Skip to contentSkip to conversation

drm/i915/pch: Use minimal number of FDI lanes

PATCH Zhenyu Wang 3 participants 3 messages Apr 12, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhenyu Wang

author Acked-by
#1 lore raw
Quoted 5 lines · Adam Jackson

This should be a small power savings, but the Watts-Up I used to test is only precise to within 100mW. Tested on Lenovo T410 (Ironlake), LVDS VGA and DisplayPort, up to 1920x1200R.

Nice work for per crtc FDI lane config! We might have some limit on future hw for FDI lane number, in consider of the introduction with the third pipe, but this one is true for all current systems.

Adam, this should be a d-i-n patch right? I've changed FDI link setting for Sandybridge on that branch, so please rebase onto that. This should also apply true for SNB/CPT system, I'll give it a testing.

Thanks.

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

#2 lore raw
Quoted 10 lines · Zhenyu Wang
Quoted 5 lines · Adam Jackson

This should be a small power savings, but the Watts-Up I used to test is only precise to within 100mW. Tested on Lenovo T410 (Ironlake), LVDS VGA and DisplayPort, up to 1920x1200R.

Nice work for per crtc FDI lane config! We might have some limit on future hw for FDI lane number, in consider of the introduction with the third pipe, but this one is true for all current systems.

Yeah, I'm not really sure how to handle that. My instinct is to just limit the maximum pixel clock for those pipes during mode validation.

Quoted 3 lines

Adam, this should be a d-i-n patch right? I've changed FDI link setting for Sandybridge on that branch, so please rebase onto that. This should also apply true for SNB/CPT system, I'll give it a testing.

It was against d-i-n as of:

drm/i915: Remove dead KMS encoder save/restore code.

Rebase coming in a moment.

- ajax

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

#3 lore raw
In reply to a message not in the archive
Quoted 3 lines · Adam Jackson

This should be a small power savings, but the Watts-Up I used to test is only precise to within 100mW. Tested on Lenovo T410 (Ironlake), LVDS VGA and DisplayPort, up to 1920x1200R.

Very good point.

I test this patch on another laptop. Only when LVDS is used, it seems that it can save about 0.2W idle power.

thanks
yakui

Quoted 82 lines
---
 drivers/gpu/drm/i915/intel_display.c |   23 ++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 2 files changed, 19 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +18 -5
index eb4a265..39b77d0 100644
@@ -1582,9 +1582,10 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
 			 */
 			temp &= ~(0x7 << 16);
 			temp |= (pipe_bpc << 11);
+			temp &= ~(7 << 19);
+			temp |= (intel_crtc->fdi_lanes - 1) << 19;
 			I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE |
-					FDI_SEL_PCDCLK |
-					FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */
+					FDI_SEL_PCDCLK);
 			I915_READ(fdi_rx_reg);
 			udelay(200);
 
@@ -1630,7 +1631,8 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
 			/* enable CPU FDI TX and PCH FDI RX */
 			temp = I915_READ(fdi_tx_reg);
 			temp |= FDI_TX_ENABLE;
-			temp |= FDI_DP_PORT_WIDTH_X4; /* default */
+			temp &= ~(7 << 19);
+			temp |= (intel_crtc->fdi_lanes - 1) << 19;
 			temp &= ~FDI_LINK_TRAIN_NONE;
 			temp |= FDI_LINK_TRAIN_PATTERN_1;
 			I915_WRITE(fdi_tx_reg, temp);
@@ -3043,7 +3045,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 
 	/* FDI link */
 	if (HAS_PCH_SPLIT(dev)) {
-		int lane, link_bw, bpp;
+		int lane = 0, link_bw, bpp;
 		/* eDP doesn't require FDI link, so just set DP M/N
 		   according to current link config */
 		if (is_edp) {
@@ -3059,7 +3061,6 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 				target_clock = mode->clock;
 			else
 				target_clock = adjusted_mode->clock;
-			lane = 4;
 			link_bw = 270000;
 		}
 
@@ -3111,6 +3112,18 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 			bpp = 24;
 		}
 
+		if (!lane) {
+			/* 
+			 * Account for spread spectrum to avoid
+			 * oversubscribing the link. Max center spread
+			 * is 2.5%; use 5% for safety's sake.
+			 */
+			u32 bps = target_clock * bpp * 19 / 20;
+			lane = bps / (link_bw * 8) + 1;
+		}
+
+		intel_crtc->fdi_lanes = lane;
+
 		ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n);
 	}
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index c15ec47..d716f35 100644
@@ -154,6 +154,7 @@ struct intel_crtc {
 	bool lowfreq_avail;
 	struct intel_overlay *overlay;
 	struct intel_unpin_work *unpin_work;
+	int fdi_lanes;
 };
 
 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)