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>
This commit is contained in:
parent
a2e066bba2
commit
76ff08da34
|
@ -49,6 +49,7 @@ struct k8temp_data {
|
||||||
u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */
|
u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */
|
||||||
u32 temp[2][2]; /* core, place */
|
u32 temp[2][2]; /* core, place */
|
||||||
u8 swap_core_select; /* meaning of SEL_CORE is inverted */
|
u8 swap_core_select; /* meaning of SEL_CORE is inverted */
|
||||||
|
u32 temp_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct k8temp_data *k8temp_update_device(struct device *dev)
|
static struct k8temp_data *k8temp_update_device(struct device *dev)
|
||||||
|
@ -116,13 +117,15 @@ static ssize_t show_temp(struct device *dev,
|
||||||
to_sensor_dev_attr_2(devattr);
|
to_sensor_dev_attr_2(devattr);
|
||||||
int core = attr->nr;
|
int core = attr->nr;
|
||||||
int place = attr->index;
|
int place = attr->index;
|
||||||
|
int temp;
|
||||||
struct k8temp_data *data = k8temp_update_device(dev);
|
struct k8temp_data *data = k8temp_update_device(dev);
|
||||||
|
|
||||||
if (data->swap_core_select)
|
if (data->swap_core_select)
|
||||||
core = core ? 0 : 1;
|
core = core ? 0 : 1;
|
||||||
|
|
||||||
return sprintf(buf, "%d\n",
|
temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
|
||||||
TEMP_FROM_REG(data->temp[core][place]));
|
|
||||||
|
return sprintf(buf, "%d\n", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* core, place */
|
/* core, place */
|
||||||
|
@ -176,6 +179,16 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
|
||||||
"wrong - check erratum #141\n");
|
"wrong - check erratum #141\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((model >= 0x69) &&
|
||||||
|
!(model == 0xc1 || model == 0x6c || model == 0x7c)) {
|
||||||
|
/*
|
||||||
|
* RevG desktop CPUs (i.e. no socket S1G1 parts)
|
||||||
|
* need additional offset, otherwise reported
|
||||||
|
* temperature is below ambient temperature
|
||||||
|
*/
|
||||||
|
data->temp_offset = 21000;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue