[Intel-gfx] [PATCH 11/13] drm/i915: add clock_get for ironlake+

Jesse Barnes jbarnes at virtuousgeek.org
Tue Feb 19 22:31:46 CET 2013


Turns out it's easy to get the clock, though it may correspond to a
potential pfit mode.  In that case, we may still be able to flip if
we can get the native mode params somehow.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 91660b1..861af1a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6771,6 +6771,27 @@ static bool i9xx_crtc_get_mode(struct drm_crtc *crtc,
 	return true;
 }
 
+static int ironlake_crtc_clock_get(struct drm_crtc *crtc)
+{
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
+	int clock;
+	u32 link_m;
+
+	/*
+	 * PCH platforms make this easy: we can just use the LINK_M1 reg.
+	 * Note: this may be the pixel clock for a fitted mode, in which
+	 * case it won't match the native mode clock.  That means we won't be
+	 * able to do a simple flip in the fastboot case.
+	 */
+	link_m = I915_READ(PIPE_LINK_M1(cpu_transcoder));
+
+	clock = link_m;
+
+	return clock;
+}
+
 static bool ironlake_crtc_get_mode(struct drm_crtc *crtc,
 				   struct drm_display_mode *mode)
 {
@@ -6797,12 +6818,11 @@ static bool ironlake_crtc_get_mode(struct drm_crtc *crtc,
 	mode->vsync_start = (tmp & 0xffff) + 1;
 	mode->vsync_end = ((tmp & 0xffff0000) >> 16) + 1;
 
-	//mode->clock = i9xx_crtc_clock_get(crtc);
-	//mode->clock = 69300;
+	mode->clock = ironlake_crtc_clock_get(crtc);
 
 	drm_mode_set_name(mode);
 
-	return false; /* XXX mode->clock unset */
+	return true;
 }
 
 static __maybe_unused bool no_crtc_get_mode(struct drm_crtc *crtc,
-- 
1.7.9.5




More information about the Intel-gfx mailing list