mfd: add subdevs in max8925
PATCH 1/1 mfd: add subdevs in max8925
Add subdevs in MAX8925. MAX8925 includes regulator, backlight and touch components.
--- drivers/mfd/Kconfig | 1 + drivers/mfd/max8925-core.c | 142 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/max8925.h | 96 +++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 0 deletions(-)
drivers/mfd/Kconfig +1 -0
@@ -163,6 +163,7 @@ config PMIC_DA903X config MFD_MAX8925 tristate "Maxim Semiconductor MAX8925 PMIC Support" depends on I2C + select MFD_CORE help Say yes here to support for Maxim Semiconductor MAX8925. This is a Power Management IC. This driver provies common support for
drivers/mfd/max8925-core.c +103 -0
109 lines not on this page · raw message
max8925_chip *chip,
goto out;
}
chip->chip_irq = i2c->irq;
+
+ ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[0],
+ ARRAY_SIZE(regulator_devs),
+ ®ulator_resources[0], 0);
+ if (ret < 0) {
+ dev_err(chip->dev, "Failed to add regulator subdev\n");
+ goto out_irq;
+ }
+
+ if (pdata && pdata->backlight) {
+ ret = mfd_add_devices(chip->dev, 0, &backlight_devs[0],
+ ARRAY_SIZE(backlight_devs),
+ &backlight_resources[0], 0);
+ if (ret < 0) {
+ dev_err(chip->dev, "Failed to add backlight subdev\n");
+ goto out_dev;
+ }
+ }
+ return 0;
+out_dev:
+ mfd_remove_devices(chip->dev);
+out_irq:
+ if (chip->chip_irq)
+ free_irq(chip->chip_irq, chip);
out:
return ret;
}
@@ -227,6 +354,20 @@ static int __devinit device_adc_init(struct max8925_chip *chip,
goto out;
}
chip->chip_irq = i2c->irq;
+
+ if (pdata && pdata->touch) {
+ ret = mfd_add_devices(chip->dev, 0, &touch_devs[0],
+ ARRAY_SIZE(touch_devs),
+ &touch_resources[0], 0);
+ if (ret < 0) {
+ dev_err(chip->dev, "Failed to add touch subdev\n");
+ goto out_irq;
+ }
+ }
+ return 0;
+out_irq:
+ if (chip->chip_irq)
+ free_irq(chip->chip_irq, chip);
out:
return ret;
}
@@ -249,6 +390,7 @@ void max8925_device_exit(struct max8925_chip *chip)
{
if (chip->chip_irq >= 0)
free_irq(chip->chip_irq, chip);
+ mfd_remove_devices(chip->dev);
}
MODULE_DESCRIPTION("PMIC Driver for Maxim MAX8925");
include/linux/mfd/max8925.h +96 -0
127 lines not on this page · raw message
Signature · 1 line
1.5.6.5