diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 88 |
1 files changed, 60 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2113f401f0ba..56a1637c864f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8275,12 +8275,14 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
8275 | { | 8275 | { |
8276 | struct drm_i915_private *dev_priv = dev->dev_private; | 8276 | struct drm_i915_private *dev_priv = dev->dev_private; |
8277 | struct intel_encoder *encoder; | 8277 | struct intel_encoder *encoder; |
8278 | int i; | ||
8278 | u32 val, final; | 8279 | u32 val, final; |
8279 | bool has_lvds = false; | 8280 | bool has_lvds = false; |
8280 | bool has_cpu_edp = false; | 8281 | bool has_cpu_edp = false; |
8281 | bool has_panel = false; | 8282 | bool has_panel = false; |
8282 | bool has_ck505 = false; | 8283 | bool has_ck505 = false; |
8283 | bool can_ssc = false; | 8284 | bool can_ssc = false; |
8285 | bool using_ssc_source = false; | ||
8284 | 8286 | ||
8285 | /* We need to take the global config into account */ | 8287 | /* We need to take the global config into account */ |
8286 | for_each_intel_encoder(dev, encoder) { | 8288 | for_each_intel_encoder(dev, encoder) { |
@@ -8307,8 +8309,22 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
8307 | can_ssc = true; | 8309 | can_ssc = true; |
8308 | } | 8310 | } |
8309 | 8311 | ||
8310 | DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d\n", | 8312 | /* Check if any DPLLs are using the SSC source */ |
8311 | has_panel, has_lvds, has_ck505); | 8313 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
8314 | u32 temp = I915_READ(PCH_DPLL(i)); | ||
8315 | |||
8316 | if (!(temp & DPLL_VCO_ENABLE)) | ||
8317 | continue; | ||
8318 | |||
8319 | if ((temp & PLL_REF_INPUT_MASK) == | ||
8320 | PLLB_REF_INPUT_SPREADSPECTRUMIN) { | ||
8321 | using_ssc_source = true; | ||
8322 | break; | ||
8323 | } | ||
8324 | } | ||
8325 | |||
8326 | DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n", | ||
8327 | has_panel, has_lvds, has_ck505, using_ssc_source); | ||
8312 | 8328 | ||
8313 | /* Ironlake: try to setup display ref clock before DPLL | 8329 | /* Ironlake: try to setup display ref clock before DPLL |
8314 | * enabling. This is only under driver's control after | 8330 | * enabling. This is only under driver's control after |
@@ -8345,9 +8361,9 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
8345 | final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | 8361 | final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
8346 | } else | 8362 | } else |
8347 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; | 8363 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
8348 | } else { | 8364 | } else if (using_ssc_source) { |
8349 | final |= DREF_SSC_SOURCE_DISABLE; | 8365 | final |= DREF_SSC_SOURCE_ENABLE; |
8350 | final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; | 8366 | final |= DREF_SSC1_ENABLE; |
8351 | } | 8367 | } |
8352 | 8368 | ||
8353 | if (final == val) | 8369 | if (final == val) |
@@ -8393,7 +8409,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
8393 | POSTING_READ(PCH_DREF_CONTROL); | 8409 | POSTING_READ(PCH_DREF_CONTROL); |
8394 | udelay(200); | 8410 | udelay(200); |
8395 | } else { | 8411 | } else { |
8396 | DRM_DEBUG_KMS("Disabling SSC entirely\n"); | 8412 | DRM_DEBUG_KMS("Disabling CPU source output\n"); |
8397 | 8413 | ||
8398 | val &= ~DREF_CPU_SOURCE_OUTPUT_MASK; | 8414 | val &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
8399 | 8415 | ||
@@ -8404,16 +8420,20 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) | |||
8404 | POSTING_READ(PCH_DREF_CONTROL); | 8420 | POSTING_READ(PCH_DREF_CONTROL); |
8405 | udelay(200); | 8421 | udelay(200); |
8406 | 8422 | ||
8407 | /* Turn off the SSC source */ | 8423 | if (!using_ssc_source) { |
8408 | val &= ~DREF_SSC_SOURCE_MASK; | 8424 | DRM_DEBUG_KMS("Disabling SSC source\n"); |
8409 | val |= DREF_SSC_SOURCE_DISABLE; | ||
8410 | 8425 | ||
8411 | /* Turn off SSC1 */ | 8426 | /* Turn off the SSC source */ |
8412 | val &= ~DREF_SSC1_ENABLE; | 8427 | val &= ~DREF_SSC_SOURCE_MASK; |
8428 | val |= DREF_SSC_SOURCE_DISABLE; | ||
8413 | 8429 | ||
8414 | I915_WRITE(PCH_DREF_CONTROL, val); | 8430 | /* Turn off SSC1 */ |
8415 | POSTING_READ(PCH_DREF_CONTROL); | 8431 | val &= ~DREF_SSC1_ENABLE; |
8416 | udelay(200); | 8432 | |
8433 | I915_WRITE(PCH_DREF_CONTROL, val); | ||
8434 | POSTING_READ(PCH_DREF_CONTROL); | ||
8435 | udelay(200); | ||
8436 | } | ||
8417 | } | 8437 | } |
8418 | 8438 | ||
8419 | BUG_ON(val != final); | 8439 | BUG_ON(val != final); |
@@ -14554,6 +14574,8 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
14554 | if (I915_READ(PCH_DP_D) & DP_DETECTED) | 14574 | if (I915_READ(PCH_DP_D) & DP_DETECTED) |
14555 | intel_dp_init(dev, PCH_DP_D, PORT_D); | 14575 | intel_dp_init(dev, PCH_DP_D, PORT_D); |
14556 | } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { | 14576 | } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { |
14577 | bool has_edp, has_port; | ||
14578 | |||
14557 | /* | 14579 | /* |
14558 | * The DP_DETECTED bit is the latched state of the DDC | 14580 | * The DP_DETECTED bit is the latched state of the DDC |
14559 | * SDA pin at boot. However since eDP doesn't require DDC | 14581 | * SDA pin at boot. However since eDP doesn't require DDC |
@@ -14562,27 +14584,37 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
14562 | * Thus we can't rely on the DP_DETECTED bit alone to detect | 14584 | * Thus we can't rely on the DP_DETECTED bit alone to detect |
14563 | * eDP ports. Consult the VBT as well as DP_DETECTED to | 14585 | * eDP ports. Consult the VBT as well as DP_DETECTED to |
14564 | * detect eDP ports. | 14586 | * detect eDP ports. |
14587 | * | ||
14588 | * Sadly the straps seem to be missing sometimes even for HDMI | ||
14589 | * ports (eg. on Voyo V3 - CHT x7-Z8700), so check both strap | ||
14590 | * and VBT for the presence of the port. Additionally we can't | ||
14591 | * trust the port type the VBT declares as we've seen at least | ||
14592 | * HDMI ports that the VBT claim are DP or eDP. | ||
14565 | */ | 14593 | */ |
14566 | if (I915_READ(VLV_HDMIB) & SDVO_DETECTED && | 14594 | has_edp = intel_dp_is_edp(dev, PORT_B); |
14567 | !intel_dp_is_edp(dev, PORT_B)) | 14595 | has_port = intel_bios_is_port_present(dev_priv, PORT_B); |
14596 | if (I915_READ(VLV_DP_B) & DP_DETECTED || has_port) | ||
14597 | has_edp &= intel_dp_init(dev, VLV_DP_B, PORT_B); | ||
14598 | if ((I915_READ(VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp) | ||
14568 | intel_hdmi_init(dev, VLV_HDMIB, PORT_B); | 14599 | intel_hdmi_init(dev, VLV_HDMIB, PORT_B); |
14569 | if (I915_READ(VLV_DP_B) & DP_DETECTED || | ||
14570 | intel_dp_is_edp(dev, PORT_B)) | ||
14571 | intel_dp_init(dev, VLV_DP_B, PORT_B); | ||
14572 | 14600 | ||
14573 | if (I915_READ(VLV_HDMIC) & SDVO_DETECTED && | 14601 | has_edp = intel_dp_is_edp(dev, PORT_C); |
14574 | !intel_dp_is_edp(dev, PORT_C)) | 14602 | has_port = intel_bios_is_port_present(dev_priv, PORT_C); |
14603 | if (I915_READ(VLV_DP_C) & DP_DETECTED || has_port) | ||
14604 | has_edp &= intel_dp_init(dev, VLV_DP_C, PORT_C); | ||
14605 | if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp) | ||
14575 | intel_hdmi_init(dev, VLV_HDMIC, PORT_C); | 14606 | intel_hdmi_init(dev, VLV_HDMIC, PORT_C); |
14576 | if (I915_READ(VLV_DP_C) & DP_DETECTED || | ||
14577 | intel_dp_is_edp(dev, PORT_C)) | ||
14578 | intel_dp_init(dev, VLV_DP_C, PORT_C); | ||
14579 | 14607 | ||
14580 | if (IS_CHERRYVIEW(dev)) { | 14608 | if (IS_CHERRYVIEW(dev)) { |
14581 | /* eDP not supported on port D, so don't check VBT */ | 14609 | /* |
14582 | if (I915_READ(CHV_HDMID) & SDVO_DETECTED) | 14610 | * eDP not supported on port D, |
14583 | intel_hdmi_init(dev, CHV_HDMID, PORT_D); | 14611 | * so no need to worry about it |
14584 | if (I915_READ(CHV_DP_D) & DP_DETECTED) | 14612 | */ |
14613 | has_port = intel_bios_is_port_present(dev_priv, PORT_D); | ||
14614 | if (I915_READ(CHV_DP_D) & DP_DETECTED || has_port) | ||
14585 | intel_dp_init(dev, CHV_DP_D, PORT_D); | 14615 | intel_dp_init(dev, CHV_DP_D, PORT_D); |
14616 | if (I915_READ(CHV_HDMID) & SDVO_DETECTED || has_port) | ||
14617 | intel_hdmi_init(dev, CHV_HDMID, PORT_D); | ||
14586 | } | 14618 | } |
14587 | 14619 | ||
14588 | intel_dsi_init(dev); | 14620 | intel_dsi_init(dev); |