Skip to contentSkip to conversation

drm/i915: Fix PCH eDP support for SNB

PATCH In review Keith Packard 5 participants 43 messages Nov 2, 2011 – Nov 3, 2011

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

cover drm/i915: Fix PCH eDP support for SNB

Here's a patch sequence which makes my PCH-connected eDP panel work. The main bug was a pile of places where the driver was incorrectly treating a PCH connected eDP panel like a CPU connected eDP panel, setting incorrect bits in the DP_CTL register and failing to configure the TRANS_DP_CTL register entirely.

Beyond that, this eDP panel appears very sensitive to panel power sequencing, and I found a bunch of minor errors there. I switched from using blind timings to polling the panel power sequencing status register to make sure we waited until that thought things were done, and so that any panel power sequencing errors would show up in the kernel log.

Finally, I noticed that the BIOS tried harder to get the link trained, by simply starting over when it failed and trying the whole sequence up to 5 times. This is not part of the DP spec, but given how bad failing to train a panel is, it seems like it might be a good idea.

The three most interesting patches are the one which handles PCH eDP more like PCH DP, the one which switches to using the panel power sequencing hardware for all delays and finally the patch which tries to do the panel power-up/down in the same order for both dp_prepare/commit and dp_dpms.

All of these patches are on my pch-edp-fixes branch at

git://people.freedesktop.org/~keithp/linux

If you've got a PCH connected eDP display, I'd love to know if this makes it work. If you've got a CPU connected eDP display or PCH connected DP, please see if this causes any problems.

(I've got several machines failing to resume with this patch, but I've checked and it's not the fault of anything in the i915 directory; applying this sequence to v3.1 makes suspend/resume work fine).

#1 lore raw

PATCH 1/7 drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control

Every usage of PCH_PP_CONTROL sets the PANEL_UNLOCK_REGS value to ensure that writes will be respected, move this to a common function to make the driver cleaner.

No functional changes.

---
 drivers/gpu/drm/i915/intel_dp.c |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -18
index 7259034..efe5f9e 100644
@@ -906,6 +906,19 @@ static void ironlake_wait_panel_off(struct intel_dp *intel_dp)
 	msleep(delay);
 }
 
+/* Read the current pp_control value, unlocking the register if it
+ * is locked
+ */
+
+static  u32 ironlake_get_pp_control(struct drm_i915_private *dev_priv)
+{
+	u32	control = I915_READ(PCH_PP_CONTROL);
+
+	control &= ~PANEL_UNLOCK_MASK;
+	control |= PANEL_UNLOCK_REGS;
+	return control;
+}
+
 static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
 {
 	struct drm_device *dev = intel_dp->base.base.dev;
@@ -926,9 +939,7 @@ static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
 	}
 
 	ironlake_wait_panel_off(intel_dp);
-	pp = I915_READ(PCH_PP_CONTROL);
-	pp &= ~PANEL_UNLOCK_MASK;
-	pp |= PANEL_UNLOCK_REGS;
+	pp = ironlake_get_pp_control(dev_priv);
 	pp |= EDP_FORCE_VDD;
 	I915_WRITE(PCH_PP_CONTROL, pp);
 	POSTING_READ(PCH_PP_CONTROL);
@@ -951,9 +962,7 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	u32 pp;
 
 	if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) {
-		pp = I915_READ(PCH_PP_CONTROL);
-		pp &= ~PANEL_UNLOCK_MASK;
-		pp |= PANEL_UNLOCK_REGS;
+		pp = ironlake_get_pp_control(dev_priv);
 		pp &= ~EDP_FORCE_VDD;
 		I915_WRITE(PCH_PP_CONTROL, pp);
 		POSTING_READ(PCH_PP_CONTROL);
@@ -1012,9 +1021,7 @@ static void ironlake_edp_panel_on(struct intel_dp *intel_dp)
 		return;
 
 	ironlake_wait_panel_off(intel_dp);
-	pp = I915_READ(PCH_PP_CONTROL);
-	pp &= ~PANEL_UNLOCK_MASK;
-	pp |= PANEL_UNLOCK_REGS;
+	pp = ironlake_get_pp_control(dev_priv);
 
 	if (IS_GEN5(dev)) {
 		/* ILK workaround: disable reset around power sequence */
@@ -1049,9 +1056,7 @@ static void ironlake_edp_panel_off(struct drm_encoder *encoder)
 
 	if (!is_edp(intel_dp))
 		return;
-	pp = I915_READ(PCH_PP_CONTROL);
-	pp &= ~PANEL_UNLOCK_MASK;
-	pp |= PANEL_UNLOCK_REGS;
+	pp = ironlake_get_pp_control(dev_priv);
 
 	if (IS_GEN5(dev)) {
 		/* ILK workaround: disable reset around power sequence */
@@ -1098,9 +1103,7 @@ static void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
 	 * allowing it to appear.
 	 */
 	msleep(intel_dp->backlight_on_delay);
-	pp = I915_READ(PCH_PP_CONTROL);
-	pp &= ~PANEL_UNLOCK_MASK;
-	pp |= PANEL_UNLOCK_REGS;
+	pp = ironlake_get_pp_control(dev_priv);
 	pp |= EDP_BLC_ENABLE;
 	I915_WRITE(PCH_PP_CONTROL, pp);
 	POSTING_READ(PCH_PP_CONTROL);
@@ -1116,9 +1119,7 @@ static void ironlake_edp_backlight_off(struct intel_dp *intel_dp)
 		return;
 
 	DRM_DEBUG_KMS("\n");
-	pp = I915_READ(PCH_PP_CONTROL);
-	pp &= ~PANEL_UNLOCK_MASK;
-	pp |= PANEL_UNLOCK_REGS;
+	pp = ironlake_get_pp_control(dev_priv);
 	pp &= ~EDP_BLC_ENABLE;
 	I915_WRITE(PCH_PP_CONTROL, pp);
 	POSTING_READ(PCH_PP_CONTROL);
Signature · 1 line
1.7.7
#2 lore raw

Re: [Intel-gfx] [PATCH 1/7] drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control

Quoted 10 lines · On Tue, 1 Nov 2011 23:20:24 -0700 Keith Packard <[email protected]> wrote:

Every usage of PCH_PP_CONTROL sets the PANEL_UNLOCK_REGS value to ensure that writes will be respected, move this to a common function to make the driver cleaner.

No functional changes.

---
 drivers/gpu/drm/i915/intel_dp.c |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

Can't we just set UNLOCK_REGS at load time and have asserts sprinkled here and there?

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

Re: [Intel-gfx] [PATCH 1/7] drm/i915: Move common PCH_PP_CONTROL setup to ironlake_get_pp_control

Quoted 2 lines · Jesse Barnes

Can't we just set UNLOCK_REGS at load time and have asserts sprinkled here and there?

I think we'd need it at resume time as well; it seemed easier to just set it every time we touch the register.

Signature · 1 line
[email protected]

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH 2/7 drm/i915: Remove link_status field from intel_dp structure

In reply to Keith Packard

No persistent data was ever stored here, so link_status is instead allocated on the stack as needed.

---
 drivers/gpu/drm/i915/intel_dp.c |   65 +++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +36 -29
index efe5f9e..2c0c482 100644
@@ -58,7 +58,6 @@ struct intel_dp {
 	struct i2c_algo_dp_aux_data algo;
 	bool is_pch_edp;
 	uint8_t	train_set[4];
-	uint8_t link_status[DP_LINK_STATUS_SIZE];
 	int panel_power_up_delay;
 	int panel_power_down_delay;
 	int panel_power_cycle_delay;
@@ -1285,11 +1284,11 @@ intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address,
  * link status information
  */
 static bool
-intel_dp_get_link_status(struct intel_dp *intel_dp)
+intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE])
 {
 	return intel_dp_aux_native_read_retry(intel_dp,
 					      DP_LANE0_1_STATUS,
-					      intel_dp->link_status,
+					      link_status,
 					      DP_LINK_STATUS_SIZE);
 }
 
@@ -1301,27 +1300,25 @@ intel_dp_link_status(uint8_t link_status[DP_LINK_STATUS_SIZE],
 }
 
 static uint8_t
-intel_get_adjust_request_voltage(uint8_t link_status[DP_LINK_STATUS_SIZE],
+intel_get_adjust_request_voltage(uint8_t adjust_request[2],
 				 int lane)
 {
-	int	    i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1);
 	int	    s = ((lane & 1) ?
 			 DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT :
 			 DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT);
-	uint8_t l = intel_dp_link_status(link_status, i);
+	uint8_t l = adjust_request[lane>>1];
 
 	return ((l >> s) & 3) << DP_TRAIN_VOLTAGE_SWING_SHIFT;
 }
 
 static uint8_t
-intel_get_adjust_request_pre_emphasis(uint8_t link_status[DP_LINK_STATUS_SIZE],
+intel_get_adjust_request_pre_emphasis(uint8_t adjust_request[2],
 				      int lane)
 {
-	int	    i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1);
 	int	    s = ((lane & 1) ?
 			 DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT :
 			 DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT);
-	uint8_t l = intel_dp_link_status(link_status, i);
+	uint8_t l = adjust_request[lane>>1];
 
 	return ((l >> s) & 3) << DP_TRAIN_PRE_EMPHASIS_SHIFT;
 }
@@ -1362,15 +1359,18 @@ intel_dp_pre_emphasis_max(uint8_t voltage_swing)
 }
 
 static void
-intel_get_adjust_train(struct intel_dp *intel_dp)
+intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE])
 {
+	struct drm_device *dev = intel_dp->base.base.dev;
 	uint8_t v = 0;
 	uint8_t p = 0;
 	int lane;
+	uint8_t	*adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS);
+	int voltage_max;
 
 	for (lane = 0; lane < intel_dp->lane_count; lane++) {
-		uint8_t this_v = intel_get_adjust_request_voltage(intel_dp->link_status, lane);
-		uint8_t this_p = intel_get_adjust_request_pre_emphasis(intel_dp->link_status, lane);
+		uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane);
+		uint8_t this_p = intel_get_adjust_request_pre_emphasis(adjust_request, lane);
 
 		if (this_v > v)
 			v = this_v;
