Re: [ibm-acpi-devel] [PATCH 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys

2024-04-21 Thread Mark Pearson
On Sun, Apr 21, 2024, at 1:17 PM, Mark Pearson wrote: > Thanks Hans! > > On Sun, Apr 21, 2024, at 11:44 AM, Hans de Goede wrote: >> Hi All, >> >> My reply in the "[PATCH v2 1/4] platform/x86: thinkpad_acpi: >> simplify known_ev handling" handling where I indicated that I would work >> on

Re: [ibm-acpi-devel] [PATCH 17/24] platform/x86: thinkpad_acpi: Use correct keycodes for volume and brightness keys

2024-04-21 Thread Andy Shevchenko
On Sun, Apr 21, 2024 at 6:45 PM Hans de Goede wrote: > > Change the default keymap to report the correct keycodes for the volume and > brightness keys. Reporting key events for these is already filtered out by > the hotkey_reserved_mask which masks these keys out of hotkey_user_mask at >

Re: [ibm-acpi-devel] [PATCH 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys

2024-04-21 Thread Mark Pearson
Thanks Hans! On Sun, Apr 21, 2024, at 11:44 AM, Hans de Goede wrote: > Hi All, > > My reply in the "[PATCH v2 1/4] platform/x86: thinkpad_acpi: > simplify known_ev handling" handling where I indicated that I would work > on converting the thinkpad_acpi hotkey handling to use sparse-keymaps >

[ibm-acpi-devel] [PATCH 19/24] platform/x86: thinkpad_acpi: Switch to using sparse-keymap helpers

2024-04-21 Thread Hans de Goede
Switch the hotkey keymap handling over to the sparse-keymap helpers, there should be no functional changes from this. Note all the mappings to KEY_UNKNOWN are removed since that is the default behavior of sparse_keymap_report_event() for unknown scancodes. Also drop the big comment about making

[ibm-acpi-devel] [PATCH 20/24] platform/x86: thinkpad_acpi: Add mappings for adaptive kbd clipping-tool and cloud keys

2024-04-21 Thread Hans de Goede
The X1 carbon 2014 / 2nd gen's adaptive keyboard top row's "Home" mode, which is 1 of the 2 modes Linux supports, has clipping-tool and cloud buttons which so far are not mapped. I assume these were left as KEY_RESERVED because no suitable KEY_FOO codes were available when support was added. In

[ibm-acpi-devel] [PATCH 16/24] platform/x86: thinkpad_acpi: Change hotkey_reserved_mask initialization

2024-04-21 Thread Hans de Goede
Change the hotkey_reserved_mask initialization to hardcode the list of reserved keys. There are only a few reserved keys and the code to iterate over the keymap will be removed when moving to sparse-keymaps. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 21

[ibm-acpi-devel] [PATCH 23/24] platform/x86: thinkpad_acpi: Support for system debug info hotkey

2024-04-21 Thread Hans de Goede
From: Mark Pearson New Lenovo platforms are adding the Fn + N key to generate system debug details that support can use for collecting important details on any customer cases for Windows. Add the infrastructure so we can do the same on Linux by sending a KEY_VENDOR keycode to userspace.

[ibm-acpi-devel] [PATCH 13/24] platform/x86: thinkpad_acpi: Move hkey > scancode mapping to tpacpi_input_send_key()

2024-04-21 Thread Hans de Goede
Move the mapping of hkey events to scancodes to tpacpi_input_send_key(), this results in a nice cleanup and prepares things for adding sparse-keymap support. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 81 +--- 1 file changed, 24

[ibm-acpi-devel] [PATCH 17/24] platform/x86: thinkpad_acpi: Use correct keycodes for volume and brightness keys

2024-04-21 Thread Hans de Goede
Change the default keymap to report the correct keycodes for the volume and brightness keys. Reporting key events for these is already filtered out by the hotkey_reserved_mask which masks these keys out of hotkey_user_mask at initialization time, so there is no need to also map them to

[ibm-acpi-devel] [PATCH 22/24] platform/x86: thinkpad_acpi: Support for trackpoint doubletap

2024-04-21 Thread Hans de Goede
From: Mark Pearson Lenovo trackpoints are adding the ability to generate a doubletap event. This handles the doubletap event and sends the KEY_PROG4 event to userspace. Despite the driver itself not using KEY_PROG1 - KEY_PROG3 this still uses KEY_PROG4 because of some keys being remapped to

[ibm-acpi-devel] [PATCH 24/24] platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint doubletap

2024-04-21 Thread Hans de Goede
From: Mark Pearson The hotkey combination Fn + G can be used to disable the trackpoint doubletap feature on Windows. Add matching functionality for Linux. Signed-off-by: Mark Pearson Signed-off-by: Vishnu Sankar Link: https://lore.kernel.org/r/20240417173124.9953-4-mpearson-len...@squebb.ca

[ibm-acpi-devel] [PATCH 21/24] platform/x86: thinkpad_acpi: Simplify known_ev handling

2024-04-21 Thread Hans de Goede
From: Mark Pearson Modify how known_ev event is handled in preparation for adding new hkey event range. Signed-off-by: Mark Pearson Link: https://lore.kernel.org/r/20240417173124.9953-1-mpearson-len...@squebb.ca Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede ---

[ibm-acpi-devel] [PATCH 18/24] platform/x86: thinkpad_acpi: Drop KEY_RESERVED special handling

2024-04-21 Thread Hans de Goede
The input core already filters out EV_KEY events for KEY_RESERVED, remove the check for this in tpacpi_input_send_key() and rely on the input core filtering instead. Also change tpacpi_input_send_key() to only report the scancode once instead of reporting it on both press and release. Together

[ibm-acpi-devel] [PATCH 10/24] platform/x86: thinkpad_acpi: Move hotkey_user_mask check to tpacpi_input_send_key()

2024-04-21 Thread Hans de Goede
Move hotkey_user_mask check to tpacpi_input_send_key(), this is a preparation patch for further refactoring. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c

[ibm-acpi-devel] [PATCH 15/24] platform/x86: thinkpad_acpi: Do not send ACPI netlink events for unknown hotkeys

2024-04-21 Thread Hans de Goede
Do not send ACPI netlink events for unknown hotkeys, to avoid userspace starting to rely on them. Instead these should be added to the keymap to send evdev events. This should not cause a behavior change for existing laptop models since all currently known 0x1xxx events have a mapping. In

[ibm-acpi-devel] [PATCH 08/24] platform/x86: thinkpad_acpi: Move adaptive kbd event handling to tpacpi_driver_event()

2024-04-21 Thread Hans de Goede
Factor out the adaptive kbd non hotkey event handling into adaptive_keyboard_change_row() and adaptive_keyboard_s_quickview_row() helpers and move the handling of TP_HKEY_EV_DFR_CHANGE_ROW and TP_HKEY_EV_DFR_S_QUICKVIEW_ROW to tpacpi_driver_event(). This groups all the handling of hotkey events

[ibm-acpi-devel] [PATCH 12/24] platform/x86: thinkpad_acpi: Drop tpacpi_input_send_key_masked() and hotkey_driver_event()

2024-04-21 Thread Hans de Goede
Both are only 1 / 2 lines and both only have 1 caller fold the contents into tpacpi_hotkey_send_key() which is their single caller. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git

[ibm-acpi-devel] [PATCH 14/24] platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call to tpacpi_input_send_key()

2024-04-21 Thread Hans de Goede
All callers of tpacpi_input_send_key() first call tpacpi_driver_event(), move the tpacpi_driver_event() inside tpacpi_input_send_key() to avoid code duplication. For the original hotkey codes 0x1001 - 0x1020 tpacpi_driver_event() never returns true. So the added "return true;" inside

[ibm-acpi-devel] [PATCH 06/24] platform/x86: thinkpad_acpi: Do hkey to scancode translation later

2024-04-21 Thread Hans de Goede
Modify hotkey_notify_hotkey() and it helpers to mostly directly operate on hkey codes (TP_HKEY_EV_* returned by "MHKP") instead of on the 0 - TPACPI_HOTKEY_MAP_LEN scancodes used for scancode -> keycode translation. Keeping things in the hkey format as long a possible is a bit cleaner and this

[ibm-acpi-devel] [PATCH 07/24] platform/x86: thinkpad_acpi: Make tpacpi_driver_event() return if it handled the event

2024-04-21 Thread Hans de Goede
tpacpi_driver_event() already only responds to hkey events which it knows about. Make it return a bool and return true when it has handled the event. This avoids the need to list TP_HKEY_EV_foo values to which it responds both in its caller and in the function itself. Instead callers can now

[ibm-acpi-devel] [PATCH 11/24] platform/x86: thinkpad_acpi: Always call tpacpi_driver_event() for hotkeys

2024-04-21 Thread Hans de Goede
Call tpacpi_driver_event() at the top of hotkey_notify_hotkey() for all (orig / adaptive / extended) hotkey types, rather then having the orig code path call tpacpi_input_send_key_masked() which calls it through hotkey_driver_event() and having the adaptive / extended helpers call it separately.

[ibm-acpi-devel] [PATCH 03/24] platform/x86: thinkpad_acpi: Drop setting send_/ignore_acpi_ev defaults twice

2024-04-21 Thread Hans de Goede
send_acpi_ev, ignore_acpi_ev are already initialized to true resp. false by hotkey_notify() before calling the various helpers. Drop the needless re-initialization from the helpers. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 24 +--- 1 file

[ibm-acpi-devel] [PATCH 05/24] platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive kbd code

2024-04-21 Thread Hans de Goede
Use tpacpi_input_send_key() in adaptive_keyboard_hotkey_notify_hotkey() instead of re-implementing it there. Note this change will also result in a behavioral change, key presses on the adaptive keyboard will now also send a EV_MSC event with the scancode, just like all other hotkey presses

[ibm-acpi-devel] [PATCH 02/24] platform/x86: thinkpad_acpi: Provide hotkey_poll_stop_sync() dummy

2024-04-21 Thread Hans de Goede
Provide a hotkey_poll_stop_sync() dummy implementation when CONFIG_THINKPAD_ACPI_HOTKEY_POLL, so that the #ifdef-ery around hotkey_poll_stop_sync() can be removed from hotkey_exit(). Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 5 +++-- 1 file changed, 3

[ibm-acpi-devel] [PATCH 09/24] platform/x86: thinkpad_acpi: Move special original hotkeys handling out of switch-case

2024-04-21 Thread Hans de Goede
Move the special handling (send_acpi_ev = false, hotkey_source_mask check) for original hotkeys out of the switch-case in hotkey_notify_hotkey(). This is a preparation patch for further refactoring. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 14 ++ 1

[ibm-acpi-devel] [PATCH 01/24] platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit()

2024-04-21 Thread Hans de Goede
hotkey_exit() already takes the mutex around the hotkey_poll_stop_sync() call, but not around the other calls. commit 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations") has added lockdep_assert_held() checks to various hotkey functions. These lockdep_assert_held() checks fail

[ibm-acpi-devel] [PATCH 04/24] platform/x86: thinkpad_acpi: Drop ignore_acpi_ev

2024-04-21 Thread Hans de Goede
Setting ignore_acpi_ev to true has the same result as setting send_acpi_ev to false, so there is no need to have both. Drop ignore_acpi_ev. Signed-off-by: Hans de Goede --- drivers/platform/x86/thinkpad_acpi.c | 56 +--- 1 file changed, 17 insertions(+), 39 deletions(-)

[ibm-acpi-devel] [PATCH 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys

2024-04-21 Thread Hans de Goede
Hi All, My reply in the "[PATCH v2 1/4] platform/x86: thinkpad_acpi: simplify known_ev handling" handling where I indicated that I would work on converting the thinkpad_acpi hotkey handling to use sparse-keymaps underestimated the work this required quite a bit. The hotkey code is quite old and