On Fri, Oct 30, 2015 at 09:29:02AM +0100, arnaud.mouiche@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