From patchwork Thu Jul 13 14:13:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 9838577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76A3860392 for ; Thu, 13 Jul 2017 14:14:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68663285F9 for ; Thu, 13 Jul 2017 14:14:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D47F2870F; Thu, 13 Jul 2017 14:14:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0A65D285F9 for ; Thu, 13 Jul 2017 14:14:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B3F16E641; Thu, 13 Jul 2017 14:13:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F3756E61F for ; Thu, 13 Jul 2017 14:13:20 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 82C1922006; Thu, 13 Jul 2017 16:13:18 +0200 (CEST) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5A90521FE2; Thu, 13 Jul 2017 16:13:18 +0200 (CEST) From: Maxime Ripard To: Mark Brown , Thierry Reding , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH 09/18] drm/sun4i: tcon: Adjust dotclock dividers range Date: Thu, 13 Jul 2017 16:13:04 +0200 Message-Id: <74db696da66cffafe1e729fe2df73b437c8fd483.1499955058.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: Cc: Mark Rutland , devicetree@vger.kernel.org, Boris Brezillon , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , Daniel Vetter , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It seems like the dotclock dividers are a bit less strict range, and can operate even with a smaller than 6 divider. Loose the boundaries a bit. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_dotclock.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c index d401156490f3..0b844c0dd102 100644 --- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c +++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c @@ -77,7 +77,25 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate, u8 best_div = 1; int i; - for (i = 6; i <= 127; i++) { + /* + * There's something odd here. + * + * In the A13 user manual, this is stated to be >= 6 when + * dclk1 and dclk2 are used (without any hint on how to use + * them), and >= 4 when only dclk is used. + * + * In the A33 user manual, when only dclk is used, it is set + * to be >= 6 in the former case, and >= 1 in the + * latter. There's also some (obscure) explanations about the + * dclk1 and dclk2 vs dclk that seems to be in the upper 4 + * bits. What those clocks are and what bit does what is not + * really clear. + * + * On the A33 however, while something lower than 4 works, it + * does have a few artifacts. Let's not use those values, and + * see how it goes. + */ + for (i = 4; i <= 127; i++) { unsigned long ideal = rate * i; unsigned long rounded;