]>
Commit | Line | Data |
---|---|---|
d074880a GKH |
1 | From 2f844b61db8297a1f7a06adf2eb5c43381f2c183 Mon Sep 17 00:00:00 2001 |
2 | From: Rajat Jain <rajatja@google.com> | |
3 | Date: Mon, 13 May 2019 12:17:08 -0700 | |
4 | Subject: ACPI: PM: Set enable_for_wake for wakeup GPEs during suspend-to-idle | |
5 | ||
6 | From: Rajat Jain <rajatja@google.com> | |
7 | ||
8 | commit 2f844b61db8297a1f7a06adf2eb5c43381f2c183 upstream. | |
9 | ||
10 | I noticed that recently multiple systems (chromebooks) couldn't wake | |
11 | from S0ix using LID or Keyboard after updating to a newer kernel. I | |
12 | bisected and it turned up commit f941d3e41da7 ("ACPI: EC / PM: Disable | |
13 | non-wakeup GPEs for suspend-to-idle"). I checked that the issue got | |
14 | fixed if that commit was reverted. | |
15 | ||
16 | I debugged and found that although PNP0C0D:00 (representing the LID) | |
17 | is wake capable and should wakeup the system per the code in | |
18 | acpi_wakeup_gpe_init() and in drivers/acpi/button.c: | |
19 | ||
20 | localhost /sys # cat /proc/acpi/wakeup | |
21 | Device S-state Status Sysfs node | |
22 | LID0 S4 *enabled platform:PNP0C0D:00 | |
23 | CREC S5 *disabled platform:GOOG0004:00 | |
24 | *disabled platform:cros-ec-dev.1.auto | |
25 | *disabled platform:cros-ec-accel.0 | |
26 | *disabled platform:cros-ec-accel.1 | |
27 | *disabled platform:cros-ec-gyro.0 | |
28 | *disabled platform:cros-ec-ring.0 | |
29 | *disabled platform:cros-usbpd-charger.2.auto | |
30 | *disabled platform:cros-usbpd-logger.3.auto | |
31 | D015 S3 *enabled i2c:i2c-ELAN0000:00 | |
32 | PENH S3 *enabled platform:PRP0001:00 | |
33 | XHCI S3 *enabled pci:0000:00:14.0 | |
34 | GLAN S4 *disabled | |
35 | WIFI S3 *disabled pci:0000:00:14.3 | |
36 | localhost /sys # | |
37 | ||
38 | On debugging, I found that its corresponding GPE is not being enabled. | |
39 | The particular GPE's "gpe_register_info->enable_for_wake" does not | |
40 | have any bits set when acpi_enable_all_wakeup_gpes() comes around to | |
41 | use it. I looked at code and could not find any other code path that | |
42 | should set the bits in "enable_for_wake" bitmask for the wake enabled | |
43 | devices for s2idle. [I do see that it happens for S3 in | |
44 | acpi_sleep_prepare()]. | |
45 | ||
46 | Thus I used the same call to enable the GPEs for wake enabled devices, | |
47 | and verified that this fixes the regression I was seeing on multiple | |
48 | of my devices. | |
49 | ||
50 | [ rjw: The problem is that commit f941d3e41da7 ("ACPI: EC / PM: | |
51 | Disable non-wakeup GPEs for suspend-to-idle") forgot to add | |
52 | the acpi_enable_wakeup_devices() call for s2idle along with | |
53 | acpi_enable_all_wakeup_gpes(). ] | |
54 | ||
55 | Fixes: f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle") | |
56 | Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579 | |
57 | Signed-off-by: Rajat Jain <rajatja@google.com> | |
58 | [ rjw: Subject & changelog ] | |
59 | Cc: 5.0+ <stable@vger.kernel.org> # 5.0+ | |
60 | Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
61 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
62 | ||
63 | --- | |
64 | drivers/acpi/sleep.c | 4 ++++ | |
65 | 1 file changed, 4 insertions(+) | |
66 | ||
67 | --- a/drivers/acpi/sleep.c | |
68 | +++ b/drivers/acpi/sleep.c | |
69 | @@ -977,6 +977,8 @@ static int acpi_s2idle_prepare(void) | |
70 | if (acpi_sci_irq_valid()) | |
71 | enable_irq_wake(acpi_sci_irq); | |
72 | ||
73 | + acpi_enable_wakeup_devices(ACPI_STATE_S0); | |
74 | + | |
75 | /* Change the configuration of GPEs to avoid spurious wakeup. */ | |
76 | acpi_enable_all_wakeup_gpes(); | |
77 | acpi_os_wait_events_complete(); | |
78 | @@ -1026,6 +1028,8 @@ static void acpi_s2idle_restore(void) | |
79 | { | |
80 | acpi_enable_all_runtime_gpes(); | |
81 | ||
82 | + acpi_disable_wakeup_devices(ACPI_STATE_S0); | |
83 | + | |
84 | if (acpi_sci_irq_valid()) | |
85 | disable_irq_wake(acpi_sci_irq); | |
86 |