aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorCarsten Emde <C.Emde@osadl.org>2010-05-24 17:33:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 11:07:07 -0400
commit5db47b009d17d69a2f8d84357e7b24c3e3c2edec (patch)
treee2b4b84a7a24bc5eb02581bec4f4fa623d046406 /drivers/hwmon
parente0c70b80786296d4f3c35ebe0d52591cebf8f916 (diff)
drivers/hwmon/coretemp.c: detect the thermal sensors by CPUID
The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction, indicated by CPUID.06H.EAX[0]. Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com> Signed-off-by: Carsten Emde <C.Emde@osadl.org> Reviewed-by: Valdis Kletnieks <valdis.kletnieks@vt.edu> Cc: Jean Delvare <khali@linux-fr.org> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Yong Wang <yong.y.wang@linux.intel.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/coretemp.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index e9b7fbc5a447..9fae7cbc5d76 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -451,28 +451,20 @@ static int __init coretemp_init(void)
451 451
452 for_each_online_cpu(i) { 452 for_each_online_cpu(i) {
453 struct cpuinfo_x86 *c = &cpu_data(i); 453 struct cpuinfo_x86 *c = &cpu_data(i);
454 /*
455 * CPUID.06H.EAX[0] indicates whether the CPU has thermal
456 * sensors. We check this bit only, all the early CPUs
457 * without thermal sensors will be filtered out.
458 */
459 if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
460 err = coretemp_device_add(i);
461 if (err)
462 goto exit_devices_unreg;
454 463
455 /* check if family 6, models 0xe (Pentium M DC), 464 } else {
456 0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm), 465 printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
457 0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom), 466 " has no thermal sensor.\n", c->x86_model);
458 0x1e (Lynnfield) */
459 if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
460 !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
461 (c->x86_model == 0x16) || (c->x86_model == 0x17) ||
462 (c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
463 (c->x86_model == 0x1e))) {
464
465 /* supported CPU not found, but report the unknown
466 family 6 CPU */
467 if ((c->x86 == 0x6) && (c->x86_model > 0xf))
468 printk(KERN_WARNING DRVNAME ": Unknown CPU "
469 "model 0x%x\n", c->x86_model);
470 continue;
471 } 467 }
472
473 err = coretemp_device_add(i);
474 if (err)
475 goto exit_devices_unreg;
476 } 468 }
477 if (list_empty(&pdev_list)) { 469 if (list_empty(&pdev_list)) {
478 err = -ENODEV; 470 err = -ENODEV;