From patchwork Fri Mar 1 21:14:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2204721 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 7C38D3FCF6 for ; Fri, 1 Mar 2013 21:41:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E676E63F1 for ; Fri, 1 Mar 2013 13:41:24 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy9.bluehost.com (oproxy9.bluehost.com [69.89.24.6]) by gabe.freedesktop.org (Postfix) with SMTP id C8BFFE5C92 for ; Fri, 1 Mar 2013 13:37:54 -0800 (PST) Received: (qmail 32248 invoked by uid 0); 1 Mar 2013 21:37:53 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy9.bluehost.com with SMTP; 1 Mar 2013 21:37:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=x454bFoPBWm2Cuk3B4Xh1Hkcy702Uumipnjs1CKv+2U=; b=fInhgVjdYjHdQ6Rc1ffrriUE0ebqR5sSsz5MfxBtKLNbtr2IFMUgC6nG35dxtuteTz46af/CM0o0fpRLlrD0uWjXh9WMRyDQB19uAuWKf/7g2fSumIiRT7rXgZ4NcUYR; Received: from [67.161.37.189] (port=37647 helo=jbarnes-desktop.intel.com) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1UBXHe-0005Ri-Kn for intel-gfx@lists.freedesktop.org; Fri, 01 Mar 2013 14:14:26 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 1 Mar 2013 13:14:16 -0800 Message-Id: <1362172471-7643-14-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362172471-7643-1-git-send-email-jbarnes@virtuousgeek.org> References: <1362172471-7643-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 13/28] drm/i915: fix VLV limits and m/n/p calculations X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org For high res modes m n p calculation is fixed for VLV platform. Signed-off-by: Vijay Purushothaman Signed-off-by: Pallavi G Signed-off-by: Yogesh M Signed-off-by: Gajanan Bhat --- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b189fa..fd4a0d4 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -380,21 +380,21 @@ static const intel_limit_t intel_limits_vlv_dac = { .m1 = { .min = 2, .max = 3 }, .m2 = { .min = 11, .max = 156 }, .p = { .min = 10, .max = 30 }, - .p1 = { .min = 2, .max = 3 }, + .p1 = { .min = 1, .max = 3 }, .p2 = { .dot_limit = 270000, .p2_slow = 2, .p2_fast = 20 }, .find_pll = intel_vlv_find_best_pll, }; static const intel_limit_t intel_limits_vlv_hdmi = { - .dot = { .min = 20000, .max = 165000 }, - .vco = { .min = 4000000, .max = 5994000}, - .n = { .min = 1, .max = 7 }, + .dot = { .min = 25000, .max = 180000 }, + .vco = { .min = 4040000, .max = 5960000 }, + .n = { .min = 1, .max = 5 }, .m = { .min = 60, .max = 300 }, /* guess */ .m1 = { .min = 2, .max = 3 }, - .m2 = { .min = 11, .max = 156 }, + .m2 = { .min = 15, .max = 149 }, .p = { .min = 10, .max = 30 }, - .p1 = { .min = 2, .max = 3 }, + .p1 = { .min = 1, .max = 3 }, .p2 = { .dot_limit = 270000, .p2_slow = 2, .p2_fast = 20 }, .find_pll = intel_vlv_find_best_pll, @@ -408,7 +408,7 @@ static const intel_limit_t intel_limits_vlv_dp = { .m1 = { .min = 2, .max = 3 }, .m2 = { .min = 11, .max = 156 }, .p = { .min = 10, .max = 30 }, - .p1 = { .min = 2, .max = 3 }, + .p1 = { .min = 1, .max = 3 }, .p2 = { .dot_limit = 270000, .p2_slow = 2, .p2_fast = 20 }, .find_pll = intel_vlv_find_best_pll, @@ -809,10 +809,14 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc, int target, int refclk, intel_clock_t *match_clock, intel_clock_t *best_clock) { +#define LONG_OVERFLOW 0x7FFFFFFF +#define DIFF_OVERFLOW (LONG_OVERFLOW/10000) + u32 p1, p2, m1, m2, vco, bestn, bestm1, bestm2, bestp1, bestp2; u32 m, n, fastclk; u32 updrate, minupdate, fracbits, p; - unsigned long bestppm, ppm, absppm; + long bestppm, ppm, absppm, ppmdiff, absppmdiff; + unsigned long ulMult = 1; int dotclk, flag; flag = 0; @@ -841,8 +845,15 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc, m = m1 * m2; vco = updrate * m; if (vco >= limit->vco.min && vco < limit->vco.max) { - ppm = 1000000 * ((vco / p) - fastclk) / fastclk; - absppm = (ppm > 0) ? ppm : (-ppm); + ppmdiff = ((100*vco)/p) - (100*fastclk); + absppmdiff = (ppmdiff > 0) ? ppmdiff : (-ppmdiff); + ulMult = 1; + while (absppmdiff > DIFF_OVERFLOW) { + absppmdiff /= 10; + ulMult *= 10; + } + absppm = ((absppmdiff*10000)/fastclk)*ulMult; + if (absppm < 100 && ((p1 * p2) > (bestp1 * bestp2))) { bestppm = 0; flag = 1;