alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Caleb Crome <caleb@crome.org>
To: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Xiubo Li <Xiubo.Lee@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>, Timur Tabi <timur@tabi.org>,
	Nicolin Chen <nicoleotsuka@gmail.com>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v3 5/6] ASoC: fsl_ssi: Fix channel slipping in Playback at startup
Date: Mon, 25 Apr 2016 10:22:29 -0700	[thread overview]
Message-ID: <CAG5mAdw6AgH__kYV6u465E+bfHfW6D6icRgtWVE6_e-1M_dZqw@mail.gmail.com> (raw)
In-Reply-To: <1453130771-24419-6-git-send-email-arnaud.mouiche@invoxia.com>

On Mon, Jan 18, 2016 at 7:26 AM, Arnaud Mouiche
<arnaud.mouiche@invoxia.com> wrote:
> Previously, SCR.SSIEN and SCR.TE were enabled at once if no capture
> stream was also running.
> This may not give a chance for the DMA to write the first sample in
> TX FIFO before the streaming starts on the PCM bus, inserting void
> samples first.
> Those void samples are then responsible for slipping the channels.
>
> Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
> ---
>  sound/soc/fsl/fsl_ssi.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index c9ba8ca..530d592 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -520,8 +520,40 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable,
>
>  config_done:
>         /* Enabling of subunits is done after configuration */
> -       if (enable)
> +       if (enable) {
> +               if (ssi_private->use_dma && (vals->scr & CCSR_SSI_SCR_TE)) {
> +                       /*
> +                        * Be sure the Tx FIFO is filled when TE is set.
> +                        * Otherwise, there are some chances to start the
> +                        * playback with some void samples inserted first,
> +                        * generating a channel slip.
> +                        *
> +                        * First, SSIEN must be set, to let the FIFO be filled.
> +                        *
> +                        * Notes:
> +                        * - Limit this fix to the DMA case until FIQ cases can
> +                        *   be tested.
> +                        * - Limit the length of the busy loop to not lock the
> +                        *   system too long, even if 1-2 loops are sufficient
> +                        *   in general.
> +                        */
> +                       int i;
> +                       int max_loop = 100;
> +                       regmap_update_bits(regs, CCSR_SSI_SCR,
> +                                       CCSR_SSI_SCR_SSIEN, CCSR_SSI_SCR_SSIEN);
> +                       for (i = 0; i < max_loop; i++) {
> +                               u32 sfcsr;
> +                               regmap_read(regs, CCSR_SSI_SFCSR, &sfcsr);
> +                               if (CCSR_SSI_SFCSR_TFCNT0(sfcsr))
> +                                       break;
> +                       }
> +                       if (i == max_loop) {
> +                               dev_err(ssi_private->dev,
> +                                       "Timeout waiting TX FIFO filling\n");
> +                       }
> +               }
>                 regmap_update_bits(regs, CCSR_SSI_SCR, vals->scr, vals->scr);
> +       }
>  }
>
>
> --
> 1.9.1
>

Tested-By: Caleb Crome <caleb@crome.org>
Reviewed-"By: Caleb Crome <caleb@crome.org>

  reply	other threads:[~2016-04-25 17:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 15:26 [PATCH v3 0/6] ASoC: fsl_ssi: Fixing various channel slips and bad samples insertions Arnaud Mouiche
2016-01-18 15:26 ` [PATCH v3 1/6] ASoC: fsl_ssi: Real hardware channels max number is 32 Arnaud Mouiche
2016-01-18 15:46   ` Timur Tabi
2016-01-18 15:56     ` arnaud.mouiche
2016-04-25 17:20   ` Caleb Crome
2016-01-18 15:26 ` [PATCH v3 2/6] ASoC: fsl_ssi: The IPG/5 limitation concerns the bitclk, not the sysclk Arnaud Mouiche
2016-04-25 17:21   ` Caleb Crome
2016-01-18 15:26 ` [PATCH v3 3/6] ASoC: fsl_ssi: Save a dev reference for dev_err() purpose Arnaud Mouiche
2016-04-25 17:21   ` Caleb Crome
2016-01-18 15:26 ` [PATCH v3 4/6] ASoC: fsl_ssi: Fix samples being dropped as Playback startup Arnaud Mouiche
2016-04-25 17:22   ` Caleb Crome
2016-01-18 15:26 ` [PATCH v3 5/6] ASoC: fsl_ssi: Fix channel slipping in Playback at startup Arnaud Mouiche
2016-04-25 17:22   ` Caleb Crome [this message]
2016-01-18 15:26 ` [PATCH v3 6/6] ASoC: fsl_ssi: Fix channel slipping on capture (or playback) restart in full duplex Arnaud Mouiche
2016-04-25 17:22   ` Caleb Crome
2016-04-29  3:44 ` [PATCH v3 0/6] ASoC: fsl_ssi: Fixing various channel slips and bad samples insertions Fabio Estevam
2016-04-29  3:54   ` Nicolin Chen
2016-04-29 16:49     ` Caleb Crome
2016-05-02 22:29       ` arnaud.mouiche
2016-05-02 22:32         ` Fabio Estevam
2016-05-02 22:35           ` arnaud.mouiche

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=CAG5mAdw6AgH__kYV6u465E+bfHfW6D6icRgtWVE6_e-1M_dZqw@mail.gmail.com \
    --to=caleb@crome.org \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.mouiche@invoxia.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=timur@tabi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).