From: "Heiko Stübner" <heiko@sntech.de>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org,
Chander Kashyap <chander.kashyap@linaro.org>,
Seungwon Jeon <tgih.jun@samsung.com>
Subject: [PATCH] mmc: sdhci-s3c: fix missing clock for gpio card-detect
Date: Sun, 18 Nov 2012 19:50:05 +0100 [thread overview]
Message-ID: <201211181950.06005.heiko@sntech.de> (raw)
In-Reply-To: <87pq3c7wza.fsf@octavius.laptop.org>
Commit 2abeb5c5ded2 (Add clk_(enable/disable) in runtime suspend/resume)
added the capability to stop the clocks when the device is runtime
suspended, but forgot to handle the case of the card-detect using
an external gpio.
Therefore in the case that runtime-pm is enabled, start the io-clock
when a card is inserted and stop it again once it is removed.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
drivers/mmc/host/sdhci-s3c.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
This _should_ go into 3.7 because currently it causes a regression there.
Nevertheless it applies to both 3.7-rc6 and linux-next.
I also tried to use pm_runtime_get_sync (and _put) there, but it didn't
seem to work and the clock was still missing. With the changes in this
patch, the gpio-card-detect works again on my machine - all of insert,
remove and reinsert.
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index a54dd5d..c9ec725 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -373,18 +373,25 @@ static struct sdhci_ops sdhci_s3c_ops = {
static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
{
struct sdhci_host *host = platform_get_drvdata(dev);
+ struct sdhci_s3c *sc = sdhci_priv(host);
unsigned long flags;
if (host) {
spin_lock_irqsave(&host->lock, flags);
if (state) {
dev_dbg(&dev->dev, "card inserted.\n");
+#ifdef CONFIG_PM_RUNTIME
+ clk_prepare_enable(sc->clk_io);
+#endif
host->flags &= ~SDHCI_DEVICE_DEAD;
host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
} else {
dev_dbg(&dev->dev, "card removed.\n");
host->flags |= SDHCI_DEVICE_DEAD;
host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
+#ifdef CONFIG_PM_RUNTIME
+ clk_disable_unprepare(sc->clk_io);
+#endif
}
tasklet_schedule(&host->card_tasklet);
spin_unlock_irqrestore(&host->lock, flags);
--
1.7.2.3
next prev parent reply other threads:[~2012-11-18 19:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 22:57 [PATCH] Revert "mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume" Heiko Stübner
2012-11-17 21:14 ` Chris Ball
2012-11-18 18:50 ` Heiko Stübner [this message]
2012-11-18 19:05 ` [PATCH] mmc: sdhci-s3c: fix missing clock for gpio card-detect Chris Ball
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=201211181950.06005.heiko@sntech.de \
--to=heiko@sntech.de \
--cc=chander.kashyap@linaro.org \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=tgih.jun@samsung.com \
/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