diff mbox

[RFC/RFT] MMC: CORE: eMMC in Sleep mode before suspend

Message ID 1310567787-14697-1-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K July 13, 2011, 2:36 p.m. UTC
Put MMC to sleep if it supports SLEEP/AWAKE (CMD5)
in the mmc suspend to minimize power consumption.

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/mmc/core/mmc.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

subhashj@codeaurora.org July 14, 2011, 2:05 p.m. UTC | #1
Balaji,

Tried this patch along with disabling the eMMC VCC supply in suspend and it
works !!! Without this patch, if I disabled the VCC supply then after resume
I/O errors are seen. This change also complies with eMMC spec so am ok with
this change.

Regards,
Subhash
Venkatraman S July 19, 2011, 4:01 p.m. UTC | #2
On Wed, Jul 13, 2011 at 8:06 PM, Balaji T K <balajitk@ti.com> wrote:
> Put MMC to sleep if it supports SLEEP/AWAKE (CMD5)
> in the mmc suspend to minimize power consumption.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
>  drivers/mmc/core/mmc.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index afabdc3..e8dfcde 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -900,16 +900,20 @@ static void mmc_detect(struct mmc_host *host)
>  */
>  static int mmc_suspend(struct mmc_host *host)
>  {
> +       int err = 0;
> +
>        BUG_ON(!host);
>        BUG_ON(!host->card);
>
>        mmc_claim_host(host);
> -       if (!mmc_host_is_spi(host))
> +       if (mmc_card_can_sleep(host))
> +               err = mmc_card_sleep(host);
> +       else if (!mmc_host_is_spi(host))
>                mmc_deselect_cards(host);
>        host->card->state &= ~MMC_STATE_HIGHSPEED;
>        mmc_release_host(host);
>
> -       return 0;
> +       return err;
>  }
>
>  /*
> --
> 1.7.0.4
>

Balaji,
  Would you mind reposting the patch without the RFC and s/CORE/core
in subject line ?
You can add my
Acked-by: Venkatraman S <svenkatr@ti.com>
--
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
Chris Ball July 19, 2011, 4:48 p.m. UTC | #3
Hi,

On Tue, Jul 19 2011, S, Venkatraman wrote:
> On Wed, Jul 13, 2011 at 8:06 PM, Balaji T K <balajitk@ti.com> wrote:
>> Put MMC to sleep if it supports SLEEP/AWAKE (CMD5)
>> in the mmc suspend to minimize power consumption.
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>
> Balaji,
>   Would you mind reposting the patch without the RFC and s/CORE/core
> in subject line ?
> You can add my
> Acked-by: Venkatraman S <svenkatr@ti.com>

No need to resend, thanks -- pushed to mmc-next with these changes and
the ACK.

Anyone object to letting this soak in mmc-next for a release and merging
it in 3.2?  I'm worried that we'll find card or host quirks around this,
and the 3.0 release is probably happening today.

- Chris.
Adrian Hunter July 21, 2011, 8:12 p.m. UTC | #4
On 19/07/2011 7:48 p.m., Chris Ball wrote:
> Hi,
>
> On Tue, Jul 19 2011, S, Venkatraman wrote:
>> On Wed, Jul 13, 2011 at 8:06 PM, Balaji T K<balajitk@ti.com>  wrote:
>>> Put MMC to sleep if it supports SLEEP/AWAKE (CMD5)
>>> in the mmc suspend to minimize power consumption.
>>>
>>> Signed-off-by: Balaji T K<balajitk@ti.com>
>> Balaji,
>>    Would you mind reposting the patch without the RFC and s/CORE/core
>> in subject line ?
>> You can add my
>> Acked-by: Venkatraman S<svenkatr@ti.com>
> No need to resend, thanks -- pushed to mmc-next with these changes and
> the ACK.
>
> Anyone object to letting this soak in mmc-next for a release and merging
> it in 3.2?  I'm worried that we'll find card or host quirks around this,
> and the 3.0 release is probably happening today.

eMMC often have VccQ (logic) always on (or sharing the same power as 
SDRAM which comes to the same thing), but can switch off Vcc (NAND 
core).  However, turning off Vcc without first putting the card to sleep 
can result in errors i.e. you are not allowed to do it.

This patch seems to be covering the "VccQ always on" case but relies on 
CMD0 to wake up the card.

If that is what is going on, then some comments to that effect are 
needed, including within mmc_init_card to note that mmc_go_idle is 
needed for cards that are asleep - if that is, in fact, correct.

Also, wouldn't it be nice to wake up the card with CMD5 which should be 
much faster than re-initialising?

> - Chris.

--
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/core/mmc.c b/drivers/mmc/core/mmc.c
index afabdc3..e8dfcde 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -900,16 +900,20 @@  static void mmc_detect(struct mmc_host *host)
  */
 static int mmc_suspend(struct mmc_host *host)
 {
+	int err = 0;
+
 	BUG_ON(!host);
 	BUG_ON(!host->card);
 
 	mmc_claim_host(host);
-	if (!mmc_host_is_spi(host))
+	if (mmc_card_can_sleep(host))
+		err = mmc_card_sleep(host);
+	else if (!mmc_host_is_spi(host))
 		mmc_deselect_cards(host);
 	host->card->state &= ~MMC_STATE_HIGHSPEED;
 	mmc_release_host(host);
 
-	return 0;
+	return err;
 }
 
 /*