@@ -1389,7 +1389,7 @@ intel_get_adjust_train(struct intel_dp *intel_dp)
 }
 
 static uint32_t
-intel_dp_signal_levels(uint8_t train_set, int lane_count)
+intel_dp_signal_levels(uint8_t train_set)
 {
 	uint32_t	signal_levels = 0;
 
@@ -1458,9 +1458,8 @@ static uint8_t
 intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE],
 		      int lane)
 {
-	int i = DP_LANE0_1_STATUS + (lane >> 1);
 	int s = (lane & 1) * 4;
-	uint8_t l = intel_dp_link_status(link_status, i);
+	uint8_t l = link_status[lane>>1];
 
 	return (l >> s) & 0xf;
 }
@@ -1485,18 +1484,18 @@ intel_clock_recovery_ok(uint8_t link_status[DP_LINK_STATUS_SIZE], int lane_count
 			 DP_LANE_CHANNEL_EQ_DONE|\
 			 DP_LANE_SYMBOL_LOCKED)
 static bool
-intel_channel_eq_ok(struct intel_dp *intel_dp)
+intel_channel_eq_ok(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE])
 {
 	uint8_t lane_align;
 	uint8_t lane_status;
 	int lane;
 
-	lane_align = intel_dp_link_status(intel_dp->link_status,
+	lane_align = intel_dp_link_status(link_status,
 					  DP_LANE_ALIGN_STATUS_UPDATED);
 	if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0)
 		return false;
 	for (lane = 0; lane < intel_dp->lane_count; lane++) {
-		lane_status = intel_get_lane_status(intel_dp->link_status, lane);
+		lane_status = intel_get_lane_status(link_status, lane);
 		if ((lane_status & CHANNEL_EQ_BITS) != CHANNEL_EQ_BITS)
 			return false;
 	}
@@ -1569,12 +1568,14 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 	clock_recovery = false;
 	for (;;) {
 		/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
+		uint8_t	    link_status[DP_LINK_STATUS_SIZE];
 		uint32_t    signal_levels;
 		if (IS_GEN6(dev) && is_edp(intel_dp)) {
 			signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]);
 			DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels;
 		} else {
-			signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count);
+			signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]);
+			DRM_DEBUG_KMS("training pattern 1 signal levels %08x\n", signal_levels);
 			DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels;
 		}
 
@@ -1590,10 +1591,13 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		/* Set training pattern 1 */
 
 		udelay(100);
-		if (!intel_dp_get_link_status(intel_dp))
+		if (!intel_dp_get_link_status(intel_dp, link_status)) {
+			DRM_ERROR("failed to get link status\n");
 			break;
+		}
 
-		if (intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) {
+		if (intel_clock_recovery_ok(link_status, intel_dp->lane_count)) {
+			DRM_DEBUG_KMS("clock recovery OK\n");
 			clock_recovery = true;
 			break;
 		}
@@ -1615,7 +1619,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
 
 		/* Compute new intel_dp->train_set as requested by target */
-		intel_get_adjust_train(intel_dp);
+		intel_get_adjust_train(intel_dp, link_status);
 	}
 
 	intel_dp->DP = DP;
@@ -1638,6 +1642,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
 	for (;;) {
 		/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
 		uint32_t    signal_levels;
+		uint8_t	    link_status[DP_LINK_STATUS_SIZE];
 
 		if (cr_tries > 5) {
 			DRM_ERROR("failed to train DP, aborting\n");
@@ -1649,7 +1654,8 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
 			signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]);
 			DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels;
 		} else {
-			signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count);
+			signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]);
+			DRM_DEBUG_KMS("training pattern 1 signal levels %08x\n", signal_levels);
 			DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels;
 		}
 
@@ -1665,17 +1671,17 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
 			break;
 
 		udelay(400);
-		if (!intel_dp_get_link_status(intel_dp))
+		if (!intel_dp_get_link_status(intel_dp, link_status))
 			break;
 
 		/* Make sure clock is still ok */
-		if (!intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) {
+		if (!intel_clock_recovery_ok(link_status, intel_dp->lane_count)) {
 			intel_dp_start_link_train(intel_dp);
 			cr_tries++;
 			continue;
 		}
 
-		if (intel_channel_eq_ok(intel_dp)) {
+		if (intel_channel_eq_ok(intel_dp, link_status)) {
 			channel_eq = true;
 			break;
 		}
@@ -1690,7 +1696,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
 		}
 
 		/* Compute new intel_dp->train_set as requested by target */
-		intel_get_adjust_train(intel_dp);
+		intel_get_adjust_train(intel_dp, link_status);
 		++tries;
 	}
 
