aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-04-28 06:07:08 -0400
committerTakashi Iwai <tiwai@suse.de>2009-04-28 09:10:16 -0400
commit3e5b50165fd0be080044586f43fcdd460ed27610 (patch)
tree54e6ed455de1f011b7da25234553c4b61f4a3f08 /sound/core
parent2008f137e92220b98120c4803499cdddb2b0fb06 (diff)
ALSA: pcm core - Avoid jiffies check for devices with BATCH flag
The hardware devices with SNDRV_PCM_INFO_BATCH flag can't give the precise current position. And such hardwares have often big FIFO in addition to the ring buffer, and it screws up the jiffies check in pcm_lib.c. This patch adds a simple check of info flag so that the driver skips the jiffies check in snd_pcm_period_elapsed() when BATCH flag is set. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_lib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 63d088f2265f..a2a792c18c40 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -249,6 +249,12 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
249 new_hw_ptr = hw_base + pos; 249 new_hw_ptr = hw_base + pos;
250 } 250 }
251 } 251 }
252 /* Skip the jiffies check for hardwares with BATCH flag.
253 * Such hardware usually just increases the position at each IRQ,
254 * thus it can't give any strange position.
255 */
256 if (runtime->hw.info & SNDRV_PCM_INFO_BATCH)
257 goto no_jiffies_check;
252 hdelta = new_hw_ptr - old_hw_ptr; 258 hdelta = new_hw_ptr - old_hw_ptr;
253 jdelta = jiffies - runtime->hw_ptr_jiffies; 259 jdelta = jiffies - runtime->hw_ptr_jiffies;
254 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { 260 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) {
@@ -272,6 +278,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
272 hw_base -= hw_base % runtime->buffer_size; 278 hw_base -= hw_base % runtime->buffer_size;
273 delta = 0; 279 delta = 0;
274 } 280 }
281 no_jiffies_check:
275 if (delta > runtime->period_size + runtime->period_size / 2) { 282 if (delta > runtime->period_size + runtime->period_size / 2) {
276 hw_ptr_error(substream, 283 hw_ptr_error(substream,
277 "Lost interrupts? " 284 "Lost interrupts? "