diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-04-17 05:43:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-17 10:03:06 -0400 |
commit | 30590d04808c03fb29341e1c6f721644b2f07650 (patch) | |
tree | 38d0f2752621ad336ddf282741d01a3838816be0 /drivers/regulator/palmas-regulator.c | |
parent | 504382c99d346c7443664dbc21b61101ccce078d (diff) |
regulator: palmas: clear sleep bits if not selected
Clear the sleep/warm reset bits when it is not selected through
regulator platform data. This will make sure that configuration
is inline with the platform data regardless of boot/POR
configuration.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/palmas-regulator.c')
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 24bbd620d933..af2109a73a80 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -443,24 +443,26 @@ static int palmas_smps_init(struct palmas *palmas, int id, | |||
443 | 443 | ||
444 | switch (id) { | 444 | switch (id) { |
445 | case PALMAS_REG_SMPS10: | 445 | case PALMAS_REG_SMPS10: |
446 | if (reg_init->mode_sleep) { | 446 | reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK; |
447 | reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK; | 447 | if (reg_init->mode_sleep) |
448 | reg |= reg_init->mode_sleep << | 448 | reg |= reg_init->mode_sleep << |
449 | PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT; | 449 | PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT; |
450 | } | ||
451 | break; | 450 | break; |
452 | default: | 451 | default: |
453 | if (reg_init->warm_reset) | 452 | if (reg_init->warm_reset) |
454 | reg |= PALMAS_SMPS12_CTRL_WR_S; | 453 | reg |= PALMAS_SMPS12_CTRL_WR_S; |
454 | else | ||
455 | reg &= ~PALMAS_SMPS12_CTRL_WR_S; | ||
455 | 456 | ||
456 | if (reg_init->roof_floor) | 457 | if (reg_init->roof_floor) |
457 | reg |= PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN; | 458 | reg |= PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN; |
459 | else | ||
460 | reg &= ~PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN; | ||
458 | 461 | ||
459 | if (reg_init->mode_sleep) { | 462 | reg &= ~PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK; |
460 | reg &= ~PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK; | 463 | if (reg_init->mode_sleep) |
461 | reg |= reg_init->mode_sleep << | 464 | reg |= reg_init->mode_sleep << |
462 | PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT; | 465 | PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT; |
463 | } | ||
464 | } | 466 | } |
465 | 467 | ||
466 | ret = palmas_smps_write(palmas, addr, reg); | 468 | ret = palmas_smps_write(palmas, addr, reg); |
@@ -506,9 +508,13 @@ static int palmas_ldo_init(struct palmas *palmas, int id, | |||
506 | 508 | ||
507 | if (reg_init->warm_reset) | 509 | if (reg_init->warm_reset) |
508 | reg |= PALMAS_LDO1_CTRL_WR_S; | 510 | reg |= PALMAS_LDO1_CTRL_WR_S; |
511 | else | ||
512 | reg &= ~PALMAS_LDO1_CTRL_WR_S; | ||
509 | 513 | ||
510 | if (reg_init->mode_sleep) | 514 | if (reg_init->mode_sleep) |
511 | reg |= PALMAS_LDO1_CTRL_MODE_SLEEP; | 515 | reg |= PALMAS_LDO1_CTRL_MODE_SLEEP; |
516 | else | ||
517 | reg &= ~PALMAS_LDO1_CTRL_MODE_SLEEP; | ||
512 | 518 | ||
513 | ret = palmas_ldo_write(palmas, addr, reg); | 519 | ret = palmas_ldo_write(palmas, addr, reg); |
514 | if (ret) | 520 | if (ret) |