diff mbox series

[3/4] dt-bindings: thermal: loongson,ls2k-thermal: Fix incorrect compatible definition

Message ID 217ce2745a8787c504bbda1d085daba7e9cb2f70.1712733065.git.zhoubinbin@loongson.cn
State Changes Requested, archived
Headers show
Series thermal: loongson2: Add Loongson-2K0500 and Loongson-2K2000 thermal support | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 1 warnings, 40 lines checked
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Binbin Zhou April 10, 2024, 9:49 a.m. UTC
The temperature output register of the Loongson-2K2000 is defined in the
chip configuration domain, which is different from the Loongson-2K1000,
so it can't be fallbacked.

We need to use two groups of registers to describe it: the first group
is the high and low temperature threshold setting register; the second
group is the temperature output register.

It is true that this fix will cause ABI corruption, but it is necessary
otherwise the Loongson-2K2000 temperature sensor will not work properly.

Fixes: 72684d99a854 ("thermal: dt-bindings: add loongson-2 thermal")
Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../thermal/loongson,ls2k-thermal.yaml        | 22 +++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

Conor Dooley April 10, 2024, 9:59 a.m. UTC | #1
On Wed, Apr 10, 2024 at 05:49:02PM +0800, Binbin Zhou wrote:
> The temperature output register of the Loongson-2K2000 is defined in the
> chip configuration domain, which is different from the Loongson-2K1000,
> so it can't be fallbacked.
> 
> We need to use two groups of registers to describe it: the first group
> is the high and low temperature threshold setting register; the second
> group is the temperature output register.
> 
> It is true that this fix will cause ABI corruption, but it is necessary
> otherwise the Loongson-2K2000 temperature sensor will not work properly.
> 
> Fixes: 72684d99a854 ("thermal: dt-bindings: add loongson-2 thermal")
> Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../thermal/loongson,ls2k-thermal.yaml        | 22 +++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> index 9748a479dcd4..a25b42702788 100644
> --- a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> @@ -18,14 +18,15 @@ properties:
>      oneOf:
>        - enum:
>            - loongson,ls2k1000-thermal
> +          - loongson,ls2k2000-thermal
>        - items:
>            - enum:
>                - loongson,ls2k0500-thermal
> -              - loongson,ls2k2000-thermal
>            - const: loongson,ls2k1000-thermal
>  
>    reg:
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
>  
>    interrupts:
>      maxItems: 1
> @@ -41,6 +42,23 @@ required:
>  
>  unevaluatedProperties: false
>  
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - loongson,ls2k2000-thermal
> +
> +then:
> +  properties:
> +    reg:
> +      maxItems: 2

You need a minItems: 2 here also, so that providing only the original
reg is not allowed anymore.

Cheers,
Conor.

> +
> +else:
> +  properties:
> +    reg:
> +      maxItems: 1
> +
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> -- 
> 2.43.0
>
Binbin Zhou April 10, 2024, 11:50 a.m. UTC | #2
On Wed, Apr 10, 2024 at 6:00 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Wed, Apr 10, 2024 at 05:49:02PM +0800, Binbin Zhou wrote:
> > The temperature output register of the Loongson-2K2000 is defined in the
> > chip configuration domain, which is different from the Loongson-2K1000,
> > so it can't be fallbacked.
> >
> > We need to use two groups of registers to describe it: the first group
> > is the high and low temperature threshold setting register; the second
> > group is the temperature output register.
> >
> > It is true that this fix will cause ABI corruption, but it is necessary
> > otherwise the Loongson-2K2000 temperature sensor will not work properly.
> >
> > Fixes: 72684d99a854 ("thermal: dt-bindings: add loongson-2 thermal")
> > Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >  .../thermal/loongson,ls2k-thermal.yaml        | 22 +++++++++++++++++--
> >  1 file changed, 20 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> > index 9748a479dcd4..a25b42702788 100644
> > --- a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> > +++ b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> > @@ -18,14 +18,15 @@ properties:
> >      oneOf:
> >        - enum:
> >            - loongson,ls2k1000-thermal
> > +          - loongson,ls2k2000-thermal
> >        - items:
> >            - enum:
> >                - loongson,ls2k0500-thermal
> > -              - loongson,ls2k2000-thermal
> >            - const: loongson,ls2k1000-thermal
> >
> >    reg:
> > -    maxItems: 1
> > +    minItems: 1
> > +    maxItems: 2
> >
> >    interrupts:
> >      maxItems: 1
> > @@ -41,6 +42,23 @@ required:
> >
> >  unevaluatedProperties: false
> >
> > +if:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - loongson,ls2k2000-thermal
> > +
> > +then:
> > +  properties:
> > +    reg:
> > +      maxItems: 2
>
> You need a minItems: 2 here also, so that providing only the original
> reg is not allowed anymore.

Hi Conor:

Indeed, it is necessary that the whole description is more rigorous.
I'll fix it in the next version.

Thanks.
Binbin
>
> Cheers,
> Conor.
>
> > +
> > +else:
> > +  properties:
> > +    reg:
> > +      maxItems: 1
> > +
> >  examples:
> >    - |
> >      #include <dt-bindings/interrupt-controller/irq.h>
> > --
> > 2.43.0
> >
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
index 9748a479dcd4..a25b42702788 100644
--- a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
@@ -18,14 +18,15 @@  properties:
     oneOf:
       - enum:
           - loongson,ls2k1000-thermal
+          - loongson,ls2k2000-thermal
       - items:
           - enum:
               - loongson,ls2k0500-thermal
-              - loongson,ls2k2000-thermal
           - const: loongson,ls2k1000-thermal
 
   reg:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   interrupts:
     maxItems: 1
@@ -41,6 +42,23 @@  required:
 
 unevaluatedProperties: false
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls2k2000-thermal
+
+then:
+  properties:
+    reg:
+      maxItems: 2
+
+else:
+  properties:
+    reg:
+      maxItems: 1
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>