All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH/RFC] mmc: core: Issue power_off_notify for eMMC Suspend-to-RAM
Date: Mon, 8 Jun 2020 13:45:29 +0200	[thread overview]
Message-ID: <CAPDyKFrcENub_NCP5s0v+3A09O55qGrK+gNrVswYjdqoLzPVzA@mail.gmail.com> (raw)
In-Reply-To: <TY2PR01MB3692FAFE6FCA89538FA3AC4DD8850@TY2PR01MB3692.jpnprd01.prod.outlook.com>

On Mon, 8 Jun 2020 at 12:39, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
>
> > From: Ulf Hansson, Sent: Monday, June 8, 2020 5:14 PM
> > On Thu, 4 Jun 2020 at 14:17, Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@renesas.com> wrote:
> > >
> > > Hi again,
> > >
> > > > From: Yoshihiro Shimoda, Sent: Tuesday, May 19, 2020 8:33 PM
> > > >
> > > > The commit 432356793415 ("mmc: core: Enable power_off_notify for
> > > > eMMC shutdown sequence") enabled the power off notification
> > > > even if MMC_CAP2_POWEROFF_NOTIFY (MMC_CAP2_FULL_PWR_CYCLE now) is
> > > > not set. However, the mmc core lacks to issue the power off
> > > > notificaiton when Suspend-to-{RAM,Disk} happens on the system.
> > > >
> > > > So, add Suspend-to-RAM support at first because this is easy to
> > > > check by using pm_suspend_target_state condition on _mmc_suspend().
> > > >
> > > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > >
> > > I'd like to add more detail why this patch is needed.
> > > I think we should think some events (which are Shutdown, Suspend-to-idle,
> > > Suspend-to-RAM) for the Power off Notification control.
> > > I described these events like below.
> > >
> > > Assumption of the host : MMC_CAP2_FULL_PWR_CYCLE=false
> > > Assumption of the eMMC : in POWERED_ON
> > >
> > > 1) Event  : Shutdown
> > > - power   : going to VCC=OFF & VCCQ=OFF
> > > - ideal   : Either POWER_OFF_LONG or POWER_OFF_SHORT
> > > - current : POWER_OFF_LONG --> Perfect
> > > - Remarks : the commit 432356793415
> > >
> > > 2) Event  : Suspend-to-Idle
> > > - power   : Keep VCC=ON & VCCQ=ON
> > > - ideal   : issue MMC_SLEEP_AWAKE and keep the power (because the host could not change VCC=OFF)
> > > - current : issue MMC_SLEEP_AWAKE and keep the power --> Perfect
> > > - Remarks : IIUC, even if the eMMC is in POWERED_ON, a host can issue CMD5 (sleep).
> >
> > As a matter of fact, VCCQ *must* remain on in sleep state, while VCC
> > can be powered off.
>
> I got it.
>
> > >
> > > 3) Event  : Suspend-to-RAM
> > > - power   : going to VCC=OFF & VCCQ=OFF
> >
> > I don't understand why you think S2R should be treated differently
> > from S2I? At least from the MMC subsystem point of view, there is no
> > difference. No?
>
> On my environment, VCC & VCCQ condition differs like below.
>  S2I: VCC=ON & VCCQ=ON
>  S2R: VCC=OFF & VCCQ=OFF

Can you explain why it differs? Who is managing the regulators and who
decides to turn them off?

Perhaps this is a regulator-enable usage count problem?

>
> So, I think the MMC subsystem should not enter sleep mode
> on such environment. If this is board-specific, I'm thinking
> I should add a new flag to fix the issue which is entering
> sleep mode even if VCCQ=OFF.
>
> > > - ideal   : Either POWER_OFF_LONG or POWER_OFF_SHORT (because the same as the "Shutdown" event)
> > > - current : issue MMC_SLEEP_AWAKE --> NG
> > > - Remarks : So, I tried to fix this by the patch.
> > >
> > > In addition, we should also think about the event of unbind.
> >
> > Yes, very good point.
> >
> > >
> > > 4) Event  : Unbind
> > > - power   : Keep VCC=ON & VCCQ=ON
> > > - ideal   : NO_POWER_NOTIFICATION because user is possible to turn the power off
> > > - current : Keep POWERED_ON --> NG
> > > - Remarks : But, I didn't try to fix this yet.
> >
> > I don't quite understand why we should keep VCC and VCCQ on?
>
> Oops. I should have described a use case. I thought one of use cases was
> using mmc_test driver. So, I thought we should keep VCC and VCCQ on to
> use mmc_test driver.

Okay, let me think about this.

Actually, we can also unbind the mmc host. And if re-binding again,
that should still work.

>
> > In principle I think we should treat "unbind" in the similar way as we
> > treat S2R/S2I. Which means sending power-off-notification if the host
> > supports MMC_CAP2_FULL_PWR_CYCLE, otherwise we should send sleep.
>
> If we didn't take care of mmc_test driver after unbind, I think so.

Kind regards
Uffe

  reply	other threads:[~2020-06-08 11:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 11:33 [PATCH/RFC] mmc: core: Issue power_off_notify for eMMC Suspend-to-RAM Yoshihiro Shimoda
2020-06-04 12:17 ` Yoshihiro Shimoda
2020-06-08  8:14   ` Ulf Hansson
2020-06-08 10:39     ` Yoshihiro Shimoda
2020-06-08 11:45       ` Ulf Hansson [this message]
2020-06-08 12:36         ` Geert Uytterhoeven
2020-06-08 14:50           ` Ulf Hansson
2020-06-09 10:29             ` Yoshihiro Shimoda
2020-06-08  7:57 ` Ulf Hansson
2020-06-08 10:38   ` Yoshihiro Shimoda

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=CAPDyKFrcENub_NCP5s0v+3A09O55qGrK+gNrVswYjdqoLzPVzA@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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.