diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-06-07 22:27:49 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-17 16:04:45 -0400 |
commit | 7142e2138b088da429d94859df0ed05b1b82607c (patch) | |
tree | ce2c85eedbf3c3af374a5d899bd37eb59656a28a /drivers/regulator/ab8500.c | |
parent | 34e74f39fa9a2c1489444266cc9e973dc1b3a419 (diff) |
regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
implement get_voltage_sel so set_voltage_time_sel won't be called )
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/ab8500.c')
-rw-r--r-- | drivers/regulator/ab8500.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 290c289a653d..c931c7c0ad1b 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -32,7 +32,6 @@ | |||
32 | * @regulator_dev: regulator device | 32 | * @regulator_dev: regulator device |
33 | * @max_uV: maximum voltage (for variable voltage supplies) | 33 | * @max_uV: maximum voltage (for variable voltage supplies) |
34 | * @min_uV: minimum voltage (for variable voltage supplies) | 34 | * @min_uV: minimum voltage (for variable voltage supplies) |
35 | * @fixed_uV: typical voltage (for fixed voltage supplies) | ||
36 | * @update_bank: bank to control on/off | 35 | * @update_bank: bank to control on/off |
37 | * @update_reg: register to control on/off | 36 | * @update_reg: register to control on/off |
38 | * @update_mask: mask to enable/disable regulator | 37 | * @update_mask: mask to enable/disable regulator |
@@ -48,7 +47,6 @@ struct ab8500_regulator_info { | |||
48 | struct regulator_dev *regulator; | 47 | struct regulator_dev *regulator; |
49 | int max_uV; | 48 | int max_uV; |
50 | int min_uV; | 49 | int min_uV; |
51 | int fixed_uV; | ||
52 | u8 update_bank; | 50 | u8 update_bank; |
53 | u8 update_reg; | 51 | u8 update_reg; |
54 | u8 update_mask; | 52 | u8 update_mask; |
@@ -271,29 +269,9 @@ static struct regulator_ops ab8500_regulator_ops = { | |||
271 | .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, | 269 | .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, |
272 | }; | 270 | }; |
273 | 271 | ||
274 | static int ab8500_fixed_list_voltage(struct regulator_dev *rdev, | ||
275 | unsigned selector) | ||
276 | { | ||
277 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
278 | |||
279 | if (info == NULL) { | ||
280 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | return info->fixed_uV; | ||
285 | } | ||
286 | |||
287 | static int ab8500_fixed_get_voltage(struct regulator_dev *rdev) | 272 | static int ab8500_fixed_get_voltage(struct regulator_dev *rdev) |
288 | { | 273 | { |
289 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | 274 | return rdev->desc->min_uV; |
290 | |||
291 | if (info == NULL) { | ||
292 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | ||
293 | return -EINVAL; | ||
294 | } | ||
295 | |||
296 | return info->fixed_uV; | ||
297 | } | 275 | } |
298 | 276 | ||
299 | static struct regulator_ops ab8500_regulator_fixed_ops = { | 277 | static struct regulator_ops ab8500_regulator_fixed_ops = { |
@@ -301,9 +279,8 @@ static struct regulator_ops ab8500_regulator_fixed_ops = { | |||
301 | .disable = ab8500_regulator_disable, | 279 | .disable = ab8500_regulator_disable, |
302 | .is_enabled = ab8500_regulator_is_enabled, | 280 | .is_enabled = ab8500_regulator_is_enabled, |
303 | .get_voltage = ab8500_fixed_get_voltage, | 281 | .get_voltage = ab8500_fixed_get_voltage, |
304 | .list_voltage = ab8500_fixed_list_voltage, | 282 | .list_voltage = regulator_list_voltage_linear, |
305 | .enable_time = ab8500_regulator_enable_time, | 283 | .enable_time = ab8500_regulator_enable_time, |
306 | .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, | ||
307 | }; | 284 | }; |
308 | 285 | ||
309 | static struct ab8500_regulator_info | 286 | static struct ab8500_regulator_info |
@@ -408,9 +385,9 @@ static struct ab8500_regulator_info | |||
408 | .id = AB8500_LDO_TVOUT, | 385 | .id = AB8500_LDO_TVOUT, |
409 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
410 | .n_voltages = 1, | 387 | .n_voltages = 1, |
388 | .min_uV = 2000000, | ||
411 | }, | 389 | }, |
412 | .delay = 10000, | 390 | .delay = 10000, |
413 | .fixed_uV = 2000000, | ||
414 | .update_bank = 0x03, | 391 | .update_bank = 0x03, |
415 | .update_reg = 0x80, | 392 | .update_reg = 0x80, |
416 | .update_mask = 0x82, | 393 | .update_mask = 0x82, |
@@ -424,8 +401,8 @@ static struct ab8500_regulator_info | |||
424 | .id = AB8500_LDO_USB, | 401 | .id = AB8500_LDO_USB, |
425 | .owner = THIS_MODULE, | 402 | .owner = THIS_MODULE, |
426 | .n_voltages = 1, | 403 | .n_voltages = 1, |
404 | .min_uV = 3300000, | ||
427 | }, | 405 | }, |
428 | .fixed_uV = 3300000, | ||
429 | .update_bank = 0x03, | 406 | .update_bank = 0x03, |
430 | .update_reg = 0x82, | 407 | .update_reg = 0x82, |
431 | .update_mask = 0x03, | 408 | .update_mask = 0x03, |
@@ -439,8 +416,8 @@ static struct ab8500_regulator_info | |||
439 | .id = AB8500_LDO_AUDIO, | 416 | .id = AB8500_LDO_AUDIO, |
440 | .owner = THIS_MODULE, | 417 | .owner = THIS_MODULE, |
441 | .n_voltages = 1, | 418 | .n_voltages = 1, |
419 | .min_uV = 2000000, | ||
442 | }, | 420 | }, |
443 | .fixed_uV = 2000000, | ||
444 | .update_bank = 0x03, | 421 | .update_bank = 0x03, |
445 | .update_reg = 0x83, | 422 | .update_reg = 0x83, |
446 | .update_mask = 0x02, | 423 | .update_mask = 0x02, |
@@ -454,8 +431,8 @@ static struct ab8500_regulator_info | |||
454 | .id = AB8500_LDO_ANAMIC1, | 431 | .id = AB8500_LDO_ANAMIC1, |
455 | .owner = THIS_MODULE, | 432 | .owner = THIS_MODULE, |
456 | .n_voltages = 1, | 433 | .n_voltages = 1, |
434 | .min_uV = 2050000, | ||
457 | }, | 435 | }, |
458 | .fixed_uV = 2050000, | ||
459 | .update_bank = 0x03, | 436 | .update_bank = 0x03, |
460 | .update_reg = 0x83, | 437 | .update_reg = 0x83, |
461 | .update_mask = 0x08, | 438 | .update_mask = 0x08, |
@@ -469,8 +446,8 @@ static struct ab8500_regulator_info | |||
469 | .id = AB8500_LDO_ANAMIC2, | 446 | .id = AB8500_LDO_ANAMIC2, |
470 | .owner = THIS_MODULE, | 447 | .owner = THIS_MODULE, |
471 | .n_voltages = 1, | 448 | .n_voltages = 1, |
449 | .min_uV = 2050000, | ||
472 | }, | 450 | }, |
473 | .fixed_uV = 2050000, | ||
474 | .update_bank = 0x03, | 451 | .update_bank = 0x03, |
475 | .update_reg = 0x83, | 452 | .update_reg = 0x83, |
476 | .update_mask = 0x10, | 453 | .update_mask = 0x10, |
@@ -484,8 +461,8 @@ static struct ab8500_regulator_info | |||
484 | .id = AB8500_LDO_DMIC, | 461 | .id = AB8500_LDO_DMIC, |
485 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
486 | .n_voltages = 1, | 463 | .n_voltages = 1, |
464 | .min_uV = 1800000, | ||
487 | }, | 465 | }, |
488 | .fixed_uV = 1800000, | ||
489 | .update_bank = 0x03, | 466 | .update_bank = 0x03, |
490 | .update_reg = 0x83, | 467 | .update_reg = 0x83, |
491 | .update_mask = 0x04, | 468 | .update_mask = 0x04, |
@@ -499,8 +476,8 @@ static struct ab8500_regulator_info | |||
499 | .id = AB8500_LDO_ANA, | 476 | .id = AB8500_LDO_ANA, |
500 | .owner = THIS_MODULE, | 477 | .owner = THIS_MODULE, |
501 | .n_voltages = 1, | 478 | .n_voltages = 1, |
479 | .min_uV = 1200000, | ||
502 | }, | 480 | }, |
503 | .fixed_uV = 1200000, | ||
504 | .update_bank = 0x04, | 481 | .update_bank = 0x04, |
505 | .update_reg = 0x06, | 482 | .update_reg = 0x06, |
506 | .update_mask = 0x0c, | 483 | .update_mask = 0x0c, |