diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-05-08 21:22:47 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-09 04:52:13 -0400 |
commit | 1f904fd1cdbda0930f667ad6a1b304d3e8f8334f (patch) | |
tree | 31f7074197c5356ed58f75a17d798ecebb286547 /drivers/regulator/tps65910-regulator.c | |
parent | 5d0526eade515d29769c46bc522055fa17cc536e (diff) |
regulator: tps65910: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps65910-regulator.c')
-rw-r--r-- | drivers/regulator/tps65910-regulator.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 3d9c54f8a88c..79bb0f39d793 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -620,10 +620,10 @@ static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev) | |||
620 | return -EINVAL; | 620 | return -EINVAL; |
621 | } | 621 | } |
622 | 622 | ||
623 | static int tps65910_get_voltage(struct regulator_dev *dev) | 623 | static int tps65910_get_voltage_sel(struct regulator_dev *dev) |
624 | { | 624 | { |
625 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); | 625 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); |
626 | int reg, value, id = rdev_get_id(dev), voltage = 0; | 626 | int reg, value, id = rdev_get_id(dev); |
627 | 627 | ||
628 | reg = pmic->get_ctrl_reg(id); | 628 | reg = pmic->get_ctrl_reg(id); |
629 | if (reg < 0) | 629 | if (reg < 0) |
@@ -650,9 +650,7 @@ static int tps65910_get_voltage(struct regulator_dev *dev) | |||
650 | return -EINVAL; | 650 | return -EINVAL; |
651 | } | 651 | } |
652 | 652 | ||
653 | voltage = pmic->info[id]->voltage_table[value] * 1000; | 653 | return value; |
654 | |||
655 | return voltage; | ||
656 | } | 654 | } |
657 | 655 | ||
658 | static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) | 656 | static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) |
@@ -660,10 +658,10 @@ static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) | |||
660 | return 5 * 1000 * 1000; | 658 | return 5 * 1000 * 1000; |
661 | } | 659 | } |
662 | 660 | ||
663 | static int tps65911_get_voltage(struct regulator_dev *dev) | 661 | static int tps65911_get_voltage_sel(struct regulator_dev *dev) |
664 | { | 662 | { |
665 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); | 663 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); |
666 | int step_mv, id = rdev_get_id(dev); | 664 | int id = rdev_get_id(dev); |
667 | u8 value, reg; | 665 | u8 value, reg; |
668 | 666 | ||
669 | reg = pmic->get_ctrl_reg(id); | 667 | reg = pmic->get_ctrl_reg(id); |
@@ -676,13 +674,6 @@ static int tps65911_get_voltage(struct regulator_dev *dev) | |||
676 | case TPS65911_REG_LDO4: | 674 | case TPS65911_REG_LDO4: |
677 | value &= LDO1_SEL_MASK; | 675 | value &= LDO1_SEL_MASK; |
678 | value >>= LDO_SEL_SHIFT; | 676 | value >>= LDO_SEL_SHIFT; |
679 | /* The first 5 values of the selector correspond to 1V */ | ||
680 | if (value < 5) | ||
681 | value = 0; | ||
682 | else | ||
683 | value -= 4; | ||
684 | |||
685 | step_mv = 50; | ||
686 | break; | 677 | break; |
687 | case TPS65911_REG_LDO3: | 678 | case TPS65911_REG_LDO3: |
688 | case TPS65911_REG_LDO5: | 679 | case TPS65911_REG_LDO5: |
@@ -691,23 +682,16 @@ static int tps65911_get_voltage(struct regulator_dev *dev) | |||
691 | case TPS65911_REG_LDO8: | 682 | case TPS65911_REG_LDO8: |
692 | value &= LDO3_SEL_MASK; | 683 | value &= LDO3_SEL_MASK; |
693 | value >>= LDO_SEL_SHIFT; | 684 | value >>= LDO_SEL_SHIFT; |
694 | /* The first 3 values of the selector correspond to 1V */ | ||
695 | if (value < 3) | ||
696 | value = 0; | ||
697 | else | ||
698 | value -= 2; | ||
699 | |||
700 | step_mv = 100; | ||
701 | break; | 685 | break; |
702 | case TPS65910_REG_VIO: | 686 | case TPS65910_REG_VIO: |
703 | value &= LDO_SEL_MASK; | 687 | value &= LDO_SEL_MASK; |
704 | value >>= LDO_SEL_SHIFT; | 688 | value >>= LDO_SEL_SHIFT; |
705 | return pmic->info[id]->voltage_table[value] * 1000; | 689 | break; |
706 | default: | 690 | default: |
707 | return -EINVAL; | 691 | return -EINVAL; |
708 | } | 692 | } |
709 | 693 | ||
710 | return (LDO_MIN_VOLT + value * step_mv) * 1000; | 694 | return value; |
711 | } | 695 | } |
712 | 696 | ||
713 | static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev, | 697 | static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev, |
@@ -943,7 +927,7 @@ static struct regulator_ops tps65910_ops = { | |||
943 | .enable_time = tps65910_enable_time, | 927 | .enable_time = tps65910_enable_time, |
944 | .set_mode = tps65910_set_mode, | 928 | .set_mode = tps65910_set_mode, |
945 | .get_mode = tps65910_get_mode, | 929 | .get_mode = tps65910_get_mode, |
946 | .get_voltage = tps65910_get_voltage, | 930 | .get_voltage_sel = tps65910_get_voltage_sel, |
947 | .set_voltage_sel = tps65910_set_voltage_sel, | 931 | .set_voltage_sel = tps65910_set_voltage_sel, |
948 | .list_voltage = tps65910_list_voltage, | 932 | .list_voltage = tps65910_list_voltage, |
949 | }; | 933 | }; |
@@ -955,7 +939,7 @@ static struct regulator_ops tps65911_ops = { | |||
955 | .enable_time = tps65910_enable_time, | 939 | .enable_time = tps65910_enable_time, |
956 | .set_mode = tps65910_set_mode, | 940 | .set_mode = tps65910_set_mode, |
957 | .get_mode = tps65910_get_mode, | 941 | .get_mode = tps65910_get_mode, |
958 | .get_voltage = tps65911_get_voltage, | 942 | .get_voltage_sel = tps65911_get_voltage_sel, |
959 | .set_voltage_sel = tps65911_set_voltage_sel, | 943 | .set_voltage_sel = tps65911_set_voltage_sel, |
960 | .list_voltage = tps65911_list_voltage, | 944 | .list_voltage = tps65911_list_voltage, |
961 | }; | 945 | }; |