regulator: palma: configure sleep mode properly
Mallikarjun Kasoju [Fri, 21 Sep 2012 14:31:35 +0000 (19:31 +0530)]
Properly configuring the sleep mode state for smps
and ldo regualtors.

Reviewed-on: http://git-master/r/134415
(cherry picked from commit 4fcff72d0eb2a055a2fa0ba8acfcfb97270feab7)

Change-Id: I1ad2a0e6d968a9d0328aaa1a5eeb6819f6f8646c
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/143136
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

drivers/regulator/palmas-regulator.c

index 36ed19a..91ef0d8 100644 (file)
@@ -815,11 +815,10 @@ static int palmas_smps_init(struct palmas *palmas, int id,
                if (reg_init->roof_floor)
                        reg |= PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN;
 
-               if (reg_init->mode_sleep) {
-                       reg &= ~PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK;
+               reg &= ~PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK;
+               if (reg_init->mode_sleep)
                        reg |= reg_init->mode_sleep <<
                                        PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT;
-               }
        } else {
                if (reg_init->mode_sleep) {
                        reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK;
@@ -885,6 +884,8 @@ static int palmas_ldo_init(struct palmas *palmas, int id,
 
        if (reg_init->mode_sleep)
                reg |= PALMAS_LDO1_CTRL_MODE_SLEEP;
+       else
+               reg &= ~PALMAS_LDO1_CTRL_MODE_SLEEP;
 
        ret = palmas_ldo_write(palmas, addr, reg);
        if (ret)