diff mbox series

[1/6] dt-bindings: regulator: qcom,spmi-regulator: Convert to dtschema

Message ID 20220515203118.474684-1-robimarko@gmail.com
State New
Headers show
Series [1/6] dt-bindings: regulator: qcom,spmi-regulator: Convert to dtschema | expand

Commit Message

Robert Marko May 15, 2022, 8:31 p.m. UTC
Convert the bindings of Qualcomm SPMI regulators to DT schema.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
I am aware that syscon alone is not really acceptable, its converted
directly from the old text bindings.

There is also the issue of some MSM8994, MSM8996 and APQ8096 devices using
'#address-cells', '#size-cells', some even defining reg property for
regulators.

Any advice on how to solve these issues is appreciated.
---
 .../regulator/qcom,spmi-regulator.yaml        | 176 ++++++++++++++++++
 1 file changed, 176 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml

Comments

Krzysztof Kozlowski May 17, 2022, 7:26 a.m. UTC | #1
On 15/05/2022 22:31, Robert Marko wrote:
> Convert the bindings of Qualcomm SPMI regulators to DT schema.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
> I am aware that syscon alone is not really acceptable, its converted
> directly from the old text bindings.
> 
> There is also the issue of some MSM8994, MSM8996 and APQ8096 devices using
> '#address-cells', '#size-cells', some even defining reg property for
> regulators.
> 
> Any advice on how to solve these issues is appreciated.
> ---
>  .../regulator/qcom,spmi-regulator.yaml        | 176 ++++++++++++++++++

You miss here the actual conversion... where is the removal of old file?

>  1 file changed, 176 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> new file mode 100644
> index 000000000000..f7da310f1845
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> @@ -0,0 +1,176 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/qcom,spmi-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm SPMI Regulators
> +
> +maintainers:
> +  - Robert Marko <robert.marko@sartura.hr>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,pm660-regulators
> +      - qcom,pm660l-regulators
> +      - qcom,pm8004-regulators
> +      - qcom,pm8005-regulators
> +      - qcom,pm8226-regulators
> +      - qcom,pm8841-regulators
> +      - qcom,pm8916-regulators
> +      - qcom,pm8941-regulators
> +      - qcom,pm8950-regulators
> +      - qcom,pm8994-regulators
> +      - qcom,pmi8994-regulators
> +      - qcom,pms405-regulators
> +
> +  qcom,saw-reg:
> +    description: Reference to syscon node defining the SAW registers
> +    $ref: "/schemas/types.yaml#/definitions/phandle"
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,pm8941-regulators
> +    then:
> +      properties:
> +        interrupts:
> +          items:
> +            - description: Over-current protection interrupt for 5V S1
> +            - description: Over-current protection interrupt for 5V S2
> +        interrupt-names:
> +          items:
> +            - const: ocp-5vs1
> +            - const: ocp-5vs2
> +
> +patternProperties:

This goes just after "properties:"

> +  ".*-supply$":
> +    description: Input supply phandle(s) for this node
> +    $ref: "/schemas/types.yaml#/definitions/phandle"
> +

Best regards,
Krzysztof
Robert Marko May 17, 2022, 11:40 a.m. UTC | #2
On Tue, 17 May 2022 at 09:26, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 15/05/2022 22:31, Robert Marko wrote:
> > Convert the bindings of Qualcomm SPMI regulators to DT schema.
> >
> > Signed-off-by: Robert Marko <robimarko@gmail.com>
> > ---
> > I am aware that syscon alone is not really acceptable, its converted
> > directly from the old text bindings.
> >
> > There is also the issue of some MSM8994, MSM8996 and APQ8096 devices using
> > '#address-cells', '#size-cells', some even defining reg property for
> > regulators.
> >
> > Any advice on how to solve these issues is appreciated.
> > ---
> >  .../regulator/qcom,spmi-regulator.yaml        | 176 ++++++++++++++++++
>
> You miss here the actual conversion... where is the removal of old file?

Hi,

Oh yeah, sorry for forgetting this.
Will fixup in v2.

>
> >  1 file changed, 176 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> > new file mode 100644
> > index 000000000000..f7da310f1845
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
> > @@ -0,0 +1,176 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/regulator/qcom,spmi-regulator.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Qualcomm SPMI Regulators
> > +
> > +maintainers:
> > +  - Robert Marko <robert.marko@sartura.hr>
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - qcom,pm660-regulators
> > +      - qcom,pm660l-regulators
> > +      - qcom,pm8004-regulators
> > +      - qcom,pm8005-regulators
> > +      - qcom,pm8226-regulators
> > +      - qcom,pm8841-regulators
> > +      - qcom,pm8916-regulators
> > +      - qcom,pm8941-regulators
> > +      - qcom,pm8950-regulators
> > +      - qcom,pm8994-regulators
> > +      - qcom,pmi8994-regulators
> > +      - qcom,pms405-regulators
> > +
> > +  qcom,saw-reg:
> > +    description: Reference to syscon node defining the SAW registers
> > +    $ref: "/schemas/types.yaml#/definitions/phandle"
> > +
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - qcom,pm8941-regulators
> > +    then:
> > +      properties:
> > +        interrupts:
> > +          items:
> > +            - description: Over-current protection interrupt for 5V S1
> > +            - description: Over-current protection interrupt for 5V S2
> > +        interrupt-names:
> > +          items:
> > +            - const: ocp-5vs1
> > +            - const: ocp-5vs2
> > +
> > +patternProperties:
>
> This goes just after "properties:"

