summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkirt_hsieh <Kirt_Hsieh@asus.com>2012-05-03 10:23:40 +0800
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-02-03 16:17:08 +0100
commit7f7b042a978edfc6c7d1e14ec9c6ec01ffcc284b (patch)
tree496af2da5896aab50ba151ba48ecb8ddf83bf70d
parentcee47e607ad98f0299cdce0bbe83898f4eab689a (diff)
[PATCH 3/3] mmc: host: sdhci: abort suspend if host suspend fails.
Change-Id: I46e3f1a158d61a0b255fae5d510c8f87579c435d Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/47847 Reviewed-by: Kirt Hsieh <Kirt_Hsieh@asus.com> Tested-by: Kirt Hsieh <Kirt_Hsieh@asus.com> Reviewed-by: Vincent Yue <Vincent_Yue@asus.com> Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/48199 Reviewed-by: Jim1 Lin <jim1_lin@asus.com> Tested-by: Jim1 Lin <jim1_lin@asus.com> Reviewed-by: Leslie Yu <Leslie_Yu@asus.com> (cherry picked from commit 8eadc6d514b7838c398ff3499ab5f2e012e2fc06) Conflicts: drivers/mmc/host/sdhci.c
-rw-r--r--drivers/mmc/host/sdhci.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7c6ff939a823..5b0e1196dd97 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1852,7 +1852,6 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable)
int sdhci_enable(struct mmc_host *mmc)
{
struct sdhci_host *host = mmc_priv(mmc);
- u16 clk;
if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
return 0;
@@ -1869,7 +1868,6 @@ int sdhci_enable(struct mmc_host *mmc)
int sdhci_disable(struct mmc_host *mmc, int lazy)
{
struct sdhci_host *host = mmc_priv(mmc);
- u16 clk;
if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
return 0;
@@ -2339,27 +2337,9 @@ 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) {
- host->flags |= SDHCI_NEEDS_RETUNING;
- mod_timer(&host->tuning_timer, jiffies +
- host->tuning_count * HZ);
- }
-
- sdhci_enable_card_detection(host);
-
- return ret;
- }
+ if (ret)
+ goto err_suspend_host;
}
if (mmc->pm_flags & MMC_PM_KEEP_POWER)
@@ -2368,12 +2348,25 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
- if (host->vmmc)
+ if (host->vmmc) {
ret = regulator_disable(host->vmmc);
+ if (ret)
+ pr_err("%s: failed to disable regulator\n", __func__);
+ }
if (host->irq)
disable_irq(host->irq);
+ return 0;
+
+err_suspend_host:
+ /* Set the re-tuning expiration flag */
+ if ((host->version >= SDHCI_SPEC_300) && host->tuning_count &&
+ (host->tuning_mode == SDHCI_TUNING_MODE_1))
+ host->flags |= SDHCI_NEEDS_RETUNING;
+
+ sdhci_enable_card_detection(host);
+
return ret;
}