mfd: ricoh583: Enable Track control for LDO4 with PWRREQ1
Laxman Dewangan [Tue, 22 Nov 2011 09:48:52 +0000 (14:48 +0530)]
Enable the track control of the LDO4 only when it is
controlled by the PWRREQ1.

bug 822562

Reviewed-on: http://git-master/r/66096
(cherry picked from commit 2140cfb4fa9ba304b199c0144d02af12f1f691b5)

Change-Id: Ibcee5f224647772bde58716c28beae8b6315190f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/67329

drivers/mfd/ricoh583.c

index 4811867..9707051 100644 (file)
@@ -35,7 +35,8 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/ricoh583.h>
 
-#define RICOH_ONOFFSEL_REG      0x10
+#define RICOH_ONOFFSEL_REG     0x10
+#define RICOH_SWCTL_REG                0x5E
 
 /* Interrupt enable register */
 #define RICOH583_INT_EN_SYS1   0x19
@@ -436,9 +437,18 @@ static int __ricoh583_set_ext_pwrreq1_control(struct device *dev,
        }
 
        ret = ricoh583_write(dev, deepsleep_data[id].reg_add, sleepseq_val);
-       if (ret < 0)
+       if (ret < 0) {
                dev_err(dev, "Error in writing reg 0x%x\n",
                                deepsleep_data[id].reg_add);
+               return ret;
+       }
+
+       if (id == RICOH583_DS_LDO4) {
+               ret = ricoh583_write(dev, RICOH_SWCTL_REG, 0x1);
+               if (ret < 0)
+                       dev_err(dev, "Error in writing reg 0x%x\n",
+                               RICOH_SWCTL_REG);
+       }
        return ret;
 }
 
@@ -499,6 +509,11 @@ static int __devinit ricoh583_ext_power_init(struct ricoh583 *ricoh583,
                dev_err(ricoh583->dev, "Error in writing reg %d error: "
                                "%d\n", RICOH_ONOFFSEL_REG, ret);
 
+       ret = __ricoh583_write(ricoh583->client, RICOH_SWCTL_REG, 0x0);
+       if (ret < 0)
+               dev_err(ricoh583->dev, "Error in writing reg %d error: "
+                               "%d\n", RICOH_SWCTL_REG, ret);
+
        /* Clear sleepseq register */
        for (i = 0x21; i < 0x2B; ++i) {
                ret = __ricoh583_write(ricoh583->client, i, 0x0);