|
Takashi Iwai |
72f63e |
From 3d677f12ea3a2097a16ded570623567403dea959 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
72f63e |
From: Esteve Varela Colominas <esteve.varela@gmail.com>
|
|
Takashi Iwai |
72f63e |
Date: Mon, 15 Mar 2021 20:58:24 +0100
|
|
Takashi Iwai |
72f63e |
Subject: [PATCH] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state
|
|
Takashi Iwai |
72f63e |
Git-commit: 3d677f12ea3a2097a16ded570623567403dea959
|
|
Takashi Iwai |
72f63e |
Patch-mainline: v5.12-rc5
|
|
Takashi Iwai |
72f63e |
References: git-fixes
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
On many recent ThinkPad laptops, there's a new LED next to the ESC key,
|
|
Takashi Iwai |
72f63e |
that indicates the FnLock status.
|
|
Takashi Iwai |
72f63e |
When the Fn+ESC combo is pressed, FnLock is toggled, which causes the
|
|
Takashi Iwai |
72f63e |
Media Key functionality to change, making it so that the media keys
|
|
Takashi Iwai |
72f63e |
either perform their media key function, or function as an F-key by
|
|
Takashi Iwai |
72f63e |
default. The Fn key can be used the access the alternate function at any
|
|
Takashi Iwai |
72f63e |
time.
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
With the current linux kernel, the LED doens't change state if you press
|
|
Takashi Iwai |
72f63e |
the Fn+ESC key combo. However, the media key functionality *does*
|
|
Takashi Iwai |
72f63e |
change. This is annoying, since the LED will stay on if it was on during
|
|
Takashi Iwai |
72f63e |
bootup, and it makes it hard to keep track what the current state of the
|
|
Takashi Iwai |
72f63e |
FnLock is.
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
This patch calls an ACPI function, that gets the current media key
|
|
Takashi Iwai |
72f63e |
state, when the Fn+ESC key combo is pressed. Through testing it was
|
|
Takashi Iwai |
72f63e |
discovered that this function causes the LED to update correctly to
|
|
Takashi Iwai |
72f63e |
reflect the current state when this function is called.
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
The relevant ACPI calls are the following:
|
|
Takashi Iwai |
72f63e |
\_sb_.pci0.lpc0.ec0_.hkey.gmks: Get media key state, returns 0x603 if the FnLock mode is enabled, and 0x602 if it's disabled.
|
|
Takashi Iwai |
72f63e |
\_sb_.pci0.lpc0.ec0_.hkey.smks: Set media key state, sending a 1 will enable FnLock mode, and a 0 will disable it.
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
Relevant discussion:
|
|
Takashi Iwai |
72f63e |
https://bugzilla.kernel.org/show_bug.cgi?id=207841
|
|
Takashi Iwai |
72f63e |
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881015
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
|
|
Takashi Iwai |
72f63e |
Link: https://lore.kernel.org/r/20210315195823.23212-1-esteve.varela@gmail.com
|
|
Takashi Iwai |
72f63e |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Takashi Iwai |
72f63e |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
---
|
|
Takashi Iwai |
72f63e |
drivers/platform/x86/thinkpad_acpi.c | 8 +++++++-
|
|
Takashi Iwai |
72f63e |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
|
|
Takashi Iwai |
72f63e |
index f7de90a47e28..8569c1d2a52c 100644
|
|
Takashi Iwai |
72f63e |
--- a/drivers/platform/x86/thinkpad_acpi.c
|
|
Takashi Iwai |
72f63e |
+++ b/drivers/platform/x86/thinkpad_acpi.c
|
|
Takashi Iwai |
72f63e |
@@ -4081,13 +4081,19 @@ static bool hotkey_notify_6xxx(const u32 hkey,
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
case TP_HKEY_EV_KEY_NUMLOCK:
|
|
Takashi Iwai |
72f63e |
case TP_HKEY_EV_KEY_FN:
|
|
Takashi Iwai |
72f63e |
- case TP_HKEY_EV_KEY_FN_ESC:
|
|
Takashi Iwai |
72f63e |
/* key press events, we just ignore them as long as the EC
|
|
Takashi Iwai |
72f63e |
* is still reporting them in the normal keyboard stream */
|
|
Takashi Iwai |
72f63e |
*send_acpi_ev = false;
|
|
Takashi Iwai |
72f63e |
*ignore_acpi_ev = true;
|
|
Takashi Iwai |
72f63e |
return true;
|
|
Takashi Iwai |
72f63e |
|
|
Takashi Iwai |
72f63e |
+ case TP_HKEY_EV_KEY_FN_ESC:
|
|
Takashi Iwai |
72f63e |
+ /* Get the media key status to foce the status LED to update */
|
|
Takashi Iwai |
72f63e |
+ acpi_evalf(hkey_handle, NULL, "GMKS", "v");
|
|
Takashi Iwai |
72f63e |
+ *send_acpi_ev = false;
|
|
Takashi Iwai |
72f63e |
+ *ignore_acpi_ev = true;
|
|
Takashi Iwai |
72f63e |
+ return true;
|
|
Takashi Iwai |
72f63e |
+
|
|
Takashi Iwai |
72f63e |
case TP_HKEY_EV_TABLET_CHANGED:
|
|
Takashi Iwai |
72f63e |
tpacpi_input_send_tabletsw();
|
|
Takashi Iwai |
72f63e |
hotkey_tablet_mode_notify_change();
|
|
Takashi Iwai |
72f63e |
--
|
|
Takashi Iwai |
72f63e |
2.26.2
|
|
Takashi Iwai |
72f63e |
|