Add optional 49 degrees C temperature offset
authorGuenter Roeck <linux@roeck-us.net>
Wed, 25 Apr 2018 00:59:23 +0000 (17:59 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 25 Apr 2018 00:59:45 +0000 (17:59 -0700)
If bit 20 of the temperature register is set, there is an additional
temperature offset of 49 degrees C.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
k10temp.c

index 4cefd7eeace3ac5b62a7aecfdc3a1cd5d654fb73..e4a179d491bed6da66eb36a8c1efed2eec1a15b1 100644 (file)
--- a/k10temp.c
+++ b/k10temp.c
@@ -130,6 +130,9 @@ static ssize_t temp1_input_show(struct device *dev,
 
        data->read_tempreg(data->pdev, &regval);
        temp = (regval >> 21) * 125;
+       /* bit 20 indicates an additional temp offset of 49 degrees C */
+       if (regval & 0x80000)
+               temp -= 49000;
        if (temp > data->temp_offset)
                temp -= data->temp_offset;
        else