aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-24 06:11:40 -0400
committerMark Brown <broonie@linaro.org>2013-10-24 06:11:40 -0400
commit67471b6a242b182dd44afbd3848fcfe4065c6445 (patch)
tree8ae87d3377312868bfd0add322204839ffd2e5d6
parent22eb85adaf0613acdbba2093b6ecc233b3f9ae41 (diff)
parent04f9f068a619cc45a8e656e7121df2c772fa14ba (diff)
Merge remote-tracking branch 'regulator/topic/s5m8767' into regulator-next
-rw-r--r--drivers/regulator/s5m8767.c62
1 files changed, 40 insertions, 22 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 2297fdf9ba7e..cbf91e25cf7f 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,32 +636,26 @@ 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, 645 if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL))
623 "s5m8767,pmic-buck2-dvs-voltage", 646 pdata->buck2_ramp_enable = true;
624 pdata->buck2_voltage, dvs_voltage_nr)) {
625 dev_err(iodev->dev, "buck2 voltages not specified\n");
626 return -EINVAL;
627 }
628 647
629 if (of_property_read_u32_array(pmic_np, 648 if (of_get_property(pmic_np, "s5m8767,pmic-buck3-ramp-enable", NULL))
630 "s5m8767,pmic-buck3-dvs-voltage", 649 pdata->buck3_ramp_enable = true;
631 pdata->buck3_voltage, dvs_voltage_nr)) {
632 dev_err(iodev->dev, "buck3 voltages not specified\n");
633 return -EINVAL;
634 }
635 650
636 if (of_property_read_u32_array(pmic_np, 651 if (of_get_property(pmic_np, "s5m8767,pmic-buck4-ramp-enable", NULL))
637 "s5m8767,pmic-buck4-dvs-voltage", 652 pdata->buck4_ramp_enable = true;
638 pdata->buck4_voltage, dvs_voltage_nr)) { 653
639 dev_err(iodev->dev, "buck4 voltages not specified\n"); 654 if (pdata->buck2_ramp_enable || pdata->buck3_ramp_enable
640 return -EINVAL; 655 || pdata->buck4_ramp_enable) {
656 if (of_property_read_u32(pmic_np, "s5m8767,pmic-buck-ramp-delay",
657 &pdata->buck_ramp_delay))
658 pdata->buck_ramp_delay = 0;
641 } 659 }
642 660
643 return 0; 661 return 0;