diff mbox series

[PATCH/RFC,v2,1/2] firmware: psci: call pm_set_suspend_via_firmware()

Message ID 1592566143-4546-2-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State New, archived
Headers show
Series treewide: fix _mmc_suspend() on PSCI | expand

Commit Message

Yoshihiro Shimoda June 19, 2020, 11:29 a.m. UTC
Call pm_set_suspend_via_firmware() in .begin() of psci_suspend_ops
to use pm_suspend_via_firmware() on PSCI environment.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/firmware/psci/psci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Sudeep Holla June 29, 2020, 2:33 p.m. UTC | #1
(This patch never made it to my inbox, may be due to ALKML issues on that day)

On Fri, Jun 19, 2020 at 08:29:02PM +0900, Yoshihiro Shimoda wrote:
> Call pm_set_suspend_via_firmware() in .begin() of psci_suspend_ops
> to use pm_suspend_via_firmware() on PSCI environment.
>

I don't have issues with this change as such, but I need to understand
how and why this is used. I will comment on that separately.

--
Regards,
Sudeep
Yoshihiro Shimoda June 30, 2020, 8:53 a.m. UTC | #2
Hi Sudeep,

> From: Sudeep Holla, Sent: Monday, June 29, 2020 11:33 PM
> 
> (This patch never made it to my inbox, may be due to ALKML issues on that day)
> 
> On Fri, Jun 19, 2020 at 08:29:02PM +0900, Yoshihiro Shimoda wrote:
> > Call pm_set_suspend_via_firmware() in .begin() of psci_suspend_ops
> > to use pm_suspend_via_firmware() on PSCI environment.
> >
> 
> I don't have issues with this change as such, but I need to understand
> how and why this is used. I will comment on that separately.

I thought MMC driver could use this API to detect whether the firmware was suspending or not.
However, Ulf said this was not a good way because all implementation of PSCI
will not turn the power off while system suspend [1]. Also, as you and Mark said on other
email thread [2], the current PSCI specification cannot inform system suspend state
to OS (Linux).

So, I think I should recall this patch because this cannot get expected information.


[1]
https://lore.kernel.org/linux-renesas-soc/CAPDyKFq-dEPaU094hrk2xg18VpJAsbnf8enieFmcMhKiB1bW1A@mail.gmail.com/


https://lore.kernel.org/linux-renesas-soc/CAMuHMdXh1Hh6H35Mp8hBJBykUucRNwxTmW+U9SHM+xhrcwasDA@mail.gmail.com/T/#m442a2ce972cfdb3ff33637c120c8d096e4d07af8

Best regards,
Yoshihiro Shimoda

> --
> Regards,
> Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 92013ec..1c22b01 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -309,6 +309,13 @@  static int psci_system_suspend(unsigned long unused)
 			      __pa_symbol(cpu_resume), 0, 0);
 }
 
+static int psci_system_suspend_begin(suspend_state_t state)
+{
+	pm_set_suspend_via_firmware();
+
+	return 0;
+}
+
 static int psci_system_suspend_enter(suspend_state_t state)
 {
 	return cpu_suspend(0, psci_system_suspend);
@@ -316,6 +323,7 @@  static int psci_system_suspend_enter(suspend_state_t state)
 
 static const struct platform_suspend_ops psci_suspend_ops = {
 	.valid          = suspend_valid_only_mem,
+	.begin          = psci_system_suspend_begin,
 	.enter          = psci_system_suspend_enter,
 };