Internal Use - Confidential +AD4- -----Original Message----- +AD4- From: Mario Limonciello +ADw-superm1+AEA-kernel.org+AD4- +AD4- Sent: Tuesday, March 4, 2025 5:27 AM +AD4- To: Limonciello, Mario +ADw-mario.limonciello+AEA-amd.com+AD4AOw- rafael+AEA-kernel.org +AD4- Cc: Shen, Yijun +ADw-Yijun+AF8-Shen+AEA-Dell.com+AD4AOw- Richard.Gong +AD4- +ADw-Richard.Gong+AEA-amd.com+AD4AOw- linux-acpi+AEA-vger.kernel.org +AD4- Subject: +AFs-PATCH+AF0- ACPI: button: Install notifier for system events as well +AD4- +AD4- +AD4- +AFs-EXTERNAL EMAIL+AF0- +AD4- +AD4- From: Mario Limonciello +ADw-mario.limonciello+AEA-amd.com+AD4- +AD4- +AD4- On some systems when the system is put to sleep pressing the ACPI power +AD4- button will cause the EC SCI to try to wake the system by a Notify(DEV, 0x2) +AD4- with an intention to wake the system up from suspend. +AD4- +AD4- This behavior matches the ACPI specification in ACPI 6.4 section +AD4- 4.8.3.1.1.2 which describes that the AML handler would generate a Notify() +AD4- with a code of 0x2 to indicate it was responsible for waking the system. +AD4- +AD4- This currently doesn't work because acpi+AF8-button+AF8-add() only configured +AD4- +AGA-ACPI+AF8-DEVICE+AF8-NOTIFY+AGA- which means that device handler notifications +AD4- 0x80 through 0xFF are handled. +AD4- +AD4- To fix the wakeups on such systems, adjust the ACPI button handler to use +AD4- +AGA-ACPI+AF8-ALL+AF8-NOTIFY+AGA- which will handle all events 0x00 through 0x7F. +AD4- +AD4- Reported-by: Yijun Shen +ADw-Yijun.Shen+AEA-dell.com+AD4- +AD4- Tested-by: Richard Gong +ADw-Richard.Gong+AEA-amd.com+AD4- +AD4- Link: +AD4- https://urldefense.com/v3/+AF8AXw-https://uefi.org/htmlspecs/ACPI+AF8-Spec+AF8-6+AF8-4+AF8-html +AD4- /04+AF8-ACPI+AF8-Hardware+AF8-Specification/ACPI+AF8-Hardware+AF8-Specification.html?highlig +AD4- ht+AD0-0x2+ACo-control-method-power-button+AF8AXwA7-Iw+ACEAIQ-LpKI+ACE-m8bmT5JUyck9Q0BMUA- +AD4- LmC5MXTEXFeJ1nmcNGIhJ4AWCQ7XMUR+AF8-UqxaxBor674mhMk53MkwkXqT1a +AD4- cTF+ACQ- +AFs-uefi+AFs-.+AF0-org+AF0- +AD4- Signed-off-by: Mario Limonciello +ADw-mario.limonciello+AEA-amd.com+AD4- Verified the patch on the issued system, the issue is gone. Tested-by: Yijun Shen +ADw-Yijun+AF8-Shen+AEA-Dell.com+AD4- +AD4- --- +AD4- drivers/acpi/button.c +AHw- 12 +-+-+-+-+-+-+-+-+---- +AD4- 1 file changed, 9 insertions(+-), 3 deletions(-) +AD4- +AD4- diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index +AD4- 7773e6b860e73..61701c646e92f 100644 +AD4- --- a/drivers/acpi/button.c +AD4- +-+-+- b/drivers/acpi/button.c +AD4- +AEAAQA- -24,6 +-24,7 +AEAAQA- +AD4- +ACM-define ACPI+AF8-BUTTON+AF8-CLASS +ACI-button+ACI- +AD4- +ACM-define ACPI+AF8-BUTTON+AF8-FILE+AF8-STATE +ACI-state+ACI- +AD4- +ACM-define ACPI+AF8-BUTTON+AF8-TYPE+AF8-UNKNOWN 0x00 +AD4- +-+ACM-define ACPI+AF8-BUTTON+AF8-NOTIFY+AF8-WAKE 0x02 +AD4- +ACM-define ACPI+AF8-BUTTON+AF8-NOTIFY+AF8-STATUS 0x80 +AD4- +AD4- +ACM-define ACPI+AF8-BUTTON+AF8-SUBCLASS+AF8-POWER +ACI-power+ACI- +AD4- +AEAAQA- -443,11 +-444,16 +AEAAQA- static void acpi+AF8-button+AF8-notify(acpi+AF8-handle handle, +AD4- u32 event, void +ACo-data) +AD4- struct input+AF8-dev +ACo-input+ADs- +AD4- int keycode+ADs- +AD4- +AD4- - if (event +ACEAPQ- ACPI+AF8-BUTTON+AF8-NOTIFY+AF8-STATUS) +AHs- +AD4- +- switch (event) +AHs- +AD4- +- case ACPI+AF8-BUTTON+AF8-NOTIFY+AF8-STATUS: +AD4- +- break+ADs- +AD4- +- case ACPI+AF8-BUTTON+AF8-NOTIFY+AF8-WAKE: +AD4- +- break+ADs- +AD4- +- default: +AD4- acpi+AF8-handle+AF8-debug(device-+AD4-handle, +ACI-Unsupported event +AD4- +AFs-0x+ACU-x+AF0AXA-n+ACI-, +AD4- event)+ADs- +AD4- return+ADs- +AD4- - +AH0- +AD4- +- +AH0AOw- +AD4- +AD4- acpi+AF8-pm+AF8-wakeup+AF8-event(+ACY-device-+AD4-dev)+ADs- +AD4- +AD4- +AEAAQA- -629,7 +-635,7 +AEAAQA- static int acpi+AF8-button+AF8-add(struct acpi+AF8-device +ACo-device) +AD4- break+ADs- +AD4- default: +AD4- status +AD0- acpi+AF8-install+AF8-notify+AF8-handler(device-+AD4-handle, +AD4- - ACPI+AF8-DEVICE+AF8-NOTIFY, +AD4- handler, +AD4- +- ACPI+AF8-ALL+AF8-NOTIFY, handler, +AD4- device)+ADs- +AD4- break+ADs- +AD4- +AH0- +AD4- -- +AD4- 2.43.0