aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/88pm8607.c
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/regulator/88pm8607.c
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/regulator/88pm8607.c')
-rw-r--r--drivers/regulator/88pm8607.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 784ea7724c7a..1904be9149af 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -398,32 +398,33 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
398{ 398{
399 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 399 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
400 struct pm8607_regulator_info *info = NULL; 400 struct pm8607_regulator_info *info = NULL;
401 struct regulator_init_data *pdata; 401 struct regulator_init_data *pdata = pdev->dev.platform_data;
402 struct resource *res;
402 int i; 403 int i;
403 404
404 pdata = pdev->dev.platform_data; 405 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
405 if (pdata == NULL) 406 if (res == NULL) {
407 dev_err(&pdev->dev, "No I/O resource!\n");
406 return -EINVAL; 408 return -EINVAL;
407 409 }
408 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) { 410 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
409 info = &pm8607_regulator_info[i]; 411 info = &pm8607_regulator_info[i];
410 if (!strcmp(info->desc.name, pdata->constraints.name)) 412 if (info->desc.id == res->start)
411 break; 413 break;
412 } 414 }
413 if (i > ARRAY_SIZE(pm8607_regulator_info)) { 415 if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
414 dev_err(&pdev->dev, "Failed to find regulator %s\n", 416 dev_err(&pdev->dev, "Failed to find regulator %d\n",
415 pdata->constraints.name); 417 res->start);
416 return -EINVAL; 418 return -EINVAL;
417 } 419 }
418
419 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; 420 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
420 info->chip = chip; 421 info->chip = chip;
421 422
422 /* check DVC ramp slope double */ 423 /* check DVC ramp slope double */
423 if (!strcmp(info->desc.name, "BUCK3")) 424 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double)
424 if (info->chip->buck3_double) 425 info->slope_double = 1;
425 info->slope_double = 1;
426 426
427 /* replace driver_data with info */
427 info->regulator = regulator_register(&info->desc, &pdev->dev, 428 info->regulator = regulator_register(&info->desc, &pdev->dev,
428 pdata, info); 429 pdata, info);
429 if (IS_ERR(info->regulator)) { 430 if (IS_ERR(info->regulator)) {