@@ -1822,6 +1828,7 @@ static void
 intel_dp_check_link_status(struct intel_dp *intel_dp)
 {
 	u8 sink_irq_vector;
+	u8 link_status[DP_LINK_STATUS_SIZE];
 
 	if (intel_dp->dpms_mode != DRM_MODE_DPMS_ON)
 		return;
@@ -1830,7 +1837,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 		return;
 
 	/* Try to read receiver status if the link appears to be up */
-	if (!intel_dp_get_link_status(intel_dp)) {
+	if (!intel_dp_get_link_status(intel_dp, link_status)) {
 		intel_dp_link_down(intel_dp);
 		return;
 	}
@@ -1855,7 +1862,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 			DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
 	}
 
-	if (!intel_channel_eq_ok(intel_dp)) {
+	if (!intel_channel_eq_ok(intel_dp, link_status)) {
 		DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
 			      drm_get_encoder_name(&intel_dp->base.base));
 		intel_dp_start_link_train(intel_dp);
Signature · 1 line
1.7.7
Reviewed-by on v1 2/7
#5 lore raw

Re: [Intel-gfx] [PATCH 2/7] drm/i915: Remove link_status field from intel_dp structure

Quoted 5 lines · On Tue, 1 Nov 2011 23:20:25 -0700 Keith Packard <[email protected]> wrote:

No persistent data was ever stored here, so link_status is instead allocated on the stack as needed.

---

I like this cleanup.

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

PATCH 3/7 drm/i915: Treat PCH eDP like DP in most places

In reply to Keith Packard

PCH eDP has many of the same needs as regular PCH DP connections, including the DP_CTl bit settings, the TRANS_DP_CTL register.

---
 drivers/gpu/drm/i915/intel_display.c |    3 +-
 drivers/gpu/drm/i915/intel_dp.c      |  112 ++++++++++++++++++++++++----------
 2 files changed, 81 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 9fa342e..53eb29e 100644
@@ -2933,7 +2933,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 
 	/* For PCH DP, enable TRANS_DP_CTL */
 	if (HAS_PCH_CPT(dev) &&
-	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+	    (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
+	     intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
 		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5;
 		reg = TRANS_DP_CTL(pipe);
 		temp = I915_READ(reg);
drivers/gpu/drm/i915/intel_dp.c +79 -33

193 lines not on this page · raw message

Signature · 1 line
1.7.7
#7 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, · line 900

Quoted 11 lines · Keith Packard
drivers/gpu/drm/i915/intel_dp.c +11 -0
+		if (intel_dp->link_configuration [1] & DP_LANE_COUNT_ENHANCED_FRAME_EN)
+			intel_dp->DP |= DP_ENHANCED_FRAMING;
+
+		/*
+		 * Check for DPCD version>  1.1 and enhanced framing support
+		 */
+		if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		    (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) {
+			intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
+			intel_dp->DP |= DP_ENHANCED_FRAMING;
+		}

Redundant. You've already done the link_configuration |= above in the common code. You can drop the second if chunk altogether.

In related news, the corresponding section for this in TRANS_DP_CTL setup appears to turn on enhanced framing unconditionally. This is probably not a big deal, I don't think I've ever seen a display not support it, but.

- ajax

#8 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 2 lines · Adam Jackson

Redundant. You've already done the link_configuration |= above in the common code. You can drop the second if chunk altogether.

Thanks for catching this mistake; cut&paste programming without the cut part...

Quoted 4 lines

In related news, the corresponding section for this in TRANS_DP_CTL setup appears to turn on enhanced framing unconditionally. This is probably not a big deal, I don't think I've ever seen a display not support it, but.

Yeah, it's actually a huge pain because TRANS_DP_CTL is set up in ironlake_pch_enable, which is part of the crtc enable path not the encoder mode set path, and getting to the appropriate intel_dp structure takes a walk through all of the encoders to find the matching one.

I think we could move the TRANS_DP_CTL code into intel_dp.c where it belongs; this chunk was stuck inside ironlake_crtc_dpms by Zhenyu last year when DP/eDP support for Sandybridge and Cougarpoint was added in commit e3421a189447c0b8cd0aff5c299f53b5ab7c38f6.

Most of the TRANS_DP_CTL chunk inside ironlake_pch_enable should just get moved to intel_dp_mode_set, but I don't know if the TRANS_DP_OUTPUT_ENABLE bit needs to be set before intel_enable_transcoder is called; if it does, then we'd need to preserve that piece inside ironlake_pch_enable, otherwise that bit would move to intel_dp_commit.

Signature · 1 line
[email protected]
#9 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

In reply to Adam Jackson
Quoted 2 lines · Adam Jackson

Redundant. You've already done the link_configuration |= above in the common code. You can drop the second if chunk altogether.

Here's the new version of that chunk of patch:

@@ -850,32 +864,45 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,

                intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
                intel_write_eld(encoder, adjusted_mode);
        }
-
        memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE);
        intel_dp->link_configuration[0] = intel_dp->link_bw;
        intel_dp->link_configuration[1] = intel_dp->lane_count;
        intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B;
-
        /*
         * Check for DPCD version > 1.1 and enhanced framing support
         */
        if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
            (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) {
                intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
-               intel_dp->DP |= DP_ENHANCED_FRAMING;
        }

- /* CPT DP's pipe select is decided in TRANS_DP_CTL */
- if (intel_crtc->pipe == 1 && !HAS_PCH_CPT(dev))
- intel_dp->DP |= DP_PIPEB_SELECT;
+ /* Split out the IBX/CPU vs CPT settings */

- if (is_cpu_edp(intel_dp)) {

-               /* don't miss out required setting for eDP */
-               intel_dp->DP |= DP_PLL_ENABLE;
-               if (adjusted_mode->clock < 200000)

- intel_dp->DP |= DP_PLL_FREQ_160MHZ;
- else
- intel_dp->DP |= DP_PLL_FREQ_270MHZ;
+ if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) {
+ intel_dp->DP |= intel_dp->color_range;
+
+ if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
+ intel_dp->DP |= DP_SYNC_HS_HIGH;
+ if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
+ intel_dp->DP |= DP_SYNC_VS_HIGH;
+ intel_dp->DP |= DP_LINK_TRAIN_OFF;
+
+ if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN)
+ intel_dp->DP |= DP_ENHANCED_FRAMING;
+
+ if (intel_crtc->pipe == 1)
+ intel_dp->DP |= DP_PIPEB_SELECT;
+
+ if (is_cpu_edp(intel_dp)) {

+                       /* don't miss out required setting for eDP */
+                       intel_dp->DP |= DP_PLL_ENABLE;
+                       if (adjusted_mode->clock < 200000)

+ intel_dp->DP |= DP_PLL_FREQ_160MHZ;
+ else
+ intel_dp->DP |= DP_PLL_FREQ_270MHZ;
+ }
+ } else {

+               intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT;
        }

}

Signature · 1 line
[email protected]
Reviewed-by on v1 3/7
#10 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

In reply to Keith Packard
Quoted 9 lines · On Tue, 1 Nov 2011 23:20:26 -0700 Keith Packard <[email protected]> wrote:

PCH eDP has many of the same needs as regular PCH DP connections, including the DP_CTl bit settings, the TRANS_DP_CTL register.

---
 drivers/gpu/drm/i915/intel_display.c |    3 +-
 drivers/gpu/drm/i915/intel_dp.c      |  112 ++++++++++++++++++++++++----------
 2 files changed, 81 insertions(+), 34 deletions(-)

Might be nice to have some function pointers to handle the different types better. But that could be a separate cleanup. I'd rather have duplicated code than fragile code...

But I was curious about this hunk:

@@ -766,10 +766,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
continue;

intel_dp = enc_to_intel_dp(encoder);
- if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
+ if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
lane_count = intel_dp->lane_count; break;
- } else if (is_edp(intel_dp)) {
+ } else if (is_cpu_edp(intel_dp)) {
lane_count = dev_priv->edp.lanes; break;
}

I guess this means we can't trust the BIOS settings for PCH eDP?

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

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 16 lines · Jesse Barnes

But I was curious about this hunk:

drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -766,10 +766,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 			continue;
 
 		intel_dp = enc_to_intel_dp(encoder);
-		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
+		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
 			lane_count = intel_dp->lane_count;
 			break;
-		} else if (is_edp(intel_dp)) {
+		} else if (is_cpu_edp(intel_dp)) {
 			lane_count = dev_priv->edp.lanes;
 			break;
 		}
Quoted 1 line

I guess this means we can't trust the BIOS settings for PCH eDP?

I'm pretty sure this isn't the right place to look at this value in any case; we're setting the m/n ratios after already deciding how many lanes to use. Getting this wrong means sending the wrong timing to the monitor, not setting a different mode.

In any case, my AIO box sets the BIOS value to 1, when it needs 2 lanes for the mode it uses.

Signature · 1 line
[email protected]
#12 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

In reply to Jesse Barnes
Quoted 14 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -766,10 +766,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
  			continue;
 
  		intel_dp = enc_to_intel_dp(encoder);
