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

title: LEDs connected to tlc59116 or tlc59108

maintainers:
  - Andrew Lunn <andrew@lunn.ch>

properties:
  compatible:
    enum:
      - ti,tlc59108
      - ti,tlc59116

  reg:
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

patternProperties:
  "^led@[0-9a-f]$":
    type: object
    $ref: common.yaml#
    properties:
      reg:
        items:
          minimum: 0
          maximum: 15

    unevaluatedProperties: false

required:
  - compatible
  - reg
  - "#address-cells"
  - "#size-cells"

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: ti,tlc59108
    then:
      patternProperties:
        "^led@[0-9a-f]$":
          properties:
            reg:
              items:
                maximum: 7

additionalProperties: false

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

        led-controller@68 {
            compatible = "ti,tlc59116";
            reg = <0x68>;
            #address-cells = <1>;
            #size-cells = <0>;

            led@0 {
                reg = <0x0>;
                label = "wrt1900ac:amber:wan";
            };

            led@2 {
                reg = <0x2>;
                label = "wrt1900ac:white:2g";
            };

            led@9 {
                reg = <0x9>;
                label = "wrt1900ac:green:alive";
                linux,default-trigger = "heartbeat";
            };
        };
    };

