summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max77693.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski.k@gmail.com>2015-07-15 08:59:50 -0400
committerMark Brown <broonie@kernel.org>2015-07-16 16:39:30 -0400
commit61b305cd2ae747b8c9a2e4467dea2575a390162c (patch)
treef1684ed3322b06b803027fc200c250f2806d8e9e /drivers/mfd/max77693.c
parent5b5e771fb711f95da859bf6be9fba4bc9919b5d5 (diff)
drivers: max77693: Move state container to common header
This prepares for merging some of the drivers between max77693 and max77843 so the child MFD driver can be attached to any parent MFD main driver. Move the state container to common header file. Additionally add consistent 'i2c' prefixes to its members (of 'struct i2c_client' type). Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/mfd/max77693.c')
-rw-r--r--drivers/mfd/max77693.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index cb14afa97e6f..67bc53fdc389 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -33,6 +33,7 @@
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <linux/mfd/core.h> 34#include <linux/mfd/core.h>
35#include <linux/mfd/max77693.h> 35#include <linux/mfd/max77693.h>
36#include <linux/mfd/max77693-common.h>
36#include <linux/mfd/max77693-private.h> 37#include <linux/mfd/max77693-private.h>
37#include <linux/regulator/machine.h> 38#include <linux/regulator/machine.h>
38#include <linux/regmap.h> 39#include <linux/regmap.h>
@@ -193,22 +194,22 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
193 } else 194 } else
194 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); 195 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
195 196
196 max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); 197 max77693->i2c_muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
197 if (!max77693->muic) { 198 if (!max77693->i2c_muic) {
198 dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n"); 199 dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n");
199 return -ENODEV; 200 return -ENODEV;
200 } 201 }
201 i2c_set_clientdata(max77693->muic, max77693); 202 i2c_set_clientdata(max77693->i2c_muic, max77693);
202 203
203 max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 204 max77693->i2c_haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
204 if (!max77693->haptic) { 205 if (!max77693->i2c_haptic) {
205 dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n"); 206 dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n");
206 ret = -ENODEV; 207 ret = -ENODEV;
207 goto err_i2c_haptic; 208 goto err_i2c_haptic;
208 } 209 }
209 i2c_set_clientdata(max77693->haptic, max77693); 210 i2c_set_clientdata(max77693->i2c_haptic, max77693);
210 211
211 max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic, 212 max77693->regmap_haptic = devm_regmap_init_i2c(max77693->i2c_haptic,
212 &max77693_regmap_haptic_config); 213 &max77693_regmap_haptic_config);
213 if (IS_ERR(max77693->regmap_haptic)) { 214 if (IS_ERR(max77693->regmap_haptic)) {
214 ret = PTR_ERR(max77693->regmap_haptic); 215 ret = PTR_ERR(max77693->regmap_haptic);
@@ -222,7 +223,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
222 * instance of MUIC device when irq of max77693 is initialized 223 * instance of MUIC device when irq of max77693 is initialized
223 * before call max77693-muic probe() function. 224 * before call max77693-muic probe() function.
224 */ 225 */
225 max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic, 226 max77693->regmap_muic = devm_regmap_init_i2c(max77693->i2c_muic,
226 &max77693_regmap_muic_config); 227 &max77693_regmap_muic_config);
227 if (IS_ERR(max77693->regmap_muic)) { 228 if (IS_ERR(max77693->regmap_muic)) {
228 ret = PTR_ERR(max77693->regmap_muic); 229 ret = PTR_ERR(max77693->regmap_muic);
@@ -255,7 +256,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
255 IRQF_ONESHOT | IRQF_SHARED | 256 IRQF_ONESHOT | IRQF_SHARED |
256 IRQF_TRIGGER_FALLING, 0, 257 IRQF_TRIGGER_FALLING, 0,
257 &max77693_charger_irq_chip, 258 &max77693_charger_irq_chip,
258 &max77693->irq_data_charger); 259 &max77693->irq_data_chg);
259 if (ret) { 260 if (ret) {
260 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); 261 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
261 goto err_irq_charger; 262 goto err_irq_charger;
@@ -296,15 +297,15 @@ err_mfd:
296err_intsrc: 297err_intsrc:
297 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 298 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
298err_irq_muic: 299err_irq_muic:
299 regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); 300 regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
300err_irq_charger: 301err_irq_charger:
301 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); 302 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
302err_irq_topsys: 303err_irq_topsys:
303 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); 304 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
304err_regmap: 305err_regmap:
305 i2c_unregister_device(max77693->haptic); 306 i2c_unregister_device(max77693->i2c_haptic);
306err_i2c_haptic: 307err_i2c_haptic:
307 i2c_unregister_device(max77693->muic); 308 i2c_unregister_device(max77693->i2c_muic);
308 return ret; 309 return ret;
309} 310}
310 311
@@ -315,12 +316,12 @@ static int max77693_i2c_remove(struct i2c_client *i2c)
315 mfd_remove_devices(max77693->dev); 316 mfd_remove_devices(max77693->dev);
316 317
317 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 318 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
318 regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); 319 regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
319 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); 320 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
320 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); 321 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
321 322
322 i2c_unregister_device(max77693->muic); 323 i2c_unregister_device(max77693->i2c_muic);
323 i2c_unregister_device(max77693->haptic); 324 i2c_unregister_device(max77693->i2c_haptic);
324 325
325 return 0; 326 return 0;
326} 327}