Re: [PATCH v3 0/2] Keyboard backlight for the Lenovo Legion Pro 7 Gen 10

From: Ciro Pedrini

Date: Tue Dec 01 2026 - 16:58:42 EST


Hi Marco,

Thanks for testing it on the AMD model, and for all the details.

On Sat, 28 Nov 2026 at 18:46, Marco Giunta wrote:
> 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.

You're right. I went through all levels and all six effects with evtest
on "Ideapad extra buttons", next to c197's report 5: the code is the new
state, the same going up and down, and it's exactly your table (0x18,
0x19, 0x1a, 0x26 for levels 0/3/6/9, 0x20..0x25 for effects 1..6). My
three codes were just where those presses landed.

Ilpo has already applied patch 1 as it was, so I'll send the other seven
(0x18, 0x20, 0x22..0x26) as a small follow-up patch on top of it, with
you in Cc. David: if your series moves the keymap first, it's the same
lines in wmi-fn-keys.c, and I'll rebase.

> 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?

It returns 0 here, on every read, both as a 5-byte request like the
driver sends and as a full 960-byte one, and reading it changes nothing
(brightness and effect read the same before and after). v4 reads it in
probe: if it isn't 0 the driver registers no LED and the keyboard works
as before. I can only test the 0 case, so a test on the Y9000P would be
very welcome if your tester has time.

> "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.

Agreed, v4 uses ":kbd_backlight".

> 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.

Thanks for catching that. v4 follows Rong's answer to you: the mutex in
set and get, an atomic level shared with raw_event.

v4, with you in Cc:
https://lore.kernel.org/r/20261201-legion-lighting-rfc-v4-1-b08dfda3f295@xxxxxxxxx

Thanks,
Ciro