aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-03-04 00:35:43 -0500
committerIngo Molnar <mingo@kernel.org>2015-03-04 00:35:43 -0500
commitd2c032e3dc58137a7261a7824d3acce435db1d66 (patch)
tree7eea1c7c6103eefe879f07472eec99b3c41eb792 /sound/core/pcm_native.c
parent7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78 (diff)
parent13a7a6ac0a11197edcd0f756a035f472b42cdf8b (diff)
Merge tag 'v4.0-rc2' into x86/asm, to refresh the tree
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 095d9572ad2b..279e24f61305 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -26,6 +26,7 @@
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/pm_qos.h> 27#include <linux/pm_qos.h>
28#include <linux/aio.h> 28#include <linux/aio.h>
29#include <linux/io.h>
29#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
30#include <sound/core.h> 31#include <sound/core.h>
31#include <sound/control.h> 32#include <sound/control.h>
@@ -34,7 +35,6 @@
34#include <sound/pcm_params.h> 35#include <sound/pcm_params.h>
35#include <sound/timer.h> 36#include <sound/timer.h>
36#include <sound/minors.h> 37#include <sound/minors.h>
37#include <asm/io.h>
38 38
39/* 39/*
40 * Compatibility 40 * Compatibility
@@ -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);
@@ -719,8 +720,11 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
719 runtime->status->audio_tstamp; 720 runtime->status->audio_tstamp;
720 goto _tstamp_end; 721 goto _tstamp_end;
721 } 722 }
723 } else {
724 /* get tstamp only in fallback mode and only if enabled */
725 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
726 snd_pcm_gettime(runtime, &status->tstamp);
722 } 727 }
723 snd_pcm_gettime(runtime, &status->tstamp);
724 _tstamp_end: 728 _tstamp_end:
725 status->appl_ptr = runtime->control->appl_ptr; 729 status->appl_ptr = runtime->control->appl_ptr;
726 status->hw_ptr = runtime->status->hw_ptr; 730 status->hw_ptr = runtime->status->hw_ptr;
@@ -806,7 +810,8 @@ static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream)
806 if (runtime->trigger_master == NULL) 810 if (runtime->trigger_master == NULL)
807 return; 811 return;
808 if (runtime->trigger_master == substream) { 812 if (runtime->trigger_master == substream) {
809 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); 813 if (!runtime->trigger_tstamp_latched)
814 snd_pcm_gettime(runtime, &runtime->trigger_tstamp);
810 } else { 815 } else {
811 snd_pcm_trigger_tstamp(runtime->trigger_master); 816 snd_pcm_trigger_tstamp(runtime->trigger_master);
812 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; 817 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp;
@@ -975,6 +980,7 @@ static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
975 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 980 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
976 !snd_pcm_playback_data(substream)) 981 !snd_pcm_playback_data(substream))
977 return -EPIPE; 982 return -EPIPE;
983 runtime->trigger_tstamp_latched = false;
978 runtime->trigger_master = substream; 984 runtime->trigger_master = substream;
979 return 0; 985 return 0;
980} 986}
@@ -1546,6 +1552,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
1546 if (! snd_pcm_playback_empty(substream)) { 1552 if (! snd_pcm_playback_empty(substream)) {
1547 snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); 1553 snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING);
1548 snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); 1554 snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING);
1555 } else {
1556 runtime->status->state = SNDRV_PCM_STATE_SETUP;
1549 } 1557 }
1550 break; 1558 break;
1551 case SNDRV_PCM_STATE_RUNNING: 1559 case SNDRV_PCM_STATE_RUNNING:
@@ -1566,6 +1574,13 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
1566 snd_pcm_post_stop(substream, new_state); 1574 snd_pcm_post_stop(substream, new_state);
1567 } 1575 }
1568 } 1576 }
1577
1578 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
1579 runtime->trigger_master == substream &&
1580 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER))
1581 return substream->ops->trigger(substream,
1582 SNDRV_PCM_TRIGGER_DRAIN);
1583
1569 return 0; 1584 return 0;
1570} 1585}
1571 1586