]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: ventana: gsc: fix negative temperature readings
authorTim Harvey <tharvey@gateworks.com>
Tue, 24 May 2016 18:03:51 +0000 (11:03 -0700)
committerStefano Babic <sbabic@denx.de>
Tue, 31 May 2016 15:24:30 +0000 (17:24 +0200)
The GSC Temperature sensor is a 2's complement value - adjust accordingly
for negative temperatures.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
board/gateworks/gw_ventana/gsc.c

index 255582425990a12bbc4c5e39ebf5c68f3be7c8d2..c626ba25e73b267dedb1fb62c9bca9a135ec95f7 100644 (file)
@@ -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