diff options
author | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2012-05-09 14:37:16 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-19 16:39:46 -0400 |
commit | d0d3e513609a19de52a42ee25ce40fd5b55b5a38 (patch) | |
tree | d18e1efd7976d125aa9b38a137f81ac120a5011b | |
parent | 6ee8bab09d515503f9f1d01690840c2bd5f66267 (diff) |
drm/i915: enable power wells on Haswell init
This attempts to enable all the available power wells during the
initialization.
Those power wells can be enabled in parallel or on-demand, and disabled
when no longer needed, but this is out of scope of this initial
enablement. Proper tracking of who uses which power well will require
a considerable rework of our display handling, so we just leave them all
enabled when the driver is loaded for now.
v2: use more generic and future-proof code
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 21587f89f44b..bd9549de4a3b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -3559,6 +3559,37 @@ void intel_sanitize_pm(struct drm_device *dev) | |||
3559 | dev_priv->display.sanitize_pm(dev); | 3559 | dev_priv->display.sanitize_pm(dev); |
3560 | } | 3560 | } |
3561 | 3561 | ||
3562 | /* Starting with Haswell, we have different power wells for | ||
3563 | * different parts of the GPU. This attempts to enable them all. | ||
3564 | */ | ||
3565 | void intel_init_power_wells(struct drm_device *dev) | ||
3566 | { | ||
3567 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
3568 | unsigned long power_wells[] = { | ||
3569 | HSW_PWR_WELL_CTL1, | ||
3570 | HSW_PWR_WELL_CTL2, | ||
3571 | HSW_PWR_WELL_CTL4 | ||
3572 | }; | ||
3573 | int i; | ||
3574 | |||
3575 | if (!IS_HASWELL(dev)) | ||
3576 | return; | ||
3577 | |||
3578 | mutex_lock(&dev->struct_mutex); | ||
3579 | |||
3580 | for (i = 0; i < ARRAY_SIZE(power_wells); i++) { | ||
3581 | int well = I915_READ(power_wells[i]); | ||
3582 | |||
3583 | if ((well & HSW_PWR_WELL_STATE) == 0) { | ||
3584 | I915_WRITE(power_wells[i], well & HSW_PWR_WELL_ENABLE); | ||
3585 | if (wait_for(I915_READ(power_wells[i] & HSW_PWR_WELL_STATE), 20)) | ||
3586 | DRM_ERROR("Error enabling power well %lx\n", power_wells[i]); | ||
3587 | } | ||
3588 | } | ||
3589 | |||
3590 | mutex_unlock(&dev->struct_mutex); | ||
3591 | } | ||
3592 | |||
3562 | /* Set up chip specific power management-related functions */ | 3593 | /* Set up chip specific power management-related functions */ |
3563 | void intel_init_pm(struct drm_device *dev) | 3594 | void intel_init_pm(struct drm_device *dev) |
3564 | { | 3595 | { |
@@ -3707,5 +3738,10 @@ void intel_init_pm(struct drm_device *dev) | |||
3707 | else | 3738 | else |
3708 | dev_priv->display.get_fifo_size = i830_get_fifo_size; | 3739 | dev_priv->display.get_fifo_size = i830_get_fifo_size; |
3709 | } | 3740 | } |
3741 | |||
3742 | /* We attempt to init the necessary power wells early in the initialization | ||
3743 | * time, so the subsystems that expect power to be enabled can work. | ||
3744 | */ | ||
3745 | intel_init_power_wells(dev); | ||
3710 | } | 3746 | } |
3711 | 3747 | ||