static int atmel_abdac_trigger(struct snd_pcm_substream *substream, int cmd) { struct atmel_abdac *dac = snd_pcm_substream_chip(substream); int retval = 0; switch (cmd) { case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ case SNDRV_PCM_TRIGGER_START: clk_enable(dac->sample_clk); retval = dw_dma_cyclic_start(dac->dma.chan); if (retval) goto out; dac_writel(dac, CTRL, DAC_BIT(EN)); break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ case SNDRV_PCM_TRIGGER_STOP: dw_dma_cyclic_stop(dac->dma.chan); dac_writel(dac, DATA, 0); dac_writel(dac, CTRL, 0); clk_disable(dac->sample_clk); break; default: retval = -EINVAL; break; } out: return retval; }
static int atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd) { struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); unsigned long camr, ptcr = 0; int retval = 0; camr = ac97c_readl(chip, CAMR); ptcr = readl(chip->regs + ATMEL_PDC_PTSR); switch (cmd) { case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ case SNDRV_PCM_TRIGGER_START: if (cpu_is_at32ap7000()) { retval = dw_dma_cyclic_start(chip->dma.rx_chan); if (retval) goto out; } else { ptcr = ATMEL_PDC_RXTEN; } camr |= AC97C_CMR_CENA | AC97C_CSR_ENDRX; break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ case SNDRV_PCM_TRIGGER_STOP: if (cpu_is_at32ap7000()) dw_dma_cyclic_stop(chip->dma.rx_chan); else ptcr |= (ATMEL_PDC_RXTDIS); if (chip->opened <= 1) camr &= ~AC97C_CMR_CENA; break; default: retval = -EINVAL; break; } ac97c_writel(chip, CAMR, camr); if (!cpu_is_at32ap7000()) writel(ptcr, chip->regs + ATMEL_PDC_PTCR); out: return retval; }