aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2012-09-17 00:19:07 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-19 06:39:13 -0400
commitff13e9e256d49a478b34da3dc380af41e0b9175f (patch)
tree2fbcc51221cd758c1805f9d2778084cc4530c8d0 /drivers
parente7a7810ae08bfca5cb2cad8a8d55c16f299cc3fe (diff)
mfd: 88pm860x: Avoid to check resource for preg regulator
Since PREG regulator is the only one regulator in 88PM8606, and other regulators are in 88PM8607. Checking resource as identifying regulator is not a good way. We can use NULL resource to indentify PREG regulator. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/88pm860x-core.c8
-rw-r--r--drivers/regulator/88pm8607.c32
2 files changed, 20 insertions, 20 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index ad966c413087..8bf7622300f4 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -150,10 +150,6 @@ static struct resource charger_resources[] __devinitdata = {
150 {PM8607_IRQ_VCHG, PM8607_IRQ_VCHG, "vchg voltage", IORESOURCE_IRQ,}, 150 {PM8607_IRQ_VCHG, PM8607_IRQ_VCHG, "vchg voltage", IORESOURCE_IRQ,},
151}; 151};
152 152
153static struct resource preg_resources[] __devinitdata = {
154 {PM8606_ID_PREG, PM8606_ID_PREG, "preg", IORESOURCE_REG,},
155};
156
157static struct resource rtc_resources[] __devinitdata = { 153static struct resource rtc_resources[] __devinitdata = {
158 {PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ,}, 154 {PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ,},
159}; 155};
@@ -960,10 +956,8 @@ static void __devinit device_power_init(struct pm860x_chip *chip,
960 956
961 power_devs[2].platform_data = &preg_init_data; 957 power_devs[2].platform_data = &preg_init_data;
962 power_devs[2].pdata_size = sizeof(struct regulator_init_data); 958 power_devs[2].pdata_size = sizeof(struct regulator_init_data);
963 power_devs[2].num_resources = ARRAY_SIZE(preg_resources);
964 power_devs[2].resources = &preg_resources[0],
965 ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1, 959 ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1,
966 &preg_resources[0], chip->irq_base, NULL); 960 NULL, chip->irq_base, NULL);
967 if (ret < 0) 961 if (ret < 0)
968 dev_err(chip->dev, "Failed to add preg subdev\n"); 962 dev_err(chip->dev, "Failed to add preg subdev\n");
969} 963}
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index d34bd8c5ad08..f96fbe38ff6f 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -358,7 +358,9 @@ static struct pm8607_regulator_info pm8607_regulator_info[] = {
358 PM8607_LDO(12, LDO12, 0, SUPPLIES_EN12, 5), 358 PM8607_LDO(12, LDO12, 0, SUPPLIES_EN12, 5),
359 PM8607_LDO(13, VIBRATOR_SET, 1, VIBRATOR_SET, 0), 359 PM8607_LDO(13, VIBRATOR_SET, 1, VIBRATOR_SET, 0),
360 PM8607_LDO(14, LDO14, 0, SUPPLIES_EN12, 6), 360 PM8607_LDO(14, LDO14, 0, SUPPLIES_EN12, 6),
361};
361 362
363static struct pm8607_regulator_info pm8606_regulator_info[] = {
362 PM8606_PREG(PREREGULATORB, 5), 364 PM8606_PREG(PREREGULATORB, 5),
363}; 365};
364 366
@@ -372,19 +374,23 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
372 int i; 374 int i;
373 375
374 res = platform_get_resource(pdev, IORESOURCE_REG, 0); 376 res = platform_get_resource(pdev, IORESOURCE_REG, 0);
375 if (res == NULL) { 377 if (res) {
376 dev_err(&pdev->dev, "No REG resource!\n"); 378 /* There're resources in 88PM8607 regulator driver */
377 return -EINVAL; 379 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
378 } 380 info = &pm8607_regulator_info[i];
379 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) { 381 if (info->desc.vsel_reg == res->start)
380 info = &pm8607_regulator_info[i]; 382 break;
381 if (info->desc.vsel_reg == res->start) 383 }
382 break; 384 if (i == ARRAY_SIZE(pm8607_regulator_info)) {
383 } 385 dev_err(&pdev->dev, "Failed to find regulator %llu\n",
384 if (i == ARRAY_SIZE(pm8607_regulator_info)) { 386 (unsigned long long)res->start);
385 dev_err(&pdev->dev, "Failed to find regulator %llu\n", 387 return -EINVAL;
386 (unsigned long long)res->start); 388 }
387 return -EINVAL; 389 } else {
390 /* There's no resource in 88PM8606 PREG regulator driver */
391 info = &pm8606_regulator_info[0];
392 /* i is used to check regulator ID */
393 i = -1;
388 } 394 }
389 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; 395 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
390 info->i2c_8606 = (chip->id == CHIP_PM8607) ? chip->companion : 396 info->i2c_8606 = (chip->id == CHIP_PM8607) ? chip->companion :