Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3865423ybn; Fri, 27 Sep 2019 12:30:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbxd7mL6j11G4wTZEpn+Hhr0ixADDehHzaWB7t3ltmLpbgf9JHKMv0281Owjgp342x9a6M X-Received: by 2002:a17:906:4bc3:: with SMTP id x3mr9160025ejv.200.1569612601205; Fri, 27 Sep 2019 12:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569612601; cv=none; d=google.com; s=arc-20160816; b=kIMEtlmWKsw8MY0kAXgeK7eDMKgGDjdEvqCm0s/d95QUyWDIxuPhmrRMN7+O2k8CEg LoWxk/uAYnBZCWxvk+Flvqa9q8r2Ey72Cd6XvrCYgh1796uhTXUy/RgTLHC2xvFQLl7A yCX7/4InkBzyVGXZq6zWiuMiHqY/GVlioXu7SeFvhL+hsrEkYU1ZfENrme5MkrCP8aVK D6It74V6fdHTl8WxSbL3gcvhFVs+tiBEBXoczP3OVc7jtVavUMZcfIB9c4Fyk15p6nAj 29hOf+kqffuuf4A7OkJh0vrfPHXUrCx+mWQVxnFW619SpCMS9KdwcM3ZWmoaE0tUBz3e bSUA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=atZ+HwABnb2WOw4ZqmBj5Du6H7WpAIuoQkORgugSSTc=; b=qpIZgxoZeCSdABYKo3EYEJ4q2cmuKahMOiaMDo+M51KrE4XkKsyWwwSkr83YrOeASH V2Cs8ej2J2adYADoi18Bjwj/09erGE+Wi/DDuOL3T+DAElKLunjMS+FiWfnOQMlSZ/pV iumFqLIDxBJyPuucSYg9F1m3y5jwtIN98uv5QT3mWJAbPPJUh518cmKqS18S0b7+szAW Vv4ABqW+cmnGjPlAVSVRPRaYARWnfoTa31a8XeW97Ldf1qGkh5I2ZloGfRXEZQb7lY96 XuAQon/iFqXhnFyQK4pzSn+UboTuUPh8hvNws6lvRifRD5J/4wK6rvvzx9J2MBc/hzhB zghg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=ozQdGjet; 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 z7si3249633ejr.99.2019.09.27.12.29.35; Fri, 27 Sep 2019 12:30:01 -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 header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=ozQdGjet; 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 S1726883AbfI0T04 (ORCPT + 99 others); Fri, 27 Sep 2019 15:26:56 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35047 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbfI0T04 (ORCPT ); Fri, 27 Sep 2019 15:26:56 -0400 Received: by mail-wm1-f67.google.com with SMTP id y21so6700395wmi.0 for ; Fri, 27 Sep 2019 12:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=atZ+HwABnb2WOw4ZqmBj5Du6H7WpAIuoQkORgugSSTc=; b=ozQdGjetN1BXbZ1hB2WduySR5IKLJbK1DCVXDwZlC20zKzLbWQDGZb369mZaIGZEhb qUdpLkncqV+O0UohGQ7Joysn2YehboUwxPDr4ENnHNOzDe251xkm4TDAiE7r9Os7Zb6Z 7wbMpY2mQEHvBrFkg5n8LNz116Bo+wu6mr9Ie1o+luh/96C97uiP8TLTAZpt7zGQyRSR 08kXzx34aQEFBs3GmDP6zOdPtjnkNzhgiLaVHceVMxmdxu0mvY05SQx0MYl2QkOXuKpm RZqrpFvz1Kx0qa3lH4zVznZl5r9FO159WnTw5hTgOGA25tsp7u0Q7NQQ/I6xo0R+5Yyg 3zuA== 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=atZ+HwABnb2WOw4ZqmBj5Du6H7WpAIuoQkORgugSSTc=; b=fha4JNTMydQj9egg5e0SuwuIbtqo7td6WEvUrx90d4Q6UCs38wRbDU60VU3dKjn8W5 2sMrl6FdnHNz4w9BX1IPUanjUCUjz5Fi8Ddu7fM79Af0Q+LOv4T8HvhXmeJysgkDDFPg 6ZwbE0i1rC87E7Dng2KWD3J8KC2e1uh+cSjgn91WlwZxw2jLXmVPD4gOk6BZaecwF3af Ct9K+XfAZJIOIylCVR+qxtl+m2M4iZQnU+8Dsr+Ek86HSh4/yRIJcwbN0SXD9wCEk8kJ tq2/B6T9V7Pz7yrGyDLCyLh29qUSdUh2+HKPlxo3Mb4bHiQOKJ6HkfkgRbSrir42Y2nV T/sQ== X-Gm-Message-State: APjAAAUlf3FvIXga/bdldFxgionrB1HKmTy4aH/xKsFVAOWpii3Sk0Gj ZoAhhp80+fBk88Ahd72FGX+rbBvbTE72OVpXkyXKKXMrPt76pufEEdtgyJnvSKFJLdRYGIFEpJ2 OSKRpsrey6vv8ZG0B1CgdT6vN6kQNy32E0A== X-Received: by 2002:a7b:caa9:: with SMTP id r9mr8829409wml.14.1569612411650; Fri, 27 Sep 2019 12:26:51 -0700 (PDT) MIME-Version: 1.0 References: <20190827215539.1286-1-mmichilot@gateworks.com> <20190829142931.GZ28351@bigcity.dyn.berto.se> <20190927190454.GA7409@bigcity.dyn.berto.se> In-Reply-To: <20190927190454.GA7409@bigcity.dyn.berto.se> From: Tim Harvey Date: Fri, 27 Sep 2019 12:26:40 -0700 Message-ID: Subject: Re: [PATCH] media: i2c: adv7180: fix adv7280 BT.656-4 compatibility To: =?UTF-8?Q?Niklas_S=C3=B6derlund?= Cc: Hans Verkuil , Matthew Michilot , Lars-Peter Clausen , Mauro Carvalho Chehab , linux-media , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 27, 2019 at 12:04 PM Niklas S=C3=B6derlund wrote: > > Hi Tim, > > Sorry for taking to so long to look at this. > > On 2019-09-23 15:04:47 -0700, Tim Harvey wrote: > > On Thu, Aug 29, 2019 at 7:29 AM Niklas S=C3=B6derlund > > wrote: > > > > > > Hi, > > > > > > On 2019-08-29 13:43:49 +0200, Hans Verkuil wrote: > > > > Adding Niklas. > > > > > > > > Niklas, can you take a look at this? > > > > > > I'm happy to have a look at this. I'm currently moving so all my boar= ds > > > are in a box somewhere. I hope to have my lab up and running next wee= k, > > > so if this is not urgent I will look at it then. > > > > > > > Niklas, > > > > Have you looked at this yet? Without this patch the ADV7280A does not > > output proper BT.656. We tested this on a Gateworks Ventana GW5404-G > > which uses the ADV7280A connected to the IMX6 CSI parallel bus. I'm > > hoping to see this get merged and perhaps backported to older kernels. > > I only have access to an adv7180 so I was unable to test this patch. > After reviewing the documentation I think the patch is OK if what you > want is to unconditionally switch the driver from outputting BT.656-3 to > outputting BT.656-4. > > As this change would effect a large number of compat strings (adv7280, > adv7280-m, adv7281, adv7281-m, adv7281-ma, adv7282, adv7282-m) and the > goal is to back port it I'm a bit reluctant to adding my tag to this > patch as I'm not sure if this will break other setups. > > From the documentation about the BT.656-4 register (address 0x04 bit 7): > > Between Revision 3 and Revision 4 of the ITU-R BT.656 standards, > the ITU has changed the toggling position for the V bit within > the SAV EAV codes for NTSC. The ITU-R BT.656-4 standard > bit allows the user to select an output mode that is compliant > with either the previous or new standard. For further information, > visit the International Telecommunication Union website. > > Note that the standard change only affects NTSC and has no > bearing on PAL. > > When ITU-R BT.656-4 is 0 (default), the ITU-R BT.656-3 > specification is used. The V bit goes low at EAV of Line 10 > and Line 273. > > When ITU-R BT.656-4 is 1, the ITU-R BT.656-4 specification is > used. The V bit goes low at EAV of Line 20 and Line 283. > > Do you know what effects such a change would bring? Looking at the > driver BT.656-4 seems to be set unconditionally for some adv7180 chips. > Niklas, Quite simply, we have a board that has an ADV7180 attached to the parallel CSI of an IMX6 that worked fine with mainline drivers then when we revised this board to attach an ADV7280A in the same way capture failed to sync. Investigation showed that the NEWAVMODE differed between the two. So if the point of the driver is to configure the variants in the same way, this patch needs to be applied. I would maintain that the adv7180 comes up with NEWAVMODE enabled and in order to be compatible we must configure the adv7282 the same. The same argument can be made for setting the V bit end position in NTSC mode - its done for the adv7180 so for compatible output it should be done for the adv7282. > > > > Regards, > > > > Tim > > > > > > > > > > Regards, > > > > > > > > Hans > > > > > > > > On 8/27/19 11:55 PM, Matthew Michilot wrote: > > > > > From: Matthew Michilot > > > > > > > > > > Captured video would be out of sync when using the adv7280 with > > > > > the BT.656-4 protocol. Certain registers (0x04, 0x31, 0xE6) had t= o > > > > > be configured properly to ensure BT.656-4 compatibility. > > > > > > > > > > An error in the adv7280 reference manual suggested that EAV/SAV m= ode > > > > > was enabled by default, however upon inspecting register 0x31, it= was > > > > > determined to be disabled by default. > > The manual I have [1] states that NEWAVMODE is switched off by default. > I'm only asking as I would like to know if there is an error in that > datasheet or not. > > 1. https://www.analog.com/media/en/technical-documentation/user-guides/AD= V7280_7281_7282_7283_UG-637.pdf > Table 99 in that document shows NEVAVMODE disabled on power-up (0x31=3D0x02) yet Page 77 shows it enabled at power-up. Looking at an actual device we find it is indeed disabled on powerup (0x31=3D0x02) so Table 99 is correct, and Page 77 is not. If you look at the ADV7180 datasheet (https://www.analog.com/media/en/technical-documentation/data-sheets/ADV718= 0.pdf) Table 105 shows NEWAVMODE enabled by default which is also reflected in the register details on Page 91 and is what you find on an actual device. Regards, Tim --=20 CONFIDENTIALITY NOTICE: This email constitutes an electronic=20 communication within the meaning of the Electronic Communications Privacy= =20 Act, 18 U.S.C. 2510, and its disclosure is strictly limited to the named=20 recipient(s) intended by the sender of this message. This email, and any=20 attachments, may contain confidential and/or proprietary information. If=20 you are not a named recipient, any copying, using, disclosing or=20 distributing to others the information in this email and attachments is=20 STRICTLY PROHIBITED. If you have received this email in error, please=20 notify the sender immediately and permanently delete the email, any=20 attachments, and all copies thereof from any drives or storage media and=20 destroy any printouts or hard copies of the email and attachments. =C2=A0 EXPORT COMPLIANCE NOTICE: This email and any attachments may contain=20 technical data subject to U.S export restrictions under the International= =20 Traffic in Arms Regulations (ITAR) or the Export Administration Regulations= =20 (EAR). Export or transfer of this technical data and/or related information= =20 to any foreign person(s) or entity(ies), either within the U.S. or outside= =20 of the U.S., may require advance export authorization by the appropriate=20 U.S. Government agency prior to export or transfer. In addition, technical= =20 data may not be exported or transferred to certain countries or specified= =20 designated nationals identified by U.S. embargo controls without prior=20 export authorization. By accepting this email and any attachments, all=20 recipients confirm that they understand and will comply with all applicable= =20 ITAR, EAR and embargo compliance requirements.