devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] scpi-sensors: Fix SCP sensor readings scale
@ 2017-03-09 10:17 Carlo Caione
  2017-03-09 10:17 ` [PATCH v3 1/2] Documentation: bindings: Introduce scpi,sensors-scale Carlo Caione
  2017-03-09 10:17 ` [PATCH v3 2/2] hwmon: (scpi) Fix the scale of SCP sensor readings Carlo Caione
  0 siblings, 2 replies; 8+ messages in thread
From: Carlo Caione @ 2017-03-09 10:17 UTC (permalink / raw)
  To: jdelvare, linux, linux-hwmon, linux-arm-kernel, linux-amlogic,
	linux, punit.agrawal, sudeep.holla, robh+dt, devicetree
  Cc: Carlo Caione

From: Carlo Caione <carlo@endlessm.com>

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.

In this patchset we introduce a new DT property `scpi,sensors-scale` that is
used by the scpi-hwmon driver to convert the sensor readings to the expected
scale.

v2:
 - Added data validation (scale != 0)
 - s/unsigned int/u32/ for the array
 - Switched to array initialiser notation
 - Introduced scpi_scale_reading()

v3:
 - scpi_scale_reading marked as static

Carlo Caione (2):
  Documentation: bindings: Introduce scpi,sensors-scale
  hwmon: (scpi) Fix the scale of SCP sensor readings

 Documentation/devicetree/bindings/arm/arm,scpi.txt | 18 ++++++++++++
 drivers/hwmon/scpi-hwmon.c                         | 34 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-03-15 22:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-09 10:17 [PATCH v3 0/2] scpi-sensors: Fix SCP sensor readings scale Carlo Caione
2017-03-09 10:17 ` [PATCH v3 1/2] Documentation: bindings: Introduce scpi,sensors-scale Carlo Caione
2017-03-15 18:20   ` Sudeep Holla
2017-03-15 19:30     ` Guenter Roeck
     [not found]     ` <57ff035a-b462-6f5d-0100-051e99e9a2b6-5wv7dgnIgG8@public.gmane.org>
2017-03-15 20:36       ` Rob Herring
2017-03-15 20:56     ` [PATCH v3 1/2] Documentation: bindings: Introduce scpi, sensors-scale Martin Blumenstingl
2017-03-15 22:40       ` [PATCH v3 1/2] Documentation: bindings: Introduce scpi,sensors-scale Guenter Roeck
2017-03-09 10:17 ` [PATCH v3 2/2] hwmon: (scpi) Fix the scale of SCP sensor readings Carlo Caione

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).