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 466be33864SEmmanuel Vadot maximum: 9 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 86c66ec88fSEmmanuel Vadot # LED will turn on (but for leds-gpio see "default-state" property in 87c66ec88fSEmmanuel Vadot # Documentation/devicetree/bindings/leds/leds-gpio.yaml) 88c66ec88fSEmmanuel Vadot - default-on 89c66ec88fSEmmanuel Vadot # LED "double" flashes at a load average based rate 90c66ec88fSEmmanuel Vadot - heartbeat 91c66ec88fSEmmanuel Vadot # LED indicates disk activity 92c66ec88fSEmmanuel Vadot - disk-activity 93*fac71e4eSEmmanuel Vadot # LED indicates disk read activity 94cb7aa33aSEmmanuel Vadot - disk-read 95*fac71e4eSEmmanuel Vadot # LED indicates disk write activity 96cb7aa33aSEmmanuel Vadot - disk-write 97c66ec88fSEmmanuel Vadot # LED flashes at a fixed, configurable rate 98c66ec88fSEmmanuel Vadot - timer 99c66ec88fSEmmanuel Vadot # LED alters the brightness for the specified duration with one software 100c66ec88fSEmmanuel Vadot # timer (requires "led-pattern" property) 101c66ec88fSEmmanuel Vadot - pattern 102*fac71e4eSEmmanuel Vadot # LED indicates mic mute state 103*fac71e4eSEmmanuel Vadot - audio-micmute 104*fac71e4eSEmmanuel Vadot # LED indicates audio mute state 105*fac71e4eSEmmanuel Vadot - audio-mute 106*fac71e4eSEmmanuel Vadot # LED indicates bluetooth power state 107*fac71e4eSEmmanuel Vadot - bluetooth-power 108*fac71e4eSEmmanuel Vadot # LED indicates activity of all CPUs 109*fac71e4eSEmmanuel Vadot - cpu 110*fac71e4eSEmmanuel Vadot # LED indicates camera flash state 111*fac71e4eSEmmanuel Vadot - flash 112*fac71e4eSEmmanuel Vadot # LED indicated keyboard capslock 113*fac71e4eSEmmanuel Vadot - kbd-capslock 114*fac71e4eSEmmanuel Vadot # LED indicates MTD memory activity 115*fac71e4eSEmmanuel Vadot - mtd 116*fac71e4eSEmmanuel Vadot # LED indicates NAND memory activity (deprecated), 117*fac71e4eSEmmanuel Vadot # in new implementations use "mtd" 118*fac71e4eSEmmanuel Vadot - nand-disk 119*fac71e4eSEmmanuel Vadot # No trigger assigned to the LED. This is the default mode 120*fac71e4eSEmmanuel Vadot # if trigger is absent 121*fac71e4eSEmmanuel Vadot - none 122*fac71e4eSEmmanuel Vadot # LED indicates camera torch state 123*fac71e4eSEmmanuel Vadot - torch 124*fac71e4eSEmmanuel Vadot # LED indicates USB gadget activity 125cb7aa33aSEmmanuel Vadot - usb-gadget 126*fac71e4eSEmmanuel Vadot # LED indicates USB host activity 127cb7aa33aSEmmanuel Vadot - usb-host 128*fac71e4eSEmmanuel Vadot # LED indicates USB port state 129*fac71e4eSEmmanuel Vadot - usbport 130*fac71e4eSEmmanuel Vadot # LED is triggered by CPU activity 1318bab661aSEmmanuel Vadot - pattern: "^cpu[0-9]*$" 132cb7aa33aSEmmanuel Vadot # LED is triggered by Bluetooth activity 133*fac71e4eSEmmanuel Vadot - pattern: "^hci[0-9]+-power$" 134cb7aa33aSEmmanuel Vadot # LED is triggered by SD/MMC activity 135*fac71e4eSEmmanuel Vadot - pattern: "^mmc[0-9]+$" 136cb7aa33aSEmmanuel Vadot # LED is triggered by WLAN activity 137*fac71e4eSEmmanuel Vadot - pattern: "^phy[0-9]+tx$" 138c66ec88fSEmmanuel Vadot 139c66ec88fSEmmanuel Vadot led-pattern: 140c66ec88fSEmmanuel Vadot description: | 141c66ec88fSEmmanuel Vadot Array of integers with default pattern for certain triggers. 142c66ec88fSEmmanuel Vadot 143c66ec88fSEmmanuel Vadot Each trigger may parse this property differently: 144c66ec88fSEmmanuel Vadot - one-shot : two numbers specifying delay on and delay off (in ms), 145c66ec88fSEmmanuel Vadot - timer : two numbers specifying delay on and delay off (in ms), 146c66ec88fSEmmanuel Vadot - pattern : the pattern is given by a series of tuples, of 147c66ec88fSEmmanuel Vadot brightness and duration (in ms). The exact format is 148c66ec88fSEmmanuel Vadot described in: 149c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 1505def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-matrix 151c66ec88fSEmmanuel Vadot items: 152c66ec88fSEmmanuel Vadot minItems: 2 153c66ec88fSEmmanuel Vadot maxItems: 2 154c66ec88fSEmmanuel Vadot 155c66ec88fSEmmanuel Vadot led-max-microamp: 156c66ec88fSEmmanuel Vadot description: 157c66ec88fSEmmanuel Vadot Maximum LED supply current in microamperes. This property can be made 158c66ec88fSEmmanuel Vadot mandatory for the board configurations introducing a risk of hardware 159c66ec88fSEmmanuel Vadot damage in case an excessive current is set. 160c66ec88fSEmmanuel Vadot For flash LED controllers with configurable current this property is 161c66ec88fSEmmanuel Vadot mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 162c66ec88fSEmmanuel Vadot 163c66ec88fSEmmanuel Vadot panic-indicator: 164c66ec88fSEmmanuel Vadot description: 165c66ec88fSEmmanuel Vadot This property specifies that the LED should be used, if at all possible, 166c66ec88fSEmmanuel Vadot as a panic indicator. 167c66ec88fSEmmanuel Vadot type: boolean 168c66ec88fSEmmanuel Vadot 169354d7675SEmmanuel Vadot retain-state-shutdown: 170354d7675SEmmanuel Vadot description: 171354d7675SEmmanuel Vadot This property specifies that the LED should not be turned off or changed 172354d7675SEmmanuel Vadot when the system shuts down. 173354d7675SEmmanuel Vadot type: boolean 174354d7675SEmmanuel Vadot 175c66ec88fSEmmanuel Vadot trigger-sources: 176c66ec88fSEmmanuel Vadot description: | 177c66ec88fSEmmanuel Vadot List of devices which should be used as a source triggering this LED 178c66ec88fSEmmanuel Vadot activity. Some LEDs can be related to a specific device and should somehow 179c66ec88fSEmmanuel Vadot indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 180c66ec88fSEmmanuel Vadot port(s). 181c66ec88fSEmmanuel Vadot Another common example is switch or router with multiple Ethernet ports 182c66ec88fSEmmanuel Vadot each of them having its own LED assigned (assuming they are not 183c66ec88fSEmmanuel Vadot hardwired). In such cases this property should contain phandle(s) of 184c66ec88fSEmmanuel Vadot related source device(s). 185c66ec88fSEmmanuel Vadot In many cases LED can be related to more than one device (e.g. one USB LED 186c66ec88fSEmmanuel Vadot vs. multiple USB ports). Each source should be represented by a node in 187c66ec88fSEmmanuel Vadot the device tree and be referenced by a phandle and a set of phandle 188c66ec88fSEmmanuel Vadot arguments. A length of arguments should be specified by the 189c66ec88fSEmmanuel Vadot #trigger-source-cells property in the source node. 1905def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 191c66ec88fSEmmanuel Vadot 192c66ec88fSEmmanuel Vadot # Required properties for flash LED child nodes: 193c66ec88fSEmmanuel Vadot flash-max-microamp: 194c66ec88fSEmmanuel Vadot description: 195c66ec88fSEmmanuel Vadot Maximum flash LED supply current in microamperes. Required for flash LED 196c66ec88fSEmmanuel Vadot nodes with configurable current. 197c66ec88fSEmmanuel Vadot 198c66ec88fSEmmanuel Vadot flash-max-timeout-us: 199c66ec88fSEmmanuel Vadot description: 200c66ec88fSEmmanuel Vadot Maximum timeout in microseconds after which the flash LED is turned off. 201c66ec88fSEmmanuel Vadot Required for flash LED nodes with configurable timeout. 202c66ec88fSEmmanuel Vadot 2036be33864SEmmanuel VadotadditionalProperties: true 2046be33864SEmmanuel Vadot 205c66ec88fSEmmanuel Vadotexamples: 206c66ec88fSEmmanuel Vadot - | 207c66ec88fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 208c66ec88fSEmmanuel Vadot #include <dt-bindings/leds/common.h> 209c66ec88fSEmmanuel Vadot 210c66ec88fSEmmanuel Vadot led-controller { 211c66ec88fSEmmanuel Vadot compatible = "gpio-leds"; 212c66ec88fSEmmanuel Vadot 213c66ec88fSEmmanuel Vadot led-0 { 214c66ec88fSEmmanuel Vadot function = LED_FUNCTION_STATUS; 215c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 216c66ec88fSEmmanuel Vadot gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 217c66ec88fSEmmanuel Vadot }; 218c66ec88fSEmmanuel Vadot 219c66ec88fSEmmanuel Vadot led-1 { 220c66ec88fSEmmanuel Vadot function = LED_FUNCTION_USB; 221c66ec88fSEmmanuel Vadot gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 222c66ec88fSEmmanuel Vadot trigger-sources = <&ohci_port1>, <&ehci_port1>; 223c66ec88fSEmmanuel Vadot }; 224c66ec88fSEmmanuel Vadot }; 225c66ec88fSEmmanuel Vadot 226c9ccf3a3SEmmanuel Vadot - | 227c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 228c9ccf3a3SEmmanuel Vadot 229c9ccf3a3SEmmanuel Vadot led-controller { 230c66ec88fSEmmanuel Vadot compatible = "maxim,max77693-led"; 231c66ec88fSEmmanuel Vadot 232c66ec88fSEmmanuel Vadot led { 233c66ec88fSEmmanuel Vadot function = LED_FUNCTION_FLASH; 234c66ec88fSEmmanuel Vadot color = <LED_COLOR_ID_WHITE>; 235c66ec88fSEmmanuel Vadot led-sources = <0>, <1>; 236c66ec88fSEmmanuel Vadot led-max-microamp = <50000>; 237c66ec88fSEmmanuel Vadot flash-max-microamp = <320000>; 238c66ec88fSEmmanuel Vadot flash-max-timeout-us = <500000>; 239c66ec88fSEmmanuel Vadot }; 240c66ec88fSEmmanuel Vadot }; 241c66ec88fSEmmanuel Vadot 242c9ccf3a3SEmmanuel Vadot - | 243c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 244c9ccf3a3SEmmanuel Vadot 245c66ec88fSEmmanuel Vadot i2c { 246c66ec88fSEmmanuel Vadot #address-cells = <1>; 247c66ec88fSEmmanuel Vadot #size-cells = <0>; 248c66ec88fSEmmanuel Vadot 249c66ec88fSEmmanuel Vadot led-controller@30 { 250c66ec88fSEmmanuel Vadot compatible = "panasonic,an30259a"; 251c66ec88fSEmmanuel Vadot reg = <0x30>; 252c66ec88fSEmmanuel Vadot #address-cells = <1>; 253c66ec88fSEmmanuel Vadot #size-cells = <0>; 254c66ec88fSEmmanuel Vadot 255c66ec88fSEmmanuel Vadot led@1 { 256c66ec88fSEmmanuel Vadot reg = <1>; 257c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 258c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 259c66ec88fSEmmanuel Vadot function-enumerator = <1>; 260c66ec88fSEmmanuel Vadot }; 261c66ec88fSEmmanuel Vadot 262c66ec88fSEmmanuel Vadot led@2 { 263c66ec88fSEmmanuel Vadot reg = <2>; 264c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 265c66ec88fSEmmanuel Vadot function-enumerator = <2>; 266c66ec88fSEmmanuel Vadot }; 267c66ec88fSEmmanuel Vadot 268c66ec88fSEmmanuel Vadot led@3 { 269c66ec88fSEmmanuel Vadot reg = <3>; 270c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 271c66ec88fSEmmanuel Vadot function-enumerator = <3>; 272c66ec88fSEmmanuel Vadot }; 273c66ec88fSEmmanuel Vadot }; 274c66ec88fSEmmanuel Vadot }; 275c66ec88fSEmmanuel Vadot 276c66ec88fSEmmanuel Vadot... 277