From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5862EC43461 for ; Thu, 17 Sep 2020 13:23:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E684B206D4 for ; Thu, 17 Sep 2020 13:23:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IPdbXHos"; dkim=temperror (0-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="o2rjWGbb"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mZLQVPsj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E684B206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZZJm+P8DPKYQXiSGNgaOlfpJGxk1FW/GlTSNGwVJ+Tk=; b=IPdbXHosQlLvDonhsa4l6lcY1 zpmyIZVw5CcDcD/GefY7K5rfxfWhZHxhCC+JzXBChd/f8BaIFD8tvLEcDlw4TUpTK4BBA7DQ2Avfz D1ROrEt2SKI0pUSk8TiWGVu1QN5/b7KNMppHd8ZiMZlWo9a4dNLc9JAsXOShJtPLaHacUzbRmaJFl D5XxZlJgQkxikpiHSW35yxpm5ForVlvSI+IzlTv1Eu4q5c8/+8ILO/9EVcp5dYYhNTmFJKZV2gg1F 6+ubsPrnHm2OBVlGZ5lO7Nfy/h08z2gKH4rBhKL0dWII75QG3h7vpXJ2DEPMxnt92wpDkH3h1ae/o wR9NDFxCg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kItqy-0002Bo-E0; Thu, 17 Sep 2020 13:21:36 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kItqw-0002BC-5n for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 13:21:35 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id E753C3AA; Thu, 17 Sep 2020 09:21:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 17 Sep 2020 09:21:32 -0400 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=fm3; bh=FCFpxRl+TpfAF97lnfZg4FGlQVJ hgvr3MRsWWhP+MLE=; b=o2rjWGbbC8f6RrteOgIG0VAHk8Xjm94lXVF4UpGCvTn JSmdon+LRGALXVMNevTbBKc1viZnmNct66v1VpvnVUv3BsRIFYHDJrQztSUieI1s mLHa4KgbNftF7VRLzBemg1+nENnDXoUo87LVI7rVCdRdUCvwgSZLPr0sTKYtp0Ou 6XlHw0muDczEg52ugKC+3l+e0N7Pi1LWJ1EhG37PwGvU/MIBIuEMcJeQ3VWh/M+N gqYu556ppD+b4FQ0ErH4m4yrOLOh9IIMCvkqDwZ5ezmtLb43sORc87E/BruFoLNu a+EvQ+aLa+ShHBybuGh0IxSOF597Owz6L2fcvH4hroQ== 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=fm3; bh=FCFpxR l+TpfAF97lnfZg4FGlQVJhgvr3MRsWWhP+MLE=; b=mZLQVPsjUDHzQmKY7A7M4o sj6U3ElU03xrXmP+mOlQ3IaU63ZdQJvHMpQP05kCAlvps99TCOn6humM8jnUWESj zj4BpFtw70eEJ8SYnevs2QHUWiVCy1gT5ytixVwvBJqGjU+Kd6lQVNvd6RVGLOY6 TNXaVBzqFTl8lw2xmyjYJN6LQXayrii5avGfEOiF1wQr/9ojIG9IxReMwuD4+fSi /37+VgihLZi0JwbY+pMiORl5yF21EWbPjPyKKg32KWyNOeQJJWoT26XxH5sOHJVq rSsUi3mvNvh+3dR8fUiWM8/9ug7/diZ14pGd8PfMid3JuQx/mLmPUNE8Sm4UQJ2g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrtdeggdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpeetgfejtdelgeffffeitdfhtddvfeeijeffteelkefhledvvefggfdujeegieeg hfenucffohhmrghinhepghhithhhuhgsrdgtohhmnecukfhppeeltddrkeelrdeikedrje einecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgr gihimhgvsegtvghrnhhordhtvggthh 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 A72293064674; Thu, 17 Sep 2020 09:21:29 -0400 (EDT) Date: Thu, 17 Sep 2020 15:21:28 +0200 From: Maxime Ripard To: Samuel Holland Subject: Re: [PATCH v3 3/7] ASoC: sun4i-i2s: Add support for H6 I2S Message-ID: <20200917132128.e6z4gwoluipbzigm@gilmour.lan> References: <20200504120942.lnrxnnmykqnvw3fb@gilmour.lan> <20200729143927.47f5tbuaob4ph3lp@gilmour.lan> <20200729151548.GB5612@sirena.org.uk> <20200903205851.gdnpthserywsxrbs@gilmour.lan> <80b5a4e3-c8bc-9521-4ff1-12bb6424516f@sholland.org> <20200910143314.qku7po6htiiq5lzf@gilmour.lan> <57f8bdeb-14dc-583e-ffa8-43d7a9f1bb24@sholland.org> MIME-Version: 1.0 In-Reply-To: <57f8bdeb-14dc-583e-ffa8-43d7a9f1bb24@sholland.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_092134_359332_E3C53BAE X-CRM114-Status: GOOD ( 33.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree , Linux-ALSA , linux-kernel , Takashi Iwai , Jernej Skrabec , Liam Girdwood , Rob Herring , Jaroslav Kysela , Marcus Cooper , Chen-Yu Tsai , Mark Brown , =?utf-8?B?Q2zDqW1lbnQgUMOpcm9u?= , linux-arm-kernel Content-Type: multipart/mixed; boundary="===============2322709994640740225==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2322709994640740225== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="g5lgblp7ammz5zgk" Content-Disposition: inline --g5lgblp7ammz5zgk Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sat, Sep 12, 2020 at 03:29:55PM -0500, Samuel Holland wrote: > On 9/10/20 9:33 AM, Maxime Ripard wrote: > > On Thu, Sep 03, 2020 at 09:54:39PM -0500, Samuel Holland wrote: > >> On 9/3/20 3:58 PM, Maxime Ripard wrote: > >>> On Thu, Sep 03, 2020 at 10:02:31PM +0200, Cl=E9ment P=E9ron wrote: > >>>> Hi Maxime, > >>>> > >>>> On Wed, 29 Jul 2020 at 17:16, Mark Brown wrote: > >>>>> > >>>>> On Wed, Jul 29, 2020 at 04:39:27PM +0200, Maxime Ripard wrote: > >>>>> > >>>>>> It really looks like the polarity of LRCK is fine though. The firs= t word > >>>>>> is sent with LRCK low, and then high, so we have channel 0 and then > >>>>>> channel 1 which seems to be the proper ordering? > >> > >> Which image file is this in reference to? > >> > >>>>> Yes, that's normal. > >>>> > >>>> Thank you very much for this test. > >>>> > >>>> So I will revert the following commit: > >>>> > >>>> ASoC: sun4i-i2s: Fix the LRCK polarity > >>>> > >>>> https://github.com/clementperon/linux/commit/dd657eae8164f7e4bafe8b8= 75031a7c6c50646a9 > >>> > >>> Like I said, the current code is working as expected with regard to t= he > >>> LRCK polarity. The issue is that the samples are delayed and start to= be > >>> transmitted on the wrong phase of the signal. > >> > >> Since an I2S LRCK frame is radially symmetric, "wrong phase" and "inve= rted > >> polarity" look the same. The only way to definitively distinguish them= is by > >> looking at the sample data. > >> > >> In "i2s-h6.png", the samples are all zeroes, so you're assuming that t= he first > >> sample transmitted (that is, when the bit clock starts transitioning) = was a > >> "left" sample. > >> > >> However, in "h6-i2s-start-data.png", there are pairs of samples we can= look at. > >> I'm still assuming that similar samples are a left/right pair, but tha= t's > >> probably a safe assumption. Here we see the first sample in each pair = is > >> transmitted with LRCK *high*, and the second sample in the pair is tra= nsmitted > >> with LRCK *low*. This is the opposite of your claim above. > >> > >> An ideal test would put left/right markers and frame numbers in the da= ta > >> channel. The Python script below can generate such a file. Then you wo= uld know > >> how much startup delay there is, which channel the "first sample" came= from, and > >> how each channel maps to the LRCK level. > >> > >> It would also be helpful to test DSP_A mode, where the LRCK signal is > >> asymmetric and an inversion would be obvious. > >=20 > > I had no idea that there was a wave module in Python, that's a great > > suggestion, thanks! > >=20 > > You'll find attached the screenshots for both the I2S and DSP_A formats. > > I zoomed out a bit to be able to have the first valid samples, but it > > should be readable. > >=20 > > The code I used is there: > > https://github.com/mripard/linux/tree/sunxi/h6-i2s-test > >=20 > > It's basically the v3, plus the DT bits. > >=20 > > As you can see, in the i2s case, LRCK starts low and then goes up, with > > the first channel (0x2*** samples) transmitted first, so everything > > looks right here. > >=20 > > On the DSP_A screenshot, LRCK will be low with small bursts high, and > > once again with the first channel being transmitted first, so it looks > > right to me too. >=20 > Indeed, for H6 i2s0 with LRCK inversion in software, everything looks cor= rect on > the wire. >=20 > It's still concerning to me that the BSP has no evidence of this inversio= n, > either for i2s0 or i2s1[1]. And the inversion seems not to be required fo= r HDMI > audio on mainline either (but there could be an inversion on the HDMI sid= e or on > the interconnect). One can only guess here, but it's also quite easy to fix it at the card level (or maybe there's a similar inversion in the codecs, or whatever). > Even so, your research is sufficient justification for me that the code is > correct as-is (with the inversion). Thank you very much for collecting th= e data! You're welcome, thanks for that script :) maxime --g5lgblp7ammz5zgk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCX2Ni2AAKCRDj7w1vZxhR xZmxAQD7LzQw0dqow218wrv2eoIFHwL+zK66hEeo26ch4WCnrwEA32DthF+KSe6e A+J30e1noRJXGztaLsaFPAGzPvzbKgk= =AqGp -----END PGP SIGNATURE----- --g5lgblp7ammz5zgk-- --===============2322709994640740225== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2322709994640740225==--