static int sunxi_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_START); return 0; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_STOP); return 0; } } else { switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_START); return 0; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_STOP); return 0; } } return 0; }
static int sunxi_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: return snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_START); case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: return snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_STOP); default: return -EINVAL; } }
int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct tegra_pcm_dma_params * dmap; struct tegra_runtime_data *prtd; if (rtd->dai_link->no_pcm) return 0; dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); prtd = (struct tegra_runtime_data *) snd_dmaengine_pcm_get_data(substream); if (!dmap) return 0; switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: prtd->running = 1; if (prtd->disable_intr) { substream->runtime->dma_addr = prtd->avp_dma_addr; substream->runtime->no_period_wakeup = 1; } else { substream->runtime->no_period_wakeup = 0; } return snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_START); case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: prtd->running = 0; return snd_dmaengine_pcm_trigger(substream, SNDRV_PCM_TRIGGER_STOP); default: return -EINVAL; } return 0; }