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

title: Analog Devices AS3645A LED Controller

maintainers:
  - Sakari Ailus <sakari.ailus@iki.fi>

description:
  The AS3645A flash LED controller can drive two LEDs, one
  high current flash LED and one indicator LED. The high
  current flash LED can be used in torch mode as well.

properties:
  compatible:
    const: ams,as3645a

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

  reg:
    maxItems: 1

  led@0:
    description: led0 describes the 'flash' feature
    type: object
    $ref: common.yaml#
    unevaluatedProperties: false

    properties:
      reg:
        const: 0

      flash-timeout-us:
        minimum: 100000
        maximum: 850000
        multipleOf: 50000

      flash-max-microamp:
        minimum: 200000
        maximum: 500000
        multipleOf: 20000

      led-max-microamp:
        minimum: 20000
        maximum: 160000
        multipleOf: 20000
        description:
          Maximum current when in torch (assist) mode.

      ams,input-max-microamp:
        minimum: 1250000
        maximum: 2000000
        multipleOf: 50000

    required:
      - reg
      - flash-timeout-us
      - flash-max-microamp
      - led-max-microamp
      - ams,input-max-microamp

  led@1:
    description: led1 describes the 'indicator' feature
    type: object
    $ref: common.yaml#
    unevaluatedProperties: false

    properties:
      reg:
        const: 1

      led-max-microamp:
        enum:
          - 2500
          - 5000
          - 7500
          - 10000
        description:
          Maximum indicator current.

    required:
      - reg
      - led-max-microamp

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

additionalProperties: false

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

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

        led-controller@30 {
            compatible = "ams,as3645a";
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <0x30>;

            led@0 {
                reg = <0>;
                flash-timeout-us = <150000>;
                flash-max-microamp = <320000>;
                led-max-microamp = <60000>;
                ams,input-max-microamp = <1750000>;
                function = LED_FUNCTION_FLASH;
            };

            led@1 {
                reg = <1>;
                led-max-microamp = <10000>;
                function = LED_FUNCTION_INDICATOR;
            };
        };
    };
...
