Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2312396pxb; Fri, 5 Feb 2021 14:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhgi+KP+TEkjdZWQmkBtCKi+sWn7g4V92uXmtZzZGEqd7KCBC1FTCySyJPi7mZwWuLOTw6 X-Received: by 2002:a05:6402:5252:: with SMTP id t18mr5648511edd.49.1612565090099; Fri, 05 Feb 2021 14:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612565090; cv=none; d=google.com; s=arc-20160816; b=vpZYZi/Jdx04+dQU8BMKYY5AU2pCVyW0HgFmAUKJAKju/UdNR7HK5IdSLrlkLhBFUG xSZSqS+mZ0mCvFXOrfAR4ATXATzYVyWPvFPQvZmflOF8P8linmgVwvzUcrOD2c7ToakF goNBBHqtdF4WlWVfMUNx/qqVlp5R/tBayvVxEHtVIiETdKaLqmc05nOXcmUhM7t/Ato5 EYR9viCmbHImDQJ23rb2rC2TnhYDn4wR03hVRBp9mM9QH/epwIFkPipKIn+lTvWiEJEo ydBMNGh5if1S+26/JgL+4vF1qQ3aMhLH1cX/jm+cGg1T991c21pBwBTi4gHikrrZgHPZ Rv/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=uY6queACyie7U/UkG7oBg/UTBNyGT9lmAjeZXbnkCls=; b=TW4ncPi8JcSzQDGoIsEmMa9DyMDOHDbNERIKFTlAMBVF8j+ZEN2+55QIou4ekwSy+o XTccjS4RvcY3jkGeN6fwodXxNxWyngg/t745Z/ZwJh2SrkX5+xYooAysRYoW6mf1MX/2 qHKNHGZ+zHvC0oCH1s2I8QGSyHMz7aTct+l4Mu4/a8hzAMbkiBOMA2x+/PSv5DN5Um83 WJmA3bYR/oSC0iwpxn27HPXIH0RngOXn1ViZxSquimVYdmIEsIOnN/TS1xfWBEgA7e0D qglWGEP2CpUsZxpLftv1pzKl/KQas9pxxCQVVkVUdSU1EzYjG1wZmDjHwL8ux/jgN/tI dVdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si5865444ejj.130.2021.02.05.14.44.26; Fri, 05 Feb 2021 14:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbhBEWli convert rfc822-to-8bit (ORCPT + 99 others); Fri, 5 Feb 2021 17:41:38 -0500 Received: from mail-lj1-f175.google.com ([209.85.208.175]:34799 "EHLO mail-lj1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbhBEOwN (ORCPT ); Fri, 5 Feb 2021 09:52:13 -0500 Received: by mail-lj1-f175.google.com with SMTP id r23so6554074ljh.1; Fri, 05 Feb 2021 08:29:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=A18d3pB/vKIfoZwd9hT2XkXbAHUUomY9AFW5el5Iv+w=; b=COccijSbZV49z6LlD6DtI7x5lPS78Okeiq6mgyvDdfVfsRgwyzdnNLsG0hzQTwA0Tu LO9iQRNXky7Hs3QysaXq0SteYMCMkC5TcQX64q0wElpnSgKeZBIDePcrJnqd41GOXFQ4 +Xk/iz3Pf0kyUyVIe01nMuuwfmQya1p/H4+TCc1cXdaj0GDpCOQMSsK11B9a7FJFX3Dt 4KdQuGcPPqNhmDb4HW7Rs5nWzV0NTH3b6T8EKtMlDGmgVtrm8rUl2m0n7r9r6OaFL+Ho D2Nct1UuT++NiI5uc8ieRHZD/uQjG9DTDCwwFEH6/yHylLlPrfULRswa/jkkCP9EICta kkJw== X-Gm-Message-State: AOAM5314JMAIuqVKIne7esYtpwr8mldGBoH4H/cwPngGNbAXmo+VTNYf kP3GfZ1KlJ6WnBp73HjA5A8Kx0tJPckm5Q== X-Received: by 2002:a2e:3317:: with SMTP id d23mr3247853ljc.199.1612542515444; Fri, 05 Feb 2021 08:28:35 -0800 (PST) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id o8sm1036010lft.213.2021.02.05.08.28.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 08:28:35 -0800 (PST) Received: by mail-lj1-f179.google.com with SMTP id a25so8497193ljn.0; Fri, 05 Feb 2021 08:28:34 -0800 (PST) X-Received: by 2002:a2e:9d04:: with SMTP id t4mr3147625lji.56.1612542514337; Fri, 05 Feb 2021 08:28:34 -0800 (PST) MIME-Version: 1.0 References: <20210204184710.1880895-1-jernej.skrabec@siol.net> <20210205160130.ccp7jfcaa5hgyekb@gilmour> <2156838.FvJGUiYDvf@kista> In-Reply-To: <2156838.FvJGUiYDvf@kista> From: Chen-Yu Tsai Date: Sat, 6 Feb 2021 00:28:23 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Re: [PATCH 2/5] drm/sun4i: tcon: set sync polarity for tcon1 channel To: =?UTF-8?Q?Jernej_=C5=A0krabec?= Cc: Maxime Ripard , Mike Turquette , Stephen Boyd , David Airlie , Daniel Vetter , linux-clk , linux-arm-kernel , linux-kernel , dri-devel , linux-sunxi , Andre Heider Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 6, 2021 at 12:21 AM Jernej Škrabec wrote: > > Dne petek, 05. februar 2021 ob 17:01:30 CET je Maxime Ripard napisal(a): > > On Fri, Feb 05, 2021 at 11:21:22AM +0800, Chen-Yu Tsai wrote: > > > On Fri, Feb 5, 2021 at 2:48 AM Jernej Skrabec > wrote: > > > > > > > > Channel 1 has polarity bits for vsync and hsync signals but driver never > > > > sets them. It turns out that with pre-HDMI2 controllers seemingly there > > > > is no issue if polarity is not set. However, with HDMI2 controllers > > > > (H6) there often comes to de-synchronization due to phase shift. This > > > > causes flickering screen. It's safe to assume that similar issues might > > > > happen also with pre-HDMI2 controllers. > > > > > > > > Solve issue with setting vsync and hsync polarity. Note that display > > > > stacks with tcon top have polarity bits actually in tcon0 polarity > > > > register. > > > > > > > > Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") > > > > Tested-by: Andre Heider > > > > Signed-off-by: Jernej Skrabec > > > > --- > > > > drivers/gpu/drm/sun4i/sun4i_tcon.c | 24 ++++++++++++++++++++++++ > > > > drivers/gpu/drm/sun4i/sun4i_tcon.h | 5 +++++ > > > > 2 files changed, 29 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/ > sun4i_tcon.c > > > > index 6b9af4c08cd6..0d132dae58c0 100644 > > > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > @@ -672,6 +672,29 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon > *tcon, > > > > SUN4I_TCON1_BASIC5_V_SYNC(vsync) | > > > > SUN4I_TCON1_BASIC5_H_SYNC(hsync)); > > > > > > > > + /* Setup the polarity of sync signals */ > > > > + if (tcon->quirks->polarity_in_ch0) { > > > > + val = 0; > > > > + > > > > + if (mode->flags & DRM_MODE_FLAG_PHSYNC) > > > > + val |= SUN4I_TCON0_IO_POL_HSYNC_POSITIVE; > > > > + > > > > + if (mode->flags & DRM_MODE_FLAG_PVSYNC) > > > > + val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; > > > > + > > > > + regmap_write(tcon->regs, SUN4I_TCON0_IO_POL_REG, val); > > > > + } else { > > > > + val = SUN4I_TCON1_IO_POL_UNKNOWN; > > > > > > I think a comment for the origin of this is warranted. > > > > If it's anything like TCON0, it's the pixel clock polarity > > Hard to say, DW HDMI controller has "data enable" polarity along hsync and > vsync. It could be either or none of those. > > What should I write in comment? BSP drivers and documentation use only generic > names like io2_inv. Just say that we don't know exactly what it is, but it is required for things to work properly? Would be interesting to know what happens if you don't set this bit, but do set VSYNC/HSYNC polarity properly. ChenYu