aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2014-07-04 10:59:58 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 02:27:09 -0400
commit9ccd5aeb2901aaaabf77f185e2e5ea3a0b577e86 (patch)
tree201f29314c86977797f72c8c9e844860862d7082 /drivers/gpu/drm/i915/intel_display.c
parentf475dadf833691e6173dee9ad05953265f6ffe21 (diff)
drm/i915: fix D_COMP usage on BDW
On HSW, the D_COMP register can be accessed through the mailbox (read and write) or through MMIO on a MCHBAR offset (read only). On BDW, the access should be done through MMIO on another address. So to account for all these cases, create hsw_read_dcomp() with the correct implementation for reading, and also fix hsw_write_dcomp() to do the correct thing on BDW. With this patch, we can now get back from the PC8+ state on BDW. We were previously getting a black screen and lots of dmesg errors. Please notice that the bug only happens when you actually reach the PC8+ states, not when you only allow it. Testcase: igt/pm_rpm/rte Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index aea48715aa1e..34286c695bcf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7339,6 +7339,16 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv)
7339 WARN(!dev_priv->pm.irqs_disabled, "IRQs enabled\n"); 7339 WARN(!dev_priv->pm.irqs_disabled, "IRQs enabled\n");
7340} 7340}
7341 7341
7342static uint32_t hsw_read_dcomp(struct drm_i915_private *dev_priv)
7343{
7344 struct drm_device *dev = dev_priv->dev;
7345
7346 if (IS_HASWELL(dev))
7347 return I915_READ(D_COMP_HSW);
7348 else
7349 return I915_READ(D_COMP_BDW);
7350}
7351
7342static void hsw_write_dcomp(struct drm_i915_private *dev_priv, uint32_t val) 7352static void hsw_write_dcomp(struct drm_i915_private *dev_priv, uint32_t val)
7343{ 7353{
7344 struct drm_device *dev = dev_priv->dev; 7354 struct drm_device *dev = dev_priv->dev;
@@ -7350,9 +7360,9 @@ static void hsw_write_dcomp(struct drm_i915_private *dev_priv, uint32_t val)
7350 DRM_ERROR("Failed to write to D_COMP\n"); 7360 DRM_ERROR("Failed to write to D_COMP\n");
7351 mutex_unlock(&dev_priv->rps.hw_lock); 7361 mutex_unlock(&dev_priv->rps.hw_lock);
7352 } else { 7362 } else {
7353 I915_WRITE(D_COMP, val); 7363 I915_WRITE(D_COMP_BDW, val);
7364 POSTING_READ(D_COMP_BDW);
7354 } 7365 }
7355 POSTING_READ(D_COMP);
7356} 7366}
7357 7367
7358/* 7368/*
@@ -7390,12 +7400,13 @@ static void hsw_disable_lcpll(struct drm_i915_private *dev_priv,
7390 if (wait_for((I915_READ(LCPLL_CTL) & LCPLL_PLL_LOCK) == 0, 1)) 7400 if (wait_for((I915_READ(LCPLL_CTL) & LCPLL_PLL_LOCK) == 0, 1))
7391 DRM_ERROR("LCPLL still locked\n"); 7401 DRM_ERROR("LCPLL still locked\n");
7392 7402
7393 val = I915_READ(D_COMP); 7403 val = hsw_read_dcomp(dev_priv);
7394 val |= D_COMP_COMP_DISABLE; 7404 val |= D_COMP_COMP_DISABLE;
7395 hsw_write_dcomp(dev_priv, val); 7405 hsw_write_dcomp(dev_priv, val);
7396 ndelay(100); 7406 ndelay(100);
7397 7407
7398 if (wait_for((I915_READ(D_COMP) & D_COMP_RCOMP_IN_PROGRESS) == 0, 1)) 7408 if (wait_for((hsw_read_dcomp(dev_priv) & D_COMP_RCOMP_IN_PROGRESS) == 0,
7409 1))
7399 DRM_ERROR("D_COMP RCOMP still in progress\n"); 7410 DRM_ERROR("D_COMP RCOMP still in progress\n");
7400 7411
7401 if (allow_power_down) { 7412 if (allow_power_down) {
@@ -7444,7 +7455,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
7444 POSTING_READ(LCPLL_CTL); 7455 POSTING_READ(LCPLL_CTL);
7445 } 7456 }
7446 7457
7447 val = I915_READ(D_COMP); 7458 val = hsw_read_dcomp(dev_priv);
7448 val |= D_COMP_COMP_FORCE; 7459 val |= D_COMP_COMP_FORCE;
7449 val &= ~D_COMP_COMP_DISABLE; 7460 val &= ~D_COMP_COMP_DISABLE;
7450 hsw_write_dcomp(dev_priv, val); 7461 hsw_write_dcomp(dev_priv, val);