Re: [PATCH RFC] leds: leds-lp50xx: Handle reg to get correct multi_index

From: Jacek Anaszewski
Date: Sat May 10 2025 - 11:32:35 EST


Hi Johan,

On 5/6/25 12:39, Johan Adolfsson wrote:
mc_subled used for multi_index needs well defined array indexes,
to guarantee the desired result, optionally use reg for that.

If devicetree child nodes is processed in random or reverse order
you may end up with multi_index "blue green red" instead of the expected
"red green blue".
If user space apps uses multi_index to deduce how to control the leds
they would most likely be broken without this patch if devicetree
processing is reversed (which it appears to be).

Are you trying to solve some real problem that occurred to you?

The order of DT nodes parsing is not a problem here - we save
color index in subled_info to be able to figure out which color
is on which position. This information can be retrieved in sysfs
by reading multi_index file.

--
Best regards,
Jacek Anaszewski