-		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
+		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
  			lane_count = intel_dp->lane_count;
  			break;
-		} else if (is_edp(intel_dp)) {
+		} else if (is_cpu_edp(intel_dp)) {
  			lane_count = dev_priv->edp.lanes;
  			break;
  		}
Quoted 1 line

I guess this means we can't trust the BIOS settings for PCH eDP?

Given the choice of trusting DPCD or the VBT, I'd definitely prefer DPCD.

- ajax

#13 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 2 lines · Adam Jackson

Given the choice of trusting DPCD or the VBT, I'd definitely prefer DPCD.

Except that the DPCD is coded into the monitor while the VBT is done by the platform. And, it's the platform which may neglect to connect some of the wires. In any case, if we want to look at these values, we should be doing it before computing the M/N ratio so that we actually set the hardware up correctly.

Any bets on how long until we find a machine that has right value in the VBT and the wrong one in DPCD? Or a machine with wrong values in both places?

Signature · 1 line
[email protected]

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

#14 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 8 lines · Keith Packard
Quoted 2 lines · Adam Jackson

Given the choice of trusting DPCD or the VBT, I'd definitely prefer DPCD.

Except that the DPCD is coded into the monitor while the VBT is done by the platform. And, it's the platform which may neglect to connect some of the wires.

My reasoning about this has been:

The maximum link configuration in DPCD is going to fit - and minimally fit - the maximum supported configuration (depth/rate/size/etc), because otherwise the hardware would have been more expensive to produce.

The VBT is going to be crap.

But as always, "do what the Windows driver does" seems like a good strategy. Do we know?

Quoted 2 lines

Any bets on how long until we find a machine that has right value in the VBT and the wrong one in DPCD? Or a machine with wrong values in both places?

I will happily pay $20 to the first person to find a monitor with broken link/lane in DPCD, on the understanding that they take it (the $20) to the nearest hardware store, buy a hammer, and smash the monitor. Preferably with the video uploaded to youtube.

- ajax

#15 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 1 line · Adam Jackson

The VBT is going to be crap.

The only question then is what to do with hardware that doesn't have the DPCD value -- that's "new" in revision 0x11, after all.

How about this:

commit 34ebe02cc78f20ae6b7865c5087c3b5ac7810185

Author: Keith Packard <[email protected]>
Date:   Wed Nov 2 13:03:47 2011 -0700

drm/i915: Use DPCD value for max DP lanes where possible

Fall back to the VBT value for eDP monitors only when DPCD is missing the value.

drivers/gpu/drm/i915/intel_dp.c +7 -4
index 02b56ce..93b082a 100644
@@ -154,6 +154,8 @@ intel_edp_link_config(struct intel_encoder *intel_encoder,
 static int
 intel_dp_max_lane_count(struct intel_dp *intel_dp)
 {
+       struct drm_device *dev = intel_dp->base.base.dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
        int max_lane_count = 4;
 
        if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
@@ -164,6 +166,8 @@ intel_dp_max_lane_count(struct intel_dp *intel_dp)
                default:
                        max_lane_count = 4;
                }
+       } else if (is_edp(intel_dp)) {
+               max_lane_count = dev_priv->edp.lanes;
        }
        return max_lane_count;
 }
@@ -765,12 +769,11 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
                        continue;
 
                intel_dp = enc_to_intel_dp(encoder);
-               if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
+               if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT ||
+                   intel_dp->base.type == INTEL_OUTPUT_EDP)
+               {
                        lane_count = intel_dp->lane_count;
                        break;
-               } else if (is_cpu_edp(intel_dp)) {
-                       lane_count = dev_priv->edp.lanes;
-                       break;
                }
        }
 
Signature · 1 line
[email protected]
Reviewed-by
#16 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 6 lines · Keith Packard
Quoted 1 line · Adam Jackson

The VBT is going to be crap.

The only question then is what to do with hardware that doesn't have the DPCD value -- that's "new" in revision 0x11, after all.

It is? The DP 1.1a text for lane count is "For Rev.1.1, only the following three values are supported. All other values are reserved." I don't think that implies anything about what it meant in 1.0. It does say that bits 7:5 of that register are reserved in 1.0 though; since it doesn't have any versioning on bits 4:0 I'd think that means they're interpreted the same in 1.0 as in 1.1.

Unless you have a copy of the 1.0 spec?

Again, not that it probably matters much. I think the installed base of DP 1.0 sinks is zero, I've literally never seen one.

Quoted 6 lines

How about this:

commit 34ebe02cc78f20ae6b7865c5087c3b5ac7810185

Author: Keith Packard<[email protected]>
Date:   Wed Nov 2 13:03:47 2011 -0700
Quoted 6 lines

drm/i915: Use DPCD value for max DP lanes where possible

Fall back to the VBT value for eDP monitors only when DPCD is missing the value.

- ajax

#17 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 2 lines · Adam Jackson

It is? The DP 1.1a text for lane count is "For Rev.1.1, only the following three values are supported. All other values are reserved."

Yeah, if you look at the MAX_LINK_RATE field, we assume that it has a useful value. I'll bet they were thinking of letting the spec support things like alternate clock rates or 3 lanes or something, and the 1.1 version just tied things down to allow only sensible values there.

How about we just always use the DPCD value?

commit e0fafa5dee031ef6174eadb005a5f01d13da931d

Author: Keith Packard <[email protected]>
Date:   Wed Nov 2 13:03:47 2011 -0700

drm/i915: Use DPCD value for max DP lanes.

The BIOS VBT value for an eDP panel has been shown to be incorrect on one machine, and we haven't found any machines where the DPCD value was wrong, so we'll use the DPCD value everywhere.

drivers/gpu/drm/i915/intel_dp.c +9 -14
index 02b56ce..5056d29 100644
@@ -154,16 +154,12 @@ intel_edp_link_config(struct intel_encoder *intel_encoder,
 static int
 intel_dp_max_lane_count(struct intel_dp *intel_dp)
 {
-       int max_lane_count = 4;
-
-       if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
-               max_lane_count = intel_dp->dpcd[DP_MAX_LANE_COUNT] & 0x1f;
-               switch (max_lane_count) {
-               case 1: case 2: case 4:
-                       break;
-               default:
-                       max_lane_count = 4;
-               }
+       int max_lane_count = intel_dp->dpcd[DP_MAX_LANE_COUNT] & 0x1f;
+       switch (max_lane_count) {
+       case 1: case 2: case 4:
+               break;
+       default:
+               max_lane_count = 4;
        }
        return max_lane_count;
 }
@@ -765,12 +761,11 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
                        continue;
 
                intel_dp = enc_to_intel_dp(encoder);
-               if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
+               if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT ||
+                   intel_dp->base.type == INTEL_OUTPUT_EDP)
+               {
                        lane_count = intel_dp->lane_count;
                        break;
-               } else if (is_cpu_edp(intel_dp)) {
-                       lane_count = dev_priv->edp.lanes;
-                       break;
                }
        }
 
Signature · 1 line
[email protected]
Reviewed-by
#18 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 11 lines · Keith Packard
Quoted 2 lines · Adam Jackson

It is? The DP 1.1a text for lane count is "For Rev.1.1, only the following three values are supported. All other values are reserved."

Yeah, if you look at the MAX_LINK_RATE field, we assume that it has a useful value. I'll bet they were thinking of letting the spec support things like alternate clock rates or 3 lanes or something, and the 1.1 version just tied things down to allow only sensible values there.

How about we just always use the DPCD value?

Looks good.

- ajax

#19 lore raw

