drm/i915: fix WRPLL clock calculation
authorJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 22 Jan 2014 20:58:04 +0000 (12:58 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 24 Jan 2014 16:23:00 +0000 (17:23 +0100)
Forgot to convert to using the refclk variable when I added refclk
readout support, and Paulo noticed the resulting calculation was off due
to the way p & r are stored.

Reported-by: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_ddi.c

index fe2967eb14fbe0136bce7a3f68e2dfb7cd95c3fe..cd65dd04ba20f8385417971f4f7a2b200e393bda 100644 (file)
@@ -663,7 +663,8 @@ static int intel_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv,
        p = (wrpll & WRPLL_DIVIDER_POST_MASK) >> WRPLL_DIVIDER_POST_SHIFT;
        n = (wrpll & WRPLL_DIVIDER_FB_MASK) >> WRPLL_DIVIDER_FB_SHIFT;
 
-       return (LC_FREQ * n) / (p * r);
+       /* Convert to KHz, p & r have a fixed point portion */
+       return (refclk * n * 100) / (p * r);
 }
 
 static void intel_ddi_clock_get(struct intel_encoder *encoder,