mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: Turn the card clock off at suspend time
@ 2014-11-19 18:51 Doug Anderson
  2014-11-19 19:03 ` Andrew Bresticker
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2014-11-19 18:51 UTC (permalink / raw)
  To: Jaehoon Chung, Seungwon Jeon, Ulf Hansson
  Cc: Alim Akhtar, Sonny Rao, Andrew Bresticker, Heiko Stuebner,
	linux-arm-kernel, linux-rockchip, Doug Anderson, chris,
	linux-mmc, linux-kernel

Since the dw_mmc driver was first added to Linux it's had a TODO in it
that we should turn off the card clock during suspend.  I have no idea
for sure why it wasn't done originally, but if I had to guess I'd
guess it was related to the lack of a common clock framework.  Let's
do it now.

There is no reason for the card clock to be left on during suspend and
most systems will eventually turn it off anyway (when whole clock
trees are disabled).  However, it's good to be explicit that it's
disabled at the time that the MMC subsystem is disabled.

This actually fixes a bug on Rockchip rk3288 where an SDIO card wakes
the system back up during suspend.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/mmc/host/dw_mmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 5a37c33..c448159 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2825,11 +2825,10 @@ EXPORT_SYMBOL(dw_mci_remove);
 
 
 #ifdef CONFIG_PM_SLEEP
-/*
- * TODO: we should probably disable the clock to the card in the suspend path.
- */
 int dw_mci_suspend(struct dw_mci *host)
 {
+	clk_disable(host->ciu_clk);
+
 	return 0;
 }
 EXPORT_SYMBOL(dw_mci_suspend);
@@ -2838,6 +2837,8 @@ int dw_mci_resume(struct dw_mci *host)
 {
 	int i, ret;
 
+	clk_enable(host->ciu_clk);
+
 	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
 		ret = -ENODEV;
 		return ret;
-- 
2.1.0.rc2.206.gedb03e5


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-19 21:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 18:51 [PATCH] mmc: dw_mmc: Turn the card clock off at suspend time Doug Anderson
2014-11-19 19:03 ` Andrew Bresticker
2014-11-19 19:30   ` Doug Anderson
2014-11-19 19:49     ` Andrew Bresticker
2014-11-19 21:14       ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®