Re: [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

In reply to Keith Packard

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, · line 774

Quoted 9 lines · Keith Packard
drivers/gpu/drm/i915/intel_dp.c +2 -2
 		intel_dp = enc_to_intel_dp(encoder);
-		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
+		if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) {
 			lane_count = intel_dp->lane_count;
 			break;
-		} else if (is_edp(intel_dp)) {
+		} else if (is_cpu_edp(intel_dp)) {
 			lane_count = dev_priv->edp.lanes;
 			break;

Thinking about this one more time -- if we ever want to use dev_priv->edp.lanes, we should use it in intel_dp_max_lane_count. intel_dp_set_m_n should use intel_dp->lane_count unconditionally as that's the value we've used everywhere else for mode setting.

Perhaps we should use it for monitors that don't include the MAX_LANE_COUNT field in the dpcd? Perhaps we should use it on all eDP monitors?

Signature · 1 line
[email protected]

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

#20 lore raw

Re: [PATCH 3/7] drm/i915: Treat PCH eDP like DP in most places

Quoted 18 lines · Keith Packard
Quoted 9 lines · Keith Packard

              intel_dp = enc_to_intel_dp(encoder);
-             if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
+             if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) { lane_count = intel_dp->lane_count;
                      break;
-             } else if (is_edp(intel_dp)) {
+             } else if (is_cpu_edp(intel_dp)) {
                      lane_count = dev_priv->edp.lanes;
                      break;

Thinking about this one more time -- if we ever want to use dev_priv->edp.lanes, we should use it in intel_dp_max_lane_count. intel_dp_set_m_n should use intel_dp->lane_count unconditionally as that's the value we've used everywhere else for mode setting.

Quoted 3 lines

Perhaps we should use it for monitors that don't include the MAX_LANE_COUNT field in the dpcd? Perhaps we should use it on all eDP monitors?

FWIW, we rely on the DPCD field for eDP just like DP. Our vbios LCD tables don't contain DP lane or rate info.

Alex

#21 lore raw

PATCH 4/7 drm/i915: Let panel power sequencing hardware do its job

In reply to Keith Packard

The panel power sequencing hardware tracks the stages of panel power sequencing and signals when the panel is completely on or off. Instead of blindly assuming the panel timings will work, poll the panel power status register until it shows the correct values.

---
 drivers/gpu/drm/i915/i915_reg.h |   17 ++++-
 drivers/gpu/drm/i915/intel_dp.c |  138 +++++++++++++++++++++------------------
 2 files changed, 87 insertions(+), 68 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +13 -4
index 5a09416..275d149 100644
@@ -1553,12 +1553,21 @@
  */
 #define   PP_READY		(1 << 30)
 #define   PP_SEQUENCE_NONE	(0 << 28)
-#define   PP_SEQUENCE_ON	(1 << 28)
-#define   PP_SEQUENCE_OFF	(2 << 28)
-#define   PP_SEQUENCE_MASK	0x30000000
+#define   PP_SEQUENCE_POWER_UP	(1 << 28)
+#define   PP_SEQUENCE_POWER_DOWN (2 << 28)
+#define   PP_SEQUENCE_MASK	(3 << 28)
+#define   PP_SEQUENCE_SHIFT	28
 #define   PP_CYCLE_DELAY_ACTIVE	(1 << 27)
-#define   PP_SEQUENCE_STATE_ON_IDLE (1 << 3)
 #define   PP_SEQUENCE_STATE_MASK 0x0000000f
+#define   PP_SEQUENCE_STATE_OFF_IDLE	(0x0 << 0)
+#define   PP_SEQUENCE_STATE_OFF_S0_1	(0x1 << 0)
+#define   PP_SEQUENCE_STATE_OFF_S0_2	(0x2 << 0)
+#define   PP_SEQUENCE_STATE_OFF_S0_3	(0x3 << 0)
+#define   PP_SEQUENCE_STATE_ON_IDLE	(0x8 << 0)
+#define   PP_SEQUENCE_STATE_ON_S1_0	(0x9 << 0)
+#define   PP_SEQUENCE_STATE_ON_S1_2	(0xa << 0)
+#define   PP_SEQUENCE_STATE_ON_S1_3	(0xb << 0)
+#define   PP_SEQUENCE_STATE_RESET	(0xf << 0)
 #define PP_CONTROL	0x61204
 #define   POWER_TARGET_ON	(1 << 0)
 #define PP_ON_DELAYS	0x61208
drivers/gpu/drm/i915/intel_dp.c +74 -64

242 lines not on this page · raw message

Signature · 1 line
1.7.7
#22 lore raw

Re: [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, · line 918

Quoted 3 lines · Keith Packard
drivers/gpu/drm/i915/intel_dp.c +2 -1
-static void ironlake_wait_panel_off(struct intel_dp *intel_dp)
+#define IDLE_ON_MASK		(PP_ON | PP_READY | PP_SEQUENCE_MASK | 0                     | PP_SEQUENCE_STATE_MASK)
+#define IDLE_ON_VALUE   	(PP_ON | PP_READY | PP_SEQUENCE_NONE | 0                     | PP_SEQUENCE_STATE_ON_IDLE)

A bit more testing -- looks like the MacBook Air doesn't mange to get PP_READY set when it's time to turn the panel on. I should look at this a bit more closely; there's no reason it shouldn't be set. But, nothing bad seems to happen if we simply ignore the PP_READY bit

+#define IDLE_ON_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK)
+#define IDLE_ON_VALUE (PP_ON | 0 | PP_SEQUENCE_NONE | 0 | PP_SEQUENCE_STATE_ON_IDLE)

Signature · 1 line
[email protected]
#23 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

Review

Quoted 13 lines · On Wed, 02 Nov 2011 00:31:40 -0700 Keith Packard <[email protected]> wrote:

drivers/gpu/drm/i915/intel_dp.c intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, · line 918

Quoted 3 lines · Keith Packard
drivers/gpu/drm/i915/intel_dp.c +2 -1
-static void ironlake_wait_panel_off(struct intel_dp *intel_dp)
+#define IDLE_ON_MASK		(PP_ON | PP_READY | PP_SEQUENCE_MASK | 0                     | PP_SEQUENCE_STATE_MASK)
+#define IDLE_ON_VALUE   	(PP_ON | PP_READY | PP_SEQUENCE_NONE | 0                     | PP_SEQUENCE_STATE_ON_IDLE)

A bit more testing -- looks like the MacBook Air doesn't mange to get PP_READY set when it's time to turn the panel on. I should look at this a bit more closely; there's no reason it shouldn't be set. But, nothing bad seems to happen if we simply ignore the PP_READY bit

(quoted diff) +2 -0
+#define IDLE_ON_MASK		(PP_ON | 0      | PP_SEQUENCE_MASK | 0                     | PP_SEQUENCE_STATE_MASK)
+#define IDLE_ON_VALUE   	(PP_ON | 0      | PP_SEQUENCE_NONE | 0                     | PP_SEQUENCE_STATE_ON_IDLE)

Note that PP_READY will incorrectly depend on some other register values, so in some configs the panel will happily power up even if PP_READY isn't set yet...

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

Re: [Intel-gfx] [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

Quoted 3 lines · Jesse Barnes

Note that PP_READY will incorrectly depend on some other register values, so in some configs the panel will happily power up even if PP_READY isn't set yet...

Yeah, I'd like to understand why PP_READY isn't getting set; we should have all of the other pieces ready before we turn on the panel. But, given that it's really just a sanity check, it probably doesn't make sense to spin for 5 seconds waiting for a bit to turn on that won't.

I've just removed that bit from the IDLE_ON_MASK and IDLE_ON_VALUE.

Signature · 1 line
[email protected]
#25 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

In reply to Jesse Barnes
Quoted 3 lines · Jesse Barnes

Note that PP_READY will incorrectly depend on some other register values, so in some configs the panel will happily power up even if PP_READY isn't set yet...

Here's the new version of that chunk:

@@ -906,32 +905,56 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,

        }

}

-static void ironlake_wait_panel_off(struct intel_dp *intel_dp)

+#define IDLE_ON_MASK           (PP_ON | 0        | PP_SEQUENCE_MASK | 0                     | PP_SEQUENCE_STATE_MASK)
+#define IDLE_ON_VALUE          (PP_ON | 0        | PP_SEQUENCE_NONE | 0                     | PP_SEQUENCE_STATE_ON_IDLE)
+
+#define IDLE_OFF_MASK          (PP_ON | 0        | PP_SEQUENCE_MASK | 0                     | PP_SEQUENCE_STATE_MASK)
+#define IDLE_OFF_VALUE         (0     | 0        | PP_SEQUENCE_NONE | 0                     | PP_SEQUENCE_STATE_OFF_IDLE)

+
+#define IDLE_CYCLE_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | PP_CYCLE_DELAY_ACTIVE | PP_SEQUENCE_STATE_MASK)
+#define IDLE_CYCLE_VALUE (0 | 0 | PP_SEQUENCE_NONE | 0 | PP_SEQUENCE_STATE_OFF_IDLE)
+
+static void ironlake_wait_panel_status(struct intel_dp *intel_dp,
+ u32 mask,
+ u32 value)
{

Signature · 1 line
[email protected]
Reviewed-by on v1 4/7
#26 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

In reply to Keith Packard
Quoted 4 lines · On Tue, 1 Nov 2011 23:20:27 -0700 Keith Packard <[email protected]> wrote:

The panel power sequencing hardware tracks the stages of panel power sequencing and signals when the panel is completely on or off. Instead of blindly assuming the panel timings will work, poll the panel power status register until it shows the correct values.

Modulo what we already discussed on irc about the PP_READY bit, and the CodingStyle nitpicks (newlines before {? come on, this isn't X :),

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

Re: [Intel-gfx] [PATCH 4/7] drm/i915: Let panel power sequencing hardware do its job

Quoted 1 line · Jesse Barnes

Modulo what we already discussed on irc about the PP_READY bit, and the

Right, the PP_READY bit requires that everything needed for PCH eDP be running, even when you're using a CPU connected eDP panel, and so it's not actually useful.

Quoted 1 line

CodingStyle nitpicks (newlines before {? come on, this isn't X :),

Ok, I can fix that at least, even if I think it's ugly in kernel style.

I'll clean up the style and attach your R-b.

Signature · 1 line
[email protected]
#28 lore raw

PATCH 5/7 drm/i915: Make DP prepare/commit consistent with DP dpms

In reply to Keith Packard

Make sure the sequence of operations in all three functions makes sense:

1) The backlight must be off unless the screen is running
2) The link must be running to turn the eDP panel on/off
3) The CPU eDP PLL must be running until everything is off

---
 drivers/gpu/drm/i915/intel_dp.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +13 -9
index d6c6608..6be6a04 100644
@@ -1234,17 +1234,18 @@ static void intel_dp_prepare(struct drm_encoder *encoder)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+	ironlake_edp_backlight_off(intel_dp);
+	ironlake_edp_panel_off(intel_dp);
+
 	/* Wake up the sink first */
 	ironlake_edp_panel_vdd_on(intel_dp);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
+	intel_dp_link_down(intel_dp);
 	ironlake_edp_panel_vdd_off(intel_dp, false);
 
 	/* Make sure the panel is off before trying to
 	 * change the mode
 	 */
-	ironlake_edp_backlight_off(intel_dp);
-	intel_dp_link_down(intel_dp);
-	ironlake_edp_panel_off(intel_dp);
 }
 
 static void intel_dp_commit(struct drm_encoder *encoder)
@@ -1276,16 +1277,20 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
 	uint32_t dp_reg = I915_READ(intel_dp->output_reg);
 
 	if (mode != DRM_MODE_DPMS_ON) {
+		ironlake_edp_backlight_off(intel_dp);
+		ironlake_edp_panel_off(intel_dp);
+
 		ironlake_edp_panel_vdd_on(intel_dp);
-		if (is_edp(intel_dp))
-			ironlake_edp_backlight_off(intel_dp);
 		intel_dp_sink_dpms(intel_dp, mode);
 		intel_dp_link_down(intel_dp);
-		ironlake_edp_panel_off(intel_dp);
-		if (is_edp(intel_dp) && !is_pch_edp(intel_dp))
-			ironlake_edp_pll_off(encoder);
 		ironlake_edp_panel_vdd_off(intel_dp, false);
+
+		if (is_cpu_edp(intel_dp))
+			ironlake_edp_pll_off(encoder);
 	} else {
+		if (is_cpu_edp(intel_dp))
+			ironlake_edp_pll_on(encoder);
+
 		ironlake_edp_panel_vdd_on(intel_dp);
 		intel_dp_sink_dpms(intel_dp, mode);
 		if (!(dp_reg & DP_PORT_EN)) {
@@ -1293,7 +1298,6 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
 			ironlake_edp_panel_on(intel_dp);
 			ironlake_edp_panel_vdd_off(intel_dp, true);
 			intel_dp_complete_link_train(intel_dp);
-			ironlake_edp_backlight_on(intel_dp);
 		} else
 			ironlake_edp_panel_vdd_off(intel_dp, false);
 		ironlake_edp_backlight_on(intel_dp);
Signature · 1 line
1.7.7
#29 lore raw

Re: [Intel-gfx] [PATCH 5/7] drm/i915: Make DP prepare/commit consistent with DP dpms

Quoted 6 lines · On Tue, 1 Nov 2011 23:20:28 -0700 Keith Packard <[email protected]> wrote:

Make sure the sequence of operations in all three functions makes sense:

1) The backlight must be off unless the screen is running
2) The link must be running to turn the eDP panel on/off
3) The CPU eDP PLL must be running until everything is off

