Skip to content

platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys

Hans de Goede platform-driver-x86 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest24 patches 17 repliesIn review
  2. v124 patches 16 repliesSuperseded

Changes in v2 from the cover letter

- Some small code style tweaks in response to reviews
- Add various Reviewed-by and Tested-by tags

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/24platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit()drivers/platform/x86/thinkpad_acpi.c+3 -20 replies
2/24platform/x86: thinkpad_acpi: Provide hotkey_poll_stop_sync() dummydrivers/platform/x86/thinkpad_acpi.c+3 -20 replies
3/24platform/x86: thinkpad_acpi: Drop setting send_/ignore_acpi_ev defaults twicedrivers/platform/x86/thinkpad_acpi.c+5 -190 replies
4/24platform/x86: thinkpad_acpi: Drop ignore_acpi_evdrivers/platform/x86/thinkpad_acpi.c+17 -392 replies
5/24platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive kbd codedrivers/platform/x86/thinkpad_acpi.c+2 -140 replies
6/24platform/x86: thinkpad_acpi: Do hkey to scancode translation laterdrivers/platform/x86/thinkpad_acpi.c+36 -350 replies
7/24platform/x86: thinkpad_acpi: Make tpacpi_driver_event() return if it handled the eventdrivers/platform/x86/thinkpad_acpi.c+61 -540 replies
8/24platform/x86: thinkpad_acpi: Move adaptive kbd event handling to tpacpi_driver_event()drivers/platform/x86/thinkpad_acpi.c+46 -400 replies
9/24platform/x86: thinkpad_acpi: Move special original hotkeys handling out of switch-casedrivers/platform/x86/thinkpad_acpi.c+10 -40 replies
10/24platform/x86: thinkpad_acpi: Move hotkey_user_mask check to tpacpi_input_send_key()drivers/platform/x86/thinkpad_acpi.c+5 -20 replies
11/24platform/x86: thinkpad_acpi: Always call tpacpi_driver_event() for hotkeysdrivers/platform/x86/thinkpad_acpi.c+4 -70 replies
12/24platform/x86: thinkpad_acpi: Drop tpacpi_input_send_key_masked() and hotkey_driver_event()drivers/platform/x86/thinkpad_acpi.c+2 -140 replies
13/24platform/x86: thinkpad_acpi: Move hkey > scancode mapping to tpacpi_input_send_key()drivers/platform/x86/thinkpad_acpi.c+24 -570 replies
14/24platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call to tpacpi_input_send_key()drivers/platform/x86/thinkpad_acpi.c+3 -40 replies
15/24platform/x86: thinkpad_acpi: Do not send ACPI netlink events for unknown hotkeysdrivers/platform/x86/thinkpad_acpi.c+11 -31 reply
16/24platform/x86: thinkpad_acpi: Change hotkey_reserved_mask initializationdrivers/platform/x86/thinkpad_acpi.c+15 -66 replies
17/24platform/x86: thinkpad_acpi: Use correct keycodes for volume and brightness keysdrivers/platform/x86/thinkpad_acpi.c+21 -240 replies
18/24platform/x86: thinkpad_acpi: Drop KEY_RESERVED special handlingdrivers/platform/x86/thinkpad_acpi.c+8 -100 replies
19/24platform/x86: thinkpad_acpi: Switch to using sparse-keymap helpersdrivers/platform/x86/thinkpad_acpi.c+145 -2592 replies
20/24platform/x86: thinkpad_acpi: Add mappings for adaptive kbd clipping-tool and cloud keysdrivers/platform/x86/thinkpad_acpi.c+2 -20 replies
21/24platform/x86: thinkpad_acpi: Simplify known_ev handlingdrivers/platform/x86/thinkpad_acpi.c+2 -60 replies
22/24platform/x86: thinkpad_acpi: Support for trackpoint doubletapdrivers/platform/x86/thinkpad_acpi.c+19 -03 replies
23/24platform/x86: thinkpad_acpi: Support for system debug info hotkeydrivers/platform/x86/thinkpad_acpi.c+1 -00 replies
24/24platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint doubletapdrivers/platform/x86/thinkpad_acpi.c+11 -10 replies

Reviews trailers per patch

4 of 24 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMark PearsonIlpo JärvinenHans de Goede
SeriesR-b R-b
1/24T-b
2/24T-b
3/24T-b R-b
4/24T-b
5/24T-b R-b
6/24T-b
7/24T-b
8/24R-b T-b
9/24T-b
10/24T-b
11/24T-b
12/24T-b
13/24T-b
14/24T-b
15/24T-b
16/24T-b
17/24T-b
18/24T-b
19/24T-b
20/24T-b
21/24T-b R-b
22/24T-b
23/24T-b
24/24T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys

