summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorKoro Chen <koro.chen@mediatek.com>2015-05-13 17:39:03 +0300
committerTakashi Iwai <tiwai@suse.de>2015-05-19 10:32:29 +0300
commit13a988396cab68e6c6afd33e461a9e52ce23ff63 (patch)
tree546fd85f5d70daee71117ae79a1a7cb556ac6881 /sound/core
parent5a6cc82171dba297ceab49cda47f2bf5616f87b3 (diff)
downloadlinux-13a988396cab68e6c6afd33e461a9e52ce23ff63.tar.xz
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 <koro.chen@mediatek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index ac6b33f3779c..7d45645f10ba 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -339,7 +339,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
if (delta > new_hw_ptr) {
/* check for double acknowledged interrupts */
hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
- if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
+ if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
hw_base += runtime->buffer_size;
if (hw_base >= runtime->boundary) {
hw_base = 0;