LEDs connected to GPIO lines
Schema identifier ($id): "http://devicetree.org/schemas/leds/leds-gpio.yaml#"
Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"
Maintainers (maintainers): "Jacek Anaszewski <jacek.anaszewski@gmail.com>", "Pavel Machek <pavel@ucw.cz>"
Each LED is represented as a sub-node of the gpio-leds device. Each node's name represents the name of the corresponding LED.
Properties and child nodes (properties) #
compatible — not listed as required here #
Exact value (const): "gpio-leds"
Properties matching a name pattern (patternProperties) #
(^led-[0-9a-f]$|led) — name matches this regular expression #
Value type (type): "object"
Shared schema rule ($ref): common.yaml#
Properties not evaluated by applicable rules (unevaluatedProperties) #
false
Not allowed by this rule.
Properties and child nodes (properties) #
gpios — required here
Maximum number of items (maxItems): 1
retain-state-suspended — not listed as required here
The suspend state can be retained.Such as charge-led gpio.
Value type (type): "boolean"
retain-state-shutdown — not listed as required here
Retain the state of the LED on shutdown. Useful in BMC systems, for example when the BMC is rebooted while the host remains up.
Value type (type): "boolean"
Required in this object (required): "gpios"
Properties not matched by properties or patternProperties in this schema (additionalProperties) #
false
Not allowed by this rule.
Examples (examples) #
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
leds {
compatible = "gpio-leds";
led-0 {
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
linux,default-trigger = "disk-activity";
function = LED_FUNCTION_DISK;
};
led-1 {
gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
/* Keep LED on if BIOS detected hardware fault */
default-state = "keep";
function = LED_FUNCTION_FAULT;
};
};
run-control {
compatible = "gpio-leds";
led-0 {
gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_RED>;
default-state = "off";
};
led-1 {
gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
default-state = "on";
};
};
Source notes #
Annotations retained from the schema source
Line 1: SPDX-License-Identifier: GPL-2.0-only
Line 22: The first form is preferred, but fall back to just 'led' anywhere in the
Line 23: node name to at least catch some child nodes.