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

title: MediaTek MT6316 BP/VP SPMI PMIC Regulators

maintainers:
  - AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

description:
  The MediaTek MT6316BP/VP PMICs are fully controlled by SPMI interface, both
  feature four step-down DC/DC (buck) converters, and provides 2+2 Phases,
  joining Buck 1+2 for the first phase, and Buck 3+4 for the second phase.

properties:
  compatible:
    const: mediatek,mt6316b-regulator

  reg:
    maxItems: 1

patternProperties:
  "^vbuck(12|34)$":
    type: object
    $ref: regulator.yaml#
    unevaluatedProperties: false
    properties:
      regulator-allowed-modes:
        description: |
          Allowed Buck regulator operating modes allowed. Valid values below.
            0 - Normal mode with automatic power saving, reducing the switching
                frequency when light load conditions are detected
            1 - Forced Continuous Conduction mode (FCCM) for improved voltage
                regulation accuracy with constant switching frequency but lower
                regulator efficiency
            2 - Forced Low Power mode for improved regulator efficiency, used
                when no heavy load is expected, will shut down unnecessary IP
                blocks and secondary phases to reduce quiescent current.
                This mode does not limit the maximum output current but unless
                only a light load is applied, there will be regulation accuracy
                and efficiency losses.
        minItems: 1
        maxItems: 3
        items:
          enum: [ 0, 1, 2 ]

required:
  - compatible
  - reg

additionalProperties: false

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

    spmi {
      #address-cells = <2>;
      #size-cells = <0>;

      pmic@8 {
        compatible = "mediatek,mt6316b-regulator";
        reg = <0x8 SPMI_USID>;

        vbuck12 {
          regulator-name = "dvdd_core";
          regulator-min-microvolt = <450000>;
          regulator-max-microvolt = <965000>;
          regulator-allowed-modes = <0 1 2>;
          regulator-enable-ramp-delay = <256>;
        };
      };
    };
...
