linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH v3 2/2] mmc: core: Call mmc_poweroff_nofity() if pm_suspend_via_firmware()
Date: Thu, 25 Jun 2020 06:31:33 +0000	[thread overview]
Message-ID: <TY2PR01MB36921A71A493ABD624A28C42D8920@TY2PR01MB3692.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdXjU7N4oG89YsozGijMpjgKGN6ezw2qm6FeGX=JyRhsvg@mail.gmail.com>

Hi Ulf, Geert,

> From: Geert Uytterhoeven, Sent: Wednesday, June 24, 2020 8:13 PM
> 
> Hi Ulf,
> 
> On Wed, Jun 24, 2020 at 12:06 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Mon, 22 Jun 2020 at 04:25, Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > If pm_suspend_via_firmware() returns true, the system will be able
> > > to cut both vcc and vccq in the suspend. So, call
> > > mmc_poweroff_nofity() if pm_suspend_via_firmware() returns true.
> > >
> > > Note that we should not update the MMC_CAP2_FULL_PWR_CYCLE caps
> > > because the mmc_select_voltage() checks the caps when attaches
> > > a mmc/sd.
> 
> > > --- a/drivers/mmc/core/mmc.c
> > > +++ b/drivers/mmc/core/mmc.c
> > > @@ -2038,7 +2039,8 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
> > >                 goto out;
> > >
> > >         if (mmc_can_poweroff_notify(host->card) &&
> > > -               ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend))
> > > +           ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend ||
> > > +            pm_suspend_via_firmware()))
> >
> > Sorry, but this doesn't work.
> >
> > Even if PSCI is a generic FW interface, it doesn't mean that all PSCI
> > implementations will cut the vcc and vccq for the MMC card at system
> > suspend.
> 
> Indeed, there's nothing guaranteed here.  Nor documented how it should
> behave.  Basically the firmware is free to power off the SoC. Or not do that.
> "If firmware is involved, all odds are off".

I thought we could be guaranteed. But, I understood we could not be guaranteed...

> > Instead, you need to decide this based on some specific DT property.
> > Perhaps in conjunction with using pm_suspend_via_firmware().
> 
> Last time I was involved in a discussion about this, the PSCI people
> didn't want to add any properties describing particular PSCI behavior...
> "If firmware is involved, all odds are off".
> 
> So the only safe thing to do is to expect the worst, and prepare for it...

A headache point is an eMMC device consumes much power if that the system
doesn't cut the vcc and vccq and doesn’t enter the sleep mode.
In other words, in power consumption point of view, this patch will
cause a regression in such a case...

By the way, about adding specific DT property, the regulator can have
regulator-off-in-suspend property in regulator-state-mem subnode.
For now, we doesn't seem to get the property from a regulator consumer though.
So, I'll try to add an API of regulator for it.

Best regards,
Yoshihiro Shimoda

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

  reply	other threads:[~2020-06-25  6:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22  2:24 [PATCH v3 0/2] treewide: fix _mmc_suspend() on PSCI Yoshihiro Shimoda
2020-06-22  2:24 ` [PATCH v3 1/2] firmware: psci: call pm_set_suspend_via_firmware() Yoshihiro Shimoda
2020-08-05  8:08   ` Geert Uytterhoeven
2020-06-22  2:24 ` [PATCH v3 2/2] mmc: core: Call mmc_poweroff_nofity() if pm_suspend_via_firmware() Yoshihiro Shimoda
2020-06-24 10:05   ` Ulf Hansson
2020-06-24 11:13     ` Geert Uytterhoeven
2020-06-25  6:31       ` Yoshihiro Shimoda [this message]
2020-06-25  9:26         ` Geert Uytterhoeven
2020-06-26 11:03           ` Ulf Hansson
2020-07-02 12:37             ` Yoshihiro Shimoda
2020-07-06 13:10               ` Ulf Hansson
2020-07-07  1:26                 ` 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=TY2PR01MB36921A71A493ABD624A28C42D8920@TY2PR01MB3692.jpnprd01.prod.outlook.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --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 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).