diff options
author | Jaewon Kim <jaewon02.kim@samsung.com> | 2014-09-17 12:40:24 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-11-25 11:18:39 -0500 |
commit | efbf49224acc8ba5ac4d7ac93b5035836aebf400 (patch) | |
tree | 7be32f9fd2dec8fd934a9cb19781b532b22ed4ea /drivers/mfd/max77693.c | |
parent | 11d0d30093301169833aedfc130d9e4abe621be1 (diff) |
mfd: max77693: Initialize haptic register map
This patch add regmap_haptic initialization to use haptic register map
in haptic device driver.
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/max77693.c')
-rw-r--r-- | drivers/mfd/max77693.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index cf008f45968c..09bf664ac2e0 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -147,6 +147,12 @@ static const struct regmap_irq_chip max77693_muic_irq_chip = { | |||
147 | .num_irqs = ARRAY_SIZE(max77693_muic_irqs), | 147 | .num_irqs = ARRAY_SIZE(max77693_muic_irqs), |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static const struct regmap_config max77693_regmap_haptic_config = { | ||
151 | .reg_bits = 8, | ||
152 | .val_bits = 8, | ||
153 | .max_register = MAX77693_HAPTIC_REG_END, | ||
154 | }; | ||
155 | |||
150 | static int max77693_i2c_probe(struct i2c_client *i2c, | 156 | static int max77693_i2c_probe(struct i2c_client *i2c, |
151 | const struct i2c_device_id *id) | 157 | const struct i2c_device_id *id) |
152 | { | 158 | { |
@@ -196,6 +202,15 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
196 | } | 202 | } |
197 | i2c_set_clientdata(max77693->haptic, max77693); | 203 | i2c_set_clientdata(max77693->haptic, max77693); |
198 | 204 | ||
205 | max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic, | ||
206 | &max77693_regmap_haptic_config); | ||
207 | if (IS_ERR(max77693->regmap_haptic)) { | ||
208 | ret = PTR_ERR(max77693->regmap_haptic); | ||
209 | dev_err(max77693->dev, | ||
210 | "failed to initialize haptic register map: %d\n", ret); | ||
211 | goto err_regmap; | ||
212 | } | ||
213 | |||
199 | /* | 214 | /* |
200 | * Initialize register map for MUIC device because use regmap-muic | 215 | * Initialize register map for MUIC device because use regmap-muic |
201 | * instance of MUIC device when irq of max77693 is initialized | 216 | * instance of MUIC device when irq of max77693 is initialized |
@@ -207,7 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
207 | ret = PTR_ERR(max77693->regmap_muic); | 222 | ret = PTR_ERR(max77693->regmap_muic); |
208 | dev_err(max77693->dev, | 223 | dev_err(max77693->dev, |
209 | "failed to allocate register map: %d\n", ret); | 224 | "failed to allocate register map: %d\n", ret); |
210 | goto err_regmap_muic; | 225 | goto err_regmap; |
211 | } | 226 | } |
212 | 227 | ||
213 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, | 228 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, |
@@ -217,7 +232,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
217 | &max77693->irq_data_led); | 232 | &max77693->irq_data_led); |
218 | if (ret) { | 233 | if (ret) { |
219 | dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); | 234 | dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); |
220 | goto err_regmap_muic; | 235 | goto err_regmap; |
221 | } | 236 | } |
222 | 237 | ||
223 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, | 238 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, |
@@ -268,7 +283,7 @@ err_irq_charger: | |||
268 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); | 283 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); |
269 | err_irq_topsys: | 284 | err_irq_topsys: |
270 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); | 285 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); |
271 | err_regmap_muic: | 286 | err_regmap: |
272 | i2c_unregister_device(max77693->haptic); | 287 | i2c_unregister_device(max77693->haptic); |
273 | err_i2c_haptic: | 288 | err_i2c_haptic: |
274 | i2c_unregister_device(max77693->muic); | 289 | i2c_unregister_device(max77693->muic); |