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