[alsa-devel] [PATCH 3/7] ASoC: tegra: Add tegra-pcm driver

Peter Ujfalusi peter.ujfalusi at nokia.com
Tue Jan 11 08:59:00 CET 2011


On 01/08/11 07:36, ext Stephen Warren wrote:
> This provides an ASoC platform driver that manages Tegra's APB DMA
> controller.
> 
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
>  sound/soc/tegra/tegra_pcm.c |  401 +++++++++++++++++++++++++++++++++++++++++++
>  sound/soc/tegra/tegra_pcm.h |   55 ++++++
>  2 files changed, 456 insertions(+), 0 deletions(-)
>  create mode 100644 sound/soc/tegra/tegra_pcm.c
>  create mode 100644 sound/soc/tegra/tegra_pcm.h
> 
> diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c

...

> +       switch (cmd) {
> +       case SNDRV_PCM_TRIGGER_START:
> +               prtd->dma_pos = 0;
> +               prtd->dma_pos_end = frames_to_bytes(runtime, runtime->periods * runtime->period_size);
> +               prtd->period_index = 0;
> +               prtd->dma_req_idx = 0;
> +               /* Fall-through */
> +       case SNDRV_PCM_TRIGGER_RESUME:
> +       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> +               spin_lock_irqsave(&prtd->lock, flags);
> +               prtd->running = 1;
> +               spin_unlock_irqrestore(&prtd->lock, flags);
> +               tegra_pcm_queue_dma(prtd);
> +               tegra_pcm_queue_dma(prtd);
> +               break;
> +       case SNDRV_PCM_TRIGGER_STOP:
> +       case SNDRV_PCM_TRIGGER_SUSPEND:
> +       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> +               spin_lock_irqsave(&prtd->lock, flags);
> +               prtd->running = 0;
> +               spin_unlock_irqrestore(&prtd->lock, flags);
> +               tegra_dma_dequeue_req(prtd->dma_chan, &prtd->dma_req[0]);
> +               tegra_dma_dequeue_req(prtd->dma_chan, &prtd->dma_req[1]);

Does tegra_dma_dequeue_req stops the ongoing DMA transaction as well?
If I read the code right, you have two DMA requests placed at every
given time (one is currently running, the other is waiting).
What happens if the dma_req[0] was running, and you dequeue it? Will the
DMA engine moves to process the dma_req[1], which will be stopped a
moment later?

-- 
Péter


More information about the Alsa-devel mailing list