Skip to contentSkip to conversation

dt-bindings: regulator: lltc,ltc3676: convert to YAML

PATCH Superseded Marek Vasut 2 participants 5 messages Oct 15, 2024 – Oct 17, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: regulator: lltc,ltc3676: convert to YAML

Convert Linear Technology LTC3676 8-output I2C voltage regulator IC DT bindings to YAML DT. Add missing interrupts: property as this IC does have interrupt line and it is used in existing DTs.

---
Cc: Conor Dooley <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 .../bindings/regulator/lltc,ltc3676.yaml      | 171 ++++++++++++++++++
 .../devicetree/bindings/regulator/ltc3676.txt |  94 ----------
 2 files changed, 171 insertions(+), 94 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/ltc3676.txt
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +171 -0
new file mode 100644
index 0000000000000..ec9ce856a944d
@@ -0,0 +1,171 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Linear Technology LTC3676 8-output regulators
+
+maintainers:
+  - Tim Harvey <[email protected]>
+
+description: |
+  LTC3676 contains eight regulators, 4 switching SW1..SW4 and four LDO1..4 .
+
+properties:
+  compatible:
+    const: lltc,ltc3676
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description: |
+      List of regulators provided by this controller, must be named
+      after their hardware counterparts (SW|LDO)[1-4].
+
+    patternProperties:
+      "^(sw[1-4]|ldo[24])$":
+        type: object
+        $ref: regulator.yaml#
+        description:
+          Properties for single SW or LDO regulator. Regulators SW1..SW4 can
+          regulate the feedback reference from 412.5mV to 800mV in 12.5 mV
+          steps. The output voltage thus ranges between 0.4125 * (1 + R1/R2) V
+          and 0.8 * (1 + R1/R2) V.
+          Regulators LDO1, LDO2, LDO4 have a fixed 0.725 V reference and thus
+          output 0.725 * (1 + R1/R2) V.
+          The LDO1 standby regulator can not be disabled and thus should have
+          the regulator-always-on property set.
+
+        properties:
+          lltc,fb-voltage-divider:
+            description:
+              An array of two integers containing the resistor values
+              R1 and R2 of the feedback voltage divider in ohms.
+            $ref: /schemas/types.yaml#/definitions/uint32-array
+            minItems: 2
+            maxItems: 2
+
+        required:
+          - lltc,fb-voltage-divider
+
+        unevaluatedProperties: false
+
+    properties:
+      ldo1:
+        type: object
+        $ref: regulator.yaml#
+        description:
+          The LDO1 standby regulator can not be disabled and thus should
+          have the regulator-always-on property set. See patternProperties
+          description above for the rest of the details.
+
+        properties:
+          lltc,fb-voltage-divider:
+            description:
+              An array of two integers containing the resistor values
+              R1 and R2 of the feedback voltage divider in ohms.
+            $ref: /schemas/types.yaml#/definitions/uint32-array
+            minItems: 2
+            maxItems: 2
+
+        required:
+          - lltc,fb-voltage-divider
+          - regulator-always-on
+
+        unevaluatedProperties: false
+
+      ldo3:
+        type: object
+        $ref: regulator.yaml#
+        description:
+          The LDO3 regulator is fixed to 1.8 V. See patternProperties
+          description above for the rest of the details.
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@3c {
+            compatible = "lltc,ltc3676";
+            reg = <0x3c>;
+
+            regulators {
+                sw1_reg: sw1 {
+                    regulator-min-microvolt = <674400>;
+                    regulator-max-microvolt = <1308000>;
+                    lltc,fb-voltage-divider = <127000 200000>;
+                    regulator-ramp-delay = <7000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+
+                sw2_reg: sw2 {
+                    regulator-min-microvolt = <1033310>;
+                    regulator-max-microvolt = <200400>;
+                    lltc,fb-voltage-divider = <301000 200000>;
+                    regulator-ramp-delay = <7000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+
+                sw3_reg: sw3 {
+                    regulator-min-microvolt = <674400>;
+                    regulator-max-microvolt = <130800>;
+                    lltc,fb-voltage-divider = <127000 200000>;
+                    regulator-ramp-delay = <7000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+
+                sw4_reg: sw4 {
+                    regulator-min-microvolt = <868310>;
+                    regulator-max-microvolt = <168400>;
+                    lltc,fb-voltage-divider = <221000 200000>;
+                    regulator-ramp-delay = <7000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+
+                ldo2_reg: ldo2 {
+                    regulator-min-microvolt = <2490375>;
+                    regulator-max-microvolt = <2490375>;
+                    lltc,fb-voltage-divider = <487000 200000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+
+                ldo3_reg: ldo3 {
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-boot-on;
+                };
+
+                ldo4_reg: ldo4 {
+                    regulator-min-microvolt = <3023250>;
+                    regulator-max-microvolt = <3023250>;
+                    lltc,fb-voltage-divider = <634000 200000>;
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
+            };
+        };
+    };
Documentation/devicetree/bindings/regulator/ltc3676.txt deleted +0 -94

94 lines not on this page · raw message

Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 43 lines · Marek Vasut

Convert Linear Technology LTC3676 8-output I2C voltage regulator IC DT bindings to YAML DT. Add missing interrupts: property as this IC does have interrupt line and it is used in existing DTs.

---
Cc: Conor Dooley <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 .../bindings/regulator/lltc,ltc3676.yaml      | 171 ++++++++++++++++++
 .../devicetree/bindings/regulator/ltc3676.txt |  94 ----------
 2 files changed, 171 insertions(+), 94 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/ltc3676.txt
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +16 -0
new file mode 100644
index 0000000000000..ec9ce856a944d
@@ -0,0 +1,171 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Linear Technology LTC3676 8-output regulators
+
+maintainers:
+  - Tim Harvey <[email protected]>
+
+description: |
+  LTC3676 contains eight regulators, 4 switching SW1..SW4 and four LDO1..4 .
+
+properties:
+  compatible:

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +10 -0
+    const: lltc,ltc3676
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    type: object

Move the additionalProperties:false here.

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml line 34

Quoted 8 lines
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +8 -0
+    description: |
+      List of regulators provided by this controller, must be named
+      after their hardware counterparts (SW|LDO)[1-4].
+
+    patternProperties:
+      "^(sw[1-4]|ldo[24])$":
+        type: object
+        $ref: regulator.yaml#

Move the unevaluatedProperties here, ditto in other places.

Best regards,
Krzysztof

#2 lore raw
Quoted 66 lines · Krzysztof Kozlowski
Quoted 43 lines · Marek Vasut

Convert Linear Technology LTC3676 8-output I2C voltage regulator IC DT bindings to YAML DT. Add missing interrupts: property as this IC does have interrupt line and it is used in existing DTs.

---
Cc: Conor Dooley <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  .../bindings/regulator/lltc,ltc3676.yaml      | 171 ++++++++++++++++++
  .../devicetree/bindings/regulator/ltc3676.txt |  94 ----------
  2 files changed, 171 insertions(+), 94 deletions(-)

create mode 100644 Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml delete mode 100644 Documentation/devicetree/bindings/regulator/ltc3676.txt

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +16 -0
new file mode 100644
index 0000000000000..ec9ce856a944d
@@ -0,0 +1,171 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Linear Technology LTC3676 8-output regulators
+
+maintainers:
+  - Tim Harvey <[email protected]>
+
+description: |
+  LTC3676 contains eight regulators, 4 switching SW1..SW4 and four LDO1..4 .
+
+properties:
+  compatible:

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +10 -0
+    const: lltc,ltc3676
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    type: object

Move the additionalProperties:false here.

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml line 34

Quoted 8 lines
Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml new file +8 -0
+    description: |
+      List of regulators provided by this controller, must be named
+      after their hardware counterparts (SW|LDO)[1-4].
+
+    patternProperties:
+      "^(sw[1-4]|ldo[24])$":
+        type: object
+        $ref: regulator.yaml#
Quoted 1 line

Move the unevaluatedProperties here, ditto in other places.

Fixed in V2.

I wanted to ask though, there are these patternProperties here which cover sw1..4 and ldo2 and ldo4, and then there is dedicated special case for ldo1 (because this LDO node must always contain regulator-always-on property) and ldo3 (because this LDO node must NOT contain lltc,fb-voltage-divider property). Is there any way to place all the sw1..4 and ldo1..4 into patternProperties, and then selectively DISABLE lltc,fb-voltage-divider requirement for LDO3 and ENABLE regulator-always-on for LDO1 ? I was looking at allOf:if: , but couldn't find anything.

Thanks !

#3 lore raw
Quoted 10 lines · Marek Vasut

I wanted to ask though, there are these patternProperties here which cover sw1..4 and ldo2 and ldo4, and then there is dedicated special case for ldo1 (because this LDO node must always contain regulator-always-on property) and ldo3 (because this LDO node must NOT contain lltc,fb-voltage-divider property). Is there any way to place all the sw1..4 and ldo1..4 into patternProperties, and then selectively DISABLE lltc,fb-voltage-divider requirement for LDO3 and ENABLE regulator-always-on for LDO1 ? I was looking at allOf:if: , but couldn't find anything.

Maybe this would work:

    patternPropeties:
      "^(sw[1-4]|ldo[1-4])$":
         ......
         ......
         allOf:
           - if:
             $nodename:
               const: ldo3
             then:
               ...

but I am not sure if this would be readable and beneficial. Current code is OK.

Best regards,
Krzysztof

#4 lore raw
Quoted 24 lines · Krzysztof Kozlowski
Quoted 10 lines · Marek Vasut

I wanted to ask though, there are these patternProperties here which cover sw1..4 and ldo2 and ldo4, and then there is dedicated special case for ldo1 (because this LDO node must always contain regulator-always-on property) and ldo3 (because this LDO node must NOT contain lltc,fb-voltage-divider property). Is there any way to place all the sw1..4 and ldo1..4 into patternProperties, and then selectively DISABLE lltc,fb-voltage-divider requirement for LDO3 and ENABLE regulator-always-on for LDO1 ? I was looking at allOf:if: , but couldn't find anything.

Maybe this would work:

     patternPropeties:
       "^(sw[1-4]|ldo[1-4])$":
          ......
          ......
          allOf:
            - if:
              $nodename:
                const: ldo3
              then:
                ...
Quoted 2 lines

but I am not sure if this would be readable and beneficial. Current code is OK.

I was hoping for something like this:
"

Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml +17 -31
index f47eacf96cd67..4fd5c7dd509dd 100644
@@ -30,7 +30,7 @@ properties:
       after their hardware counterparts (SW|LDO)[1-4].
 
     patternProperties:
-      "^(sw[1-4]|ldo[24])$":
+      "^(sw[1-4]|ldo[1-4])$":
         type: object
         unevaluatedProperties: false
         $ref: regulator.yaml#
@@ -56,36 +56,22 @@ properties:
         required:
           - lltc,fb-voltage-divider
 
-    properties:
-      ldo1:
-        type: object
-        unevaluatedProperties: false
-        $ref: regulator.yaml#
-        description:
-          The LDO1 standby regulator can not be disabled and thus should
-          have the regulator-always-on property set. See patternProperties
-          description above for the rest of the details.
-
-        properties:
-          lltc,fb-voltage-divider:
-            description:
-              An array of two integers containing the resistor values
-              R1 and R2 of the feedback voltage divider in ohms.
-            $ref: /schemas/types.yaml#/definitions/uint32-array
-            minItems: 2
-            maxItems: 2
-
-        required:
-          - lltc,fb-voltage-divider
-          - regulator-always-on
-
-      ldo3:
-        type: object
-        unevaluatedProperties: false
-        $ref: regulator.yaml#
-        description:
-          The LDO3 regulator is fixed to 1.8 V. See patternProperties
-          description above for the rest of the details.
+        allOf:
+          - if:
+              properties:
+                $nodename:
+                  const: ldo3
+            then:
+              properties:
+                lltc,fb-voltage-divider: false
+          - if:
+              properties:
+                $nodename:
+                  const: ldo1
+            then:
+              required:
+                - lltc,fb-voltage-divider
+                - regulator-always-on
 
 required:
   - compatible

"

But I keep getting this:
"
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:sw1:lltc,fb-voltage-divider: False schema does not allow [127000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:sw2:lltc,fb-voltage-divider: False schema does not allow [301000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:sw3:lltc,fb-voltage-divider: False schema does not allow [127000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:sw4:lltc,fb-voltage-divider: False schema does not allow [221000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:ldo2:lltc,fb-voltage-divider: False schema does not allow [487000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:ldo3: 'lltc,fb-voltage-divider' is a required property
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:ldo3: 'lltc,fb-voltage-divider' is a required property
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:ldo3: 'regulator-always-on' is a required property
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
/Documentation/devicetree/bindings/regulator/lltc,ltc3676.example.dtb: pmic@3c: regulators:ldo4:lltc,fb-voltage-divider: False schema does not allow [634000, 200000]
from schema $id:
http://devicetree.org/schemas/regulator/lltc,ltc3676.yaml#
"

I am at a loss here, do you have any hint you could offer ?

Thank you!