aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/pcm-indirect2.c
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/drivers/pcm-indirect2.c
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/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,
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}