aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJoachim Foerster <JOFT@gmx.de>2007-11-05 09:48:36 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:15 -0500
commitdddefd0d706da7d981e8e397231df257f0122a49 (patch)
treea34207d65501763dfdf91c34d724af7bb83774a9 /sound
parenta9f00d8df2115b396f13ea74b835f18215a871cc (diff)
[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')
-rw-r--r--sound/drivers/ml403-ac97cr.c6
-rw-r--r--sound/drivers/pcm-indirect2.c20
2 files changed, 4 insertions, 22 deletions
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 22223152a34..c76a24e337f 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -28,11 +28,9 @@
28 * accesses to a minimum, because after a variable amount of accesses, the AC97 28 * accesses to a minimum, because after a variable amount of accesses, the AC97
29 * controller doesn't raise the register access finished bit anymore ... 29 * controller doesn't raise the register access finished bit anymore ...
30 * 30 *
31 * - Capture support works - basically, but after ~30s (with rates > ~20kHz)
32 * ALSA stops reading captured samples from the intermediate buffer and
33 * therefore a overrun happens - ATM I don't know what's wrong.
34 *
35 * - Playback support seems to be pretty stable - no issues here. 31 * - Playback support seems to be pretty stable - no issues here.
32 * - Capture support "works" now, too. Overruns don't happen any longer so often.
33 * But there might still be some ...
36 */ 34 */
37 35
38#include <sound/driver.h> 36#include <sound/driver.h>
diff --git a/sound/drivers/pcm-indirect2.c b/sound/drivers/pcm-indirect2.c
index 6a829cd03dd..660157d4942 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,
403 rec->min_multiple); 403 rec->min_multiple);
404 rec->mul_elapsed++; 404 rec->mul_elapsed++;
405#endif 405#endif
406 rec->min_periods = 0; 406 rec->min_periods = (rec->min_periods % rec->min_multiple);
407 snd_pcm_period_elapsed(substream); 407 snd_pcm_period_elapsed(substream);
408 } 408 }
409} 409}
@@ -568,24 +568,8 @@ snd_pcm_indirect2_capture_interrupt(struct snd_pcm_substream *substream,
568 rec->mul_elapsed_real += (rec->min_periods / 568 rec->mul_elapsed_real += (rec->min_periods /
569 rec->min_multiple); 569 rec->min_multiple);
570 rec->mul_elapsed++; 570 rec->mul_elapsed++;
571
572 if (!(rec->mul_elapsed % 4)) {
573 struct snd_pcm_runtime *runtime = substream->runtime;
574 unsigned int appl_ptr =
575 frames_to_bytes(runtime,
576 (unsigned int)runtime->control->
577 appl_ptr) % rec->sw_buffer_size;
578 int diff = rec->sw_data - appl_ptr;
579 if (diff < 0)
580 diff += rec->sw_buffer_size;
581 snd_printk(KERN_DEBUG
582 "STAT: mul_elapsed: %d, sw_data: %u, "
583 "appl_ptr (bytes): %u, diff: %d\n",
584 rec->mul_elapsed, rec->sw_data, appl_ptr,
585 diff);
586 }
587#endif 571#endif
588 rec->min_periods = 0; 572 rec->min_periods = (rec->min_periods % rec->min_multiple);
589 snd_pcm_period_elapsed(substream); 573 snd_pcm_period_elapsed(substream);
590 } 574 }
591} 575}