/* * open/close dma daudio0->hdmi */ static int sunxi_i2s_set_daudio0_to_hdmi(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { dma_daudio0_to_hdmi_en = ucontrol->value.integer.value[0]; if (dma_daudio0_to_hdmi_en) { daudio0_set_clk(); sunxi_snd_rxctrl_daudio0(NULL, 1); daudio2_hdmi_spdif_en(1, 0); } else { sunxi_snd_rxctrl_daudio0(NULL, 0); daudio2_hdmi_spdif_en(0, 0); } return 0; }
static int sunxi_daudio0_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { int ret = 0; u32 reg_val; 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_daudio0(substream, 1); } else { sunxi_snd_txctrl_daudio0(substream, 1,0); } /*Global Enable Digital Audio Interface*/ reg_val = sunxi_smc_readl(sunxi_daudio.regs + SUNXI_DAUDIOCTL); reg_val |= SUNXI_DAUDIOCTL_GEN; if (daudio0_loop_en) { reg_val |= SUNXI_DAUDIOCTL_LOOP; /*for test*/ } sunxi_smc_writel(reg_val, sunxi_daudio.regs + SUNXI_DAUDIOCTL); 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_daudio0(substream, 0); } else { sunxi_snd_txctrl_daudio0(substream, 0,0); } break; default: ret = -EINVAL; break; } return ret; }