xref: /linux/Documentation/devicetree/bindings/leds/common.yaml (revision c771600c6af14749609b49565ffb4cac2959710d)
124a71afeSRob Herring# SPDX-License-Identifier: GPL-2.0-only
224a71afeSRob Herring%YAML 1.2
324a71afeSRob Herring---
424a71afeSRob Herring$id: http://devicetree.org/schemas/leds/common.yaml#
524a71afeSRob Herring$schema: http://devicetree.org/meta-schemas/core.yaml#
624a71afeSRob Herring
724a71afeSRob Herringtitle: Common leds properties
824a71afeSRob Herring
924a71afeSRob Herringmaintainers:
1024a71afeSRob Herring  - Jacek Anaszewski <jacek.anaszewski@gmail.com>
1124a71afeSRob Herring  - Pavel Machek <pavel@ucw.cz>
1224a71afeSRob Herring
1324a71afeSRob Herringdescription:
1424a71afeSRob Herring  LED and flash LED devices provide the same basic functionality as current
1524a71afeSRob Herring  regulators, but extended with LED and flash LED specific features like
1624a71afeSRob Herring  blinking patterns, flash timeout, flash faults and external flash strobe mode.
1724a71afeSRob Herring
1824a71afeSRob Herring  Many LED devices expose more than one current output that can be connected
1924a71afeSRob Herring  to one or more discrete LED component. Since the arrangement of connections
2024a71afeSRob Herring  can influence the way of the LED device initialization, the LED components
2124a71afeSRob Herring  have to be tightly coupled with the LED device binding. They are represented
2224a71afeSRob Herring  by child nodes of the parent LED device binding.
2324a71afeSRob Herring
2424a71afeSRob Herringproperties:
2524a71afeSRob Herring  led-sources:
2624a71afeSRob Herring    description:
2724a71afeSRob Herring      List of device current outputs the LED is connected to. The outputs are
2824a71afeSRob Herring      identified by the numbers that must be defined in the LED device binding
2924a71afeSRob Herring      documentation.
30d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/uint32-array
3124a71afeSRob Herring
3224a71afeSRob Herring  function:
3324a71afeSRob Herring    description:
3424a71afeSRob Herring      LED function. Use one of the LED_FUNCTION_* prefixed definitions
3524a71afeSRob Herring      from the header include/dt-bindings/leds/common.h. If there is no
3624a71afeSRob Herring      matching LED_FUNCTION available, add a new one.
37d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/string
3824a71afeSRob Herring
3924a71afeSRob Herring  color:
4024a71afeSRob Herring    description:
4124a71afeSRob Herring      Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from
4224a71afeSRob Herring      the header include/dt-bindings/leds/common.h. If there is no matching
4324a71afeSRob Herring      LED_COLOR_ID available, add a new one.
44d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/uint32
4524a71afeSRob Herring    minimum: 0
4643962eb5SOndrej Jirman    maximum: 14
4724a71afeSRob Herring
4824a71afeSRob Herring  function-enumerator:
4924a71afeSRob Herring    description:
5024a71afeSRob Herring      Integer to be used when more than one instance of the same function is
5124a71afeSRob Herring      needed, differing only with an ordinal number.
52d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/uint32
5324a71afeSRob Herring
5424a71afeSRob Herring  label:
5524a71afeSRob Herring    description:
5624a71afeSRob Herring      The label for this LED. If omitted, the label is taken from the node name
5724a71afeSRob Herring      (excluding the unit address). It has to uniquely identify a device, i.e.
5824a71afeSRob Herring      no other LED class device can be assigned the same label. This property is
5924a71afeSRob Herring      deprecated - use 'function' and 'color' properties instead.
6024a71afeSRob Herring      function-enumerator has no effect when this property is present.
6124a71afeSRob Herring
6224a71afeSRob Herring  default-state:
6324a71afeSRob Herring    description:
6424a71afeSRob Herring      The initial state of the LED. If the LED is already on or off and the
6524a71afeSRob Herring      default-state property is set the to same value, then no glitch should be
6624a71afeSRob Herring      produced where the LED momentarily turns off (or on). The "keep" setting
6724a71afeSRob Herring      will keep the LED at whatever its current state is, without producing a
6824a71afeSRob Herring      glitch.
69d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/string
7024a71afeSRob Herring    enum:
7124a71afeSRob Herring      - on
7224a71afeSRob Herring      - off
7324a71afeSRob Herring      - keep
7424a71afeSRob Herring    default: off
7524a71afeSRob Herring
7624a71afeSRob Herring  linux,default-trigger:
7724a71afeSRob Herring    description:
7824a71afeSRob Herring      This parameter, if present, is a string defining the trigger assigned to
7924a71afeSRob Herring      the LED.
80d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/string
813d21a460SRob Herring
8231fd7108SMarek Vasut    oneOf:
8331fd7108SMarek Vasut      - enum:
8424a71afeSRob Herring            # LED will act as a back-light, controlled by the framebuffer system
8524a71afeSRob Herring          - backlight
86d3679199SJonathan Neuschäfer            # LED will turn on (see also "default-state" property)
8724a71afeSRob Herring          - default-on
8824a71afeSRob Herring            # LED "double" flashes at a load average based rate
8924a71afeSRob Herring          - heartbeat
9024a71afeSRob Herring            # LED indicates disk activity
9124a71afeSRob Herring          - disk-activity
92e91a4d5dSManivannan Sadhasivam            # LED indicates disk read activity
93d8fe820bSCorentin Labbe          - disk-read
94e91a4d5dSManivannan Sadhasivam            # LED indicates disk write activity
95d8fe820bSCorentin Labbe          - disk-write
9624a71afeSRob Herring            # LED flashes at a fixed, configurable rate
9724a71afeSRob Herring          - timer
9824a71afeSRob Herring            # LED alters the brightness for the specified duration with one software
9924a71afeSRob Herring            # timer (requires "led-pattern" property)
10024a71afeSRob Herring          - pattern
101e91a4d5dSManivannan Sadhasivam            # LED indicates mic mute state
102e91a4d5dSManivannan Sadhasivam          - audio-micmute
103e91a4d5dSManivannan Sadhasivam            # LED indicates audio mute state
104e91a4d5dSManivannan Sadhasivam          - audio-mute
105e91a4d5dSManivannan Sadhasivam            # LED indicates bluetooth power state
106e91a4d5dSManivannan Sadhasivam          - bluetooth-power
107e91a4d5dSManivannan Sadhasivam            # LED indicates camera flash state
108e91a4d5dSManivannan Sadhasivam          - flash
109e91a4d5dSManivannan Sadhasivam            # LED indicated keyboard capslock
110e91a4d5dSManivannan Sadhasivam          - kbd-capslock
111e91a4d5dSManivannan Sadhasivam            # LED indicates MTD memory activity
112e91a4d5dSManivannan Sadhasivam          - mtd
113e91a4d5dSManivannan Sadhasivam            # LED indicates NAND memory activity (deprecated),
114e91a4d5dSManivannan Sadhasivam            # in new implementations use "mtd"
115e91a4d5dSManivannan Sadhasivam          - nand-disk
116616dbed6SMarek Vasut            # LED indicates network activity
117616dbed6SMarek Vasut          - netdev
118e91a4d5dSManivannan Sadhasivam            # No trigger assigned to the LED. This is the default mode
119e91a4d5dSManivannan Sadhasivam            # if trigger is absent
120e91a4d5dSManivannan Sadhasivam          - none
121267f1ad6SHeiko Stuebner            # LED indicates remote control feedback
122267f1ad6SHeiko Stuebner          - rc-feedback
123e91a4d5dSManivannan Sadhasivam            # LED indicates camera torch state
124e91a4d5dSManivannan Sadhasivam          - torch
125e91a4d5dSManivannan Sadhasivam            # LED indicates USB gadget activity
126d8fe820bSCorentin Labbe          - usb-gadget
127e91a4d5dSManivannan Sadhasivam            # LED indicates USB host activity
128d8fe820bSCorentin Labbe          - usb-host
129820d7550SRafał Miłecki            # LED indicates USB port state
130820d7550SRafał Miłecki          - usbport
131e91a4d5dSManivannan Sadhasivam        # LED is triggered by CPU activity
1325f52a8baSRob Herring      - pattern: "^cpu[0-9]*$"
133227e9611SGeert Uytterhoeven        # LED is triggered by Bluetooth activity
134e91a4d5dSManivannan Sadhasivam      - pattern: "^hci[0-9]+-power$"
135227e9611SGeert Uytterhoeven        # LED is triggered by SD/MMC activity
136e91a4d5dSManivannan Sadhasivam      - pattern: "^mmc[0-9]+$"
137227e9611SGeert Uytterhoeven        # LED is triggered by WLAN activity
138e91a4d5dSManivannan Sadhasivam      - pattern: "^phy[0-9]+tx$"
13924a71afeSRob Herring
14024a71afeSRob Herring  led-pattern:
14124a71afeSRob Herring    description: |
14224a71afeSRob Herring      Array of integers with default pattern for certain triggers.
14324a71afeSRob Herring
14424a71afeSRob Herring      Each trigger may parse this property differently:
14524a71afeSRob Herring        - one-shot : two numbers specifying delay on and delay off (in ms),
14624a71afeSRob Herring        - timer : two numbers specifying delay on and delay off (in ms),
14724a71afeSRob Herring        - pattern : the pattern is given by a series of tuples, of
14824a71afeSRob Herring          brightness and duration (in ms).  The exact format is
14924a71afeSRob Herring          described in:
15024a71afeSRob Herring          Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
151d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/uint32-matrix
15224a71afeSRob Herring    items:
15324a71afeSRob Herring      minItems: 2
15424a71afeSRob Herring      maxItems: 2
15524a71afeSRob Herring
15624a71afeSRob Herring  led-max-microamp:
15724a71afeSRob Herring    description:
15824a71afeSRob Herring      Maximum LED supply current in microamperes. This property can be made
15924a71afeSRob Herring      mandatory for the board configurations introducing a risk of hardware
16024a71afeSRob Herring      damage in case an excessive current is set.
16124a71afeSRob Herring      For flash LED controllers with configurable current this property is
16224a71afeSRob Herring      mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
16324a71afeSRob Herring
164713899c0SAstrid Rost  max-brightness:
165713899c0SAstrid Rost    description:
166713899c0SAstrid Rost      Normally, the maximum brightness is determined by the hardware, and this
167713899c0SAstrid Rost      property is not required. This property is used to set a software limit.
168713899c0SAstrid Rost      It could happen that an LED is made so bright that it gets damaged or
169713899c0SAstrid Rost      causes damage due to restrictions in a specific system, such as mounting
170713899c0SAstrid Rost      conditions.
171713899c0SAstrid Rost      Note that this flag is mainly used for PWM-LEDs, where it is not possible
172713899c0SAstrid Rost      to map brightness to current. Drivers for other controllers should use
173713899c0SAstrid Rost      led-max-microamp.
1741de1da7bSRob Herring    $ref: /schemas/types.yaml#/definitions/uint32
175713899c0SAstrid Rost
17624a71afeSRob Herring  panic-indicator:
17724a71afeSRob Herring    description:
17824a71afeSRob Herring      This property specifies that the LED should be used, if at all possible,
17924a71afeSRob Herring      as a panic indicator.
18024a71afeSRob Herring    type: boolean
18124a71afeSRob Herring
1825d823d6dSEddie James  retain-state-shutdown:
1835d823d6dSEddie James    description:
1845d823d6dSEddie James      This property specifies that the LED should not be turned off or changed
1855d823d6dSEddie James      when the system shuts down.
1865d823d6dSEddie James    type: boolean
1875d823d6dSEddie James
18824a71afeSRob Herring  trigger-sources:
18924a71afeSRob Herring    description: |
19024a71afeSRob Herring      List of devices which should be used as a source triggering this LED
19124a71afeSRob Herring      activity. Some LEDs can be related to a specific device and should somehow
19224a71afeSRob Herring      indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0
19324a71afeSRob Herring      port(s).
19424a71afeSRob Herring      Another common example is switch or router with multiple Ethernet ports
19524a71afeSRob Herring      each of them having its own LED assigned (assuming they are not
19624a71afeSRob Herring      hardwired). In such cases this property should contain phandle(s) of
19724a71afeSRob Herring      related source device(s).
198f9be4d5bSLinus Walleij      Another example is a GPIO line that will be monitored and mirror the
199f9be4d5bSLinus Walleij      state of the line (with or without inversion flags) to the LED.
20024a71afeSRob Herring      In many cases LED can be related to more than one device (e.g. one USB LED
20124a71afeSRob Herring      vs. multiple USB ports). Each source should be represented by a node in
20224a71afeSRob Herring      the device tree and be referenced by a phandle and a set of phandle
20324a71afeSRob Herring      arguments. A length of arguments should be specified by the
20424a71afeSRob Herring      #trigger-source-cells property in the source node.
205d69c6dddSRob Herring    $ref: /schemas/types.yaml#/definitions/phandle-array
20624a71afeSRob Herring
207*c161656bSDaniel Golle  active-high:
208*c161656bSDaniel Golle    type: boolean
209*c161656bSDaniel Golle    description:
210*c161656bSDaniel Golle      Makes LED active high. To turn the LED ON, line needs to be
211*c161656bSDaniel Golle      set to high voltage instead of low.
212*c161656bSDaniel Golle
213c94d1783SChristian Marangi  active-low:
214c94d1783SChristian Marangi    type: boolean
215c94d1783SChristian Marangi    description:
216c94d1783SChristian Marangi      Makes LED active low. To turn the LED ON, line needs to be
217c94d1783SChristian Marangi      set to low voltage instead of high.
218c94d1783SChristian Marangi
219355c6dc3SChristian Marangi  inactive-high-impedance:
220355c6dc3SChristian Marangi    type: boolean
221355c6dc3SChristian Marangi    description:
222355c6dc3SChristian Marangi      Set LED to high-impedance mode to turn the LED OFF. LED might also
223355c6dc3SChristian Marangi      describe this mode as tristate.
224355c6dc3SChristian Marangi
22524a71afeSRob Herring  # Required properties for flash LED child nodes:
22624a71afeSRob Herring  flash-max-microamp:
22724a71afeSRob Herring    description:
22824a71afeSRob Herring      Maximum flash LED supply current in microamperes. Required for flash LED
22924a71afeSRob Herring      nodes with configurable current.
23024a71afeSRob Herring
23124a71afeSRob Herring  flash-max-timeout-us:
23224a71afeSRob Herring    description:
23324a71afeSRob Herring      Maximum timeout in microseconds after which the flash LED is turned off.
23424a71afeSRob Herring      Required for flash LED nodes with configurable timeout.
23524a71afeSRob Herring
236*c161656bSDaniel GolleallOf:
237*c161656bSDaniel Golle  - if:
238*c161656bSDaniel Golle      required:
239*c161656bSDaniel Golle        - active-low
240*c161656bSDaniel Golle    then:
241*c161656bSDaniel Golle      properties:
242*c161656bSDaniel Golle        active-high: false
243*c161656bSDaniel Golle
2446a0e321eSRob HerringadditionalProperties: true
2456a0e321eSRob Herring
24624a71afeSRob Herringexamples:
24724a71afeSRob Herring  - |
24824a71afeSRob Herring    #include <dt-bindings/gpio/gpio.h>
24924a71afeSRob Herring    #include <dt-bindings/leds/common.h>
25024a71afeSRob Herring
25124a71afeSRob Herring    led-controller {
25224a71afeSRob Herring        compatible = "gpio-leds";
25324a71afeSRob Herring
2547a3a2a64SJohan Jonker        led-0 {
25524a71afeSRob Herring            function = LED_FUNCTION_STATUS;
25624a71afeSRob Herring            linux,default-trigger = "heartbeat";
25724a71afeSRob Herring            gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
25824a71afeSRob Herring        };
25924a71afeSRob Herring
2607a3a2a64SJohan Jonker        led-1 {
26124a71afeSRob Herring            function = LED_FUNCTION_USB;
26224a71afeSRob Herring            gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
26324a71afeSRob Herring            trigger-sources = <&ohci_port1>, <&ehci_port1>;
26424a71afeSRob Herring        };
26524a71afeSRob Herring    };
26624a71afeSRob Herring
267114fa138SKrzysztof Kozlowski  - |
268114fa138SKrzysztof Kozlowski    #include <dt-bindings/leds/common.h>
269114fa138SKrzysztof Kozlowski
270114fa138SKrzysztof Kozlowski    led-controller {
27124a71afeSRob Herring        compatible = "maxim,max77693-led";
27224a71afeSRob Herring
27324a71afeSRob Herring        led {
27424a71afeSRob Herring            function = LED_FUNCTION_FLASH;
27524a71afeSRob Herring            color = <LED_COLOR_ID_WHITE>;
27624a71afeSRob Herring            led-sources = <0>, <1>;
27724a71afeSRob Herring            led-max-microamp = <50000>;
27824a71afeSRob Herring            flash-max-microamp = <320000>;
27924a71afeSRob Herring            flash-max-timeout-us = <500000>;
28024a71afeSRob Herring        };
28124a71afeSRob Herring    };
28224a71afeSRob Herring
283114fa138SKrzysztof Kozlowski  - |
284114fa138SKrzysztof Kozlowski    #include <dt-bindings/leds/common.h>
285114fa138SKrzysztof Kozlowski
28624a71afeSRob Herring    i2c {
28724a71afeSRob Herring        #address-cells = <1>;
28824a71afeSRob Herring        #size-cells = <0>;
28924a71afeSRob Herring
29024a71afeSRob Herring        led-controller@30 {
29124a71afeSRob Herring            compatible = "panasonic,an30259a";
29224a71afeSRob Herring            reg = <0x30>;
29324a71afeSRob Herring            #address-cells = <1>;
29424a71afeSRob Herring            #size-cells = <0>;
29524a71afeSRob Herring
29624a71afeSRob Herring            led@1 {
29724a71afeSRob Herring                reg = <1>;
29824a71afeSRob Herring                linux,default-trigger = "heartbeat";
29924a71afeSRob Herring                function = LED_FUNCTION_INDICATOR;
30024a71afeSRob Herring                function-enumerator = <1>;
30124a71afeSRob Herring            };
30224a71afeSRob Herring
30324a71afeSRob Herring            led@2 {
30424a71afeSRob Herring                reg = <2>;
30524a71afeSRob Herring                function = LED_FUNCTION_INDICATOR;
30624a71afeSRob Herring                function-enumerator = <2>;
30724a71afeSRob Herring            };
30824a71afeSRob Herring
30924a71afeSRob Herring            led@3 {
31024a71afeSRob Herring                reg = <3>;
31124a71afeSRob Herring                function = LED_FUNCTION_INDICATOR;
31224a71afeSRob Herring                function-enumerator = <3>;
31324a71afeSRob Herring            };
31424a71afeSRob Herring        };
31524a71afeSRob Herring    };
31624a71afeSRob Herring
31724a71afeSRob Herring...
318