A few comments on this one (also, is it strictly required to fix your bug)?

Quoted 19 lines
---
 drivers/gpu/drm/i915/intel_dp.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -0
index d6c6608..6be6a04 100644
@@ -1234,17 +1234,18 @@ static void intel_dp_prepare(struct drm_encoder *encoder)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+	ironlake_edp_backlight_off(intel_dp);
+	ironlake_edp_panel_off(intel_dp);
+
 	/* Wake up the sink first */
 	ironlake_edp_panel_vdd_on(intel_dp);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_prepare(struct drm_encoder *encoder) · line 1249

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +1 -3
+	intel_dp_link_down(intel_dp);
 	ironlake_edp_panel_vdd_off(intel_dp, false);
 
 	/* Make sure the panel is off before trying to
 	 * change the mode
 	 */
-	ironlake_edp_backlight_off(intel_dp);
-	intel_dp_link_down(intel_dp);
-	ironlake_edp_panel_off(intel_dp);
 }

Ok so you're making sure the panel has power to down the link, I think that's fine.

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -1
 static void intel_dp_commit(struct drm_encoder *encoder)
@@ -1276,16 +1277,20 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
 	uint32_t dp_reg = I915_READ(intel_dp->output_reg);
 
 	if (mode != DRM_MODE_DPMS_ON) {
+		ironlake_edp_backlight_off(intel_dp);
+		ironlake_edp_panel_off(intel_dp);
+
 		ironlake_edp_panel_vdd_on(intel_dp);
-		if (is_edp(intel_dp))

drivers/gpu/drm/i915/intel_dp.c intel_dp_dpms(struct drm_encoder *encoder, int mode) · line 1289

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -4
-			ironlake_edp_backlight_off(intel_dp);
 		intel_dp_sink_dpms(intel_dp, mode);
 		intel_dp_link_down(intel_dp);
-		ironlake_edp_panel_off(intel_dp);
-		if (is_edp(intel_dp) && !is_pch_edp(intel_dp))
-			ironlake_edp_pll_off(encoder);
 		ironlake_edp_panel_vdd_off(intel_dp, false);
+
+		if (is_cpu_edp(intel_dp))
+			ironlake_edp_pll_off(encoder);

But here it looks like you're shutting it off, then downing the link? Should this be reordered?

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center

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

#30 lore raw

Re: [Intel-gfx] [PATCH 5/7] drm/i915: Make DP prepare/commit consistent with DP dpms

Quoted 2 lines · Jesse Barnes

A few comments on this one (also, is it strictly required to fix your bug)?

I think so; the panel definitely was not happy when I turned the link off while the panel power was on. Having the mode setting and DPMS paths doing things in different orders definitely doesn't seem reasonable though. I nearly managed to share code between the two paths, but there are subtle differences in requirements and so I didn't bother.

Quoted 2 lines

Ok so you're making sure the panel has power to down the link, I think that's fine.

No, I'm turning the panel off *before* turning off the link. The panel goes nuts if you down the link before turning its power off; lots of technicolor.

Downing the link doesn't require any communication with the panel, so there's no issue with losing connectivity at this point:

	ironlake_edp_backlight_off(intel_dp);
	ironlake_edp_panel_off(intel_dp);               <= panel off

	/* Wake up the sink first */
	ironlake_edp_panel_vdd_on(intel_dp);
	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
	intel_dp_link_down(intel_dp);                   <= link down
	ironlake_edp_panel_vdd_off(intel_dp, false);
Quoted 2 lines

But here it looks like you're shutting it off, then downing the link? Should this be reordered?

Nope, it's in the same order:

	ironlake_edp_backlight_off(intel_dp);
	ironlake_edp_panel_off(intel_dp);               <= panel off

	ironlake_edp_panel_vdd_on(intel_dp);
	intel_dp_sink_dpms(intel_dp, mode);
	intel_dp_link_down(intel_dp);                   <= link down
	ironlake_edp_panel_vdd_off(intel_dp, false);

The only difference in these two code paths is that dp_prepare turns the sink to DPMS_ON, while dp_dpms turns the sink to DPMS_OFF.

Signature · 1 line
[email protected]
#31 lore raw

Re: [Intel-gfx] [PATCH 5/7] drm/i915: Make DP prepare/commit consistent with DP dpms

Quoted 11 lines · On Thu, 03 Nov 2011 15:30:57 -0700 Keith Packard <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

A few comments on this one (also, is it strictly required to fix your bug)?

I think so; the panel definitely was not happy when I turned the link off while the panel power was on. Having the mode setting and DPMS paths doing things in different orders definitely doesn't seem reasonable though. I nearly managed to share code between the two paths, but there are subtle differences in requirements and so I didn't bother.

Quoted 6 lines
Quoted 2 lines

Ok so you're making sure the panel has power to down the link, I think that's fine.

No, I'm turning the panel off *before* turning off the link. The panel goes nuts if you down the link before turning its power off; lots of technicolor.

Except for VDD?? That does come on... and shouldn't be any different than a full power sequence as far as link training etc go...

Quoted 25 lines

Downing the link doesn't require any communication with the panel, so there's no issue with losing connectivity at this point:

	ironlake_edp_backlight_off(intel_dp);
	ironlake_edp_panel_off(intel_dp);               <= panel off

	/* Wake up the sink first */
	ironlake_edp_panel_vdd_on(intel_dp);
	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
	intel_dp_link_down(intel_dp);                   <= link down
	ironlake_edp_panel_vdd_off(intel_dp, false);
Quoted 2 lines

But here it looks like you're shutting it off, then downing the link? Should this be reordered?

Nope, it's in the same order:

	ironlake_edp_backlight_off(intel_dp);
	ironlake_edp_panel_off(intel_dp);               <= panel off

	ironlake_edp_panel_vdd_on(intel_dp);
	intel_dp_sink_dpms(intel_dp, mode);
	intel_dp_link_down(intel_dp);                   <= link down
	ironlake_edp_panel_vdd_off(intel_dp, false);
Quoted 2 lines

The only difference in these two code paths is that dp_prepare turns the sink to DPMS_ON, while dp_dpms turns the sink to DPMS_OFF.

Oh missed the vdd on, which is in this path too... So I'm still confused by the panel off, vdd on sequence, but at least they're consistent.

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

Re: [Intel-gfx] [PATCH 5/7] drm/i915: Make DP prepare/commit consistent with DP dpms

Quoted 2 lines · Jesse Barnes

Except for VDD?? That does come on... and shouldn't be any different than a full power sequence as far as link training etc go...

Oh, that's a good point. Doing things in this order essentially forces yet another full panel power sequence delay at this point. Hrm. I'll have to test again when I get a chance, but perhaps we can turn the sink DPMS on before we turn the panel power off.

Quoted 3 lines

Oh missed the vdd on, which is in this path too... So I'm still confused by the panel off, vdd on sequence, but at least they're consistent.

Right, I'll try doing the sink_dpms before turning the panel off; that should work just fine, and should make the sequence a bit faster.

Signature · 1 line
[email protected]
#33 lore raw

PATCH 6/7 drm/i915: Try harder during dp pattern 1 link training

In reply to Keith Packard

Instead of going through the sequence just once, run through the whole set up to 5 times to see if something can work. This isn't part of the DP spec, but the BIOS seems to do it, and given that link training failure is so bad, it seems reasonable to follow suit.

---
 drivers/gpu/drm/i915/intel_dp.c |   41 +++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +27 -14
index 6be6a04..bf20a35 100644
@@ -1576,8 +1576,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
 
 	ret = intel_dp_aux_native_write(intel_dp,
 					DP_TRAINING_LANE0_SET,
-					intel_dp->train_set, 4);
-	if (ret != 4)
+					intel_dp->train_set,
+					intel_dp->lane_count);
+	if (ret != intel_dp->lane_count)
 		return false;
 
 	return true;
