All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: daniel.lezcano@linaro.org, rafael@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
	conor+dt@kernel.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, Fabio Estevam <festevam@denx.de>
Subject: Re: [PATCH v3] dt-bindings: thermal: qoriq-thermal: Adjust fsl,tmu-range min/maxItems
Date: Sat, 9 Dec 2023 20:23:19 +0000	[thread overview]
Message-ID: <20231209-singular-tighten-eef5f7909dcd@spud> (raw)
In-Reply-To: <CAOMZO5Di6Saq_r2k8AkGeANRvXwwx26U=Vf5-Eu-_2Qhu5sDCw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5423 bytes --]

On Sat, Dec 09, 2023 at 04:22:31PM -0300, Fabio Estevam wrote:
> Hi Conor,
> 
> On Mon, Oct 2, 2023 at 9:27 AM Conor Dooley <conor@kernel.org> wrote:
> 
> > tbh, this seems like a situation where per compatible constraints should
> > be added, since each of the devices listed above has different
> > requirements.
> 
> Ok, I am trying to add the device constraints as suggested.
> 
> For example: I am trying to describe that imx93 has 7 items for fsl,tmu-range:
> 
> --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> @@ -21,6 +21,7 @@ properties:
>      enum:
>        - fsl,qoriq-tmu
>        - fsl,imx8mq-tmu
> +      - fsl,imx93-tmu
> 
>    reg:
>      maxItems: 1
> @@ -33,7 +34,15 @@ properties:
>      description: |
>        The values to be programmed into TTRnCR, as specified by the SoC
>        reference manual. The first cell is TTR0CR, the second is TTR1CR, etc.
> -    maxItems: 4
> +    items:
> +      - description: TTR0CR
> +      - description: TTR1CR
> +      - description: TTR2CR
> +      - description: TTR3CR
> +      - description: TTR4CR
> +      - description: TTR5CR
> +      - description: TTR6CR
> +    minItems: 4
> 
>    fsl,tmu-calibration:
>      $ref: /schemas/types.yaml#/definitions/uint32-matrix
> @@ -69,15 +78,33 @@ required:
>    - fsl,tmu-calibration
>    - '#thermal-sensor-cells'
> 
> +

^^ extra newline here I think.

> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - fsl,imx93-tmu
> +    then:
> +      properties:
> +        fsl,tmu-range:
> +          minItems: 7
> +          maxItems: 7
> +    else:
> +      properties:
> +        fsl,tmu-range:
> +          maxItems: 4
> +
>  additionalProperties: false
> 
>  examples:
>    - |
>      tmu@f0000 {
> -        compatible = "fsl,qoriq-tmu";
> +        compatible = "fsl,imx93-tmu";
>          reg = <0xf0000 0x1000>;
>          interrupts = <18 2 0 0>;
> -        fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a>;
> +        fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a 0 0 0>;
>          fsl,tmu-calibration = <0x00000000 0x00000025>,
>                                <0x00000001 0x00000028>,
>                                <0x00000002 0x0000002d>,
> 
> but dt_binding_check fails:
> 
> $ make dt_binding_check DT_SCHEMA_FILES=qoriq-thermal.yaml -j12
>   LINT    Documentation/devicetree/bindings
>   DTEX    Documentation/devicetree/bindings/thermal/qoriq-thermal.example.dts
>   CHKDT   Documentation/devicetree/bindings/processed-schema.json
>   SCHEMA  Documentation/devicetree/bindings/processed-schema.json
>   DTC_CHK Documentation/devicetree/bindings/thermal/qoriq-thermal.example.dtb
> /home/fabio/linux-next/Documentation/devicetree/bindings/thermal/qoriq-thermal.example.dtb:
> tmu@f0000: fsl,tmu-range: [[655360, 589862, 524362, 65642, 0, 0, 0]]
> is too short
> from schema $id: http://devicetree.org/schemas/thermal/qoriq-thermal.yaml#
> 
> What is wrong with the yaml changes to tell that imx93 has 7 items for
> fsl,tmu-range?

You're adding the constraints and items at the wrong level AFAICT.
I think something like the below better matches your constraints?

diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
index 145744027234..540169806cc8 100644
--- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
@@ -21,6 +21,7 @@ properties:
     enum:
       - fsl,qoriq-tmu
       - fsl,imx8mq-tmu
+      - fsl,imx93-tmu
 
   reg:
     maxItems: 1
@@ -33,7 +34,17 @@ properties:
     description: |
       The values to be programmed into TTRnCR, as specified by the SoC
       reference manual. The first cell is TTR0CR, the second is TTR1CR, etc.
-    maxItems: 4
+    items:
+      items:
+        - description: TTR0CR
+        - description: TTR1CR
+        - description: TTR2CR
+        - description: TTR3CR
+        - description: TTR4CR
+        - description: TTR5CR
+        - description: TTR6CR
+      minItems: 4
+    maxItems: 1
 
   fsl,tmu-calibration:
     $ref: /schemas/types.yaml#/definitions/uint32-matrix
@@ -69,15 +80,34 @@ required:
   - fsl,tmu-calibration
   - '#thermal-sensor-cells'
 
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,imx93-tmu
+    then:
+      properties:
+        fsl,tmu-range:
+          items:
+            minItems: 7
+    else:
+      properties:
+        fsl,tmu-range:
+          items:
+            maxItems: 4
+
 additionalProperties: false
 
 examples:
   - |
     tmu@f0000 {
-        compatible = "fsl,qoriq-tmu";
+        compatible = "fsl,imx93-tmu";
         reg = <0xf0000 0x1000>;
         interrupts = <18 2 0 0>;
-        fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a>;
+        fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a 0 0 0>;
         fsl,tmu-calibration = <0x00000000 0x00000025>,
                               <0x00000001 0x00000028>,
                               <0x00000002 0x0000002d>,


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-12-09 20:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 22:21 [PATCH v3] dt-bindings: thermal: qoriq-thermal: Adjust fsl,tmu-range min/maxItems Fabio Estevam
2023-10-02 12:27 ` Conor Dooley
2023-12-09 19:22   ` Fabio Estevam
2023-12-09 20:23     ` Conor Dooley [this message]
2023-12-09 20:59       ` Fabio Estevam
2023-12-10 14:52         ` Conor Dooley
2023-12-10 15:37           ` Rob Herring
2023-12-14 17:13             ` Conor Dooley
2024-01-03 21:39               ` Rob Herring
2024-01-03 21:51                 ` Fabio Estevam

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=20231209-singular-tighten-eef5f7909dcd@spud \
    --to=conor@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@denx.de \
    --cc=festevam@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.