Will fixup in v2.

Regards,
Robert
>
> > +  ".*-supply$":
> > +    description: Input supply phandle(s) for this node
> > +    $ref: "/schemas/types.yaml#/definitions/phandle"
> > +
>
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
new file mode 100644
index 000000000000..f7da310f1845
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
@@ -0,0 +1,176 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/qcom,spmi-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SPMI Regulators
+
+maintainers:
+  - Robert Marko <robert.marko@sartura.hr>
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm660-regulators
+      - qcom,pm660l-regulators
+      - qcom,pm8004-regulators
+      - qcom,pm8005-regulators
+      - qcom,pm8226-regulators
+      - qcom,pm8841-regulators
+      - qcom,pm8916-regulators
+      - qcom,pm8941-regulators
+      - qcom,pm8950-regulators
+      - qcom,pm8994-regulators
+      - qcom,pmi8994-regulators
+      - qcom,pms405-regulators
+
+  qcom,saw-reg:
+    description: Reference to syscon node defining the SAW registers
+    $ref: "/schemas/types.yaml#/definitions/phandle"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,pm8941-regulators
+    then:
+      properties:
+        interrupts:
+          items:
+            - description: Over-current protection interrupt for 5V S1
+            - description: Over-current protection interrupt for 5V S2
+        interrupt-names:
+          items:
+            - const: ocp-5vs1
+            - const: ocp-5vs2
+
+patternProperties:
+  ".*-supply$":
+    description: Input supply phandle(s) for this node
+    $ref: "/schemas/types.yaml#/definitions/phandle"
+
+  "^((s|l|lvs|5vs)[0-9]*)$":
+    description: List of regulators and its properties
+    $ref: regulator.yaml#
+
+    properties:
+      qcom,ocp-max-retries:
+        description:
+          Maximum number of times to try toggling a voltage switch off and
+          back on as a result of consecutive over current events
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+
+      qcom,ocp-retry-delay:
+        description:
+          Time to delay in milliseconds between each voltage switch toggle
+          after an over current event takes place
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+
+      qcom,pin-ctrl-enable:
+        description:
+          Bit mask specifying which hardware pins should be used to enable the
+          regulator, if any.
+          Supported bits are
+          0 = ignore all hardware enable signals
+          BIT(0) = follow HW0_EN signal
+          BIT(1) = follow HW1_EN signal
+          BIT(2) = follow HW2_EN signal
+          BIT(3) = follow HW3_EN signal
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+        minimum: 0
+        maximum: 15
+
+      qcom,pin-ctrl-hpm:
+        description:
+          Bit mask specifying which hardware pins should be used to force the
+          regulator into high power mode, if any.
+          Supported bits are
+          0 = ignore all hardware enable signals
+          BIT(0) = follow HW0_EN signal
+          BIT(1) = follow HW1_EN signal
+          BIT(2) = follow HW2_EN signal
+          BIT(3) = follow HW3_EN signal
+          BIT(4) = follow PMIC awake state
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+        minimum: 0
+        maximum: 31
+
+      qcom,vs-soft-start-strength:
+        description:
+          This property sets the soft start strength for voltage switch type
+          regulators.
+          Supported values are
+          0 = 0.05 uA
+          1 = 0.25 uA
+          2 = 0.55 uA
+          3 = 0.75 uA
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+        minimum: 0
+        maximum: 3
+
+      qcom,saw-slave:
+        description: SAW controlled gang slave. Will not be configured.
+        type: boolean
+
+      qcom,saw-leader:
+        description:
+          SAW controlled gang leader. Will be configured as SAW regulator.
+        type: boolean
+
+      unevaluatedProperties: false
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+
+examples:
+  - |
+    regulators {
+      compatible = "qcom,pm8941-regulators";
+      vdd_l1_l3-supply = <&s1>;
+
+      s1: s1 {
+        regulator-min-microvolt = <1300000>;
+        regulator-max-microvolt = <1400000>;
+      };
+
+      l1: l1 {
+        regulator-min-microvolt = <1225000>;
+        regulator-max-microvolt = <1300000>;
+      };
+    };
+
+  - |
+    saw3: syscon@9a10000 {
+      compatible = "syscon";
+      reg = <0x9a10000 0x1000>;
+    };
+
+    regulators {
+      compatible = "qcom,pm8994-regulators";
+      qcom,saw-reg = <&saw3>;
+
+      s8 {
+        qcom,saw-slave;
+      };
+
+      s9 {
+        qcom,saw-slave;
+      };
+
+      s10 {
+        qcom,saw-slave;
+      };
+
+      pm8994_s11_saw: s11 {
+        qcom,saw-leader;
+        regulator-always-on;
+        regulator-min-microvolt = <900000>;
+        regulator-max-microvolt = <1140000>;
+      };
+    };
+...