drm/i915: Round to closest when computing the VGA dotclock for LPT-H
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 4 Dec 2015 20:20:21 +0000 (22:20 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 8 Dec 2015 14:30:21 +0000 (16:30 +0200)
Bspec says we should round to closest when computing the LPT-H VGA
dotclock, so let's do that.

v2: Fix typo in commit message (Paulo)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449260421-14243-1-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c

index c69a0d6c5a1e2546f302c490eb61d19f4f06f638..7e3afcc62997420caad50947f3d3abaa967dc3bd 100644 (file)
@@ -3978,7 +3978,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
                u32 iclk_pi_range = 64;
                u32 desired_divisor, msb_divisor_value, pi_value;
 
-               desired_divisor = (iclk_virtual_root_freq / clock);
+               desired_divisor = DIV_ROUND_CLOSEST(iclk_virtual_root_freq, clock);
                msb_divisor_value = desired_divisor / iclk_pi_range;
                pi_value = desired_divisor % iclk_pi_range;