Re: [PATCH v3 2/2] mmc: core: Call mmc_poweroff_nofity() if pm_suspend_via_firmware()
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2020-06-24 11:15:31
Also in:
linux-mmc, linux-renesas-soc
Hi Ulf, On Wed, Jun 24, 2020 at 12:06 PM Ulf Hansson [off-list ref] wrote:
On Mon, 22 Jun 2020 at 04:25, Yoshihiro Shimoda [off-list ref] wrote:quoted
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.
quoted
--- 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".
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...
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel