diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2009-01-15 16:27:47 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-01-15 16:27:47 -0500 |
commit | 76ff08da34196cfa308fcd3552bb9ea20888e745 (patch) | |
tree | da6e83ed71af4e13358400f5c1fb5b06eb19b206 /drivers/hwmon/k8temp.c | |
parent | a2e066bba2aad6583e3ff648bf28339d6c9f0898 (diff) |
hwmon: (k8temp) Fix temperature reporting for (most) K8 RevG CPUs
Current Temperature for K8 RevG desktop CPUs is a "normalized value"
which can be below ambient temperature.
As a consequence lots of RevG systems report temperatures like:
$ sensors
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: +17 C
Core0 Temp: +3 C
Core1 Temp: +21 C
Core1 Temp: +5 C
being quite below ambient temperature.
There are even reports of negative temperature values.
This patch corrects the temperature reporting of k8temp for
RevG desktop CPUs.
Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/k8temp.c')
-rw-r--r-- | drivers/hwmon/k8temp.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index a6381bc9189c..1fe995111841 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -49,6 +49,7 @@ struct k8temp_data { | |||
49 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ | 49 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ |
50 | u32 temp[2][2]; /* core, place */ | 50 | u32 temp[2][2]; /* core, place */ |
51 | u8 swap_core_select; /* meaning of SEL_CORE is inverted */ | 51 | u8 swap_core_select; /* meaning of SEL_CORE is inverted */ |
52 | u32 temp_offset; | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | static struct k8temp_data *k8temp_update_device(struct device *dev) | 55 | static struct k8temp_data *k8temp_update_device(struct device *dev) |
@@ -116,13 +117,15 @@ static ssize_t show_temp(struct device *dev, | |||
116 | to_sensor_dev_attr_2(devattr); | 117 | to_sensor_dev_attr_2(devattr); |
117 | int core = attr->nr; | 118 | int core = attr->nr; |
118 | int place = attr->index; | 119 | int place = attr->index; |
120 | int temp; | ||
119 | struct k8temp_data *data = k8temp_update_device(dev); | 121 | struct k8temp_data *data = k8temp_update_device(dev); |
120 | 122 | ||
121 | if (data->swap_core_select) | 123 | if (data->swap_core_select) |
122 | core = core ? 0 : 1; | 124 | core = core ? 0 : 1; |
123 | 125 | ||
124 | return sprintf(buf, "%d\n", | 126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; |
125 | TEMP_FROM_REG(data->temp[core][place])); | 127 | |
128 | return sprintf(buf, "%d\n", temp); | ||
126 | } | 129 | } |
127 | 130 | ||
128 | /* core, place */ | 131 | /* core, place */ |
@@ -176,6 +179,16 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
176 | "wrong - check erratum #141\n"); | 179 | "wrong - check erratum #141\n"); |
177 | } | 180 | } |
178 | 181 | ||
182 | if ((model >= 0x69) && | ||
183 | !(model == 0xc1 || model == 0x6c || model == 0x7c)) { | ||
184 | /* | ||
185 | * RevG desktop CPUs (i.e. no socket S1G1 parts) | ||
186 | * need additional offset, otherwise reported | ||
187 | * temperature is below ambient temperature | ||
188 | */ | ||
189 | data->temp_offset = 21000; | ||
190 | } | ||
191 | |||
179 | break; | 192 | break; |
180 | } | 193 | } |
181 | 194 | ||