Received: by 10.223.176.46 with SMTP id f43csp2266686wra; Thu, 25 Jan 2018 07:22:43 -0800 (PST) X-Google-Smtp-Source: AH8x225jmdZCGcG7LJcgOXHyfIk5CbegLnnZf4Obu7jrv8hhunJZG2y2uy0RWzeJDhR58kXobKSR X-Received: by 10.101.80.69 with SMTP id k5mr2494633pgo.439.1516893763798; Thu, 25 Jan 2018 07:22:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516893763; cv=none; d=google.com; s=arc-20160816; b=yHIu6V0cPkDo1s+qE5M24c00eoGQ8XEv5mya53oiUY3fHJks1WqAx3BfpxrX83clae rE0rpIOakp0TD8sGqkWFjGAiGVQawOjIBUR6abZcHTVZop5ma2Y6wxJiHIpNMoJFkuIC dLo3K358tZcWXh5P2tjwxN4QiX8XDPXLaiRx/Ge8ofDqmFUESh9pjlAdulRfAWLW37Uw MRwnrMKninHI6MR4S/jjPxXFvCmAwqGvoTgnF3mOY6zuxTdHrZ9dMFwgKo/5ssNomf+C wtpqKfbzwduxhPBJl6UBi0ZtiIzRx84sM0LYM1CMa92P0tA9y6P1n/mR3EBf/nNwfMJn 8mog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mPSUUsgay2dFeOPJs5CF5IGmhc7EMuYjgnckQKqbzDU=; b=m7GQuDdomrsSrh7cDKODJ0lL33znLRni3dxmW207CD3QeD/2mc6+vx7GOIojDq7Vp/ hK+XwZTBK0qO+614ievAJAGy2zo/bk9ugPy6KK/h9vzCWrZyi69J58pocRefJHN443c+ YyZpEnbpSxueW3Dt3UWg8hDxYJbkTq/qkBo87VAFIb6qbpmXNXDQ94/HcS9OE/q6fT18 fR0lh5ZILDEEB36+UoD6EeC1AX3fQmZIpBQ1gENZqXscEmBaHXzR/7MypwQjFsfyZCh1 IWsH5DP0hE0f0VWpcDnYZrsp273iw0tICqxf41zI1r0+WUt4rm6ci0/2bADcd0mHXMzM bxhA== ARC-Authentication-Results: i=1; mx.google.com; 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 u16si4715675pfl.262.2018.01.25.07.22.29; Thu, 25 Jan 2018 07:22:43 -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; 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 S1751565AbeAYPVV (ORCPT + 99 others); Thu, 25 Jan 2018 10:21:21 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:46495 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751537AbeAYPVT (ORCPT ); Thu, 25 Jan 2018 10:21:19 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 4E4E92075F; Thu, 25 Jan 2018 16:21:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 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 15CC820379; Thu, 25 Jan 2018 16:21:18 +0100 (CET) Date: Thu, 25 Jan 2018 16:21:17 +0100 From: Maxime Ripard To: Giulio Benetti Cc: airlied@linux.ie, wens@csie.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] drm/sun4i: Handle DRM_MODE_FLAG_**SYNC_POSITIVE correctly Message-ID: <20180125152117.qikemrwl7f35ssjg@flea.lan> References: <1516474221-114596-1-git-send-email-giulio.benetti@micronovasrl.com> <1516474221-114596-2-git-send-email-giulio.benetti@micronovasrl.com> <20180122085112.7xo2t3x5ag4k2kpl@flea.lan> <59f7b542-3b1d-ff62-e290-37c47f4075ff@micronovasrl.com> <9929d894-53c3-a7e9-a328-a00cfc1ef546@micronovasrl.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pr3kpx4pxlae3qti" Content-Disposition: inline In-Reply-To: <9929d894-53c3-a7e9-a328-a00cfc1ef546@micronovasrl.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --pr3kpx4pxlae3qti Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Wed, Jan 24, 2018 at 08:37:28PM +0100, Giulio Benetti wrote: > Hi, >=20 > Il 24/01/2018 18:38, Giulio Benetti ha scritto: > > Hi, > >=20 > > Il 22/01/2018 21:27, Giulio Benetti ha scritto: > > > Hi, > > >=20 > > > Il 22/01/2018 09:51, Maxime Ripard ha scritto: > > > > On Sat, Jan 20, 2018 at 07:50:21PM +0100, Giulio Benetti wrote: > > > > > On previous handling, if specified DRM_MODE_FLAG_N*SYNC, > > > > > it was ignored, > > > > > because only PHSYNC and PVSYNC were taken into account. > > > > > DRM_MODE_FLAG_P*SYNC and DRM_MODE_FLAG_N*SYNC are not exclusive. > > > > >=20 > > > > > If flags contains PVSYNC, it doesn't mean it is NVSYNC. > > > > > And it's true also the contrary. > > > > > Also, as I've checked with scope on A20, > > > > > if (flags & PVSYNC) then SUN4I_TCON0_IO_POL_VSYNC_POSITIVE > > > > > must be set, as name suggests. > > > > > It seems all display io polarities starts inverted if 0. > > > > >=20 > > > > > Signed-off-by: Giulio Benetti > > > > >=20 > > > > > PVSYNC and PHSYNC only > > > > >=20 > > > > > Signed-off-by: Giulio Benetti > > > >=20 > > > > Checkpatch: > > > > WARNING: Duplicate signature > > >=20 > > > Sorry I didn't use ./scripts/checkpatch.pl > > >=20 > > > >=20 > > > > > --- > > > > > =A0 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++-- > > > > > =A0 1 file changed, 2 insertions(+), 2 deletions(-) > > > > >=20 > > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > > b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > > index 6121210..e873a37 100644 > > > > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > > > > @@ -224,10 +224,10 @@ static void > > > > > sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, > > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 SUN4I_TCON0_BASIC3_H_S= YNC(hsync)); > > > > > =A0=A0=A0=A0=A0 /* Setup the polarity of the various signals */ > > > > > -=A0=A0=A0 if (!(mode->flags & DRM_MODE_FLAG_PHSYNC)) > > > > > +=A0=A0=A0 if (mode->flags & DRM_MODE_FLAG_PHSYNC) > > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0 val |=3D SUN4I_TCON0_IO_POL_HSYNC_POS= ITIVE; > > > > > -=A0=A0=A0 if (!(mode->flags & DRM_MODE_FLAG_PVSYNC)) > > > > > +=A0=A0=A0 if (mode->flags & DRM_MODE_FLAG_PVSYNC) > > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0 val |=3D SUN4I_TCON0_IO_POL_VSYNC_POS= ITIVE; > > > >=20 > > > > I'm not sure why you were talking of the differences between NVSYNC > > > > and PVSYNC if you're not making use of any of it here? > > >=20 > > > Thinking about it more now, the point is that all Lcd IOs seem to be > > > inverted by default(at least on A20). > > > With inverted, I mean that if for example PVSYNC, > > > I should see vsync line low and when asserted to give VSync, > > > it goes high. > > > This is what I've checked with oscilloscope on A20. > > > Can someone give a try on A33? Otherwise I will, > > > but I will take some time. > > > On uboot, everything is treated equal to kernel, > > > but to have my falling edge dclk and low h/vsync I had to specify: > > > CONFIG_VIDEO_LCD_DCLK_PHASE=3D0 (giving me falling edge on dclk) > > > and > > > CONFIG_VIDEO_LCD_MODE=3D"....,sync:3,..." > > > but digging into code, I see "sync:3" means H/VSYNC HIGH, > > > but I experience both LOW during their pulse. > > >=20 > > > >=20 > > > > Also, how was it tested? This seems quite weird that we haven't cau= ght > > > > that one sooner, and I'm a bit worried about the possible regressio= ns > > > > here. > > >=20 > > > It sounds really strange to me too, > > > because everybody under uboot use "sync:3"(HIGH). > > > I will retry to measure, > > > unfortunately at home I don't have a scope, > > > but I think I'm going to have one soon, because of this. :) > >=20 > > Here I am with scope captures and tcon0 registers dump: > > tcon0_regs =3D> https://pasteboard.co/H4r8Zcs.png > > dclk_d0 =3D> https://pasteboard.co/H4r8QRe.png > > dclk_de =3D> https://pasteboard.co/H4r8zh4R.png > > dclk_vsnc =3D> https://pasteboard.co/H4r8Hye.png > >=20 > > As you can see circled in reg on registers, > > TCON0_IO_POL_REG =3D 0x00000000. > > But on all the waveforms you can see: > > - dclk_d0: clock phase is 0, but it starts with falling edge, otherwise > > the rising front overlaps dclk rising edge(not good), so to me this is > > falling, then I mean it Negative. > > - dclk_de: de pulse is clearly negative, even if register is 0 and its' > > polarity bit is 0. > > - dclk_vsnc: same as dclk_de > > - dclk_hsync: I didn't take scope screenshot but I can assure you it's > > negative. > >=20 > > You can also check all the other registers about TCON0. > >=20 > > Now I proceed testing it on A33, maybe the peripheral is slightly > > different between Axx SoCs, if I find it that way, > > it should be only a check about SoC or peripheral ID, > > and treat polarity as it should be done. >=20 > Here I am with A33 waveforms: > tcon0_regs =3D> https://pasteboard.co/H4rXfN0M.png > dclk_d0 =3D> https://pasteboard.co/H4rVXwy.png > dclk_de =3D> https://pasteboard.co/H4rWDt8.png > dclk_vsnc =3D> https://pasteboard.co/H4rWRACu.png > dclk_hsync =3D> https://pasteboard.co/H4rWK6I.png Thanks, that's really helpful. > It behaves the same way as A20, so as I mean IO polarity, > all signals(except D0-D23), are inverted. > For A33 I've used A33-OLinuXino. > For A20 our LiNova1. Indeed, HSYNC and VSYNC look inverted. I don't really know what the polarity of D0 would be just by judging at that capture, but we would have noticed if the colors were inverted for quite some time now. DE seems to be active high though, since it's only going to be at a logical low level when data are not transmitted, so during the blank periods. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --pr3kpx4pxlae3qti Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlpp9ewACgkQ0rTAlCFN r3Qp2w//bBtLuXWtRVUoVeL9Etpqk7L7kNep2jTry/JBpbKTaOC33hMkItd8hX1V VraW8zUJ9HhjvAFXZkJqxjpDI1vkhPMfxNznAWH192SbP/upoGkWaElC7pbLsdyS 1CKrr2bCK6xRG85kMHfYC1u02hahIgs4J0obrOyen678ybLh0OvBpQx98A4Wde/j M4G1ARPKMZ34OdcL9e9lKOtqniJxLNm9HJnLKJkzcF4NnQ199+ITj9JxaIbZ0fr4 G+TZ4zwnBb4jBNecm7dY/H7SBH2zkJxRPSyqxETmgOqqLrgrtQc4/YIshg8eUgRG ttqzxZdJgHrflRIQE1WX2auP4wGireynO5XEIAryiRrEUVD3gMHnQFFMNUgJCuAg baOdas0vHvDsxpOrIjhIWclSeNQXOqCLTQ1F59+H2LcUbR+wDhZKg2Zkd9i5KsAd jAzQM8xr3eEllfKSAER0ELlTDeueC8Ibj2KSWug4AtmNCJx1QjaQOVWdS8csArWZ XYBuWZvcrdt0jJWwLQRNns1wB7DmTdSMsCNG3Qgmwz3+ztaNYKjibJ6/ikyjK7sW 8/Lu9lVSEI5LTy+GjgeW6rxJ5eqRikUo/7fbqdwdzkhukEogAjhcXtdlPhEJNziW sC8gEL4/mpocbEklhMJcTpVB6abyOq0ODqnDvF9TytLgFZsvW08= =Ti0o -----END PGP SIGNATURE----- --pr3kpx4pxlae3qti--