/[linux-patches]/genpatches-2.6/tags/2.6.15-4/1028_2_usb-audio-hang.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.15-4/1028_2_usb-audio-hang.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 288 - (show annotations) (download)
Tue Jan 31 11:46:46 2006 UTC (12 years, 5 months ago) by dsd
File size: 2471 byte(s)
2.6.15-4 release
1 From stable-bounces@linux.kernel.org Thu Jan 12 00:48:57 2006
2 Date: Thu, 12 Jan 2006 09:44:29 +0100
3 Message-id: <20060112084429.GA18332@turing.informatik.uni-halle.de>
4 From: Clemens Ladisch <clemens@ladisch.de>
5 To: stable@kernel.org
6 Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@lists.sourceforge.net
7 Subject: [PATCH] usb-audio: don't use empty packets at start of playback
8
9 Some widespread USB interface chips with adaptive iso endpoints hang
10 after receiving a series of empty packets when they expect data. This
11 completely disables audio playback on those devices. To avoid this, we
12 have to send packets containing silence (zero samples) instead.
13
14 ALSA bug: http://bugtrack.alsa-project.org/alsa-bug/view.php?id=1585
15
16 Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
17 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19 ---
20 sound/usb/usbaudio.c | 26 +++++++++++++++++++++-----
21 1 file changed, 21 insertions(+), 5 deletions(-)
22
23 --- linux-2.6.15.1.orig/sound/usb/usbaudio.c
24 +++ linux-2.6.15.1/sound/usb/usbaudio.c
25 @@ -480,22 +480,38 @@ static int retire_playback_sync_urb_hs(s
26 /*
27 * Prepare urb for streaming before playback starts.
28 *
29 - * We don't care about (or have) any data, so we just send a transfer delimiter.
30 + * We don't yet have data, so we send a frame of silence.
31 */
32 static int prepare_startup_playback_urb(snd_usb_substream_t *subs,
33 snd_pcm_runtime_t *runtime,
34 struct urb *urb)
35 {
36 - unsigned int i;
37 + unsigned int i, offs, counts;
38 snd_urb_ctx_t *ctx = urb->context;
39 + int stride = runtime->frame_bits >> 3;
40
41 + offs = 0;
42 urb->dev = ctx->subs->dev;
43 urb->number_of_packets = subs->packs_per_ms;
44 for (i = 0; i < subs->packs_per_ms; ++i) {
45 - urb->iso_frame_desc[i].offset = 0;
46 - urb->iso_frame_desc[i].length = 0;
47 + /* calculate the size of a packet */
48 + if (subs->fill_max)
49 + counts = subs->maxframesize; /* fixed */
50 + else {
51 + subs->phase = (subs->phase & 0xffff)
52 + + (subs->freqm << subs->datainterval);
53 + counts = subs->phase >> 16;
54 + if (counts > subs->maxframesize)
55 + counts = subs->maxframesize;
56 + }
57 + urb->iso_frame_desc[i].offset = offs * stride;
58 + urb->iso_frame_desc[i].length = counts * stride;
59 + offs += counts;
60 }
61 - urb->transfer_buffer_length = 0;
62 + urb->transfer_buffer_length = offs * stride;
63 + memset(urb->transfer_buffer,
64 + subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0,
65 + offs * stride);
66 return 0;
67 }
68

  ViewVC Help
Powered by ViewVC 1.1.20