Hi All,

Here is v2 of my patch-series to refactor thinkpad_acpi's hotkey handling and to add support for some new hotkeys on new models.

Changes in v2:
- Some small code style tweaks in response to reviews
- Add various Reviewed-by and Tested-by tags

Relevant parts of v1 cover-letter:

I have been very careful to not introduce any changes wrt support for the original ThinkPad models / hotkeys which use the hotkey_*_mask related code.

I've also done my best to avoid any *significant* functional change but there are still some functional changes, which should all not impact userspace compatibility:

1. Adaptive keyboard special keys will now also send EV_MSC events with the scancode, just like all the other hotkeys.

2. Rely on the input core for KEY_RESERVED suppression. This means that keys marked as KEY_RESERVED will still send EV_MSC evdev events when pressed (which helps users with mapping them to non reserved KEY_FOO values if desired).

3. Align the keycodes for volume up/down/mute and brightness up/down with those set by userspace through udev upstream's hwdb. Note these are all for keys which are suppressed by hotkey_reserved_mask by default. So this is only a functional change for users who override the default hotkey-mask *and* who do not have udev's default hwdb installed.

4. Suppress ACPI netlink event generation for unknown 0x1xxx hkey events to avoid userspace starting to rely on the netlink events for new hotkeys before these have been added to the keymap, only to have the netlink events get disabled by the adding of the new hotkeys to the keymap.

This should not cause a behavior change for existing models since all currently known 0x1xxx events have a mapping.

Here is a quick breakdown of the patches in this series:

Patch 1 - 2: Fix a small locking issue on rmmod the only problem here
really is a lockdep warning, so I plan to route these fixes through for-next together with the rest to keep things simple.

Patch 3 - 14: Do a bunch of cleanups and refactoring

Patch 15: Implements functional change no 4. I really kinda want to just
completely disable ACPI netlink event generation when also sending evdev events instead of reporting these twice. But for the 0x11xx / 0x13xx hkey events the kernel has send ACPI netlink events for years now. So this disables ACPI netlink events for any new hotkeys going forward.

Patch 16 - 18: Refactor / cleanup reserved key handling

Patch 19: Actually move to sparse-keymaps

Patch 20: Update the keymap for 2 adaptive kbd Fn row keys

Patch 21 - 24: Mark's original patches adding support for the new Fn + N
key combo and for trackpoint doubletap slightly reworked to use the new sparse-keymap.

Regards,

Hans

Hans de Goede (20):
platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit() platform/x86: thinkpad_acpi: Provide hotkey_poll_stop_sync() dummy platform/x86: thinkpad_acpi: Drop setting send_/ignore_acpi_ev
defaults twice
platform/x86: thinkpad_acpi: Drop ignore_acpi_ev platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive
kbd code
platform/x86: thinkpad_acpi: Do hkey to scancode translation later platform/x86: thinkpad_acpi: Make tpacpi_driver_event() return if it
handled the event
platform/x86: thinkpad_acpi: Move adaptive kbd event handling to
tpacpi_driver_event()
platform/x86: thinkpad_acpi: Move special original hotkeys handling
out of switch-case
platform/x86: thinkpad_acpi: Move hotkey_user_mask check to
tpacpi_input_send_key()
platform/x86: thinkpad_acpi: Always call tpacpi_driver_event() for
hotkeys
platform/x86: thinkpad_acpi: Drop tpacpi_input_send_key_masked() and
hotkey_driver_event()
platform/x86: thinkpad_acpi: Move hkey > scancode mapping to
tpacpi_input_send_key()
platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call to
tpacpi_input_send_key()
platform/x86: thinkpad_acpi: Do not send ACPI netlink events for
unknown hotkeys
platform/x86: thinkpad_acpi: Change hotkey_reserved_mask
initialization
platform/x86: thinkpad_acpi: Use correct keycodes for volume and
brightness keys
platform/x86: thinkpad_acpi: Drop KEY_RESERVED special handling platform/x86: thinkpad_acpi: Switch to using sparse-keymap helpers platform/x86: thinkpad_acpi: Add mappings for adaptive kbd
clipping-tool and cloud keys

Mark Pearson (4):
platform/x86: thinkpad_acpi: Simplify known_ev handling platform/x86: thinkpad_acpi: Support for trackpoint doubletap platform/x86: thinkpad_acpi: Support for system debug info hotkey platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint
doubletap

 drivers/platform/x86/thinkpad_acpi.c | 854 +++++++++++----------------
 1 file changed, 353 insertions(+), 501 deletions(-)
Signature · 1 line
2.44.0