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

title: Qualcomm RPM regulator

description:
  The Qualcomm RPM regulator is modelled as a subdevice of the RPM.

  Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,rpm.yaml
  for information regarding the RPM node.

  The regulator node houses sub-nodes for each regulator within the device.
  Each sub-node is identified using the node's name, with valid values listed
  for each of the pmics below.

  For pm8058 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15,
  l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, s0, s1, s2, s3, s4,
  lvs0, lvs1, ncp

  For pm8901 l0, l1, l2, l3, l4, l5, l6, s0, s1, s2, s3, s4, lvs0, lvs1, lvs2, lvs3,
  mvs

  For pm8921 s1, s2, s3, s4, s7, s8, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
  l12, l14, l15, l16, l17, l18, l21, l22, l23, l24, l25, l26, l27, l28,
  l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch,
  ncp

  For pm8018 s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
  l12, l14, lvs1

  For smb208 s1a, s1b, s2a, s2b

maintainers:
  - Bjorn Andersson <andersson@kernel.org>

properties:
  compatible:
    enum:
      - qcom,rpm-pm8058-regulators
      - qcom,rpm-pm8901-regulators
      - qcom,rpm-pm8921-regulators
      - qcom,rpm-pm8018-regulators
      - qcom,rpm-smb208-regulators

patternProperties:
  ".*-supply$":
    description: Input supply phandle(s) for this node

  "^((s|l|lvs)[0-9]*|s[1-2][a-b]|ncp|mvs|usb-switch|hdmi-switch)$":
    description: List of regulators and its properties
    $ref: regulator.yaml#
    unevaluatedProperties: false
    properties:
      bias-pull-down:
        description: enable pull down of the regulator when inactive
        type: boolean

      qcom,switch-mode-frequency:
        description: Frequency (Hz) of the switch-mode power supply
        $ref: /schemas/types.yaml#/definitions/uint32
        enum:
          - 19200000
          - 9600000
          - 6400000
          - 4800000
          - 3840000
          - 3200000
          - 2740000
          - 2400000
          - 2130000
          - 1920000
          - 1750000
          - 1600000
          - 1480000
          - 1370000
          - 1280000
          - 1200000

      qcom,force-mode:
        description: Indicates that the regulator should be forced to a particular mode
        $ref: /schemas/types.yaml#/definitions/uint32
        enum:
          - 0 # QCOM_RPM_FORCE_MODE_NONE do not force any mode
          - 1 # QCOM_RPM_FORCE_MODE_LPM force into low power mode
          - 2 # QCOM_RPM_FORCE_MODE_HPM force into high power mode
          - 3 # QCOM_RPM_FORCE_MODE_AUTO allow regulator to automatically select its own mode
              # based on realtime current draw, only for pm8921 smps and ftsmps

      qcom,power-mode-hysteretic:
        description: select that the power supply should operate in hysteretic mode,
          instead of the default pwm mode
        type: boolean

additionalProperties: false

required:
  - compatible

examples:
  - |
    #include <dt-bindings/mfd/qcom-rpm.h>
    regulators {
      compatible = "qcom,rpm-pm8921-regulators";
      vdd_l1_l2_l12_l18-supply = <&pm8921_s4>;

      s1 {
        regulator-min-microvolt = <1225000>;
        regulator-max-microvolt = <1225000>;

        bias-pull-down;

        qcom,switch-mode-frequency = <3200000>;
      };

      pm8921_s4: s4 {
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;

        qcom,switch-mode-frequency = <1600000>;
        bias-pull-down;

        qcom,force-mode = <QCOM_RPM_FORCE_MODE_AUTO>;
      };
    };
...