1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only 2c66ec88fSEmmanuel Vadot%YAML 1.2 3c66ec88fSEmmanuel Vadot--- 4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/leds/common.yaml# 5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6c66ec88fSEmmanuel Vadot 7c66ec88fSEmmanuel Vadottitle: Common leds properties 8c66ec88fSEmmanuel Vadot 9c66ec88fSEmmanuel Vadotmaintainers: 10c66ec88fSEmmanuel Vadot - Jacek Anaszewski <jacek.anaszewski@gmail.com> 11c66ec88fSEmmanuel Vadot - Pavel Machek <pavel@ucw.cz> 12c66ec88fSEmmanuel Vadot 13c66ec88fSEmmanuel Vadotdescription: 14c66ec88fSEmmanuel Vadot LED and flash LED devices provide the same basic functionality as current 15c66ec88fSEmmanuel Vadot regulators, but extended with LED and flash LED specific features like 16c66ec88fSEmmanuel Vadot blinking patterns, flash timeout, flash faults and external flash strobe mode. 17c66ec88fSEmmanuel Vadot 18c66ec88fSEmmanuel Vadot Many LED devices expose more than one current output that can be connected 19c66ec88fSEmmanuel Vadot to one or more discrete LED component. Since the arrangement of connections 20c66ec88fSEmmanuel Vadot can influence the way of the LED device initialization, the LED components 21c66ec88fSEmmanuel Vadot have to be tightly coupled with the LED device binding. They are represented 22c66ec88fSEmmanuel Vadot by child nodes of the parent LED device binding. 23c66ec88fSEmmanuel Vadot 24c66ec88fSEmmanuel Vadotproperties: 25c66ec88fSEmmanuel Vadot led-sources: 26c66ec88fSEmmanuel Vadot description: 27c66ec88fSEmmanuel Vadot List of device current outputs the LED is connected to. The outputs are 28c66ec88fSEmmanuel Vadot identified by the numbers that must be defined in the LED device binding 29c66ec88fSEmmanuel Vadot documentation. 305def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-array 31c66ec88fSEmmanuel Vadot 32c66ec88fSEmmanuel Vadot function: 33c66ec88fSEmmanuel Vadot description: 34c66ec88fSEmmanuel Vadot LED function. Use one of the LED_FUNCTION_* prefixed definitions 35c66ec88fSEmmanuel Vadot from the header include/dt-bindings/leds/common.h. If there is no 36c66ec88fSEmmanuel Vadot matching LED_FUNCTION available, add a new one. 375def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 38c66ec88fSEmmanuel Vadot 39c66ec88fSEmmanuel Vadot color: 40c66ec88fSEmmanuel Vadot description: 41c66ec88fSEmmanuel Vadot Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from 42c66ec88fSEmmanuel Vadot the header include/dt-bindings/leds/common.h. If there is no matching 43c66ec88fSEmmanuel Vadot LED_COLOR_ID available, add a new one. 445def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 45c66ec88fSEmmanuel Vadot minimum: 0 4684943d6fSEmmanuel Vadot maximum: 14 47c66ec88fSEmmanuel Vadot 48c66ec88fSEmmanuel Vadot function-enumerator: 49c66ec88fSEmmanuel Vadot description: 50c66ec88fSEmmanuel Vadot Integer to be used when more than one instance of the same function is 51c66ec88fSEmmanuel Vadot needed, differing only with an ordinal number. 525def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 53c66ec88fSEmmanuel Vadot 54c66ec88fSEmmanuel Vadot label: 55c66ec88fSEmmanuel Vadot description: 56c66ec88fSEmmanuel Vadot The label for this LED. If omitted, the label is taken from the node name 57c66ec88fSEmmanuel Vadot (excluding the unit address). It has to uniquely identify a device, i.e. 58c66ec88fSEmmanuel Vadot no other LED class device can be assigned the same label. This property is 59c66ec88fSEmmanuel Vadot deprecated - use 'function' and 'color' properties instead. 60c66ec88fSEmmanuel Vadot function-enumerator has no effect when this property is present. 61c66ec88fSEmmanuel Vadot 62c66ec88fSEmmanuel Vadot default-state: 63c66ec88fSEmmanuel Vadot description: 64c66ec88fSEmmanuel Vadot The initial state of the LED. If the LED is already on or off and the 65c66ec88fSEmmanuel Vadot default-state property is set the to same value, then no glitch should be 66c66ec88fSEmmanuel Vadot produced where the LED momentarily turns off (or on). The "keep" setting 67c66ec88fSEmmanuel Vadot will keep the LED at whatever its current state is, without producing a 68c66ec88fSEmmanuel Vadot glitch. 695def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 70c66ec88fSEmmanuel Vadot enum: 71c66ec88fSEmmanuel Vadot - on 72c66ec88fSEmmanuel Vadot - off 73c66ec88fSEmmanuel Vadot - keep 74c66ec88fSEmmanuel Vadot default: off 75c66ec88fSEmmanuel Vadot 76c66ec88fSEmmanuel Vadot linux,default-trigger: 77c66ec88fSEmmanuel Vadot description: 78c66ec88fSEmmanuel Vadot This parameter, if present, is a string defining the trigger assigned to 79c66ec88fSEmmanuel Vadot the LED. 805def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 81c66ec88fSEmmanuel Vadot 827ef62cebSEmmanuel Vadot oneOf: 837ef62cebSEmmanuel Vadot - enum: 84c66ec88fSEmmanuel Vadot # LED will act as a back-light, controlled by the framebuffer system 85c66ec88fSEmmanuel Vadot - backlight 86aa1a8ff2SEmmanuel Vadot # LED will turn on (see also "default-state" property) 87c66ec88fSEmmanuel Vadot - default-on 88c66ec88fSEmmanuel Vadot # LED "double" flashes at a load average based rate 89c66ec88fSEmmanuel Vadot - heartbeat 90c66ec88fSEmmanuel Vadot # LED indicates disk activity 91c66ec88fSEmmanuel Vadot - disk-activity 92fac71e4eSEmmanuel Vadot # LED indicates disk read activity 93cb7aa33aSEmmanuel Vadot - disk-read 94fac71e4eSEmmanuel Vadot # LED indicates disk write activity 95cb7aa33aSEmmanuel Vadot - disk-write 96c66ec88fSEmmanuel Vadot # LED flashes at a fixed, configurable rate 97c66ec88fSEmmanuel Vadot - timer 98c66ec88fSEmmanuel Vadot # LED alters the brightness for the specified duration with one software 99c66ec88fSEmmanuel Vadot # timer (requires "led-pattern" property) 100c66ec88fSEmmanuel Vadot - pattern 101fac71e4eSEmmanuel Vadot # LED indicates mic mute state 102fac71e4eSEmmanuel Vadot - audio-micmute 103fac71e4eSEmmanuel Vadot # LED indicates audio mute state 104fac71e4eSEmmanuel Vadot - audio-mute 105fac71e4eSEmmanuel Vadot # LED indicates bluetooth power state 106fac71e4eSEmmanuel Vadot - bluetooth-power 107fac71e4eSEmmanuel Vadot # LED indicates camera flash state 108fac71e4eSEmmanuel Vadot - flash 109fac71e4eSEmmanuel Vadot # LED indicated keyboard capslock 110fac71e4eSEmmanuel Vadot - kbd-capslock 111fac71e4eSEmmanuel Vadot # LED indicates MTD memory activity 112fac71e4eSEmmanuel Vadot - mtd 113fac71e4eSEmmanuel Vadot # LED indicates NAND memory activity (deprecated), 114fac71e4eSEmmanuel Vadot # in new implementations use "mtd" 115fac71e4eSEmmanuel Vadot - nand-disk 116*b2d2a78aSEmmanuel Vadot # LED indicates network activity 117*b2d2a78aSEmmanuel Vadot - netdev 118fac71e4eSEmmanuel Vadot # No trigger assigned to the LED. This is the default mode 119fac71e4eSEmmanuel Vadot # if trigger is absent 120fac71e4eSEmmanuel Vadot - none 121fac71e4eSEmmanuel Vadot # LED indicates camera torch state 122fac71e4eSEmmanuel Vadot - torch 123fac71e4eSEmmanuel Vadot # LED indicates USB gadget activity 124cb7aa33aSEmmanuel Vadot - usb-gadget 125fac71e4eSEmmanuel Vadot # LED indicates USB host activity 126cb7aa33aSEmmanuel Vadot - usb-host 127fac71e4eSEmmanuel Vadot # LED indicates USB port state 128fac71e4eSEmmanuel Vadot - usbport 129fac71e4eSEmmanuel Vadot # LED is triggered by CPU activity 1308bab661aSEmmanuel Vadot - pattern: "^cpu[0-9]*$" 131cb7aa33aSEmmanuel Vadot # LED is triggered by Bluetooth activity 132fac71e4eSEmmanuel Vadot - pattern: "^hci[0-9]+-power$" 133cb7aa33aSEmmanuel Vadot # LED is triggered by SD/MMC activity 134fac71e4eSEmmanuel Vadot - pattern: "^mmc[0-9]+$" 135cb7aa33aSEmmanuel Vadot # LED is triggered by WLAN activity 136fac71e4eSEmmanuel Vadot - pattern: "^phy[0-9]+tx$" 137c66ec88fSEmmanuel Vadot 138c66ec88fSEmmanuel Vadot led-pattern: 139c66ec88fSEmmanuel Vadot description: | 140c66ec88fSEmmanuel Vadot Array of integers with default pattern for certain triggers. 141c66ec88fSEmmanuel Vadot 142c66ec88fSEmmanuel Vadot Each trigger may parse this property differently: 143c66ec88fSEmmanuel Vadot - one-shot : two numbers specifying delay on and delay off (in ms), 144c66ec88fSEmmanuel Vadot - timer : two numbers specifying delay on and delay off (in ms), 145c66ec88fSEmmanuel Vadot - pattern : the pattern is given by a series of tuples, of 146c66ec88fSEmmanuel Vadot brightness and duration (in ms). The exact format is 147c66ec88fSEmmanuel Vadot described in: 148c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 1495def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-matrix 150c66ec88fSEmmanuel Vadot items: 151c66ec88fSEmmanuel Vadot minItems: 2 152c66ec88fSEmmanuel Vadot maxItems: 2 153c66ec88fSEmmanuel Vadot 154c66ec88fSEmmanuel Vadot led-max-microamp: 155c66ec88fSEmmanuel Vadot description: 156c66ec88fSEmmanuel Vadot Maximum LED supply current in microamperes. This property can be made 157c66ec88fSEmmanuel Vadot mandatory for the board configurations introducing a risk of hardware 158c66ec88fSEmmanuel Vadot damage in case an excessive current is set. 159c66ec88fSEmmanuel Vadot For flash LED controllers with configurable current this property is 160c66ec88fSEmmanuel Vadot mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 161c66ec88fSEmmanuel Vadot 162aa1a8ff2SEmmanuel Vadot max-brightness: 163aa1a8ff2SEmmanuel Vadot description: 164aa1a8ff2SEmmanuel Vadot Normally, the maximum brightness is determined by the hardware, and this 165aa1a8ff2SEmmanuel Vadot property is not required. This property is used to set a software limit. 166aa1a8ff2SEmmanuel Vadot It could happen that an LED is made so bright that it gets damaged or 167aa1a8ff2SEmmanuel Vadot causes damage due to restrictions in a specific system, such as mounting 168aa1a8ff2SEmmanuel Vadot conditions. 169aa1a8ff2SEmmanuel Vadot Note that this flag is mainly used for PWM-LEDs, where it is not possible 170aa1a8ff2SEmmanuel Vadot to map brightness to current. Drivers for other controllers should use 171aa1a8ff2SEmmanuel Vadot led-max-microamp. 1728d13bc63SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 173aa1a8ff2SEmmanuel Vadot 174c66ec88fSEmmanuel Vadot panic-indicator: 175c66ec88fSEmmanuel Vadot description: 176c66ec88fSEmmanuel Vadot This property specifies that the LED should be used, if at all possible, 177c66ec88fSEmmanuel Vadot as a panic indicator. 178c66ec88fSEmmanuel Vadot type: boolean 179c66ec88fSEmmanuel Vadot 180354d7675SEmmanuel Vadot retain-state-shutdown: 181354d7675SEmmanuel Vadot description: 182354d7675SEmmanuel Vadot This property specifies that the LED should not be turned off or changed 183354d7675SEmmanuel Vadot when the system shuts down. 184354d7675SEmmanuel Vadot type: boolean 185354d7675SEmmanuel Vadot 186c66ec88fSEmmanuel Vadot trigger-sources: 187c66ec88fSEmmanuel Vadot description: | 188c66ec88fSEmmanuel Vadot List of devices which should be used as a source triggering this LED 189c66ec88fSEmmanuel Vadot activity. Some LEDs can be related to a specific device and should somehow 190c66ec88fSEmmanuel Vadot indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 191c66ec88fSEmmanuel Vadot port(s). 192c66ec88fSEmmanuel Vadot Another common example is switch or router with multiple Ethernet ports 193c66ec88fSEmmanuel Vadot each of them having its own LED assigned (assuming they are not 194c66ec88fSEmmanuel Vadot hardwired). In such cases this property should contain phandle(s) of 195c66ec88fSEmmanuel Vadot related source device(s). 19684943d6fSEmmanuel Vadot Another example is a GPIO line that will be monitored and mirror the 19784943d6fSEmmanuel Vadot state of the line (with or without inversion flags) to the LED. 198c66ec88fSEmmanuel Vadot In many cases LED can be related to more than one device (e.g. one USB LED 199c66ec88fSEmmanuel Vadot vs. multiple USB ports). Each source should be represented by a node in 200c66ec88fSEmmanuel Vadot the device tree and be referenced by a phandle and a set of phandle 201c66ec88fSEmmanuel Vadot arguments. A length of arguments should be specified by the 202c66ec88fSEmmanuel Vadot #trigger-source-cells property in the source node. 2035def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 204c66ec88fSEmmanuel Vadot 20501950c46SEmmanuel Vadot active-low: 20601950c46SEmmanuel Vadot type: boolean 20701950c46SEmmanuel Vadot description: 20801950c46SEmmanuel Vadot Makes LED active low. To turn the LED ON, line needs to be 20901950c46SEmmanuel Vadot set to low voltage instead of high. 21001950c46SEmmanuel Vadot 21101950c46SEmmanuel Vadot inactive-high-impedance: 21201950c46SEmmanuel Vadot type: boolean 21301950c46SEmmanuel Vadot description: 21401950c46SEmmanuel Vadot Set LED to high-impedance mode to turn the LED OFF. LED might also 21501950c46SEmmanuel Vadot describe this mode as tristate. 21601950c46SEmmanuel Vadot 217c66ec88fSEmmanuel Vadot # Required properties for flash LED child nodes: 218c66ec88fSEmmanuel Vadot flash-max-microamp: 219c66ec88fSEmmanuel Vadot description: 220c66ec88fSEmmanuel Vadot Maximum flash LED supply current in microamperes. Required for flash LED 221c66ec88fSEmmanuel Vadot nodes with configurable current. 222c66ec88fSEmmanuel Vadot 223c66ec88fSEmmanuel Vadot flash-max-timeout-us: 224c66ec88fSEmmanuel Vadot description: 225c66ec88fSEmmanuel Vadot Maximum timeout in microseconds after which the flash LED is turned off. 226c66ec88fSEmmanuel Vadot Required for flash LED nodes with configurable timeout. 227c66ec88fSEmmanuel Vadot 2286be33864SEmmanuel VadotadditionalProperties: true 2296be33864SEmmanuel Vadot 230c66ec88fSEmmanuel Vadotexamples: 231c66ec88fSEmmanuel Vadot - | 232c66ec88fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 233c66ec88fSEmmanuel Vadot #include <dt-bindings/leds/common.h> 234c66ec88fSEmmanuel Vadot 235c66ec88fSEmmanuel Vadot led-controller { 236c66ec88fSEmmanuel Vadot compatible = "gpio-leds"; 237c66ec88fSEmmanuel Vadot 238c66ec88fSEmmanuel Vadot led-0 { 239c66ec88fSEmmanuel Vadot function = LED_FUNCTION_STATUS; 240c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 241c66ec88fSEmmanuel Vadot gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 242c66ec88fSEmmanuel Vadot }; 243c66ec88fSEmmanuel Vadot 244c66ec88fSEmmanuel Vadot led-1 { 245c66ec88fSEmmanuel Vadot function = LED_FUNCTION_USB; 246c66ec88fSEmmanuel Vadot gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 247c66ec88fSEmmanuel Vadot trigger-sources = <&ohci_port1>, <&ehci_port1>; 248c66ec88fSEmmanuel Vadot }; 249c66ec88fSEmmanuel Vadot }; 250c66ec88fSEmmanuel Vadot 251c9ccf3a3SEmmanuel Vadot - | 252c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 253c9ccf3a3SEmmanuel Vadot 254c9ccf3a3SEmmanuel Vadot led-controller { 255c66ec88fSEmmanuel Vadot compatible = "maxim,max77693-led"; 256c66ec88fSEmmanuel Vadot 257c66ec88fSEmmanuel Vadot led { 258c66ec88fSEmmanuel Vadot function = LED_FUNCTION_FLASH; 259c66ec88fSEmmanuel Vadot color = <LED_COLOR_ID_WHITE>; 260c66ec88fSEmmanuel Vadot led-sources = <0>, <1>; 261c66ec88fSEmmanuel Vadot led-max-microamp = <50000>; 262c66ec88fSEmmanuel Vadot flash-max-microamp = <320000>; 263c66ec88fSEmmanuel Vadot flash-max-timeout-us = <500000>; 264c66ec88fSEmmanuel Vadot }; 265c66ec88fSEmmanuel Vadot }; 266c66ec88fSEmmanuel Vadot 267c9ccf3a3SEmmanuel Vadot - | 268c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 269c9ccf3a3SEmmanuel Vadot 270c66ec88fSEmmanuel Vadot i2c { 271c66ec88fSEmmanuel Vadot #address-cells = <1>; 272c66ec88fSEmmanuel Vadot #size-cells = <0>; 273c66ec88fSEmmanuel Vadot 274c66ec88fSEmmanuel Vadot led-controller@30 { 275c66ec88fSEmmanuel Vadot compatible = "panasonic,an30259a"; 276c66ec88fSEmmanuel Vadot reg = <0x30>; 277c66ec88fSEmmanuel Vadot #address-cells = <1>; 278c66ec88fSEmmanuel Vadot #size-cells = <0>; 279c66ec88fSEmmanuel Vadot 280c66ec88fSEmmanuel Vadot led@1 { 281c66ec88fSEmmanuel Vadot reg = <1>; 282c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 283c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 284c66ec88fSEmmanuel Vadot function-enumerator = <1>; 285c66ec88fSEmmanuel Vadot }; 286c66ec88fSEmmanuel Vadot 287c66ec88fSEmmanuel Vadot led@2 { 288c66ec88fSEmmanuel Vadot reg = <2>; 289c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 290c66ec88fSEmmanuel Vadot function-enumerator = <2>; 291c66ec88fSEmmanuel Vadot }; 292c66ec88fSEmmanuel Vadot 293c66ec88fSEmmanuel Vadot led@3 { 294c66ec88fSEmmanuel Vadot reg = <3>; 295c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 296c66ec88fSEmmanuel Vadot function-enumerator = <3>; 297c66ec88fSEmmanuel Vadot }; 298c66ec88fSEmmanuel Vadot }; 299c66ec88fSEmmanuel Vadot }; 300c66ec88fSEmmanuel Vadot 301c66ec88fSEmmanuel Vadot... 302