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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 6BADAC433ED for ; Fri, 23 Apr 2021 22:31:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 EA65B61263 for ; Fri, 23 Apr 2021 22:31:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA65B61263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=users.sourceforge.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D1AA8171C; Sat, 24 Apr 2021 00:30:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D1AA8171C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1619217101; bh=10dfyHcpS9kQPkAZYizSRrByct4CCKhMti3/m2bJ3J8=; h=Date:From:To:In-Reply-To:References:Subject:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=FgtFjoiUpiN0rk5yOjM00o9bhgvfFaMumq7ydU2TOFu+8sqBPX5OQL5G/IuTwePbe i9qCV0WY2J7U9h4Q5qpBsYYrA5CK4wWpo6/NbwijjGtGGWAMTJuTTJv88dcJAcRgkj ml0Z2X9UIu90/+pVBUB2sdYivcaxqyhbEfHqzrTw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2A350F8019B; Sat, 24 Apr 2021 00:30:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CDAD3F80227; Sat, 24 Apr 2021 00:30:47 +0200 (CEST) Received: from sonic306-21.consmr.mail.ir2.yahoo.com (sonic306-21.consmr.mail.ir2.yahoo.com [77.238.176.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 712E0F800AE for ; Sat, 24 Apr 2021 00:30:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 712E0F800AE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="Cc6jmUwT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1619217032; bh=J/7RlJZR6i9yu6TC7lR3Sph2MSZyvFOiIY50oWqgoEw=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=Cc6jmUwTx2T7b67Hmem/mnzBCn4keOykHt0/8m9LT9cmcppZ19c5fEwgMsNpiqXC1r3xOyF10mdHG7hxfvON+PG1OsCQKXaym2dZ4hEAdv19sD5LUCpwv75GIG0JpkfYBnoUFwZcocD3dh7eCsldybrE4PFHPsDxi5B+P92Cr7BIZ8mQ85c8OllSA3PP6LQ1ij3/JBorwyaO3wHd4osK30gv27O4B/p0lEF5hG9DUmSlpBKSs+zd5RtHdXODkF/Eikq7WchKBcXT8/sotNwKhAadlqZRb+rBXL7RGaDfDqlT1HyMEDnkB4KWvC1CDydCSA+rvdVrtcpHPyM7UgSplA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1619217032; bh=vHsHxyjyJSel7rnk5JVRpDV8+mT0KedfT4a0kZhVsgA=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=iCiVUaPabx6szfdBzNNnErrgFWLrg40vHskT7yXVgBt+f5LNWY582DfqjJ/AiwuklIupfW8Suo2pn4rvaZhf0HP8Ym6Hjg6dwvHXFjMG5gNETSsEG9cb4Xb0lr7lwK2bXANKslW2u8qELPTIaMIdzDxD8cfKHVEjNeFqufjWsi92t0R6PA+fVAUWKoom+c6h2diO6x7dIIuaj11sReGDFGaDy6JSdCD9ZTVayQgTRkSPx9qCwrOXA5UIyy5ivaU1Pwy8dndS40p6i2wGXhMm0AOj8At6rli60bADU/epmEZnky5GgXd2v0QK5rZer+qRVxnp2gHM2KzrUFkeCiC0dA== X-YMail-OSG: JTbmBt4VM1kiVGolN6Gw_B7x8QS_bD3apz0RdVnlMM20aBsKFV_JoDVvE36PDjf 2jbX.gXoae8vhLlokEgMN3z75YatZYHqCMtEXqSgBbNj407bQcQ5AQuTNOG_.b_Rt9FxLmNBzxbF cSqRRVHXUZfkSKQQJzkNqy1IHl_L5Ks6BYBKg8ewdTbIotzG5L3k.QTiyAoAJ5WESRuBnM2PZ2z6 zu1lfTWYW1cZ3.IbzUMX_muurHwmokXUh4uyWw_w1c515bf6kZzzHt83H.k2iZPETyMgQoaO_S1E 6u2K2pqRCcBlP_v4JDarYsK4M2JpRxmoUhWIArMGvgELmSL0s.7l0c2W6_v5qqCQ9r23d8DFOnPc iyFLOE0TX6yzDdjN7dJij9rpbWF6gtN.lbS1zEVwXrneGYjMNEmEMGtF005sdGUBfTekM_k4KBHG 8LI3dxzGa3ir2.2XoGZodJUZS0Wr2rs1cpURo9uKi6yuie96aSB0UjLf5WhAGPsyF07BuyXAxEDr K5toWBTApXATqbGDRL31B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c.5V95W .ZtYd8My93oIBDdvU.0pt3TEUFRcO9RJfYpYOTljfaiAdnWyAOmMqMhhdEDR2Y6lR7R.vWarRrVa wHwJnbUSLaatq6urs.C30kTI9UAHZ3ZIGP8wgImidfwmM1pbQOpWtWTvIwE.cJYKuLlftx.aCZus 7Am90dunX0eZHuFM3wGvIyw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Fri, 23 Apr 2021 22:30:32 +0000 Date: Fri, 23 Apr 2021 22:30:27 +0000 (UTC) From: Hin-Tak Leung To: Peter Ujfalusi , =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= Message-ID: <989629357.29063.1619217027895@mail.yahoo.com> In-Reply-To: <1556414365.8666901.1619176930979@mail.yahoo.com> References: <148484793.4894421.1618654607945.ref@mail.yahoo.com> <148484793.4894421.1618654607945@mail.yahoo.com> <877dkz5hz1.wl-kuninori.morimoto.gx@renesas.com> <1772063602.5910217.1618841824599@mail.yahoo.com> <87h7k152du.wl-kuninori.morimoto.gx@renesas.com> <212419469.6653726.1618928398310@mail.yahoo.com> <425493399.6730534.1618934642983@mail.yahoo.com> <1556414365.8666901.1619176930979@mail.yahoo.com> Subject: Re: ASoc / PCM recording-related regression between v5.4 and v5.5 MIME-Version: 1.0 X-Mailer: WebService/1.1.18138 YMailNodin Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: alsa-devel@alsa-project.org, Mark Brown , Pierre-Louis Bossart , Kuninori Morimoto X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: htl10@users.sourceforge.net Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" =20 On Friday, 23 April 2021, 12:22:11 BST, Hin-Tak Leung wrote: > On Thursday, 22 April 2021, 15:01:02 BST, P=C3=A9ter Ujfalusi wrote: > > Can you point me to the out of tree driver and the related dts files? > > Can it be reproduced with rpbi w/o any hat? I have one hifiberry but > > that is playback only and if I'm not mistaken the 3.5 on the board also= ? > For your purpose you can see my fork (which includes v5.4 -> v5.10 migrat= ion change, unlike the vendor's),=20 > https://github.com/HinTak/seeed-voicecard .=20 > The dts concerned is: https://github.com/HinTak/seeed-voicecard/blob/v5.9= /seeed-8mic-voicecard-overlay.dts > The card trigger code is in: https://github.com/HinTak/seeed-voicecard/bl= ob/v5.9/seeed-voicecard.c > while the codec trigger code is in > https://github.com/HinTak/seeed-voicecard/blob/v5.9/ac108.c > and also https://github.com/HinTak/seeed-voicecard/blob/v5.9/ac101.c !=20 > Note that the routine ac101_trigger() is not used, although the ac101 cod= ec itself is involved. > There is a spinlock in ac108_trigger(), which I have long suspected to be= incorrect, and has been known to cause the > pi to kernel panic if built w= ith PREEMPT ; Now I think it is there to make it work under the previous wr= ong sequence. > There is another device of the same family - which records okay regardles= s of the trigger sequence=20 > https://github.com/HinTak/seeed-voicecard/blob/v5.9/seeed-4mic-voicecard-= overlay.dts . > The problematic device has 8 mics, using two ac108 for 2 x 4-ADC and the = ac101 for DAC loopback (and as clock > master?). The 4-mics record-okay device has just one ac108 (and without a= ac101) to record 4-channels. I have gone ahead and inserted a number of pr_info()'s to all the triggers = (and compare the order of calls in 5.4 and 5.10) ; there was a mistake in m= y comment above: ac101_trigger() is used! it is just not set up as a call-b= ack in the component struct. If I understand it correctly, the 8-mics device was designed to do record a= nd playback simultaneously; the master clock is really on the DAC ac101 cod= ec; and ac101_trigger() needed to be called before the card trigger code se= eed_voice_card_trigger() calling _set_clock(). In 5.4, we had ac108_trigger() calling ac101_trigger() , then seeed_voice_c= ard_trigger() calling _set_clock(), which works.=20 in 5.10 (and 5.5+), seeed_voice_card_trigger() calling _set_clock(), then a= c108_trigger() calling ac101_trigger() , which does not. So I made this rather ugly change to the driver code, and it gives me the r= ight behavior: diff --git a/Makefile b/Makefile index b9de7f4..1aa0949 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ifneq ($(KERNELRELEASE),) =20 snd-soc-wm8960-objs :=3D wm8960.o snd-soc-ac108-objs :=3D ac108.o ac101.o -snd-soc-seeed-voicecard-objs :=3D seeed-voicecard.o +snd-soc-seeed-voicecard-objs :=3D seeed-voicecard.o ac101.o =20 =20 obj-m +=3D snd-soc-wm8960.o diff --git a/ac108.c b/ac108.c index 5fe5176..c755741 100644 --- a/ac108.c +++ b/ac108.c @@ -1060,7 +1060,7 @@ static int ac108_trigger(struct snd_pcm_substream *su= bstream, int cmd, =20 spin_lock_irqsave(&ac10x->lock, flags); =20 - if (ac10x->i2c101 && _MASTER_MULTI_CODEC =3D=3D _MASTER_AC101) { + if (!cmd && ac10x->i2c101 && _MASTER_MULTI_CODEC =3D=3D _MASTER_AC101) { ac101_trigger(substream, cmd, dai); if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { goto __ret; diff --git a/seeed-voicecard.c b/seeed-voicecard.c index 23dfb15..244dc6e 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -197,6 +197,7 @@ static int seeed_voice_card_trigger(struct snd_pcm_subs= tream *substream, int cmd { struct snd_soc_pcm_runtime *rtd =3D substream->private_data; struct snd_soc_dai *dai =3D asoc_rtd_to_codec(rtd, 0); + struct ac10x_priv *ac10x =3D snd_soc_dai_get_drvdata(dai); struct seeed_card_data *priv =3D snd_soc_card_get_drvdata(rtd->card); #if CONFIG_AC10X_TRIG_LOCK unsigned long flags; @@ -216,6 +217,9 @@ static int seeed_voice_card_trigger(struct snd_pcm_subs= tream *substream, int cmd /* I know it will degrades performance, but I have no choice */ spin_lock_irqsave(&priv->lock, flags); #endif + if (cmd && ac10x->i2c101 && _MASTER_MULTI_CODEC =3D=3D _MASTER_AC101) { + ac101_trigger(substream, cmd, dai); + } if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPT= URE](1); if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLA= YBACK](1); #if CONFIG_AC10X_TRIG_LOCK It is certainly not ideal for the card driver to be linked directly and cal= ling codec routines... Is there a better way of doing this, perhaps by re-w= riting the dts in https://github.com/HinTak/seeed-voicecard/blob/v5.9/seeed= -8mic-voicecard-overlay.dts ?=20 While we are at it, the spinlock in ac108.c (just above the changed line) s= eems wrong; can somebody have a look and advise on what better way to do it= ? Regards, Hin-Tak =20