302 lines · yaml
1# SPDX-License-Identifier: GPL-2.0-only2%YAML 1.23---4$id: http://devicetree.org/schemas/leds/common.yaml#5$schema: http://devicetree.org/meta-schemas/core.yaml#6 7title: Common leds properties8 9maintainers:10 - Jacek Anaszewski <jacek.anaszewski@gmail.com>11 - Pavel Machek <pavel@ucw.cz>12 13description:14 LED and flash LED devices provide the same basic functionality as current15 regulators, but extended with LED and flash LED specific features like16 blinking patterns, flash timeout, flash faults and external flash strobe mode.17 18 Many LED devices expose more than one current output that can be connected19 to one or more discrete LED component. Since the arrangement of connections20 can influence the way of the LED device initialization, the LED components21 have to be tightly coupled with the LED device binding. They are represented22 by child nodes of the parent LED device binding.23 24properties:25 led-sources:26 description:27 List of device current outputs the LED is connected to. The outputs are28 identified by the numbers that must be defined in the LED device binding29 documentation.30 $ref: /schemas/types.yaml#/definitions/uint32-array31 32 function:33 description:34 LED function. Use one of the LED_FUNCTION_* prefixed definitions35 from the header include/dt-bindings/leds/common.h. If there is no36 matching LED_FUNCTION available, add a new one.37 $ref: /schemas/types.yaml#/definitions/string38 39 color:40 description:41 Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from42 the header include/dt-bindings/leds/common.h. If there is no matching43 LED_COLOR_ID available, add a new one.44 $ref: /schemas/types.yaml#/definitions/uint3245 minimum: 046 maximum: 1447 48 function-enumerator:49 description:50 Integer to be used when more than one instance of the same function is51 needed, differing only with an ordinal number.52 $ref: /schemas/types.yaml#/definitions/uint3253 54 label:55 description:56 The label for this LED. If omitted, the label is taken from the node name57 (excluding the unit address). It has to uniquely identify a device, i.e.58 no other LED class device can be assigned the same label. This property is59 deprecated - use 'function' and 'color' properties instead.60 function-enumerator has no effect when this property is present.61 62 default-state:63 description:64 The initial state of the LED. If the LED is already on or off and the65 default-state property is set the to same value, then no glitch should be66 produced where the LED momentarily turns off (or on). The "keep" setting67 will keep the LED at whatever its current state is, without producing a68 glitch.69 $ref: /schemas/types.yaml#/definitions/string70 enum:71 - on72 - off73 - keep74 default: off75 76 linux,default-trigger:77 description:78 This parameter, if present, is a string defining the trigger assigned to79 the LED.80 $ref: /schemas/types.yaml#/definitions/string81 82 oneOf:83 - enum:84 # LED will act as a back-light, controlled by the framebuffer system85 - backlight86 # LED will turn on (see also "default-state" property)87 - default-on88 # LED "double" flashes at a load average based rate89 - heartbeat90 # LED indicates disk activity91 - disk-activity92 # LED indicates disk read activity93 - disk-read94 # LED indicates disk write activity95 - disk-write96 # LED flashes at a fixed, configurable rate97 - timer98 # LED alters the brightness for the specified duration with one software99 # timer (requires "led-pattern" property)100 - pattern101 # LED indicates mic mute state102 - audio-micmute103 # LED indicates audio mute state104 - audio-mute105 # LED indicates bluetooth power state106 - bluetooth-power107 # LED indicates camera flash state108 - flash109 # LED indicated keyboard capslock110 - kbd-capslock111 # LED indicates MTD memory activity112 - mtd113 # LED indicates NAND memory activity (deprecated),114 # in new implementations use "mtd"115 - nand-disk116 # LED indicates network activity117 - netdev118 # No trigger assigned to the LED. This is the default mode119 # if trigger is absent120 - none121 # LED indicates camera torch state122 - torch123 # LED indicates USB gadget activity124 - usb-gadget125 # LED indicates USB host activity126 - usb-host127 # LED indicates USB port state128 - usbport129 # LED is triggered by CPU activity130 - pattern: "^cpu[0-9]*$"131 # LED is triggered by Bluetooth activity132 - pattern: "^hci[0-9]+-power$"133 # LED is triggered by SD/MMC activity134 - pattern: "^mmc[0-9]+$"135 # LED is triggered by WLAN activity136 - pattern: "^phy[0-9]+tx$"137 138 led-pattern:139 description: |140 Array of integers with default pattern for certain triggers.141 142 Each trigger may parse this property differently:143 - one-shot : two numbers specifying delay on and delay off (in ms),144 - timer : two numbers specifying delay on and delay off (in ms),145 - pattern : the pattern is given by a series of tuples, of146 brightness and duration (in ms). The exact format is147 described in:148 Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt149 $ref: /schemas/types.yaml#/definitions/uint32-matrix150 items:151 minItems: 2152 maxItems: 2153 154 led-max-microamp:155 description:156 Maximum LED supply current in microamperes. This property can be made157 mandatory for the board configurations introducing a risk of hardware158 damage in case an excessive current is set.159 For flash LED controllers with configurable current this property is160 mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).161 162 max-brightness:163 description:164 Normally, the maximum brightness is determined by the hardware, and this165 property is not required. This property is used to set a software limit.166 It could happen that an LED is made so bright that it gets damaged or167 causes damage due to restrictions in a specific system, such as mounting168 conditions.169 Note that this flag is mainly used for PWM-LEDs, where it is not possible170 to map brightness to current. Drivers for other controllers should use171 led-max-microamp.172 $ref: /schemas/types.yaml#/definitions/uint32173 174 panic-indicator:175 description:176 This property specifies that the LED should be used, if at all possible,177 as a panic indicator.178 type: boolean179 180 retain-state-shutdown:181 description:182 This property specifies that the LED should not be turned off or changed183 when the system shuts down.184 type: boolean185 186 trigger-sources:187 description: |188 List of devices which should be used as a source triggering this LED189 activity. Some LEDs can be related to a specific device and should somehow190 indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0191 port(s).192 Another common example is switch or router with multiple Ethernet ports193 each of them having its own LED assigned (assuming they are not194 hardwired). In such cases this property should contain phandle(s) of195 related source device(s).196 Another example is a GPIO line that will be monitored and mirror the197 state of the line (with or without inversion flags) to the LED.198 In many cases LED can be related to more than one device (e.g. one USB LED199 vs. multiple USB ports). Each source should be represented by a node in200 the device tree and be referenced by a phandle and a set of phandle201 arguments. A length of arguments should be specified by the202 #trigger-source-cells property in the source node.203 $ref: /schemas/types.yaml#/definitions/phandle-array204 205 active-low:206 type: boolean207 description:208 Makes LED active low. To turn the LED ON, line needs to be209 set to low voltage instead of high.210 211 inactive-high-impedance:212 type: boolean213 description:214 Set LED to high-impedance mode to turn the LED OFF. LED might also215 describe this mode as tristate.216 217 # Required properties for flash LED child nodes:218 flash-max-microamp:219 description:220 Maximum flash LED supply current in microamperes. Required for flash LED221 nodes with configurable current.222 223 flash-max-timeout-us:224 description:225 Maximum timeout in microseconds after which the flash LED is turned off.226 Required for flash LED nodes with configurable timeout.227 228additionalProperties: true229 230examples:231 - |232 #include <dt-bindings/gpio/gpio.h>233 #include <dt-bindings/leds/common.h>234 235 led-controller {236 compatible = "gpio-leds";237 238 led-0 {239 function = LED_FUNCTION_STATUS;240 linux,default-trigger = "heartbeat";241 gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;242 };243 244 led-1 {245 function = LED_FUNCTION_USB;246 gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;247 trigger-sources = <&ohci_port1>, <&ehci_port1>;248 };249 };250 251 - |252 #include <dt-bindings/leds/common.h>253 254 led-controller {255 compatible = "maxim,max77693-led";256 257 led {258 function = LED_FUNCTION_FLASH;259 color = <LED_COLOR_ID_WHITE>;260 led-sources = <0>, <1>;261 led-max-microamp = <50000>;262 flash-max-microamp = <320000>;263 flash-max-timeout-us = <500000>;264 };265 };266 267 - |268 #include <dt-bindings/leds/common.h>269 270 i2c {271 #address-cells = <1>;272 #size-cells = <0>;273 274 led-controller@30 {275 compatible = "panasonic,an30259a";276 reg = <0x30>;277 #address-cells = <1>;278 #size-cells = <0>;279 280 led@1 {281 reg = <1>;282 linux,default-trigger = "heartbeat";283 function = LED_FUNCTION_INDICATOR;284 function-enumerator = <1>;285 };286 287 led@2 {288 reg = <2>;289 function = LED_FUNCTION_INDICATOR;290 function-enumerator = <2>;291 };292 293 led@3 {294 reg = <3>;295 function = LED_FUNCTION_INDICATOR;296 function-enumerator = <3>;297 };298 };299 };300 301...302