]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/hwmon/scpi-hwmon.c
hwmon: (scpi) Fix the scale of SCP sensor readings
authorCarlo Caione <carlo@endlessm.com>
Tue, 30 May 2017 09:05:07 +0000 (11:05 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 12 Jun 2017 00:08:19 +0000 (17:08 -0700)
commitccc9b8263d904228e5007cfc206eba3e6bea9f98
tree8433603a55289ed830ac3a82c68af81ac08b804a
parent1e276292bf25d288b645d3026f6c026ac9347061
hwmon: (scpi) Fix the scale of SCP sensor readings

The implementation details for SCPI seems to suggest that the sensor
readings must be reported by SCP using a well defined scale
(millidegree Celsius for temperature, millivolts for voltage,
milliamperes for current, microwatts for power and microjoules for
energy).

This is also important for the interaction with other subsystems: for
example both the thermal sub-system and the hwmon sysfs interface expect
the temperature expressed in millidegree Celsius.

Unfortunately since this behaviour is dependent on the firmware
implementation there are cases where the sensor readings are reported
using a different scale. For example in the Amlogic SoCs the
temperature is reported in degree and not millidegree Celsius.

To take into account this discrepancy and fixup the values reported by
SCP a new compatible 'amlogic,meson-gxbb-scpi-sensors' is introduced and
used in this patch by the scpi-hwmon driver to convert the sensor
readings to the expected scale.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/scpi-hwmon.c