diff options
author | Eliad Peller <eliad@wizery.com> | 2011-11-22 16:02:17 +0200 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-12-08 16:24:09 -0800 |
commit | 31f9d4635bde3f03bc6dbac01d4c0fb0da9d06d7 (patch) | |
tree | bebd0a1b33b667cd242c1b33b6eff13e1a87f83c /drivers/mmc/host/omap_hsmmc.c | |
parent | 5611cc4572e889b62a7b4c72a413536bf6a9c416 (diff) | |
download | op-kernel-dev-31f9d4635bde3f03bc6dbac01d4c0fb0da9d06d7.zip op-kernel-dev-31f9d4635bde3f03bc6dbac01d4c0fb0da9d06d7.tar.gz |
omap_hsmmc: consider MMC_PM_KEEP_POWER on suspend/resume
When an mmc card has the MMC_PM_KEEP_POWER flag, it shouldn't
be powered off on suspend (and thus doesn't have to be powered-on
on resume)
While on it, change the suspend flow a bit, to make it a bit
easier to follow.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Acked-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 101cd31..6784fbb 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2176,13 +2176,7 @@ static int omap_hsmmc_suspend(struct device *dev) cancel_work_sync(&host->mmc_carddetect_work); ret = mmc_suspend_host(host->mmc); - if (ret == 0) { - omap_hsmmc_disable_irq(host); - OMAP_HSMMC_WRITE(host->base, HCTL, - OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); - if (host->got_dbclk) - clk_disable(host->dbclk); - } else { + if (ret) { host->suspended = 0; if (host->pdata->resume) { ret = host->pdata->resume(&pdev->dev, @@ -2191,9 +2185,20 @@ static int omap_hsmmc_suspend(struct device *dev) dev_dbg(mmc_dev(host->mmc), "Unmask interrupt failed\n"); } + goto err; } - pm_runtime_put_sync(host->dev); + + if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { + omap_hsmmc_disable_irq(host); + OMAP_HSMMC_WRITE(host->base, HCTL, + OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); + } + if (host->got_dbclk) + clk_disable(host->dbclk); + } +err: + pm_runtime_put_sync(host->dev); return ret; } @@ -2213,7 +2218,8 @@ static int omap_hsmmc_resume(struct device *dev) if (host->got_dbclk) clk_enable(host->dbclk); - omap_hsmmc_conf_bus_power(host); + if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) + omap_hsmmc_conf_bus_power(host); if (host->pdata->resume) { ret = host->pdata->resume(&pdev->dev, host->slot_id); |