# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/leds-lp50xx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LED driver for LP50XX RGB LED from Texas Instruments.

maintainers:
  - Andrew Davis <afd@ti.com>

description: |
  The LP50XX is multi-channel, I2C RGB LED Drivers that can group RGB LEDs into
  a LED group or control them individually.

  The difference in these RGB LED drivers is the number of supported RGB
  modules.

  For more product information please see the link below:
  https://www.ti.com/lit/ds/symlink/lp5012.pdf
  https://www.ti.com/lit/ds/symlink/lp5024.pdf
  https://www.ti.com/lit/ds/symlink/lp5036.pdf

properties:
  compatible:
    enum:
      - ti,lp5009
      - ti,lp5012
      - ti,lp5018
      - ti,lp5024
      - ti,lp5030
      - ti,lp5036

  reg:
    maxItems: 1
    description:
      I2C slave address
      lp5009/12 - 0x14, 0x15, 0x16, 0x17
      lp5018/24 - 0x28, 0x29, 0x2a, 0x2b
      lp5030/36 - 0x30, 0x31, 0x32, 0x33

  enable-gpios:
    maxItems: 1
    description: GPIO pin to enable/disable the device.

  vled-supply:
    description: LED supply.

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

patternProperties:
  '^multi-led@[0-9a-f]$':
    type: object
    $ref: leds-class-multicolor.yaml#
    unevaluatedProperties: false

    properties:
      reg:
        minItems: 1
        maxItems: 12
        description:
          This property denotes the LED module number(s) that is used on the
          for the child node.  The LED modules can either be used stand alone
          or grouped into a module bank.

      '#address-cells':
        const: 1

      '#size-cells':
        const: 0

    patternProperties:
      "^led@[0-9a-f]+$":
        type: object
        $ref: common.yaml#

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/leds/common.h>

    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        led-controller@14 {
            compatible = "ti,lp5009";
            reg = <0x14>;
            #address-cells = <1>;
            #size-cells = <0>;
            enable-gpios = <&gpio1 16>;

            multi-led@1 {
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x1>;
                color = <LED_COLOR_ID_RGB>;
                function = LED_FUNCTION_CHARGING;

                led@0 {
                     reg = <0x0>;
                     color = <LED_COLOR_ID_RED>;
                };

                led@1 {
                     reg = <0x1>;
                     color = <LED_COLOR_ID_GREEN>;
                };

                led@2 {
                     reg = <0x2>;
                     color = <LED_COLOR_ID_BLUE>;
                };
            };

            multi-led@3 {
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x3>, <0x4>, <0x5>;
                color = <LED_COLOR_ID_RGB>;
                function = LED_FUNCTION_STANDBY;

                led@3 {
                    reg = <0x3>;
                    color = <LED_COLOR_ID_RED>;
                };

                led@4 {
                    reg = <0x4>;
                    color = <LED_COLOR_ID_GREEN>;
                };

                led@5 {
                    reg = <0x5>;
                    color = <LED_COLOR_ID_BLUE>;
                };
            };
        };
    };

...
