LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RFC PATCH] ACPI: PM: Enable wake-up device GPEs for suspend-to-idle
@ 2019-05-13 19:17 Rajat Jain
  2019-05-14 21:28 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Rajat Jain @ 2019-05-13 19:17 UTC (permalink / raw)
  To: rjw, lenb, linux-acpi, linux-kernel; +Cc: Rajat Jain, rajatxjain, furquan

I noticed that recently multiple systems (chromebooks) couldn't wake
from S0ix using LID or Keyboard after updating to a newer kernel, I
bisected and the issue is seen starting the following commit:

commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for
suspend-to-idle")

and found that the issue gets fixed if I revert it. I debugged and
found that although PNP0C0D:00 (representing the LID) is wake capable
and should wakeup the system per the code in acpi_wakeup_gpe_init()
and in drivers/acpi/button.c:

localhost /sys # cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
LID0      S4    *enabled   platform:PNP0C0D:00
CREC      S5    *disabled  platform:GOOG0004:00
                *disabled  platform:cros-ec-dev.1.auto
                *disabled  platform:cros-ec-accel.0
                *disabled  platform:cros-ec-accel.1
                *disabled  platform:cros-ec-gyro.0
                *disabled  platform:cros-ec-ring.0
                *disabled  platform:cros-usbpd-charger.2.auto
                *disabled  platform:cros-usbpd-logger.3.auto
D015      S3    *enabled   i2c:i2c-ELAN0000:00
PENH      S3    *enabled   platform:PRP0001:00
XHCI      S3    *enabled   pci:0000:00:14.0
GLAN      S4    *disabled
WIFI      S3    *disabled  pci:0000:00:14.3
localhost /sys #

On debugging, I found that its corresponding GPE is not being enabled.
The particular GPE's "gpe_register_info->enable_for_wake" does not have any
bits set when acpi_enable_all_wakeup_gpes() comes around to use it. I
looked at code and could not find any other code path that should set the
bits in "enable_for_wake" bitmask for the wake enabled devices for s2idle
(I do see that it happens for S3 in acpi_sleep_prepare()).

Thus I used the same call to enable the GPEs for wake enabled devices,
and verified that this fixes the regression I was seeing on multiple of
my devices.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579
Signed-off-by: Rajat Jain <rajatja@google.com>
---
 drivers/acpi/sleep.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 403c4ff15349..e52f1238d2d6 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -977,6 +977,8 @@ static int acpi_s2idle_prepare(void)
 	if (acpi_sci_irq_valid())
 		enable_irq_wake(acpi_sci_irq);
 
+	acpi_enable_wakeup_devices(ACPI_STATE_S0);
+
 	/* Change the configuration of GPEs to avoid spurious wakeup. */
 	acpi_enable_all_wakeup_gpes();
 	acpi_os_wait_events_complete();
@@ -1027,6 +1029,8 @@ static void acpi_s2idle_restore(void)
 {
 	acpi_enable_all_runtime_gpes();
 
+	acpi_disable_wakeup_devices(ACPI_STATE_S0);
+
 	if (acpi_sci_irq_valid())
 		disable_irq_wake(acpi_sci_irq);
 
-- 
2.21.0.1020.gf2820cf01a-goog


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

* Re: [RFC PATCH] ACPI: PM: Enable wake-up device GPEs for suspend-to-idle
  2019-05-13 19:17 [RFC PATCH] ACPI: PM: Enable wake-up device GPEs for suspend-to-idle Rajat Jain
@ 2019-05-14 21:28 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-05-14 21:28 UTC (permalink / raw)
  To: Rajat Jain; +Cc: lenb, linux-acpi, linux-kernel, rajatxjain, furquan

On Monday, May 13, 2019 9:17:08 PM CEST Rajat Jain wrote:
> I noticed that recently multiple systems (chromebooks) couldn't wake
> from S0ix using LID or Keyboard after updating to a newer kernel, I
> bisected and the issue is seen starting the following commit:
> 
> commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for
> suspend-to-idle")
> 
> and found that the issue gets fixed if I revert it. I debugged and
> found that although PNP0C0D:00 (representing the LID) is wake capable
> and should wakeup the system per the code in acpi_wakeup_gpe_init()
> and in drivers/acpi/button.c:
> 
> localhost /sys # cat /proc/acpi/wakeup
> Device  S-state   Status   Sysfs node
> LID0      S4    *enabled   platform:PNP0C0D:00
> CREC      S5    *disabled  platform:GOOG0004:00
>                 *disabled  platform:cros-ec-dev.1.auto
>                 *disabled  platform:cros-ec-accel.0
>                 *disabled  platform:cros-ec-accel.1
>                 *disabled  platform:cros-ec-gyro.0
>                 *disabled  platform:cros-ec-ring.0
>                 *disabled  platform:cros-usbpd-charger.2.auto
>                 *disabled  platform:cros-usbpd-logger.3.auto
> D015      S3    *enabled   i2c:i2c-ELAN0000:00
> PENH      S3    *enabled   platform:PRP0001:00
> XHCI      S3    *enabled   pci:0000:00:14.0
> GLAN      S4    *disabled
> WIFI      S3    *disabled  pci:0000:00:14.3
> localhost /sys #
> 
> On debugging, I found that its corresponding GPE is not being enabled.
> The particular GPE's "gpe_register_info->enable_for_wake" does not have any
> bits set when acpi_enable_all_wakeup_gpes() comes around to use it. I
> looked at code and could not find any other code path that should set the
> bits in "enable_for_wake" bitmask for the wake enabled devices for s2idle
> (I do see that it happens for S3 in acpi_sleep_prepare()).
> 
> Thus I used the same call to enable the GPEs for wake enabled devices,
> and verified that this fixes the regression I was seeing on multiple of
> my devices.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579
> Signed-off-by: Rajat Jain <rajatja@google.com>
> ---
>  drivers/acpi/sleep.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 403c4ff15349..e52f1238d2d6 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -977,6 +977,8 @@ static int acpi_s2idle_prepare(void)
>  	if (acpi_sci_irq_valid())
>  		enable_irq_wake(acpi_sci_irq);
>  
> +	acpi_enable_wakeup_devices(ACPI_STATE_S0);
> +
>  	/* Change the configuration of GPEs to avoid spurious wakeup. */
>  	acpi_enable_all_wakeup_gpes();
>  	acpi_os_wait_events_complete();
> @@ -1027,6 +1029,8 @@ static void acpi_s2idle_restore(void)
>  {
>  	acpi_enable_all_runtime_gpes();
>  
> +	acpi_disable_wakeup_devices(ACPI_STATE_S0);
> +
>  	if (acpi_sci_irq_valid())
>  		disable_irq_wake(acpi_sci_irq);
>  
> 

Applied, thanks!





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

end of thread, other threads:[~2019-05-14 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 19:17 [RFC PATCH] ACPI: PM: Enable wake-up device GPEs for suspend-to-idle Rajat Jain
2019-05-14 21:28 ` Rafael J. Wysocki

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