diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-04-01 11:28:48 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-03 13:46:29 -0400 |
commit | b5366e5edc2014f0c86ed6fdad6fc9c24b7fad2c (patch) | |
tree | e8a2877b7376105dd05781467fae1b331a13471d /drivers/regulator | |
parent | 80abd60d9891fb1ba8cd93ef4df9320ac5569d70 (diff) |
regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops
For fixed voltage, we can just set min_uV and use regulator_list_voltage_linear
for list_voltage callback. Regulator core will call list_voltage(rdev, 0) if
both get_voltage get_voltage_sel are not implemented. Thus we can also remove
lp8788_ldo_fixed_get_voltage() function.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/lp8788-ldo.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c index c29aeae3c121..0ce2c4c194b3 100644 --- a/drivers/regulator/lp8788-ldo.c +++ b/drivers/regulator/lp8788-ldo.c | |||
@@ -170,23 +170,6 @@ static int lp8788_ldo_enable_time(struct regulator_dev *rdev) | |||
170 | return ENABLE_TIME_USEC * val; | 170 | return ENABLE_TIME_USEC * val; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int lp8788_ldo_fixed_get_voltage(struct regulator_dev *rdev) | ||
174 | { | ||
175 | enum lp8788_ldo_id id = rdev_get_id(rdev); | ||
176 | |||
177 | switch (id) { | ||
178 | case ALDO2 ... ALDO5: | ||
179 | return 2850000; | ||
180 | case DLDO12: | ||
181 | case ALDO8 ... ALDO9: | ||
182 | return 2500000; | ||
183 | case ALDO10: | ||
184 | return 1100000; | ||
185 | default: | ||
186 | return -EINVAL; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | static struct regulator_ops lp8788_ldo_voltage_table_ops = { | 173 | static struct regulator_ops lp8788_ldo_voltage_table_ops = { |
191 | .list_voltage = regulator_list_voltage_table, | 174 | .list_voltage = regulator_list_voltage_table, |
192 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 175 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
@@ -198,7 +181,7 @@ static struct regulator_ops lp8788_ldo_voltage_table_ops = { | |||
198 | }; | 181 | }; |
199 | 182 | ||
200 | static struct regulator_ops lp8788_ldo_voltage_fixed_ops = { | 183 | static struct regulator_ops lp8788_ldo_voltage_fixed_ops = { |
201 | .get_voltage = lp8788_ldo_fixed_get_voltage, | 184 | .list_voltage = regulator_list_voltage_linear, |
202 | .enable = regulator_enable_regmap, | 185 | .enable = regulator_enable_regmap, |
203 | .disable = regulator_disable_regmap, | 186 | .disable = regulator_disable_regmap, |
204 | .is_enabled = regulator_is_enabled_regmap, | 187 | .is_enabled = regulator_is_enabled_regmap, |
@@ -358,6 +341,7 @@ static struct regulator_desc lp8788_dldo_desc[] = { | |||
358 | .owner = THIS_MODULE, | 341 | .owner = THIS_MODULE, |
359 | .enable_reg = LP8788_EN_LDO_B, | 342 | .enable_reg = LP8788_EN_LDO_B, |
360 | .enable_mask = LP8788_EN_DLDO12_M, | 343 | .enable_mask = LP8788_EN_DLDO12_M, |
344 | .min_uV = 2500000, | ||
361 | }, | 345 | }, |
362 | }; | 346 | }; |
363 | 347 | ||
@@ -384,6 +368,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
384 | .owner = THIS_MODULE, | 368 | .owner = THIS_MODULE, |
385 | .enable_reg = LP8788_EN_LDO_B, | 369 | .enable_reg = LP8788_EN_LDO_B, |
386 | .enable_mask = LP8788_EN_ALDO2_M, | 370 | .enable_mask = LP8788_EN_ALDO2_M, |
371 | .min_uV = 2850000, | ||
387 | }, | 372 | }, |
388 | { | 373 | { |
389 | .name = "aldo3", | 374 | .name = "aldo3", |
@@ -394,6 +379,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
394 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
395 | .enable_reg = LP8788_EN_LDO_B, | 380 | .enable_reg = LP8788_EN_LDO_B, |
396 | .enable_mask = LP8788_EN_ALDO3_M, | 381 | .enable_mask = LP8788_EN_ALDO3_M, |
382 | .min_uV = 2850000, | ||
397 | }, | 383 | }, |
398 | { | 384 | { |
399 | .name = "aldo4", | 385 | .name = "aldo4", |
@@ -404,6 +390,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
404 | .owner = THIS_MODULE, | 390 | .owner = THIS_MODULE, |
405 | .enable_reg = LP8788_EN_LDO_B, | 391 | .enable_reg = LP8788_EN_LDO_B, |
406 | .enable_mask = LP8788_EN_ALDO4_M, | 392 | .enable_mask = LP8788_EN_ALDO4_M, |
393 | .min_uV = 2850000, | ||
407 | }, | 394 | }, |
408 | { | 395 | { |
409 | .name = "aldo5", | 396 | .name = "aldo5", |
@@ -414,6 +401,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
414 | .owner = THIS_MODULE, | 401 | .owner = THIS_MODULE, |
415 | .enable_reg = LP8788_EN_LDO_C, | 402 | .enable_reg = LP8788_EN_LDO_C, |
416 | .enable_mask = LP8788_EN_ALDO5_M, | 403 | .enable_mask = LP8788_EN_ALDO5_M, |
404 | .min_uV = 2850000, | ||
417 | }, | 405 | }, |
418 | { | 406 | { |
419 | .name = "aldo6", | 407 | .name = "aldo6", |
@@ -450,6 +438,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
450 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
451 | .enable_reg = LP8788_EN_LDO_C, | 439 | .enable_reg = LP8788_EN_LDO_C, |
452 | .enable_mask = LP8788_EN_ALDO8_M, | 440 | .enable_mask = LP8788_EN_ALDO8_M, |
441 | .min_uV = 2500000, | ||
453 | }, | 442 | }, |
454 | { | 443 | { |
455 | .name = "aldo9", | 444 | .name = "aldo9", |
@@ -460,6 +449,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
460 | .owner = THIS_MODULE, | 449 | .owner = THIS_MODULE, |
461 | .enable_reg = LP8788_EN_LDO_C, | 450 | .enable_reg = LP8788_EN_LDO_C, |
462 | .enable_mask = LP8788_EN_ALDO9_M, | 451 | .enable_mask = LP8788_EN_ALDO9_M, |
452 | .min_uV = 2500000, | ||
463 | }, | 453 | }, |
464 | { | 454 | { |
465 | .name = "aldo10", | 455 | .name = "aldo10", |
@@ -470,6 +460,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { | |||
470 | .owner = THIS_MODULE, | 460 | .owner = THIS_MODULE, |
471 | .enable_reg = LP8788_EN_LDO_C, | 461 | .enable_reg = LP8788_EN_LDO_C, |
472 | .enable_mask = LP8788_EN_ALDO10_M, | 462 | .enable_mask = LP8788_EN_ALDO10_M, |
463 | .min_uV = 1100000, | ||
473 | }, | 464 | }, |
474 | }; | 465 | }; |
475 | 466 | ||