Re: Maximum values for multi_intensity sysfs attribute

From: Werner Sembach

Date: Wed Mar 04 2026 - 07:00:20 EST


Hi Barnabás,

Am 04.03.26 um 12:45 schrieb Pőcze Barnabás:
Hi

2026. 02. 14. 20:15 keltezéssel, Armin Wolf írta:
Hello,

i am currently adding support for RGB keyboard backlight control to the uniwill-laptop
driver, and want to use the multicolor LED class for that. However the hardware interface
is a bit exotic:

- 5 global brightness levels
- 50 intensity levels for each R/G/B channel

I am now asking myself how this should be mapped onto the multi_intensity sysfs attribute.
Should i set max_brightness to 5 and reject intensity values larger that 50? Or should
i set max_brightness to 50 and interpolate? What is the input range of intensity values?
Is that the same interface implemented by https://github.com/pobrn/hid-ite8291r3
(and https://github.com/pobrn/ite8291r3-ctl)?

In any case it's probably not too different. Unfortunately I don't recall ever finding a
satisfying way to integrate it with the multi-color led things. The best approach I could
find: brightness as [0; 50], while multi_intesity is [0; 255], essentially specifying the
color of each channel (simply clamping, without `led_mc_calc_color_components()`). Note that
the above kernel driver does not implement per-key color setting, so this approach seemed
most sensible.

Note that some devices control the brightness levels via EC directly when pressing a key combo with no way of disabling that. So the 5 brightness levels can't be easily abstracted away.

For best compatibility I would still suggest adapting the brightness levels of the firmware (5 levels), it will cause headaches down the road otherwise.

Best regards,

Werner



Barnabás Pőcze

Thanks,
Armin Wolf