Commit 51acdb61 authored by Haojian Zhuang's avatar Haojian Zhuang Committed by Samuel Ortiz

mfd: max8925: Remove array in regulator platform data

Remove array in parent's platform data. Use struct regulator_init_data
as regulator device's platform data directly. So a lot of pdata are
added into parent's platform data. And voltage out register offset
is used as IORESOURCE_REG to distinguish different regualtor devices.
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 63b501e2
This diff is collapsed.
......@@ -214,37 +214,36 @@ static struct max8925_regulator_info max8925_regulator_info[] = {
MAX8925_LDO(20, 750, 3900, 50),
};
static struct max8925_regulator_info * __devinit find_regulator_info(int id)
{
struct max8925_regulator_info *ri;
int i;
for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) {
ri = &max8925_regulator_info[i];
if (ri->desc.id == id)
return ri;
}
return NULL;
}
static int __devinit max8925_regulator_probe(struct platform_device *pdev)
{
struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct max8925_platform_data *pdata = chip->dev->platform_data;
struct regulator_init_data *pdata = pdev->dev.platform_data;
struct regulator_config config = { };
struct max8925_regulator_info *ri;
struct resource *res;
struct regulator_dev *rdev;
int i;
ri = find_regulator_info(pdev->id);
if (ri == NULL) {
dev_err(&pdev->dev, "invalid regulator ID specified\n");
res = platform_get_resource(pdev, IORESOURCE_REG, 0);
if (!res) {
dev_err(&pdev->dev, "No REG resource!\n");
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) {
ri = &max8925_regulator_info[i];
if (ri->vol_reg == res->start)
break;
}
if (i == ARRAY_SIZE(max8925_regulator_info)) {
dev_err(&pdev->dev, "Failed to find regulator %llu\n",
(unsigned long long)res->start);
return -EINVAL;
}
ri->i2c = chip->i2c;
ri->chip = chip;
config.dev = &pdev->dev;
config.init_data = pdata->regulator[pdev->id];
config.init_data = pdata;
config.driver_data = ri;
rdev = regulator_register(&ri->desc, &config);
......
......@@ -158,8 +158,6 @@ enum {
#define TSC_IRQ_MASK (0x03)
#define RTC_IRQ_MASK (0x0c)
#define MAX8925_MAX_REGULATOR (23)
#define MAX8925_NAME_SIZE (32)
/* IRQ definitions */
......@@ -236,7 +234,29 @@ struct max8925_platform_data {
struct max8925_backlight_pdata *backlight;
struct max8925_touch_pdata *touch;
struct max8925_power_pdata *power;
struct regulator_init_data *regulator[MAX8925_MAX_REGULATOR];
struct regulator_init_data *sd1;
struct regulator_init_data *sd2;
struct regulator_init_data *sd3;
struct regulator_init_data *ldo1;
struct regulator_init_data *ldo2;
struct regulator_init_data *ldo3;
struct regulator_init_data *ldo4;
struct regulator_init_data *ldo5;
struct regulator_init_data *ldo6;
struct regulator_init_data *ldo7;
struct regulator_init_data *ldo8;
struct regulator_init_data *ldo9;
struct regulator_init_data *ldo10;
struct regulator_init_data *ldo11;
struct regulator_init_data *ldo12;
struct regulator_init_data *ldo13;
struct regulator_init_data *ldo14;
struct regulator_init_data *ldo15;
struct regulator_init_data *ldo16;
struct regulator_init_data *ldo17;
struct regulator_init_data *ldo18;
struct regulator_init_data *ldo19;
struct regulator_init_data *ldo20;
int irq_base;
int tsc_irq;
......
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