diff mbox series

[v2,1/5] dt-bindings: thermal: tsens: Add ipq8074 compatible

Message ID 20220501182200.47328-1-robimarko@gmail.com (mailing list archive)
State Superseded, archived
Headers show
Series [v2,1/5] dt-bindings: thermal: tsens: Add ipq8074 compatible | expand

Commit Message

Robert Marko May 1, 2022, 6:21 p.m. UTC
Qualcomm IPQ8074 has tsens v2.3.0 block, though unlike existing v2 IP it
only uses one IRQ, so tsens v2 compatible cannot be used as the fallback.

We also have to make sure that correct interrupts are set according to
compatibles, so populate interrupt information per compatibles.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v2:
* No need for a list in compatible check
* Specify minItems and maxItems for interrupt and interrupt-names
---
 .../bindings/thermal/qcom-tsens.yaml          | 74 +++++++++++++++++--
 1 file changed, 67 insertions(+), 7 deletions(-)

Comments

Krzysztof Kozlowski May 3, 2022, 11:36 a.m. UTC | #1
On 01/05/2022 20:21, Robert Marko wrote:
> Qualcomm IPQ8074 has tsens v2.3.0 block, though unlike existing v2 IP it
> only uses one IRQ, so tsens v2 compatible cannot be used as the fallback.
> 
> We also have to make sure that correct interrupts are set according to
> compatibles, so populate interrupt information per compatibles.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Rob Herring (Arm) May 3, 2022, 3:52 p.m. UTC | #2
On Sun, May 01, 2022 at 08:21:56PM +0200, Robert Marko wrote:
> Qualcomm IPQ8074 has tsens v2.3.0 block, though unlike existing v2 IP it
> only uses one IRQ, so tsens v2 compatible cannot be used as the fallback.
> 
> We also have to make sure that correct interrupts are set according to
> compatibles, so populate interrupt information per compatibles.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
> Changes in v2:
> * No need for a list in compatible check
> * Specify minItems and maxItems for interrupt and interrupt-names
> ---
>  .../bindings/thermal/qcom-tsens.yaml          | 74 +++++++++++++++++--
>  1 file changed, 67 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> index b6406bcc683f..e9b85c99bb60 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> @@ -56,6 +56,10 @@ properties:
>                - qcom,sm8350-tsens
>            - const: qcom,tsens-v2
>  
> +      - description: v2 of TSENS with combined interrupt
> +        enum:
> +          - qcom,ipq8074-tsens
> +
>    reg:
>      items:
>        - description: TM registers
> @@ -63,15 +67,11 @@ properties:
>  
>    interrupts:
>      minItems: 1
> -    items:
> -      - description: Combined interrupt if upper or lower threshold crossed
> -      - description: Interrupt if critical threshold crossed
> +    maxItems: 2
>  
>    interrupt-names:
>      minItems: 1
> -    items:
> -      - const: uplow
> -      - const: critical
> +    maxItems: 2
>  
>    nvmem-cells:
>      minItems: 1
> @@ -125,21 +125,66 @@ allOf:
>        properties:
>          interrupts:
>            maxItems: 1

You can drop 'maxItems' as it is implied by 'items' length.

> +          items:
> +            - description: Combined interrupt if upper or lower threshold crossed
>          interrupt-names:
>            maxItems: 1

ditto

> +          items:
> +            - const: uplow
>  
> -    else:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,msm8953-tsens
> +              - qcom,msm8996-tsens
> +              - qcom,msm8998-tsens
> +              - qcom,sc7180-tsens
> +              - qcom,sc7280-tsens
> +              - qcom,sc8180x-tsens
> +              - qcom,sdm630-tsens
> +              - qcom,sdm845-tsens
> +              - qcom,sm8150-tsens
> +              - qcom,sm8250-tsens
> +              - qcom,sm8350-tsens
> +              - qcom,tsens-v2
> +    then:
>        properties:
>          interrupts:
>            minItems: 2

Same for minItems.

> +          items:
> +            - description: Combined interrupt if upper or lower threshold crossed
> +            - description: Interrupt if critical threshold crossed
>          interrupt-names:
>            minItems: 2

ditto

