/* * hw free callback */ static int snd_tm6000_hw_free(struct snd_pcm_substream *substream) { struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); _tm6000_stop_audio_dma(chip); return 0; }
/* * trigger callback */ static void audio_trigger(struct work_struct *work) { struct tm6000_core *core = container_of(work, struct tm6000_core, wq_trigger); struct snd_tm6000_card *chip = core->adev; if (atomic_read(&core->stream_started)) { dprintk(1, "starting capture"); _tm6000_start_audio_dma(chip); } else { dprintk(1, "stopping capture"); _tm6000_stop_audio_dma(chip); } }
/* * trigger callback */ static int snd_tm6000_card_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); int err; spin_lock(&chip->reg_lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: err = _tm6000_start_audio_dma(chip); break; case SNDRV_PCM_TRIGGER_STOP: err = _tm6000_stop_audio_dma(chip); break; default: err = -EINVAL; break; } spin_unlock(&chip->reg_lock); return err; }