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. 30*5def4c47SEmmanuel 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. 37*5def4c47SEmmanuel 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. 44*5def4c47SEmmanuel 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. 52*5def4c47SEmmanuel 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. 69*5def4c47SEmmanuel 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. 80*5def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 81c66ec88fSEmmanuel Vadot 82c66ec88fSEmmanuel Vadot enum: 83c66ec88fSEmmanuel Vadot # LED will act as a back-light, controlled by the framebuffer system 84c66ec88fSEmmanuel Vadot - backlight 85c66ec88fSEmmanuel Vadot # LED will turn on (but for leds-gpio see "default-state" property in 86c66ec88fSEmmanuel Vadot # Documentation/devicetree/bindings/leds/leds-gpio.yaml) 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 92c66ec88fSEmmanuel Vadot # LED indicates IDE disk activity (deprecated), in new implementations 93c66ec88fSEmmanuel Vadot # use "disk-activity" 94c66ec88fSEmmanuel Vadot - ide-disk 95c66ec88fSEmmanuel Vadot # LED flashes at a fixed, configurable rate 96c66ec88fSEmmanuel Vadot - timer 97c66ec88fSEmmanuel Vadot # LED alters the brightness for the specified duration with one software 98c66ec88fSEmmanuel Vadot # timer (requires "led-pattern" property) 99c66ec88fSEmmanuel Vadot - pattern 100c66ec88fSEmmanuel Vadot 101c66ec88fSEmmanuel Vadot led-pattern: 102c66ec88fSEmmanuel Vadot description: | 103c66ec88fSEmmanuel Vadot Array of integers with default pattern for certain triggers. 104c66ec88fSEmmanuel Vadot 105c66ec88fSEmmanuel Vadot Each trigger may parse this property differently: 106c66ec88fSEmmanuel Vadot - one-shot : two numbers specifying delay on and delay off (in ms), 107c66ec88fSEmmanuel Vadot - timer : two numbers specifying delay on and delay off (in ms), 108c66ec88fSEmmanuel Vadot - pattern : the pattern is given by a series of tuples, of 109c66ec88fSEmmanuel Vadot brightness and duration (in ms). The exact format is 110c66ec88fSEmmanuel Vadot described in: 111c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 112*5def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-matrix 113c66ec88fSEmmanuel Vadot items: 114c66ec88fSEmmanuel Vadot minItems: 2 115c66ec88fSEmmanuel Vadot maxItems: 2 116c66ec88fSEmmanuel Vadot 117c66ec88fSEmmanuel Vadot led-max-microamp: 118c66ec88fSEmmanuel Vadot description: 119c66ec88fSEmmanuel Vadot Maximum LED supply current in microamperes. This property can be made 120c66ec88fSEmmanuel Vadot mandatory for the board configurations introducing a risk of hardware 121c66ec88fSEmmanuel Vadot damage in case an excessive current is set. 122c66ec88fSEmmanuel Vadot For flash LED controllers with configurable current this property is 123c66ec88fSEmmanuel Vadot mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 124c66ec88fSEmmanuel Vadot 125c66ec88fSEmmanuel Vadot panic-indicator: 126c66ec88fSEmmanuel Vadot description: 127c66ec88fSEmmanuel Vadot This property specifies that the LED should be used, if at all possible, 128c66ec88fSEmmanuel Vadot as a panic indicator. 129c66ec88fSEmmanuel Vadot type: boolean 130c66ec88fSEmmanuel Vadot 131c66ec88fSEmmanuel Vadot trigger-sources: 132c66ec88fSEmmanuel Vadot description: | 133c66ec88fSEmmanuel Vadot List of devices which should be used as a source triggering this LED 134c66ec88fSEmmanuel Vadot activity. Some LEDs can be related to a specific device and should somehow 135c66ec88fSEmmanuel Vadot indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 136c66ec88fSEmmanuel Vadot port(s). 137c66ec88fSEmmanuel Vadot Another common example is switch or router with multiple Ethernet ports 138c66ec88fSEmmanuel Vadot each of them having its own LED assigned (assuming they are not 139c66ec88fSEmmanuel Vadot hardwired). In such cases this property should contain phandle(s) of 140c66ec88fSEmmanuel Vadot related source device(s). 141c66ec88fSEmmanuel Vadot In many cases LED can be related to more than one device (e.g. one USB LED 142c66ec88fSEmmanuel Vadot vs. multiple USB ports). Each source should be represented by a node in 143c66ec88fSEmmanuel Vadot the device tree and be referenced by a phandle and a set of phandle 144c66ec88fSEmmanuel Vadot arguments. A length of arguments should be specified by the 145c66ec88fSEmmanuel Vadot #trigger-source-cells property in the source node. 146*5def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 147c66ec88fSEmmanuel Vadot 148c66ec88fSEmmanuel Vadot # Required properties for flash LED child nodes: 149c66ec88fSEmmanuel Vadot flash-max-microamp: 150c66ec88fSEmmanuel Vadot description: 151c66ec88fSEmmanuel Vadot Maximum flash LED supply current in microamperes. Required for flash LED 152c66ec88fSEmmanuel Vadot nodes with configurable current. 153c66ec88fSEmmanuel Vadot 154c66ec88fSEmmanuel Vadot flash-max-timeout-us: 155c66ec88fSEmmanuel Vadot description: 156c66ec88fSEmmanuel Vadot Maximum timeout in microseconds after which the flash LED is turned off. 157c66ec88fSEmmanuel Vadot Required for flash LED nodes with configurable timeout. 158c66ec88fSEmmanuel Vadot 1596be33864SEmmanuel VadotadditionalProperties: true 1606be33864SEmmanuel Vadot 161c66ec88fSEmmanuel Vadotexamples: 162c66ec88fSEmmanuel Vadot - | 163c66ec88fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 164c66ec88fSEmmanuel Vadot #include <dt-bindings/leds/common.h> 165c66ec88fSEmmanuel Vadot 166c66ec88fSEmmanuel Vadot led-controller { 167c66ec88fSEmmanuel Vadot compatible = "gpio-leds"; 168c66ec88fSEmmanuel Vadot 169c66ec88fSEmmanuel Vadot led-0 { 170c66ec88fSEmmanuel Vadot function = LED_FUNCTION_STATUS; 171c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 172c66ec88fSEmmanuel Vadot gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 173c66ec88fSEmmanuel Vadot }; 174c66ec88fSEmmanuel Vadot 175c66ec88fSEmmanuel Vadot led-1 { 176c66ec88fSEmmanuel Vadot function = LED_FUNCTION_USB; 177c66ec88fSEmmanuel Vadot gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 178c66ec88fSEmmanuel Vadot trigger-sources = <&ohci_port1>, <&ehci_port1>; 179c66ec88fSEmmanuel Vadot }; 180c66ec88fSEmmanuel Vadot }; 181c66ec88fSEmmanuel Vadot 182c66ec88fSEmmanuel Vadot led-controller@0 { 183c66ec88fSEmmanuel Vadot compatible = "maxim,max77693-led"; 184c66ec88fSEmmanuel Vadot reg = <0 0x100>; 185c66ec88fSEmmanuel Vadot 186c66ec88fSEmmanuel Vadot led { 187c66ec88fSEmmanuel Vadot function = LED_FUNCTION_FLASH; 188c66ec88fSEmmanuel Vadot color = <LED_COLOR_ID_WHITE>; 189c66ec88fSEmmanuel Vadot led-sources = <0>, <1>; 190c66ec88fSEmmanuel Vadot led-max-microamp = <50000>; 191c66ec88fSEmmanuel Vadot flash-max-microamp = <320000>; 192c66ec88fSEmmanuel Vadot flash-max-timeout-us = <500000>; 193c66ec88fSEmmanuel Vadot }; 194c66ec88fSEmmanuel Vadot }; 195c66ec88fSEmmanuel Vadot 196c66ec88fSEmmanuel Vadot i2c { 197c66ec88fSEmmanuel Vadot #address-cells = <1>; 198c66ec88fSEmmanuel Vadot #size-cells = <0>; 199c66ec88fSEmmanuel Vadot 200c66ec88fSEmmanuel Vadot led-controller@30 { 201c66ec88fSEmmanuel Vadot compatible = "panasonic,an30259a"; 202c66ec88fSEmmanuel Vadot reg = <0x30>; 203c66ec88fSEmmanuel Vadot #address-cells = <1>; 204c66ec88fSEmmanuel Vadot #size-cells = <0>; 205c66ec88fSEmmanuel Vadot 206c66ec88fSEmmanuel Vadot led@1 { 207c66ec88fSEmmanuel Vadot reg = <1>; 208c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 209c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 210c66ec88fSEmmanuel Vadot function-enumerator = <1>; 211c66ec88fSEmmanuel Vadot }; 212c66ec88fSEmmanuel Vadot 213c66ec88fSEmmanuel Vadot led@2 { 214c66ec88fSEmmanuel Vadot reg = <2>; 215c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 216c66ec88fSEmmanuel Vadot function-enumerator = <2>; 217c66ec88fSEmmanuel Vadot }; 218c66ec88fSEmmanuel Vadot 219c66ec88fSEmmanuel Vadot led@3 { 220c66ec88fSEmmanuel Vadot reg = <3>; 221c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 222c66ec88fSEmmanuel Vadot function-enumerator = <3>; 223c66ec88fSEmmanuel Vadot }; 224c66ec88fSEmmanuel Vadot }; 225c66ec88fSEmmanuel Vadot }; 226c66ec88fSEmmanuel Vadot 227c66ec88fSEmmanuel Vadot... 228