Skip to contentSkip to conversation

hwmon: gsc-hwmon: scale temperature to millidegrees

PATCH Applied Tim Harvey 2 participants 2 messages Aug 27, 2020

Subsystems (3)
lore
Share & tools
lore

Tim Harvey

author maintainer
#0 lore raw

PATCH 1/1 hwmon: gsc-hwmon: scale temperature to millidegrees

The GSC registers report temperature in decidegrees celcius so we need to scale it to represent the hwmon sysfs API of millidegrees.

---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index 3dfe2ca..c6d4567 100644
@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 	case mode_temperature:
 		if (tmp > 0x8000)
 			tmp -= 0xffff;
+		tmp *= 100; /* convert to millidegrees celsius */
 		break;
 	case mode_voltage_raw:
 		tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 5 lines · Tim Harvey

The GSC registers report temperature in decidegrees celcius so we need to scale it to represent the hwmon sysfs API of millidegrees.

Applied.

Thanks,
Guenter

Quoted 16 lines
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index 3dfe2ca..c6d4567 100644
@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 	case mode_temperature:
 		if (tmp > 0x8000)
 			tmp -= 0xffff;
+		tmp *= 100; /* convert to millidegrees celsius */
 		break;
 	case mode_voltage_raw:
 		tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));