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

title: Maxim MAX77693 MicroUSB and Companion Power Management IC LEDs

maintainers:
  - Krzysztof Kozlowski <krzk@kernel.org>

description: |
  This is a part of device tree bindings for Maxim MAX77693 MicroUSB Integrated
  Circuit (MUIC).

  There are two LED outputs available - FLED1 and FLED2. Each of them can
  control a separate LED or they can be connected together to double the
  maximum current for a single connected LED. One LED is represented by one
  child node.

  See also Documentation/devicetree/bindings/mfd/maxim,max77693.yaml for
  additional information and example.

properties:
  compatible:
    const: maxim,max77693-led

  maxim,boost-mode:
    description:
      In boost mode the device can produce up to 1.2A of total current on both
      outputs. The maximum current on each output is reduced to 625mA then. If
      not enabled explicitly, boost setting defaults to LEDS_BOOST_FIXED in
      case both current sources are used.
      See LEDS_BOOST_* in include/dt-bindings/leds/common.h.
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [0, 1, 2]

  maxim,boost-mvout:
    description: |
      Output voltage of the boost module in millivolts.
      Valid values: 3300 - 5500, step by 25 (rounded down)
    $ref: /schemas/types.yaml#/definitions/uint32
    minimum: 3300
    maximum: 5500
    default: 3300

  maxim,mvsys-min:
    description: |
      Low input voltage level in millivolts. Flash is not fired if chip
      estimates that system voltage could drop below this level due to flash
      power consumption.
      Valid values: 2400 - 3400, step by 33 (rounded down)
    $ref: /schemas/types.yaml#/definitions/uint32
    minimum: 2400
    maximum: 3400
    default: 2400

patternProperties:
  "^([a-z]+-)?led[01]?$":
    type: object
    $ref: common.yaml#
    unevaluatedProperties: false

    properties:
      led-sources:
        allOf:
          - minItems: 1
            maxItems: 2
            items:
              minimum: 0
              maximum: 1

      led-max-microamp:
        description: |
          Valid values for a LED connected to one FLED output:
            15625 - 250000, step by 15625 (rounded down)
          Valid values for a LED connected to both FLED outputs:
            15625 - 500000, step by 15625 (rounded down)

      flash-max-microamp:
        description: |
          Valid values for a single LED connected to one FLED output
          (boost mode must be turned off):
            15625 - 1000000, step by 15625 (rounded down)
          Valid values for a single LED connected to both FLED outputs:
            15625 - 1250000, step by 15625 (rounded down)
          Valid values for two LEDs case:
            15625 - 625000, step by 15625 (rounded down)

      flash-max-timeout-us:
        description: |
          Valid values: 62500 - 1000000, step by 62500 (rounded down)
        minimum: 62500
        maximum: 1000000

    required:
      - flash-max-microamp
      - flash-max-timeout-us
      - led-max-microamp
      - led-sources

required:
  - compatible

additionalProperties: false