@@ -1593,7 +1594,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 	int i;
 	uint8_t voltage;
 	bool clock_recovery = false;
-	int tries;
+	int voltage_tries, loop_tries;
 	u32 reg;
 	uint32_t DP = intel_dp->DP;
 
@@ -1620,7 +1621,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		DP &= ~DP_LINK_TRAIN_MASK;
 	memset(intel_dp->train_set, 0, 4);
 	voltage = 0xff;
-	tries = 0;
+	voltage_tries = 0;
+	loop_tries = 0;
 	clock_recovery = false;
 	for (;;) {
 		/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
@@ -1663,17 +1665,28 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		for (i = 0; i < intel_dp->lane_count; i++)
 			if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
 				break;
-		if (i == intel_dp->lane_count)
-			break;
-
-		/* Check to see if we've tried the same voltage 5 times */
-		if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
-			++tries;
-			if (tries == 5)
+		if (i == intel_dp->lane_count) {
+			++loop_tries;
+			if (loop_tries == 5) {
+				DRM_DEBUG_KMS("too many full retries, give up\n");
 				break;
-		} else
-			tries = 0;
-		voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+			}
+			memset(intel_dp->train_set, 0, 4);
+			voltage_tries = 0;
+			continue;
+		} else {
+
+			/* Check to see if we've tried the same voltage 5 times */
+			if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
+				++voltage_tries;
+				if (voltage_tries == 5) {
+					DRM_DEBUG_KMS("too many voltage retries, give up\n");
+					break;
+				}
+			} else
+				voltage_tries = 0;
+			voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+		}
 
 		/* Compute new intel_dp->train_set as requested by target */
 		intel_get_adjust_train(intel_dp, link_status);
Signature · 1 line
1.7.7
#34 lore raw

Re: [PATCH 6/7] drm/i915: Try harder during dp pattern 1 link training

Quoted 15 lines · Keith Packard

Instead of going through the sequence just once, run through the whole set up to 5 times to see if something can work. This isn't part of the DP spec, but the BIOS seems to do it, and given that link training failure is so bad, it seems reasonable to follow suit.

---
 drivers/gpu/drm/i915/intel_dp.c |   41 +++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 6be6a04..bf20a35 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_link_train(struct intel_dp *intel_dp, · line 1582

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +3 -2
@@ -1576,8 +1576,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
 
 	ret = intel_dp_aux_native_write(intel_dp,
 					DP_TRAINING_LANE0_SET,
-					intel_dp->train_set, 4);
-	if (ret != 4)
+					intel_dp->train_set,
+					intel_dp->lane_count);
+	if (ret != intel_dp->lane_count)
 		return false;

This would seem to be a separate chunk to initiate training on only the lanes we intend to use.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#35 lore raw

