1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only 2*4882a593Smuzhiyun%YAML 1.2 3*4882a593Smuzhiyun--- 4*4882a593Smuzhiyun$id: http://devicetree.org/schemas/leds/common.yaml# 5*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml# 6*4882a593Smuzhiyun 7*4882a593Smuzhiyuntitle: Common leds properties 8*4882a593Smuzhiyun 9*4882a593Smuzhiyunmaintainers: 10*4882a593Smuzhiyun - Jacek Anaszewski <jacek.anaszewski@gmail.com> 11*4882a593Smuzhiyun - Pavel Machek <pavel@ucw.cz> 12*4882a593Smuzhiyun 13*4882a593Smuzhiyundescription: 14*4882a593Smuzhiyun LED and flash LED devices provide the same basic functionality as current 15*4882a593Smuzhiyun regulators, but extended with LED and flash LED specific features like 16*4882a593Smuzhiyun blinking patterns, flash timeout, flash faults and external flash strobe mode. 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun Many LED devices expose more than one current output that can be connected 19*4882a593Smuzhiyun to one or more discrete LED component. Since the arrangement of connections 20*4882a593Smuzhiyun can influence the way of the LED device initialization, the LED components 21*4882a593Smuzhiyun have to be tightly coupled with the LED device binding. They are represented 22*4882a593Smuzhiyun by child nodes of the parent LED device binding. 23*4882a593Smuzhiyun 24*4882a593Smuzhiyunproperties: 25*4882a593Smuzhiyun led-sources: 26*4882a593Smuzhiyun description: 27*4882a593Smuzhiyun List of device current outputs the LED is connected to. The outputs are 28*4882a593Smuzhiyun identified by the numbers that must be defined in the LED device binding 29*4882a593Smuzhiyun documentation. 30*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/uint32-array 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun function: 33*4882a593Smuzhiyun description: 34*4882a593Smuzhiyun LED function. Use one of the LED_FUNCTION_* prefixed definitions 35*4882a593Smuzhiyun from the header include/dt-bindings/leds/common.h. If there is no 36*4882a593Smuzhiyun matching LED_FUNCTION available, add a new one. 37*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/string 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun color: 40*4882a593Smuzhiyun description: 41*4882a593Smuzhiyun Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from 42*4882a593Smuzhiyun the header include/dt-bindings/leds/common.h. If there is no matching 43*4882a593Smuzhiyun LED_COLOR_ID available, add a new one. 44*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/uint32 45*4882a593Smuzhiyun minimum: 0 46*4882a593Smuzhiyun maximum: 9 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun function-enumerator: 49*4882a593Smuzhiyun description: 50*4882a593Smuzhiyun Integer to be used when more than one instance of the same function is 51*4882a593Smuzhiyun needed, differing only with an ordinal number. 52*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/uint32 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun label: 55*4882a593Smuzhiyun description: 56*4882a593Smuzhiyun The label for this LED. If omitted, the label is taken from the node name 57*4882a593Smuzhiyun (excluding the unit address). It has to uniquely identify a device, i.e. 58*4882a593Smuzhiyun no other LED class device can be assigned the same label. This property is 59*4882a593Smuzhiyun deprecated - use 'function' and 'color' properties instead. 60*4882a593Smuzhiyun function-enumerator has no effect when this property is present. 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun default-state: 63*4882a593Smuzhiyun description: 64*4882a593Smuzhiyun The initial state of the LED. If the LED is already on or off and the 65*4882a593Smuzhiyun default-state property is set the to same value, then no glitch should be 66*4882a593Smuzhiyun produced where the LED momentarily turns off (or on). The "keep" setting 67*4882a593Smuzhiyun will keep the LED at whatever its current state is, without producing a 68*4882a593Smuzhiyun glitch. 69*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/string 70*4882a593Smuzhiyun enum: 71*4882a593Smuzhiyun - on 72*4882a593Smuzhiyun - off 73*4882a593Smuzhiyun - keep 74*4882a593Smuzhiyun default: off 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun linux,default-trigger: 77*4882a593Smuzhiyun description: 78*4882a593Smuzhiyun This parameter, if present, is a string defining the trigger assigned to 79*4882a593Smuzhiyun the LED. 80*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/string 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun enum: 83*4882a593Smuzhiyun # LED will act as a back-light, controlled by the framebuffer system 84*4882a593Smuzhiyun - backlight 85*4882a593Smuzhiyun # LED will turn on (but for leds-gpio see "default-state" property in 86*4882a593Smuzhiyun # Documentation/devicetree/bindings/leds/leds-gpio.yaml) 87*4882a593Smuzhiyun - default-on 88*4882a593Smuzhiyun # LED "double" flashes at a load average based rate 89*4882a593Smuzhiyun - heartbeat 90*4882a593Smuzhiyun # LED indicates disk activity 91*4882a593Smuzhiyun - disk-activity 92*4882a593Smuzhiyun # LED indicates IDE disk activity (deprecated), in new implementations 93*4882a593Smuzhiyun # use "disk-activity" 94*4882a593Smuzhiyun - ide-disk 95*4882a593Smuzhiyun # LED flashes at a fixed, configurable rate 96*4882a593Smuzhiyun - timer 97*4882a593Smuzhiyun # LED alters the brightness for the specified duration with one software 98*4882a593Smuzhiyun # timer (requires "led-pattern" property) 99*4882a593Smuzhiyun - pattern 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun led-pattern: 102*4882a593Smuzhiyun description: | 103*4882a593Smuzhiyun Array of integers with default pattern for certain triggers. 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun Each trigger may parse this property differently: 106*4882a593Smuzhiyun - one-shot : two numbers specifying delay on and delay off (in ms), 107*4882a593Smuzhiyun - timer : two numbers specifying delay on and delay off (in ms), 108*4882a593Smuzhiyun - pattern : the pattern is given by a series of tuples, of 109*4882a593Smuzhiyun brightness and duration (in ms). The exact format is 110*4882a593Smuzhiyun described in: 111*4882a593Smuzhiyun Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 112*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/uint32-matrix 113*4882a593Smuzhiyun items: 114*4882a593Smuzhiyun minItems: 2 115*4882a593Smuzhiyun maxItems: 2 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun led-max-microamp: 118*4882a593Smuzhiyun description: 119*4882a593Smuzhiyun Maximum LED supply current in microamperes. This property can be made 120*4882a593Smuzhiyun mandatory for the board configurations introducing a risk of hardware 121*4882a593Smuzhiyun damage in case an excessive current is set. 122*4882a593Smuzhiyun For flash LED controllers with configurable current this property is 123*4882a593Smuzhiyun mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun panic-indicator: 126*4882a593Smuzhiyun description: 127*4882a593Smuzhiyun This property specifies that the LED should be used, if at all possible, 128*4882a593Smuzhiyun as a panic indicator. 129*4882a593Smuzhiyun type: boolean 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun trigger-sources: 132*4882a593Smuzhiyun description: | 133*4882a593Smuzhiyun List of devices which should be used as a source triggering this LED 134*4882a593Smuzhiyun activity. Some LEDs can be related to a specific device and should somehow 135*4882a593Smuzhiyun indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 136*4882a593Smuzhiyun port(s). 137*4882a593Smuzhiyun Another common example is switch or router with multiple Ethernet ports 138*4882a593Smuzhiyun each of them having its own LED assigned (assuming they are not 139*4882a593Smuzhiyun hardwired). In such cases this property should contain phandle(s) of 140*4882a593Smuzhiyun related source device(s). 141*4882a593Smuzhiyun In many cases LED can be related to more than one device (e.g. one USB LED 142*4882a593Smuzhiyun vs. multiple USB ports). Each source should be represented by a node in 143*4882a593Smuzhiyun the device tree and be referenced by a phandle and a set of phandle 144*4882a593Smuzhiyun arguments. A length of arguments should be specified by the 145*4882a593Smuzhiyun #trigger-source-cells property in the source node. 146*4882a593Smuzhiyun $ref: /schemas/types.yaml#definitions/phandle-array 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun # Required properties for flash LED child nodes: 149*4882a593Smuzhiyun flash-max-microamp: 150*4882a593Smuzhiyun description: 151*4882a593Smuzhiyun Maximum flash LED supply current in microamperes. Required for flash LED 152*4882a593Smuzhiyun nodes with configurable current. 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun flash-max-timeout-us: 155*4882a593Smuzhiyun description: 156*4882a593Smuzhiyun Maximum timeout in microseconds after which the flash LED is turned off. 157*4882a593Smuzhiyun Required for flash LED nodes with configurable timeout. 158*4882a593Smuzhiyun 159*4882a593SmuzhiyunadditionalProperties: true 160*4882a593Smuzhiyun 161*4882a593Smuzhiyunexamples: 162*4882a593Smuzhiyun - | 163*4882a593Smuzhiyun #include <dt-bindings/gpio/gpio.h> 164*4882a593Smuzhiyun #include <dt-bindings/leds/common.h> 165*4882a593Smuzhiyun 166*4882a593Smuzhiyun led-controller { 167*4882a593Smuzhiyun compatible = "gpio-leds"; 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun led-0 { 170*4882a593Smuzhiyun function = LED_FUNCTION_STATUS; 171*4882a593Smuzhiyun linux,default-trigger = "heartbeat"; 172*4882a593Smuzhiyun gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 173*4882a593Smuzhiyun }; 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun led-1 { 176*4882a593Smuzhiyun function = LED_FUNCTION_USB; 177*4882a593Smuzhiyun gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 178*4882a593Smuzhiyun trigger-sources = <&ohci_port1>, <&ehci_port1>; 179*4882a593Smuzhiyun }; 180*4882a593Smuzhiyun }; 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun led-controller@0 { 183*4882a593Smuzhiyun compatible = "maxim,max77693-led"; 184*4882a593Smuzhiyun reg = <0 0x100>; 185*4882a593Smuzhiyun 186*4882a593Smuzhiyun led { 187*4882a593Smuzhiyun function = LED_FUNCTION_FLASH; 188*4882a593Smuzhiyun color = <LED_COLOR_ID_WHITE>; 189*4882a593Smuzhiyun led-sources = <0>, <1>; 190*4882a593Smuzhiyun led-max-microamp = <50000>; 191*4882a593Smuzhiyun flash-max-microamp = <320000>; 192*4882a593Smuzhiyun flash-max-timeout-us = <500000>; 193*4882a593Smuzhiyun }; 194*4882a593Smuzhiyun }; 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun i2c { 197*4882a593Smuzhiyun #address-cells = <1>; 198*4882a593Smuzhiyun #size-cells = <0>; 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun led-controller@30 { 201*4882a593Smuzhiyun compatible = "panasonic,an30259a"; 202*4882a593Smuzhiyun reg = <0x30>; 203*4882a593Smuzhiyun #address-cells = <1>; 204*4882a593Smuzhiyun #size-cells = <0>; 205*4882a593Smuzhiyun 206*4882a593Smuzhiyun led@1 { 207*4882a593Smuzhiyun reg = <1>; 208*4882a593Smuzhiyun linux,default-trigger = "heartbeat"; 209*4882a593Smuzhiyun function = LED_FUNCTION_INDICATOR; 210*4882a593Smuzhiyun function-enumerator = <1>; 211*4882a593Smuzhiyun }; 212*4882a593Smuzhiyun 213*4882a593Smuzhiyun led@2 { 214*4882a593Smuzhiyun reg = <2>; 215*4882a593Smuzhiyun function = LED_FUNCTION_INDICATOR; 216*4882a593Smuzhiyun function-enumerator = <2>; 217*4882a593Smuzhiyun }; 218*4882a593Smuzhiyun 219*4882a593Smuzhiyun led@3 { 220*4882a593Smuzhiyun reg = <3>; 221*4882a593Smuzhiyun function = LED_FUNCTION_INDICATOR; 222*4882a593Smuzhiyun function-enumerator = <3>; 223*4882a593Smuzhiyun }; 224*4882a593Smuzhiyun }; 225*4882a593Smuzhiyun }; 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun... 228