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 93c66ec88fSEmmanuel Vadot # LED indicates IDE disk activity (deprecated), in new implementations 94c66ec88fSEmmanuel Vadot # use "disk-activity" 95c66ec88fSEmmanuel Vadot - ide-disk 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 1017ef62cebSEmmanuel Vadot # LED is triggered by SD/MMC activity 1027ef62cebSEmmanuel Vadot - pattern: "^mmc[0-9]+$" 103*8bab661aSEmmanuel Vadot - pattern: "^cpu[0-9]*$" 104c66ec88fSEmmanuel Vadot 105c66ec88fSEmmanuel Vadot led-pattern: 106c66ec88fSEmmanuel Vadot description: | 107c66ec88fSEmmanuel Vadot Array of integers with default pattern for certain triggers. 108c66ec88fSEmmanuel Vadot 109c66ec88fSEmmanuel Vadot Each trigger may parse this property differently: 110c66ec88fSEmmanuel Vadot - one-shot : two numbers specifying delay on and delay off (in ms), 111c66ec88fSEmmanuel Vadot - timer : two numbers specifying delay on and delay off (in ms), 112c66ec88fSEmmanuel Vadot - pattern : the pattern is given by a series of tuples, of 113c66ec88fSEmmanuel Vadot brightness and duration (in ms). The exact format is 114c66ec88fSEmmanuel Vadot described in: 115c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 1165def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-matrix 117c66ec88fSEmmanuel Vadot items: 118c66ec88fSEmmanuel Vadot minItems: 2 119c66ec88fSEmmanuel Vadot maxItems: 2 120c66ec88fSEmmanuel Vadot 121c66ec88fSEmmanuel Vadot led-max-microamp: 122c66ec88fSEmmanuel Vadot description: 123c66ec88fSEmmanuel Vadot Maximum LED supply current in microamperes. This property can be made 124c66ec88fSEmmanuel Vadot mandatory for the board configurations introducing a risk of hardware 125c66ec88fSEmmanuel Vadot damage in case an excessive current is set. 126c66ec88fSEmmanuel Vadot For flash LED controllers with configurable current this property is 127c66ec88fSEmmanuel Vadot mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 128c66ec88fSEmmanuel Vadot 129c66ec88fSEmmanuel Vadot panic-indicator: 130c66ec88fSEmmanuel Vadot description: 131c66ec88fSEmmanuel Vadot This property specifies that the LED should be used, if at all possible, 132c66ec88fSEmmanuel Vadot as a panic indicator. 133c66ec88fSEmmanuel Vadot type: boolean 134c66ec88fSEmmanuel Vadot 135354d7675SEmmanuel Vadot retain-state-shutdown: 136354d7675SEmmanuel Vadot description: 137354d7675SEmmanuel Vadot This property specifies that the LED should not be turned off or changed 138354d7675SEmmanuel Vadot when the system shuts down. 139354d7675SEmmanuel Vadot type: boolean 140354d7675SEmmanuel Vadot 141c66ec88fSEmmanuel Vadot trigger-sources: 142c66ec88fSEmmanuel Vadot description: | 143c66ec88fSEmmanuel Vadot List of devices which should be used as a source triggering this LED 144c66ec88fSEmmanuel Vadot activity. Some LEDs can be related to a specific device and should somehow 145c66ec88fSEmmanuel Vadot indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 146c66ec88fSEmmanuel Vadot port(s). 147c66ec88fSEmmanuel Vadot Another common example is switch or router with multiple Ethernet ports 148c66ec88fSEmmanuel Vadot each of them having its own LED assigned (assuming they are not 149c66ec88fSEmmanuel Vadot hardwired). In such cases this property should contain phandle(s) of 150c66ec88fSEmmanuel Vadot related source device(s). 151c66ec88fSEmmanuel Vadot In many cases LED can be related to more than one device (e.g. one USB LED 152c66ec88fSEmmanuel Vadot vs. multiple USB ports). Each source should be represented by a node in 153c66ec88fSEmmanuel Vadot the device tree and be referenced by a phandle and a set of phandle 154c66ec88fSEmmanuel Vadot arguments. A length of arguments should be specified by the 155c66ec88fSEmmanuel Vadot #trigger-source-cells property in the source node. 1565def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 157c66ec88fSEmmanuel Vadot 158c66ec88fSEmmanuel Vadot # Required properties for flash LED child nodes: 159c66ec88fSEmmanuel Vadot flash-max-microamp: 160c66ec88fSEmmanuel Vadot description: 161c66ec88fSEmmanuel Vadot Maximum flash LED supply current in microamperes. Required for flash LED 162c66ec88fSEmmanuel Vadot nodes with configurable current. 163c66ec88fSEmmanuel Vadot 164c66ec88fSEmmanuel Vadot flash-max-timeout-us: 165c66ec88fSEmmanuel Vadot description: 166c66ec88fSEmmanuel Vadot Maximum timeout in microseconds after which the flash LED is turned off. 167c66ec88fSEmmanuel Vadot Required for flash LED nodes with configurable timeout. 168c66ec88fSEmmanuel Vadot 1696be33864SEmmanuel VadotadditionalProperties: true 1706be33864SEmmanuel Vadot 171c66ec88fSEmmanuel Vadotexamples: 172c66ec88fSEmmanuel Vadot - | 173c66ec88fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 174c66ec88fSEmmanuel Vadot #include <dt-bindings/leds/common.h> 175c66ec88fSEmmanuel Vadot 176c66ec88fSEmmanuel Vadot led-controller { 177c66ec88fSEmmanuel Vadot compatible = "gpio-leds"; 178c66ec88fSEmmanuel Vadot 179c66ec88fSEmmanuel Vadot led-0 { 180c66ec88fSEmmanuel Vadot function = LED_FUNCTION_STATUS; 181c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 182c66ec88fSEmmanuel Vadot gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 183c66ec88fSEmmanuel Vadot }; 184c66ec88fSEmmanuel Vadot 185c66ec88fSEmmanuel Vadot led-1 { 186c66ec88fSEmmanuel Vadot function = LED_FUNCTION_USB; 187c66ec88fSEmmanuel Vadot gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 188c66ec88fSEmmanuel Vadot trigger-sources = <&ohci_port1>, <&ehci_port1>; 189c66ec88fSEmmanuel Vadot }; 190c66ec88fSEmmanuel Vadot }; 191c66ec88fSEmmanuel Vadot 192c9ccf3a3SEmmanuel Vadot - | 193c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 194c9ccf3a3SEmmanuel Vadot 195c9ccf3a3SEmmanuel Vadot led-controller { 196c66ec88fSEmmanuel Vadot compatible = "maxim,max77693-led"; 197c66ec88fSEmmanuel Vadot 198c66ec88fSEmmanuel Vadot led { 199c66ec88fSEmmanuel Vadot function = LED_FUNCTION_FLASH; 200c66ec88fSEmmanuel Vadot color = <LED_COLOR_ID_WHITE>; 201c66ec88fSEmmanuel Vadot led-sources = <0>, <1>; 202c66ec88fSEmmanuel Vadot led-max-microamp = <50000>; 203c66ec88fSEmmanuel Vadot flash-max-microamp = <320000>; 204c66ec88fSEmmanuel Vadot flash-max-timeout-us = <500000>; 205c66ec88fSEmmanuel Vadot }; 206c66ec88fSEmmanuel Vadot }; 207c66ec88fSEmmanuel Vadot 208c9ccf3a3SEmmanuel Vadot - | 209c9ccf3a3SEmmanuel Vadot #include <dt-bindings/leds/common.h> 210c9ccf3a3SEmmanuel Vadot 211c66ec88fSEmmanuel Vadot i2c { 212c66ec88fSEmmanuel Vadot #address-cells = <1>; 213c66ec88fSEmmanuel Vadot #size-cells = <0>; 214c66ec88fSEmmanuel Vadot 215c66ec88fSEmmanuel Vadot led-controller@30 { 216c66ec88fSEmmanuel Vadot compatible = "panasonic,an30259a"; 217c66ec88fSEmmanuel Vadot reg = <0x30>; 218c66ec88fSEmmanuel Vadot #address-cells = <1>; 219c66ec88fSEmmanuel Vadot #size-cells = <0>; 220c66ec88fSEmmanuel Vadot 221c66ec88fSEmmanuel Vadot led@1 { 222c66ec88fSEmmanuel Vadot reg = <1>; 223c66ec88fSEmmanuel Vadot linux,default-trigger = "heartbeat"; 224c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 225c66ec88fSEmmanuel Vadot function-enumerator = <1>; 226c66ec88fSEmmanuel Vadot }; 227c66ec88fSEmmanuel Vadot 228c66ec88fSEmmanuel Vadot led@2 { 229c66ec88fSEmmanuel Vadot reg = <2>; 230c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 231c66ec88fSEmmanuel Vadot function-enumerator = <2>; 232c66ec88fSEmmanuel Vadot }; 233c66ec88fSEmmanuel Vadot 234c66ec88fSEmmanuel Vadot led@3 { 235c66ec88fSEmmanuel Vadot reg = <3>; 236c66ec88fSEmmanuel Vadot function = LED_FUNCTION_INDICATOR; 237c66ec88fSEmmanuel Vadot function-enumerator = <3>; 238c66ec88fSEmmanuel Vadot }; 239c66ec88fSEmmanuel Vadot }; 240c66ec88fSEmmanuel Vadot }; 241c66ec88fSEmmanuel Vadot 242c66ec88fSEmmanuel Vadot... 243