Skip to contentSkip to conversation

drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get

PATCH Applied Jesse Barnes 2 participants 2 messages Sep 25, 2013

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

PATCH 1/1 drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get

From: Chris Wilson <[email protected]>

With some divider values we end up with the wrong result. So remove the intermediates (like Ville suggested in the first place) to get the right answer.

---
 drivers/gpu/drm/i915/intel_display.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -5
index 5b52ab0..f52e6d4 100644
@@ -5084,7 +5084,7 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	int pipe = pipe_config->cpu_transcoder;
 	intel_clock_t clock;
 	u32 mdiv;
-	int refclk = 100000, fastclk, update_rate;
+	int refclk = 100000;
 
 	mutex_lock(&dev_priv->dpio_lock);
 	mdiv = vlv_dpio_read(dev_priv, pipe, DPIO_DIV(pipe));
@@ -5096,10 +5096,8 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	clock.p1 = (mdiv >> DPIO_P1_SHIFT) & 7;
 	clock.p2 = (mdiv >> DPIO_P2_SHIFT) & 0x1f;
 
-	update_rate = refclk / clock.n;
-	clock.vco = update_rate * clock.m1 * clock.m2;
-	fastclk = clock.vco / clock.p1 / clock.p2;
-	clock.dot = (2 * fastclk);
+	clock.vco = refclk * clock.m1 * clock.m2 / clock.n;
+	clock.dot = 2 * clock.vco / (clock.p1 * clock.p2);
 
 	pipe_config->port_clock = clock.dot / 10;
 }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Jesse Barnes

From: Chris Wilson <[email protected]>

With some divider values we end up with the wrong result. So remove the intermediates (like Ville suggested in the first place) to get the right answer.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch