aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/asound.h4
-rw-r--r--sound/core/pcm.c2
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/core/pcm_native.c8
4 files changed, 12 insertions, 6 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 069d9120e622..3eaf155b850d 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -354,8 +354,8 @@ struct snd_pcm_hw_params {
354 354
355enum { 355enum {
356 SNDRV_PCM_TSTAMP_NONE = 0, 356 SNDRV_PCM_TSTAMP_NONE = 0,
357 SNDRV_PCM_TSTAMP_MMAP, 357 SNDRV_PCM_TSTAMP_ENABLE,
358 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, 358 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
359}; 359};
360 360
361struct snd_pcm_sw_params { 361struct snd_pcm_sw_params {
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 1502acd81a18..9dd9bc73fe1d 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -227,7 +227,7 @@ static char *snd_pcm_subformat_names[] = {
227 227
228static char *snd_pcm_tstamp_mode_names[] = { 228static char *snd_pcm_tstamp_mode_names[] = {
229 TSTAMP(NONE), 229 TSTAMP(NONE),
230 TSTAMP(MMAP), 230 TSTAMP(ENABLE),
231}; 231};
232 232
233static const char *snd_pcm_stream_name(int stream) 233static const char *snd_pcm_stream_name(int stream)
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index ed0223ca5c55..1533f0379e9d 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -144,6 +144,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre
144{ 144{
145 snd_pcm_uframes_t pos; 145 snd_pcm_uframes_t pos;
146 146
147 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
148 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
147 pos = substream->ops->pointer(substream); 149 pos = substream->ops->pointer(substream);
148 if (pos == SNDRV_PCM_POS_XRUN) 150 if (pos == SNDRV_PCM_POS_XRUN)
149 return pos; /* XRUN */ 151 return pos; /* XRUN */
@@ -186,8 +188,6 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs
186 snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; 188 snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt;
187 snd_pcm_sframes_t delta; 189 snd_pcm_sframes_t delta;
188 190
189 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP)
190 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp);
191 pos = snd_pcm_update_hw_ptr_pos(substream, runtime); 191 pos = snd_pcm_update_hw_ptr_pos(substream, runtime);
192 if (pos == SNDRV_PCM_POS_XRUN) { 192 if (pos == SNDRV_PCM_POS_XRUN) {
193 xrun(substream); 193 xrun(substream);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index e6e4aa87e57e..62449117ee14 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -580,9 +580,15 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
580 if (status->state == SNDRV_PCM_STATE_OPEN) 580 if (status->state == SNDRV_PCM_STATE_OPEN)
581 goto _end; 581 goto _end;
582 status->trigger_tstamp = runtime->trigger_tstamp; 582 status->trigger_tstamp = runtime->trigger_tstamp;
583 if (snd_pcm_running(substream)) 583 if (snd_pcm_running(substream)) {
584 snd_pcm_update_hw_ptr(substream); 584 snd_pcm_update_hw_ptr(substream);
585 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
586 status->tstamp = runtime->status->tstamp;
587 goto _tstamp_end;
588 }
589 }
585 snd_pcm_gettime(runtime, &status->tstamp); 590 snd_pcm_gettime(runtime, &status->tstamp);
591 _tstamp_end:
586 status->appl_ptr = runtime->control->appl_ptr; 592 status->appl_ptr = runtime->control->appl_ptr;
587 status->hw_ptr = runtime->status->hw_ptr; 593 status->hw_ptr = runtime->status->hw_ptr;
588 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 594 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {