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

title: TI TPS6586x family of regulators

maintainers:
  - Thierry Reding <thierry.reding@avionic-design.de>

properties:
  compatible:
    const: ti,tps6586x

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  "#gpio-cells":
    const: 2

  gpio-controller: true

  sys-supply:
    description: The input supply for SYS.

  ti,system-power-controller:
    type: boolean
    description:
      Whether or not this PMIC is controlling the system power.

  regulators:
    type: object
    additionalProperties: false
    description:
      list of regulators provided by this controller, LDO5 and LDO_RTC is
      supplied by SYS regulator internally and driver take care of making
      proper parent child relationship.

    properties:
      sys:
        type: object
        $ref: regulator.yaml#
        unevaluatedProperties: false

    patternProperties:
      "^ldo([0-9]|_rtc)$":
        type: object
        allOf:
          - $ref: /schemas/regulator/regulator.yaml#
          - $ref: /schemas/regulator/nvidia,tegra-regulators-coupling.yaml#
        unevaluatedProperties: false

      "^sm[0-2]$":
        type: object
        allOf:
          - $ref: /schemas/regulator/regulator.yaml#
          - $ref: /schemas/regulator/nvidia,tegra-regulators-coupling.yaml#
        unevaluatedProperties: false

patternProperties:
  "^vin-sm[0-2]-supply$":
    description: The input supply for the corresponding SM (SM0, SM1, or SM2).

  "^vinldo(01|23|4|678|9)-supply$":
    description: The input supply for the corresponding LDO or group of LDOs.

required:
  - compatible
  - reg
  - interrupts
  - regulators
  - "#gpio-cells"
  - gpio-controller
  - sys-supply
  - vin-sm0-supply
  - vin-sm1-supply
  - vin-sm2-supply
  - vinldo01-supply
  - vinldo23-supply
  - vinldo4-supply
  - vinldo678-supply
  - vinldo9-supply

additionalProperties: false

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

      pmic@34 {
          compatible = "ti,tps6586x";
          reg = <0x34>;
          interrupts = <0 88 0x4>;

          #gpio-cells = <2>;
          gpio-controller;

          ti,system-power-controller;

          sys-supply = <&vdd_5v0_sys>;
          vin-sm0-supply = <&sys_reg>;
          vin-sm1-supply = <&sys_reg>;
          vin-sm2-supply = <&sys_reg>;
          vinldo01-supply = <&sm2_reg>;
          vinldo23-supply = <&sm2_reg>;
          vinldo4-supply = <&sm2_reg>;
          vinldo678-supply = <&sm2_reg>;
          vinldo9-supply = <&sm2_reg>;

          regulators {
              sys {
                  regulator-name = "vdd_sys";
                  regulator-boot-on;
                  regulator-always-on;
              };

              sm0 {
                  regulator-min-microvolt = < 725000>;
                  regulator-max-microvolt = <1500000>;
                  regulator-boot-on;
                  regulator-always-on;
              };

              sm1 {
                  regulator-min-microvolt = < 725000>;
                  regulator-max-microvolt = <1500000>;
                  regulator-boot-on;
                  regulator-always-on;
              };

              sm2 {
                  regulator-min-microvolt = <3000000>;
                  regulator-max-microvolt = <4550000>;
                  regulator-boot-on;
                  regulator-always-on;
              };

              ldo0 {
                  regulator-name = "PCIE CLK";
                  regulator-min-microvolt = <3300000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo1 {
                  regulator-min-microvolt = < 725000>;
                  regulator-max-microvolt = <1500000>;
              };

              ldo2 {
                  regulator-min-microvolt = < 725000>;
                  regulator-max-microvolt = <1500000>;
              };

              ldo3 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo4 {
                  regulator-min-microvolt = <1700000>;
                  regulator-max-microvolt = <2475000>;
              };

              ldo5 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo6 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo7 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo8 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };

              ldo9 {
                  regulator-min-microvolt = <1250000>;
                  regulator-max-microvolt = <3300000>;
              };
          };
      };
    };