diff mbox series

[v3,1/2] firmware: psci: call pm_set_suspend_via_firmware()

Message ID 1592792699-24638-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 22, 2020, 2:24 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

Geert Uytterhoeven Aug. 5, 2020, 8:08 a.m. UTC | #1
Hi Shimoda-san,

CC linux-pm

On Mon, Jun 22, 2020 at 4:25 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> 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>

Thanks for your patch!

While [PATCH v3 2/2] has been rejected, and a different solution (DT
property "full-pwr-cycle-in-suspend") was accepted, I think this patch
has merits on its own: it makes sure pm_suspend_global_flags contains
the correct state not only for systems using ACPI, but also for PSCI.

> --- 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)
>  {

Shouldn't you add a call to pm_set_resume_via_firmware() here?

>         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,
>  };

Gr{oetje,eeting}s,

                        Geert
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,
 };