U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Marek Vasut <marex@denx.de>, u-boot@lists.denx.de
Cc: Philippe Reynes <philippe.reynes@softathome.com>,
	Doug Zobel <douglas.zobel@climate.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 2/6] led-uclass: honour ->label field populated by driver's own .bind
Date: Mon, 23 Oct 2023 10:51:09 +0200	[thread overview]
Message-ID: <7d38b732-e5f4-4e6a-9a5d-7837e285ba55@prevas.dk> (raw)
In-Reply-To: <d4389465-e5bd-492b-8f86-7b4a93ff6016@denx.de>

On 19/10/2023 15.54, Marek Vasut wrote:
> On 10/19/23 11:58, Rasmus Villemoes wrote:
>> If the driver's own .bind method has populated uc_plat->label, don't
>> override that. This is necessary for an upcoming driver for ti,lp5562,
>> where the DT binding unfortunately says to use "chan-name" and not
>> "label".
>>
>> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
>> ---
>>   drivers/led/led-uclass.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
>> index 5a5d07b9a7..0232fa84de 100644
>> --- a/drivers/led/led-uclass.c
>> +++ b/drivers/led/led-uclass.c
>> @@ -71,7 +71,9 @@ static int led_post_bind(struct udevice *dev)
>>       struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
>>       const char *default_state;
>>   -    uc_plat->label = dev_read_string(dev, "label");
>> +    if (!uc_plat->label)
>> +        uc_plat->label = dev_read_string(dev, "label");
>> +
> 
> One thing I have to wonder about is, why does this controller have label
> property in the top-level node , what is that used for ?
> 
> (see Linux Documentation/devicetree/bindings/leds/leds-lp55xx.yaml)
> 
> Reviewed-by: Marek Vasut <marex@denx.de>

Reading the linux driver, it seems that the top-level label, if any, is
used as part of the naming for individual channels if they don't have
individual chan-name properties:


        if (pdata->led_config[chan].name) {
                led->cdev.name = pdata->led_config[chan].name;
        } else {
                snprintf(name, sizeof(name), "%s:channel%d",
                        pdata->label ? : chip->cl->name, chan);
                led->cdev.name = name;
        }

but I think the rationale in d1188adb2dabc is a bit weak, since the only
example also does have individual chan-name properties.

[Complete aside: At first I thought it was related to the multi-color
LED work that has been ongoing for many many years (I think there was an
LWN article at some point), where this could be exposed as a single
multi-color LED, as opposed to the "traditional" three/four individual
LEDs. In the former case, there would only be one sysfs entry, but with
attributes exposing the multicolor functionality. I must admit I don't
know the status of that work, when something reaches v31,
http://archive.lwn.net:8080/linux-kernel/20200722071055.GA8984@amd/t/ ,
it's hard to know if it ever lands, or if pieces of it has landed.]

Rasmus


  reply	other threads:[~2023-10-23  8:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  9:58 [PATCH 0/6] some LED patches Rasmus Villemoes
2023-10-19  9:58 ` [PATCH 1/6] led-uclass: do not create fallback label for top-level node Rasmus Villemoes
2023-10-19 13:51   ` Marek Vasut
2023-10-23  8:28     ` Rasmus Villemoes
2023-10-23  9:01       ` Marek Vasut
2023-10-19  9:58 ` [PATCH 2/6] led-uclass: honour ->label field populated by driver's own .bind Rasmus Villemoes
2023-10-19 13:54   ` Marek Vasut
2023-10-23  8:51     ` Rasmus Villemoes [this message]
2023-10-23  9:03       ` Marek Vasut
2023-11-14 12:11         ` Christian Gmeiner
2023-11-15  5:37           ` Marek Vasut
2023-11-16  9:21             ` Pavel Machek
2023-10-23 10:43       ` Christian Gmeiner
2023-10-19  9:58 ` [PATCH 3/6] led: introduce led_bind_generic() Rasmus Villemoes
2023-10-19 13:56   ` Marek Vasut
2023-10-19  9:58 ` [PATCH 4/6] led: led_gpio: use led_bind_generic() helper Rasmus Villemoes
2023-10-19 13:56   ` Marek Vasut
2023-10-19  9:58 ` [PATCH 5/6] led: led_pwm: " Rasmus Villemoes
2023-10-19 13:57   ` Marek Vasut
2023-10-19  9:58 ` [PATCH 6/6] led: add TI LP5562 LED driver Rasmus Villemoes
2023-10-19 13:58   ` Marek Vasut
2023-10-23  9:11     ` Rasmus Villemoes
2023-10-23  9:39       ` Marek Vasut
2023-10-23 11:17         ` Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d38b732-e5f4-4e6a-9a5d-7837e285ba55@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=douglas.zobel@climate.com \
    --cc=marex@denx.de \
    --cc=philippe.reynes@softathome.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox