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 116fac71e4eSEmmanuel Vadot # No trigger assigned to the LED. This is the default mode 117fac71e4eSEmmanuel Vadot # if trigger is absent 118fac71e4eSEmmanuel Vadot - none 119fac71e4eSEmmanuel Vadot # LED indicates camera torch state 120fac71e4eSEmmanuel Vadot - torch 121fac71e4eSEmmanuel Vadot # LED indicates USB gadget activity 122cb7aa33aSEmmanuel Vadot - usb-gadget 123fac71e4eSEmmanuel Vadot # LED indicates USB host activity 124cb7aa33aSEmmanuel Vadot - usb-host 125fac71e4eSEmmanuel Vadot # LED indicates USB port state 126fac71e4eSEmmanuel Vadot - usbport 127fac71e4eSEmmanuel Vadot # LED is triggered by CPU activity 1288bab661aSEmmanuel Vadot - pattern: "^cpu[0-9]*$" 129cb7aa33aSEmmanuel Vadot # LED is triggered by Bluetooth activity 130fac71e4eSEmmanuel Vadot - pattern: "^hci[0-9]+-power$" 131cb7aa33aSEmmanuel Vadot # LED is triggered by SD/MMC activity 132fac71e4eSEmmanuel Vadot - pattern: "^mmc[0-9]+$" 133cb7aa33aSEmmanuel Vadot # LED is triggered by WLAN activity 134fac71e4eSEmmanuel Vadot - pattern: "^phy[0-9]+tx$" 135c66ec88fSEmmanuel Vadot 136c66ec88fSEmmanuel Vadot led-pattern: 137c66ec88fSEmmanuel Vadot description: | 138c66ec88fSEmmanuel Vadot Array of integers with default pattern for certain triggers. 139c66ec88fSEmmanuel Vadot 140c66ec88fSEmmanuel Vadot Each trigger may parse this property differently: 141c66ec88fSEmmanuel Vadot - one-shot : two numbers specifying delay on and delay off (in ms), 142c66ec88fSEmmanuel Vadot - timer : two numbers specifying delay on and delay off (in ms), 143c66ec88fSEmmanuel Vadot - pattern : the pattern is given by a series of tuples, of 144c66ec88fSEmmanuel Vadot brightness and duration (in ms). The exact format is 145c66ec88fSEmmanuel Vadot described in: 146c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 1475def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-matrix 148c66ec88fSEmmanuel Vadot items: 149c66ec88fSEmmanuel Vadot minItems: 2 150c66ec88fSEmmanuel Vadot maxItems: 2 151c66ec88fSEmmanuel Vadot 152c66ec88fSEmmanuel Vadot led-max-microamp: 153c66ec88fSEmmanuel Vadot description: 154c66ec88fSEmmanuel Vadot Maximum LED supply current in microamperes. This property can be made 155c66ec88fSEmmanuel Vadot mandatory for the board configurations introducing a risk of hardware 156c66ec88fSEmmanuel Vadot damage in case an excessive current is set. 157c66ec88fSEmmanuel Vadot For flash LED controllers with configurable current this property is 158c66ec88fSEmmanuel Vadot mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 159c66ec88fSEmmanuel Vadot 160aa1a8ff2SEmmanuel Vadot max-brightness: 161aa1a8ff2SEmmanuel Vadot description: 162aa1a8ff2SEmmanuel Vadot Normally, the maximum brightness is determined by the hardware, and this 163aa1a8ff2SEmmanuel Vadot property is not required. This property is used to set a software limit. 164aa1a8ff2SEmmanuel Vadot It could happen that an LED is made so bright that it gets damaged or 165aa1a8ff2SEmmanuel Vadot causes damage due to restrictions in a specific system, such as mounting 166aa1a8ff2SEmmanuel Vadot conditions. 167aa1a8ff2SEmmanuel Vadot Note that this flag is mainly used for PWM-LEDs, where it is not possible 168aa1a8ff2SEmmanuel Vadot to map brightness to current. Drivers for other controllers should use 169aa1a8ff2SEmmanuel Vadot led-max-microamp. 170*8d13bc63SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 171aa1a8ff2SEmmanuel Vadot 172c66ec88fSEmmanuel Vadot panic-indicator: 173c66ec88fSEmmanuel Vadot description: 174c66ec88fSEmmanuel Vadot This property specifies that the LED should be used, if at all possible, 175c66ec88fSEmmanuel Vadot as a panic indicator. 176c66ec88fSEmmanuel Vadot type: boolean 177c66ec88fSEmmanuel Vadot 178354d7675SEmmanuel Vadot retain-state-shutdown: 179354d7675SEmmanuel Vadot description: 180354d7675SEmmanuel Vadot This property specifies that the LED should not be turned off or changed 181354d7675SEmmanuel Vadot when the system shuts down. 182354d7675SEmmanuel Vadot type: boolean 183354d7675SEmmanuel Vadot 184c66ec88fSEmmanuel Vadot trigger-sources: 185c66ec88fSEmmanuel Vadot description: | 186c66ec88fSEmmanuel Vadot List of devices which should be used as a source triggering this LED 187c66ec88fSEmmanuel Vadot activity. Some LEDs can be related to a specific device and should somehow 188c66ec88fSEmmanuel Vadot indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 189c66ec88fSEmmanuel Vadot port(s). 190c66ec88fSEmmanuel Vadot Another common example is switch or router with multiple Ethernet ports 191c66ec88fSEmmanuel Vadot each of them having its own LED assigned (assuming they are not 192c66ec88fSEmmanuel Vadot hardwired). In such cases this property should contain phandle(s) of 193c66ec88fSEmmanuel Vadot related source device(s). 19484943d6fSEmmanuel Vadot Another example is a GPIO line that will be monitored and mirror the 19584943d6fSEmmanuel Vadot state of the line (with or without inversion flags) to the LED. 196c66ec88fSEmmanuel Vadot In many cases LED can be related to more than one device (e.g. one USB LED 197c66ec88fSEmmanuel Vadot vs. multiple USB ports). Each source should be represented by a node in 198c66ec88fSEmmanuel Vadot the device tree and be referenced by a phandle and a set of phandle 199c66ec88fSEmmanuel Vadot arguments. A length of arguments should be specified by the 200c66ec88fSEmmanuel Vadot #trigger-source-cells property in the source node. 2015def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 202c66ec88fSEmmanuel Vadot 203c66ec88fSEmmanuel Vadot # Required properties for flash LED child nodes: 204c66ec88fSEmmanuel Vadot flash-max-microamp: 205c66ec88fSEmmanuel Vadot description: 206c66ec88fSEmmanuel Vadot Maximum flash LED supply current in microamperes. Required for flash LED 207c66ec88fSEmmanuel Vadot nodes with configurable current. 208c66ec88fSEmmanuel Vadot 209c66ec88fSEmmanuel Vadot flash-max-timeout-us: 210c66ec88fSEmmanuel Vadot description: 211c66ec88fSEmmanuel Vadot Maximum timeout in microseconds after which the flash LED is turned off. 212c66ec88fSEmmanuel Vadot Required for flash LED nodes with configurable timeout. 213c66ec88fSEmmanuel Vadot 2146be33864SEmmanuel VadotadditionalProperties: true 2156be33864SEmmanuel Vadot 216c66ec88fSEmmanuel Vadotexamples: 217c66ec88fSEmmanuel Vadot - | 218c66ec88fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 219c66ec88fSEmmanuel Vadot #include <dt-bindings/leds/common.h> 220c66ec88fSEmmanuel Vadot 221c66ec88fSEmmanuel Vadot led-controller { 222c66ec88fSEmmanuel Vadot compatible = "gpio-leds"; 223c66ec88fSEmmanuel Vadot 224c66ec88fSEmmanuel Vadot led-0 { 225c66ec88fSEmmanuel Vadot function = LED_FUNCTION_STATUS; 226c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 227c66ec88fSEmmanuel Vadot gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 228c66ec88fSEmmanuel Vadot }; 229c66ec88fSEmmanuel Vadot 230c66ec88fSEmmanuel Vadot led-1 { 231c66ec88fSEmmanuel Vadot function = LED_FUNCTION_USB; 232c66ec88fSEmmanuel Vadot gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 233c66ec88fSEmmanuel Vadot trigger-sources = <&ohci_port1>, <&ehci_port1>; 234c66ec88fSEmmanuel Vadot }; 235c66ec88fSEmmanuel Vadot }; 236c66ec88fSEmmanuel Vadot 237c9ccf3a3SEmmanuel Vadot - | 238c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 239c9ccf3a3SEmmanuel Vadot 240c9ccf3a3SEmmanuel Vadot led-controller { 241c66ec88fSEmmanuel Vadot compatible = "maxim,max77693-led"; 242c66ec88fSEmmanuel Vadot 243c66ec88fSEmmanuel Vadot led { 244c66ec88fSEmmanuel Vadot function = LED_FUNCTION_FLASH; 245c66ec88fSEmmanuel Vadot color = <LED_COLOR_ID_WHITE>; 246c66ec88fSEmmanuel Vadot led-sources = <0>, <1>; 247c66ec88fSEmmanuel Vadot led-max-microamp = <50000>; 248c66ec88fSEmmanuel Vadot flash-max-microamp = <320000>; 249c66ec88fSEmmanuel Vadot flash-max-timeout-us = <500000>; 250c66ec88fSEmmanuel Vadot }; 251c66ec88fSEmmanuel Vadot }; 252c66ec88fSEmmanuel Vadot 253c9ccf3a3SEmmanuel Vadot - | 254c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 255c9ccf3a3SEmmanuel Vadot 256c66ec88fSEmmanuel Vadot i2c { 257c66ec88fSEmmanuel Vadot #address-cells = <1>; 258c66ec88fSEmmanuel Vadot #size-cells = <0>; 259c66ec88fSEmmanuel Vadot 260c66ec88fSEmmanuel Vadot led-controller@30 { 261c66ec88fSEmmanuel Vadot compatible = "panasonic,an30259a"; 262c66ec88fSEmmanuel Vadot reg = <0x30>; 263c66ec88fSEmmanuel Vadot #address-cells = <1>; 264c66ec88fSEmmanuel Vadot #size-cells = <0>; 265c66ec88fSEmmanuel Vadot 266c66ec88fSEmmanuel Vadot led@1 { 267c66ec88fSEmmanuel Vadot reg = <1>; 268c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 269c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 270c66ec88fSEmmanuel Vadot function-enumerator = <1>; 271c66ec88fSEmmanuel Vadot }; 272c66ec88fSEmmanuel Vadot 273c66ec88fSEmmanuel Vadot led@2 { 274c66ec88fSEmmanuel Vadot reg = <2>; 275c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 276c66ec88fSEmmanuel Vadot function-enumerator = <2>; 277c66ec88fSEmmanuel Vadot }; 278c66ec88fSEmmanuel Vadot 279c66ec88fSEmmanuel Vadot led@3 { 280c66ec88fSEmmanuel Vadot reg = <3>; 281c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 282c66ec88fSEmmanuel Vadot function-enumerator = <3>; 283c66ec88fSEmmanuel Vadot }; 284c66ec88fSEmmanuel Vadot }; 285c66ec88fSEmmanuel Vadot }; 286c66ec88fSEmmanuel Vadot 287c66ec88fSEmmanuel Vadot... 288