Re: [PATCH] dt-bindings: regulator: lltc,ltc3676: convert to YAML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/17/24 9:01 AM, Krzysztof Kozlowski wrote:
On 17/10/2024 00:48, Marek Vasut wrote:

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.

I was hoping for something like this:
"
diff --git a/Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml b/Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml
index f47eacf96cd67..4fd5c7dd509dd 100644
--- a/Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml
+++ b/Documentation/devicetree/bindings/regulator/lltc,ltc3676.yaml
@@ -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!




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux