devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to pass a label as an overlay parameter?
@ 2025-01-18  3:25 Adam Nielsen
  0 siblings, 0 replies; only message in thread
From: Adam Nielsen @ 2025-01-18  3:25 UTC (permalink / raw)
  To: devicetree

Hi all,

Is it possible to pass a label to a device tree overlay as a parameter,
to control where the overlay is inserted in the tree?

I am attempting to use the ledtrig-gpio module[1], which works by
inserting an extra field in an LED definition:

  led_act: led-act {
          label = "ACT";
          gpios = <&gio_aon 9 GPIO_ACTIVE_LOW>;
          default-state = "off";
          linux,default-trigger = "mmc0";  // change to "gpio"
          trigger-sources = <&gpio 0 0>;   // new field added
  };

While I can successfully write an overlay that does these two things
(adds the extra trigger-sources line, and sets the trigger to "gpio")
my problem is that I am not sure how to tell the overlay where to
insert itself.

I am trying to write a generic overlay, such that it accepts parameters
for both the trigger-sources value, as well as the LED structure where
this value should be inserted.

The problem is that it seems you have to use a label (e.g. "led_act" in
the above example) as the insertion point for the overlay, however I am
not sure how to specify this as an overlay parameter.  This is because
the user of the overlay may want to insert the code for led_pwr,
led_act, or one of the nodes added by the led-gpio overlay, so there is
no fixed label or path for the insertion point.

As an aside, I am also wondering how one might link up this LED trigger
with say a USB keyboard, where the LED devices are not created until
much later in the boot process.  In this case the trigger would have to
be associated with an LED device in userspace, but the module doesn't
seem to be set up to create LED triggers in isolation that aren't
pre-attached to LEDs.

However for now, is it possible to specify the label or LED DT node as
a parameter to an overlay?  I read the documentation at [2] but it
doesn't seem to list these as parameter types, and I am not sure if it
can be done as a string parameter.

Many thanks,
Adam.
(Please CC, not subscribed)

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/leds/trigger/ledtrig-gpio.c?id=4a11dbf04f31c71eb458c062129e95b7aa308464
[2]: https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/configuration/device-tree.adoc

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-18  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-18  3:25 How to pass a label as an overlay parameter? Adam Nielsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).