aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2011-05-06 05:21:23 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-05-26 13:45:38 -0400
commit586e1a1763d34bd256f3f1e77293d8386e4871d2 (patch)
treec02a3a61e0974e669fb58c690d1988c061b28e4e /drivers/mfd
parentebf9988ecad6727e5ae950fc2c72b963a1bfc0fe (diff)
mfd: Avoid to use constraint name in 88pm860x regulator driver
Avoid to use constraint name in regulator driver. So use regulator id is used instead in platform driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/88pm860x-core.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 91962ef38c08..17dfe9bb6d27 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -578,7 +578,7 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip,
578{ 578{
579 struct regulator_init_data *initdata; 579 struct regulator_init_data *initdata;
580 int ret; 580 int ret;
581 int i, j; 581 int i, seq;
582 582
583 if ((pdata == NULL) || (pdata->regulator == NULL)) 583 if ((pdata == NULL) || (pdata->regulator == NULL))
584 return; 584 return;
@@ -586,40 +586,21 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip,
586 if (pdata->num_regulators > ARRAY_SIZE(regulator_devs)) 586 if (pdata->num_regulators > ARRAY_SIZE(regulator_devs))
587 pdata->num_regulators = ARRAY_SIZE(regulator_devs); 587 pdata->num_regulators = ARRAY_SIZE(regulator_devs);
588 588
589 for (i = 0, j = -1; i < pdata->num_regulators; i++) { 589 for (i = 0, seq = -1; i < pdata->num_regulators; i++) {
590 initdata = &pdata->regulator[i]; 590 initdata = &pdata->regulator[i];
591 if (strstr(initdata->constraints.name, "BUCK")) { 591 seq = *(unsigned int *)initdata->driver_data;
592 sscanf(initdata->constraints.name, "BUCK%d", &j); 592 if ((seq < 0) || (seq > PM8607_ID_RG_MAX)) {
593 /* BUCK1 ~ BUCK3 */ 593 dev_err(chip->dev, "Wrong ID(%d) on regulator(%s)\n",
594 if ((j < 1) || (j > 3)) { 594 seq, initdata->constraints.name);
595 dev_err(chip->dev, "Failed to add constraint "
596 "(%s)\n", initdata->constraints.name);
597 goto out;
598 }
599 j = (j - 1) + PM8607_ID_BUCK1;
600 }
601 if (strstr(initdata->constraints.name, "LDO")) {
602 sscanf(initdata->constraints.name, "LDO%d", &j);
603 /* LDO1 ~ LDO15 */
604 if ((j < 1) || (j > 15)) {
605 dev_err(chip->dev, "Failed to add constraint "
606 "(%s)\n", initdata->constraints.name);
607 goto out;
608 }
609 j = (j - 1) + PM8607_ID_LDO1;
610 }
611 if (j == -1) {
612 dev_err(chip->dev, "Failed to add constraint (%s)\n",
613 initdata->constraints.name);
614 goto out; 595 goto out;
615 } 596 }
616 regulator_devs[i].platform_data = &pdata->regulator[i]; 597 regulator_devs[i].platform_data = &pdata->regulator[i];
617 regulator_devs[i].pdata_size = sizeof(struct regulator_init_data); 598 regulator_devs[i].pdata_size = sizeof(struct regulator_init_data);
618 regulator_devs[i].num_resources = 1; 599 regulator_devs[i].num_resources = 1;
619 regulator_devs[i].resources = &regulator_resources[j]; 600 regulator_devs[i].resources = &regulator_resources[seq];
620 601
621 ret = mfd_add_devices(chip->dev, 0, &regulator_devs[i], 1, 602 ret = mfd_add_devices(chip->dev, 0, &regulator_devs[i], 1,
622 &regulator_resources[j], 0); 603 &regulator_resources[seq], 0);
623 if (ret < 0) { 604 if (ret < 0) {
624 dev_err(chip->dev, "Failed to add regulator subdev\n"); 605 dev_err(chip->dev, "Failed to add regulator subdev\n");
625 goto out; 606 goto out;