From: Stefan Hajnoczi <[email protected]>

The .trigger() pcm callbacks are not allowed to block and cannot wait
until urbs have completed.  We need to ensure that stopping, preparing,
and then restarting a stream always works.

Currently the driver will sometimes return -EBUSY when restarting the
stream because urbs have not completed yet.  This can be triggered by
jackd from userspace.

The solution is to wait on urbs in the .prepare() pcm callback since
blocking is allowed in that callback.  This guarantees that all urbs are
quiesced and ready to be submitted when the start trigger callback is
invoked.

Signed-off-by: Stefan Hajnoczi <[email protected]>
---
 pcm.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/pcm.c b/pcm.c
index 7e3a5f0..7ca6451 100644
--- a/pcm.c
+++ b/pcm.c
@@ -491,6 +491,20 @@ int snd_line6_prepare(struct snd_pcm_substream *substream)
 {
        struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
 
+       switch (substream->stream) {
+       case SNDRV_PCM_STREAM_PLAYBACK:
+               line6_unlink_wait_clear_audio_out_urbs(line6pcm);
+               break;
+
+       case SNDRV_PCM_STREAM_CAPTURE:
+               line6_unlink_wait_clear_audio_in_urbs(line6pcm);
+               break;
+
+       default:
+               MISSING_CASE;
+       }
+
+
        if (!test_and_set_bit(BIT_PREPARED, &line6pcm->flags)) {
                line6pcm->count_out = 0;
                line6pcm->pos_out = 0;
-- 
1.7.7.3


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Line6linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/line6linux-devel

Reply via email to