aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/coretemp.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 411257676133..256f70803eb3 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -374,7 +374,6 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
374 374
375static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) 375static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
376{ 376{
377 /* The 100C is default for both mobile and non mobile CPUs */
378 int err; 377 int err;
379 u32 eax, edx; 378 u32 eax, edx;
380 u32 val; 379 u32 val;
@@ -385,7 +384,8 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
385 */ 384 */
386 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 385 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
387 if (err) { 386 if (err) {
388 dev_warn(dev, "Unable to read TjMax from CPU.\n"); 387 if (c->x86_model > 0xe && c->x86_model != 0x1c)
388 dev_warn(dev, "Unable to read TjMax from CPU %u\n", id);
389 } else { 389 } else {
390 val = (eax >> 16) & 0xff; 390 val = (eax >> 16) & 0xff;
391 /* 391 /*
@@ -393,7 +393,7 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
393 * will be used 393 * will be used
394 */ 394 */
395 if (val) { 395 if (val) {
396 dev_info(dev, "TjMax is %d C.\n", val); 396 dev_dbg(dev, "TjMax is %d degrees C\n", val);
397 return val * 1000; 397 return val * 1000;
398 } 398 }
399 } 399 }
@@ -414,21 +414,6 @@ static void __devinit get_ucode_rev_on_cpu(void *edx)
414 rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx); 414 rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
415} 415}
416 416
417static int get_pkg_tjmax(unsigned int cpu, struct device *dev)
418{
419 int err;
420 u32 eax, edx, val;
421
422 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
423 if (!err) {
424 val = (eax >> 16) & 0xff;
425 if (val)
426 return val * 1000;
427 }
428 dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu);
429 return 100000; /* Default TjMax: 100 degree celsius */
430}
431
432static int create_name_attr(struct platform_data *pdata, struct device *dev) 417static int create_name_attr(struct platform_data *pdata, struct device *dev)
433{ 418{
434 sysfs_attr_init(&pdata->name_attr.attr); 419 sysfs_attr_init(&pdata->name_attr.attr);
@@ -588,10 +573,7 @@ static int create_core_data(struct platform_data *pdata,
588 goto exit_free; 573 goto exit_free;
589 574
590 /* We can access status register. Get Critical Temperature */ 575 /* We can access status register. Get Critical Temperature */
591 if (pkg_flag) 576 tdata->tjmax = get_tjmax(c, cpu, &pdev->dev);
592 tdata->tjmax = get_pkg_tjmax(pdev->id, &pdev->dev);
593 else
594 tdata->tjmax = get_tjmax(c, cpu, &pdev->dev);
595 577
596 /* 578 /*
597 * Test if we can access the intrpt register. If so, increase the 579 * Test if we can access the intrpt register. If so, increase the