devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: devicetree@vger.kernel.org, Conor Dooley <conor+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Tim Harvey <tharvey@gateworks.com>,
	kernel@dh-electronics.com
Subject: Re: [PATCH] dt-bindings: regulator: lltc,ltc3676: convert to YAML
Date: Thu, 17 Oct 2024 22:50:13 +0200	[thread overview]
Message-ID: <f485fe9d-b514-44d9-a0d7-acfcd6b1f4ed@denx.de> (raw)
In-Reply-To: <aca453f0-6cf7-4fab-8b0d-ce455affb62b@kernel.org>

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!

      reply	other threads:[~2024-10-17 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 22:42 [PATCH] dt-bindings: regulator: lltc,ltc3676: convert to YAML Marek Vasut
2024-10-16  7:24 ` Krzysztof Kozlowski
2024-10-16 22:48   ` Marek Vasut
2024-10-17  7:01     ` Krzysztof Kozlowski
2024-10-17 20:50       ` Marek Vasut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f485fe9d-b514-44d9-a0d7-acfcd6b1f4ed@denx.de \
    --to=marex@denx.de \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@dh-electronics.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=robh@kernel.org \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).