Skip to content

Commit 13a9883

Browse files
korochentiwai
authored andcommitted
ALSA: pcm: Modify double acknowledged interrupts check condition
Currently in snd_pcm_update_hw_ptr0 during interrupt, we consider there were double acknowledged interrupts when: 1. HW reported pointer is smaller than expected, and 2. Time from last update time (hdelta) is over half a buffer time. However, when HW reported pointer is only a few bytes smaller than expected, and when hdelta is just a little larger than half a buffer time (e.g. ping-pong buffer), it wrongly treats this IRQ as double acknowledged. The condition #2 uses jiffies, but jiffies is not high resolution since it is integer. We should consider jiffies inaccuracy. Signed-off-by: Koro Chen <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5a6cc82 commit 13a9883

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/core/pcm_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
339339
if (delta > new_hw_ptr) {
340340
/* check for double acknowledged interrupts */
341341
hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
342-
if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
342+
if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
343343
hw_base += runtime->buffer_size;
344344
if (hw_base >= runtime->boundary) {
345345
hw_base = 0;

0 commit comments

Comments
 (0)