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

title: Analog Devices MAX20830 Step-Down Switching Regulator with PMBus

maintainers:
  - Alexis Czezar Torreno <alexisczezar.torreno@analog.com>

description: |
  The MAX20830 is a fully integrated step-down DC-DC switching regulator with
  PMBus interface. It provides 2.7V to 16V input, 0.4V to 5.8V adjustable
  output, and up to 30A output current. It allows monitoring of input/output
  voltage, output current and temperature through the PMBus serial interface.
  Datasheet:
    https://www.analog.com/en/products/max20830.html

allOf:
  - $ref: /schemas/regulator/regulator.yaml#

properties:
  compatible:
    oneOf:
      - const: adi,max20830
      - items:
          - enum:
              - adi,max20830c
              - adi,max20840c
          - const: adi,max20830

  reg:
    maxItems: 1

  vddh-supply:
    description:
      Phandle to the regulator that provides the VDDH power supply.

  avdd-supply:
    description:
      Phandle to the regulator that provides the AVDD power supply.

  ldoin-supply:
    description:
      Optional 2.5V to 5.5V LDO input supply.

  pwr-good-gpios:
    description:
      GPIO connected to the power-good status output pin.
    maxItems: 1

  adi,vout-rfb1-ohms:
    description:
      Top feedback resistor (RFB1) value in ohms for VOUT sensing divider.
      When the desired output voltage is higher than VREF, a resistor divider
      is required. VOUT = VREF × (1 + RFB1/RFB2)

  adi,vout-rfb2-ohms:
    description:
      Bottom feedback resistor (RFB2) value in ohms for VOUT sensing divider.
      Datasheet recommends that RFB2 does not exceed 2.5kΩ.

required:
  - compatible
  - reg
  - vddh-supply

dependencies:
  adi,vout-rfb1-ohms: ['adi,vout-rfb2-ohms']
  adi,vout-rfb2-ohms: ['adi,vout-rfb1-ohms']

unevaluatedProperties: false

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

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

        regulator@30 {
            compatible = "adi,max20830";
            reg = <0x30>;
            vddh-supply = <&vddh>;
            avdd-supply = <&avdd>;
            ldoin-supply = <&ldoin>;
            pwr-good-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
            adi,vout-rfb1-ohms = <10000>;
            adi,vout-rfb2-ohms = <2000>;
        };
    };
...