Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5023772ybl; Tue, 14 Jan 2020 02:09:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwHiiU0KUHpjKsJ7D6USRg9jAmABO/DV9v12waYJ0ZmlBVBwDK7tAjtIdNmdmncfVl7fJIo X-Received: by 2002:a9d:65cb:: with SMTP id z11mr15331623oth.348.1578996573459; Tue, 14 Jan 2020 02:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578996573; cv=none; d=google.com; s=arc-20160816; b=xiVszVXmlRdazjEfQC99DGnl/ipHvhrrLo+NiWlNjBIcf5ZyWvpnnmJHpeSulHDFh1 JDaN7np/f6avDZ4UCZQLPfc/n74EROsICTrSwHA0CsvN6NvLN5oObjfrncM4abaZSPaX tjJlfW1t+9m2FEEoymfrMp2qaYsaUEhWjws42R3bi4fjluXAZSbfKSjORpSKmhdIQoLA zffBRBd+iu8eH99b+yA3kTvlXZjvz6bFFBRAEa4OhKzEW/B8obZPQao39/rTzHi9yPHZ VdFiwH5Baumw99KmnoSfdOcTB3XVl81SKQs0hHk35X0IeZfhXJNE3q+qn0kjC6Fn5twD Ck1Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7z3DJOF00W30X4DIvNyFC9s36ZEZZlZj1MU6Vx1gTnw=; b=pWoqolO3y1BaxloEckcdL//qt8LOtD0bmUmVI3qrEMYfWqilTfngnr6KKmABuTD+iK Mc8HGycyry0nP+KfFU42725cmgnGwpJjpPHSDXtisK6YtuolrC06rE0otZDZnvhQ6OMH N+t+7jmwXcXU1E8Q5JAWsXQ/ILH+Fiq8k33VL76MRO0CHRogecHZgHNBUk3Uiv6vMMV2 YozKN9krgP8/MH2SGmXCIdw5zq5mf1JrqIyq0akmyNFsVqGpuJwsxtk3z9xNMBJteC6l 6eOR8RwxkHdKkjbAJRqs3296lnsix4tabT+fFFGAFFeGHeZNawXqIy7xUDEzkeOdHnwU /NrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wlgWeyIT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si8381830otp.284.2020.01.14.02.09.22; Tue, 14 Jan 2020 02:09:33 -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=wlgWeyIT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729863AbgANKHV (ORCPT + 99 others); Tue, 14 Jan 2020 05:07:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:37274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730651AbgANKHQ (ORCPT ); Tue, 14 Jan 2020 05:07:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 30EF024687; Tue, 14 Jan 2020 10:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996434; bh=rE7QBSma/p8DVJlJA35iUxJ1Y9UvZCnyIuSvTLJfYBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wlgWeyITZoQm4ki8DMmIeBGg51e3xZeswLUvjKwrXIa9gsJsVPpsy9iO4z4RIAN1+ teN0JOijkahAOx9M0xMQr6bdWooIhnMKYtoIdcm4HP29ziXgSM+sprJg4NHIRKZZW9 vJ0ZYpuxaiNHQ63QR3GKUJEpuct2CP0V2fiw4/qI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard Subject: [PATCH 4.19 16/46] drm/sun4i: tcon: Set RGB DCLK min. divider based on hardware model Date: Tue, 14 Jan 2020 11:01:33 +0100 Message-Id: <20200114094343.835349007@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094339.608068818@linuxfoundation.org> References: <20200114094339.608068818@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 commit 4396393fb96449c56423fb4b351f76e45a6bcaf6 upstream. 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 Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20200107070113.28951-1-wens@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 15 ++++++++++++--- drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -423,7 +423,7 @@ static void sun4i_tcon0_mode_set_rgb(str 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); @@ -1249,12 +1249,14 @@ static int sun6i_tcon_set_mux(struct sun 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, }; @@ -1263,6 +1265,7 @@ static const struct sun4i_tcon_quirks su .has_channel_1 = true, .has_lvds_alt = true, .needs_de_be_mux = true, + .dclk_min_div = 1, .set_mux = sun6i_tcon_set_mux, }; @@ -1270,11 +1273,13 @@ static const struct sun4i_tcon_quirks su .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, }; @@ -1282,11 +1287,13 @@ static const struct sun4i_tcon_quirks su 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 = { @@ -1295,11 +1302,13 @@ static const struct sun4i_tcon_quirks su 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 = { --- 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 *);