diff mbox series

[v3,4/6] dt-bindings: thermal: Add a property to select the aggregation type

Message ID 20240524143150.610949-5-abailon@baylibre.com
State New
Headers show
Series thermal: Add support of multiple sensors | expand

Commit Message

Alexandre Bailon May 24, 2024, 2:31 p.m. UTC
This adds a new property named "aggregation" that could be used to
select the aggregation type when there are multiple sensors assigned
to a thermal zone.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 .../devicetree/bindings/thermal/thermal-zones.yaml        | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Krzysztof Kozlowski May 27, 2024, 6:55 a.m. UTC | #1
On 24/05/2024 16:31, Alexandre Bailon wrote:
> This adds a new property named "aggregation" that could be used to
> select the aggregation type when there are multiple sensors assigned
> to a thermal zone.
> 
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  .../devicetree/bindings/thermal/thermal-zones.yaml        | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> index fa7a72e2ba44..e6e4b46773e3 100644
> --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> @@ -111,6 +111,14 @@ patternProperties:
>            coefficients are ordered and are matched with sensors by means of the
>            sensor ID. Additional coefficients are interpreted as constant offset.
>  
> +      aggregation:
> +        $ref: /schemas/types.yaml#/definitions/string
> +        enum:
> +          - avg
> +          - max
> +        description:
> +          Aggregation type to use compute a temperature from multiple sensors.

Hm, why exactly this is a property of hardware? Why on one board you
would like to average and on other use max? I can only think of a case
that some sensors give inaccurate data. Otherwise it is OS policy.

Best regards,
Krzysztof
Rob Herring May 28, 2024, 5 p.m. UTC | #2
On Fri, May 24, 2024 at 04:31:48PM +0200, Alexandre Bailon wrote:
> This adds a new property named "aggregation" that could be used to
> select the aggregation type when there are multiple sensors assigned
> to a thermal zone.
> 
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> ---
>  .../devicetree/bindings/thermal/thermal-zones.yaml        | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> index fa7a72e2ba44..e6e4b46773e3 100644
> --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
> @@ -111,6 +111,14 @@ patternProperties:
>            coefficients are ordered and are matched with sensors by means of the
>            sensor ID. Additional coefficients are interpreted as constant offset.
>  
> +      aggregation:
> +        $ref: /schemas/types.yaml#/definitions/string
> +        enum:
> +          - avg
> +          - max
> +        description:
> +          Aggregation type to use compute a temperature from multiple sensors.

This is optional, so what's the default? I suppose you could make it 
required if more than 1 sensor.

A boolean could work here as well unless you think there might be a 3rd 
algorithm.

> +
>        sustainable-power:
>          $ref: /schemas/types.yaml#/definitions/uint32
>          description:
> -- 
> 2.44.1
>
Alexandre Bailon May 29, 2024, 8:06 a.m. UTC | #3
On 5/27/24 08:55, Krzysztof Kozlowski wrote:
> On 24/05/2024 16:31, Alexandre Bailon wrote:
>> This adds a new property named "aggregation" that could be used to
>> select the aggregation type when there are multiple sensors assigned
>> to a thermal zone.
>>
>> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
>> ---
>>   .../devicetree/bindings/thermal/thermal-zones.yaml        | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
>> index fa7a72e2ba44..e6e4b46773e3 100644
>> --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
>> +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
>> @@ -111,6 +111,14 @@ patternProperties:
>>             coefficients are ordered and are matched with sensors by means of the
>>             sensor ID. Additional coefficients are interpreted as constant offset.
>>   
>> +      aggregation:
>> +        $ref: /schemas/types.yaml#/definitions/string
>> +        enum:
>> +          - avg
>> +          - max
>> +        description:
>> +          Aggregation type to use compute a temperature from multiple sensors.
> 
> Hm, why exactly this is a property of hardware? Why on one board you
> would like to average and on other use max? I can only think of a case
> that some sensors give inaccurate data. Otherwise it is OS policyIn the case of Mediatek SoC, we only need max temperature.
I am not really sure if there is really an use case for the average.
Maybe I should drop average if no-one has a use case for it.

Best Regards,
Alexandre
> 
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
index fa7a72e2ba44..e6e4b46773e3 100644
--- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
+++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
@@ -111,6 +111,14 @@  patternProperties:
           coefficients are ordered and are matched with sensors by means of the
           sensor ID. Additional coefficients are interpreted as constant offset.
 
+      aggregation:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum:
+          - avg
+          - max
+        description:
+          Aggregation type to use compute a temperature from multiple sensors.
+
       sustainable-power:
         $ref: /schemas/types.yaml#/definitions/uint32
         description: