mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Furquan Shaikh <furquan@google.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>,
	Josh Triplett <josh.triplett@intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Ronald Minnich <rminnich@google.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Furquan Shaikh <furquan@google.com>,
	furquan.m.shaikh@gmail.com
Subject: [PATCH 1/2] drm/i915: Fix bug while calculating the clock value using do_div in ironlake_crtc_clock_get
Date: Mon, 19 Aug 2013 18:33:01 -0700	[thread overview]
Message-ID: <1376962382-29913-1-git-send-email-furquan@google.com> (raw)

We need to round up the values since the comparison in drm_mode_equal might fail if division
results in fractional part

Signed-off-by: Furquan Shaikh <furquan@google.com>
---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0f40f8e..e0069f4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7190,7 +7190,11 @@ static void ironlake_crtc_clock_get(struct intel_crtc *crtc,
 		return;
 
 	clock = ((u64)link_m * (u64)link_freq * (u64)repeat);
-	do_div(clock, link_n);
+	/* This is required because the value comes out to be in fraction
+	   (eg. 70699.54). Need to round it up since values are compared in
+	   drm_mode_equal
+	*/
+	clock = DIV_ROUND_UP_ULL(clock, link_n);
 
 	pipe_config->adjusted_mode.clock = clock;
 }
-- 
1.8.3


             reply	other threads:[~2013-08-20  1:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  1:33 Furquan Shaikh [this message]
2013-08-20  1:33 ` [PATCH 2/2] drm/i915: add fast boot support for Haswell Furquan Shaikh
2013-08-20 12:27   ` Daniel Vetter
2013-08-20 20:22   ` Paulo Zanoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376962382-29913-1-git-send-email-furquan@google.com \
    --to=furquan@google.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=furquan.m.shaikh@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=josh.triplett@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rminnich@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®