[alsa-devel] [PATCH 5/5] ASoC: DaVinci: pcm, fix underruns by using sram
Troy Kisky
troy.kisky at boundarydevices.com
Fri Aug 7 04:05:54 CEST 2009
Troy Kisky wrote:
> Fix underruns by using dma to copy 1st to sram
> in a ping/pong buffer style and then copying from
> the sram to the ASP. This also has the advantage
> of tolerating very long interrupt latency on dma
> completion.
>
> Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
> static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
> {
> + struct snd_dma_buffer *iram_dma;
> struct davinci_runtime_data *prtd = substream->runtime->private_data;
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data;
> - struct edmacc_param p_ram;
> - int ret;
> + int lch;
>
> if (!dma_data)
> return -ENODEV;
>
> prtd->params = dma_data;
>
> - /* Request master DMA channel */
> - ret = edma_alloc_channel(prtd->params->channel,
> - davinci_pcm_dma_irq, substream,
> - EVENTQ_0);
> - if (ret < 0)
> - return ret;
> - prtd->asp_master_lch = ret;
> + /* Request asp master DMA channel */
> + lch = prtd->asp_master_lch = edma_alloc_channel(dma_data->channel,
> + davinci_pcm_dma_irq, substream, EVENTQ_0);
> + if (lch < 0)
> + goto exit1;
>
> - /* Request parameter RAM reload slot */
> - ret = edma_alloc_slot(EDMA_CTLR(prtd->asp_master_lch), EDMA_SLOT_ANY);
> - if (ret < 0) {
> - edma_free_channel(prtd->asp_master_lch);
> - return ret;
> - }
> - prtd->asp_link_lch[0] = ret;
> + /* Request asp link channels */
> + lch = prtd->asp_link_lch[0] = edma_alloc_slot(
> + EDMA_CTLR(prtd->asp_master_lch), EDMA_SLOT_ANY);
> + if (lch < 0)
> + goto exit2;
> +
> + allocate_sram(substream, dma_data->sram_size);
This is allocated too late for the "ensure that buffer size is a multiple of period size"
constraint.
I have a patch after fixing other feedback.
Troy
More information about the Alsa-devel
mailing list