From bfbfc777e11bc3e900d691ca71643b75b9b111e2 Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 23 Jan 2014 14:15:07 -0200 Subject: [PATCH] drm/i915: some HSW non-ULT machines may also not have CRT So check for this on SFUSE_STRAP, otherwise we may hard hang the machine while booting (!!). Since the CRT detection is getting complicated, move it to inside the huge "if" statement so we don't accidentally kill CRT on older gens.. While at it, don't reuse the "found" variable to store register contents, and kill an obvious comment. Cc: stable@vger.kernel.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73559 Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 242f540..872c754 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -5398,6 +5398,7 @@ /* SFUSE_STRAP */ #define SFUSE_STRAP 0xc2014 +#define SFUSE_STRAP_CRT_DISABLED (1<<6) /* Only present on LPT:H */ #define SFUSE_STRAP_DDIB_DETECTED (1<<2) #define SFUSE_STRAP_DDIC_DETECTED (1<<1) #define SFUSE_STRAP_DDID_DETECTED (1<<0) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ec96002..45c094c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10426,11 +10426,13 @@ static void intel_setup_outputs(struct drm_device *dev) intel_lvds_init(dev); - if (!IS_ULT(dev)) - intel_crt_init(dev); - if (HAS_DDI(dev)) { - int found; + bool found; + uint32_t sfuse_strap = I915_READ(SFUSE_STRAP); + + if (!IS_ULT(dev) && + (sfuse_strap & SFUSE_STRAP_CRT_DISABLED) == 0) + intel_crt_init(dev); /* Haswell uses DDI functions to detect digital outputs */ found = I915_READ(DDI_BUF_CTL_A) & DDI_INIT_DISPLAY_DETECTED; @@ -10438,20 +10440,18 @@ static void intel_setup_outputs(struct drm_device *dev) if (found) intel_ddi_init(dev, PORT_A); - /* DDI B, C and D detection is indicated by the SFUSE_STRAP - * register */ - found = I915_READ(SFUSE_STRAP); - - if (found & SFUSE_STRAP_DDIB_DETECTED) + if (sfuse_strap & SFUSE_STRAP_DDIB_DETECTED) intel_ddi_init(dev, PORT_B); - if (found & SFUSE_STRAP_DDIC_DETECTED) + if (sfuse_strap & SFUSE_STRAP_DDIC_DETECTED) intel_ddi_init(dev, PORT_C); - if (found & SFUSE_STRAP_DDID_DETECTED) + if (sfuse_strap & SFUSE_STRAP_DDID_DETECTED) intel_ddi_init(dev, PORT_D); } else if (HAS_PCH_SPLIT(dev)) { int found; dpd_is_edp = intel_dp_is_edp(dev, PORT_D); + intel_crt_init(dev); + if (has_edp_a(dev)) intel_dp_init(dev, DP_A, PORT_A); @@ -10476,6 +10476,9 @@ static void intel_setup_outputs(struct drm_device *dev) if (I915_READ(PCH_DP_D) & DP_DETECTED) intel_dp_init(dev, PCH_DP_D, PORT_D); } else if (IS_VALLEYVIEW(dev)) { + + intel_crt_init(dev); + if (I915_READ(VLV_DISPLAY_BASE + GEN4_HDMIB) & SDVO_DETECTED) { intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIB, PORT_B); @@ -10494,6 +10497,8 @@ static void intel_setup_outputs(struct drm_device *dev) } else if (SUPPORTS_DIGITAL_OUTPUTS(dev)) { bool found = false; + intel_crt_init(dev); + if (I915_READ(GEN3_SDVOB) & SDVO_DETECTED) { DRM_DEBUG_KMS("probing SDVOB\n"); found = intel_sdvo_init(dev, GEN3_SDVOB, true); @@ -10526,8 +10531,12 @@ static void intel_setup_outputs(struct drm_device *dev) if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) intel_dp_init(dev, DP_D, PORT_D); - } else if (IS_GEN2(dev)) + } else if (IS_GEN2(dev)) { + intel_crt_init(dev); intel_dvo_init(dev); + } else { + intel_crt_init(dev); + } if (SUPPORTS_TV(dev)) intel_tv_init(dev); -- 1.8.4.2