diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-06-11 02:43:57 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-17 16:05:28 -0400 |
commit | 368a7887698c3e7ec30678853fa7dd1f0720863f (patch) | |
tree | 1a302b1370a1d8b60c6cf2ff7cbb59c38cf8f7e6 /drivers/regulator/pcf50633-regulator.c | |
parent | 07b9e329f99397d01e4789d64aa2f581a7c94b03 (diff) |
regulator: pcf50633: Convert to regulator_set_voltage_sel_regmap 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/regulator/pcf50633-regulator.c')
-rw-r--r-- | drivers/regulator/pcf50633-regulator.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 3c9d14c0017b..092e5cb848a1 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c | |||
@@ -100,13 +100,12 @@ static unsigned int ldo_voltage_value(u8 bits) | |||
100 | return 900 + (bits * 100); | 100 | return 900 + (bits * 100); |
101 | } | 101 | } |
102 | 102 | ||
103 | static int pcf50633_regulator_set_voltage(struct regulator_dev *rdev, | 103 | static int pcf50633_regulator_map_voltage(struct regulator_dev *rdev, |
104 | int min_uV, int max_uV, | 104 | int min_uV, int max_uV) |
105 | unsigned *selector) | ||
106 | { | 105 | { |
107 | struct pcf50633 *pcf; | 106 | struct pcf50633 *pcf; |
108 | int regulator_id, millivolts; | 107 | int regulator_id, millivolts; |
109 | u8 volt_bits, regnr; | 108 | u8 volt_bits; |
110 | 109 | ||
111 | pcf = rdev_get_drvdata(rdev); | 110 | pcf = rdev_get_drvdata(rdev); |
112 | 111 | ||
@@ -116,15 +115,11 @@ static int pcf50633_regulator_set_voltage(struct regulator_dev *rdev, | |||
116 | 115 | ||
117 | millivolts = min_uV / 1000; | 116 | millivolts = min_uV / 1000; |
118 | 117 | ||
119 | regnr = rdev->desc->vsel_reg; | ||
120 | |||
121 | switch (regulator_id) { | 118 | switch (regulator_id) { |
122 | case PCF50633_REGULATOR_AUTO: | 119 | case PCF50633_REGULATOR_AUTO: |
123 | volt_bits = auto_voltage_bits(millivolts); | 120 | volt_bits = auto_voltage_bits(millivolts); |
124 | break; | 121 | break; |
125 | case PCF50633_REGULATOR_DOWN1: | 122 | case PCF50633_REGULATOR_DOWN1: |
126 | volt_bits = down_voltage_bits(millivolts); | ||
127 | break; | ||
128 | case PCF50633_REGULATOR_DOWN2: | 123 | case PCF50633_REGULATOR_DOWN2: |
129 | volt_bits = down_voltage_bits(millivolts); | 124 | volt_bits = down_voltage_bits(millivolts); |
130 | break; | 125 | break; |
@@ -142,9 +137,7 @@ static int pcf50633_regulator_set_voltage(struct regulator_dev *rdev, | |||
142 | return -EINVAL; | 137 | return -EINVAL; |
143 | } | 138 | } |
144 | 139 | ||
145 | *selector = volt_bits; | 140 | return volt_bits; |
146 | |||
147 | return pcf50633_reg_write(pcf, regnr, volt_bits); | ||
148 | } | 141 | } |
149 | 142 | ||
150 | static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, | 143 | static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, |
@@ -159,8 +152,6 @@ static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, | |||
159 | millivolts = auto_voltage_value(index); | 152 | millivolts = auto_voltage_value(index); |
160 | break; | 153 | break; |
161 | case PCF50633_REGULATOR_DOWN1: | 154 | case PCF50633_REGULATOR_DOWN1: |
162 | millivolts = down_voltage_value(index); | ||
163 | break; | ||
164 | case PCF50633_REGULATOR_DOWN2: | 155 | case PCF50633_REGULATOR_DOWN2: |
165 | millivolts = down_voltage_value(index); | 156 | millivolts = down_voltage_value(index); |
166 | break; | 157 | break; |
@@ -182,9 +173,10 @@ static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, | |||
182 | } | 173 | } |
183 | 174 | ||
184 | static struct regulator_ops pcf50633_regulator_ops = { | 175 | static struct regulator_ops pcf50633_regulator_ops = { |
185 | .set_voltage = pcf50633_regulator_set_voltage, | 176 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
186 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 177 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
187 | .list_voltage = pcf50633_regulator_list_voltage, | 178 | .list_voltage = pcf50633_regulator_list_voltage, |
179 | .map_voltage = pcf50633_regulator_map_voltage, | ||
188 | .enable = regulator_enable_regmap, | 180 | .enable = regulator_enable_regmap, |
189 | .disable = regulator_disable_regmap, | 181 | .disable = regulator_disable_regmap, |
190 | .is_enabled = regulator_is_enabled_regmap, | 182 | .is_enabled = regulator_is_enabled_regmap, |