[U-Boot] [PATCH 10/18] imx: ventana: gsc: fix negative temperature readings
Tim Harvey
tharvey at gateworks.com
Tue May 24 20:03:51 CEST 2016
The GSC Temperature sensor is a 2's complement value - adjust accordingly
for negative temperatures.
Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
board/gateworks/gw_ventana/gsc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/board/gateworks/gw_ventana/gsc.c b/board/gateworks/gw_ventana/gsc.c
index 2555824..c626ba2 100644
--- a/board/gateworks/gw_ventana/gsc.c
+++ b/board/gateworks/gw_ventana/gsc.c
@@ -71,6 +71,8 @@ static void read_hwmon(const char *name, uint reg, uint size)
puts("fRD\n");
} else {
ui = buf[0] | (buf[1]<<8) | (buf[2]<<16);
+ if (reg == GSC_HWMON_TEMP && ui > 0x8000)
+ ui -= 0xffff;
if (ui == 0xffffff)
puts("invalid\n");
else
--
1.9.1
More information about the U-Boot
mailing list