Re: SCMI sensor reads unit scaling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 20, 2019 at 09:43:48AM -0700, Florian Fainelli wrote:
> Hi Sudeep, Guenter,
>
> The current SCMI hwmon support does not seem to make use of the sensor
> scale/unit as defined in the sensor replies (or the update scale for
> that matter).
>

That sounds like a bug as I simplified(IOW removed code that I couldn't
test with the reference platform firmware) before I pushed upstream.

> I came up with the patch below which gets the job done, but I am worried
> about possibly breaking people's SCMI deployments and sensors reading
> because they may have intentionally or not already decided to return a
> value which is scaled the way Linux's hwmon expect it, and may, or may
> not have populated a valid unit number in the sensor reply.
>

OK, will try to recollect the details and get back to you, I might have
forgotten few details as it's over  1.5 years since I originally wrote
it.

> Ideally we should probably do two conversions:
>
> - from within scmi_sensor_reading_get(), scale the value as indicated by
> the reply
> - from within scmi_hwmon_read(), take that scaled value and apply the
> necessary conversion expected by Linux's HWMON conventions (e.g.:
> reporting voltage as mV values)
>

At least, the idea I had is to have all the conversion in scmi_sensors.c
and provide sensor data scale to HWMON framework's expectation. Not sure
if I implemented correctly to obey that.

> What do you think?
>
> ---
> From: Florian Fainelli <f.fainelli@xxxxxxxxx>
> Subject: firmware: arm_scmi: Support sensor scaling
>
> The SCMI sensor management protocol includes the following provision:
>
> The power-of-10 multiplier in two’s-complement format that is applied to
> the sensor unit specified by the SensorType field.
>
> Add support for scaling the value returned based on what is provided by
> the firmware. This requires us to be able to look up a sensor identifier
> to its backing scmi_sensor_info structure and apply the necessary scale.
>

Had a brief look at the patch and this is what I had initially as mentioned
before. Since the Juno firmware at that time didn't have all these implemented
properly, I dropped. But I am happy to test and merge this if it makes sense
and get the firmware fixed if I find any bugs with it ;).

However I am not sure if we need another conversion in hwmon driver as
we can scale it in scmi itself to whatever Linux HWMON expects. Let me
know if you don't agree with that.

If possible, please post this independently. Also if you can give it a
testing on your platform, that would be great. I will try to run this on
Juno too in the meantime.

--
Regards,
Sudeep



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux