linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: fixed regulator control when suspend/resume
@ 2011-04-07  4:23 Jaehoon Chung
  2011-04-08 18:47 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2011-04-07  4:23 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: Chris Ball, Kyungmin Park

Suspend/resume is working always enable regulator after resuming. 
(if there is host->vmmc)
I assume that if regulator is enabled, card is inserted.
Then We need to restore "vmmc".

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/sdhci.c  |    8 +++++---
 include/linux/mmc/sdhci.h |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9e15f41..70cbbd6 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1663,8 +1663,10 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
 
 	free_irq(host->irq, host);
 
-	if (host->vmmc)
+	if (host->vmmc && regulator_is_enabled(host->vmmc)) {
 		ret = regulator_disable(host->vmmc);
+		host->restore_vmmc = true;
+	}
 
 	return ret;
 }
@@ -1675,8 +1677,8 @@ int sdhci_resume_host(struct sdhci_host *host)
 {
 	int ret;
 
-	if (host->vmmc) {
-		int ret = regulator_enable(host->vmmc);
+	if (host->vmmc && host->restore_vmmc) {
+		ret = regulator_enable(host->vmmc);
 		if (ret)
 			return ret;
 	}
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 83bd9f7..1c38261 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -92,6 +92,7 @@ struct sdhci_host {
 	const struct sdhci_ops *ops;	/* Low level hw interface */
 
 	struct regulator *vmmc;	/* Power regulator */
+	bool restore_vmmc;	/* Restore vmmc */
 
 	/* Internal data */
 	struct mmc_host *mmc;	/* MMC structure */
-- 

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

* Re: [PATCH] mmc: sdhci: fixed regulator control when suspend/resume
  2011-04-07  4:23 [PATCH] mmc: sdhci: fixed regulator control when suspend/resume Jaehoon Chung
@ 2011-04-08 18:47 ` Wolfram Sang
  2011-04-09 11:44   ` Jae hoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2011-04-08 18:47 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, Chris Ball, Kyungmin Park

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

On Thu, Apr 07, 2011 at 01:23:52PM +0900, Jaehoon Chung wrote:
> Suspend/resume is working always enable regulator after resuming. 
> (if there is host->vmmc)

The regulator is enabled during add_host. How could it not be enabled in
suspend?

>  	struct regulator *vmmc;	/* Power regulator */
> +	bool restore_vmmc;	/* Restore vmmc */

If you can explain the above, this should be turned into a SDHCI_-flag IMHO.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] mmc: sdhci: fixed regulator control when suspend/resume
  2011-04-08 18:47 ` Wolfram Sang
@ 2011-04-09 11:44   ` Jae hoon Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Jae hoon Chung @ 2011-04-09 11:44 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Jaehoon Chung, linux-mmc@vger.kernel.org, Chris Ball,
	Kyungmin Park

Hi, Wolfram..

2011/4/9 Wolfram Sang <w.sang@pengutronix.de>:
> On Thu, Apr 07, 2011 at 01:23:52PM +0900, Jaehoon Chung wrote:
>> Suspend/resume is working always enable regulator after resuming.
>> (if there is host->vmmc)
>
> The regulator is enabled during add_host. How could it not be enabled in
> suspend?

you're right..When running add_host, enabled the regulator "vmmc".
I'm missing this patch.sorry ^^
Actually,If controller didn't detect the card, i added disable
function in sdhci-s3c.c.
Then regulator is disabled when enter suspend. :)

But i didn't find methed to disable in sdhci.c.
(i think that should be find to use CDn pin)

I'll resend the modified patch.
If you have other method, let me know your opinion.

Thanks very much for your comment.
>
>>       struct regulator *vmmc; /* Power regulator */
>> +     bool restore_vmmc;      /* Restore vmmc */
>
> If you can explain the above, this should be turned into a SDHCI_-flag IMHO.
>
> Regards,
>
>   Wolfram
>
> --
> Pengutronix e.K.                           | Wolfram Sang                |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAk2fWC4ACgkQD27XaX1/VRuTAwCghHV5u2l8tAqnLPAwBf3fz+iV
> MVoAnRB+hXXCZU3xZQghwVVBcm7iu5+H
> =cDOF
> -----END PGP SIGNATURE-----
>
>

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

end of thread, other threads:[~2011-04-09 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-07  4:23 [PATCH] mmc: sdhci: fixed regulator control when suspend/resume Jaehoon Chung
2011-04-08 18:47 ` Wolfram Sang
2011-04-09 11:44   ` Jae hoon Chung

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).