162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci%YAML 1.2 362306a36Sopenharmony_ci--- 462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/leds/common.yaml# 562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 662306a36Sopenharmony_ci 762306a36Sopenharmony_cititle: Common leds properties 862306a36Sopenharmony_ci 962306a36Sopenharmony_cimaintainers: 1062306a36Sopenharmony_ci - Jacek Anaszewski <jacek.anaszewski@gmail.com> 1162306a36Sopenharmony_ci - Pavel Machek <pavel@ucw.cz> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cidescription: 1462306a36Sopenharmony_ci LED and flash LED devices provide the same basic functionality as current 1562306a36Sopenharmony_ci regulators, but extended with LED and flash LED specific features like 1662306a36Sopenharmony_ci blinking patterns, flash timeout, flash faults and external flash strobe mode. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci Many LED devices expose more than one current output that can be connected 1962306a36Sopenharmony_ci to one or more discrete LED component. Since the arrangement of connections 2062306a36Sopenharmony_ci can influence the way of the LED device initialization, the LED components 2162306a36Sopenharmony_ci have to be tightly coupled with the LED device binding. They are represented 2262306a36Sopenharmony_ci by child nodes of the parent LED device binding. 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ciproperties: 2562306a36Sopenharmony_ci led-sources: 2662306a36Sopenharmony_ci description: 2762306a36Sopenharmony_ci List of device current outputs the LED is connected to. The outputs are 2862306a36Sopenharmony_ci identified by the numbers that must be defined in the LED device binding 2962306a36Sopenharmony_ci documentation. 3062306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32-array 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci function: 3362306a36Sopenharmony_ci description: 3462306a36Sopenharmony_ci LED function. Use one of the LED_FUNCTION_* prefixed definitions 3562306a36Sopenharmony_ci from the header include/dt-bindings/leds/common.h. If there is no 3662306a36Sopenharmony_ci matching LED_FUNCTION available, add a new one. 3762306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/string 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci color: 4062306a36Sopenharmony_ci description: 4162306a36Sopenharmony_ci Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from 4262306a36Sopenharmony_ci the header include/dt-bindings/leds/common.h. If there is no matching 4362306a36Sopenharmony_ci LED_COLOR_ID available, add a new one. 4462306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 4562306a36Sopenharmony_ci minimum: 0 4662306a36Sopenharmony_ci maximum: 9 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci function-enumerator: 4962306a36Sopenharmony_ci description: 5062306a36Sopenharmony_ci Integer to be used when more than one instance of the same function is 5162306a36Sopenharmony_ci needed, differing only with an ordinal number. 5262306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci label: 5562306a36Sopenharmony_ci description: 5662306a36Sopenharmony_ci The label for this LED. If omitted, the label is taken from the node name 5762306a36Sopenharmony_ci (excluding the unit address). It has to uniquely identify a device, i.e. 5862306a36Sopenharmony_ci no other LED class device can be assigned the same label. This property is 5962306a36Sopenharmony_ci deprecated - use 'function' and 'color' properties instead. 6062306a36Sopenharmony_ci function-enumerator has no effect when this property is present. 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci default-state: 6362306a36Sopenharmony_ci description: 6462306a36Sopenharmony_ci The initial state of the LED. If the LED is already on or off and the 6562306a36Sopenharmony_ci default-state property is set the to same value, then no glitch should be 6662306a36Sopenharmony_ci produced where the LED momentarily turns off (or on). The "keep" setting 6762306a36Sopenharmony_ci will keep the LED at whatever its current state is, without producing a 6862306a36Sopenharmony_ci glitch. 6962306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/string 7062306a36Sopenharmony_ci enum: 7162306a36Sopenharmony_ci - on 7262306a36Sopenharmony_ci - off 7362306a36Sopenharmony_ci - keep 7462306a36Sopenharmony_ci default: off 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci linux,default-trigger: 7762306a36Sopenharmony_ci description: 7862306a36Sopenharmony_ci This parameter, if present, is a string defining the trigger assigned to 7962306a36Sopenharmony_ci the LED. 8062306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/string 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci oneOf: 8362306a36Sopenharmony_ci - enum: 8462306a36Sopenharmony_ci # LED will act as a back-light, controlled by the framebuffer system 8562306a36Sopenharmony_ci - backlight 8662306a36Sopenharmony_ci # LED will turn on (see also "default-state" property) 8762306a36Sopenharmony_ci - default-on 8862306a36Sopenharmony_ci # LED "double" flashes at a load average based rate 8962306a36Sopenharmony_ci - heartbeat 9062306a36Sopenharmony_ci # LED indicates disk activity 9162306a36Sopenharmony_ci - disk-activity 9262306a36Sopenharmony_ci # LED indicates disk read activity 9362306a36Sopenharmony_ci - disk-read 9462306a36Sopenharmony_ci # LED indicates disk write activity 9562306a36Sopenharmony_ci - disk-write 9662306a36Sopenharmony_ci # LED flashes at a fixed, configurable rate 9762306a36Sopenharmony_ci - timer 9862306a36Sopenharmony_ci # LED alters the brightness for the specified duration with one software 9962306a36Sopenharmony_ci # timer (requires "led-pattern" property) 10062306a36Sopenharmony_ci - pattern 10162306a36Sopenharmony_ci # LED indicates mic mute state 10262306a36Sopenharmony_ci - audio-micmute 10362306a36Sopenharmony_ci # LED indicates audio mute state 10462306a36Sopenharmony_ci - audio-mute 10562306a36Sopenharmony_ci # LED indicates bluetooth power state 10662306a36Sopenharmony_ci - bluetooth-power 10762306a36Sopenharmony_ci # LED indicates camera flash state 10862306a36Sopenharmony_ci - flash 10962306a36Sopenharmony_ci # LED indicated keyboard capslock 11062306a36Sopenharmony_ci - kbd-capslock 11162306a36Sopenharmony_ci # LED indicates MTD memory activity 11262306a36Sopenharmony_ci - mtd 11362306a36Sopenharmony_ci # LED indicates NAND memory activity (deprecated), 11462306a36Sopenharmony_ci # in new implementations use "mtd" 11562306a36Sopenharmony_ci - nand-disk 11662306a36Sopenharmony_ci # No trigger assigned to the LED. This is the default mode 11762306a36Sopenharmony_ci # if trigger is absent 11862306a36Sopenharmony_ci - none 11962306a36Sopenharmony_ci # LED indicates camera torch state 12062306a36Sopenharmony_ci - torch 12162306a36Sopenharmony_ci # LED indicates USB gadget activity 12262306a36Sopenharmony_ci - usb-gadget 12362306a36Sopenharmony_ci # LED indicates USB host activity 12462306a36Sopenharmony_ci - usb-host 12562306a36Sopenharmony_ci # LED indicates USB port state 12662306a36Sopenharmony_ci - usbport 12762306a36Sopenharmony_ci # LED is triggered by CPU activity 12862306a36Sopenharmony_ci - pattern: "^cpu[0-9]*$" 12962306a36Sopenharmony_ci # LED is triggered by Bluetooth activity 13062306a36Sopenharmony_ci - pattern: "^hci[0-9]+-power$" 13162306a36Sopenharmony_ci # LED is triggered by SD/MMC activity 13262306a36Sopenharmony_ci - pattern: "^mmc[0-9]+$" 13362306a36Sopenharmony_ci # LED is triggered by WLAN activity 13462306a36Sopenharmony_ci - pattern: "^phy[0-9]+tx$" 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci led-pattern: 13762306a36Sopenharmony_ci description: | 13862306a36Sopenharmony_ci Array of integers with default pattern for certain triggers. 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci Each trigger may parse this property differently: 14162306a36Sopenharmony_ci - one-shot : two numbers specifying delay on and delay off (in ms), 14262306a36Sopenharmony_ci - timer : two numbers specifying delay on and delay off (in ms), 14362306a36Sopenharmony_ci - pattern : the pattern is given by a series of tuples, of 14462306a36Sopenharmony_ci brightness and duration (in ms). The exact format is 14562306a36Sopenharmony_ci described in: 14662306a36Sopenharmony_ci Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt 14762306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32-matrix 14862306a36Sopenharmony_ci items: 14962306a36Sopenharmony_ci minItems: 2 15062306a36Sopenharmony_ci maxItems: 2 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci led-max-microamp: 15362306a36Sopenharmony_ci description: 15462306a36Sopenharmony_ci Maximum LED supply current in microamperes. This property can be made 15562306a36Sopenharmony_ci mandatory for the board configurations introducing a risk of hardware 15662306a36Sopenharmony_ci damage in case an excessive current is set. 15762306a36Sopenharmony_ci For flash LED controllers with configurable current this property is 15862306a36Sopenharmony_ci mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci max-brightness: 16162306a36Sopenharmony_ci description: 16262306a36Sopenharmony_ci Normally, the maximum brightness is determined by the hardware, and this 16362306a36Sopenharmony_ci property is not required. This property is used to set a software limit. 16462306a36Sopenharmony_ci It could happen that an LED is made so bright that it gets damaged or 16562306a36Sopenharmony_ci causes damage due to restrictions in a specific system, such as mounting 16662306a36Sopenharmony_ci conditions. 16762306a36Sopenharmony_ci Note that this flag is mainly used for PWM-LEDs, where it is not possible 16862306a36Sopenharmony_ci to map brightness to current. Drivers for other controllers should use 16962306a36Sopenharmony_ci led-max-microamp. 17062306a36Sopenharmony_ci $ref: /schemas/types.yaml#definitions/uint32 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci panic-indicator: 17362306a36Sopenharmony_ci description: 17462306a36Sopenharmony_ci This property specifies that the LED should be used, if at all possible, 17562306a36Sopenharmony_ci as a panic indicator. 17662306a36Sopenharmony_ci type: boolean 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci retain-state-shutdown: 17962306a36Sopenharmony_ci description: 18062306a36Sopenharmony_ci This property specifies that the LED should not be turned off or changed 18162306a36Sopenharmony_ci when the system shuts down. 18262306a36Sopenharmony_ci type: boolean 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci trigger-sources: 18562306a36Sopenharmony_ci description: | 18662306a36Sopenharmony_ci List of devices which should be used as a source triggering this LED 18762306a36Sopenharmony_ci activity. Some LEDs can be related to a specific device and should somehow 18862306a36Sopenharmony_ci indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0 18962306a36Sopenharmony_ci port(s). 19062306a36Sopenharmony_ci Another common example is switch or router with multiple Ethernet ports 19162306a36Sopenharmony_ci each of them having its own LED assigned (assuming they are not 19262306a36Sopenharmony_ci hardwired). In such cases this property should contain phandle(s) of 19362306a36Sopenharmony_ci related source device(s). 19462306a36Sopenharmony_ci In many cases LED can be related to more than one device (e.g. one USB LED 19562306a36Sopenharmony_ci vs. multiple USB ports). Each source should be represented by a node in 19662306a36Sopenharmony_ci the device tree and be referenced by a phandle and a set of phandle 19762306a36Sopenharmony_ci arguments. A length of arguments should be specified by the 19862306a36Sopenharmony_ci #trigger-source-cells property in the source node. 19962306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/phandle-array 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci # Required properties for flash LED child nodes: 20262306a36Sopenharmony_ci flash-max-microamp: 20362306a36Sopenharmony_ci description: 20462306a36Sopenharmony_ci Maximum flash LED supply current in microamperes. Required for flash LED 20562306a36Sopenharmony_ci nodes with configurable current. 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci flash-max-timeout-us: 20862306a36Sopenharmony_ci description: 20962306a36Sopenharmony_ci Maximum timeout in microseconds after which the flash LED is turned off. 21062306a36Sopenharmony_ci Required for flash LED nodes with configurable timeout. 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ciadditionalProperties: true 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ciexamples: 21562306a36Sopenharmony_ci - | 21662306a36Sopenharmony_ci #include <dt-bindings/gpio/gpio.h> 21762306a36Sopenharmony_ci #include <dt-bindings/leds/common.h> 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci led-controller { 22062306a36Sopenharmony_ci compatible = "gpio-leds"; 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci led-0 { 22362306a36Sopenharmony_ci function = LED_FUNCTION_STATUS; 22462306a36Sopenharmony_ci linux,default-trigger = "heartbeat"; 22562306a36Sopenharmony_ci gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; 22662306a36Sopenharmony_ci }; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci led-1 { 22962306a36Sopenharmony_ci function = LED_FUNCTION_USB; 23062306a36Sopenharmony_ci gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; 23162306a36Sopenharmony_ci trigger-sources = <&ohci_port1>, <&ehci_port1>; 23262306a36Sopenharmony_ci }; 23362306a36Sopenharmony_ci }; 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci - | 23662306a36Sopenharmony_ci #include <dt-bindings/leds/common.h> 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci led-controller { 23962306a36Sopenharmony_ci compatible = "maxim,max77693-led"; 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci led { 24262306a36Sopenharmony_ci function = LED_FUNCTION_FLASH; 24362306a36Sopenharmony_ci color = <LED_COLOR_ID_WHITE>; 24462306a36Sopenharmony_ci led-sources = <0>, <1>; 24562306a36Sopenharmony_ci led-max-microamp = <50000>; 24662306a36Sopenharmony_ci flash-max-microamp = <320000>; 24762306a36Sopenharmony_ci flash-max-timeout-us = <500000>; 24862306a36Sopenharmony_ci }; 24962306a36Sopenharmony_ci }; 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci - | 25262306a36Sopenharmony_ci #include <dt-bindings/leds/common.h> 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci i2c { 25562306a36Sopenharmony_ci #address-cells = <1>; 25662306a36Sopenharmony_ci #size-cells = <0>; 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci led-controller@30 { 25962306a36Sopenharmony_ci compatible = "panasonic,an30259a"; 26062306a36Sopenharmony_ci reg = <0x30>; 26162306a36Sopenharmony_ci #address-cells = <1>; 26262306a36Sopenharmony_ci #size-cells = <0>; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci led@1 { 26562306a36Sopenharmony_ci reg = <1>; 26662306a36Sopenharmony_ci linux,default-trigger = "heartbeat"; 26762306a36Sopenharmony_ci function = LED_FUNCTION_INDICATOR; 26862306a36Sopenharmony_ci function-enumerator = <1>; 26962306a36Sopenharmony_ci }; 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci led@2 { 27262306a36Sopenharmony_ci reg = <2>; 27362306a36Sopenharmony_ci function = LED_FUNCTION_INDICATOR; 27462306a36Sopenharmony_ci function-enumerator = <2>; 27562306a36Sopenharmony_ci }; 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci led@3 { 27862306a36Sopenharmony_ci reg = <3>; 27962306a36Sopenharmony_ci function = LED_FUNCTION_INDICATOR; 28062306a36Sopenharmony_ci function-enumerator = <3>; 28162306a36Sopenharmony_ci }; 28262306a36Sopenharmony_ci }; 28362306a36Sopenharmony_ci }; 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci... 286