]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
regulator: as3722: sd1 external control only during suspend
authorBibek Basu <bbasu@nvidia.com>
Fri, 11 Apr 2014 05:44:13 +0000 (11:14 +0530)
committerMatthew Pedro <mapedro@nvidia.com>
Mon, 14 Apr 2014 16:30:52 +0000 (09:30 -0700)
If SD1 external control is enabled from boot, it has adverse
effect on power down cycle. Which can lead to long term product
stability. So enable SD1 external control only while going to
to suspend and disable while resuming

Bug 1495458

Change-Id: Ia65bf6f358d15604cea3914914188ce1725b4120
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/395039
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
arch/arm/mach-tegra/board-laguna-power.c
drivers/regulator/as3722-regulator.c

index 9e71debf745581f9fdbca116018fca9e42d4130e..e0cdb836093786058ea2415a94c360a5ac50eeb1 100644 (file)
@@ -186,7 +186,7 @@ static struct regulator_consumer_supply as3722_sd6_supply[] = {
 };
 
 AMS_PDATA_INIT(sd0, NULL, 700000, 1400000, 1, 1, 1, AS3722_EXT_CONTROL_ENABLE2);
-AMS_PDATA_INIT(sd1, NULL, 700000, 1350000, 1, 1, 1, AS3722_EXT_CONTROL_ENABLE1);
+AMS_PDATA_INIT(sd1, NULL, 700000, 1350000, 1, 1, 1, 0);
 AMS_PDATA_INIT(sd2, NULL, 1350000, 1350000, 1, 1, 1, 0);
 AMS_PDATA_INIT(sd4, NULL, 1050000, 1050000, 1, 1, 1, AS3722_EXT_CONTROL_ENABLE1);
 AMS_PDATA_INIT(sd5, NULL, 1800000, 1800000, 1, 1, 1, 0);
index f63a8420900fd573daecc3b7e2c83a74de59219c..13791a7a50bb4dea24384be3a713749f4f4c9a5e 100644 (file)
@@ -942,7 +942,22 @@ static int as3722_regulator_suspend(struct device *dev)
        struct as3722_regulators *as3722_regs = dev_get_drvdata(dev);
        struct as3722_regulator_config_data *reg_config;
        int ret;
+       u32 val;
+
+       /* Enable SD1 external control before entering suspend */
+       reg_config = &as3722_regs->reg_config_data[AS3722_REGULATOR_ID_SD1];
+       val =  AS3722_EXT_CONTROL_ENABLE1 << (ffs(
+               as3722_reg_lookup[AS3722_REGULATOR_ID_SD1].
+               sleep_ctrl_mask) - 1);
 
+       ret = as3722_update_bits(as3722_regs->as3722, AS3722_ENABLE_CTRL1_REG,
+                       AS3722_SD1_EXT_ENABLE_MASK,
+                       val);
+       if (ret < 0) {
+               dev_err(dev, "Reg 0x%02x write failed: %d\n",
+                               AS3722_ENABLE_CTRL1_REG, ret);
+               return ret;
+       }
        reg_config = &as3722_regs->reg_config_data[AS3722_REGULATOR_ID_LDO3];
        if (reg_config->enable_tracking &&
                reg_config->disable_tracking_suspend) {
@@ -961,7 +976,18 @@ static int as3722_regulator_resume(struct device *dev)
        struct as3722_regulators *as3722_regs = dev_get_drvdata(dev);
        struct as3722_regulator_config_data *reg_config;
        int ret;
+       u32 val;
 
+       /* Disable SD1 external control after resuming to have a
+        * proper shutdown sequence
+        */
+       ret = as3722_update_bits(as3722_regs->as3722, AS3722_ENABLE_CTRL1_REG,
+                       AS3722_SD1_EXT_ENABLE_MASK, 0);
+       if (ret < 0) {
+               dev_err(dev, "Reg 0x%02x write failed: %d\n",
+                               AS3722_ENABLE_CTRL1_REG, ret);
+               return ret;
+       }
        reg_config = &as3722_regs->reg_config_data[AS3722_REGULATOR_ID_LDO3];
        if (reg_config->enable_tracking &&
                reg_config->disable_tracking_suspend) {