Skip to content

Commit b90ff35

Browse files
committed
ACPI: PM: s2idle: Always set up EC GPE for system wakeup
Commit 10a08fd ("ACPI: PM: Set up EC GPE for system wakeup from drivers that need it") assumed that the EC GPE would only need to be set up for system wakeup if either the intel-hid or the intel-vbtn driver was in use, but that turns out to be incorrect. In particular, on ASUS Zenbook UX430UNR/i7-8550U, if the EC GPE is not enabled while suspended, the system cannot be woken up by opening the lid or pressing a key, and that machine doesn't use any of the drivers mentioned above. For this reason, always set up the EC GPE for system wakeup from suspend-to-idle by setting and clearing its wake mask in the ACPI suspend-to-idle callbacks. Fixes: 10a08fd ("ACPI: PM: Set up EC GPE for system wakeup from drivers that need it") Reported-by: Kristian Klausen <[email protected]> Tested-by: Kristian Klausen <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 45dc157 commit b90ff35

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

drivers/acpi/ec.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,6 @@ void acpi_ec_set_gpe_wake_mask(u8 action)
19701970
if (pm_suspend_no_platform() && first_ec && !ec_no_wakeup)
19711971
acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action);
19721972
}
1973-
EXPORT_SYMBOL_GPL(acpi_ec_set_gpe_wake_mask);
19741973

19751974
bool acpi_ec_dispatch_gpe(void)
19761975
{

drivers/acpi/sleep.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,13 @@ static int lps0_device_attach(struct acpi_device *adev,
938938
if (mem_sleep_default > PM_SUSPEND_MEM && !acpi_sleep_default_s3)
939939
mem_sleep_current = PM_SUSPEND_TO_IDLE;
940940

941+
/*
942+
* Some LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U, require the
943+
* EC GPE to be enabled while suspended for certain wakeup devices to
944+
* work, so mark it as wakeup-capable.
945+
*/
946+
acpi_ec_mark_gpe_for_wake();
947+
941948
return 0;
942949
}
943950

@@ -954,8 +961,10 @@ static int acpi_s2idle_begin(void)
954961

955962
static int acpi_s2idle_prepare(void)
956963
{
957-
if (acpi_sci_irq_valid())
964+
if (acpi_sci_irq_valid()) {
958965
enable_irq_wake(acpi_sci_irq);
966+
acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
967+
}
959968

960969
acpi_enable_wakeup_devices(ACPI_STATE_S0);
961970

@@ -1034,8 +1043,10 @@ static void acpi_s2idle_restore(void)
10341043

10351044
acpi_disable_wakeup_devices(ACPI_STATE_S0);
10361045

1037-
if (acpi_sci_irq_valid())
1046+
if (acpi_sci_irq_valid()) {
1047+
acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
10381048
disable_irq_wake(acpi_sci_irq);
1049+
}
10391050
}
10401051

10411052
static void acpi_s2idle_end(void)

drivers/platform/x86/intel-hid.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ static int intel_hid_pm_prepare(struct device *device)
257257
struct intel_hid_priv *priv = dev_get_drvdata(device);
258258

259259
priv->wakeup_mode = true;
260-
acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
261260
}
262261
return 0;
263262
}
@@ -266,10 +265,7 @@ static void intel_hid_pm_complete(struct device *device)
266265
{
267266
struct intel_hid_priv *priv = dev_get_drvdata(device);
268267

269-
if (priv->wakeup_mode) {
270-
acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
271-
priv->wakeup_mode = false;
272-
}
268+
priv->wakeup_mode = false;
273269
}
274270

275271
static int intel_hid_pl_suspend_handler(struct device *device)

drivers/platform/x86/intel-vbtn.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ static int intel_vbtn_pm_prepare(struct device *dev)
205205
struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
206206

207207
priv->wakeup_mode = true;
208-
acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
209208
}
210209
return 0;
211210
}
@@ -214,10 +213,7 @@ static void intel_vbtn_pm_complete(struct device *dev)
214213
{
215214
struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
216215

217-
if (priv->wakeup_mode) {
218-
acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
219-
priv->wakeup_mode = false;
220-
}
216+
priv->wakeup_mode = false;
221217
}
222218

223219
static int intel_vbtn_pm_resume(struct device *dev)

0 commit comments

Comments
 (0)