diff options
| author | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
|---|---|---|
| committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
| commit | a215aa7b9ab3759c047201199fba64d3042d7f13 (patch) | |
| tree | bca37493d9b2233450e6d3ffced1261d0e4f71fe /drivers/platform/x86/intel_ips.c | |
| parent | d31199a77ef606f1d06894385f1852181ba6136b (diff) | |
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'drivers/platform/x86/intel_ips.c')
| -rw-r--r-- | drivers/platform/x86/intel_ips.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index c44a5e8b8b82..f0b3ad13c273 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | #include <drm/i915_drm.h> | 75 | #include <drm/i915_drm.h> |
| 76 | #include <asm/msr.h> | 76 | #include <asm/msr.h> |
| 77 | #include <asm/processor.h> | 77 | #include <asm/processor.h> |
| 78 | #include "intel_ips.h" | ||
| 78 | 79 | ||
| 79 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 | 80 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 |
| 80 | 81 | ||
| @@ -245,6 +246,7 @@ | |||
| 245 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) | 246 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) |
| 246 | 247 | ||
| 247 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ | 248 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ |
| 249 | static bool late_i915_load = false; | ||
| 248 | 250 | ||
| 249 | /* For initial average collection */ | 251 | /* For initial average collection */ |
| 250 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ | 252 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ |
| @@ -339,6 +341,9 @@ struct ips_driver { | |||
| 339 | u64 orig_turbo_ratios; | 341 | u64 orig_turbo_ratios; |
| 340 | }; | 342 | }; |
| 341 | 343 | ||
| 344 | static bool | ||
| 345 | ips_gpu_turbo_enabled(struct ips_driver *ips); | ||
| 346 | |||
| 342 | /** | 347 | /** |
| 343 | * ips_cpu_busy - is CPU busy? | 348 | * ips_cpu_busy - is CPU busy? |
| 344 | * @ips: IPS driver struct | 349 | * @ips: IPS driver struct |
| @@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) | |||
| 517 | */ | 522 | */ |
| 518 | static bool ips_gpu_busy(struct ips_driver *ips) | 523 | static bool ips_gpu_busy(struct ips_driver *ips) |
| 519 | { | 524 | { |
| 520 | if (!ips->gpu_turbo_enabled) | 525 | if (!ips_gpu_turbo_enabled(ips)) |
| 521 | return false; | 526 | return false; |
| 522 | 527 | ||
| 523 | return ips->gpu_busy(); | 528 | return ips->gpu_busy(); |
| @@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips) | |||
| 532 | */ | 537 | */ |
| 533 | static void ips_gpu_raise(struct ips_driver *ips) | 538 | static void ips_gpu_raise(struct ips_driver *ips) |
| 534 | { | 539 | { |
| 535 | if (!ips->gpu_turbo_enabled) | 540 | if (!ips_gpu_turbo_enabled(ips)) |
| 536 | return; | 541 | return; |
| 537 | 542 | ||
| 538 | if (!ips->gpu_raise()) | 543 | if (!ips->gpu_raise()) |
| @@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips) | |||
| 549 | */ | 554 | */ |
| 550 | static void ips_gpu_lower(struct ips_driver *ips) | 555 | static void ips_gpu_lower(struct ips_driver *ips) |
| 551 | { | 556 | { |
| 552 | if (!ips->gpu_turbo_enabled) | 557 | if (!ips_gpu_turbo_enabled(ips)) |
| 553 | return; | 558 | return; |
| 554 | 559 | ||
| 555 | if (!ips->gpu_lower()) | 560 | if (!ips->gpu_lower()) |
| @@ -1454,6 +1459,31 @@ out_err: | |||
| 1454 | return false; | 1459 | return false; |
| 1455 | } | 1460 | } |
| 1456 | 1461 | ||
| 1462 | static bool | ||
| 1463 | ips_gpu_turbo_enabled(struct ips_driver *ips) | ||
| 1464 | { | ||
| 1465 | if (!ips->gpu_busy && late_i915_load) { | ||
| 1466 | if (ips_get_i915_syms(ips)) { | ||
| 1467 | dev_info(&ips->dev->dev, | ||
| 1468 | "i915 driver attached, reenabling gpu turbo\n"); | ||
| 1469 | ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS); | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | return ips->gpu_turbo_enabled; | ||
| 1474 | } | ||
| 1475 | |||
| 1476 | void | ||
| 1477 | ips_link_to_i915_driver() | ||
| 1478 | { | ||
| 1479 | /* We can't cleanly get at the various ips_driver structs from | ||
| 1480 | * this caller (the i915 driver), so just set a flag saying | ||
| 1481 | * that it's time to try getting the symbols again. | ||
| 1482 | */ | ||
| 1483 | late_i915_load = true; | ||
| 1484 | } | ||
| 1485 | EXPORT_SYMBOL_GPL(ips_link_to_i915_driver); | ||
| 1486 | |||
| 1457 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { | 1487 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { |
| 1458 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | 1488 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, |
| 1459 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, | 1489 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, |
