Commit fb03ac01 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Use DIV_ROUND_CLOSEST() to calculate dot/vco

Rounding down when calculating the dot/vco frequencies doesn't make much
sense. Round to closest should give slightly nicer answers.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 540b5d02
...@@ -329,8 +329,8 @@ static void vlv_clock(int refclk, intel_clock_t *clock) ...@@ -329,8 +329,8 @@ static void vlv_clock(int refclk, intel_clock_t *clock)
{ {
clock->m = clock->m1 * clock->m2; clock->m = clock->m1 * clock->m2;
clock->p = clock->p1 * clock->p2; clock->p = clock->p1 * clock->p2;
clock->vco = refclk * clock->m / clock->n; clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
clock->dot = clock->vco / clock->p; clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
} }
/** /**
...@@ -430,8 +430,8 @@ static void pineview_clock(int refclk, intel_clock_t *clock) ...@@ -430,8 +430,8 @@ static void pineview_clock(int refclk, intel_clock_t *clock)
{ {
clock->m = clock->m2 + 2; clock->m = clock->m2 + 2;
clock->p = clock->p1 * clock->p2; clock->p = clock->p1 * clock->p2;
clock->vco = refclk * clock->m / clock->n; clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
clock->dot = clock->vco / clock->p; clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
} }
static uint32_t i9xx_dpll_compute_m(struct dpll *dpll) static uint32_t i9xx_dpll_compute_m(struct dpll *dpll)
...@@ -443,8 +443,8 @@ static void i9xx_clock(int refclk, intel_clock_t *clock) ...@@ -443,8 +443,8 @@ static void i9xx_clock(int refclk, intel_clock_t *clock)
{ {
clock->m = i9xx_dpll_compute_m(clock); clock->m = i9xx_dpll_compute_m(clock);
clock->p = clock->p1 * clock->p2; clock->p = clock->p1 * clock->p2;
clock->vco = refclk * clock->m / (clock->n + 2); clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n + 2);
clock->dot = clock->vco / clock->p; clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
} }
#define INTELPllInvalid(s) do { /* DRM_DEBUG(s); */ return false; } while (0) #define INTELPllInvalid(s) do { /* DRM_DEBUG(s); */ return false; } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment