All of lore.kernel.org
 help / color / mirror / Atom feed
From: "arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>
To: Caleb Crome <caleb@crome.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Markus Pargmann <mpa@pengutronix.de>,
	Mark Brown <broonie@kernel.org>,
	Roberto Fichera <kernel@tekno-soft.it>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>
Subject: Re: [PATCH 0/5] ASoC: fsl_ssi: Fixing various channel slips and bad samples insertions
Date: Wed, 13 Jan 2016 15:45:56 +0100	[thread overview]
Message-ID: <56966324.8090409@invoxia.com> (raw)
In-Reply-To: <CAG5mAdw3HKwyMyX9O2NM=GRDy9nEcOH6FrB1BSYMFhM-kL-BZw@mail.gmail.com>



Le 12/01/2016 00:44, Caleb Crome a écrit :
> On Sat, Jan 9, 2016 at 3:02 AM, arnaud.mouiche@invoxia.com
> <arnaud.mouiche@invoxia.com> wrote:
>> Hello Caleb
>>
>> Le 09/01/2016 01:47, Caleb Crome a écrit :
>>> [...]
>>>
>>> Hello Arnaud,
>>>     I have finally gotten to test your patches, and I'm still having
>>> trouble with channel slips.
>>>
>>> I applied your v2 patch set, along with your changes for using a dummy
>>> codec.
>>>
>>> The full changes are here:
>>> https://github.com/ccrome/linux-caleb-dev/tree/v4.4-rc8-armv7-x3
>>>
>>> This ignores most of my previous patches, and uses your code to bring
>>> up the SSI (without a codec) on a wandboard.
>>>
>>> I am using SSI3, and doing a hardware loopback between TX and RX.
>>>
>>> Here's what I run:
>>> ./atest -r 16000 -c 8 -p 2048   -D default play
>>>
>>> which plays continuously.
>>>
>>> and in another shell:
>>> ./atest -r 16000 -c 8 -p 2048  -D default -d 10 capture
>>>
>>> which captures for 10 seconds.
>>>
>>>
>>> The first time I run the capture command, it succeeds, no problem.
>>>> dbg: dev: 'default'
>>>> dbg: default: capture_start
>>>> dbg: start a 10 seconds duration timer
>>>> warn: First valid frame
>>>> warn:   3400 3401 3402 3403 3404 3405 3406 3407
>>>> dbg: end of tests
>>>> total number of sequence errors: 0
>>>> global tests exit status: OK
>>> But the second and all subsequent captures, it fails with channel slips:
>>>
>>>> dbg: dev: 'default'
>>>> dbg: default: capture_start
>>>> dbg: start a 10 seconds duration timer
>>>> err: invalid frame after 0 null frames
>>>> err:   d2a1 d2a2 d2a3 d2a4 d2a5 d2a6 d2a7 d2c0
>>>> err:   d2c1 d2c2 d2c3 d2c4 d2c5 d2c6 d2c7 78e0
>>>> dbg: end of tests
>>>> total number of sequence errors: 430080
>>>> global tests exit status: OK
>>
>> Can you use -I option to get a little more log of the error
>> $ ./atest -r 16000 -c 8 -p 2048  -D default -d 10 -I 10 capture
>>
>> Just to know if the wrong frames comes from the previous record session,
>> meaning the RX fifo was not cleared correctly,
>> as if the CCSR_SSI_SOR_RX_CLR bit is not working as we might expect.
>> (ie. d2a1 .. d2c7 may come from the previous recording, and 78e0 .. may be
>> the start of the new recording session)
> That does appear to be what's happening.  I read the SFCSR before and
> after you update the SOR register (SOR_RX_CLR), and in both cases the
> rx buffer is full on the second enablement.
>
> I can't seem to empty that buffer, either by using the SOR_RX_CLR or
> by reading the SRX0 register. This is another one of those cases where
> there you cannot modify the register (i.e. fifo or RX0) when RE is
> disabled.
>
> So, instead of clearing on enable, I'm clearing on shutdown and on
> enable.  I attempted using the SOR_RX_CLR, but it doesn't seem to work
> on the MX6.  Rather, I clear the fifo by reading all the words in a
> loop, just before RE is disabled.
so the imx6.sl SSI behaves differently from the imx6.solo SSI ... Or 
some things have changes between 4.3 and 4.4.

May be SOR_RX_CLR and/or RX0 registers can't be read on 'solo' because 
de the SRCR.RFEN0 [or1] are not enabled yet.

In fact, clearing the fifos at the end may still introduce a race since 
the RX path is still enabled when your read from fifo, and
Samples may still be received in the meantime...

Also, I see that the CCSR_SSI_SOR register is not in the regmap 
fsl_ssi_volatile_reg() list (line 140). May be there is an implication 
of some caching mechanism ?

Can you try to move the the fifo clearing part just before the write in 
CCSR_SSI_SIER with the following change in top of my patches ?
Also may be you can additionally add the RX0 / RX1 reading from clearing 
mechanism at the same place.

On my side, I will check the 4.4 tree on imx6sl

Regards,
Arnaud

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 0277097..bd163b2 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -420,6 +420,9 @@ static void fsl_ssi_config(struct fsl_ssi_private 
*ssi_private, int enable,
          * (online configuration)
          */
         if (enable) {
+
+               regmap_update_bits(regs, CCSR_SSI_SRCR, vals->srcr, 
vals->srcr);
+               regmap_update_bits(regs, CCSR_SSI_STCR, vals->stcr, 
vals->stcr);
                 /*
                  * Clear RX or TX FIFO to remove samples from the previous
                  * stream session which may be still present in the 
FIFO and
@@ -435,9 +438,6 @@ static void fsl_ssi_config(struct fsl_ssi_private 
*ssi_private, int enable,
                         regmap_update_bits(regs, CCSR_SSI_SOR,
                                 CCSR_SSI_SOR_TX_CLR, CCSR_SSI_SOR_TX_CLR);

                 }
-
-               regmap_update_bits(regs, CCSR_SSI_SRCR, vals->srcr, 
vals->srcr);
-               regmap_update_bits(regs, CCSR_SSI_STCR, vals->stcr, 
vals->stcr);
                 regmap_update_bits(regs, CCSR_SSI_SIER, vals->sier, 
vals->sier);
         } else {
                 u32 sier;



_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2016-01-13 14:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 14:07 [PATCH 0/5] ASoC: fsl_ssi: Fixing various channel slips and bad samples insertions Arnaud Mouiche
2015-11-26 14:07 ` [PATCH 1/5] ASoC: fsl_ssi: The IPG/5 limitation concerns the bitclk, not the sysclk Arnaud Mouiche
2016-05-13 12:26   ` Applied "ASoC: fsl_ssi: The IPG/5 limitation concerns the bitclk, not the sysclk." to the asoc tree Mark Brown
2015-11-26 14:07 ` [PATCH 2/5] ASoC: fsl_ssi: Save a dev reference for dev_err() purpose Arnaud Mouiche
2016-05-13 12:26   ` Applied "ASoC: fsl_ssi: Save a dev reference for dev_err() purpose." to the asoc tree Mark Brown
2015-11-26 14:07 ` [PATCH 3/5] ASoC: fsl_ssi: Fix samples being dropped as Playback startup Arnaud Mouiche
2016-05-13 12:26   ` Applied "ASoC: fsl_ssi: Fix samples being dropped at Playback startup" to the asoc tree Mark Brown
2015-11-26 14:07 ` [PATCH 4/5] ASoC: fsl_ssi: Fix channel slipping in Playback at startup Arnaud Mouiche
2015-11-26 14:07 ` [PATCH 5/5] ASoC: fsl_ssi: Fix channel slipping on capture (or playback) restart in full duplex Arnaud Mouiche
2016-01-09  0:47 ` [PATCH 0/5] ASoC: fsl_ssi: Fixing various channel slips and bad samples insertions Caleb Crome
2016-01-09 11:02   ` arnaud.mouiche
2016-01-11 23:44     ` Caleb Crome
2016-01-13 14:45       ` arnaud.mouiche [this message]
2016-01-13 20:20         ` Caleb Crome
2016-01-13 21:18           ` Caleb Crome
2016-01-14  8:40             ` arnaud.mouiche
2016-01-14 14:25               ` Caleb Crome
2016-01-14 16:42                 ` Caleb Crome

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56966324.8090409@invoxia.com \
    --to=arnaud.mouiche@invoxia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=caleb@crome.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@tekno-soft.it \
    --cc=lgirdwood@gmail.com \
    --cc=mpa@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.