diff options
Diffstat (limited to 'drivers/regulator/max8660.c')
-rw-r--r-- | drivers/regulator/max8660.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 5d568175cc27..67ec6ad7eb5e 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c | |||
@@ -126,13 +126,6 @@ static int max8660_dcdc_disable(struct regulator_dev *rdev) | |||
126 | return max8660_write(max8660, MAX8660_OVER1, mask, 0); | 126 | return max8660_write(max8660, MAX8660_OVER1, mask, 0); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int max8660_dcdc_list(struct regulator_dev *rdev, unsigned selector) | ||
130 | { | ||
131 | if (selector > MAX8660_DCDC_MAX_SEL) | ||
132 | return -EINVAL; | ||
133 | return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP; | ||
134 | } | ||
135 | |||
136 | static int max8660_dcdc_get(struct regulator_dev *rdev) | 129 | static int max8660_dcdc_get(struct regulator_dev *rdev) |
137 | { | 130 | { |
138 | struct max8660 *max8660 = rdev_get_drvdata(rdev); | 131 | struct max8660 *max8660 = rdev_get_drvdata(rdev); |
@@ -156,7 +149,7 @@ static int max8660_dcdc_set(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
156 | selector = DIV_ROUND_UP(min_uV - MAX8660_DCDC_MIN_UV, | 149 | selector = DIV_ROUND_UP(min_uV - MAX8660_DCDC_MIN_UV, |
157 | MAX8660_DCDC_STEP); | 150 | MAX8660_DCDC_STEP); |
158 | 151 | ||
159 | ret = max8660_dcdc_list(rdev, selector); | 152 | ret = regulator_list_voltage_linear(rdev, selector); |
160 | if (ret < 0 || ret > max_uV) | 153 | if (ret < 0 || ret > max_uV) |
161 | return -EINVAL; | 154 | return -EINVAL; |
162 | 155 | ||
@@ -174,7 +167,7 @@ static int max8660_dcdc_set(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
174 | 167 | ||
175 | static struct regulator_ops max8660_dcdc_ops = { | 168 | static struct regulator_ops max8660_dcdc_ops = { |
176 | .is_enabled = max8660_dcdc_is_enabled, | 169 | .is_enabled = max8660_dcdc_is_enabled, |
177 | .list_voltage = max8660_dcdc_list, | 170 | .list_voltage = regulator_list_voltage_linear, |
178 | .set_voltage = max8660_dcdc_set, | 171 | .set_voltage = max8660_dcdc_set, |
179 | .get_voltage = max8660_dcdc_get, | 172 | .get_voltage = max8660_dcdc_get, |
180 | }; | 173 | }; |
@@ -184,13 +177,6 @@ static struct regulator_ops max8660_dcdc_ops = { | |||
184 | * LDO5 functions | 177 | * LDO5 functions |
185 | */ | 178 | */ |
186 | 179 | ||
187 | static int max8660_ldo5_list(struct regulator_dev *rdev, unsigned selector) | ||
188 | { | ||
189 | if (selector > MAX8660_LDO5_MAX_SEL) | ||
190 | return -EINVAL; | ||
191 | return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP; | ||
192 | } | ||
193 | |||
194 | static int max8660_ldo5_get(struct regulator_dev *rdev) | 180 | static int max8660_ldo5_get(struct regulator_dev *rdev) |
195 | { | 181 | { |
196 | struct max8660 *max8660 = rdev_get_drvdata(rdev); | 182 | struct max8660 *max8660 = rdev_get_drvdata(rdev); |
@@ -214,7 +200,7 @@ static int max8660_ldo5_set(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
214 | selector = DIV_ROUND_UP(min_uV - MAX8660_LDO5_MIN_UV, | 200 | selector = DIV_ROUND_UP(min_uV - MAX8660_LDO5_MIN_UV, |
215 | MAX8660_LDO5_STEP); | 201 | MAX8660_LDO5_STEP); |
216 | 202 | ||
217 | ret = max8660_ldo5_list(rdev, selector); | 203 | ret = regulator_list_voltage_linear(rdev, selector); |
218 | if (ret < 0 || ret > max_uV) | 204 | if (ret < 0 || ret > max_uV) |
219 | return -EINVAL; | 205 | return -EINVAL; |
220 | 206 | ||
@@ -229,7 +215,7 @@ static int max8660_ldo5_set(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
229 | } | 215 | } |
230 | 216 | ||
231 | static struct regulator_ops max8660_ldo5_ops = { | 217 | static struct regulator_ops max8660_ldo5_ops = { |
232 | .list_voltage = max8660_ldo5_list, | 218 | .list_voltage = regulator_list_voltage_linear, |
233 | .set_voltage = max8660_ldo5_set, | 219 | .set_voltage = max8660_ldo5_set, |
234 | .get_voltage = max8660_ldo5_get, | 220 | .get_voltage = max8660_ldo5_get, |
235 | }; | 221 | }; |
@@ -261,13 +247,6 @@ static int max8660_ldo67_disable(struct regulator_dev *rdev) | |||
261 | return max8660_write(max8660, MAX8660_OVER2, mask, 0); | 247 | return max8660_write(max8660, MAX8660_OVER2, mask, 0); |
262 | } | 248 | } |
263 | 249 | ||
264 | static int max8660_ldo67_list(struct regulator_dev *rdev, unsigned selector) | ||
265 | { | ||
266 | if (selector > MAX8660_LDO67_MAX_SEL) | ||
267 | return -EINVAL; | ||
268 | return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP; | ||
269 | } | ||
270 | |||
271 | static int max8660_ldo67_get(struct regulator_dev *rdev) | 250 | static int max8660_ldo67_get(struct regulator_dev *rdev) |
272 | { | 251 | { |
273 | struct max8660 *max8660 = rdev_get_drvdata(rdev); | 252 | struct max8660 *max8660 = rdev_get_drvdata(rdev); |
@@ -292,7 +271,7 @@ static int max8660_ldo67_set(struct regulator_dev *rdev, int min_uV, | |||
292 | selector = DIV_ROUND_UP(min_uV - MAX8660_LDO67_MIN_UV, | 271 | selector = DIV_ROUND_UP(min_uV - MAX8660_LDO67_MIN_UV, |
293 | MAX8660_LDO67_STEP); | 272 | MAX8660_LDO67_STEP); |
294 | 273 | ||
295 | ret = max8660_ldo67_list(rdev, selector); | 274 | ret = regulator_list_voltage_linear(rdev, selector); |
296 | if (ret < 0 || ret > max_uV) | 275 | if (ret < 0 || ret > max_uV) |
297 | return -EINVAL; | 276 | return -EINVAL; |
298 | 277 | ||
@@ -308,7 +287,7 @@ static struct regulator_ops max8660_ldo67_ops = { | |||
308 | .is_enabled = max8660_ldo67_is_enabled, | 287 | .is_enabled = max8660_ldo67_is_enabled, |
309 | .enable = max8660_ldo67_enable, | 288 | .enable = max8660_ldo67_enable, |
310 | .disable = max8660_ldo67_disable, | 289 | .disable = max8660_ldo67_disable, |
311 | .list_voltage = max8660_ldo67_list, | 290 | .list_voltage = regulator_list_voltage_linear, |
312 | .get_voltage = max8660_ldo67_get, | 291 | .get_voltage = max8660_ldo67_get, |
313 | .set_voltage = max8660_ldo67_set, | 292 | .set_voltage = max8660_ldo67_set, |
314 | }; | 293 | }; |
@@ -321,6 +300,8 @@ static const struct regulator_desc max8660_reg[] = { | |||
321 | .type = REGULATOR_VOLTAGE, | 300 | .type = REGULATOR_VOLTAGE, |
322 | .n_voltages = MAX8660_DCDC_MAX_SEL + 1, | 301 | .n_voltages = MAX8660_DCDC_MAX_SEL + 1, |
323 | .owner = THIS_MODULE, | 302 | .owner = THIS_MODULE, |
303 | .min_uV = MAX8660_DCDC_MIN_UV, | ||
304 | .uV_step = MAX8660_DCDC_STEP, | ||
324 | }, | 305 | }, |
325 | { | 306 | { |
326 | .name = "V4(DCDC)", | 307 | .name = "V4(DCDC)", |
@@ -329,6 +310,8 @@ static const struct regulator_desc max8660_reg[] = { | |||
329 | .type = REGULATOR_VOLTAGE, | 310 | .type = REGULATOR_VOLTAGE, |
330 | .n_voltages = MAX8660_DCDC_MAX_SEL + 1, | 311 | .n_voltages = MAX8660_DCDC_MAX_SEL + 1, |
331 | .owner = THIS_MODULE, | 312 | .owner = THIS_MODULE, |
313 | .min_uV = MAX8660_DCDC_MIN_UV, | ||
314 | .uV_step = MAX8660_DCDC_STEP, | ||
332 | }, | 315 | }, |
333 | { | 316 | { |
334 | .name = "V5(LDO)", | 317 | .name = "V5(LDO)", |
@@ -337,6 +320,8 @@ static const struct regulator_desc max8660_reg[] = { | |||
337 | .type = REGULATOR_VOLTAGE, | 320 | .type = REGULATOR_VOLTAGE, |
338 | .n_voltages = MAX8660_LDO5_MAX_SEL + 1, | 321 | .n_voltages = MAX8660_LDO5_MAX_SEL + 1, |
339 | .owner = THIS_MODULE, | 322 | .owner = THIS_MODULE, |
323 | .min_uV = MAX8660_LDO5_MIN_UV, | ||
324 | .uV_step = MAX8660_LDO5_STEP, | ||
340 | }, | 325 | }, |
341 | { | 326 | { |
342 | .name = "V6(LDO)", | 327 | .name = "V6(LDO)", |
@@ -345,6 +330,8 @@ static const struct regulator_desc max8660_reg[] = { | |||
345 | .type = REGULATOR_VOLTAGE, | 330 | .type = REGULATOR_VOLTAGE, |
346 | .n_voltages = MAX8660_LDO67_MAX_SEL + 1, | 331 | .n_voltages = MAX8660_LDO67_MAX_SEL + 1, |
347 | .owner = THIS_MODULE, | 332 | .owner = THIS_MODULE, |
333 | .min_uV = MAX8660_LDO67_MIN_UV, | ||
334 | .uV_step = MAX8660_LDO67_STEP, | ||
348 | }, | 335 | }, |
349 | { | 336 | { |
350 | .name = "V7(LDO)", | 337 | .name = "V7(LDO)", |
@@ -353,6 +340,8 @@ static const struct regulator_desc max8660_reg[] = { | |||
353 | .type = REGULATOR_VOLTAGE, | 340 | .type = REGULATOR_VOLTAGE, |
354 | .n_voltages = MAX8660_LDO67_MAX_SEL + 1, | 341 | .n_voltages = MAX8660_LDO67_MAX_SEL + 1, |
355 | .owner = THIS_MODULE, | 342 | .owner = THIS_MODULE, |
343 | .min_uV = MAX8660_LDO67_MIN_UV, | ||
344 | .uV_step = MAX8660_LDO67_STEP, | ||
356 | }, | 345 | }, |
357 | }; | 346 | }; |
358 | 347 | ||