linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eliad@wizery.com (Eliad Peller)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] omap_hsmmc: consider MMC_PM_KEEP_POWER on suspend/resume
Date: Tue, 22 Nov 2011 16:02:17 +0200	[thread overview]
Message-ID: <1321970539-7104-1-git-send-email-eliad@wizery.com> (raw)

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>
---
 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 21e4a79..ec7c83c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2174,13 +2174,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,
@@ -2189,9 +2183,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;
 }
 
@@ -2211,7 +2216,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);
-- 
1.7.6.401.g6a319

             reply	other threads:[~2011-11-22 14:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 14:02 Eliad Peller [this message]
2011-11-22 14:02 ` [PATCH 2/3] omap_hsmmc: add pm_caps field Eliad Peller
2011-11-28  9:15   ` Igor Grinberg
2011-11-28  9:23     ` Eliad Peller
2011-11-28 10:01       ` Igor Grinberg
2011-11-28 10:07         ` Eliad Peller
2011-11-28 10:39           ` Igor Grinberg
2011-11-22 14:02 ` [PATCH 3/3] omap: board-sdp4430: declare support for MMC_PM_KEEP_POWER Eliad Peller
2011-11-28  7:50   ` Coelho, Luciano
2011-11-28  8:26     ` Eliad Peller
2011-11-28  9:08       ` Luciano Coelho
2011-11-28  9:26         ` Igor Grinberg
2011-11-28  9:58           ` Luciano Coelho
2011-11-28 10:12             ` Eliad Peller
2011-11-28 10:18               ` Luciano Coelho
2011-12-01 18:16 ` [PATCH 1/3] omap_hsmmc: consider MMC_PM_KEEP_POWER on suspend/resume Chris Ball
2011-12-09  0:28   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321970539-7104-1-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).