diff options
author | Libin Yang <libin.yang@intel.com> | 2014-12-31 09:09:54 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-12-31 11:10:08 -0500 |
commit | 48d882978eb0a15547093b4542a82b5c22548041 (patch) | |
tree | 814d122dc9b7d6076ecb49229ba27b3bd94d3401 /sound | |
parent | 0d02e1292715d00674a49626146e3a854b504cb1 (diff) |
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')
-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 095d9572ad2b..ff3abc3b4ff5 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, | |||
420 | 420 | ||
421 | hw = &substream->runtime->hw; | 421 | hw = &substream->runtime->hw; |
422 | if (!params->info) { | 422 | if (!params->info) { |
423 | params->info = hw->info & ~SNDRV_PCM_INFO_FIFO_IN_FRAMES; | 423 | params->info = hw->info & ~(SNDRV_PCM_INFO_FIFO_IN_FRAMES | |
424 | SNDRV_PCM_INFO_DRAIN_TRIGGER); | ||
424 | if (!hw_support_mmap(substream)) | 425 | if (!hw_support_mmap(substream)) |
425 | params->info &= ~(SNDRV_PCM_INFO_MMAP | | 426 | params->info &= ~(SNDRV_PCM_INFO_MMAP | |
426 | SNDRV_PCM_INFO_MMAP_VALID); | 427 | SNDRV_PCM_INFO_MMAP_VALID); |
@@ -1566,6 +1567,13 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) | |||
1566 | snd_pcm_post_stop(substream, new_state); | 1567 | snd_pcm_post_stop(substream, new_state); |
1567 | } | 1568 | } |
1568 | } | 1569 | } |
1570 | |||
1571 | if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && | ||
1572 | runtime->trigger_master == substream && | ||
1573 | (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) | ||
1574 | return substream->ops->trigger(substream, | ||
1575 | SNDRV_PCM_TRIGGER_DRAIN); | ||
1576 | |||
1569 | return 0; | 1577 | return 0; |
1570 | } | 1578 | } |
1571 | 1579 | ||