summaryrefslogtreecommitdiffstats
path: root/sound/drivers/pcm-indirect2.c
diff options
context:
space:
mode:
authorJoachim Foerster <JOFT@gmx.de>2007-11-05 15:48:36 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:29:15 +0100
commitdddefd0d706da7d981e8e397231df257f0122a49 (patch)
treea34207d65501763dfdf91c34d724af7bb83774a9 /sound/drivers/pcm-indirect2.c
parent[ALSA] Xilinx ML403 AC97 Controller Reference device driver (diff)
downloadlinux-dddefd0d706da7d981e8e397231df257f0122a49.tar.xz
linux-dddefd0d706da7d981e8e397231df257f0122a49.zip
[ALSA] [ML403-AC97CR] Fix capture/periodic overrun bug
We have to do fairly accurate counting of the minimal periods, instead of being lazy and just setting the number to zero as soon as one period elapses. Signed-off-by: Joachim Foerster <JOFT@gmx.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/drivers/pcm-indirect2.c')
-rw-r--r--sound/drivers/pcm-indirect2.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sound/drivers/pcm-indirect2.c b/sound/drivers/pcm-indirect2.c
index 6a829cd03dde..660157d49422 100644
--- a/sound/drivers/pcm-indirect2.c
+++ b/sound/drivers/pcm-indirect2.c
@@ -403,7 +403,7 @@ snd_pcm_indirect2_playback_interrupt(struct snd_pcm_substream *substream,
rec->min_multiple);
rec->mul_elapsed++;
#endif
- rec->min_periods = 0;
+ rec->min_periods = (rec->min_periods % rec->min_multiple);
snd_pcm_period_elapsed(substream);
}
}
@@ -568,24 +568,8 @@ snd_pcm_indirect2_capture_interrupt(struct snd_pcm_substream *substream,
rec->mul_elapsed_real += (rec->min_periods /
rec->min_multiple);
rec->mul_elapsed++;
-
- if (!(rec->mul_elapsed % 4)) {
- struct snd_pcm_runtime *runtime = substream->runtime;
- unsigned int appl_ptr =
- frames_to_bytes(runtime,
- (unsigned int)runtime->control->
- appl_ptr) % rec->sw_buffer_size;
- int diff = rec->sw_data - appl_ptr;
- if (diff < 0)
- diff += rec->sw_buffer_size;
- snd_printk(KERN_DEBUG
- "STAT: mul_elapsed: %d, sw_data: %u, "
- "appl_ptr (bytes): %u, diff: %d\n",
- rec->mul_elapsed, rec->sw_data, appl_ptr,
- diff);
- }
#endif
- rec->min_periods = 0;
+ rec->min_periods = (rec->min_periods % rec->min_multiple);
snd_pcm_period_elapsed(substream);
}
}