[alsa-devel] fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode.

Caleb Crome caleb at crome.org
Fri Oct 30 19:10:28 CET 2015


On Fri, Oct 30, 2015 at 8:49 AM, Nicolin Chen <nicoleotsuka at gmail.com> wrote:
> On Fri, Oct 30, 2015 at 09:29:02AM +0100, arnaud.mouiche at invoxia.com wrote:
>
>> At imx50 age, I remember one workaround was to fill the fifo
>> manually, writing directly a number of samples (equal to the number
>> of slots for one frame to keep the synchronization), and then,
>> enable the TMDAE.
>> This just allow to not have to wait an undefined period of time for
>> the DMA to be ready.
>> But, on the other hand, if the time to wait the DMA is short enough,
>> it should not be an issue.
>
> Nice input. This reminds me of the zero-filling step inside the
> ESAI startup procedure:
>
>         case SNDRV_PCM_TRIGGER_START:
>         case SNDRV_PCM_TRIGGER_RESUME:
>         case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
>                 regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx),
>                                    ESAI_xFCR_xFEN_MASK, ESAI_xFCR_xFEN);
>
>                 /* Write initial words reqiured by ESAI as normal procedure */
>                 for (i = 0; tx && i < channels; i++)
>                         regmap_write(esai_priv->regmap, REG_ESAI_ETDR, 0x0);
>
>                 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
>                                    tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
>                                    tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
>                 break;
>
> It's exactly the same thing to prevent underrun. This might be
> a reasonable alternative option due to no polling overhead and
> timeout handling.
>
> Thanks
> Nicolin

Interesting, but in the SSI case, the # channels can easily be larger
than the fifo size.  For example, I'm using 16 channels, and the fifo
size is only 15.  Of course, with the dual fifo enabled, then this
restriction is eased to a maximum # of slots of 30.

I'll do a quick check this morning with Nicolin's suggested patch, and
see how many loops it needs to poll before the fifo gets a word.  My
suspicion is that Nicolin's hunch is correct: that is,  that the
context switch provides enough time for the DMA to push a word.

Will check back shortly.

Then, we'll have the problem that Arnaud bring up -- when starting the
Rx after Tx, we will have fresh new problems.  In fact, I'm 100% sure
we will -- I already see it with a portaudio program that must bring
up tx and rx separately.  I think I'll start a new thread for that
problem once this one is put to bed.

-Caleb


More information about the Alsa-devel mailing list