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 <[email protected]>
>  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

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to