All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] mmc: core: Issue power_off_notify for eMMC Suspend-to-RAM
@ 2020-05-19 11:33 Yoshihiro Shimoda
  2020-06-04 12:17 ` Yoshihiro Shimoda
  2020-06-08  7:57 ` Ulf Hansson
  0 siblings, 2 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2020-05-19 11:33 UTC (permalink / raw)
  To: ulf.hansson; +Cc: linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

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>
---
 drivers/mmc/core/mmc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4203303..4a23f83 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -11,6 +11,7 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
+#include <linux/suspend.h>
 #include <linux/pm_runtime.h>
 
 #include <linux/mmc/host.h>
@@ -2027,6 +2028,12 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
 	int err = 0;
 	unsigned int notify_type = is_suspend ? EXT_CSD_POWER_OFF_SHORT :
 					EXT_CSD_POWER_OFF_LONG;
+	bool s2ram = false;
+
+#ifdef CONFIG_PM_SLEEP
+	if (pm_suspend_target_state == PM_SUSPEND_MEM)
+		s2ram = true;
+#endif
 
 	mmc_claim_host(host);
 
@@ -2038,7 +2045,7 @@ 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 || s2ram))
 		err = mmc_poweroff_notify(host->card, notify_type);
 	else if (mmc_can_sleep(host->card))
 		err = mmc_sleep(host);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-09 10:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.