Re: [PATCH v2 2/3] ACPI: button: Enable wakeup GPEs for ACPI buttons at probe time
From: Nick
Date: Fri May 22 2026 - 22:15:50 EST
On May 22, 2026 2:52:10 p.m. UTC, "Rafael J. Wysocki" <rafael@xxxxxxxxxx> wrote:
>From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
>Prior to commit 57c31e6d620f ("ACPI: scan: Use acpi_setup_gpe_for_wake()
>for buttons"), ACPI button wakeup GPEs having handler methods remained
>enabled after acpi_wakeup_gpe_init(), but currently they are not enabled
>because acpi_setup_gpe_for_wake() disables them.
>
>That causes function keys to stop working on some systems [1] and there
>may be other related issues elsewhere.
>
>To address that, make the ACPI button driver enable wakeup GPEs for ACPI
>buttons so long as they have handler methods. While this does not
>restore the old behavior exactly (the ACPI button driver needs to be
>bound to the button devices for the GPEs to be enabled), it should be
>sufficient to restore the missing functionality.
>
>For this purpose, introduce acpi_enable_gpe_cond() that enables
>a GPE if its dispatch type matches the supplied one and modify
>acpi_button_probe() to use that function for enabling the GPEs in
>question.
>
>Fixes: 57c31e6d620f ("ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons")
>Reported-by: Nick <nick@xxxxxxxx>
>Closes: https://lore.kernel.org/linux-acpi/E2OXET.4X5GTP37VTNC3@xxxxxxxx/ [1]
>Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>Cc: 7.0+ <stable@xxxxxxxxxxxxxxx> # 7.0+
>---
>
>v1 -> v2:
> * Change the acpi_enable_gpe_cond() third parameter to a dispatch type (or
> "any type" value) and modify checks in it accordingly to address a
> problem pointed out by sashiko.dev
> * Adjust comments in acpi_enable_gpe_cond() and acpi_enable_gpe()
> * Update the changelog
>
>@Nick, It would be good to test this version of the patch on your system
>because it is a bit different from the previous one (which was not entirely
>correct). I'm not expecting it to behave differently, but additional
>testing would be welcome.
>
I tested this on top of 45255ea1ca096. The keys are still working as expected! I compared it against 6.19.14 too and all the keys seem to behave as before.
I noticed one difference, but it might not be directly related: KEY_SLEEP takes significantly longer to trigger suspend on 7.1-rc4 than on 6.19.14. On the older version it suspends in about a second; on 7.1-rc4 it takes about a minute before it fully suspends. The lid switch on the other hand suspends in about a second, and so does the suspend button in my DE, on both versions. I guess they're doing different kinds of suspend. That's probably related to the other ACPI changes that landed in 7.0.
Here's a log of me pressing the keys again: (we don't see KEY_SUSPEND here because it triggers hiberation which I don't have set up so it just shuts down and I lose the log)
(Apologies if you got this twice, I managed to reset.my mail client to HTML defaults while testing somehow)
$ uname -r
6.19.14-arch1-1
$ sudo libinput debug-events --show-keycodes
-event2 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event4 DEVICE_ADDED Video Bus seat0 default group2 cap:k
-event1 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event0 DEVICE_ADDED Lid Switch seat0 default group4 cap:S
-event5 DEVICE_ADDED Toshiba input device seat0 default group5 cap:k
-event12 DEVICE_ADDED Synaptics TM3322-002 seat0 default group6 cap:pg size 95x53mm tap (dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event3 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group7 cap:k
-event5 KEYBOARD_KEY +0.000s KEY_MUTE (113) pressed
event5 KEYBOARD_KEY +0.000s KEY_MUTE (113) released
event5 KEYBOARD_KEY +1.054s KEY_MUTE (113) pressed
event5 KEYBOARD_KEY +1.054s KEY_MUTE (113) released
event5 KEYBOARD_KEY +2.979s KEY_COFFEE (152) pressed
event5 KEYBOARD_KEY +2.979s KEY_COFFEE (152) released
event5 KEYBOARD_KEY +3.810s KEY_COFFEE (152) pressed
event5 KEYBOARD_KEY +3.810s KEY_COFFEE (152) released
event5 KEYBOARD_KEY +5.552s KEY_BATTERY (236) pressed
event5 KEYBOARD_KEY +5.552s KEY_BATTERY (236) released
event5 KEYBOARD_KEY +6.180s KEY_BATTERY (236) pressed
event5 KEYBOARD_KEY +6.180s KEY_BATTERY (236) released
event5 KEYBOARD_KEY +7.964s KEY_SLEEP (142) pressed
event5 KEYBOARD_KEY +7.964s KEY_SLEEP (142) released
event5 KEYBOARD_KEY +10.545s KEY_UNKNOWN (240) pressed
event5 KEYBOARD_KEY +10.545s KEY_UNKNOWN (240) released
-event1 KEYBOARD_KEY +10.598s KEY_WAKEUP (143) pressed
event1 KEYBOARD_KEY +10.598s KEY_WAKEUP (143) released
-event2 KEYBOARD_KEY +10.600s KEY_WAKEUP (143) pressed
event2 KEYBOARD_KEY +10.600s KEY_WAKEUP (143) released
-event5 KEYBOARD_KEY +20.312s KEY_SWITCHVIDEOMODE (227) pressed
event5 KEYBOARD_KEY +20.312s KEY_SWITCHVIDEOMODE (227) released
event5 KEYBOARD_KEY +20.981s KEY_SWITCHVIDEOMODE (227) pressed
event5 KEYBOARD_KEY +20.981s KEY_SWITCHVIDEOMODE (227) released
event5 KEYBOARD_KEY +21.467s KEY_BRIGHTNESSDOWN (224) pressed
event5 KEYBOARD_KEY +21.467s KEY_BRIGHTNESSDOWN (224) released
event5 KEYBOARD_KEY +22.034s KEY_BRIGHTNESSDOWN (224) pressed
event5 KEYBOARD_KEY +22.034s KEY_BRIGHTNESSDOWN (224) released
event5 KEYBOARD_KEY +22.420s KEY_BRIGHTNESSUP (225) pressed
event5 KEYBOARD_KEY +22.420s KEY_BRIGHTNESSUP (225) released
event5 KEYBOARD_KEY +22.845s KEY_BRIGHTNESSUP (225) pressed
event5 KEYBOARD_KEY +22.845s KEY_BRIGHTNESSUP (225) released
event5 KEYBOARD_KEY +23.757s KEY_WLAN (238) pressed
event5 KEYBOARD_KEY +23.757s KEY_WLAN (238) released
event5 KEYBOARD_KEY +24.953s KEY_WLAN (238) pressed
event5 KEYBOARD_KEY +24.953s KEY_WLAN (238) released
$ uname -r
7.1.0-rc4-1-git-00393-g39551c4ef087
$ sudo libinput debug-events --show-keycodes
-event5 DEVICE_ADDED Toshiba input device seat0 default group1 cap:k
-event12 DEVICE_ADDED Synaptics TM3322-002 seat0 default group2 cap:pg size 95x53mm tap (dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event4 DEVICE_ADDED Video Bus seat0 default group3 cap:k
-event2 DEVICE_ADDED Power Button seat0 default group4 cap:k
-event1 DEVICE_ADDED Power Button seat0 default group5 cap:k
-event0 DEVICE_ADDED Lid Switch seat0 default group6 cap:S
-event3 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group7 cap:k
event3 KEYBOARD_KEY +1.467s KEY_LEFTCTRL (29) pressed
event3 KEYBOARD_KEY +1.469s KEY_LEFTMETA (125) pressed
event3 KEYBOARD_KEY +1.470s KEY_F24 (194) pressed
event3 KEYBOARD_KEY +1.608s KEY_F24 (194) released
event3 KEYBOARD_KEY +1.611s KEY_LEFTMETA (125) released
event3 KEYBOARD_KEY +1.612s KEY_LEFTCTRL (29) released
-event5 KEYBOARD_KEY +4.041s KEY_WLAN (238) pressed
event5 KEYBOARD_KEY +4.041s KEY_WLAN (238) released
event5 KEYBOARD_KEY +7.001s KEY_BRIGHTNESSUP (225) pressed
event5 KEYBOARD_KEY +7.001s KEY_BRIGHTNESSUP (225) released
event5 KEYBOARD_KEY +7.568s KEY_BRIGHTNESSDOWN (224) pressed
event5 KEYBOARD_KEY +7.568s KEY_BRIGHTNESSDOWN (224) released
event5 KEYBOARD_KEY +12.350s KEY_SWITCHVIDEOMODE (227) pressed
event5 KEYBOARD_KEY +12.350s KEY_SWITCHVIDEOMODE (227) released
event5 KEYBOARD_KEY +13.726s KEY_SWITCHVIDEOMODE (227) pressed
event5 KEYBOARD_KEY +13.726s KEY_SWITCHVIDEOMODE (227) released
event5 KEYBOARD_KEY +19.846s KEY_SLEEP (142) pressed
event5 KEYBOARD_KEY +19.846s KEY_SLEEP (142) released
-event3 KEYBOARD_KEY +50.998s KEY_LEFTCTRL (29) pressed
event3 KEYBOARD_KEY +51.140s KEY_LEFTCTRL (29) released
-event5 KEYBOARD_KEY +96.713s KEY_UNKNOWN (240) pressed
event5 KEYBOARD_KEY +96.716s KEY_UNKNOWN (240) released
-event1 KEYBOARD_KEY +96.740s KEY_WAKEUP (143) pressed
event1 KEYBOARD_KEY +96.740s KEY_WAKEUP (143) released
-event2 KEYBOARD_KEY +96.743s KEY_WAKEUP (143) pressed
event2 KEYBOARD_KEY +96.743s KEY_WAKEUP (143) released
-event5 KEYBOARD_KEY +111.647s KEY_BATTERY (236) pressed
event5 KEYBOARD_KEY +111.647s KEY_BATTERY (236) released
event5 KEYBOARD_KEY +113.308s KEY_BATTERY (236) pressed
event5 KEYBOARD_KEY +113.308s KEY_BATTERY (236) released
event5 KEYBOARD_KEY +119.950s KEY_COFFEE (152) pressed
event5 KEYBOARD_KEY +119.950s KEY_COFFEE (152) released
event5 KEYBOARD_KEY +121.349s KEY_COFFEE (152) pressed
event5 KEYBOARD_KEY +121.349s KEY_COFFEE (152) released
event5 KEYBOARD_KEY +124.933s KEY_MUTE (113) pressed
event5 KEYBOARD_KEY +124.933s KEY_MUTE (113) released
event5 KEYBOARD_KEY +125.420s KEY_MUTE (113) pressed
event5 KEYBOARD_KEY +125.420s KEY_MUTE (113) released
-event0 SWITCH_TOGGLE +133.939s switch lid state 1
-event5 KEYBOARD_KEY +136.839s KEY_UNKNOWN (240) pressed
event5 KEYBOARD_KEY +136.850s KEY_UNKNOWN (240) released
-event0 SWITCH_TOGGLE +136.873s switch lid state 0
-event1 KEYBOARD_KEY +136.873s KEY_WAKEUP (143) pressed
event1 KEYBOARD_KEY +136.873s KEY_WAKEUP (143) released
-event2 KEYBOARD_KEY +136.874s KEY_WAKEUP (143) pressed
event2 KEYBOARD_KEY +136.874s KEY_WAKEUP (143) released