Re: [PATCH 6/7] drm/i915: Try harder during dp pattern 1 link training

Quoted 2 lines · Chris Wilson

This would seem to be a separate chunk to initiate training on only the lanes we intend to use.

Yeah, this got left in during some debugging; it might be a good thing to do, but it's completely separate. I've pulled it out into a separate patch.

Signature · 1 line
[email protected]
#36 lore raw

Re: [PATCH 6/7] drm/i915: Try harder during dp pattern 1 link training

In reply to Chris Wilson
Quoted 3 lines · Chris Wilson

This would seem to be a separate chunk to initiate training on only the lanes we intend to use.
-Chris

Here's that patch separated out:

commit e7fecae483754ca9a42312be18f58ceb454702fe

Author: Keith Packard <[email protected]>
Date:   Wed Nov 2 10:17:59 2011 -0700

drm/i915: Initiate DP link training only on the lanes we'll be using

Limit the link training setting command to the lanes needed for the current mode. It seems vaguely possible that a monitor will try to train the other lanes and fail in some way, so this seems like the safer plan.

drivers/gpu/drm/i915/intel_dp.c +3 -2
index 0a4fa64..02b56ce 100644
@@ -1567,8 +1567,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
 
        ret = intel_dp_aux_native_write(intel_dp,
                                        DP_TRAINING_LANE0_SET,
-                                       intel_dp->train_set, 4);
-       if (ret != 4)
+                                       intel_dp->train_set,
+                                       intel_dp->lane_count);
+       if (ret != intel_dp->lane_count)
                return false;
 
        return true;
Signature · 1 line
[email protected]
Reviewed-by on v1 6/7
#37 lore raw

Re: [Intel-gfx] [PATCH 6/7] drm/i915: Try harder during dp pattern 1 link training

In reply to Keith Packard
Quoted 16 lines · On Tue, 1 Nov 2011 23:20:29 -0700 Keith Packard <[email protected]> wrote:

Instead of going through the sequence just once, run through the whole set up to 5 times to see if something can work. This isn't part of the DP spec, but the BIOS seems to do it, and given that link training failure is so bad, it seems reasonable to follow suit.

---
 drivers/gpu/drm/i915/intel_dp.c |   41 +++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 6be6a04..bf20a35 100644
@@ -1576,8 +1576,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
 

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_link_train(struct intel_dp *intel_dp, · line 1584

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -2
 	ret = intel_dp_aux_native_write(intel_dp,
 					DP_TRAINING_LANE0_SET,
-					intel_dp->train_set, 4);
-	if (ret != 4)
+					intel_dp->train_set,
+					intel_dp->lane_count);
+	if (ret != intel_dp->lane_count)
 		return false;
 
 	return true;

Sneaky putting this bug fix into this patch. :)

Quoted 48 lines
drivers/gpu/drm/i915/intel_dp.c +17 -12
@@ -1593,7 +1594,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 	int i;
 	uint8_t voltage;
 	bool clock_recovery = false;
-	int tries;
+	int voltage_tries, loop_tries;
 	u32 reg;
 	uint32_t DP = intel_dp->DP;
 
@@ -1620,7 +1621,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		DP &= ~DP_LINK_TRAIN_MASK;
 	memset(intel_dp->train_set, 0, 4);
 	voltage = 0xff;
-	tries = 0;
+	voltage_tries = 0;
+	loop_tries = 0;
 	clock_recovery = false;
 	for (;;) {
 		/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
@@ -1663,17 +1665,28 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
 		for (i = 0; i < intel_dp->lane_count; i++)
 			if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
 				break;
-		if (i == intel_dp->lane_count)
-			break;
-
-		/* Check to see if we've tried the same voltage 5 times */
-		if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
-			++tries;
-			if (tries == 5)
+		if (i == intel_dp->lane_count) {
+			++loop_tries;
+			if (loop_tries == 5) {
+				DRM_DEBUG_KMS("too many full retries, give up\n");
 				break;
-		} else
-			tries = 0;
-		voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+			}
+			memset(intel_dp->train_set, 0, 4);
+			voltage_tries = 0;
+			continue;
+		} else {
+
+			/* Check to see if we've tried the same voltage 5 times */
+			if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
+				++voltage_tries;
+				if (voltage_tries == 5) {

drivers/gpu/drm/i915/intel_dp.c intel_dp_start_link_train(struct intel_dp *intel_dp) · line 1692

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+					DRM_DEBUG_KMS("too many voltage retries, give up\n");
+					break;
+				}
+			} else
+				voltage_tries = 0;
+			voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+		}
 
 		/* Compute new intel_dp->train_set as requested by target */
 		intel_get_adjust_train(intel_dp, link_status);

Don't you love the training state machine? I think this looks ok, and the DP compliance test should catch any grievous errors, so aside from the bug fix hunk which should be split out:

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

Re: [Intel-gfx] [PATCH 6/7] drm/i915: Try harder during dp pattern 1 link training

Quoted 1 line · Jesse Barnes

Sneaky putting this bug fix into this patch. :)

Ickle already saw that, and I've split it out into a separate patch. I don't think this is necessary, but it seems like a sensible change.

Quoted 5 lines

Don't you love the training state machine? I think this looks ok, and the DP compliance test should catch any grievous errors, so aside from the bug fix hunk which should be split out:

And that chunk has already been split out :-)

Signature · 1 line
[email protected]
#39 lore raw

PATCH 7/7 drm/i915: Remove trailing white space

In reply to Keith Packard

Found a couple of bare tabs in intel_dp.c

---
 drivers/gpu/drm/i915/intel_dp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
index bf20a35..7ebeb01 100644
@@ -1054,7 +1054,7 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
 
 	DRM_DEBUG_KMS("Turn eDP VDD off %d\n", intel_dp->want_panel_vdd);
 	WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on");
-	
+
 	intel_dp->want_panel_vdd = false;
 
 	if (sync) {
@@ -2402,7 +2402,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 
 		cur.t8 = (pp_on & PANEL_LIGHT_ON_DELAY_MASK) >>
 			PANEL_LIGHT_ON_DELAY_SHIFT;
-		
+
 		cur.t9 = (pp_off & PANEL_LIGHT_OFF_DELAY_MASK) >>
 			PANEL_LIGHT_OFF_DELAY_SHIFT;
 
Signature · 1 line
1.7.7
Reviewed-by on v1 7/7
#40 lore raw

Re: [Intel-gfx] [PATCH 7/7] drm/i915: Remove trailing white space

Quoted 21 lines · On Tue, 1 Nov 2011 23:20:30 -0700 Keith Packard <[email protected]> wrote:

Found a couple of bare tabs in intel_dp.c

---
 drivers/gpu/drm/i915/intel_dp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index bf20a35..7ebeb01 100644
@@ -1054,7 +1054,7 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
 
 	DRM_DEBUG_KMS("Turn eDP VDD off %d\n", intel_dp->want_panel_vdd);
 	WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on");
-	
+
 	intel_dp->want_panel_vdd = false;
 
 	if (sync) {

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

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -2402,7 +2402,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 
 		cur.t8 = (pp_on & PANEL_LIGHT_ON_DELAY_MASK) >>
 			PANEL_LIGHT_ON_DELAY_SHIFT;
-		
+
 		cur.t9 = (pp_off & PANEL_LIGHT_OFF_DELAY_MASK) >>
 			PANEL_LIGHT_OFF_DELAY_SHIFT;
 
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#42 lore raw

Re: [Intel-gfx] [PATCH 7/7] drm/i915: Remove trailing white space

In reply to Jesse Barnes
Quoted 1 line · Jesse Barnes

I've updated the pch-edp-fixes branch with your suggestions and attached your R-b: to the reviewed patches.

That leaves only the panel power sequencing changes, which could probably use more testing to make sure no existing systems stop working. I've got an ILK eDP system here that I haven't tested yet, so I can do that. I have tested SNB CPU eDP on the MacBook and CPT PCH eDP on the other system.

Signature · 1 line
[email protected]