diff options
| -rw-r--r-- | drivers/extcon/extcon-max77693.c | 3 | ||||
| -rw-r--r-- | drivers/input/misc/max77693-haptic.c | 1 | ||||
| -rw-r--r-- | drivers/leds/leds-max77693.c | 1 | ||||
| -rw-r--r-- | drivers/mfd/max77693.c | 31 | ||||
| -rw-r--r-- | drivers/power/max77693_charger.c | 1 | ||||
| -rw-r--r-- | drivers/regulator/max77693.c | 1 | ||||
| -rw-r--r-- | include/linux/mfd/max77693-common.h | 44 | ||||
| -rw-r--r-- | include/linux/mfd/max77693-private.h | 25 |
8 files changed, 66 insertions, 41 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 770db3a72a6a..c7bb180cfff4 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
| 25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/mfd/max77693.h> | 26 | #include <linux/mfd/max77693.h> |
| 27 | #include <linux/mfd/max77693-common.h> | ||
| 27 | #include <linux/mfd/max77693-private.h> | 28 | #include <linux/mfd/max77693-private.h> |
| 28 | #include <linux/extcon.h> | 29 | #include <linux/extcon.h> |
| 29 | #include <linux/regmap.h> | 30 | #include <linux/regmap.h> |
| @@ -1077,7 +1078,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1077 | dev_dbg(&pdev->dev, "allocate register map\n"); | 1078 | dev_dbg(&pdev->dev, "allocate register map\n"); |
| 1078 | } else { | 1079 | } else { |
| 1079 | info->max77693->regmap_muic = devm_regmap_init_i2c( | 1080 | info->max77693->regmap_muic = devm_regmap_init_i2c( |
| 1080 | info->max77693->muic, | 1081 | info->max77693->i2c_muic, |
| 1081 | &max77693_muic_regmap_config); | 1082 | &max77693_muic_regmap_config); |
| 1082 | if (IS_ERR(info->max77693->regmap_muic)) { | 1083 | if (IS_ERR(info->max77693->regmap_muic)) { |
| 1083 | ret = PTR_ERR(info->max77693->regmap_muic); | 1084 | ret = PTR_ERR(info->max77693->regmap_muic); |
diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 39e930c10ebb..4524499ea72f 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
| 25 | #include <linux/regulator/consumer.h> | 25 | #include <linux/regulator/consumer.h> |
| 26 | #include <linux/mfd/max77693.h> | 26 | #include <linux/mfd/max77693.h> |
| 27 | #include <linux/mfd/max77693-common.h> | ||
| 27 | #include <linux/mfd/max77693-private.h> | 28 | #include <linux/mfd/max77693-private.h> |
| 28 | 29 | ||
| 29 | #define MAX_MAGNITUDE_SHIFT 16 | 30 | #define MAX_MAGNITUDE_SHIFT 16 |
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c index b8b0eec7b540..df348a06d8c7 100644 --- a/drivers/leds/leds-max77693.c +++ b/drivers/leds/leds-max77693.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/led-class-flash.h> | 14 | #include <linux/led-class-flash.h> |
| 15 | #include <linux/mfd/max77693.h> | 15 | #include <linux/mfd/max77693.h> |
| 16 | #include <linux/mfd/max77693-common.h> | ||
| 16 | #include <linux/mfd/max77693-private.h> | 17 | #include <linux/mfd/max77693-private.h> |
| 17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 18 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
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: | |||
| 296 | err_intsrc: | 297 | err_intsrc: |
| 297 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); | 298 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); |
| 298 | err_irq_muic: | 299 | err_irq_muic: |
| 299 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); | 300 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg); |
| 300 | err_irq_charger: | 301 | err_irq_charger: |
| 301 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); | 302 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); |
| 302 | err_irq_topsys: | 303 | err_irq_topsys: |
| 303 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); | 304 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); |
| 304 | err_regmap: | 305 | err_regmap: |
| 305 | i2c_unregister_device(max77693->haptic); | 306 | i2c_unregister_device(max77693->i2c_haptic); |
| 306 | err_i2c_haptic: | 307 | err_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 | } |
diff --git a/drivers/power/max77693_charger.c b/drivers/power/max77693_charger.c index 754879eb59f6..060cab5ae3aa 100644 --- a/drivers/power/max77693_charger.c +++ b/drivers/power/max77693_charger.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/power_supply.h> | 20 | #include <linux/power_supply.h> |
| 21 | #include <linux/regmap.h> | 21 | #include <linux/regmap.h> |
| 22 | #include <linux/mfd/max77693.h> | 22 | #include <linux/mfd/max77693.h> |
| 23 | #include <linux/mfd/max77693-common.h> | ||
| 23 | #include <linux/mfd/max77693-private.h> | 24 | #include <linux/mfd/max77693-private.h> |
| 24 | 25 | ||
| 25 | #define MAX77693_CHARGER_NAME "max77693-charger" | 26 | #define MAX77693_CHARGER_NAME "max77693-charger" |
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c index 236851ab575a..c6ab440a74b7 100644 --- a/drivers/regulator/max77693.c +++ b/drivers/regulator/max77693.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/regulator/driver.h> | 29 | #include <linux/regulator/driver.h> |
| 30 | #include <linux/regulator/machine.h> | 30 | #include <linux/regulator/machine.h> |
| 31 | #include <linux/mfd/max77693.h> | 31 | #include <linux/mfd/max77693.h> |
| 32 | #include <linux/mfd/max77693-common.h> | ||
| 32 | #include <linux/mfd/max77693-private.h> | 33 | #include <linux/mfd/max77693-private.h> |
| 33 | #include <linux/regulator/of_regulator.h> | 34 | #include <linux/regulator/of_regulator.h> |
| 34 | #include <linux/regmap.h> | 35 | #include <linux/regmap.h> |
diff --git a/include/linux/mfd/max77693-common.h b/include/linux/mfd/max77693-common.h new file mode 100644 index 000000000000..7da4cc38e982 --- /dev/null +++ b/include/linux/mfd/max77693-common.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* | ||
| 2 | * Common data shared between Maxim 77693 and 77843 drivers | ||
| 3 | * | ||
| 4 | * Copyright (C) 2015 Samsung Electronics | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __LINUX_MFD_MAX77693_COMMON_H | ||
| 13 | #define __LINUX_MFD_MAX77693_COMMON_H | ||
| 14 | |||
| 15 | enum max77693_types { | ||
| 16 | TYPE_MAX77693_UNKNOWN, | ||
| 17 | TYPE_MAX77693, | ||
| 18 | }; | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Shared also with max77843. | ||
| 22 | */ | ||
| 23 | struct max77693_dev { | ||
| 24 | struct device *dev; | ||
| 25 | struct i2c_client *i2c; /* 0xCC , PMIC, Charger, Flash LED */ | ||
| 26 | struct i2c_client *i2c_muic; /* 0x4A , MUIC */ | ||
| 27 | struct i2c_client *i2c_haptic; /* MAX77693: 0x90 , Haptic */ | ||
| 28 | |||
| 29 | enum max77693_types type; | ||
| 30 | |||
| 31 | struct regmap *regmap; | ||
| 32 | struct regmap *regmap_muic; | ||
| 33 | struct regmap *regmap_haptic; /* Only MAX77693 */ | ||
| 34 | |||
| 35 | struct regmap_irq_chip_data *irq_data_led; | ||
| 36 | struct regmap_irq_chip_data *irq_data_topsys; | ||
| 37 | struct regmap_irq_chip_data *irq_data_chg; /* Only MAX77693 */ | ||
| 38 | struct regmap_irq_chip_data *irq_data_muic; | ||
| 39 | |||
| 40 | int irq; | ||
| 41 | }; | ||
| 42 | |||
| 43 | |||
| 44 | #endif /* __LINUX_MFD_MAX77693_COMMON_H */ | ||
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index e3c0afff38d3..8c4143c0c651 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h | |||
| @@ -529,29 +529,4 @@ enum max77693_irq_muic { | |||
| 529 | MAX77693_MUIC_IRQ_NR, | 529 | MAX77693_MUIC_IRQ_NR, |
| 530 | }; | 530 | }; |
| 531 | 531 | ||
| 532 | enum max77693_types { | ||
| 533 | TYPE_MAX77693_UNKNOWN, | ||
| 534 | TYPE_MAX77693, | ||
| 535 | }; | ||
| 536 | |||
| 537 | struct max77693_dev { | ||
| 538 | struct device *dev; | ||
| 539 | struct i2c_client *i2c; /* 0xCC , PMIC, Charger, Flash LED */ | ||
| 540 | struct i2c_client *muic; /* 0x4A , MUIC */ | ||
| 541 | struct i2c_client *haptic; /* 0x90 , Haptic */ | ||
| 542 | |||
| 543 | enum max77693_types type; | ||
| 544 | |||
| 545 | struct regmap *regmap; | ||
| 546 | struct regmap *regmap_muic; | ||
| 547 | struct regmap *regmap_haptic; | ||
| 548 | |||
| 549 | struct regmap_irq_chip_data *irq_data_led; | ||
| 550 | struct regmap_irq_chip_data *irq_data_topsys; | ||
| 551 | struct regmap_irq_chip_data *irq_data_charger; | ||
| 552 | struct regmap_irq_chip_data *irq_data_muic; | ||
| 553 | |||
| 554 | int irq; | ||
| 555 | }; | ||
| 556 | |||
| 557 | #endif /* __LINUX_MFD_MAX77693_PRIV_H */ | 532 | #endif /* __LINUX_MFD_MAX77693_PRIV_H */ |
