aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-10-09 15:27:12 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-12-05 13:55:54 -0500
commit72cbdddcc158fa52056619b81624df0cd9125a26 (patch)
tree17f2be20a7c9cd061a1238d64bbe70966013f0ae
parentd835ca0fd2d50d126530b55e3c5dfe1b9038e26b (diff)
hwmon: (coretemp) Drop dependency on PCI for TjMax detection on Atom CPUs
So far, we use the NM10 Express Chipset PCI chip ID to detect TjMax for Atom CPUs with model 0x1c. As it turns out, we can use the CPU stepping (x86_mask) for the same purpose; stepping is 10 for all model 0x1c CPUs with TjMax of 100 degrees C. This was verified by checking the output of /proc/cpuinfo for the respective CPUs (D4xx, D5xx, N4xx, N5xx). Other CPUs currently covered by the same code (Exx, Z6xx, Z2460) are not supported by the NM10 Express Chipset. Most of those CPUs have TjMax of 90 degrees C, except for E6xxT models which have a TjMax of 110 degrees C. E6xxT CPUs can however not be detected by software. Calculate TjMax for Atom CPUs as follows. Note that the listed values are not correct in some cases (230, 330). tjmax_table is used for those to override the default values. ID Stepping TjMax Models 0x1c 10 100 D4xx, N4xx, D5xx, N5xx 0x1c not 10 90 Z5xx, N2xx, 230, 330, others 0x26 - 90 Atom Tunnel Creek (Exx), Lincroft (Z6xx) 0x27 - 90 Atom Medfield (Z2460) 0x36 - 100 Atom Cedar Trail (N2xxx, D2xxx) Also drop the module dependency on PCI. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/hwmon/Kconfig2
-rw-r--r--drivers/hwmon/coretemp.c37
2 files changed, 16 insertions, 23 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 9e3d977c106b..42f21ad56276 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -455,7 +455,7 @@ config SENSORS_HIH6130
455 455
456config SENSORS_CORETEMP 456config SENSORS_CORETEMP
457 tristate "Intel Core/Core2/Atom temperature sensor" 457 tristate "Intel Core/Core2/Atom temperature sensor"
458 depends on X86 && PCI 458 depends on X86
459 help 459 help
460 If you say yes here you get support for the temperature 460 If you say yes here you get support for the temperature
461 sensor inside your CPU. Most of the family 6 CPUs 461 sensor inside your CPU. Most of the family 6 CPUs
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 47b8d84b489d..1653d0ddd1d0 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -34,7 +34,6 @@
34#include <linux/list.h> 34#include <linux/list.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/pci.h>
38#include <linux/smp.h> 37#include <linux/smp.h>
39#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
40#include <asm/msr.h> 39#include <asm/msr.h>
@@ -222,7 +221,6 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
222 int usemsr_ee = 1; 221 int usemsr_ee = 1;
223 int err; 222 int err;
224 u32 eax, edx; 223 u32 eax, edx;
225 struct pci_dev *host_bridge;
226 int i; 224 int i;
227 225
228 /* explicit tjmax table entries override heuristics */ 226 /* explicit tjmax table entries override heuristics */
@@ -231,31 +229,26 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
231 return tjmax_table[i].tjmax; 229 return tjmax_table[i].tjmax;
232 } 230 }
233 231
234 /* Early chips have no MSR for TjMax */
235
236 if (c->x86_model == 0xf && c->x86_mask < 4)
237 usemsr_ee = 0;
238
239 /* Atom CPUs */ 232 /* Atom CPUs */
240 233
241 if (c->x86_model == 0x1c || c->x86_model == 0x26 234 if (c->x86_model == 0x1c) {
242 || c->x86_model == 0x27) { 235 /*
243 usemsr_ee = 0; 236 * TjMax for stepping 10 CPUs (N4xx, N5xx, D4xx, D5xx)
244 237 * is 100 degrees C, for all others it is 90 degrees C.
245 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); 238 */
239 if (c->x86_mask == 10)
240 return 100000;
241 return 90000;
242 } else if (c->x86_model == 0x26 || c->x86_model == 0x27) {
243 return 90000;
244 } else if (c->x86_model == 0x36) {
245 return 100000;
246 }
246 247
247 if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL 248 /* Early chips have no MSR for TjMax */
248 && (host_bridge->device == 0xa000 /* NM10 based nettop */
249 || host_bridge->device == 0xa010)) /* NM10 based netbook */
250 tjmax = 100000;
251 else
252 tjmax = 90000;
253 249
254 pci_dev_put(host_bridge); 250 if (c->x86_model == 0xf && c->x86_mask < 4)
255 } else if (c->x86_model == 0x36) {
256 usemsr_ee = 0; 251 usemsr_ee = 0;
257 tjmax = 100000;
258 }
259 252
260 if (c->x86_model > 0xe && usemsr_ee) { 253 if (c->x86_model > 0xe && usemsr_ee) {
261 u8 platform_id; 254 u8 platform_id;