Skip to contentSkip to conversation

Describing LEDs roles in device tree?

DISCUSSION Rafał Miłecki 1 participant 1 message Nov 20, 2023 LED

lore
Share & tools
lore
#0 lore raw

Hi!

Our current binding Documentation/devicetree/bindings/leds/common.yaml allows describing some generic LED parameters. Most common are color and function.

Now, many systems will want further & more specialized description of LEDs. Most common roles I can think of:
1. System is booting
2. System is running
3. System's failure

For kernel usage role we actually have a "panic-indicator" property.

Are those extra roles something we could put in DT?

Please note that "function" on its own is not sufficient as multiple LEDs my share the same function name but its meaning may vary depending on color.

OpenWrt developers started (ab?)using aliases in downstream/modified DT files for such purposes. Example:

aliases {
	led-boot = &led_status_blue;
	led-running = &led_status_green;
	led-failsafe = &led_status_red;
};

Above could work with some adjustments but I'm not sure if it's acceptable for upstream binding. Also what if OpenWrt wants to define different roles than another project? Prefixes?

With Linux a problem is also a lack of mapping between /proc/device-tree/leds/*
and
/sys/class/leds/*
With "label" present its simple but some guessing logic is needed for function + color properties (it's actually missing in OpenWrt right now)

Any suggestions for DT-based solution?

Signature · 1 line
Rafał Miłecki