Skip to content

Commit 57c31e6

Browse files
committed
ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons
After starting to use platform devices for representing buttons enumerated via ACPI, acpi_mark_gpe_for_wake() is insufficient for preparing their GPEs to wake up the system from sleep because it does not change the "dispatch type" of the given GPE to ACPI_GPE_DISPATCH_NOTIFY. Subsequently, this causes acpi_enable_gpe() in __acpi_device_wakeup_enable() to fail and system suspend transitions to be aborted. Address this by updating acpi_wakeup_gpe_init() to use acpi_setup_gpe_for_wake() for buttons like for any other devices. This allows acpi_setup_gpe_for_wake() to be simplified further because buttons are not a special case in it any more, so do that as well. Fixes: 52d8640 ("ACPI: button: Convert the driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Xi Pardee <xi.pardee@linux.intel.com> Link: https://patch.msgid.link/2259694.irdbgypaU6@rafael.j.wysocki
1 parent 88fad6c commit 57c31e6

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

drivers/acpi/scan.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,11 @@ static int acpi_bus_extract_wakeup_device_power_package(struct acpi_device *dev)
999999
return err;
10001000
}
10011001

1002-
/* Do not use a button for S5 wakeup */
1003-
#define ACPI_AVOID_WAKE_FROM_S5 BIT(0)
1004-
10051002
static bool acpi_wakeup_gpe_init(struct acpi_device *device)
10061003
{
10071004
static const struct acpi_device_id button_device_ids[] = {
1008-
{"PNP0C0C", 0}, /* Power button */
1009-
{"PNP0C0D", ACPI_AVOID_WAKE_FROM_S5}, /* Lid */
1010-
{"PNP0C0E", ACPI_AVOID_WAKE_FROM_S5}, /* Sleep button */
1005+
{"PNP0C0D", 0}, /* Lid */
1006+
{"PNP0C0E", 0}, /* Sleep button */
10111007
{"", 0},
10121008
};
10131009
struct acpi_device_wakeup *wakeup = &device->wakeup;
@@ -1016,15 +1012,9 @@ static bool acpi_wakeup_gpe_init(struct acpi_device *device)
10161012

10171013
wakeup->flags.notifier_present = 0;
10181014

1019-
/* Power button, Lid switch always enable wakeup */
10201015
match = acpi_match_acpi_device(button_device_ids, device);
1021-
if (match) {
1022-
if ((match->driver_data & ACPI_AVOID_WAKE_FROM_S5) &&
1023-
wakeup->sleep_state == ACPI_STATE_S5)
1024-
wakeup->sleep_state = ACPI_STATE_S4;
1025-
acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number);
1026-
return true;
1027-
}
1016+
if (match && wakeup->sleep_state == ACPI_STATE_S5)
1017+
wakeup->sleep_state = ACPI_STATE_S4;
10281018

10291019
status = acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device,
10301020
wakeup->gpe_number);

0 commit comments

Comments
 (0)