Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp565648imm; Fri, 14 Sep 2018 02:58:16 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/w46tzNmxQQAYkaxWAqCp2BwVhN16QE9LbnSdXKDPy/6qkgz70vk8RL6qgnKeaiQE5QVQ X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr11675223plb.55.1536919096292; Fri, 14 Sep 2018 02:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536919096; cv=none; d=google.com; s=arc-20160816; b=jSsxGSg7d7+DwoV9DFV7yEFGYYw7QeKnZKJJW6n/B02JgMySQkZ//iLfNgDR8Jmc1x pdKUlNzAEoF35CSzWJJCuqesDYwelVbUOzhHzW4C66W4jrTnPWlyLmzvjmwMlH1tv5CZ pzvyzLTASZD/IMO/BiLEOSwpEYVrNm7WGxDKq37Eh+One5v/OnNeWCfmYYW3yVQ8Ntgz bay3Rd29bjTpOXmgAqO80LuYLVWWs+Z04kXA6YURxG2w38MSEBCH1UoSG9AwpLGuEXRT 2YJ0+AlC9yY9zzrFvfjStd4zMKDQGYAn2V4LrmCPh/w1trHxlHfPYG9uTxEPBD368AUY JbmA== 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 :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=4pn2HrQCloS1dyvqA1NOe3o0K7F8MfP7/RDhlhwBfFQ=; b=YdMcJhD32H+kBc5EvphqCU9kG3b6fMRcRSfj7oMyPmOYrfVJennjyjLEexMVG5Y1iU loXbyZE42ZXLVG6pCxnwiuUKlvJOq01eeo6EHw9e5BOArCOtwOqktZgrMMamWeToGYjT EGE/O5L/XyY10M5atc20Nc1mW8ty6EnQForiHZLYrVB4ZBLMuEU7+mYn9Ntr86g3sG49 J9bvSLeaP4VkkAwEprcE24Zzd7JpBk60hKEyMy6SxJ1jS/HGCeHIS7xua6dK+vBGzSau EIaAca9f77yekTd5j61cSsxzZKaG2PifzspsnCnNzs8P/eUGVXcZ0YbT1AnGseHf1UqB kXVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=ipAnRTmK; 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 h3-v6si6741193pgc.122.2018.09.14.02.58.00; Fri, 14 Sep 2018 02:58:16 -0700 (PDT) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=ipAnRTmK; 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 S1728100AbeINPLT (ORCPT + 99 others); Fri, 14 Sep 2018 11:11:19 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:33082 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbeINPLT (ORCPT ); Fri, 14 Sep 2018 11:11:19 -0400 Received: from avalon.localnet (unknown [IPv6:2a02:a03f:44f6:3500:d929:375b:d608:66c7]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 302D0CE; Fri, 14 Sep 2018 11:57:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1536919051; bh=GE9SI6+56XDaRMPGUGwASxINiCDmuL1FVpWvUwqbgJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipAnRTmKXYLl0d407TzF8BxI/XjP5j2cGs3soWm33+cbaknNjXLvufggGXTcxWM7W B9d7+DN2qW2mOsLNtmuwbF3wul2XfZzwtRuiRJJWj2UvPb5Wfl8ySwKC+gn5N5xBGF TDpKS4tcw/TByYKLwoQWzRVNbPjwvZXaGFnSSIPc= From: Laurent Pinchart To: Stefan Agner Cc: Linus Walleij , Dave Airlie , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Philipp Zabel , Sascha Hauer , Fabio Estevam , NXP Linux Team , Archit Taneja , Andrzej Hajda , Gustavo Padovan , Maarten Lankhorst , sean@poorly.run, Marcel Ziswiler , max.krummenacher@toradex.com, "open list:DRM PANEL DRIVERS" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] drm/bridge: use bus flags in bridge timings Date: Fri, 14 Sep 2018 12:57:45 +0300 Message-ID: <4320623.81Q3F1DtM1@avalon> Organization: Ideas on Board Oy In-Reply-To: <2015108.bT6A7b8iLH@avalon> References: <20180905052113.21262-1-stefan@agner.ch> <2015108.bT6A7b8iLH@avalon> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, 14 September 2018 12:49:40 EEST Laurent Pinchart wrote: > Hi Stefan, > > On Thursday, 6 September 2018 23:25:56 EEST Stefan Agner wrote: > > On 06.09.2018 04:07, Linus Walleij wrote: > > > On Wed, Sep 5, 2018 at 8:32 PM Stefan Agner wrote: > > >> On 05.09.2018 00:44, Laurent Pinchart wrote: > > >> > > >> Good point! I actually really don't like that we use the same flags > > >> here > > >> but from a different perspective. Especially since the flags defines > > >> document things differently: > > >> > > >> /* drive data on pos. edge */ > > >> #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) > > >> /* drive data on neg. edge */ > > >> #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) > > > > > > Maybe a stupid comment from my side, but can't we just change the > > > documentation to match the usecases? > > > > > > /* Trigger pixel data latch on positive edge */ > > > #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) > > > > > >> Using the opposite perspective would also need translation in crtc > > >> drivers... So far no driver uses sampling_edge. > > >> > > >> I would prefer if we always use the meaning as documented by the flags. > > >> > > >> I guess we would need to convert DRM_BUS_FLAG_PIXDATA_POSEDGE -> > > >> DRM_BUS_FLAG_PIXDATA_NEGEDGE. > > >> > > >> Linus Walleij, you added sampling edge, any thoughts? > > > > > > I just thought it was generally useful to have triggering edge encoded > > > into the bridge as it makes it clear that this edge is something > > > that is a delayed version of the driving edge which is subject to > > > clock skew caused by the speed of electrons in silicon and > > > copper and slew rate caused by parasitic capacitance. > > > > Ok, I read a bit up on the history of bridge timing, especially: > > https://www.spinics.net/lists/dri-devel/msg155618.html > > > > IMHO, this got overengineered. For displays we do not need all that > > setup/sample delay timing information, and much longer cables are in > > use. So why is all that needed for bridges? > > > > For Linus case, the THS8134(A/B) data sheet I found (revised March 2010) > > clearly states: > > Clock input. A rising edge on CLK latches RPr0-7, GY0-7, BPb0-7. > > > > So we need to drive on negative edge, hence DRM_BUS_FLAG_PIXDATA_NEGEDGE > > should be used, which makes the pl111 driver setting TIM2_IPC: > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0121d/index > > .h tml > > > > > DRM_BUS_FLAG_PIXDATA_POSEDGE is the right value for my use cases, but it > > > doesn't match how the ADV7123 operates. Using > > > DRM_BUS_FLAG_PIXDATA_NEGEDGE > > > would match the hardware, but would break display for some modes, > > > depending on the display clock frequency as the internal 8.5ns output > > > delay applied to a falling clock edge would fall right into the 1.7ns > > > setup + hold time window of the ADV7123 around the rising edge. I can't > > > test this right now as I don't have local access to boards using the > > > ADV7123, but from a quick calculation that ignores the PCB transmission > > > delay modes with frequencies between 57MHz and 71MHz could break if the > > > data was output on the falling edge of the clock. > > > > If clocks vs. data signal are really that much off on R-Car DU, then > > parallel displays must have the very same issue... > > > > Are you sure that only the clock signal has an output delay? And that > > this output delay is a fixed value, clock independent? > > > > Typically, delays apply to all signals equally, and often are clock > > frequency dependent... > > > > Without really looking at the signals, I would not jump to conclusions > > here! I am pretty sure that driving on negative edge works just as well. > > I've tested Linus' original patch and it broke display on R-Car, so, no, it > doesn't work :-) > > The R-Car display engine delays the clock internally (in some cases that > delay is even configurable, and that's not uncommon in display > controllers). We really need all this information, and I believe we need it > for panels too, not just for bridges. The fact that we managed to get away > without adding it to panels is likely due to the large number of panels out > there, which makes it less likely that the same panel gets used by > different systems in mainline with different clock delays. I expect that > some panel drivers report the wrong clock edge to make things work on the > board they were tested with, and I expect we'll eventually need to add the > same information for panels too. > > So please don't remove this useful API, otherwise you'll break my board, and > I won't be happy. Or, to be precise, the board won't break now, but as soon as I need to implement support for configuring the output clock edge, it will break as the ADV7123 driver won't give me the right information to make the right choice. -- Regards, Laurent Pinchart