Re: [PATCH] dt-bindings: leds: Mark label property as deprecated

Marek Vasut
2022-12-01T23:45:10Z

On 11/30/22 20:19, Rob Herring wrote:
> On Fri, Nov 25, 2022 at 10:26:30PM +0100, Marek Vasut wrote:
>> On 11/22/22 13:23, Pavel Machek wrote:
>>> Hi!
>>
>> Hi,
>>
>>>> Mark the label property as deprecated as it is mentioned
>>>> in the description.
>>>
>>> Lets do it the other way around. Functions (etc) don't really provide
>>> good enough description of LED, and label is still needed.
>>
>> Can you please provide a clear explanation which property or approach is the
>> correct one for new DTs ?
>>
>> So far, the documentation states that "label" is deprecated, and users
>> should replace it with "function" and "color".
>
> 'function' is what activity/operation the LED is associated with. It is
> a fixed set of strings which s/w may use. It is a replacement for
> 'linux,default-trigger'.

Isn't this 'function' more of a standardized replacement for 'label' ?

$ git grep LED_FUNCTION_ include/
...
include/dt-bindings/leds/common.h:#define LED_FUNCTION_PLAYER5 "player-5"
include/dt-bindings/leds/common.h:#define LED_FUNCTION_ACTIVITY "activity"
include/dt-bindings/leds/common.h:#define LED_FUNCTION_ALARM "alarm"
include/dt-bindings/leds/common.h:#define LED_FUNCTION_BACKLIGHT "backlight"
include/dt-bindings/leds/common.h:#define LED_FUNCTION_BLUETOOTH "bluetooth"
include/dt-bindings/leds/common.h:#define LED_FUNCTION_BOOT "boot"
...

Seems to me that ^ is closer to a "standardized" form of 'label' .

The LED subsystem does not infer any behavior of those LEDs based on
their 'function' property as far as I can tell, at least not in the way
'linux,default-trigger' behaves.

> 'label' is what is printed next to the LED for a human to read. 'label'
> can be anything and the OS shouldn't care what it is.

This part I understand. What is not clear to me is, why is 'label' being
un-deprecated.

We newly have 'function', 'function-enumerator' and 'color' DT
properties for LEDs, which seem to be standardized forms of describing
what the LED is used for, which LED it is (if there are multiple), and
color of that LED. This was previously described in the 'label'
property, usually in free form of e.g. "beaglebone:green:usr2" .

> They serve 2 different purposes. …