aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/s5m8767.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-10-09 21:41:36 -0400
committerMark Brown <broonie@linaro.org>2013-10-24 06:11:14 -0400
commit04f9f068a619cc45a8e656e7121df2c772fa14ba (patch)
treebe9a1afd940b4af8f38c57a311fb56f3349f8931 /drivers/regulator/s5m8767.c
parent033054e8603036e43ddfad3155b3e5b78ed49e04 (diff)
regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4
The s5m8767 regulator driver parse always the voltage table of buck2/3/4. If gpio_dvs feature isn't used and dts haven't included the voltage table of buck2/3/4, s5m8767 regulator driver return error and file probe state. This patch check only voltage table of buck on s5m8767_pmic_dt_parse_pdata() if buck[2-4]_gpiodvs is true. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index cb6cdb3c0bdc..29999c042d69 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -522,7 +522,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
522 struct device_node *pmic_np, *regulators_np, *reg_np; 522 struct device_node *pmic_np, *regulators_np, *reg_np;
523 struct sec_regulator_data *rdata; 523 struct sec_regulator_data *rdata;
524 struct sec_opmode_data *rmode; 524 struct sec_opmode_data *rmode;
525 unsigned int i, dvs_voltage_nr = 1, ret; 525 unsigned int i, dvs_voltage_nr = 8, ret;
526 526
527 pmic_np = iodev->dev->of_node; 527 pmic_np = iodev->dev->of_node;
528 if (!pmic_np) { 528 if (!pmic_np) {
@@ -586,15 +586,39 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
586 rmode++; 586 rmode++;
587 } 587 }
588 588
589 if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) 589 if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) {
590 pdata->buck2_gpiodvs = true; 590 pdata->buck2_gpiodvs = true;
591 591
592 if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL)) 592 if (of_property_read_u32_array(pmic_np,
593 "s5m8767,pmic-buck2-dvs-voltage",
594 pdata->buck2_voltage, dvs_voltage_nr)) {
595 dev_err(iodev->dev, "buck2 voltages not specified\n");
596 return -EINVAL;
597 }
598 }
599
600 if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL)) {
593 pdata->buck3_gpiodvs = true; 601 pdata->buck3_gpiodvs = true;
594 602
595 if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL)) 603 if (of_property_read_u32_array(pmic_np,
604 "s5m8767,pmic-buck3-dvs-voltage",
605 pdata->buck3_voltage, dvs_voltage_nr)) {
606 dev_err(iodev->dev, "buck3 voltages not specified\n");
607 return -EINVAL;
608 }
609 }
610
611 if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL)) {
596 pdata->buck4_gpiodvs = true; 612 pdata->buck4_gpiodvs = true;
597 613
614 if (of_property_read_u32_array(pmic_np,
615 "s5m8767,pmic-buck4-dvs-voltage",
616 pdata->buck4_voltage, dvs_voltage_nr)) {
617 dev_err(iodev->dev, "buck4 voltages not specified\n");
618 return -EINVAL;
619 }
620 }
621
598 if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || 622 if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
599 pdata->buck4_gpiodvs) { 623 pdata->buck4_gpiodvs) {
600 ret = s5m8767_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); 624 ret = s5m8767_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np);
@@ -612,34 +636,12 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
612 "invalid value for default dvs index, use 0\n"); 636 "invalid value for default dvs index, use 0\n");
613 } 637 }
614 } 638 }
615 dvs_voltage_nr = 8;
616 } 639 }
617 640
618 ret = s5m8767_pmic_dt_parse_ds_gpio(iodev, pdata, pmic_np); 641 ret = s5m8767_pmic_dt_parse_ds_gpio(iodev, pdata, pmic_np);
619 if (ret) 642 if (ret)
620 return -EINVAL; 643 return -EINVAL;
621 644
622 if (of_property_read_u32_array(pmic_np,
623 "s5m8767,pmic-buck2-dvs-voltage",
624 pdata->buck2_voltage, dvs_voltage_nr)) {
625 dev_err(iodev->dev, "buck2 voltages not specified\n");
626 return -EINVAL;
627 }
628
629 if (of_property_read_u32_array(pmic_np,
630 "s5m8767,pmic-buck3-dvs-voltage",
631 pdata->buck3_voltage, dvs_voltage_nr)) {
632 dev_err(iodev->dev, "buck3 voltages not specified\n");
633 return -EINVAL;
634 }
635
636 if (of_property_read_u32_array(pmic_np,
637 "s5m8767,pmic-buck4-dvs-voltage",
638 pdata->buck4_voltage, dvs_voltage_nr)) {
639 dev_err(iodev->dev, "buck4 voltages not specified\n");
640 return -EINVAL;
641 }
642
643 if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL)) 645 if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL))
644 pdata->buck2_ramp_enable = true; 646 pdata->buck2_ramp_enable = true;
645 647