From 0d9ab4fdaeb2a433ab6d5a66bd4b8d7c8df67c86 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Thu, 12 Jan 2006 19:44:19 -0800 Subject: [PATCH] Add usb audio fix for silenced sb live, from Clemens Ladisch --- queue/series | 1 + ...e-empty-packets-at-start-of-playback.patch | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 queue/series create mode 100644 queue/usb-audio-dont-use-empty-packets-at-start-of-playback.patch diff --git a/queue/series b/queue/series new file mode 100644 index 00000000000..dde6a13c4e9 --- /dev/null +++ b/queue/series @@ -0,0 +1 @@ +usb-audio-dont-use-empty-packets-at-start-of-playback.patch diff --git a/queue/usb-audio-dont-use-empty-packets-at-start-of-playback.patch b/queue/usb-audio-dont-use-empty-packets-at-start-of-playback.patch new file mode 100644 index 00000000000..7a217bae5d9 --- /dev/null +++ b/queue/usb-audio-dont-use-empty-packets-at-start-of-playback.patch @@ -0,0 +1,68 @@ +From stable-bounces@linux.kernel.org Thu Jan 12 00:48:57 2006 +Date: Thu, 12 Jan 2006 09:44:29 +0100 +Message-id: <20060112084429.GA18332@turing.informatik.uni-halle.de> +From: Clemens Ladisch +To: stable@kernel.org +Cc: Takashi Iwai , alsa-devel@lists.sourceforge.net +Subject: [PATCH] usb-audio: don't use empty packets at start of playback + +Some widespread USB interface chips with adaptive iso endpoints hang +after receiving a series of empty packets when they expect data. This +completely disables audio playback on those devices. To avoid this, we +have to send packets containing silence (zero samples) instead. + +ALSA bug: http://bugtrack.alsa-project.org/alsa-bug/view.php?id=1585 + +Signed-off-by: Clemens Ladisch +Signed-off-by: Chris Wright +--- + + sound/usb/usbaudio.c | 26 +++++++++++++++++++++----- + 1 files changed, 21 insertions(+), 5 deletions(-) + +--- linux-2.6.15.y.orig/sound/usb/usbaudio.c ++++ linux-2.6.15.y/sound/usb/usbaudio.c +@@ -480,22 +480,38 @@ static int retire_playback_sync_urb_hs(s + /* + * Prepare urb for streaming before playback starts. + * +- * We don't care about (or have) any data, so we just send a transfer delimiter. ++ * We don't yet have data, so we send a frame of silence. + */ + static int prepare_startup_playback_urb(snd_usb_substream_t *subs, + snd_pcm_runtime_t *runtime, + struct urb *urb) + { +- unsigned int i; ++ unsigned int i, offs, counts; + snd_urb_ctx_t *ctx = urb->context; ++ int stride = runtime->frame_bits >> 3; + ++ offs = 0; + urb->dev = ctx->subs->dev; + urb->number_of_packets = subs->packs_per_ms; + for (i = 0; i < subs->packs_per_ms; ++i) { +- urb->iso_frame_desc[i].offset = 0; +- urb->iso_frame_desc[i].length = 0; ++ /* calculate the size of a packet */ ++ if (subs->fill_max) ++ counts = subs->maxframesize; /* fixed */ ++ else { ++ subs->phase = (subs->phase & 0xffff) ++ + (subs->freqm << subs->datainterval); ++ counts = subs->phase >> 16; ++ if (counts > subs->maxframesize) ++ counts = subs->maxframesize; ++ } ++ urb->iso_frame_desc[i].offset = offs * stride; ++ urb->iso_frame_desc[i].length = counts * stride; ++ offs += counts; + } +- urb->transfer_buffer_length = 0; ++ urb->transfer_buffer_length = offs * stride; ++ memset(urb->transfer_buffer, ++ subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0, ++ offs * stride); + return 0; + } + -- 2.47.3