Skip to contentSkip to conversation

drm/i915: set proper DPIO post divider for VGA on VLV

PATCH New Jesse Barnes 1 participant 3 messages May 1, 2013

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

PATCH 1/1 drm/i915: set proper DPIO post divider for VGA on VLV

It's only for the low rates that the divider value should be 0.

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -3
index 6504337..25aff94 100644
@@ -4425,10 +4425,17 @@ static void vlv_update_pll(struct intel_crtc *crtc)
 	mdiv |= ((bestp1 << DPIO_P1_SHIFT) | (bestp2 << DPIO_P2_SHIFT));
 	mdiv |= ((bestn << DPIO_N_SHIFT));
 	mdiv |= (1 << DPIO_K_SHIFT);
-	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT))
+
+	/*
+	 * Post divider depends on pixel clock rate, DAC vs digital (and LVDS,
+	 * but we don't support that).
+	 */
+	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_ANALOG) &&
+	    adjusted_mode->clock > 300000)
+		mdiv |= (DPIO_POST_DIV_DAC << DPIO_POST_DIV_SHIFT);
+	else
 		mdiv |= (DPIO_POST_DIV_HDMIDP << DPIO_POST_DIV_SHIFT);
+	mdiv |= (DPIO_POST_DIV_HDMIDP << DPIO_POST_DIV_SHIFT);
 	intel_dpio_write(dev_priv, DPIO_DIV(pipe), mdiv);
 
 	mdiv |= DPIO_ENABLE_CALIBRATION;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 drm/i915: set proper DPIO post divider for VGA on VLV v2

It's only for the low rates that the divider value should be 0.

v2: remove unconditional write (Jesse)
check for pixel rate properly (Jesse)

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -3
index 6504337..92894b7 100644
@@ -4425,9 +4425,16 @@ static void vlv_update_pll(struct intel_crtc *crtc)
 	mdiv |= ((bestp1 << DPIO_P1_SHIFT) | (bestp2 << DPIO_P2_SHIFT));
 	mdiv |= ((bestn << DPIO_N_SHIFT));
 	mdiv |= (1 << DPIO_K_SHIFT);
-	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT))
+
+	/*
+	 * Post divider depends on pixel clock rate, DAC vs digital (and LVDS,
+	 * but we don't support that).
+	 */
+	DRM_ERROR("clock: %d\n", adjusted_mode->clock);
+	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_ANALOG) &&
+	    adjusted_mode->clock < 30000)
+		mdiv |= (DPIO_POST_DIV_DAC << DPIO_POST_DIV_SHIFT);
+	else
 		mdiv |= (DPIO_POST_DIV_HDMIDP << DPIO_POST_DIV_SHIFT);
 	intel_dpio_write(dev_priv, DPIO_DIV(pipe), mdiv);
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/1 drm/i915: set proper DPIO post divider for VGA on VLV v3

It's only for the low rates that the divider value should be 0.

v2: remove unconditional write (Jesse)
check for pixel rate properly (Jesse)
v3: give up, the DAC divider apparently doesn't work, and low res modes
work ok (Jesse)
remove debug msg (Jesse)

---
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -4
index 6504337..59c2114 100644
@@ -4425,10 +4425,13 @@ static void vlv_update_pll(struct intel_crtc *crtc)
 	mdiv |= ((bestp1 << DPIO_P1_SHIFT) | (bestp2 << DPIO_P2_SHIFT));
 	mdiv |= ((bestn << DPIO_N_SHIFT));
 	mdiv |= (1 << DPIO_K_SHIFT);
-	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT))
-		mdiv |= (DPIO_POST_DIV_HDMIDP << DPIO_POST_DIV_SHIFT);
+
+	/*
+	 * Post divider depends on pixel clock rate, DAC vs digital (and LVDS,
+	 * but we don't support that).
+	 * Note: don't use the DAC post divider as it seems unstable.
+	 */
+	mdiv |= (DPIO_POST_DIV_HDMIDP << DPIO_POST_DIV_SHIFT);
 	intel_dpio_write(dev_priv, DPIO_DIV(pipe), mdiv);
 
 	mdiv |= DPIO_ENABLE_CALIBRATION;
Signature · 1 line
1.7.10.4