[Intel-gfx] [PATCH 02/14] drm/i915: Use DIV_ROUND_CLOSEST()

Daniel Vetter daniel at ffwll.ch
Fri Sep 27 21:35:13 CEST 2013


On Thu, Sep 26, 2013 at 01:09:26PM +0300, Mika Kuoppala wrote:
> ville.syrjala at linux.intel.com writes:
> 
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > vlv_find_best_dpll() has an open coded DIV_ROUND_CLOSEST(). Replace it
> > with the real thing.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index fca56fc..4b1af94 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -696,8 +696,7 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
> >  				p = p1 * p2;
> >  				/* based on hardware requirement, prefer bigger m1,m2 values */
> >  				for (m1 = limit->m1.min; m1 <= limit->m1.max; m1++) {
> > -					m2 = (((2*(fastclk * p * n / m1 )) +
> > -					       refclk) / (2*refclk));
> > +					m2 = DIV_ROUND_CLOSEST(fastclk * p * n, refclk * m1);
> >  					m = m1 * m2;
> >  					vco = updrate * m;
> >  
> > -- 
> > 1.8.1.5
> 
> Not a problem with this patch but perhaps consideration for further
> cleanups: target and refclk should be u32 and further down the line
> the crtc_config.clock and xxx_get_refclk() also.
> 
> Reviewed-by: Mika Kuoppala <mika.kuoppala at intel.com>

Up to this all merged, thanks for patches&review.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list