Commit d1a82001 authored by Lee Jones's avatar Lee Jones Committed by Mark Brown

regulator: ab8500-ext: New driver to control external regulators

The ABx500 is capable of controlling three external regulator supplies.
Most commonly on and off are supported, but if an external regulator
chipset or power supply supports high-power and low-power mode settings,
we can control those too.
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent cc40dc29
...@@ -12,7 +12,7 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o ...@@ -12,7 +12,7 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o ab8500-ext.o
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
......
This diff is collapsed.
...@@ -947,6 +947,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev) ...@@ -947,6 +947,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
return err; return err;
} }
/* register external regulators (before Vaux1, 2 and 3) */
err = ab8500_ext_regulator_init(pdev);
if (err)
return err;
/* register all regulators */ /* register all regulators */
for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) {
err = ab8500_regulator_register(pdev, &pdata->regulator[i], i, NULL); err = ab8500_regulator_register(pdev, &pdata->regulator[i], i, NULL);
...@@ -959,7 +964,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) ...@@ -959,7 +964,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
static int ab8500_regulator_remove(struct platform_device *pdev) static int ab8500_regulator_remove(struct platform_device *pdev)
{ {
int i; int i, err;
for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) {
struct ab8500_regulator_info *info = NULL; struct ab8500_regulator_info *info = NULL;
...@@ -971,6 +976,11 @@ static int ab8500_regulator_remove(struct platform_device *pdev) ...@@ -971,6 +976,11 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
regulator_unregister(info->regulator); regulator_unregister(info->regulator);
} }
/* remove external regulators (after Vaux1, 2 and 3) */
err = ab8500_ext_regulator_exit(pdev);
if (err)
return err;
return 0; return 0;
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifndef __LINUX_MFD_AB8500_REGULATOR_H #ifndef __LINUX_MFD_AB8500_REGULATOR_H
#define __LINUX_MFD_AB8500_REGULATOR_H #define __LINUX_MFD_AB8500_REGULATOR_H
#include <linux/platform_device.h>
/* AB8500 regulators */ /* AB8500 regulators */
enum ab8500_regulator_id { enum ab8500_regulator_id {
AB8500_LDO_AUX1, AB8500_LDO_AUX1,
...@@ -140,11 +142,37 @@ enum ab9540_regulator_reg { ...@@ -140,11 +142,37 @@ enum ab9540_regulator_reg {
AB9540_NUM_REGULATOR_REGISTERS, AB9540_NUM_REGULATOR_REGISTERS,
}; };
/* AB8500 external regulators */
enum ab8500_ext_regulator_id {
AB8500_EXT_SUPPLY1,
AB8500_EXT_SUPPLY2,
AB8500_EXT_SUPPLY3,
AB8500_NUM_EXT_REGULATORS,
};
/* AB8500 regulator platform data */
struct ab8500_regulator_platform_data { struct ab8500_regulator_platform_data {
int num_reg_init; int num_reg_init;
struct ab8500_regulator_reg_init *reg_init; struct ab8500_regulator_reg_init *reg_init;
int num_regulator; int num_regulator;
struct regulator_init_data *regulator; struct regulator_init_data *regulator;
int num_ext_regulator;
struct regulator_init_data *ext_regulator;
}; };
/* AB8500 external regulator functions (internal) */
#ifdef CONFIG_REGULATOR_AB8500_EXT
int ab8500_ext_regulator_init(struct platform_device *pdev);
int ab8500_ext_regulator_exit(struct platform_device *pdev);
#else
inline int ab8500_ext_regulator_init(struct platform_device *pdev)
{
return 0;
}
inline int ab8500_ext_regulator_exit(struct platform_device *pdev)
{
return 0;
}
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment