Skip to content

Commit cd26a1c

Browse files
committed
ACPI: button: Install notifier for system events as well
JIRA: https://issues.redhat.com/browse/RHEL-114091 commit a7e23ec Author: Mario Limonciello <mario.limonciello@amd.com> Date: Tue, 11 Mar 2025 20:41:48 +0000 On some systems when the system is put to sleep pressing the ACPI power button will cause the EC SCI to try to wake the system by a Notify(DEV, 0x2) with an intention to wake the system up from suspend. This behavior matches the ACPI specification in ACPI 6.4 section 4.8.3.1.1.2 which describes that the AML handler would generate a Notify() with a code of 0x2 to indicate it was responsible for waking the system. This currently doesn't work because acpi_button_add() only configured `ACPI_DEVICE_NOTIFY` which means that device handler notifications 0x80 through 0xFF are handled. To fix the wakeups on such systems, adjust the ACPI button handler to use `ACPI_ALL_NOTIFY` which will handle all events 0x00 through 0x7F. Reported-by: Yijun Shen <Yijun.Shen@dell.com> Tested-by: Richard Gong <Richard.Gong@amd.com> Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/04_ACPI_Hardware_Specification/ACPI_Hardware_Specification.html?highlight=0x2#control-method-power-button Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Tested-by: Yijun Shen <Yijun_Shen@Dell.com> Link: https://patch.msgid.link/20250303212719.4153485-1-superm1@kernel.org [ rjw: Removed uneeded semicolon ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent de436a7 commit cd26a1c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/acpi/button.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define ACPI_BUTTON_CLASS "button"
2525
#define ACPI_BUTTON_FILE_STATE "state"
2626
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
27+
#define ACPI_BUTTON_NOTIFY_WAKE 0x02
2728
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
2829

2930
#define ACPI_BUTTON_SUBCLASS_POWER "power"
@@ -443,7 +444,12 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
443444
struct input_dev *input;
444445
int keycode;
445446

446-
if (event != ACPI_BUTTON_NOTIFY_STATUS) {
447+
switch (event) {
448+
case ACPI_BUTTON_NOTIFY_STATUS:
449+
break;
450+
case ACPI_BUTTON_NOTIFY_WAKE:
451+
break;
452+
default:
447453
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
448454
event);
449455
return;
@@ -629,7 +635,7 @@ static int acpi_button_add(struct acpi_device *device)
629635
break;
630636
default:
631637
status = acpi_install_notify_handler(device->handle,
632-
ACPI_DEVICE_NOTIFY, handler,
638+
ACPI_ALL_NOTIFY, handler,
633639
device);
634640
break;
635641
}

0 commit comments

Comments
 (0)