The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1 3/3]mmc: not clock gate host when host is in runtime suspended state
@ 2011-01-14  8:23 Chuanxiao Dong
  0 siblings, 0 replies; only message in thread
From: Chuanxiao Dong @ 2011-01-14  8:23 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-kernel, cjb, ohad

Since mmc clock gating is done in a work queue which is not synchronized with
host runtime power management, when driver is doing clock gating, host may
has already been power gated.

So before driver clock gate host, check whether host is already suspended.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
 drivers/mmc/core/core.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e296c5a..d2121fa 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -670,6 +670,17 @@ void mmc_gate_clock(struct mmc_host *host)
 	host->ios.clock = 0;
 	host->clk_gated = true;
 	spin_unlock_irqrestore(&host->clk_lock, flags);
+#ifdef CONFIG_PM_RUNTIME
+	/*
+	 * mmc clock gating is done in a work queue which
+	 * does not synchronized with host controller runtime
+	 * power management. So when mmc gate clock, host may
+	 * have already in runtime suspend state. In that case,
+	 * driver cannot touch host controller registers
+	 */
+	if (host->class_dev.power.runtime_status != RPM_ACTIVE)
+		return;
+#endif
 	mmc_set_ios(host);
 }
 
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-14  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14  8:23 [PATCH v1 3/3]mmc: not clock gate host when host is in runtime suspended state Chuanxiao Dong

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