diff mbox

mmc: sdhci: fixed regulator control when suspend/resume

Message ID 4D9D3C58.5030901@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jaehoon Chung April 7, 2011, 4:23 a.m. UTC
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(-)

Comments

Wolfram Sang April 8, 2011, 6:47 p.m. UTC | #1
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
Jaehoon Chung April 9, 2011, 11:44 a.m. UTC | #2
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-----
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 */