[PATCH/RFC,v2,2/2] mmc: core: Call mmc_power_off_nofity() if pm_suspend_via_firmware()
diff mbox series

Message ID 1592566143-4546-3-git-send-email-yoshihiro.shimoda.uh@renesas.com
State New
Headers show
Series
  • treewide: fix _mmc_suspend() on PSCI
Related show

Commit Message

Yoshihiro Shimoda June 19, 2020, 11:29 a.m. UTC
If pm_suspend_via_firmware() returns true, the system will be able
to cut both vcc and vccq in the suspend. So, call
mmc_power_off_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.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/mmc/core/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov June 19, 2020, 1:41 p.m. UTC | #1
Hello!

On 19.06.2020 14:29, Yoshihiro Shimoda 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_power_off_nofity() if pm_suspend_via_firmware() returns true.

    mmc_poweroff_notify()? :-)

> 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.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>   drivers/mmc/core/mmc.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 4203303..81941fd 100644
> --- 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()))
>   		err = mmc_poweroff_notify(host->card, notify_type);
>   	else if (mmc_can_sleep(host->card))
>   		err = mmc_sleep(host);
> 

MBR, Sergei
Yoshihiro Shimoda June 22, 2020, 1:46 a.m. UTC | #2
Hello!

Thank you for your review!

> From: Sergei Shtylyov, Sent: Friday, June 19, 2020 10:41 PM
> 
> Hello!
> 
> On 19.06.2020 14:29, Yoshihiro Shimoda 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_power_off_nofity() if pm_suspend_via_firmware() returns true.
> 
>     mmc_poweroff_notify()? :-)

Oops! I'll fix it.

Best regards,
Yoshihiro Shimoda

> > 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.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >   drivers/mmc/core/mmc.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > index 4203303..81941fd 100644
> > --- 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()))
> >   		err = mmc_poweroff_notify(host->card, notify_type);
> >   	else if (mmc_can_sleep(host->card))
> >   		err = mmc_sleep(host);
> >
> 
> MBR, Sergei

Patch
diff mbox series

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4203303..81941fd 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>
@@ -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()))
 		err = mmc_poweroff_notify(host->card, notify_type);
 	else if (mmc_can_sleep(host->card))
 		err = mmc_sleep(host);