Re: SCMI sensor reads unit scaling

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

 



On Mon, Apr 22, 2019 at 11:31:18AM -0700, Florian Fainelli wrote:
> On 4/20/19 10:31 AM, Guenter Roeck wrote:
> > On 4/20/19 9:43 AM, 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).
> >>
> >> 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.
> >>
> >> 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)
> >>
> >> What do you think?
> >>
> > 
> > Reported values have to follow HWMON conventions. If not, this is a bug
> > and needs to get fixed. The argument about not changing the userspace ABI
> > does not apply to bugs.
> 
> Upon re-reading the SCMI specification, what is not clear to me is
> whether you have the liberty to:
> 
> - target the Linux HWMON sensor units as specified by
> Documentation/hwmon/sysfs-interface by e.g.: putting a millidegree
> Celsius value in the SCMI reply and an power of 10 multiplier value of 0
> (which would be treated as not doing any scaling)
> 
> - must provide the raw value as provided by the sensor as well as
> indicate the scale, e.g.: millidegree celsius and specifying a scale of -3
> 
> Sudeep can you clarify how you would approach making use (or not) of the
> power of 10 multiplier as defined by the SCMI specification?
> 

Not sure I understand. SCMI and hwmon sysfs ABI requirements are orthogonal.
hwmon expects certain units (mostly milli, but micro for power). What the
hardware reports is irrelevant. The SCMI driver needs to convert values
reported by SCMI into values expected by the hwmon ABI. If it does not do
that today, that is a bug which needs to be fixed.

Thanks,
Guenter



[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