0001 # SPDX-License-Identifier: GPL-2.0-only
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/leds/common.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006
0007 title: Common leds properties
0008
0009 maintainers:
0010 - Jacek Anaszewski <jacek.anaszewski@gmail.com>
0011 - Pavel Machek <pavel@ucw.cz>
0012
0013 description:
0014 LED and flash LED devices provide the same basic functionality as current
0015 regulators, but extended with LED and flash LED specific features like
0016 blinking patterns, flash timeout, flash faults and external flash strobe mode.
0017
0018 Many LED devices expose more than one current output that can be connected
0019 to one or more discrete LED component. Since the arrangement of connections
0020 can influence the way of the LED device initialization, the LED components
0021 have to be tightly coupled with the LED device binding. They are represented
0022 by child nodes of the parent LED device binding.
0023
0024 properties:
0025 led-sources:
0026 description:
0027 List of device current outputs the LED is connected to. The outputs are
0028 identified by the numbers that must be defined in the LED device binding
0029 documentation.
0030 $ref: /schemas/types.yaml#/definitions/uint32-array
0031
0032 function:
0033 description:
0034 LED function. Use one of the LED_FUNCTION_* prefixed definitions
0035 from the header include/dt-bindings/leds/common.h. If there is no
0036 matching LED_FUNCTION available, add a new one.
0037 $ref: /schemas/types.yaml#/definitions/string
0038
0039 color:
0040 description:
0041 Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from
0042 the header include/dt-bindings/leds/common.h. If there is no matching
0043 LED_COLOR_ID available, add a new one.
0044 $ref: /schemas/types.yaml#/definitions/uint32
0045 minimum: 0
0046 maximum: 9
0047
0048 function-enumerator:
0049 description:
0050 Integer to be used when more than one instance of the same function is
0051 needed, differing only with an ordinal number.
0052 $ref: /schemas/types.yaml#/definitions/uint32
0053
0054 label:
0055 description:
0056 The label for this LED. If omitted, the label is taken from the node name
0057 (excluding the unit address). It has to uniquely identify a device, i.e.
0058 no other LED class device can be assigned the same label. This property is
0059 deprecated - use 'function' and 'color' properties instead.
0060 function-enumerator has no effect when this property is present.
0061
0062 default-state:
0063 description:
0064 The initial state of the LED. If the LED is already on or off and the
0065 default-state property is set the to same value, then no glitch should be
0066 produced where the LED momentarily turns off (or on). The "keep" setting
0067 will keep the LED at whatever its current state is, without producing a
0068 glitch.
0069 $ref: /schemas/types.yaml#/definitions/string
0070 enum:
0071 - on
0072 - off
0073 - keep
0074 default: off
0075
0076 linux,default-trigger:
0077 description:
0078 This parameter, if present, is a string defining the trigger assigned to
0079 the LED.
0080 $ref: /schemas/types.yaml#/definitions/string
0081
0082 enum:
0083 # LED will act as a back-light, controlled by the framebuffer system
0084 - backlight
0085 # LED will turn on (but for leds-gpio see "default-state" property in
0086 # Documentation/devicetree/bindings/leds/leds-gpio.yaml)
0087 - default-on
0088 # LED "double" flashes at a load average based rate
0089 - heartbeat
0090 # LED indicates disk activity
0091 - disk-activity
0092 # LED indicates IDE disk activity (deprecated), in new implementations
0093 # use "disk-activity"
0094 - ide-disk
0095 # LED flashes at a fixed, configurable rate
0096 - timer
0097 # LED alters the brightness for the specified duration with one software
0098 # timer (requires "led-pattern" property)
0099 - pattern
0100
0101 led-pattern:
0102 description: |
0103 Array of integers with default pattern for certain triggers.
0104
0105 Each trigger may parse this property differently:
0106 - one-shot : two numbers specifying delay on and delay off (in ms),
0107 - timer : two numbers specifying delay on and delay off (in ms),
0108 - pattern : the pattern is given by a series of tuples, of
0109 brightness and duration (in ms). The exact format is
0110 described in:
0111 Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
0112 $ref: /schemas/types.yaml#/definitions/uint32-matrix
0113 items:
0114 minItems: 2
0115 maxItems: 2
0116
0117 led-max-microamp:
0118 description:
0119 Maximum LED supply current in microamperes. This property can be made
0120 mandatory for the board configurations introducing a risk of hardware
0121 damage in case an excessive current is set.
0122 For flash LED controllers with configurable current this property is
0123 mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
0124
0125 panic-indicator:
0126 description:
0127 This property specifies that the LED should be used, if at all possible,
0128 as a panic indicator.
0129 type: boolean
0130
0131 retain-state-shutdown:
0132 description:
0133 This property specifies that the LED should not be turned off or changed
0134 when the system shuts down.
0135 type: boolean
0136
0137 trigger-sources:
0138 description: |
0139 List of devices which should be used as a source triggering this LED
0140 activity. Some LEDs can be related to a specific device and should somehow
0141 indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0
0142 port(s).
0143 Another common example is switch or router with multiple Ethernet ports
0144 each of them having its own LED assigned (assuming they are not
0145 hardwired). In such cases this property should contain phandle(s) of
0146 related source device(s).
0147 In many cases LED can be related to more than one device (e.g. one USB LED
0148 vs. multiple USB ports). Each source should be represented by a node in
0149 the device tree and be referenced by a phandle and a set of phandle
0150 arguments. A length of arguments should be specified by the
0151 #trigger-source-cells property in the source node.
0152 $ref: /schemas/types.yaml#/definitions/phandle-array
0153
0154 # Required properties for flash LED child nodes:
0155 flash-max-microamp:
0156 description:
0157 Maximum flash LED supply current in microamperes. Required for flash LED
0158 nodes with configurable current.
0159
0160 flash-max-timeout-us:
0161 description:
0162 Maximum timeout in microseconds after which the flash LED is turned off.
0163 Required for flash LED nodes with configurable timeout.
0164
0165 additionalProperties: true
0166
0167 examples:
0168 - |
0169 #include <dt-bindings/gpio/gpio.h>
0170 #include <dt-bindings/leds/common.h>
0171
0172 led-controller {
0173 compatible = "gpio-leds";
0174
0175 led-0 {
0176 function = LED_FUNCTION_STATUS;
0177 linux,default-trigger = "heartbeat";
0178 gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
0179 };
0180
0181 led-1 {
0182 function = LED_FUNCTION_USB;
0183 gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
0184 trigger-sources = <&ohci_port1>, <&ehci_port1>;
0185 };
0186 };
0187
0188 - |
0189 #include <dt-bindings/leds/common.h>
0190
0191 led-controller {
0192 compatible = "maxim,max77693-led";
0193
0194 led {
0195 function = LED_FUNCTION_FLASH;
0196 color = <LED_COLOR_ID_WHITE>;
0197 led-sources = <0>, <1>;
0198 led-max-microamp = <50000>;
0199 flash-max-microamp = <320000>;
0200 flash-max-timeout-us = <500000>;
0201 };
0202 };
0203
0204 - |
0205 #include <dt-bindings/leds/common.h>
0206
0207 i2c {
0208 #address-cells = <1>;
0209 #size-cells = <0>;
0210
0211 led-controller@30 {
0212 compatible = "panasonic,an30259a";
0213 reg = <0x30>;
0214 #address-cells = <1>;
0215 #size-cells = <0>;
0216
0217 led@1 {
0218 reg = <1>;
0219 linux,default-trigger = "heartbeat";
0220 function = LED_FUNCTION_INDICATOR;
0221 function-enumerator = <1>;
0222 };
0223
0224 led@2 {
0225 reg = <2>;
0226 function = LED_FUNCTION_INDICATOR;
0227 function-enumerator = <2>;
0228 };
0229
0230 led@3 {
0231 reg = <3>;
0232 function = LED_FUNCTION_INDICATOR;
0233 function-enumerator = <3>;
0234 };
0235 };
0236 };
0237
0238 ...