summaryrefslogtreecommitdiff
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-08-18 16:16:54 +0400
committerTakashi Iwai <tiwai@suse.de>2010-08-18 17:18:02 +0400
commitbd76af0f87f7a1815b311bde269a3f18305b3169 (patch)
tree27f95b3e568146eed0958989f3f8d0c4eae3616b /sound/core/pcm_native.c
parente7cfbea9cb7a02ea29fdae5d39c9e3d09102c4d5 (diff)
downloadlinux-bd76af0f87f7a1815b311bde269a3f18305b3169.tar.xz
ALSA: pcm midlevel code - add time check for double interrupt acknowledge
The current code in pcm_lib.c do all checks using only the position in the ring buffer. Unfortunately, where the interrupts gets delayed or merged into one, we need another timing source to check when the buffer size boundary overlaps to avoid the wrong updating of the ring buffer pointers. This code uses jiffies to check the right time window without any performance impact. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 134fc6c2e08d..e2e73895db12 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -864,6 +864,8 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state)
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream);
runtime->hw_ptr_jiffies = jiffies;
+ runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) /
+ runtime->rate;
runtime->status->state = state;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
runtime->silence_size > 0)