Skip to contentSkip to conversation

drm/i915/dp: Rename has_edp to is_pch_edp to reflect its real meaning

PATCH Applied Adam Jackson 5 participants 11 messages Jul 16, 2010 – Oct 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 drm/i915/dp: Rename has_edp to is_pch_edp to reflect its real meaning

---
 drivers/gpu/drm/i915/intel_dp.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -4
index b4f0282..c2b3d9b 100644
@@ -43,7 +43,7 @@
 #define DP_LINK_CONFIGURATION_SIZE	9
 
 #define IS_eDP(i) ((i)->type == INTEL_OUTPUT_EDP)
-#define IS_PCH_eDP(dp_priv) ((dp_priv)->has_edp)
+#define IS_PCH_eDP(dp_priv) ((dp_priv)->is_pch_edp)
 
 struct intel_dp_priv {
 	uint32_t output_reg;
@@ -57,7 +57,7 @@ struct intel_dp_priv {
 	struct intel_encoder *intel_encoder;
 	struct i2c_adapter adapter;
 	struct i2c_algo_dp_aux_data algo;
-	bool has_edp;
+	bool is_pch_edp;
 };
 
 static void
@@ -598,7 +598,7 @@ bool intel_pch_has_edp(struct drm_crtc *crtc)
 		dp_priv = intel_encoder->dev_priv;
 
 		if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT)
-			return dp_priv->has_edp;
+			return dp_priv->is_pch_edp;
 	}
 	return false;
 }
@@ -1481,7 +1481,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 
 	if (HAS_PCH_SPLIT(dev) && (output_reg == PCH_DP_D)) {
 		if (intel_dpd_is_edp(dev))
-			dp_priv->has_edp = true;
+			dp_priv->is_pch_edp = true;
 	}
 
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
Signature · 1 line
1.7.1.1
#1 lore raw

PATCH 2/6 drm/i915/dp: Correctly report eDP in the core connector type

Do this for both real eDP and for PCH_DP_D when used as the eDP connection.

---
 drivers/gpu/drm/i915/intel_dp.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +14 -12
index c2b3d9b..48076a8 100644
@@ -1443,6 +1443,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 	struct intel_connector *intel_connector;
 	struct intel_dp_priv *dp_priv;
 	const char *name = NULL;
+	int type;
 
 	intel_encoder = kcalloc(sizeof(struct intel_encoder) +
 			       sizeof(struct intel_dp_priv), 1, GFP_KERNEL);
@@ -1457,18 +1458,24 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 
 	dp_priv = (struct intel_dp_priv *)(intel_encoder + 1);
 
+	if (HAS_PCH_SPLIT(dev) && (output_reg == PCH_DP_D))
+		if (intel_dpd_is_edp(dev))
+			dp_priv->is_pch_edp = true;
+
+	if (output_reg == DP_A || IS_PCH_eDP(dp_priv)) {
+		type = DRM_MODE_CONNECTOR_eDP;
+		intel_encoder->type = INTEL_OUTPUT_EDP;
+	} else {
+		type = DRM_MODE_CONNECTOR_DisplayPort;
+		intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
+	}
+
 	connector = &intel_connector->base;
-	drm_connector_init(dev, connector, &intel_dp_connector_funcs,
-			   DRM_MODE_CONNECTOR_DisplayPort);
+	drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
 	drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
 
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 
-	if (output_reg == DP_A)
-		intel_encoder->type = INTEL_OUTPUT_EDP;
-	else
-		intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
-
 	if (output_reg == DP_B || output_reg == PCH_DP_B)
 		intel_encoder->clone_mask = (1 << INTEL_DP_B_CLONE_BIT);
 	else if (output_reg == DP_C || output_reg == PCH_DP_C)
@@ -1479,11 +1486,6 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 	if (IS_eDP(intel_encoder))
 		intel_encoder->clone_mask = (1 << INTEL_EDP_CLONE_BIT);
 
-	if (HAS_PCH_SPLIT(dev) && (output_reg == PCH_DP_D)) {
-		if (intel_dpd_is_edp(dev))
-			dp_priv->is_pch_edp = true;
-	}
-
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
 	connector->interlace_allowed = true;
 	connector->doublescan_allowed = 0;
Signature · 1 line
1.7.1.1
#2 lore raw

Re: [PATCH 2/6] drm/i915/dp: Correctly report eDP in the core connector type

drivers/gpu/drm/i915/intel_dp.c intel_dp_init(struct drm_device *dev, int output_reg) · line 1472

Quoted 8 lines · Adam Jackson
drivers/gpu/drm/i915/intel_dp.c +8 -0
+	if (output_reg == DP_A || IS_PCH_eDP(dp_priv)) {
+		type = DRM_MODE_CONNECTOR_eDP;
+		intel_encoder->type = INTEL_OUTPUT_EDP;
+	} else {
+		type = DRM_MODE_CONNECTOR_DisplayPort;
+		intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
+	}
+

Adam, I believe this one causes regression on PCH eDP port as for bug 27220. It changes behavior in mode_set path to program FDI link properly.

I think above part should be reverted for .36 kernel. What's your idea?

Thanks Yakui to remind me about this recent change.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH 2/6] drm/i915/dp: Correctly report eDP in the core connector type

Quoted 14 lines · On Thu, 2 Sep 2010 23:37:26 +0800 Zhenyu Wang <[email protected]> wrote:

drivers/gpu/drm/i915/intel_dp.c intel_dp_init(struct drm_device *dev, int output_reg) · line 1472

Quoted 8 lines · Adam Jackson
drivers/gpu/drm/i915/intel_dp.c +8 -0
+	if (output_reg == DP_A || IS_PCH_eDP(dp_priv)) {
+		type = DRM_MODE_CONNECTOR_eDP;
+		intel_encoder->type = INTEL_OUTPUT_EDP;
+	} else {
+		type = DRM_MODE_CONNECTOR_DisplayPort;
+		intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
+	}
+

Adam, I believe this one causes regression on PCH eDP port as for bug 27220. It changes behavior in mode_set path to program FDI link properly.

Quoted 4 lines

I think above part should be reverted for .36 kernel. What's your idea?

Thanks Yakui to remind me about this recent change.

Did PCH eDP ever work? I'll try going back to a kernel before this change, but current code definitely seems broken (we get never try to get a real clock value for PCH eDP, and I don't think we program the transcoder regs at all).

Even with those fixed though (among other things), I haven't been able to get my Vaio with switchable graphics working. Which platforms did you have working, and what changeset is most likely to work?

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#4 lore raw

Re: drm/i915/dp: Correctly report eDP in the core connector type

Quoted 2 lines · Jesse Barnes

On Thu, 2 Sep 2010 23:37:26 +0800
Zhenyu Wang <[email protected]> wrote:

[snip]

Quoted 9 lines
Quoted 8 lines

Adam, I believe this one causes regression on PCH eDP port as for bug 27220. It changes behavior in mode_set path to program FDI link properly.

I think above part should be reverted for .36 kernel. What's your idea?

Thanks Yakui to remind me about this recent change.

Quoted 8 lines

Did PCH eDP ever work? I'll try going back to a kernel before this change, but current code definitely seems broken (we get never try to get a real clock value for PCH eDP, and I don't think we program the transcoder regs at all).

Even with those fixed though (among other things), I haven't been able to get my Vaio with switchable graphics working. Which platforms did you have working, and what changeset is most likely to work?

There were a few revisions that worked fine with a Vaio VPCZ11C5E, among them:

- 36e83a187ca7517e9bdce7148b1c2c27661ef38f
- a2757b6fab6dee3dbf43bdb7d7226d03747fbdb1

But I was unable to bisect the problem properly until now and bug 29414 isn't exactly helping either.

-jhz

#5 lore raw

Re: drm/i915/dp: Correctly report eDP in the core connector type

Quoted 22 lines · On Mon, 4 Oct 2010 15:13:17 +0200 Jan-Hendrik Zab <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

On Thu, 2 Sep 2010 23:37:26 +0800
Zhenyu Wang <[email protected]> wrote:

[snip]

Quoted 9 lines
Quoted 8 lines

Adam, I believe this one causes regression on PCH eDP port as for bug 27220. It changes behavior in mode_set path to program FDI link properly.

I think above part should be reverted for .36 kernel. What's your idea?

Thanks Yakui to remind me about this recent change.

Quoted 8 lines

Did PCH eDP ever work? I'll try going back to a kernel before this change, but current code definitely seems broken (we get never try to get a real clock value for PCH eDP, and I don't think we program the transcoder regs at all).

Even with those fixed though (among other things), I haven't been able to get my Vaio with switchable graphics working. Which platforms did you have working, and what changeset is most likely to work?

Quoted 8 lines

There were a few revisions that worked fine with a Vaio VPCZ11C5E, among them:

- 36e83a187ca7517e9bdce7148b1c2c27661ef38f
- a2757b6fab6dee3dbf43bdb7d7226d03747fbdb1

But I was unable to bisect the problem properly until now and bug 29414 isn't exactly helping either.

First commit adds eDP on PCH support but doesn't work for me. Second looks unrelated on ILK (SNB caching bits commit).

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#6 lore raw

PATCH 3/6 drm/i915: Initialize LVDS and eDP outputs before anything else

In reply to Adam Jackson

This makes them sort to the front in X, which makes them likely to be the primary outputs if you haven't specified a preference in your DE, which is likely to be what you want.

---
 drivers/gpu/drm/i915/intel_display.c |   17 ++++++++++++-----
 drivers/gpu/drm/i915/intel_dp.c      |    2 +-
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +12 -5
index 8359c50..b1b742b 100644
@@ -5086,19 +5086,26 @@ static void intel_setup_outputs(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_encoder *encoder;
+	bool dpd_is_edp = false;
 
-	intel_crt_init(dev);
-
-	/* Set up integrated LVDS */
 	if (IS_MOBILE(dev) && !IS_I830(dev))
 		intel_lvds_init(dev);
 
 	if (HAS_PCH_SPLIT(dev)) {
-		int found;
+		dpd_is_edp = intel_dpd_is_edp(dev);
 
 		if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED))
 			intel_dp_init(dev, DP_A);
 
