From: Tim Harvey Date: Tue, 24 May 2016 18:03:51 +0000 (-0700) Subject: imx: ventana: gsc: fix negative temperature readings X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=82a17e75da0d812c2e583e733efd1e67e7488933;p=u-boot.git imx: ventana: gsc: fix negative temperature readings The GSC Temperature sensor is a 2's complement value - adjust accordingly for negative temperatures. Signed-off-by: Tim Harvey --- diff --git a/board/gateworks/gw_ventana/gsc.c b/board/gateworks/gw_ventana/gsc.c index 2555824259..c626ba25e7 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