All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: lenovo: Re-apply Fn-lock state on reset_resume
@ 2026-08-19 15:16 Stephanie Wilde-Hobbs
  0 siblings, 0 replies; only message in thread
From: Stephanie Wilde-Hobbs @ 2026-08-19 15:16 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-kernel
  Cc: linux-input, Derek J . Clark, Mark Pearson, stable,
	Stephanie Wilde-Hobbs

When a ThinkPad 10 Ultrabook or X1 Tablet keyboard is reset during
suspend/resume because the USB power session was lost, the keyboard
firmware reverts to its power-on Fn-lock state while the driver keeps
the value which was in effect before suspend. The fn_lock sysfs
attribute then disagrees with the actual key behaviour, and the Fn-lock
LED no longer reflects the state.

Re-apply the cached Fn-lock value in reset_resume, the same way the
compact keyboards already resend their configuration. This only runs
when the device was actually reset during resume, so a warm resume
which preserves the keyboard state is unaffected.

Tested on a ThinkPad X1 Tablet Gen 3 keyboard.

Fixes: c87de33ed43a ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard fn_lock support")
Assisted-by: ClaudeCode:deepseek-v4-flash-0731
Signed-off-by: Stephanie Wilde-Hobbs <git@stephanie.is>
---
 drivers/hid/hid-lenovo.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 3976d7b53b14..1ca58610e425 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -1432,6 +1432,8 @@ static int lenovo_probe(struct hid_device *hdev,
 
 static int lenovo_reset_resume(struct hid_device *hdev)
 {
+	struct lenovo_drvdata *data;
+
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
@@ -1439,6 +1441,25 @@ static int lenovo_reset_resume(struct hid_device *hdev)
 			lenovo_features_set_cptkbd(hdev);
 
 		break;
+	case USB_DEVICE_ID_LENOVO_X12_TAB:
+	case USB_DEVICE_ID_LENOVO_X12_TAB2:
+	case USB_DEVICE_ID_LENOVO_X13_TAB:
+	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
+	case USB_DEVICE_ID_LENOVO_X1_TAB:
+	case USB_DEVICE_ID_LENOVO_X1_TAB2:
+	case USB_DEVICE_ID_LENOVO_X1_TAB3:
+		/*
+		 * The keyboard reverts to its power-on Fn-lock default when
+		 * it is reset during resume, while we retain the state which
+		 * was in effect before suspend. Re-apply our cached value so
+		 * the Fn-lock behaviour and indicator stay in sync with the
+		 * sysfs interface.
+		 */
+		data = hid_get_drvdata(hdev);
+		if (data)
+			lenovo_led_set_tp10ubkbd(hdev, TP10UBKBD_FN_LOCK_LED,
+						 data->fn_lock);
+		break;
 	default:
 		break;
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-19 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 15:16 [PATCH] HID: lenovo: Re-apply Fn-lock state on reset_resume Stephanie Wilde-Hobbs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.