18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci%YAML 1.2
38c2ecf20Sopenharmony_ci---
48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/leds/common.yaml#
58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cititle: Common leds properties
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cimaintainers:
108c2ecf20Sopenharmony_ci  - Jacek Anaszewski <jacek.anaszewski@gmail.com>
118c2ecf20Sopenharmony_ci  - Pavel Machek <pavel@ucw.cz>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cidescription:
148c2ecf20Sopenharmony_ci  LED and flash LED devices provide the same basic functionality as current
158c2ecf20Sopenharmony_ci  regulators, but extended with LED and flash LED specific features like
168c2ecf20Sopenharmony_ci  blinking patterns, flash timeout, flash faults and external flash strobe mode.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci  Many LED devices expose more than one current output that can be connected
198c2ecf20Sopenharmony_ci  to one or more discrete LED component. Since the arrangement of connections
208c2ecf20Sopenharmony_ci  can influence the way of the LED device initialization, the LED components
218c2ecf20Sopenharmony_ci  have to be tightly coupled with the LED device binding. They are represented
228c2ecf20Sopenharmony_ci  by child nodes of the parent LED device binding.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciproperties:
258c2ecf20Sopenharmony_ci  led-sources:
268c2ecf20Sopenharmony_ci    description:
278c2ecf20Sopenharmony_ci      List of device current outputs the LED is connected to. The outputs are
288c2ecf20Sopenharmony_ci      identified by the numbers that must be defined in the LED device binding
298c2ecf20Sopenharmony_ci      documentation.
308c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/uint32-array
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci  function:
338c2ecf20Sopenharmony_ci    description:
348c2ecf20Sopenharmony_ci      LED function. Use one of the LED_FUNCTION_* prefixed definitions
358c2ecf20Sopenharmony_ci      from the header include/dt-bindings/leds/common.h. If there is no
368c2ecf20Sopenharmony_ci      matching LED_FUNCTION available, add a new one.
378c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/string
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci  color:
408c2ecf20Sopenharmony_ci    description:
418c2ecf20Sopenharmony_ci      Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from
428c2ecf20Sopenharmony_ci      the header include/dt-bindings/leds/common.h. If there is no matching
438c2ecf20Sopenharmony_ci      LED_COLOR_ID available, add a new one.
448c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/uint32
458c2ecf20Sopenharmony_ci    minimum: 0
468c2ecf20Sopenharmony_ci    maximum: 9
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci  function-enumerator:
498c2ecf20Sopenharmony_ci    description:
508c2ecf20Sopenharmony_ci      Integer to be used when more than one instance of the same function is
518c2ecf20Sopenharmony_ci      needed, differing only with an ordinal number.
528c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/uint32
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci  label:
558c2ecf20Sopenharmony_ci    description:
568c2ecf20Sopenharmony_ci      The label for this LED. If omitted, the label is taken from the node name
578c2ecf20Sopenharmony_ci      (excluding the unit address). It has to uniquely identify a device, i.e.
588c2ecf20Sopenharmony_ci      no other LED class device can be assigned the same label. This property is
598c2ecf20Sopenharmony_ci      deprecated - use 'function' and 'color' properties instead.
608c2ecf20Sopenharmony_ci      function-enumerator has no effect when this property is present.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci  default-state:
638c2ecf20Sopenharmony_ci    description:
648c2ecf20Sopenharmony_ci      The initial state of the LED. If the LED is already on or off and the
658c2ecf20Sopenharmony_ci      default-state property is set the to same value, then no glitch should be
668c2ecf20Sopenharmony_ci      produced where the LED momentarily turns off (or on). The "keep" setting
678c2ecf20Sopenharmony_ci      will keep the LED at whatever its current state is, without producing a
688c2ecf20Sopenharmony_ci      glitch.
698c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/string
708c2ecf20Sopenharmony_ci    enum:
718c2ecf20Sopenharmony_ci      - on
728c2ecf20Sopenharmony_ci      - off
738c2ecf20Sopenharmony_ci      - keep
748c2ecf20Sopenharmony_ci    default: off
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci  linux,default-trigger:
778c2ecf20Sopenharmony_ci    description:
788c2ecf20Sopenharmony_ci      This parameter, if present, is a string defining the trigger assigned to
798c2ecf20Sopenharmony_ci      the LED.
808c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/string
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci    enum:
838c2ecf20Sopenharmony_ci        # LED will act as a back-light, controlled by the framebuffer system
848c2ecf20Sopenharmony_ci      - backlight
858c2ecf20Sopenharmony_ci        # LED will turn on (but for leds-gpio see "default-state" property in
868c2ecf20Sopenharmony_ci        # Documentation/devicetree/bindings/leds/leds-gpio.yaml)
878c2ecf20Sopenharmony_ci      - default-on
888c2ecf20Sopenharmony_ci        # LED "double" flashes at a load average based rate
898c2ecf20Sopenharmony_ci      - heartbeat
908c2ecf20Sopenharmony_ci        # LED indicates disk activity
918c2ecf20Sopenharmony_ci      - disk-activity
928c2ecf20Sopenharmony_ci        # LED indicates IDE disk activity (deprecated), in new implementations
938c2ecf20Sopenharmony_ci        # use "disk-activity"
948c2ecf20Sopenharmony_ci      - ide-disk
958c2ecf20Sopenharmony_ci        # LED flashes at a fixed, configurable rate
968c2ecf20Sopenharmony_ci      - timer
978c2ecf20Sopenharmony_ci        # LED alters the brightness for the specified duration with one software
988c2ecf20Sopenharmony_ci        # timer (requires "led-pattern" property)
998c2ecf20Sopenharmony_ci      - pattern
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci  led-pattern:
1028c2ecf20Sopenharmony_ci    description: |
1038c2ecf20Sopenharmony_ci      Array of integers with default pattern for certain triggers.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci      Each trigger may parse this property differently:
1068c2ecf20Sopenharmony_ci        - one-shot : two numbers specifying delay on and delay off (in ms),
1078c2ecf20Sopenharmony_ci        - timer : two numbers specifying delay on and delay off (in ms),
1088c2ecf20Sopenharmony_ci        - pattern : the pattern is given by a series of tuples, of
1098c2ecf20Sopenharmony_ci          brightness and duration (in ms).  The exact format is
1108c2ecf20Sopenharmony_ci          described in:
1118c2ecf20Sopenharmony_ci          Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
1128c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/uint32-matrix
1138c2ecf20Sopenharmony_ci    items:
1148c2ecf20Sopenharmony_ci      minItems: 2
1158c2ecf20Sopenharmony_ci      maxItems: 2
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci  led-max-microamp:
1188c2ecf20Sopenharmony_ci    description:
1198c2ecf20Sopenharmony_ci      Maximum LED supply current in microamperes. This property can be made
1208c2ecf20Sopenharmony_ci      mandatory for the board configurations introducing a risk of hardware
1218c2ecf20Sopenharmony_ci      damage in case an excessive current is set.
1228c2ecf20Sopenharmony_ci      For flash LED controllers with configurable current this property is
1238c2ecf20Sopenharmony_ci      mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci  panic-indicator:
1268c2ecf20Sopenharmony_ci    description:
1278c2ecf20Sopenharmony_ci      This property specifies that the LED should be used, if at all possible,
1288c2ecf20Sopenharmony_ci      as a panic indicator.
1298c2ecf20Sopenharmony_ci    type: boolean
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci  trigger-sources:
1328c2ecf20Sopenharmony_ci    description: |
1338c2ecf20Sopenharmony_ci      List of devices which should be used as a source triggering this LED
1348c2ecf20Sopenharmony_ci      activity. Some LEDs can be related to a specific device and should somehow
1358c2ecf20Sopenharmony_ci      indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0
1368c2ecf20Sopenharmony_ci      port(s).
1378c2ecf20Sopenharmony_ci      Another common example is switch or router with multiple Ethernet ports
1388c2ecf20Sopenharmony_ci      each of them having its own LED assigned (assuming they are not
1398c2ecf20Sopenharmony_ci      hardwired). In such cases this property should contain phandle(s) of
1408c2ecf20Sopenharmony_ci      related source device(s).
1418c2ecf20Sopenharmony_ci      In many cases LED can be related to more than one device (e.g. one USB LED
1428c2ecf20Sopenharmony_ci      vs. multiple USB ports). Each source should be represented by a node in
1438c2ecf20Sopenharmony_ci      the device tree and be referenced by a phandle and a set of phandle
1448c2ecf20Sopenharmony_ci      arguments. A length of arguments should be specified by the
1458c2ecf20Sopenharmony_ci      #trigger-source-cells property in the source node.
1468c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#definitions/phandle-array
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci  # Required properties for flash LED child nodes:
1498c2ecf20Sopenharmony_ci  flash-max-microamp:
1508c2ecf20Sopenharmony_ci    description:
1518c2ecf20Sopenharmony_ci      Maximum flash LED supply current in microamperes. Required for flash LED
1528c2ecf20Sopenharmony_ci      nodes with configurable current.
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci  flash-max-timeout-us:
1558c2ecf20Sopenharmony_ci    description:
1568c2ecf20Sopenharmony_ci      Maximum timeout in microseconds after which the flash LED is turned off.
1578c2ecf20Sopenharmony_ci      Required for flash LED nodes with configurable timeout.
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ciadditionalProperties: true
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ciexamples:
1628c2ecf20Sopenharmony_ci  - |
1638c2ecf20Sopenharmony_ci    #include <dt-bindings/gpio/gpio.h>
1648c2ecf20Sopenharmony_ci    #include <dt-bindings/leds/common.h>
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci    led-controller {
1678c2ecf20Sopenharmony_ci        compatible = "gpio-leds";
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci        led-0 {
1708c2ecf20Sopenharmony_ci            function = LED_FUNCTION_STATUS;
1718c2ecf20Sopenharmony_ci            linux,default-trigger = "heartbeat";
1728c2ecf20Sopenharmony_ci            gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
1738c2ecf20Sopenharmony_ci        };
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci        led-1 {
1768c2ecf20Sopenharmony_ci            function = LED_FUNCTION_USB;
1778c2ecf20Sopenharmony_ci            gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
1788c2ecf20Sopenharmony_ci            trigger-sources = <&ohci_port1>, <&ehci_port1>;
1798c2ecf20Sopenharmony_ci        };
1808c2ecf20Sopenharmony_ci    };
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci    led-controller@0 {
1838c2ecf20Sopenharmony_ci        compatible = "maxim,max77693-led";
1848c2ecf20Sopenharmony_ci        reg = <0 0x100>;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci        led {
1878c2ecf20Sopenharmony_ci            function = LED_FUNCTION_FLASH;
1888c2ecf20Sopenharmony_ci            color = <LED_COLOR_ID_WHITE>;
1898c2ecf20Sopenharmony_ci            led-sources = <0>, <1>;
1908c2ecf20Sopenharmony_ci            led-max-microamp = <50000>;
1918c2ecf20Sopenharmony_ci            flash-max-microamp = <320000>;
1928c2ecf20Sopenharmony_ci            flash-max-timeout-us = <500000>;
1938c2ecf20Sopenharmony_ci        };
1948c2ecf20Sopenharmony_ci    };
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci    i2c {
1978c2ecf20Sopenharmony_ci        #address-cells = <1>;
1988c2ecf20Sopenharmony_ci        #size-cells = <0>;
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci        led-controller@30 {
2018c2ecf20Sopenharmony_ci            compatible = "panasonic,an30259a";
2028c2ecf20Sopenharmony_ci            reg = <0x30>;
2038c2ecf20Sopenharmony_ci            #address-cells = <1>;
2048c2ecf20Sopenharmony_ci            #size-cells = <0>;
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci            led@1 {
2078c2ecf20Sopenharmony_ci                reg = <1>;
2088c2ecf20Sopenharmony_ci                linux,default-trigger = "heartbeat";
2098c2ecf20Sopenharmony_ci                function = LED_FUNCTION_INDICATOR;
2108c2ecf20Sopenharmony_ci                function-enumerator = <1>;
2118c2ecf20Sopenharmony_ci            };
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci            led@2 {
2148c2ecf20Sopenharmony_ci                reg = <2>;
2158c2ecf20Sopenharmony_ci                function = LED_FUNCTION_INDICATOR;
2168c2ecf20Sopenharmony_ci                function-enumerator = <2>;
2178c2ecf20Sopenharmony_ci            };
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci            led@3 {
2208c2ecf20Sopenharmony_ci                reg = <3>;
2218c2ecf20Sopenharmony_ci                function = LED_FUNCTION_INDICATOR;
2228c2ecf20Sopenharmony_ci                function-enumerator = <3>;
2238c2ecf20Sopenharmony_ci            };
2248c2ecf20Sopenharmony_ci        };
2258c2ecf20Sopenharmony_ci    };
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci...
228