mmc: sdhci: Avoid power on/off during sleep
Pavan Kunapuli [Tue, 10 Jul 2012 13:27:25 +0000 (18:27 +0530)]
If eMMC sleep support is enabled, set MMC_PM_KEEP_POWER
to avoid host power off and power on. Instead, restore
the host context in resume.

Bug 1007644
Bug 936069

Change-Id: I74578bb1f9e297b3af6bd79b9215364334984836
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/118913
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Min-wuk Lee <mlee@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/mmc/host/sdhci.c

index 6c86278..f86bf74 100644 (file)
@@ -2349,6 +2349,15 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
        }
 
        if (mmc->card) {
+               /*
+                * If eMMC cards are put in sleep state, Vccq can be disabled
+                * but Vcc would still be powered on. In resume, we only restore
+                * the controller context. So, set MMC_PM_KEEP_POWER flag.
+                */
+               if (mmc_card_can_sleep(mmc) &&
+                       !(mmc->caps & MMC_CAP2_NO_SLEEP_CMD))
+                       mmc->pm_flags = MMC_PM_KEEP_POWER;
+
                ret = mmc_suspend_host(host->mmc);
                if (ret) {
                        if (has_tuning_timer) {