Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22283112ybl; Mon, 6 Jan 2020 23:03:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxMWTW+MrVe8WgA0A3X7Ton/bBnUw8WRhIE2ZlP4iZa+5y7Hqnk54oLW4fS3KMtni+Se+Qu X-Received: by 2002:a05:6830:1d91:: with SMTP id y17mr113908064oti.276.1578380603374; Mon, 06 Jan 2020 23:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578380603; cv=none; d=google.com; s=arc-20160816; b=R4NAEGvVaBfKIuUlofGNVqDPySEISLJgp0meh/Yb/WgavmJaA1AcM26Ni5/Za4/zpb M6clzdkbW0krYl7t1i8YbP1o0QPy6NNMOQqwbtWgLKYzkD9Qm8ednXioe9r6UBa0zmye AbGd5QkULmS+Iuxh+dIZas0pI1EwkxSMfReTldd9sEwUkBsuVLjf+2KgJZFI1Tl1OWdh oUdHNBon6TFJqMU9XMaueSmvYloYXmZ+t+EAODhDbbzP/z7/RfNlA8fskDl9px8lKYew A8MyDYaPRdD1mUheTZiicGR72cRDtEfmFGWHZyWeuzSgI5fsvEdaif04FnSdm5nTppbj Ew0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YoW1uwk61Mb64EKx2yvjX5Da/j+IS7hO3D1+cMDb0Z0=; b=LpOT0WbbvKdI3+jGnoJlrkr4vMYWhhMfgEFJqhx7s82uLdbjZ8lj1VP47Pq6ZAX8kf sz4VSRPpM9X4C/V7sy9txsMZP5b58ggQHiZmNGkLbSztibOg7J1fMvUS3rO6nem5/QB9 7Nbb0jsjlCz/7YQq4UtjbF/fNR86qaW7IqB7NBW1Aq00KAG0JV6dK2vDa9F5xAWyzLjZ Vb9XZsovh81eydAZqxD7KTYfSwK45bQXQMjJleq1cG6la5b8jVGr6eJx5iwf0Xyqnty2 P0y5v3sGNeapw/yUxcghizI3w0yooVby0a8YNKN467RcziOxaJGBGCzWNwgOa/rljfu4 ECSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yRlWLe9t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si33707073oib.246.2020.01.06.23.03.07; Mon, 06 Jan 2020 23:03:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yRlWLe9t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbgAGHBV (ORCPT + 99 others); Tue, 7 Jan 2020 02:01:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:38718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgAGHBV (ORCPT ); Tue, 7 Jan 2020 02:01:21 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EFB1C207E0; Tue, 7 Jan 2020 07:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578380480; bh=atyeyYGT5jcZ0qw968QE6bC4vhzHSBeJkqKe40lWcgw=; h=From:To:Cc:Subject:Date:From; b=yRlWLe9tvzeqTyU1nAkpz6Gkhk4nPMcY/UbD3NnJGpF5g1n2mhMgnAGxjcJsLud9k FCzRz6EHMOBWx4MFyorXoJSRuKSeMNon/6lBmN1ce4AqmIKMe89FvvEg+e1Gipjn1O ePyakwDZ4Iqpjw5JgTkMGCbjiCr8RVq7VIK7U1s8= Received: by wens.tw (Postfix, from userid 1000) id AF3315FBD4; Tue, 7 Jan 2020 15:01:16 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , David Airlie , Daniel Vetter Cc: Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] drm/sun4i: tcon: Set RGB DCLK min. divider based on hardware model Date: Tue, 7 Jan 2020 15:01:13 +0800 Message-Id: <20200107070113.28951-1-wens@kernel.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai In commit 0b8e7bbde5e7 ("drm/sun4i: tcon: Set min division of TCON0_DCLK to 1.") it was assumed that all TCON variants support a minimum divider of 1 if only DCLK was used. However, the oldest generation of hardware only supports minimum divider of 4 if only DCLK is used. If a divider of 1 was used on this old hardware, some scrolling artifact would appear. A divider of 2 seemed OK, but a divider of 3 had artifacts as well. Set the minimum divider when outputing to parallel RGB based on the hardware model, with a minimum of 4 for the oldest (A10/A10s/A13/A20) hardware, and a minimum of 1 for the rest. A value is not set for the TCON variants lacking channel 0. This fixes the scrolling artifacts seen on my A13 tablet. Fixes: 0b8e7bbde5e7 ("drm/sun4i: tcon: Set min division of TCON0_DCLK to 1.") Cc: # 5.4.x Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 15 ++++++++++++--- drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 42651d737c55..c81cdce6ed55 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -489,7 +489,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, WARN_ON(!tcon->quirks->has_channel_0); - tcon->dclk_min_div = 1; + tcon->dclk_min_div = tcon->quirks->dclk_min_div; tcon->dclk_max_div = 127; sun4i_tcon0_mode_set_common(tcon, mode); @@ -1426,12 +1426,14 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, static const struct sun4i_tcon_quirks sun4i_a10_quirks = { .has_channel_0 = true, .has_channel_1 = true, + .dclk_min_div = 4, .set_mux = sun4i_a10_tcon_set_mux, }; static const struct sun4i_tcon_quirks sun5i_a13_quirks = { .has_channel_0 = true, .has_channel_1 = true, + .dclk_min_div = 4, .set_mux = sun5i_a13_tcon_set_mux, }; @@ -1440,6 +1442,7 @@ static const struct sun4i_tcon_quirks sun6i_a31_quirks = { .has_channel_1 = true, .has_lvds_alt = true, .needs_de_be_mux = true, + .dclk_min_div = 1, .set_mux = sun6i_tcon_set_mux, }; @@ -1447,11 +1450,13 @@ static const struct sun4i_tcon_quirks sun6i_a31s_quirks = { .has_channel_0 = true, .has_channel_1 = true, .needs_de_be_mux = true, + .dclk_min_div = 1, }; static const struct sun4i_tcon_quirks sun7i_a20_quirks = { .has_channel_0 = true, .has_channel_1 = true, + .dclk_min_div = 4, /* Same display pipeline structure as A10 */ .set_mux = sun4i_a10_tcon_set_mux, }; @@ -1459,11 +1464,13 @@ static const struct sun4i_tcon_quirks sun7i_a20_quirks = { static const struct sun4i_tcon_quirks sun8i_a33_quirks = { .has_channel_0 = true, .has_lvds_alt = true, + .dclk_min_div = 1, }; static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = { .supports_lvds = true, .has_channel_0 = true, + .dclk_min_div = 1, }; static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { @@ -1477,11 +1484,13 @@ static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { .has_channel_0 = true, + .dclk_min_div = 1, }; static const struct sun4i_tcon_quirks sun9i_a80_tcon_lcd_quirks = { - .has_channel_0 = true, - .needs_edp_reset = true, + .has_channel_0 = true, + .needs_edp_reset = true, + .dclk_min_div = 1, }; static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = { diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index f9f1fe80b206..a62ec826ae71 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -224,6 +224,7 @@ struct sun4i_tcon_quirks { bool needs_de_be_mux; /* sun6i needs mux to select backend */ bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */ bool supports_lvds; /* Does the TCON support an LVDS output? */ + u8 dclk_min_div; /* minimum divider for TCON0 DCLK */ /* callback to handle tcon muxing options */ int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *); -- 2.24.1