public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MMC/pxamci: workaround regulator framework bugs
@ 2009-06-26 23:07 Daniel Ribeiro
  2009-06-27  0:48 ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Ribeiro @ 2009-06-26 23:07 UTC (permalink / raw)
  To: Pierre Ossman, linux-kernel
  Cc: Eric Miao, Mark Brown, openezx-devel, David Brownell,
	Liam Girdwood, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

The voltage regulator framework can't sanely deal with voltage
regulators which are left enabled by the bootloader. We workaround this
by forcing an enable()/disable() pair so it has a sane use_count.

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>

---
 drivers/mmc/host/pxamci.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index d7d7109..20fb3da 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -80,6 +80,18 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 	if (IS_ERR(host->vcc))
 		host->vcc = NULL;
 	else {
+		/*
+		 * When the bootloader leaves a supply active, it's
+		 * initialized with zero usecount ... and we can't
+		 * disable it without first enabling it.  Until the
+		 * framework is fixed, we need a workaround like this
+		 * (which is safe for MMC, but not in general).
+		 */
+		if (regulator_is_enabled(host->vcc) > 0) {
+			regulator_enable(host->vcc);
+			regulator_disable(host->vcc);
+		}
+
 		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
 		if (host->pdata && host->pdata->ocr_mask)
 			dev_warn(mmc_dev(host->mmc),
-- 
tg: (87da0bf..) mmc/workaround-regulator-bugs (depends on: mmc/pxamci-regulator-support)

-- 
Daniel Ribeiro

[-- Attachment #2: Esta é uma parte de mensagem assinada digitalmente --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2009-07-24 14:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-26 23:07 [PATCH 1/2] MMC/pxamci: workaround regulator framework bugs Daniel Ribeiro
2009-06-27  0:48 ` Mark Brown
2009-06-27  2:55   ` Daniel Ribeiro
2009-06-29  3:00     ` Eric Miao
2009-06-29  9:43       ` Mark Brown
2009-07-01  2:36         ` David Brownell
2009-07-01 11:46           ` Mark Brown
2009-07-22 21:03             ` David Brownell
2009-07-24 14:35               ` Mark Brown

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