aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-05-20 17:27:23 -0400
committerMatthew Garrett <mjg@redhat.com>2010-08-03 09:48:46 -0400
commit0385e5210c83b13fe685c54b6063655f80bce3ee (patch)
treec1af73fd9367d1e5afd34cd14dd28b468da13cf8 /drivers/platform/x86
parentaa7ffc01d254c91a36bf854d57a14049c6134c72 (diff)
IPS driver: add GPU busy and turbo checking
Be sure to enable GPU turbo by default at load time and check GPU busy and MCP exceeded status correctly. Also fix up CPU power comparison and work around buggy MCH temp reporting. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/intel_ips.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index f1dce3b8372d..cdaf40e44460 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -515,7 +515,10 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
515 */ 515 */
516static bool ips_gpu_busy(struct ips_driver *ips) 516static bool ips_gpu_busy(struct ips_driver *ips)
517{ 517{
518 return false; 518 if (!ips->gpu_turbo_enabled)
519 return false;
520
521 return ips->gpu_busy();
519} 522}
520 523
521/** 524/**
@@ -627,7 +630,7 @@ static bool cpu_exceeded(struct ips_driver *ips, int cpu)
627 avg = cpu ? ips->ctv2_avg_temp : ips->ctv1_avg_temp; 630 avg = cpu ? ips->ctv2_avg_temp : ips->ctv1_avg_temp;
628 if (avg > (ips->limits->core_temp_limit * 100)) 631 if (avg > (ips->limits->core_temp_limit * 100))
629 ret = true; 632 ret = true;
630 if (ips->cpu_avg_power > ips->core_power_limit) 633 if (ips->cpu_avg_power > ips->core_power_limit * 100)
631 ret = true; 634 ret = true;
632 spin_unlock_irqrestore(&ips->turbo_status_lock, flags); 635 spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
633 636
@@ -652,6 +655,8 @@ static bool mch_exceeded(struct ips_driver *ips)
652 spin_lock_irqsave(&ips->turbo_status_lock, flags); 655 spin_lock_irqsave(&ips->turbo_status_lock, flags);
653 if (ips->mch_avg_temp > (ips->limits->mch_temp_limit * 100)) 656 if (ips->mch_avg_temp > (ips->limits->mch_temp_limit * 100))
654 ret = true; 657 ret = true;
658 if (ips->mch_avg_power > ips->mch_power_limit)
659 ret = true;
655 spin_unlock_irqrestore(&ips->turbo_status_lock, flags); 660 spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
656 661
657 return ret; 662 return ret;
@@ -747,7 +752,7 @@ static int ips_adjust(void *data)
747 ips_disable_gpu_turbo(ips); 752 ips_disable_gpu_turbo(ips);
748 753
749 /* We're outside our comfort zone, crank them down */ 754 /* We're outside our comfort zone, crank them down */
750 if (!mcp_exceeded(ips)) { 755 if (mcp_exceeded(ips)) {
751 ips_cpu_lower(ips); 756 ips_cpu_lower(ips);
752 ips_gpu_lower(ips); 757 ips_gpu_lower(ips);
753 goto sleep; 758 goto sleep;
@@ -808,8 +813,7 @@ static u16 read_mgtv(struct ips_driver *ips)
808 813
809 ret = ((val * slope + 0x40) >> 7) + offset; 814 ret = ((val * slope + 0x40) >> 7) + offset;
810 815
811 816 return 0; /* MCH temp reporting buggy */
812 return ret;
813} 817}
814 818
815static u16 read_ptv(struct ips_driver *ips) 819static u16 read_ptv(struct ips_driver *ips)
@@ -1471,14 +1475,6 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
1471 if (trc & TRC_CORE2_EN) 1475 if (trc & TRC_CORE2_EN)
1472 ips->second_cpu = true; 1476 ips->second_cpu = true;
1473 1477
1474 if (!ips_get_i915_syms(ips)) {
1475 dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n");
1476 ips->gpu_turbo_enabled = false;
1477 } else {
1478 dev_dbg(&dev->dev, "graphics turbo enabled\n");
1479 ips->gpu_turbo_enabled = true;
1480 }
1481
1482 update_turbo_limits(ips); 1478 update_turbo_limits(ips);
1483 dev_dbg(&dev->dev, "max cpu power clamp: %dW\n", 1479 dev_dbg(&dev->dev, "max cpu power clamp: %dW\n",
1484 ips->mcp_power_limit / 10); 1480 ips->mcp_power_limit / 10);
@@ -1488,6 +1484,14 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
1488 if (thm_readl(THM_PSC) & PSP_PBRT) 1484 if (thm_readl(THM_PSC) & PSP_PBRT)
1489 ips->poll_turbo_status = true; 1485 ips->poll_turbo_status = true;
1490 1486
1487 if (!ips_get_i915_syms(ips)) {
1488 dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n");
1489 ips->gpu_turbo_enabled = false;
1490 } else {
1491 dev_dbg(&dev->dev, "graphics turbo enabled\n");
1492 ips->gpu_turbo_enabled = true;
1493 }
1494
1491 /* 1495 /*
1492 * Check PLATFORM_INFO MSR to make sure this chip is 1496 * Check PLATFORM_INFO MSR to make sure this chip is
1493 * turbo capable. 1497 * turbo capable.