static int sunxi_spdif_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { int ret = 0; switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { sunxi_snd_rxctrl(substream, 1); } else { sunxi_snd_txctrl(substream, 1); } break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { sunxi_snd_rxctrl(substream, 0); } else { sunxi_snd_txctrl(substream, 0); } break; default: ret = -EINVAL; break; } return ret; }
static int sunxi_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { 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: /*enable i2s tx*/ sunxi_snd_txctrl(substream, 1); return 0; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: sunxi_snd_txctrl(substream, 0); return 0; default: return -EINVAL; } } else { switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: sunxi_snd_rxctrl(substream, 1); return 0; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: sunxi_snd_rxctrl(substream, 0); return 0; default: pr_err("error:%s,%d\n", __func__, __LINE__); return -EINVAL; } } return 0; }