> +          items:
> +            - const: uplow
> +            - const: critical
>  
>    - if:
>        properties:
>          compatible:
>            contains:
>              enum:
> +              - qcom,ipq8074-tsens
> +    then:
> +      properties:
> +        interrupts:
> +          maxItems: 1

ditto

> +          items:
> +            - description: Combined interrupt if upper, lower or critical thresholds crossed
> +        interrupt-names:
> +          maxItems: 1

ditto

> +          items:
> +            - const: combined
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,ipq8074-tsens
>                - qcom,tsens-v0_1
>                - qcom,tsens-v1
>                - qcom,tsens-v2
> @@ -222,4 +267,19 @@ examples:
>             #qcom,sensors = <13>;
>             #thermal-sensor-cells = <1>;
>      };
> +
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    // Example 4 (for any IPQ8074 based SoC-s):
> +    tsens4: thermal-sensor@4a9000 {
> +           compatible = "qcom,ipq8074-tsens";
> +           reg = <0x4a9000 0x1000>,
> +                 <0x4a8000 0x1000>;
> +
> +           interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
> +           interrupt-names = "combined";
> +
> +           #qcom,sensors = <16>;
> +           #thermal-sensor-cells = <1>;
> +    };
>  ...
> -- 
> 2.35.1
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
index b6406bcc683f..e9b85c99bb60 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
@@ -56,6 +56,10 @@  properties:
               - qcom,sm8350-tsens
           - const: qcom,tsens-v2
 
+      - description: v2 of TSENS with combined interrupt
+        enum:
+          - qcom,ipq8074-tsens
+
   reg:
     items:
       - description: TM registers
@@ -63,15 +67,11 @@  properties:
 
   interrupts:
     minItems: 1
-    items:
-      - description: Combined interrupt if upper or lower threshold crossed
-      - description: Interrupt if critical threshold crossed
+    maxItems: 2
 
   interrupt-names:
     minItems: 1
-    items:
-      - const: uplow
-      - const: critical
+    maxItems: 2
 
   nvmem-cells:
     minItems: 1
@@ -125,21 +125,66 @@  allOf:
       properties:
         interrupts:
           maxItems: 1
+          items:
+            - description: Combined interrupt if upper or lower threshold crossed
         interrupt-names:
           maxItems: 1
+          items:
+            - const: uplow
 
-    else:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,msm8953-tsens
+              - qcom,msm8996-tsens
+              - qcom,msm8998-tsens
+              - qcom,sc7180-tsens
+              - qcom,sc7280-tsens
+              - qcom,sc8180x-tsens
+              - qcom,sdm630-tsens
+              - qcom,sdm845-tsens
+              - qcom,sm8150-tsens
+              - qcom,sm8250-tsens
+              - qcom,sm8350-tsens
+              - qcom,tsens-v2
+    then:
       properties:
         interrupts:
           minItems: 2
+          items:
+            - description: Combined interrupt if upper or lower threshold crossed
+            - description: Interrupt if critical threshold crossed
         interrupt-names:
           minItems: 2
+          items:
+            - const: uplow
+            - const: critical
 
   - if:
       properties:
         compatible:
           contains:
             enum:
+              - qcom,ipq8074-tsens
+    then:
+      properties:
+        interrupts:
+          maxItems: 1
+          items:
+            - description: Combined interrupt if upper, lower or critical thresholds crossed
+        interrupt-names:
+          maxItems: 1
+          items:
+            - const: combined
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,ipq8074-tsens
               - qcom,tsens-v0_1
               - qcom,tsens-v1
               - qcom,tsens-v2
@@ -222,4 +267,19 @@  examples:
            #qcom,sensors = <13>;
            #thermal-sensor-cells = <1>;
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    // Example 4 (for any IPQ8074 based SoC-s):
+    tsens4: thermal-sensor@4a9000 {
+           compatible = "qcom,ipq8074-tsens";
+           reg = <0x4a9000 0x1000>,
+                 <0x4a8000 0x1000>;
+
+           interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+           interrupt-names = "combined";
+
+           #qcom,sensors = <16>;
+           #thermal-sensor-cells = <1>;
+    };
 ...