Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp374913pxb; Tue, 9 Feb 2021 02:39:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+d/xs4T9i2NxaroJ4sJIRKk7tMbVv5fLrx4d4IfD6IPJH/0DipHHRBPpPftaBX5qsmffN X-Received: by 2002:aa7:cd62:: with SMTP id ca2mr1108181edb.94.1612867176418; Tue, 09 Feb 2021 02:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612867176; cv=none; d=google.com; s=arc-20160816; b=bDlds6skKcGnyFiDx6vMnfDWRBuaviuzVZg82LFCX3oB69C5xNMQ+OPYbF7OTD8Uof 7QRBs2C3lHU1arjttMHxH45n3+H3GhI18OktJm1Xvzk/ryZCoZmnYVXTrtFngpld98v3 TMev3rqy0z81EIWs0X+PXwV1QPvFD8aLD2lZU9/uA1+3J3J6f/BiMZoPCOrLIdFgIfCG qhMKvu2WErN9NslcTmla+KnygaqSLz8kC8oKUUn2c7sKrPneUZQVpjKjRVEeUk6T0Bx2 eJAB1HDv+aAbhTgYo+2F3xO1oZz2AxftYcYi/5RbxtNXbjIIi3zSDKDH29kKUcV/OjEB cz6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Jt1fO61HE02mor/p4/e0vvQVzypUYMVpukrxRr4pIl0=; b=O8InsMvkjEE7zR0rT1kYj98b/smJDpd5hGNzPTwf491VXS6bQ+mRhbjffowLN16oKJ 9vRJTs0UIAQ67YLVyAispdlJXZpCO5cg8t8+/vyUo62kPs369DECRA8nw08TQYaI0gv4 u8CBDBGuYrlB5taKDB2Um4PR+3eiqYwifYUx59HeKqMG09DWb94DNE51ZyxFruFioqy9 EMc8Wzpc7RW7B+pBRLF3sgwnEKvmckGkaoJHsvOhKInnZdh2VqghPWQVMO6etYC7m5Ku vM/tet+yzXue+0F0CCTu0eEPFwI0FbuVqxfpM2su6w1t1r/YX99BcvC7EDIV+VdfZzaj UNXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=gy8fEdwm; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=nIf3OoCE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si14594608edz.34.2021.02.09.02.39.13; Tue, 09 Feb 2021 02:39:36 -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; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=gy8fEdwm; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=nIf3OoCE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbhBIKgX (ORCPT + 99 others); Tue, 9 Feb 2021 05:36:23 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:32801 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbhBIKdV (ORCPT ); Tue, 9 Feb 2021 05:33:21 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A893558018B; Tue, 9 Feb 2021 05:32:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 09 Feb 2021 05:32:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=Jt1fO61HE02mor/p4/e0vvQVzyp UYMVpukrxRr4pIl0=; b=gy8fEdwmYdkeQ8fotFSQU0/tDyfUqgMq2SUYoNaDlpb rUJikXAa4pKn4hMdRrJmJAuJ+ujlOORjbAz5VLGwL3OH9xErQquWjsotKMrp/aoA fIUjkF5x8cEzBDPL6Xk2+e+BIFW+J3nadR13oLak15wDh5XJre9kgh1kxc4OEXqb RHaWXPY4gHL1tKb+mvV6jCmr2miXegc5pOBQdryZDZ+S2fET+NT2f2XYYwyQaEV1 tTeJ//9RFCXthIoXil/W6obfRqFYODEjnv4ywaEtH1l9H7I/T3XSeCvS93GEkL1A MKMpJePR8b58FXSqALe5orCQItF/nx/lJPGhkrNypqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Jt1fO6 1HE02mor/p4/e0vvQVzypUYMVpukrxRr4pIl0=; b=nIf3OoCE1HypM0jgX2mMyK 4d+rnAtKa3pDVr7BeGt1EHBk197gCDnXnXO5EUUHkBrsVqjv/C072X3C0pVbXpY6 T9lpK7lZNyZMBTRHuVoaPUl6zWcb6PsJVophqUDkv9zdcVJKra1UX77bnHX55GG2 F1HQpy6hcgnJJUBhf8yM5L/k17rhWQ81/WMSPosD9b6yZIp6ZPXW73AsNf7odUjA cJQVQr++fjfMFZ6Fgq2N+pFLePGD94t5WwSiDo3CkpRfqGWqKUCX72L2E2umIZeD 4EBA6C1zAMopyJKHl5AC67Hu9TLk+7hmKGJzL2iaj9g174O3pLs9zYZI133i3wEw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrheehgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpeeutdfgjeeuudehvefgvedvtedtudelfffgffekledtffekgedukeejueevieeg udenucfkphepledtrdekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 4AF51108006A; Tue, 9 Feb 2021 05:32:00 -0500 (EST) Date: Tue, 9 Feb 2021 11:31:58 +0100 From: Maxime Ripard To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: Chen-Yu Tsai , Mike Turquette , Stephen Boyd , David Airlie , Daniel Vetter , linux-clk , linux-arm-kernel , linux-kernel , dri-devel , linux-sunxi , Andre Heider Subject: Re: [PATCH 2/5] drm/sun4i: tcon: set sync polarity for tcon1 channel Message-ID: <20210209103158.rnzvlvo44nnzrmk4@gilmour> References: <20210204184710.1880895-1-jernej.skrabec@siol.net> <2156838.FvJGUiYDvf@kista> <3972834.uPFdDeCNB3@kista> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lvwjttyd23hbxwrd" Content-Disposition: inline In-Reply-To: <3972834.uPFdDeCNB3@kista> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lvwjttyd23hbxwrd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 05, 2021 at 07:47:17PM +0100, Jernej =C5=A0krabec wrote: > Dne petek, 05. februar 2021 ob 17:28:23 CET je Chen-Yu Tsai napisal(a): > > On Sat, Feb 6, 2021 at 12:21 AM Jernej =C5=A0krabec =20 > 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=20 > > > > wrote: > > > > > > > > > > > > Channel 1 has polarity bits for vsync and hsync signals but dri= ver=20 > never > > > > > > sets them. It turns out that with pre-HDMI2 controllers seeming= ly=20 > there > > > > > > is no issue if polarity is not set. However, with HDMI2 control= lers > > > > > > (H6) there often comes to de-synchronization due to phase shift= =2E=20 > This > > > > > > causes flickering screen. It's safe to assume that similar issu= es=20 > might > > > > > > happen also with pre-HDMI2 controllers. > > > > > > > > > > > > Solve issue with setting vsync and hsync polarity. Note that di= splay > > > > > > stacks with tcon top have polarity bits actually in tcon0 polar= ity > > > > > > register. > > > > > > > > > > > > Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine=20 > 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/d= rm/ > 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=20 > 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 =3D 0; > > > > > > + > > > > > > + if (mode->flags & DRM_MODE_FLAG_PHSYNC) > > > > > > + val |=3D SUN4I_TCON0_IO_POL_HSYNC_POSIT= IVE; > > > > > > + > > > > > > + if (mode->flags & DRM_MODE_FLAG_PVSYNC) > > > > > > + val |=3D SUN4I_TCON0_IO_POL_VSYNC_POSIT= IVE; > > > > > > + > > > > > > + regmap_write(tcon->regs, SUN4I_TCON0_IO_POL_REG= ,=20 > val); > > > > > > + } else { > > > > > > + val =3D 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 hsyn= c and > > > vsync. It could be either or none of those. > > > > > > What should I write in comment? BSP drivers and documentation use onl= y=20 > generic > > > names like io2_inv. > >=20 > > Just say that we don't know exactly what it is, but it is required for= =20 > 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. >=20 > Nothing seems to happen - tested on H3 with HDMI (4k@30) and CVBS. At lea= st I=20 > didn't notice anything. That's pretty normal, an inverted pixel clock would at worst give you some weird artifacts and / or pixels being of the wrong color. Data enable on the other hand would very likely stall the HDMI controller since you would have only the blanking periods that would be considered valid. Maxime --lvwjttyd23hbxwrd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYCJkngAKCRDj7w1vZxhR xedJAQCvyb+V3yoXMwG3DqhG21kI9ivkqbheculNc5PYOa79ZQD/cKZtr++3tXXL b0t+vjHAf3eohmy56y3F2ZBXFWYzhg8= =MfCa -----END PGP SIGNATURE----- --lvwjttyd23hbxwrd--