+		if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
+			intel_dp_init(dev, PCH_DP_D);
+	}
+
+	intel_crt_init(dev);
+
+	if (HAS_PCH_SPLIT(dev)) {
+		int found;
+
 		if (I915_READ(HDMIB) & PORT_DETECTED) {
 			/* PCH SDVOB multiplex with HDMIB */
 			found = intel_sdvo_init(dev, PCH_SDVOB);
@@ -5117,7 +5124,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 		if (I915_READ(PCH_DP_C) & DP_DETECTED)
 			intel_dp_init(dev, PCH_DP_C);
 
-		if (I915_READ(PCH_DP_D) & DP_DETECTED)
+		if (!dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
 			intel_dp_init(dev, PCH_DP_D);
 
 	} else if (SUPPORTS_DIGITAL_OUTPUTS(dev)) {
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 48076a8..0468705 100644
@@ -1415,7 +1415,7 @@ intel_trans_dp_port_sel (struct drm_crtc *crtc)
 }
 
 /* check the VBT to see whether the eDP is on DP-D port */
-static bool intel_dpd_is_edp(struct drm_device *dev)
+bool intel_dpd_is_edp(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct child_device_config *p_child;
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 3fbedd8..ab2f9a0 100644
@@ -180,6 +180,7 @@ void
 intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 		 struct drm_display_mode *adjusted_mode);
 extern bool intel_pch_has_edp(struct drm_crtc *crtc);
+extern bool intel_dpd_is_edp(struct drm_device *dev);
 extern void intel_edp_link_config (struct intel_encoder *, int *, int *);
 
 
Signature · 1 line
1.7.1.1
#7 lore raw

PATCH 4/6 drm/i915/pch: Set transcoder sync polarity for DP based on actual mode

In reply to Adam Jackson
---
 drivers/gpu/drm/i915/intel_display.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -3
index b1b742b..889f4ed 100644
@@ -1983,9 +1983,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
 				reg = I915_READ(trans_dp_ctl);
 				reg &= ~TRANS_DP_PORT_SEL_MASK;
 				reg = TRANS_DP_OUTPUT_ENABLE |
-				      TRANS_DP_ENH_FRAMING |
-				      TRANS_DP_VSYNC_ACTIVE_HIGH |
-				      TRANS_DP_HSYNC_ACTIVE_HIGH;
+				      TRANS_DP_ENH_FRAMING;
+
+				if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
+				      reg |= TRANS_DP_HSYNC_ACTIVE_HIGH;
+				if (crtc->mode.flags & DRM_MODE_FLAG_PVSYNC)
+				      reg |= TRANS_DP_VSYNC_ACTIVE_HIGH;
 
 				switch (intel_trans_dp_port_sel(crtc)) {
 				case PCH_DP_B:
Signature · 1 line
1.7.1.1
#8 lore raw

PATCH 5/6 drm/i915/hdmi: Set sync polarity based on actual mode

In reply to Adam Jackson
---
 drivers/gpu/drm/i915/intel_hdmi.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +5 -4
index 83bd764..197887e 100644
@@ -54,10 +54,11 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 	struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
 	u32 sdvox;
 
-	sdvox = SDVO_ENCODING_HDMI |
-		SDVO_BORDER_ENABLE |
-		SDVO_VSYNC_ACTIVE_HIGH |
-		SDVO_HSYNC_ACTIVE_HIGH;
+	sdvox = SDVO_ENCODING_HDMI | SDVO_BORDER_ENABLE;
+	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
+		sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
+	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
+		sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 
 	if (hdmi_priv->has_hdmi_sink) {
 		sdvox |= SDVO_AUDIO_ENABLE;
Signature · 1 line
1.7.1.1
#9 lore raw

PATCH 6/6 drm/i915/sdvo: Set sync polarity based on actual mode

In reply to Adam Jackson
---
 drivers/gpu/drm/i915/intel_sdvo.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +5 -3
index 76993ac..8b2bfc0 100644
@@ -1237,9 +1237,11 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 
 	/* Set the SDVO control regs. */
 	if (IS_I965G(dev)) {
-		sdvox |= SDVO_BORDER_ENABLE |
-			SDVO_VSYNC_ACTIVE_HIGH |
-			SDVO_HSYNC_ACTIVE_HIGH;
+		sdvox |= SDVO_BORDER_ENABLE;
+		if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
+			sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
+		if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
+			sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 	} else {
 		sdvox |= I915_READ(sdvo_priv->sdvo_reg);
 		switch (sdvo_priv->sdvo_reg) {
Signature · 1 line
1.7.1.1