Skip to contentSkip to conversation

Add the temp offset diode register to the k8temp

lm-sensors TuskenTower 1 participant 1 message Apr 13, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

[CC'ing the lm-sensors list in case the Documentation/hwmon/k8temp documentation is out of date]

Hi Rudolf,
I have attached my patch (sorry gmail always screws them up for me) to have the k8temp utilize the temperature diode offset when calculating the reported temperature.

Short Story:
I started looking at this because the k8temp driver reported temperatures that were very different from those reported by the BIOS. Since I couldn't make heads or tails of why the numbers were wrong, I read the spec sheet and the driver source. I came up with the changes based on spec sheet (see my bug report). The temperature reported by k8temp is not the same as the BIOS, but both CPU temps are uniformly 6 degrees C lower than BIOS reported temps. The diode offset corrects CPU1 by 4 and CPU 2 by 7.

I was wondering what you thought of my changes.

For the long story , please see http://www.lm-sensors.org/ticket/2200 .

thanks,
Amul

drivers/hwmon/k8temp.c +3 -1
diff -uprN kernel.orig/drivers/hwmon/k8temp.c kernel/drivers/hwmon/k8temp.c
@@ -33,6 +33,7 @@
 #include <linux/mutex.h>
 
 #define TEMP_FROM_REG(val)	(((((val) >> 16) & 0xff) - 49) * 1000)
+#define OFFSET_FROM_REG(val)	((val >> 8) & 0x3f)?(11 - ((val >> 8) & 0x3f)):0
 #define REG_TEMP	0xe4
 #define SEL_PLACE	0x40
 #define SEL_CORE	0x04
@@ -117,7 +118,8 @@ static ssize_t show_temp(struct device *
 	struct k8temp_data *data = k8temp_update_device(dev);
 
 	return sprintf(buf, "%d\n",
-		       TEMP_FROM_REG(data->temp[core][place]));
+			((int) TEMP_FROM_REG(data->temp[core][place])) +
+			(((int) OFFSET_FROM_REG(data->temp[core][place]))*1000));
 }
 
 /* core, place */

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors