# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/qcom,usb-vbus-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: The Qualcomm PMIC VBUS output regulator driver

maintainers:
  - Wesley Cheng <quic_wcheng@quicinc.com>

description: |
  This regulator driver controls the VBUS output by the Qualcomm PMIC.  This
  regulator will be enabled in situations where the device is required to
  provide power to the connected peripheral.

  The pm8150b variant uses an OTG current-limit selector, supporting limits
  of 500 mA, 1000 mA, 1500 mA, 2000 mA, 2500 mA and 3000 mA.

  The pm4125 variant uses a different register layout with a 2-bit VBOOST
  voltage selector supporting output voltages of 4.25 V, 4.5 V, 4.75 V
  and 5.0 V.

properties:
  compatible:
    oneOf:
      - enum:
          - qcom,pm8150b-vbus-reg
          - qcom,pm4125-vbus-reg
      - items:
          - enum:
              - qcom,pm6150-vbus-reg
              - qcom,pm7250b-vbus-reg
              - qcom,pmi632-vbus-reg
          - const: qcom,pm8150b-vbus-reg

  reg:
    maxItems: 1
    description: VBUS output base address

allOf:
  - $ref: regulator.yaml#
  - if:
      properties:
        compatible:
          contains:
            enum:
              - qcom,pm8150b-vbus-reg
              - qcom,pm6150-vbus-reg
              - qcom,pm7250b-vbus-reg
              - qcom,pmi632-vbus-reg
    then:
      required:
        - regulator-min-microamp
        - regulator-max-microamp

  - if:
      properties:
        compatible:
          contains:
            const: qcom,pm4125-vbus-reg
    then:
      required:
        - regulator-min-microvolt
        - regulator-max-microvolt

required:
  - compatible
  - reg

unevaluatedProperties: false

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

        usb-vbus-regulator@1100 {
            compatible = "qcom,pm8150b-vbus-reg";
            reg = <0x1100>;
            regulator-min-microamp = <500000>;
            regulator-max-microamp = <3000000>;
        };
     };
  - |
     pmic {
        #address-cells = <1>;
        #size-cells = <0>;

        usb-vbus-regulator@1100 {
            compatible = "qcom,pm4125-vbus-reg";
            reg = <0x1100>;
            regulator-min-microvolt = <4250000>;
            regulator-max-microvolt = <5000000>;
        };
     };
...