aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-07-14 01:41:23 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-28 14:00:16 -0400
commit38f8f43cbafe9ad07fdde31d28ed0c6933ac1e2e (patch)
treea592fb0711f523a09d6491479a75420be88df5c1 /drivers
parent78292f4ed2aa9f92eb7bef1e0e1cea14b705e378 (diff)
regulator: twl: Convert twlsmps_ops to get_voltage_sel and map_voltage
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/twl-regulator.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 3203411e9929..89d447dd5830 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -757,12 +757,11 @@ static int twl6030smps_list_voltage(struct regulator_dev *rdev, unsigned index)
757 return voltage; 757 return voltage;
758} 758}
759 759
760static int 760static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV,
761twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, 761 int max_uV)
762 unsigned int *selector)
763{ 762{
764 struct twlreg_info *info = rdev_get_drvdata(rdev); 763 struct twlreg_info *info = rdev_get_drvdata(rdev);
765 int vsel = 0, calc_uV; 764 int vsel = 0;
766 765
767 switch (info->flags) { 766 switch (info->flags) {
768 case 0: 767 case 0:
@@ -829,14 +828,16 @@ twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
829 break; 828 break;
830 } 829 }
831 830
832 calc_uV = twl6030smps_list_voltage(rdev, vsel); 831 return vsel;
833 if (calc_uV > max_uV) 832}
834 return -EINVAL;
835 833
836 *selector = vsel; 834static int twl6030smps_set_voltage_sel(struct regulator_dev *rdev,
835 unsigned int selector)
836{
837 struct twlreg_info *info = rdev_get_drvdata(rdev);
837 838
838 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS, 839 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS,
839 vsel); 840 selector);
840} 841}
841 842
842static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev) 843static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev)
@@ -848,8 +849,9 @@ static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev)
848 849
849static struct regulator_ops twlsmps_ops = { 850static struct regulator_ops twlsmps_ops = {
850 .list_voltage = twl6030smps_list_voltage, 851 .list_voltage = twl6030smps_list_voltage,
852 .map_voltage = twl6030smps_map_voltage,
851 853
852 .set_voltage = twl6030smps_set_voltage, 854 .set_voltage_sel = twl6030smps_set_voltage_sel,
853 .get_voltage_sel = twl6030smps_get_voltage_sel, 855 .get_voltage_sel = twl6030smps_get_voltage_sel,
854 856
855 .enable = twl6030reg_enable, 857 .enable = twl6030reg_enable,