From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 02/14] drm/i915: Use DIV_ROUND_CLOSEST() Date: Fri, 27 Sep 2013 21:35:13 +0200 Message-ID: <20130927193512.GC26592@phenom.ffwll.local> References: <1380047191-3359-1-git-send-email-ville.syrjala@linux.intel.com> <1380047191-3359-3-git-send-email-ville.syrjala@linux.intel.com> <87fvsrdhd5.fsf@gaia.fi.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) by gabe.freedesktop.org (Postfix) with ESMTP id D4FB1E8259 for ; Fri, 27 Sep 2013 12:34:57 -0700 (PDT) Received: by mail-ee0-f50.google.com with SMTP id d51so1433348eek.37 for ; Fri, 27 Sep 2013 12:34:55 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87fvsrdhd5.fsf@gaia.fi.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Mika Kuoppala Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Sep 26, 2013 at 01:09:26PM +0300, Mika Kuoppala wrote: > ville.syrjala@linux.intel.com writes: > = > > From: Ville Syrj=E4l=E4 > > > > vlv_find_best_dpll() has an open coded DIV_ROUND_CLOSEST(). Replace it > > with the real thing. > > > > Signed-off-by: Ville Syrj=E4l=E4 > > --- > > 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/i91= 5/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, stru= ct drm_crtc *crtc, > > p =3D p1 * p2; > > /* based on hardware requirement, prefer bigger m1,m2 values */ > > for (m1 =3D limit->m1.min; m1 <=3D limit->m1.max; m1++) { > > - m2 =3D (((2*(fastclk * p * n / m1 )) + > > - refclk) / (2*refclk)); > > + m2 =3D DIV_ROUND_CLOSEST(fastclk * p * n, refclk * m1); > > m =3D m1 * m2; > > vco =3D 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 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