]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.45/acpi-pm-set-enable_for_wake-for-wakeup-gpes-during-suspend-to-idle.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.19.45 / acpi-pm-set-enable_for_wake-for-wakeup-gpes-during-suspend-to-idle.patch
CommitLineData
d074880a
GKH
1From 2f844b61db8297a1f7a06adf2eb5c43381f2c183 Mon Sep 17 00:00:00 2001
2From: Rajat Jain <rajatja@google.com>
3Date: Mon, 13 May 2019 12:17:08 -0700
4Subject: ACPI: PM: Set enable_for_wake for wakeup GPEs during suspend-to-idle
5
6From: Rajat Jain <rajatja@google.com>
7
8commit 2f844b61db8297a1f7a06adf2eb5c43381f2c183 upstream.
9
10I noticed that recently multiple systems (chromebooks) couldn't wake
11from S0ix using LID or Keyboard after updating to a newer kernel. I
12bisected and it turned up commit f941d3e41da7 ("ACPI: EC / PM: Disable
13non-wakeup GPEs for suspend-to-idle"). I checked that the issue got
14fixed if that commit was reverted.
15
16I debugged and found that although PNP0C0D:00 (representing the LID)
17is wake capable and should wakeup the system per the code in
18acpi_wakeup_gpe_init() and in drivers/acpi/button.c:
19
20localhost /sys # cat /proc/acpi/wakeup
21Device S-state Status Sysfs node
22LID0 S4 *enabled platform:PNP0C0D:00
23CREC 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
31D015 S3 *enabled i2c:i2c-ELAN0000:00
32PENH S3 *enabled platform:PRP0001:00
33XHCI S3 *enabled pci:0000:00:14.0
34GLAN S4 *disabled
35WIFI S3 *disabled pci:0000:00:14.3
36localhost /sys #
37
38On debugging, I found that its corresponding GPE is not being enabled.
39The particular GPE's "gpe_register_info->enable_for_wake" does not
40have any bits set when acpi_enable_all_wakeup_gpes() comes around to
41use it. I looked at code and could not find any other code path that
42should set the bits in "enable_for_wake" bitmask for the wake enabled
43devices for s2idle. [I do see that it happens for S3 in
44acpi_sleep_prepare()].
45
46Thus I used the same call to enable the GPEs for wake enabled devices,
47and verified that this fixes the regression I was seeing on multiple
48of 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
55Fixes: f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle")
56Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579
57Signed-off-by: Rajat Jain <rajatja@google.com>
58[ rjw: Subject & changelog ]
59Cc: 5.0+ <stable@vger.kernel.org> # 5.0+
60Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
61Signed-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