[PATCH v3] led: add function naming option from linux

Heiko Schocher hs at denx.de
Sat Jan 25 07:16:36 CET 2025


Hello Tom,

On 23.01.25 15:33, Tom Rini wrote:
> On Thu, Jan 23, 2025 at 12:49:06PM +0100, Heiko Schocher wrote:
> 
>> in linux we have the option to create the name of a led
>> optionally through the following properties:
>>
>> - function
>> - color
>> - function-enumerator
>>
>> This patch adds support for parsing this properties if there
>> is no label property.
>>
>> To be as close as possible to linux import the following files
>> from it:
>>
>> include/dt-bindings/leds/common.h
>> include/linux/uapi/linux/uleds.h
> [snip]
>> ---
>> as we introduce a new element in struct led_uc_priv, may we should add
>> this functionality through a new Kconfig option? (Which also would make
>> this optional and save some bytes for boards who do not need this...)
> [snip]
>>   arch/sandbox/dts/test.dts                | 37 ++++++++++++-
>>   doc/device-tree-bindings/leds/common.txt | 28 ++++++++++
>>   drivers/led/led-uclass.c                 | 70 ++++++++++++++++++++++--
>>   include/led.h                            |  6 ++
>>   test/dm/led.c                            | 22 +++++++-
>>   test/dm/ofnode.c                         |  2 +-
>>   6 files changed, 158 insertions(+), 7 deletions(-)
> 
> Getting things out of order slightly, sorry. The commit message should
> be updated a bit more still since we aren't copying files in. And we
> should delete doc/device-tree-bindings/leds/common.txt in a pre-patch
> because we have that from upstream now. As for size, how much is the

removed! And updated commit message

> growth? You can use tools/qconfig.py -b, and then -f LED to find some
> platforms to size compare before/after, and if you've not used buildman
> for size checking before I've put my script up over at
> https://source.denx.de/u-boot/u-boot-extras/-/raw/master/contrib/trini/u-boot-size-test.sh?ref_type=heads
> now for easier sharing.

Thanks for the script!

Here 2 examples:
$ ./u-boot-size-test.sh capricorn_cxg3 --branch led-mainline
[...]
    aarch64: (for 1/1 boards) all +886.0 rodata +230.0 text +656.0
             capricorn_cxg3 : all +886 rodata +230 text +656
                u-boot: add: 1/0, grow: 1/0 bytes: 416/0 (416)
                  function                                   old     new   delta
                  led_post_bind                              220     516    +296
                  led_colors                                   -     120    +120

$ ./u-boot-size-test.sh aristainetos2c --branch led-mainline
[...]
01: Merge patch series "add the support of sha256_hmac and sha256_hkdf"
40: led: add function naming option from linux
        arm: (for 2/2 boards) all +557.0 bss +20.0 rodata +161.0 text +376.0
             aristainetos2c : all +557 bss +20 rodata +161 text +376
                u-boot: add: 1/0, grow: 1/0 bytes: 264/0 (264)
                  function                                   old     new   delta
                  led_post_bind                              128     332    +204
                  led_colors                                   -      60     +60
             aristainetos2ccslb: all +557 bss +20 rodata +161 text +376
                u-boot: add: 1/0, grow: 1/0 bytes: 264/0 (264)
                  function                                   old     new   delta
                  led_post_bind                              128     332    +204
                  led_colors                                   -      60     +60

So, may not worth to add a Kconfig option here... or?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list