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

title: Monolithic Power Systems MPQ4210 buck-boost regulator

maintainers:
  - Tapio Reijonen <tapio.reijonen@vaisala.com>

description:
  The MPQ4210 is a synchronous four-switch buck-boost controller with an I2C
  interface. The output voltage is programmed through an 11-bit feedback
  reference DAC and scaled by an external feedback resistor divider.

  The controller ramps the feedback reference at 38, 50, 75 or 150 mV/ms.
  The divider scales the ramp rate along with the voltage, so the output
  ramp rates that regulator-ramp-delay can select are those values
  multiplied by (R1 + R2) / R2.

allOf:
  - $ref: regulator.yaml#

properties:
  compatible:
    const: mps,mpq4210

  reg:
    maxItems: 1

  enable-gpios:
    description: GPIO connected to the EN pin. If absent, EN is assumed to
      be permanently asserted.
    maxItems: 1

  mps,fb-voltage-divider-ohms:
    description: An array of two integers containing the resistor values R1
      and R2 of the output feedback voltage divider.
    maxItems: 2

required:
  - compatible
  - reg
  - mps,fb-voltage-divider-ohms

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        regulator@64 {
            compatible = "mps,mpq4210";
            reg = <0x64>;
            regulator-name = "vout";
            regulator-min-microvolt = <4000000>;
            regulator-max-microvolt = <20000000>;
            enable-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
            /* R1 = 82 kOhm, R2 = 9.1 kOhm */
            mps,fb-voltage-divider-ohms = <82000 9100>;
            /* 50 mV/ms reference ramp x (82000 + 9100) / 9100 */
            regulator-ramp-delay = <500>;
        };
    };