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: 9838633 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 80541602D8 for ; Thu, 13 Jul 2017 14:17:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70FCC1FE76 for ; Thu, 13 Jul 2017 14:17:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64CB328711; Thu, 13 Jul 2017 14:17:42 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D717F28720 for ; Thu, 13 Jul 2017 14:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=i5pNEVXjBUtv1Z7sBpmpEWavtiiF/ZtOTGRfJerJrb4=; b=JOJrLsEAySjgg2aorGZtyjy2s/ gZBQs4VYk8Yh1ER5fN9WYV3LZzlxQcLM9BQIjT1Ujyby93Epkb4zcl09OOnvsInOYwnJ0QPQdsqjL unqsV6lQHQQqcJjUvoz9wSzm6eOselHoa07LayDcJhyMe30KTO0DzcuYOM/cRstVVyaWqP22Q+ryc 8aB3BOqeBwQepgMzyHamkRMrieH+ZbiQS2y7eUSv8Xwi9L2oxF69vuKLIc7aDzADX1hCCyoZdTkAn QnIbv/QflePzw+HsHzdZEx/TRg+GR7NMeIQ5HEJZ9QxJTlo4I16QodLt3cKWfUcAVDphXm2gnu4Z4 Rr2+yVsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dVevz-0006Yz-Rc; Thu, 13 Jul 2017 14:17:39 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dVesf-0002JX-I0 for linux-arm-kernel@lists.infradead.org; Thu, 13 Jul 2017 14:14:23 +0000 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170713_071414_705089_70D3690B X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Boris Brezillon , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , Daniel Vetter , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;