aboutsummaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorGravatar Hans de Goede <hdegoede@redhat.com> 2024-04-24 14:28:19 +0200
committerGravatar Hans de Goede <hdegoede@redhat.com> 2024-04-29 11:44:12 +0200
commitba69660627eadb0983483fff376dceb55a773562 (patch)
tree64911dcf3f00cda79a1dcedac3c137b5f4d04ac2 /drivers/platform
parentplatform/x86: thinkpad_acpi: Move adaptive kbd event handling to tpacpi_drive... (diff)
downloadlinux-ba69660627eadb0983483fff376dceb55a773562.tar.gz
linux-ba69660627eadb0983483fff376dceb55a773562.tar.bz2
linux-ba69660627eadb0983483fff376dceb55a773562.zip
platform/x86: thinkpad_acpi: Move special original hotkeys handling out of switch-case
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. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-10-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 153de035e3e2..f9615b1a28cc 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3745,6 +3745,15 @@ static bool hotkey_notify_hotkey(const u32 hkey, bool *send_acpi_ev)
{
unsigned int scancode = hkey - TP_HKEY_EV_ORIG_KEY_START;
+ /* Never send ACPI netlink events for original hotkeys (hkey: 0x1001 - 0x1020) */
+ if (hkey >= TP_HKEY_EV_ORIG_KEY_START && hkey <= TP_HKEY_EV_ORIG_KEY_END) {
+ *send_acpi_ev = false;
+
+ /* Original hotkeys may be polled from NVRAM instead */
+ if (hotkey_source_mask & (1 << scancode))
+ return true;
+ }
+
/*
* Original events are in the 0x10XX range, the adaptive keyboard
* found in 2014 X1 Carbon emits events are of 0x11XX. In 2017
@@ -3754,10 +3763,7 @@ static bool hotkey_notify_hotkey(const u32 hkey, bool *send_acpi_ev)
case 0:
if (hkey >= TP_HKEY_EV_ORIG_KEY_START &&
hkey <= TP_HKEY_EV_ORIG_KEY_END) {
- if (!(hotkey_source_mask & (1 << scancode)))
- tpacpi_input_send_key_masked(scancode);
-
- *send_acpi_ev = false;
+ tpacpi_input_send_key_masked(scancode);
return true;
}
break;