linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: PM: s2idle: Invoke _PTS for s2idle
@ 2021-04-19  9:07 Kai-Heng Feng
  2021-04-19 11:34 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Kai-Heng Feng @ 2021-04-19  9:07 UTC (permalink / raw)
  To: rjw; +Cc: Kai-Heng Feng, Len Brown, open list:ACPI, open list

HP EliteBook 840 G8 reboots on s2idle resume, and HP EliteBook 845 G8
wakes up immediately on s2idle. Both are caused by the XMM7360 WWAN PCI
card.

There's a WWAN specific method to really turn off the WWAN via EC:
    Method (_PTS, 1, NotSerialized)  // _PTS: Prepare To Sleep
    {
    ...
        If (CondRefOf (\_SB.PCI0.GP12.PTS))
        {
            \_SB.PCI0.GP12.PTS (Arg0)
        }
    ...
    }

    Scope (_SB.PCI0.GP12)
    {
    ...
        Method (PTS, 1, Serialized)
        {
            If (^^LPCB.EC0.ECRG)
            {
                If ((PDID == 0xFFFF))
                {
                    Return (Zero)
                }

                POFF ()
                SGIO (WWBR, One)
                Sleep (0x1E)
                Acquire (^^LPCB.EC0.ECMX, 0xFFFF)
                ^^LPCB.EC0.WWP = One
                Release (^^LPCB.EC0.ECMX)
                Sleep (0x01F4)
            }

            Return (Zero)
        }
    ...
    }

So let's also invok _PTS for s2idle.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/acpi/sleep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 09fd13757b65..7e84b4b09919 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -698,6 +698,7 @@ int acpi_s2idle_prepare(void)
 	}
 
 	acpi_enable_wakeup_devices(ACPI_STATE_S0);
+	acpi_enter_sleep_state_prep(ACPI_STATE_S0);
 
 	/* Change the configuration of GPEs to avoid spurious wakeup. */
 	acpi_enable_all_wakeup_gpes();
-- 
2.30.2


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

* Re: [PATCH] ACPI: PM: s2idle: Invoke _PTS for s2idle
  2021-04-19  9:07 [PATCH] ACPI: PM: s2idle: Invoke _PTS for s2idle Kai-Heng Feng
@ 2021-04-19 11:34 ` Rafael J. Wysocki
  2021-04-19 12:17   ` Kai-Heng Feng
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-04-19 11:34 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: Rafael J. Wysocki, Len Brown, open list:ACPI, open list

On Mon, Apr 19, 2021 at 11:08 AM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> HP EliteBook 840 G8 reboots on s2idle resume, and HP EliteBook 845 G8
> wakes up immediately on s2idle. Both are caused by the XMM7360 WWAN PCI
> card.
>
> There's a WWAN specific method to really turn off the WWAN via EC:
>     Method (_PTS, 1, NotSerialized)  // _PTS: Prepare To Sleep
>     {
>     ...
>         If (CondRefOf (\_SB.PCI0.GP12.PTS))
>         {
>             \_SB.PCI0.GP12.PTS (Arg0)
>         }
>     ...
>     }
>
>     Scope (_SB.PCI0.GP12)
>     {
>     ...
>         Method (PTS, 1, Serialized)
>         {
>             If (^^LPCB.EC0.ECRG)
>             {
>                 If ((PDID == 0xFFFF))
>                 {
>                     Return (Zero)
>                 }
>
>                 POFF ()
>                 SGIO (WWBR, One)
>                 Sleep (0x1E)
>                 Acquire (^^LPCB.EC0.ECMX, 0xFFFF)
>                 ^^LPCB.EC0.WWP = One
>                 Release (^^LPCB.EC0.ECMX)
>                 Sleep (0x01F4)
>             }
>
>             Return (Zero)
>         }
>     ...
>     }
>
> So let's also invok _PTS for s2idle.
>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/acpi/sleep.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 09fd13757b65..7e84b4b09919 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -698,6 +698,7 @@ int acpi_s2idle_prepare(void)
>         }
>
>         acpi_enable_wakeup_devices(ACPI_STATE_S0);
> +       acpi_enter_sleep_state_prep(ACPI_STATE_S0);

The system is in S0 already at this point, so not really.

Please use a quirk to address this.

>
>         /* Change the configuration of GPEs to avoid spurious wakeup. */
>         acpi_enable_all_wakeup_gpes();
> --

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

* Re: [PATCH] ACPI: PM: s2idle: Invoke _PTS for s2idle
  2021-04-19 11:34 ` Rafael J. Wysocki
@ 2021-04-19 12:17   ` Kai-Heng Feng
  0 siblings, 0 replies; 3+ messages in thread
From: Kai-Heng Feng @ 2021-04-19 12:17 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Len Brown, open list:ACPI, open list

On Mon, Apr 19, 2021 at 7:35 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Mon, Apr 19, 2021 at 11:08 AM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > HP EliteBook 840 G8 reboots on s2idle resume, and HP EliteBook 845 G8
> > wakes up immediately on s2idle. Both are caused by the XMM7360 WWAN PCI
> > card.
> >
> > There's a WWAN specific method to really turn off the WWAN via EC:
> >     Method (_PTS, 1, NotSerialized)  // _PTS: Prepare To Sleep
> >     {
> >     ...
> >         If (CondRefOf (\_SB.PCI0.GP12.PTS))
> >         {
> >             \_SB.PCI0.GP12.PTS (Arg0)
> >         }
> >     ...
> >     }
> >
> >     Scope (_SB.PCI0.GP12)
> >     {
> >     ...
> >         Method (PTS, 1, Serialized)
> >         {
> >             If (^^LPCB.EC0.ECRG)
> >             {
> >                 If ((PDID == 0xFFFF))
> >                 {
> >                     Return (Zero)
> >                 }
> >
> >                 POFF ()
> >                 SGIO (WWBR, One)
> >                 Sleep (0x1E)
> >                 Acquire (^^LPCB.EC0.ECMX, 0xFFFF)
> >                 ^^LPCB.EC0.WWP = One
> >                 Release (^^LPCB.EC0.ECMX)
> >                 Sleep (0x01F4)
> >             }
> >
> >             Return (Zero)
> >         }
> >     ...
> >     }
> >
> > So let's also invok _PTS for s2idle.
> >
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> >  drivers/acpi/sleep.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> > index 09fd13757b65..7e84b4b09919 100644
> > --- a/drivers/acpi/sleep.c
> > +++ b/drivers/acpi/sleep.c
> > @@ -698,6 +698,7 @@ int acpi_s2idle_prepare(void)
> >         }
> >
> >         acpi_enable_wakeup_devices(ACPI_STATE_S0);
> > +       acpi_enter_sleep_state_prep(ACPI_STATE_S0);
>
> The system is in S0 already at this point, so not really.

Ok, indeed ACPI spec only states _PTS can be used for S1 to S5.

> Please use a quirk to address this.

Let me discuss with HP folks. Right now it looks like we need to apply
this to all HP systems...

Kai-Heng

>
> >
> >         /* Change the configuration of GPEs to avoid spurious wakeup. */
> >         acpi_enable_all_wakeup_gpes();
> > --

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

end of thread, other threads:[~2021-04-19 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  9:07 [PATCH] ACPI: PM: s2idle: Invoke _PTS for s2idle Kai-Heng Feng
2021-04-19 11:34 ` Rafael J. Wysocki
2021-04-19 12:17   ` Kai-Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).