All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@stericsson.com>
To: Saugata Das <saugata.das@linaro.org>
Cc: Per Forlin <per.lkml@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Girish K S <girish.shivananjappa@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"cjb@laptop.org" <cjb@laptop.org>,
	"patches@linaro.org" <patches@linaro.org>,
	"subhashj@codeaurora.org" <subhashj@codeaurora.org>,
	Per FORLIN <per.forlin@stericsson.com>
Subject: Re: [PATCH v5] MMC-4.5 Power OFF Notify Rework
Date: Fri, 15 Jun 2012 09:22:53 +0200	[thread overview]
Message-ID: <4FDAE2CD.6090703@stericsson.com> (raw)
In-Reply-To: <CAKLKtze-TtrC89hbyQn3KcyBRdiMMTJdeo5899tddioqOJxp1w@mail.gmail.com>

On 06/15/2012 05:49 AM, Saugata Das wrote:
> On 15 June 2012 00:36, Per Forlin<per.lkml@gmail.com>  wrote:
>> Hi Saugata,
>>
>> I can have a go and test it. But first I would like to bring up 3
>> concerns that I have with this patch.
>>
>> 1. This patch should be sent to cc-stable in order to repair the bug
>> introduced in 3.4
>
> I shall sent it out today.
>
>> 2. Is the bus_ops for poweroff_notify really necessary since only mmc
>> use it?
>
> This was recommended in the review from Ulf. If it is not adding to a
> bug, I propose to keep it this way. Otherwise, we will be going in
> circles :-)

Moreover it seems close related to sleep, which is implemented with 
bus_ops. So I would say, keep as is. We might change later, then both 
sleep and poweroff_notify together.

>
>> There are already bus_ops for suspend/resume,
>> power_save/power_restore and remove. It feels like it would be
>> possible to address poweroff_notify internally from mmc.c from theses
>> bus_ops. I would be nice to add this feature without having to touch
>> core.c.
>>
>> For instance. Call mmc_suspend() from mmc_remove()
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -1302,7 +1302,7 @@ static void mmc_remove(struct mmc_host *host)
>> +       __mmc_suspend(host, true);
>>         mmc_remove_card(host->card);
>>
>> @@ -1347,7 +1347,7 @@ static void mmc_detect(struct mmc_host *host)
>> -static int mmc_suspend(struct mmc_host *host)
>> +static int __mmc_suspend(struct mmc_host *host, bool remove)
>>
>> @@ -1356,7 +1356,8 @@ static int mmc_suspend(struct mmc_host *host)
>>         mmc_claim_host(host);
>>         if (mmc_can_poweroff_notify(host->card)&&
>> -               (host->caps2&  MMC_CAP2_POWER_OFF_VCCQ_DURING_SUSPEND)) {
>> +               (host->caps2&  MMC_CAP2_POWER_OFF_VCCQ_DURING_SUSPEND ||
>> +                remove)) {
>>                 err = mmc_poweroff_notify(host, MMC_PW_OFF_NOTIFY_SHORT);
>>         } else {
>>                 if (mmc_card_can_sleep(host))
>>
>> @@ -1372,6 +1373,11 @@ static int mmc_suspend(struct mmc_host *host)
>> +static int mmc_suspend(struct mmc_host *host)
>> +{
>> +       return __mmc_suspend(host, false);
>> +}
>> +
>>
>> Calling mmc_suspend from mmc_remove() has another advantage since it
>> may issue SLEEP (CMD5) before the card is removed and power off. This
>> is recommended by eMMC Vendors in order to shutdown the eMMC safely to
>> prevent data corruption. When the platform shuts down the power to the
>> eMMC will be turned off no matter what.
>
> May be for MMC-4.41 cards this approach can be taken. For MMC-4.5, it
> has to be power OFF notify when the power is removed. Lets do it for
> another patch, since the intention of this patch is to fix the issues
> around power OFF notify.

I agree with you Saugata, the exact same sequence as in suspend can not 
be used. The reason is simply that we do not want to consider 
MMC_CAP2_POWER_OFF_VCCQ_DURING_SUSPEND for doing poweroff_notify here, 
as we want in suspend.

Leave this to be fixed in a separate patch instead.

>
>>
>> 3. About the sleep and awake issue. This is not really related to
>> poweroff_notify() as I see it. I would recommend to use CMD 0 to
>> re-init the card safely after sleep in this patch. Then you could send
>> out a sleep/awake patch that address this separately.  This would also
>> make #1 easier, send patch to cc-stable. Adding save/restore IOS is a
>> new feature and should not be sent to the cc-stable list. What do you
>> think?
>
> The problem in sending CMD0 without power OFF notify is possibility of
> some data loss in MMC-4.5 devices.

I don't see the problem here. You will be sending power OFF notify when 
you can. The only difference is when you "wake" the device from sleep 
mode. Instead of using CMD5, which may work is some cases and in some 
cases not (without restoring ios). So using CMD0 as common way of waking 
up from suspend should be fine. Unless I missed something of course. :-)

Kind regards
Ulf Hansson

  reply	other threads:[~2012-06-15  7:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 11:45 [PATCH v5] MMC-4.5 Power OFF Notify Rework Girish K S
2012-05-23  8:00 ` Subhash Jadavani
2012-05-23 11:16 ` Ulf Hansson
2012-05-28 11:03 ` Subhash Jadavani
2012-05-28 15:07   ` Saugata Das
2012-05-29  3:36   ` Girish K S
2012-06-14 13:13 ` Per Forlin
2012-06-14 13:21   ` Girish K S
2012-06-14 14:50     ` Ulf Hansson
2012-06-14 15:15       ` Saugata Das
2012-06-14 19:06         ` Per Forlin
2012-06-15  3:49           ` Saugata Das
2012-06-15  7:22             ` Ulf Hansson [this message]
2012-06-15  7:49               ` Per Forlin
2012-06-15  8:34               ` Saugata Das
2012-06-15  9:52                 ` Per Forlin
2012-06-15 10:52                   ` Saugata Das
2012-06-15 11:26                     ` Ulf Hansson
2012-06-15 11:34                       ` Saugata Das
2012-06-15 12:07                         ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FDAE2CD.6090703@stericsson.com \
    --to=ulf.hansson@stericsson.com \
    --cc=cjb@laptop.org \
    --cc=girish.shivananjappa@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=per.forlin@stericsson.com \
    --cc=per.lkml@gmail.com \
    --cc=saugata.das@linaro.org \
    --cc=subhashj@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.