[Intel-gfx] [PATCH] drm/i915: move LVDS support check to output setup

Jani Nikula jani.nikula at intel.com
Tue Feb 12 18:06:59 CET 2013


Keep all the platform output selection in intel_output_setup(), and don't
scatter it around. As a useful side effect, do not try to enable LVDS on
HSW or VLV.

Some checks are done in a slightly different order than before, and on some
platforms VGA is now initialized before LVDS.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>

---

I took this out of the VLV series to give it the attention it needs.
---
 drivers/gpu/drm/i915/intel_display.c |   25 ++++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_lvds.c    |   24 ------------------------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d75c6a0..a1fb320 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8198,12 +8198,19 @@ static void intel_setup_outputs(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_encoder *encoder;
 	bool dpd_is_edp = false;
-	bool has_lvds;
 
-	has_lvds = intel_lvds_init(dev);
-	if (!has_lvds && !HAS_PCH_SPLIT(dev)) {
-		/* disable the panel fitter on everything but LVDS */
-		I915_WRITE(PFIT_CONTROL, 0);
+	if (!HAS_PCH_SPLIT(dev)) {
+		bool has_lvds = false;
+
+		/* Prior to PCH split LVDS was only attached to mobile products,
+		 * except for the inglorious 830gm */
+		if (IS_MOBILE(dev) && !IS_I830(dev))
+			has_lvds = intel_lvds_init(dev);
+
+		if (!has_lvds) {
+			/* disable the panel fitter on everything but LVDS */
+			I915_WRITE(PFIT_CONTROL, 0);
+		}
 	}
 
 	if (!(HAS_DDI(dev) && (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)))
@@ -8230,6 +8237,14 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_ddi_init(dev, PORT_D);
 	} else if (HAS_PCH_SPLIT(dev)) {
 		int found;
+
+		if (I915_READ(PCH_LVDS) & LVDS_DETECTED) {
+			if (dev_priv->edp.support)
+				DRM_DEBUG_KMS("disable LVDS for eDP support\n");
+			else
+				intel_lvds_init(dev);
+		}
+
 		dpd_is_edp = intel_dpd_is_edp(dev);
 
 		if (has_edp_a(dev))
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 7e4ec63..3c76e91 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1024,18 +1024,6 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 	return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
 }
 
-static bool intel_lvds_supported(struct drm_device *dev)
-{
-	/* With the introduction of the PCH we gained a dedicated
-	 * LVDS presence pin, use it. */
-	if (HAS_PCH_SPLIT(dev))
-		return true;
-
-	/* Otherwise LVDS was only attached to mobile products,
-	 * except for the inglorious 830gm */
-	return IS_MOBILE(dev) && !IS_I830(dev);
-}
-
 /**
  * intel_lvds_init - setup LVDS connectors on this device
  * @dev: drm device
@@ -1060,9 +1048,6 @@ bool intel_lvds_init(struct drm_device *dev)
 	int pipe;
 	u8 pin;
 
-	if (!intel_lvds_supported(dev))
-		return false;
-
 	/* Skip init on machines we know falsely report LVDS */
 	if (dmi_check_system(intel_no_lvds))
 		return false;
@@ -1073,15 +1058,6 @@ bool intel_lvds_init(struct drm_device *dev)
 		return false;
 	}
 
-	if (HAS_PCH_SPLIT(dev)) {
-		if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0)
-			return false;
-		if (dev_priv->edp.support) {
-			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
-			return false;
-		}
-	}
-
 	lvds_encoder = kzalloc(sizeof(struct intel_lvds_encoder), GFP_KERNEL);
 	if (!lvds_encoder)
 		return false;
-- 
1.7.10.4




More information about the Intel-gfx mailing list