diff mbox series

[v3,16/19] dt-bindings: hwmon: (mr75203) add coefficient properties for the thermal equation

Message ID 20220830192212.28570-17-farbere@amazon.com (mailing list archive)
State Changes Requested
Headers show
Series Variety of fixes and new features for mr75203 driver | expand

Commit Message

Eliav Farber Aug. 30, 2022, 7:22 p.m. UTC
Add optional temperature coefficient properties:
 *) moortec,ts-coeff-g
 *) moortec,ts-coeff-h
 *) moortec,ts-coeff-cal5
 *) moortec,ts-coeff-j
If defined they shall be used instead of defaults.

The coefficients were added to device tree on top of the series property
(which can be used to select between series 5 and series 6), because
coefficients can vary between product and product, and code defaults might
not be accurate enough.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
V3 -> V2:
- Add "moortec" prefix to property name.

 .../bindings/hwmon/moortec,mr75203.yaml       | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Rob Herring Sept. 2, 2022, 8:03 p.m. UTC | #1
On Tue, Aug 30, 2022 at 07:22:09PM +0000, Eliav Farber wrote:
> Add optional temperature coefficient properties:
>  *) moortec,ts-coeff-g
>  *) moortec,ts-coeff-h
>  *) moortec,ts-coeff-cal5
>  *) moortec,ts-coeff-j
> If defined they shall be used instead of defaults.
> 
> The coefficients were added to device tree on top of the series property
> (which can be used to select between series 5 and series 6), because
> coefficients can vary between product and product, and code defaults might
> not be accurate enough.
> 
> Signed-off-by: Eliav Farber <farbere@amazon.com>
> ---
> V3 -> V2:
> - Add "moortec" prefix to property name.
> 
>  .../bindings/hwmon/moortec,mr75203.yaml       | 33 +++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> index ec2dbe7da9c2..a92da6064285 100644
> --- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> @@ -74,6 +74,37 @@ properties:
>      default: 5
>      $ref: /schemas/types.yaml#definitions/uint32
>  
> +  moortec,ts-coeff-g:
> +    description:
> +      G coefficient for temperature equation.
> +      Value should be multiplied by factor 1000.

If you just multiply the values here, you can specify 'multipleOf: 1000'

Either way, some constraints would be nice. Or is 0 - 2^32 valid?


> +      Default for series 5 = 60000
> +      Default for series 6 = 57400
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  moortec,ts-coeff-h:
> +    description:
> +      H coefficient for temperature equation.
> +      Value should be multiplied by factor 1000.
> +      Default for series 5 = 200000
> +      Default for series 6 = 249400
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  moortec,ts-coeff-cal5:
> +    description:
> +      cal5 coefficient for temperature equation (can't be 0).

minimum: 1

> +      Default for series 5 = 4094
> +      Default for series 6 = 4096
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  moortec,ts-coeff-j:
> +    description:
> +      J coefficient for temperature equation.
> +      Value should be multiplied by factor 1000.
> +      Default for series 5 = -100
> +      Default for series 6 = 0
> +    $ref: /schemas/types.yaml#/definitions/int32
> +
>  required:
>    - compatible
>    - reg
> @@ -97,5 +128,7 @@ examples:
>          resets = <&rcu0 0x40 7>;
>          moortec,vm-active-channels = <0x10 0x05>;
>          moortec,vm-pre-scaler = <5 6>;
> +        moortec,ts-coeff-g = <61400>;
> +        moortec,ts-coeff-h = <253700>;
>          #thermal-sensor-cells = <1>;
>      };
> -- 
> 2.37.1
> 
>
Eliav Farber Sept. 3, 2022, 7:16 p.m. UTC | #2
On 9/2/2022 11:03 PM, Rob Herring wrote:
> On Tue, Aug 30, 2022 at 07:22:09PM +0000, Eliav Farber wrote:
>> Add optional temperature coefficient properties:
>>  *) moortec,ts-coeff-g
>>  *) moortec,ts-coeff-h
>>  *) moortec,ts-coeff-cal5
>>  *) moortec,ts-coeff-j
>> If defined they shall be used instead of defaults.
>>
>> The coefficients were added to device tree on top of the series property
>> (which can be used to select between series 5 and series 6), because
>> coefficients can vary between product and product, and code defaults 
>> might
>> not be accurate enough.
>>
>> Signed-off-by: Eliav Farber <farbere@amazon.com>
>> ---
>> V3 -> V2:
>> - Add "moortec" prefix to property name.
>>
>>  .../bindings/hwmon/moortec,mr75203.yaml       | 33 +++++++++++++++++++
>>  1 file changed, 33 insertions(+)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml 
>> b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> index ec2dbe7da9c2..a92da6064285 100644
>> --- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> +++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> @@ -74,6 +74,37 @@ properties:
>>      default: 5
>>      $ref: /schemas/types.yaml#definitions/uint32
>>
>> +  moortec,ts-coeff-g:
>> +    description:
>> +      G coefficient for temperature equation.
>> +      Value should be multiplied by factor 1000.
>
> If you just multiply the values here, you can specify 'multipleOf: 1000'
>
Fixed in v4.

> Either way, some constraints would be nice. Or is 0 - 2^32 valid?

g and h can't be 0, and since they must be multiple of 1000 I added:
minimum: 1000
j is negative or 0, so I added:
maximum: 0

>
>> +      Default for series 5 = 60000
>> +      Default for series 6 = 57400
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +
>> +  moortec,ts-coeff-h:
>> +    description:
>> +      H coefficient for temperature equation.
>> +      Value should be multiplied by factor 1000.
>> +      Default for series 5 = 200000
>> +      Default for series 6 = 249400
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +
>> +  moortec,ts-coeff-cal5:
>> +    description:
>> +      cal5 coefficient for temperature equation (can't be 0).
>
> minimum: 1 
Fixed in v4.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
index ec2dbe7da9c2..a92da6064285 100644
--- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
+++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
@@ -74,6 +74,37 @@  properties:
     default: 5
     $ref: /schemas/types.yaml#definitions/uint32
 
+  moortec,ts-coeff-g:
+    description:
+      G coefficient for temperature equation.
+      Value should be multiplied by factor 1000.
+      Default for series 5 = 60000
+      Default for series 6 = 57400
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  moortec,ts-coeff-h:
+    description:
+      H coefficient for temperature equation.
+      Value should be multiplied by factor 1000.
+      Default for series 5 = 200000
+      Default for series 6 = 249400
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  moortec,ts-coeff-cal5:
+    description:
+      cal5 coefficient for temperature equation (can't be 0).
+      Default for series 5 = 4094
+      Default for series 6 = 4096
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  moortec,ts-coeff-j:
+    description:
+      J coefficient for temperature equation.
+      Value should be multiplied by factor 1000.
+      Default for series 5 = -100
+      Default for series 6 = 0
+    $ref: /schemas/types.yaml#/definitions/int32
+
 required:
   - compatible
   - reg
@@ -97,5 +128,7 @@  examples:
         resets = <&rcu0 0x40 7>;
         moortec,vm-active-channels = <0x10 0x05>;
         moortec,vm-pre-scaler = <5 6>;
+        moortec,ts-coeff-g = <61400>;
+        moortec,ts-coeff-h = <253700>;
         #thermal-sensor-cells = <1>;
     };