Commit 38f8f43cbafe9ad07fdde31d28ed0c6933ac1e2e
Committed by
Mark Brown
1 parent
78292f4ed2
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 13 additions and 11 deletions Side-by-side Diff
drivers/regulator/twl-regulator.c
... | ... | @@ -757,12 +757,11 @@ |
757 | 757 | return voltage; |
758 | 758 | } |
759 | 759 | |
760 | -static int | |
761 | -twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, | |
762 | - unsigned int *selector) | |
760 | +static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV, | |
761 | + int max_uV) | |
763 | 762 | { |
764 | - struct twlreg_info *info = rdev_get_drvdata(rdev); | |
765 | - int vsel = 0, calc_uV; | |
763 | + struct twlreg_info *info = rdev_get_drvdata(rdev); | |
764 | + int vsel = 0; | |
766 | 765 | |
767 | 766 | switch (info->flags) { |
768 | 767 | case 0: |
769 | 768 | |
770 | 769 | |
... | ... | @@ -829,14 +828,16 @@ |
829 | 828 | break; |
830 | 829 | } |
831 | 830 | |
832 | - calc_uV = twl6030smps_list_voltage(rdev, vsel); | |
833 | - if (calc_uV > max_uV) | |
834 | - return -EINVAL; | |
831 | + return vsel; | |
832 | +} | |
835 | 833 | |
836 | - *selector = vsel; | |
834 | +static 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 | 839 | return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS, |
839 | - vsel); | |
840 | + selector); | |
840 | 841 | } |
841 | 842 | |
842 | 843 | static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev) |
843 | 844 | |
... | ... | @@ -848,8 +849,9 @@ |
848 | 849 | |
849 | 850 | static struct regulator_ops twlsmps_ops = { |
850 | 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 | 855 | .get_voltage_sel = twl6030smps_get_voltage_sel, |
854 | 856 | |
855 | 857 | .enable = twl6030reg_enable, |