From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.103.14.15 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795888027; b=Q+FiXAVDNXgLWivp/7EZDgwCQIGGfmHG/2B07InyVG+Gw4KjNQkONN9tieAaSYdk8uZW PPzwocHib45+r3TGDcaJZm+gg8z0LoU0WMIeBqZUKfRDyrC+36KiMCxBwJJCXcodP+HFU m6VtcVxKeO1mS0gBNJuiTzFoLON8EHwzdQR/t6krxftQir3X8IhboOYXuMHifAjZ+qqpp u3szN1dakvd4Bpo9fZSmSJ3u/Wr6rAxyq3FxRMVqTDJwZXK1VxUytTmYbAH0/yhVPETTz AV8j3COiumkSdxBbnxiseZ456woVRJ3mQ0IdsoySFRw10dhn6vFvqlJ8dFv/WBS9nlA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795888027; h=DMARC-Filter:DKIM-Signature:Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References: Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy: X-Microsoft-Original-Message-ID:MIME-Version: X-MS-Exchange-MessageSentRepresentingType:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=e7ytIhbq5s5fkzbnVsOzShEfWIGDI2CBgZjX2gzTPSU=; b=gmHLgb2OLI+c0f/UeHcFkJto2L5tonYtJCBMHs6yxPBQUMbXm6fP1a9CwfCG1pnSusHP pFZWbnzkWJHdJmN6S89gvrfZybWVuEBhbLB2druMQ+ugAZJBxuMC1jxbM54kJZ2KH+UV6 p6iaxL1z1G2eVECqVI6SUf4ATvQm73nFHWlBbzORD30GPNOB9pyvNMOypqZQw2g39RNma McAi9ZwfvkOB7Ju8IDQQmczpz3j6LAZRfYrA7nbgAv5UgObd5/ETUHSQz4A/EseTfeI24 vYDl0Qh0GwXhPgPb+dZqUDgsZilb1BPx3ltVsVXvcu+YYu7LUOFEz/3K7DchcLX/gYA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=outlook.it; spf=pass smtp.mailfrom=outlook.it; dkim=pass header.d=OUTLOOK.IT header.i=@OUTLOOK.IT header.a=rsa-sha256 header.s=selector1 header.b=g5CulCEz; arc=pass header.oldest-pass=0 smtp.remote-ip=52.103.14.15 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazolkn19012015.outbound.protection.outlook.com [52.103.14.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B87BC606A31C; Sat, 28 Nov 2026 17:47:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B87BC606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.it Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=OUTLOOK.IT header.i=@OUTLOOK.IT header.a=rsa-sha256 header.s=selector1 header.b=g5CulCEz ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fo93iNwhiyBh2uOJf5DxPvwoN2I1lm5PoRC28x44+fmEZb8UBW1t2gLp4wPphV1NVfD0Ssocsa1EI8A9xKbIGv0KqiIvjhcIMbA1pJGZC0b4DtRELLIDJLpO9bEXWveu4UZ+Fs4acuaU938lMJHxIZGgvJOrUI0UI6xX6bY0pFS4hL/qJlep68zpUM2WwtAF95zJsG0EqBXV6R2x6KeR0o5lMz+CDRp6XuTej86iRFGydQJT1scZ+nlZdb0mKpvIYpY8iDPsB6/2DJaxT079pPcaZKc2Wmf6GTFbXa4aEhwyBN4uZqiGycoeEjl2T74qrTrPb39N30uzIerRHviUxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e7ytIhbq5s5fkzbnVsOzShEfWIGDI2CBgZjX2gzTPSU=; b=o0Wa5Q69atDcNlQssavXmMgJ+7EPIQLxvr+39666BnlFkGAg9ySiTOD5PTHSsQ22zLzC12cqu5F9KD2U4yAKSuarcINk0RtkMZoYpwJotMV/OhD5jkXXkHmthnT7Z4l4bCBCkEtH7MqDpDZQ8o1jjbIaQyxraPb4vJFWl9I5B/s/8IPVv1FCDXgTSHL9htZCJke99wHaUaCR5AIT9oduSE8ErwZCY9AkyCVNb+qU0MHhi7o58WwbbxqEn4wE6+PA6vREuGPRIqPtPrQKjNAGsUy5oFhFbjeLSAePADpCHlcuO86n7j7Ir/MRFZ6kzupF7byf+pBUUD4+FqWcOkpNvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=OUTLOOK.IT; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e7ytIhbq5s5fkzbnVsOzShEfWIGDI2CBgZjX2gzTPSU=; b=g5CulCEzRQdW1eCrmpn7tPM7q06cM7c21gtEBTipYIv8c/gnJaSMR3NiVN1Xa7sMsNJm1ITrpVOYievCap+GYTsqMZtqbOwvkmFTujir7x7ab0POT0rrcaYQtho8RKu7kyoZRlmceE9rHz+Y/yfVcuypD4aYozuruuQ9sRHeedEAkyspIb4areGwPz9u0roDF+m0knWihQPqsxv5t3ttLwo+0/LtEoezoMtV73krwQp93OZ3SL/Md6DlFByhTxSVCemEPwTKQs62U1Hqe/Ax1nyqVJlJX0vK4vUUMNdyX5Fd6PPkhWa+PNcr4NpsVtVbVvejxgS3EXB9GJbXcRtNWQ== Received: from SN6PR19MB2303.namprd19.prod.outlook.com (2603:10b6:805:56::19) by PH0PR19MB5084.namprd19.prod.outlook.com (2603:10b6:510:7b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.7; Sat, 28 Nov 2026 17:47:03 +0000 Received: from SN6PR19MB2303.namprd19.prod.outlook.com ([fe80::805c:7f80:c69f:876a]) by SN6PR19MB2303.namprd19.prod.outlook.com ([fe80::805c:7f80:c69f:876a%4]) with mapi id 15.21.0662.007; Sat, 28 Nov 2026 17:47:03 +0000 From: Marco Giunta To: devnull+ciro.pedrini.gmail.com@kernel.org Cc: aer@tuxedocomputers.com, bentiss@kernel.org, ciro.pedrini@gmail.com, dcemin@nvidia.com, derekjohn.clark@gmail.com, hansg@kernel.org, i@rong.moe, ikepanhc@gmail.com, ilpo.jarvinen@linux.intel.com, jikos@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, mpearson-lenovo@squebb.ca, platform-driver-x86@vger.kernel.org, wse@tuxedocomputers.com, marco_giunta@outlook.it Subject: Re: [PATCH v3 0/2] Keyboard backlight for the Lenovo Legion Pro 7 Gen 10 Date: Sat, 28 Nov 2026 18:46:47 +0100 Message-ID: X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261127-legion-lighting-rfc-v3-0-15c55d9f15b7@gmail.com> References: <20261127-legion-lighting-rfc-v3-0-15c55d9f15b7@gmail.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MI1P293CA0022.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:3::19) To BYAPR19MB2293.namprd19.prod.outlook.com (2603:10b6:a02:be::11) X-Microsoft-Original-Message-ID: <20261128174647.51642-1-marco_giunta@outlook.it> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR19MB2303:EE_|PH0PR19MB5084:EE_ X-MS-Office365-Filtering-Correlation-Id: ef5baeda-1b9a-4787-7503-08df4d779a6f X-Microsoft-Antispam: BCL:0;ARA:14566002|4140399003|25010399006|55001999006|19110799012|8060799015|24021099003|260925184616899003|10092599007|12121999013|5072599009|23021999003|15080799012|41001999006|12091999003|1602099012|10035399007|52005399003|40105399003|56899033|3412199025|440099028|4302099013|1710799026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?S3kWLP2aAwSSpnA2S/j8rpszYtkKDB2t9nLZRh+uI9EYJUEmlpZfJYKFtDXW?= =?us-ascii?Q?Q1T3/z2C1XPon2XCImEJirNUK6c05CvsODxINYoayD+4gvaQGrfJH38JU3zw?= =?us-ascii?Q?wP7x1rNJDQTdVPLzqruYOLJHZ48/mGsWFWBm6yKmT2TuAJsUjifAmjuLNUWP?= =?us-ascii?Q?Dz/vOJ9c6nCSjEv/NtwsxBiW4+1bfhWEIp05XUBJRV6De+ZdK5Gito5XqmnA?= =?us-ascii?Q?KPf3J5tfC02WIIG+5QJOkQc56+mKBD0MFF+NIJYiTAwc0R2Mq+bNjz+FKk5D?= =?us-ascii?Q?B4Eu6+bjDLvbGPU7A8QhT35YIcbbaHYiNlXmbNdg3z4yUz4M9kudMd/D30Xb?= =?us-ascii?Q?HrQuPdJKMFGmSk4XiacxFqBzGOXwgVwG5ECMkZZ2lpHgpg9di9Z0Dwty1R2N?= =?us-ascii?Q?LsGQJABjetbnt0UBFRtSh+b8FKHG35eJw2UBXLnYYbb7JhSK39IgHBzoJW20?= =?us-ascii?Q?OtmAJ7PvFvZR+BlxHeegD7cSNQsmD8ztd+ZaFLEIDSCClN+M3QXttRi45eql?= =?us-ascii?Q?0933DwjYurmVyJTLb37jJY3YPfVqkw4d/t/J4WLPM+F5Sa/bTYE11g/Mjrt+?= =?us-ascii?Q?DPnDcTy+9f73rGWfZ3sI40NcdGVv/BLu9/V6K8slmgbGZfomXj8wCZhGT4Mj?= =?us-ascii?Q?VfI79pNOXHT0HuQG0bsVNfe/157F4H96mA8ouC2wL/3sgCX1xIWegOmyI6Tm?= =?us-ascii?Q?eimt/Qr4X0Ei2ayqOjTeVd8O+oLgJ/mbu/lzcHCYRCURUZuhrxNI/hA2F15V?= =?us-ascii?Q?v5D0lDqEygm0jvUbu2b2FpDDhN3zYprmcSXo9xptfTtluZsEFbIL7tLsE1S1?= =?us-ascii?Q?MAxQdcy1XRd86/3IIYy3cAiPBBRHP5FUAz1gp3CdPv0mDyFKOx2+h1wse6wB?= =?us-ascii?Q?NvDgmaUHtW/G6MmxJk4GVTZYSeUxKPA5Z9IB4GCZUpeWOVxbegzjD3xdGlJX?= =?us-ascii?Q?KQRZ38m+9+cVVjbgC4yRo3WuScvYTQ6VR99Xgwn4Jl+4cmfCaRNVPdWZL0yf?= =?us-ascii?Q?UEX+9ESUn0BEDXRR5Y+Y/NUgJOHdIIdrwqsGrRgDg5nadjug2vx40YiT2fRr?= =?us-ascii?Q?RIGD1p6219YlZ3x3R9dNRMdFbGLuJpr1mBduPxVO12/i3QLnH+Doc8jyFlbz?= =?us-ascii?Q?Vci73izMAaJ/zEYy20KeLTMWVTy3jCnqLl+j4jYwSUXEZWI8OM6jwU8=3D?= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ri2F/cz1yW2a7p8tnp5kwT4umttXcsnuSWWZdqlAHKkOW+NDtQotdiWjSSAh?= =?us-ascii?Q?v6OwTnEmDH5XZektpYn8SXoBiprZHvw29Waf2/UuwOq7WzC6Pxu6y0AHJIBd?= =?us-ascii?Q?yJjIyJ9/g2DZW15kGmo1Ieaawf32ZVoFF0itPIzowTqTtHFlO5wVww1Z6gP4?= =?us-ascii?Q?nxzAgkoCufo6bMinB6ovnUzEEMK7g74kOv9ZqmxdAZeP9NoNJSjSjmPYLLA+?= =?us-ascii?Q?/unIUYXhGAvS/MYEbrTr82B6HLFciN2tyhPVHWZe6fhI8+QFhDn+eDw4wg6C?= =?us-ascii?Q?5XhsAZznWSr+TPzVVSejljmbn1Xdpe6G27QKmF9jsiERK3L+XDIzxxWYDkYy?= =?us-ascii?Q?HbQcJPj1PekbMadulDZR7i/SMh0ClZn/KMmZ11MBOPGGraAZkrqAX+U3SIla?= =?us-ascii?Q?9i/UbxyP86Y9UlqNFgmQG9WgnTYRFF0Ugbvi9sioMLgVj7r3xgWMIqAH9yke?= =?us-ascii?Q?5vYNgOy28drWvXCCfe6EWLxzc7rn6z3OGE/qUVHFZqvHo5WC0soQBVZHB+ys?= =?us-ascii?Q?YF9Dnh7g7GNGJVaudxeEGrcOfnuRT9B+a3vP894Egq4Jio9ms29tyKiihcyE?= =?us-ascii?Q?xzOoSYcV15PSVghUQXrdxT4/bmHLOaTewFI0yIcSt/JA3zxKeY8iiMr2yCLq?= =?us-ascii?Q?BgDj3BQTsc75ew1n63XEq94/q8pbINAfMlG1H4FgQQIoH0ooQGjOQIEaNXfY?= =?us-ascii?Q?PORh3Bobr6sy/ACXea0uRNd8/eLE85Z5mdF9QCaUsKktDqk3DfnagC5jT40X?= =?us-ascii?Q?d83tX4xadVpHnxF2YEzq1VaCRGW1CHK0j8fQ6EQ6t9mgeHqONLZooGanQTnZ?= =?us-ascii?Q?l//rbi4Q3zPS4ElW5cs4Pq8Q9FdCwnERE9T+lRZ2ju96GFuwFEW10o8vPraV?= =?us-ascii?Q?F1/okaj/Fk/yhxC3hJHhi4y/3eBvxFpzGVxI6yGtHCXhDgumQ+m4iXjbH9wQ?= =?us-ascii?Q?la/eJpzTpB/B0GAAq9Jcm7ZZt28HQC+1llhoBrIA35UbxosWVgZR1WQzSAel?= =?us-ascii?Q?fti+ohgctPmP9fHcix0BVFCbTNTmbon1OqfZeJZ+19keWiic1nN0PFkuCl7u?= =?us-ascii?Q?rEkoW1p5iN+kXCOQ2/c0vHJIOqUgXFRcrPIVCV0fjAQWkAcLXwdpqFZ5vrTF?= =?us-ascii?Q?44hzgMlABV7fcBHj06/SYzqgIl/yj9bmkKYLKzARbRMbHKIeEbrCK71CXEqr?= =?us-ascii?Q?l1wxHHawXzfp7t7WcGpPNgCZingWsuZGMjDImH//I9xPxlBcpv6k6VQsxTtm?= =?us-ascii?Q?mLIVZCa6OmaqgIvg61qmma7W6ewvIEuGUZRX2S/rxMnlRdoFrJyvd2G89+z+?= =?us-ascii?Q?TrTGWYIfc8f0xXULxf0GtKTyrmQq7ZsnduPoads3H4SUUz3BxUF+U/f0NwVw?= =?us-ascii?Q?SHIRs84=3D?= X-OriginatorOrg: sct-15-20-9412-4-msonline-outlook-990eb.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ef5baeda-1b9a-4787-7503-08df4d779a6f X-MS-Exchange-CrossTenant-AuthSource: BYAPR19MB2293.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2026 17:47:03.3285 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB5084 Hi all, Ciro, thank you for this series. Some time ago I started working on the exact same driver, but never really had the time to polish it and submit it. Now that you did, I can happily and lazily skip this effort. I have some high-level comments on the series. For reference, my laptop is the Legion Pro 7 16AFR10H, which is the AMD variant of the 16IAX10H. Apologies for not sending this earlier, I missed v1 and v2. I see that in v3 you already fixed e.g. ignoring the spurious "brightness up" event reported after OS/fn+up/fn+space-induced state changes or removing the unnecessary sleep, but there are still some missing things. 1. More WMI event codes to be ignored -------------------------------------------------------------------------- (This part is for both Ciro and David, since Rong suggested moving patch 1 into David's series.) On my laptop, the WMI codes emitted when pressing fn+space or fn+up/down encode the new state, not just "state changed": there are 6 codes for the RGB presets and 4 for the brightness levels. Here is the code I had written in my draft series: /* * Legion keyboard backlight level, Fn+Up/Down (handled by the firmware, * changes reported by hid-lenovo-legion) */ { KE_IGNORE, 0x18 | IDEAPAD_WMI_KEY }, /* off */ { KE_IGNORE, 0x19 | IDEAPAD_WMI_KEY }, /* low */ { KE_IGNORE, 0x1a | IDEAPAD_WMI_KEY }, /* medium */ { KE_IGNORE, 0x26 | IDEAPAD_WMI_KEY }, /* high */ /* Legion keyboard lighting preset, Fn+Space (handled by the firmware) */ { KE_IGNORE, 0x20 | IDEAPAD_WMI_KEY }, /* preset 1 */ { KE_IGNORE, 0x21 | IDEAPAD_WMI_KEY }, /* preset 2 */ { KE_IGNORE, 0x22 | IDEAPAD_WMI_KEY }, /* preset 3 */ { KE_IGNORE, 0x23 | IDEAPAD_WMI_KEY }, /* preset 4 */ { KE_IGNORE, 0x24 | IDEAPAD_WMI_KEY }, /* preset 5 */ { KE_IGNORE, 0x25 | IDEAPAD_WMI_KEY }, /* preset 6 */ Ciro: The three codes in your patch 1 (0x21 for fn+space, 0x1a for fn+up, 0x19 for fn+down) are exactly my "preset 2", "medium" and "low". Of course the Intel and AMD models' firmwares may simply differ here, but it could also be that your laptop behaves like mine and each key press you tested happened to land on those states. Could you check by cycling through *all* brightness levels and presets with evtest? If so, the other seven codes still reach userspace as KEY_UNKNOWN on your machine as well with the current patch 1. My guess is that the two laptops behave identically, since it would be unusual for these WMI codes not to be Lenovo-wide constants, especially on two closely related models, but this is just a guess on my end. Maybe Rong or Mark have some insight on this. Regardless of the exact meaning on any particular model, the firmware handles these keys and the HID driver reports the brightness changes, so none of these WMI events are needed and all ten should be KE_IGNORE'd. This is the only relevant (and actionable) point I'm trying to make in this section. Whichever version of patch 1 carries all ten codes, in this series or in David's, will get my Reviewed-by tag. 2. 0xd1 compatibility check on other Legion models -------------------------------------------------------------------------- On my Legion, and I would assume yours as well, the KBLC ACPI method is present in firmware but it's a stub: trying to do anything with it fails, and ideapad-laptop says: ideapad_acpi VPC2004:00: Unknown keyboard type: 1 without registering any platform::kbd_backlight LED cdev. This makes sense, given that the backlight is actually driven by the USB keyboard controller. However, the opposite happens on the Legion Y9000P IAX10, which is the China-exclusive version of the 16IAX10H and has the same keyboard controller with the same USB ID. A tester of mine kindly ran some tests on that laptop; here's the summary: * The IAX10 only has a white backlight, similarly to most Yogas. * Consistently with the above, that device uses the KBLC method: the platform::kbd_backlight LED is already registered and functional (tested with upower on an unpatched kernel). Regarding the hardware, the keyboard's brightness is changed with the Yoga-like fn+space combo, while fn+up/down does nothing. * On the HID side, GET_BRIGHTNESS always returns 9 regardless of the actual level, and the controller sends no report 5 on fn+space or on brightness changes through platform::kbd_backlight. Also note that your 16IAX10H and the tester's Y9000P report the same BIOS version, Q7CN77WW (on top of the same 83F5 DMI), so neither the USB ID nor DMI/BIOS matching can tell these machines apart. For reference, Lenovo's BIOS changelogs, e.g. the latest one: https://download.lenovo.com/consumer/mobiles/q7cn83ww.txt officially confirm that the same BIOS image is shared between the Legion Pro 7 16IAX10H, the Legion Y9000P IAX10H and the Legion Y9000P IAX10. So if the driver binds based on the USB ID alone, it will register a second, broken kbd_backlight LED on devices that already have a functioning one. Fortunately, there seems to be a programmatic way of telling these cases apart. This project: https://github.com/LenovoLegionToolkit-Team/LenovoLegionToolkit/ is a GPLv3 Windows app aiming to replace the proprietary Lenovo apps, and includes a complete reverse engineering of the keyboard's HID protocol. Here is a userspace Linux/Python port of the above targeting exclusively the RGB functionality: https://github.com/alstergee/legion-spectrum-control/ One opcode reported in these repos that your driver doesn't use is 0xd1, which is called "compatibility". I have checked that on my 16AFR10H it returns 0, while on my tester's Y9000P it returns 1, so indeed it seems like the right tool for the job. Could you confirm that it returns 0 on your 16IAX10H too, before relying on it? Overall, my suggestion would be to add a small helper, something like legion_is_compatible(), that returns whether the response to 0xd1 is zero; alternatively, something like legion_check_compatibility() that returns -ENODEV on failure (I personally prefer the simpler version, but I'll leave such details to Rong and Ilpo). Either way, I suggest using this helper in probe to conditionally skip the LED registration on incompatible models, while still keeping the keyboard itself working. 3. Legion Pro 5 Gen 10 models with ID 0xc195 -------------------------------------------------------------------------- This part isn't directed at anyone in this thread specifically. In some open issues in the second GitHub repo I linked, people report trying these HID commands in userspace on Legion Pro 5 Gen 10 models (also from 2025), whose keyboard controllers have ID 0xc195 instead of 0xc197. Brightness and whole-keyboard colour reportedly work, while per-key colours light up the wrong keys (which doesn't matter for this driver, since it only handles the brightness for now). So, if any owner of a Pro 5 Gen 10 model is reading this, please consider testing the driver on your device with 0xc195 added to the legion_devices table. (I wouldn't recommend adding the ID to the patch without direct confirmation.) 4. Some notes on patch 2 -------------------------------------------------------------------------- I haven't had time to review the code in detail, but a few things stood out while skimming through this thread and the past ones: * I gave v3 a quick try on my 16AFR10H (on 7.3.6 + Fedora 45 KDE, with devm_kzalloc_obj() replaced by devm_kzalloc() since the former is only available from 7.4). Everything works as expected based on a 5-minute test, including the short reports, suspend/resume (the level is kept and the hotkeys still update the OSD afterwards) and reboots (the level is kept from GRUB onwards, and KDE's slider picks it up). Also, exposing the raw 0-9 range turns out to be a good choice: in my draft I had limited it to the 0/3/6/9 steps used by fn+up/down, but on my laptop the intermediate levels are all visibly different, so KDE's slider gives finer control than the hotkeys do. I didn't know the keyboard had these "hidden" intermediate levels, so thanks for that. BTW, mixing software and hardware controls works as well: starting from an intermediate level (i.e. not a multiple of 3), fn+up and fn+down snap to the nearest multiple of 3 in that direction (e.g. 1 + fn+up -> 3, 4 + fn+down -> 3), and KDE's OSD follows on screen. So if this were the final revision I'd give my Tested-by, but I'll save that for a later one. * Separately from Rong's question about the function part of the name, "legion::kbd_backlight" uses a vendor/product name as the devicename, which Documentation/leds/leds-class.rst describes as deprecated; ":kbd_backlight" is the documented form, and my suggestion going forward. * About Rong's suggestion to serialize legion_brightness_{set,get}() and legion_raw_event() with kbd->lock: if I'm not mistaken, kbd->lock is a mutex and raw_event runs in interrupt context, so it can't be taken there. In my draft I kept a mutex in set/get around the whole SET/GET exchange (with a lockdep assertion in the command helper), plus a spinlock protecting only the cached level, which set() and raw_event both read and write. Unlike your v1 spinlock, which only guarded the redundant "ready" flag, this one protects the current brightness state, which is shared with raw_event. That said, most of my experience is in the sound tree, so I'm not 100% sure this is the best (or even a correct) approach, and I'll gladly defer to Rong on the details. 5. In conclusion... -------------------------------------------------------------------------- Ciro, I'm sure Rong, Ilpo and Mark will offer much more useful and timely commentary on the code than I could, so please don't wait for another mail from me before sending v4. And when you do, please CC me so I can provide my Tested-by and Reviewed-by tags ASAP. Again, I'm quite busy at the moment, so I can't give an in-depth review for now, but I'll gladly do one later if possible. Thanks again for working on this. Best regards, Marco