Linux LED subsystem development
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Lee Jones <lee@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-renesas-soc@vger.kernel.org,
	Magnus Damm <magnus.damm@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, Pavel Machek <pavel@kernel.org>,
	linux-leds <linux-leds@vger.kernel.org>
Subject: Re: [PATCH v3] ARM: dts: renesas: r9a06g032-rzn1d400-db: describe Debug LEDs
Date: Mon, 19 May 2025 09:37:52 +0200	[thread overview]
Message-ID: <20250519-crudeness-hatchery-3c9f02fc95ad@thorsis.com> (raw)
In-Reply-To: <c9c6b734-30c4-467c-bd5b-b73784aa0f27@gmail.com>

Hello Jacek,

Am Sun, May 18, 2025 at 04:36:52PM +0200 schrieb Jacek Anaszewski:
> Hi Alexander,
> 
> On 5/16/25 09:35, Alexander Dahl wrote:
> > Hei hei,
> > 
> > just wanted to create a new thread on a similar topic, but this is so
> > close, just hooking in here …
> > 
> > Am Sat, May 10, 2025 at 02:43:45PM +0200 schrieb Jacek Anaszewski:
> > > Hi all,

[…]

> > > The question is if the LED name from the schematics tells anything to
> > > the user of the equipment?
> > > 
> > > The idea behind LED naming is to facilitate matching the LED class
> > > device name as reported by the system with the LED location on the
> > > equipment.
> > > 
> > > The LED naming standardization intended to enforce consistent
> > > LED naming, and not allowing to add multiple interchangeable
> > > names like wifi/wlan. It also helps to keep LED name sections order in
> > > accordance with Linux documentation, which before had been often
> > > abused by allowing to assign anything to the now deprecated 'label'
> > > DT property.
> > 
> > You see devicetree changes frequently which change the sysfs path of
> > existing LEDs, last example I saw today:
> > 
> > https://lore.kernel.org/linux-devicetree/20250513170056.96259-1-didi.debian@cknow.org/
> > 
> > Consider this change:
> > 
> >   		led-lan1 {
> >   			color = <LED_COLOR_ID_GREEN>;
> > +			default-state = "off";
> >   			function = LED_FUNCTION_LAN;
> >   			function-enumerator = <1>;
> >   			gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
> > +			label = "LAN-1";
> 
> So this change was made without understanding how LED naming works,
> and without reading LED common bindings [0], which clearly states
> that 'label' property is deprecated. It makes no sense to add 'label'
> when there are already 'function' and 'color' properties present.
> Label takes precedence to keep backwards compatibility.
> 
> > +			linux,default-trigger = "netdev";
> >   		};
> > 
> > Before the sysfs path probably was /sys/class/leds/green:lan-1 and
> > with the addition of the label property now it's probably
> > /sys/class/leds/LAN-1 … so it changed.  This might break userspace,
> > which relies on certain sysfs paths, maybe.
> > 
> > The main question is: Is that sysfs path considered to be a stable
> > interface for accessing a particular LED or not?
> 
> It should be stable, but since LED sysfs interface is influenced by
> DT implementation, then the responsibility for keeping it stable is on
> given dts file maintainer.

Okay thanks for clarification.

Follow-up question: should the linux-leds list be included in Cc if
someone changes LED related DTS properties?  This is often not the
case, like in the case quoted above.

> > I've seen this pattern also the other way round, were an old dts only
> > has the node name determing the sysfs path, people change the node
> > name or add color/function properties, gone is the supposedly stable
> > path.
> > 
> > New idea: what about making this somewhat more flexible and less
> > suprising by _always_ creating the standardized sysfs entry based on
> > color/function by default, and let label only create an additional
> > symlink linking to that?
> > 
> > So in the above example /sys/class/leds/green:lan-1 would be the
> > canonical name/path of that LED, and /sys/class/leds/LAN-1 would only
> > be a symlink on it?
> 
> IMO it would be cheaper to keep DTS implementation stable.
> 
> [0] Documentation/devicetree/bindings/leds/common.yaml

Ack.  Sounds for me like it would be okay to point users to those
bindings and the deprecation notice, if one stumbles over such changes
on the devicetree list?

Greets
Alex


  reply	other threads:[~2025-05-19  7:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250417093256.40390-2-wsa+renesas@sang-engineering.com>
2025-04-17 11:39 ` [PATCH v3] ARM: dts: renesas: r9a06g032-rzn1d400-db: describe Debug LEDs Geert Uytterhoeven
2025-05-08  7:56   ` Wolfram Sang
2025-05-08 13:49     ` Lee Jones
2025-05-10 12:43       ` Jacek Anaszewski
2025-05-12  7:13         ` Geert Uytterhoeven
2025-05-12 17:54           ` Jacek Anaszewski
2025-05-14 15:28             ` Lee Jones
2025-05-14 18:57               ` Jacek Anaszewski
2025-05-15  6:53                 ` Lee Jones
2025-05-15 20:14                   ` Jacek Anaszewski
2025-05-15  8:27                 ` Wolfram Sang
2025-05-15  9:15                   ` Lee Jones
2025-05-15 19:53                   ` Jacek Anaszewski
2025-05-16  7:35         ` Alexander Dahl
2025-05-18 14:36           ` Jacek Anaszewski
2025-05-19  7:37             ` Alexander Dahl [this message]
2025-05-19 21:14               ` Jacek Anaszewski

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=20250519-crudeness-hatchery-3c9f02fc95ad@thorsis.com \
    --to=ada@thorsis.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=pavel@kernel.org \
    --cc=robh@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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