board-msm7x30: mmc: Fix high current consumption during suspend.
With SANDisk class-4 4GB SD card, the current drain on Vdd (LDO5)
rail is observed to be ~8mA after the first resume.
It continues to remain ~8mA even during subsequent suspend states.
Fix this by switching off the Vdd to the card on suspend
and switching on the same on resume.
CRs-Fixed: 325730
Change-Id: I3d52b8aeec9cbb643274390d69137890e1d576bf
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 47a4605..260c880 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -118,6 +118,7 @@
#define OPTNAV_I2C_SLAVE_ADDR (0xB0 >> 1)
#define OPTNAV_IRQ 20
#define OPTNAV_CHIP_SELECT 19
+#define PMIC_GPIO_SDC4_PWR_EN_N 24 /* PMIC GPIO Number 25 */
/* Macros assume PMIC GPIOs start at 0 */
#define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + NR_GPIO_IRQS)
@@ -167,6 +168,19 @@
},
};
+ struct pm8xxx_gpio_init_info sdc4_pwr_en = {
+ PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N),
+ {
+ .direction = PM_GPIO_DIR_OUT,
+ .pull = PM_GPIO_PULL_NO,
+ .vin_sel = PM8058_GPIO_VIN_L5,
+ .function = PM_GPIO_FUNC_NORMAL,
+ .inv_int_pol = 0,
+ .out_strength = PM_GPIO_STRENGTH_LOW,
+ .output_value = 0,
+ },
+ };
+
struct pm8xxx_gpio_init_info haptics_enable = {
PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_HAP_ENABLE),
{
@@ -294,6 +308,23 @@
}
gpio_set_value_cansleep(sdc4_en.gpio, 0);
}
+ /* FFA -> gpio_25 controls vdd of sdcc4 */
+ else {
+ /* SCD4 gpio_25 */
+ rc = pm8xxx_gpio_config(sdc4_pwr_en.gpio, &sdc4_pwr_en.config);
+ if (rc) {
+ pr_err("%s PMIC_GPIO_SDC4_PWR_EN_N config failed: %d\n",
+ __func__, rc);
+ return rc;
+ }
+
+ rc = gpio_request(sdc4_pwr_en.gpio, "sdc4_pwr_en");
+ if (rc) {
+ pr_err("PMIC_GPIO_SDC4_PWR_EN_N gpio_req failed: %d\n",
+ rc);
+ return rc;
+ }
+ }
return 0;
}
@@ -5478,9 +5509,24 @@
if (test_bit(dev_id, &vreg_sts) == enable)
return rc;
- if (!enable || enabled_once[dev_id - 1])
- return 0;
+ if (dev_id == 4) {
+ if (enable) {
+ pr_debug("Enable Vdd dev_%d\n", dev_id);
+ gpio_set_value_cansleep(
+ PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N),
+ 0);
+ set_bit(dev_id, &vreg_sts);
+ } else {
+ pr_debug("Disable Vdd dev_%d\n", dev_id);
+ gpio_set_value_cansleep(
+ PM8058_GPIO_PM_TO_SYS(PMIC_GPIO_SDC4_PWR_EN_N),
+ 1);
+ clear_bit(dev_id, &vreg_sts);
+ }
+ }
+ if (!enable || enabled_once[dev_id - 1])
+ return 0;
if (!curr)
return -ENODEV;