aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_lib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 92ed6d819225..063c675177a9 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -221,8 +221,11 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
221 new_hw_ptr = hw_base + pos; 221 new_hw_ptr = hw_base + pos;
222 hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; 222 hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;
223 delta = new_hw_ptr - hw_ptr_interrupt; 223 delta = new_hw_ptr - hw_ptr_interrupt;
224 if (hw_ptr_interrupt == runtime->boundary) 224 if (hw_ptr_interrupt >= runtime->boundary) {
225 hw_ptr_interrupt = 0; 225 hw_ptr_interrupt %= runtime->boundary;
226 if (!hw_base) /* hw_base was already lapped; recalc delta */
227 delta = new_hw_ptr - hw_ptr_interrupt;
228 }
226 if (delta < 0) { 229 if (delta < 0) {
227 delta += runtime->buffer_size; 230 delta += runtime->buffer_size;
228 if (delta < 0) { 231 if (delta < 0) {
@@ -233,6 +236,8 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
233 (long)hw_ptr_interrupt); 236 (long)hw_ptr_interrupt);
234 /* rebase to interrupt position */ 237 /* rebase to interrupt position */
235 hw_base = new_hw_ptr = hw_ptr_interrupt; 238 hw_base = new_hw_ptr = hw_ptr_interrupt;
239 /* align hw_base to buffer_size */
240 hw_base -= hw_base % runtime->buffer_size;
236 delta = 0; 241 delta = 0;
237 } else { 242 } else {
238 hw_base += runtime->buffer_size; 243 hw_base += runtime->buffer_size;