From patchwork Thu May 17 16:30:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 11298 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SV3b0-0005aY-Fr for patchwork@linuxtv.org; Thu, 17 May 2012 18:30:34 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1SV3az-0004ov-Ii; Thu, 17 May 2012 18:30:34 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762196Ab2EQQaa (ORCPT ); Thu, 17 May 2012 12:30:30 -0400 Received: from smtp.nokia.com ([147.243.1.47]:30224 "EHLO mgw-sa01.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760587Ab2EQQa3 (ORCPT ); Thu, 17 May 2012 12:30:29 -0400 Received: from maxwell.research.nokia.com (maxwell.research.nokia.com [172.21.199.25]) by mgw-sa01.nokia.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q4HGURnu029742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 17 May 2012 19:30:27 +0300 Received: from lanttu (lanttu-o.localdomain [192.168.239.74]) by maxwell.research.nokia.com (Postfix) with ESMTPS id 59E2B1F4C5A for ; Thu, 17 May 2012 19:30:27 +0300 (EEST) Received: from sakke by lanttu with local (Exim 4.72) (envelope-from ) id 1SV3am-00086j-Gh for linux-media@vger.kernel.org; Thu, 17 May 2012 19:30:20 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 05/10] smiapp: Round minimum pre_pll up rather than down in ip_clk_freq check Date: Thu, 17 May 2012 19:30:04 +0300 Message-Id: <1337272209-31061-5-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <4FB52770.9000400@maxwell.research.nokia.com> References: <4FB52770.9000400@maxwell.research.nokia.com> X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.17.162121 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1200_1299 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __DATE_TZ_RU 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' The pre_pll divisor must be such that ext_clk / pre_pll divisor does not result in a frequency that is greater than pll_ip_clk_freq. Fix this. Signed-off-by: Sakari Ailus --- drivers/media/video/smiapp-pll.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/smiapp-pll.c b/drivers/media/video/smiapp-pll.c index a416e27..a2e41a2 100644 --- a/drivers/media/video/smiapp-pll.c +++ b/drivers/media/video/smiapp-pll.c @@ -124,8 +124,9 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, limits->min_pll_ip_freq_hz)); limits->min_pre_pll_clk_div = max_t(uint16_t, limits->min_pre_pll_clk_div, - clk_div_even(pll->ext_clk_freq_hz / - limits->max_pll_ip_freq_hz)); + clk_div_even_up( + DIV_ROUND_UP(pll->ext_clk_freq_hz, + limits->max_pll_ip_freq_hz))); dev_dbg(dev, "pre-pll check: min / max pre_pll_clk_div: %d / %d\n", limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div);