From patchwork Thu Jun 25 17:00:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6676721 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DFF349F39B for ; Thu, 25 Jun 2015 17:00:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10F63206E8 for ; Thu, 25 Jun 2015 17:00:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 30413206F7 for ; Thu, 25 Jun 2015 17:00:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BA896E504; Thu, 25 Jun 2015 10:00:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 386FB6E504 for ; Thu, 25 Jun 2015 10:00:45 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 25 Jun 2015 10:00:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,678,1427785200"; d="scan'208";a="753198624" Received: from unknown (HELO strange.ger.corp.intel.com) ([10.252.32.192]) by orsmga002.jf.intel.com with ESMTP; 25 Jun 2015 10:00:42 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Thu, 25 Jun 2015 18:00:40 +0100 Message-Id: <1435251640-6984-2-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435251640-6984-1-git-send-email-damien.lespiau@intel.com> References: <1435251640-6984-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/2] skl_compute_wrpll: Don't try other dividers if we find a 0 central freq deviation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Paulo suggested that we could short-circuit the search for a good divider if we find a 0 deviation of the DCO frequency from the central frequency. Out of the 373 test frequencies, 34 hit that fast path. Suggested-by: Paulo Zanoni Signed-off-by: Damien Lespiau --- tools/skl_compute_wrpll.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/skl_compute_wrpll.c b/tools/skl_compute_wrpll.c index 1cc2343..9245724 100644 --- a/tools/skl_compute_wrpll.c +++ b/tools/skl_compute_wrpll.c @@ -274,7 +274,12 @@ static void skl_wrpll_context_init(struct skl_wrpll_context *ctx) #define SKL_MAX_PDEVIATION 100 #define SKL_MAX_NDEVIATION 600 -static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, + +/* + * Returns true if we're sure to have found the definitive divider (ie + * deviation == 0). + */ +static bool skl_wrpll_try_divider(struct skl_wrpll_context *ctx, uint64_t central_freq, uint64_t dco_freq, unsigned int divider) @@ -297,6 +302,10 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, found = true; #endif } + + /* we can't improve a 0 deviation */ + if (deviation == 0) + return true; /* negative deviation */ } else if (deviation < SKL_MAX_NDEVIATION && deviation < ctx->min_deviation) { @@ -315,6 +324,8 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, printf("dco_freq: %"PRIu64", dco_central_freq %"PRIu64"\n", dco_freq, central_freq); } + + return false; } static void skl_wrpll_get_multipliers(unsigned int p, @@ -433,13 +444,15 @@ skl_ddi_calculate_wrpll2(int clock /* in Hz */, unsigned int p = dividers[d].list[i]; uint64_t dco_freq = p * afe_clock; - skl_wrpll_try_divider(&ctx, - dco_central_freq[dco], - dco_freq, - p); + if (skl_wrpll_try_divider(&ctx, + dco_central_freq[dco], + dco_freq, + p)) + goto skip_remaining_dividers; } } +skip_remaining_dividers: /* * If a solution is found with an even divider, prefer * this one.