Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10551452imu; Thu, 6 Dec 2018 03:06:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/X1vV+M7KFInPoKLTFA2Z/C1RiivSxod07CISgxpw7kvR3yTrvIsXhOuBlBoWfK1CMQPkjN X-Received: by 2002:a62:b2c3:: with SMTP id z64mr27786664pfl.120.1544094390617; Thu, 06 Dec 2018 03:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544094390; cv=none; d=google.com; s=arc-20160816; b=BWn+dWIY01xsp5GwPdw5tDmSSe5/u2H2I4Bv+60hdT3dBV7CaU4QPQY6SZ44yxZaF5 O/uZ/xeZnuRipqp9x+/LglqzXqhUrfFK2gLcUd0nwPTQeMJZtjEz/2xnnPmJUOxss1m5 CZQs9zbgdiIenBCSDarC2utR6rvX5IW5gxY3Apdbsb0w7Otp4Dln3LD4tZUIcHcHsCtZ jsBC3Kc3fxoS+63FIkQNe+qJYyYsbpqfiu6XdAJvPJxmIfmJ4blG+PFQo1UaS8sc0V6e qi8sV71mtcKOlyy7cuK4zpfbkZiyhXEq7LSNmtSfyfxSsAuJTTqmPJDcQTtfWT9eFb7K r1xg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dkim-signature; bh=NtQntKgi684892QVmv+szygBhOkT10bx98AuXLLrsJI=; b=vnB+xr7hImKQanbBMbSIahJvHLyv+mpdiFyY5ENKzQ5F5o64EA+5cutQ/pTeoQyna3 87yTEazWyu0fFbqLAytbsXE64AkfJ6+jsVnZp7oeSVQf97ww3Y5veXGq5/5vjU8Z8sQj 9IQaZT23k9I/bBW5d5bwwAopP325SvOAmP8blCwt22ypNRUEGYbzsWUMohkyLVXBgMCW kMMsaPimO7kyo7QjfksnguFEjEcuRZEOTyO2mgddmTPI3Zqi3CuwIb6ckKhw1QOM97RJ EZjswNnRO/K11mbwIy3ajOx1G6RlpWnnYJN6YCQmBYvcH1V0BrmiBSjGWR1wnHoiA/3Y mU3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=kMWyiNzO; 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 y191si54622pgd.4.2018.12.06.03.06.12; Thu, 06 Dec 2018 03:06:30 -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=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=kMWyiNzO; 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 S1729489AbeLFLF1 (ORCPT + 99 others); Thu, 6 Dec 2018 06:05:27 -0500 Received: from mail.micronovasrl.com ([212.103.203.10]:58412 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbeLFLF1 (ORCPT ); Thu, 6 Dec 2018 06:05:27 -0500 X-Greylist: delayed 308 seconds by postgrey-1.27 at vger.kernel.org; Thu, 06 Dec 2018 06:05:26 EST Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 9608AB015F2 for ; Thu, 6 Dec 2018 12:00:17 +0100 (CET) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:references:to:subject:subject:from:from; s=dkim; t= 1544094013; x=1544958014; bh=6UmA2urPp/XhmsO8K4zUHxGAh9AUsE1+RDP 890zGn78=; b=kMWyiNzOw85aP371Rj7Umj8RoeW9TNQmP65dUX9gZhLJbSpzTpE etMvH+qIugEvJV8H2nyws0aL2TdVY1yafNv82PNzHMkkj26dOM+40h6rdB/UyyMX OJhA+/am24Hqd5rj/AkMPj1+ayep2ARp6jXgqzuo2cGqii0xWJ4nFaTM= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QGchWfwSf7HX for ; Thu, 6 Dec 2018 12:00:13 +0100 (CET) Received: from [192.168.178.33] (host128-8-dynamic.21-79-r.retail.telecomitalia.it [79.21.8.128]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 0BF78B00117; Thu, 6 Dec 2018 12:00:12 +0100 (CET) From: Giulio Benetti Subject: Re: [PATCH] drm/sun4i: fix HSYNC and VSYNC polarity To: Jonathan Liu Cc: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel , dri-devel , linux-kernel References: <1518717288-123578-1-git-send-email-giulio.benetti@micronovasrl.com> Message-ID: <57d929cf-4458-dae4-36d4-4e89170eba4a@micronovasrl.com> Date: Thu, 6 Dec 2018 12:00:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, Il 06/12/2018 08:29, Jonathan Liu ha scritto: > Hi Giulio, > > On Thu, 15 Feb 2018 at 17:54, Giulio Benetti > wrote: >> >> Differently from other Lcd signals, HSYNC and VSYNC signals >> result inverted if their bits are cleared to 0. >> >> Invert their settings of IO_POL register. >> >> Signed-off-by: Giulio Benetti >> --- >> drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c >> index 3c15cf2..aaf911a 100644 >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c >> @@ -389,10 +389,10 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, >> SUN4I_TCON0_BASIC3_H_SYNC(hsync)); >> >> /* Setup the polarity of the various signals */ >> - if (!(mode->flags & DRM_MODE_FLAG_PHSYNC)) >> + if (mode->flags & DRM_MODE_FLAG_PHSYNC) >> val |= SUN4I_TCON0_IO_POL_HSYNC_POSITIVE; >> >> - if (!(mode->flags & DRM_MODE_FLAG_PVSYNC)) >> + if (mode->flags & DRM_MODE_FLAG_PVSYNC) >> val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; >> >> regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG, > > I am running Linux 4.19.6 and noticed with Olimex LCD-OLinuXino-7TS 7" > LCD touchscreen (Innolux AT070TN92) connected to Olimex > A20-OLinuXino-MICRO that the image does not display correctly after > this change. > The image is shifted to the right. > > Reverting the change results in the image being displayed correctly on > the screen. > > I have in the device tree a "panel" node with compatible = > "innolux,at070tn92" which uses the timings in > drivers/gpu/drm/panel/panel-simple.c. > > Any ideas? Checking Display Datasheet: https://www.olimex.com/Products/Retired/A13-LCD7-TS/resources/S700-AT070TN92.pdf Page 13 section 3.3.2 you can see it needs active low VS and HS. You can refer to this Thread and check scope captures about VS and HS versus TCON0_IOPOL register: https://lists.freedesktop.org/archives/dri-devel/2018-January/163874.html There should be something that wrongly sets one of these or both: mode->flags |= DRM_MODE_FLAG_PHSYNC; and/or mode->flags |= DRM_MODE_FLAG_PVSYNC; Checked in panel-simple.c but it's not there. At the moment I don't have a board to check it with me, I'll try to do it soon, but I'm full with other work at the moment. If you have the chance to debug you could try to find in which point mode->flags gets changed with those 2 flags. When the problem came out I've noticed the same thing for u-boot too but it's been decided to not patch it because in that case every single sunxi defconfig had to be changed from: CONFIG_VIDEO_LCD_MODE="...,sync:3,..." to: CONFIG_VIDEO_LCD_MODE="...,sync:0,..." and it would have been a great mess, probably not worth it: https://lists.denx.de/pipermail/u-boot/2018-February/321405.html So keep in mind that TCON driver works differently for HS and VS(inverted) polarity in u-boot and linux. Hope to work this out soon. Best regards -- Giulio Benetti CTO MICRONOVA SRL Sede: Via A. Niedda 3 - 35010 Vigonza (PD) Tel. 049/8931563 - Fax 049/8931346 Cod.Fiscale - P.IVA 02663420285 Capitale Sociale € 26.000 i.v. Iscritta al Reg. Imprese di Padova N. 02663420285 Numero R.E.A. 258642