diff mbox series

[v3,10/19] dt-bindings: hwmon: (mr75203) add "moortec,vm-pre-scaler" property

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

Commit Message

Farber, Eliav Aug. 30, 2022, 7:22 p.m. UTC
Add support for mr76006 pre-scaler which provides divide-by-2 scaling of
input voltage, which can then be presented for VM for measurement within
its range (the VM input range is limited to -0.1V to 1V).

The new "moortec,vm-pre-scaler" property lists the channels that use a
pre-scaler.

The driver will use this list to multiply the voltage result by 2, to
present to the user the actual voltage input source.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
V3 -> V2:
- Add "moortec" prefix to property name.
- Change property format to be a single u8 array.
- Fix typo: scalar --> scaler.

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

Comments

Rob Herring (Arm) Sept. 2, 2022, 7:57 p.m. UTC | #1
On Tue, Aug 30, 2022 at 07:22:03PM +0000, Eliav Farber wrote:
> Add support for mr76006 pre-scaler which provides divide-by-2 scaling of
> input voltage, which can then be presented for VM for measurement within
> its range (the VM input range is limited to -0.1V to 1V).
> 
> The new "moortec,vm-pre-scaler" property lists the channels that use a
> pre-scaler.
> 
> The driver will use this list to multiply the voltage result by 2, to
> present to the user the actual voltage input source.
> 
> Signed-off-by: Eliav Farber <farbere@amazon.com>
> ---
> V3 -> V2:
> - Add "moortec" prefix to property name.
> - Change property format to be a single u8 array.
> - Fix typo: scalar --> scaler.
> 
>  .../devicetree/bindings/hwmon/moortec,mr75203.yaml    | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> index 69cc6caceb2c..4c983d8f8fe7 100644
> --- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
> @@ -54,6 +54,16 @@ properties:
>      default: 16
>      $ref: /schemas/types.yaml#definitions/uint8-array
>  
> +  moortec,vm-pre-scaler:
> +    description:
> +      moortec,vm-pre-scaler property is an array of channels that use a mr76006
> +      pre-scaler to divides the input source by 2.

to divide the

You don't need the property name in the description. The entries are the 
pre-scaler values for each channel? The array index is the channel? If 
so, then 'an array of pre-scaler values for each channel ...'.

> +      The pre-scaler is used for input sources that exceed the VM input range.
> +      The driver uses this information to present to the user the actual value
> +      of the voltage source.
> +    default: 1

It's an array, so a scalar default doesn't make sense.

> +    $ref: /schemas/types.yaml#definitions/uint8-array

Constraints? I assume there's a finite number of channels to set the 
array size bounds for example.

> +
>  required:
>    - compatible
>    - reg
> @@ -76,5 +86,6 @@ examples:
>          clocks = <&osc0>;
>          resets = <&rcu0 0x40 7>;
>          moortec,vm-active-channels = <0x10 0x05>;
> +        moortec,vm-pre-scaler = <5 6>;
>          #thermal-sensor-cells = <1>;
>      };
> -- 
> 2.37.1
> 
>
Farber, Eliav Sept. 3, 2022, 7:34 p.m. UTC | #2
On 9/2/2022 10:57 PM, Rob Herring wrote:
> On Tue, Aug 30, 2022 at 07:22:03PM +0000, Eliav Farber wrote:
>> Add support for mr76006 pre-scaler which provides divide-by-2 scaling of
>> input voltage, which can then be presented for VM for measurement within
>> its range (the VM input range is limited to -0.1V to 1V).
>>
>> The new "moortec,vm-pre-scaler" property lists the channels that use a
>> pre-scaler.
>>
>> The driver will use this list to multiply the voltage result by 2, to
>> present to the user the actual voltage input source.
>>
>> Signed-off-by: Eliav Farber <farbere@amazon.com>
>> ---
>> V3 -> V2:
>> - Add "moortec" prefix to property name.
>> - Change property format to be a single u8 array.
>> - Fix typo: scalar --> scaler.
>>
>>  .../devicetree/bindings/hwmon/moortec,mr75203.yaml    | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml 
>> b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> index 69cc6caceb2c..4c983d8f8fe7 100644
>> --- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> +++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
>> @@ -54,6 +54,16 @@ properties:
>>      default: 16
>>      $ref: /schemas/types.yaml#definitions/uint8-array
>>
>> +  moortec,vm-pre-scaler:
>> +    description:
>> +      moortec,vm-pre-scaler property is an array of channels that 
>> use a mr76006
>> +      pre-scaler to divides the input source by 2.
>
> to divide the

Fixed in v4.

> You don't need the property name in the description. The entries are the
> pre-scaler values for each channel? The array index is the channel? If
> so, then 'an array of pre-scaler values for each channel ...'.

Removed property name in the description.

The entries are channel numbers that use a pre-scaler.
Assume 2 VMs, with 16 channels each (so 32 channels in total, numbered
from 0 to 31) and assume: moortec,vm-pre-scaler = /bits/ 8 <5 6 20>;
This means that only channels 5 6 and 20 use a pre-scaler, and the driver
will use a factor of 2 only for these channels.

For v4 I renamed the property name to be "moortec,vm-pre-scaler-x2".
And I changed binding to:

moortec,vm-pre-scaler-x2:
description:
   Defines the channels that use a mr76006 pre-scaler to divide the input
   source by 2.
   The pre-scaler is used for input sources that exceed the VM input range.
   The driver uses this information to present to the user with the actual
   value of the voltage source.
   For channels that are not listed, no pre-scaler is assumed.
   Maximum number of items - total number of channels in all VMs.
   Each channel should not appear more than once.
$ref: /schemas/types.yaml#/definitions/uint8-array

>> +      The pre-scaler is used for input sources that exceed the VM 
>> input range.
>> +      The driver uses this information to present to the user the 
>> actual value
>> +      of the voltage source.
>> +    default: 1
>
> It's an array, so a scalar default doesn't make sense.
What I meant was the in-case channel is not defined the default pre-
scaler value is 1.

>> +    $ref: /schemas/types.yaml#definitions/uint8-array
>
> Constraints? I assume there's a finite number of channels to set the
> array size bounds for example. 
Added some constraints in the new description above.

--
Thanks, Eliav
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
index 69cc6caceb2c..4c983d8f8fe7 100644
--- a/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
+++ b/Documentation/devicetree/bindings/hwmon/moortec,mr75203.yaml
@@ -54,6 +54,16 @@  properties:
     default: 16
     $ref: /schemas/types.yaml#definitions/uint8-array
 
+  moortec,vm-pre-scaler:
+    description:
+      moortec,vm-pre-scaler property is an array of channels that use a mr76006
+      pre-scaler to divides the input source by 2.
+      The pre-scaler is used for input sources that exceed the VM input range.
+      The driver uses this information to present to the user the actual value
+      of the voltage source.
+    default: 1
+    $ref: /schemas/types.yaml#definitions/uint8-array
+
 required:
   - compatible
   - reg
@@ -76,5 +86,6 @@  examples:
         clocks = <&osc0>;
         resets = <&rcu0 0x40 7>;
         moortec,vm-active-channels = <0x10 0x05>;
+        moortec,vm-pre-scaler = <5 6>;
         #thermal-sensor-cells = <1>;
     };