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

title: Texas Instruments - LM3692x Highly Efficient White LED Driver

maintainers:
  - Dan Murphy <dmurphy@ti.com>

description: |
  The LM3692x is an ultra-compact, highly efficient,
  white-LED driver designed for LCD display backlighting.

  The main difference between the LM36922 and LM36923 is the number of
  LED strings it supports. The LM36922 supports two strings while the LM36923
  supports three strings.

  For more product information please see the link below:
  https://www.ti.com/lit/ds/snvsa29/snvsa29.pdf

properties:
  compatible:
    enum:
      - ti,lm36922
      - ti,lm36923

  reg:
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

  enable-gpios:
    description: gpio pin to enable/disable the device.

  vled-supply:
    description: LED supply

  ti,ovp-microvolt:
    description: Overvoltage protection.
    default: 29000000
    enum: [17000000, 21000000, 25000000, 29000000]

patternProperties:
  '^led@[0-3]$':
    type: object
    $ref: common.yaml
    properties:
      reg:
        enum: [0, 1, 2, 3]
        description: |
          0 - Will enable all LED sync paths
          1 - Will enable the LED1 sync
          2 - Will enable the LED2 sync
          3 - Will enable the LED3 sync (LM36923 only)

    unevaluatedProperties: false

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

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: ti,lm36922
    then:
      properties:
        led@3: false

additionalProperties: false

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

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

        led-controller@36 {
            compatible = "ti,lm36922";
            reg = <0x36>;
            #address-cells = <1>;
            #size-cells = <0>;

            enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
            vled-supply = <&vbatt>;
            ti,ovp-microvolt = <29000000>;

            led@0 {
                reg = <0>;
                function = LED_FUNCTION_BACKLIGHT;
                color = <LED_COLOR_ID_WHITE>;
                linux,default-trigger = "backlight";
                led-max-microamp = <20000>;
            };
        };
    };

