Fix 1600X model, and don't report negative temperatures
authorGuenter Roeck <linux@roeck-us.net>
Thu, 8 Feb 2018 01:58:40 +0000 (17:58 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 8 Feb 2018 01:58:40 +0000 (17:58 -0800)
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
k10temp.c

index c62ffe8dd7b16e5c56a922b12d03db5aaa4219fc..4c6594a4661d777e3ea29b66e8e0c7aca1f0e0f8 100644 (file)
--- a/k10temp.c
+++ b/k10temp.c
@@ -81,7 +81,7 @@ struct tctl_offset {
 };
 
 static const struct tctl_offset tctl_offset_table[] = {
-       { 0x17, "AMD Ryzen 7 1600X", 20000 },
+       { 0x17, "AMD Ryzen 5 1600X", 20000 },
        { 0x17, "AMD Ryzen 7 1700X", 20000 },
        { 0x17, "AMD Ryzen 7 1800X", 20000 },
        { 0x17, "AMD Ryzen Threadripper 1950X", 27000 },
@@ -129,7 +129,10 @@ static ssize_t temp1_input_show(struct device *dev,
 
        data->read_tempreg(data->pdev, &regval);
        temp = (regval >> 21) * 125;
-       temp -= data->temp_offset;
+       if (temp > data->temp_offset)
+               temp -= data->temp_offset;
+       else
+               temp = 0;
 
        return sprintf(buf, "%u\n", temp);
 }