diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-05-26 02:09:38 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-26 02:09:38 -0400 |
commit | f2b3614cefb61ee6046a0aaee503ee37f227d310 (patch) | |
tree | 4e43feacc58c629919d09bc6fd200ac0892d2cca /sound/core/pcm_native.c | |
parent | a331b0c3665506aa23bfc78c777199b30349d731 (diff) |
ALSA: PCM - Don't check DMA time-out too shortly
When the PCM period size is set larger than 10 seconds, currently the
PCM core may abort the operation with DMA-error due to the fixed timeout
for 10 seconds. A similar problem is seen in the drain operation that
has a fixed timeout of 10 seconds, too.
This patch fixes the timeout length depending on the period size and
rate, also including the consideration of no_period_wakeup flag.
Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 1a07750f3836..b597408d5faa 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1481,11 +1481,20 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1481 | break; /* all drained */ | 1481 | break; /* all drained */ |
1482 | init_waitqueue_entry(&wait, current); | 1482 | init_waitqueue_entry(&wait, current); |
1483 | add_wait_queue(&to_check->sleep, &wait); | 1483 | add_wait_queue(&to_check->sleep, &wait); |
1484 | set_current_state(TASK_INTERRUPTIBLE); | ||
1485 | snd_pcm_stream_unlock_irq(substream); | 1484 | snd_pcm_stream_unlock_irq(substream); |
1486 | up_read(&snd_pcm_link_rwsem); | 1485 | up_read(&snd_pcm_link_rwsem); |
1487 | snd_power_unlock(card); | 1486 | snd_power_unlock(card); |
1488 | tout = schedule_timeout(10 * HZ); | 1487 | if (runtime->no_period_wakeup) |
1488 | tout = MAX_SCHEDULE_TIMEOUT; | ||
1489 | else { | ||
1490 | tout = 10; | ||
1491 | if (runtime->rate) { | ||
1492 | long t = runtime->period_size * 2 / runtime->rate; | ||
1493 | tout = max(t, tout); | ||
1494 | } | ||
1495 | tout = msecs_to_jiffies(tout * 1000); | ||
1496 | } | ||
1497 | tout = schedule_timeout_interruptible(tout); | ||
1489 | snd_power_lock(card); | 1498 | snd_power_lock(card); |
1490 | down_read(&snd_pcm_link_rwsem); | 1499 | down_read(&snd_pcm_link_rwsem); |
1491 | snd_pcm_stream_lock_irq(substream); | 1500 | snd_pcm_stream_lock_irq(substream); |