regulator: palma: Disable smps10 boost during suspend
Karthik Ramakrishnan [Wed, 7 Nov 2012 23:21:27 +0000 (15:21 -0800)]
If the boost on smps10 is ON, the PMU consumes 2.5mW on
the VCCA rail. It should be disabled when the device is
in LP0

Bug 1156145

Change-Id: Icddc5c14a3b430f1a5aafda699c4216eafd9b32f
Signed-off-by: Karthik Ramakrishnan <karthikr@nvidia.com>
Reviewed-on: http://git-master/r/162156
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

drivers/regulator/palmas-regulator.c

index 3fb5c11..c317f64 100644 (file)
@@ -921,6 +921,48 @@ static int palmas_extreg_init(struct palmas *palmas, int id,
        return 0;
 }
 
+static void palmas_disable_smps10_boost(struct palmas *palmas)
+{
+       unsigned int reg;
+       unsigned int addr;
+       int ret;
+       int i;
+
+       addr = palmas_regs_info[PALMAS_REG_SMPS10].ctrl_addr;
+
+       ret = palmas_smps_write(palmas, addr, 0x00);
+       if (ret < 0) {
+               dev_err(palmas->dev, "Error in disabling smps10 boost\n");
+               return;
+       }
+
+}
+
+static void palmas_enable_smps10_boost(struct palmas *palmas)
+{
+       unsigned int reg;
+       unsigned int addr;
+       int ret;
+       int i;
+
+       addr = palmas_regs_info[PALMAS_REG_SMPS10].ctrl_addr;
+
+       ret = palmas_smps_read(palmas, addr, &reg);
+       if (ret) {
+               dev_err(palmas->dev, "Error in reading smps10 control reg\n");
+               return;
+       }
+
+       reg |= PALMA_SMPS10_VSEL;
+       reg |= PALMA_SMPS10_BOOST_EN;
+
+       ret = palmas_smps_write(palmas, addr, reg);
+       if (ret < 0) {
+               dev_err(palmas->dev, "Error in disabling smps10 boost\n");
+               return;
+       }
+}
+
 static void palmas_enable_ldo8_track(struct palmas *palmas)
 {
        unsigned int reg;
@@ -1325,6 +1367,7 @@ static int palmas_suspend(struct device *dev)
        if (pdata->enable_ldo8_tracking && pdata->disabe_ldo8_tracking_suspend)
                palmas_disable_ldo8_track(palmas);
 
+       palmas_disable_smps10_boost(palmas);
        return 0;
 }
 
@@ -1337,6 +1380,7 @@ static int palmas_resume(struct device *dev)
        if (pdata->enable_ldo8_tracking && pdata->disabe_ldo8_tracking_suspend)
                palmas_enable_ldo8_track(palmas);
 
+       palmas_enable_smps10_boost(palmas);
        return 0;
 }
 #endif