diff options
author | Libin Yang <libin.yang@intel.com> | 2014-12-31 14:09:54 (GMT) |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-12-31 16:10:08 (GMT) |
commit | 48d882978eb0a15547093b4542a82b5c22548041 (patch) | |
tree | 814d122dc9b7d6076ecb49229ba27b3bd94d3401 /sound/core/pcm_native.c | |
parent | 0d02e1292715d00674a49626146e3a854b504cb1 (diff) | |
download | linux-48d882978eb0a15547093b4542a82b5c22548041.tar.xz |
ALSA: pcm: add SNDRV_PCM_TRIGGER_DRAIN trigger
Add SNDRV_PCM_TRIGGER_DRAIN trigger for pcm drain.
Some audio devices require notification of drain events
in order to properly drain and shutdown an audio stream.
Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 095d957..ff3abc3 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -420,7 +420,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, hw = &substream->runtime->hw; if (!params->info) { - params->info = hw->info & ~SNDRV_PCM_INFO_FIFO_IN_FRAMES; + params->info = hw->info & ~(SNDRV_PCM_INFO_FIFO_IN_FRAMES | + SNDRV_PCM_INFO_DRAIN_TRIGGER); if (!hw_support_mmap(substream)) params->info &= ~(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID); @@ -1566,6 +1567,13 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) snd_pcm_post_stop(substream, new_state); } } + + if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && + runtime->trigger_master == substream && + (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) + return substream->ops->trigger(substream, + SNDRV_PCM_TRIGGER_DRAIN); + return 0; } |