From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-166.mta0.migadu.com [91.218.175.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C908A3C0630 for ; Wed, 19 Aug 2026 15:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.166 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787152589; cv=none; b=MG5Tqf1YGUbWY0j6TVrJ2irI4i4c6z4kbE5NGhHQew2oyMvVHCUpISgVOP7GgRO4S9SOd8WsTG64cOi/GIGjFXQon3MKdoTRjYNspYN6ro+mJgrUd+eaE3eqX20Vu9/oi1zq9aYOep1gl5iL8Kq15Ay8VBCHojOFMfhVoCYG05w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787152589; c=relaxed/simple; bh=1qLtqv/HQP/ho7fTNQ1guG8sR7HixupGcypPBGfeEXU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZG+mCRMpbhUONu5NwTznUE38QlG8RAQndGR0RFigHdQ5AhyIO1h5RX1mVcThqH31k9oecV58DLuNppqoCQhNCaC/E/SKffD7CgEnN4nEaiz9f9L3XN8AuCWIZuyZe1tBWO2pNXTiqzZSIyBbhwfwI120Aib9UDSLmCWSMl9U/Nw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=stephanie.is; spf=pass smtp.mailfrom=stephanie.is; dkim=pass (2048-bit key) header.d=stephanie.is header.i=@stephanie.is header.b=WYhBg+6H; arc=none smtp.client-ip=91.218.175.166 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=stephanie.is Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=stephanie.is Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=stephanie.is header.i=@stephanie.is header.b="WYhBg+6H" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=1qLtqv/HQP/ho7fTNQ1guG8sR7HixupGcypPBGfeEXU=; c=simple/simple; d=stephanie.is; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787152581; v=1; x=1787757381; b=WYhBg+6HlE9lsKOFGQue3Sgv1ZJuAWsUASelOAHpWbyVW+bMrUF+VZlz4ttgDhm6NBkKVOcQ 3IGbeyzVuAeDxY4IrnfXQxxT5wJVtV0QmcUjoND8BOJk2YfDg1XgIYbzM8dGH0RBacFH2rP3UIY LcMNsCNAk+mELouC8ArZsuH+3eLreSuxe0mnu2J+2giGwBjoDi3lZAVHLG+VoLitwMVESm8geOT +Uu957BAkWFQXc7SKNILdXhd2qbpr9FQEpUIBESOeSWILhEIZ4fS9MoLwLH0Kpmz/vchOlm7Xu0 B+s/sR17TkUvrKsO23HlLaLtRzG2c4hZz+WHyL1z4uRWA== X-Envelope-To: linux-kernel@vger.kernel.org Received: from arisa.iscute.moe (2a11:f2c0:acac:10:1a1d:eaff:fe51:9041) by smtp.migadu.com with ESMTPS id 60e1cc53a49542b8; Wed, 19 Aug 2026 15:16:20 +0000 X-Mizu-Trace-ID: 60e1cc53a49542b8 X-Migadu-Flow: FLOW_OUT From: Stephanie Wilde-Hobbs To: Jiri Kosina , Benjamin Tissoires , linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Derek J . Clark" , Mark Pearson , stable@vger.kernel.org, Stephanie Wilde-Hobbs Subject: [PATCH] HID: lenovo: Re-apply Fn-lock state on reset_resume Date: Wed, 19 Aug 2026 17:16:09 +0200 Message-ID: <20260819151609.68209-1-git@stephanie.is> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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