[alsa-devel] 3.5-rc1 snd_usb_audio stream format breakage

Takashi Iwai tiwai at suse.de
Thu Jun 7 09:45:40 CEST 2012


At Thu, 7 Jun 2012 03:38:30 +0000,
Jamie Heilman wrote:
> 
> With the USB audio streaming logic changes, my HeadRoom Bithead
> (08bb:2902 Burr-Brown PCM2902) no longer works.  Symptoms include the
> loss of most of the normally available formats leaving only:
> 
> root at cucamonga:~# cat /proc/asound/bithead/stream0 
> Burr-Brown from TI USB Audio CODEC at usb-0000:00:1a.7-1.1.4, full speed : USB Audio
> 
> Playback:
>   Status: Stop
>   Interface 1
>     Altset 6
>     Format: U8
>     Channels: 1
>     Endpoint: 2 OUT (ADAPTIVE)
>     Rates: 32000, 44100, 48000
> 
> Capture:
>   Status: Stop
>   Interface 2
>     Altset 18
>     Format: S8
>     Channels: 1
>     Endpoint: 4 IN (SYNC)
>     Rates: 11025
> 
> (normally 2 channel S16_LE is available, with capture rates up to
> 48kHz ... only the last altset's are being reported now) and a slew of
> proc registration warnings logged:
> 
> ------------[ cut here ]------------
> WARNING: at fs/proc/generic.c:586 proc_register+0x169/0x1a6()
> Hardware name: Precision WorkStation T3400  
> proc_dir_entry 'card1/pcm0p' already registered
> Modules linked in: snd_usb_audio(+) snd_usbmidi_lib snd_hda_intel(+) snd_hda_codec snd_hwdep snd_seq_midi snd_seq_midi_event snd_pcm snd_page_alloc snd_rawmidi snd_seq snd_seq_device snd_timer snd soundcore dcdbas floppy sr_mod usb_storage cdrom kvm_intel psmouse kvm tg3 evdev xfs dm_mod raid1 md_mod
> Pid: 1152, comm: modprobe Not tainted 3.5.0-rc1-00110-g71fae7e #2
> Call Trace:
>  [<ffffffff8102a400>] warn_slowpath_common+0x83/0x9c
>  [<ffffffff8102a4bc>] warn_slowpath_fmt+0x46/0x48
>  [<ffffffff813829ad>] ? add_preempt_count+0x39/0x3b
>  [<ffffffff811292f0>] proc_register+0x169/0x1a6
>  [<ffffffff8112962e>] create_proc_entry+0x74/0x8c
>  [<ffffffffa018eb63>] snd_info_register+0x3e/0xc3 [snd]
>  [<ffffffffa01fde2e>] snd_pcm_new_stream+0xb1/0x404 [snd_pcm]
>  [<ffffffffa024861f>] snd_usb_add_audio_stream+0xd2/0x230 [snd_usb_audio]
>  [<ffffffffa0241d33>] ? snd_usb_parse_audio_format+0x252/0x34f [snd_usb_audio]
>  [<ffffffff810d6b17>] ? kmem_cache_alloc_trace+0xab/0xbb
>  [<ffffffffa0248c29>] snd_usb_parse_audio_interface+0x4ac/0x567 [snd_usb_audio]
>  [<ffffffffa023f0ff>] snd_usb_create_stream+0xe9/0x125 [snd_usb_audio]
>  [<ffffffffa023f9b1>] usb_audio_probe+0x62a/0x72c [snd_usb_audio]
>  [<ffffffff812c49f5>] usb_probe_interface+0x136/0x1b1
>  [<ffffffff81287e66>] ? driver_probe_device+0x1d3/0x1d3
>  [<ffffffff81287d43>] driver_probe_device+0xb0/0x1d3
>  [<ffffffff81287ec5>] __driver_attach+0x5f/0x83
>  [<ffffffff812863a2>] bus_for_each_dev+0x54/0x86
>  [<ffffffff81287730>] driver_attach+0x1e/0x20
>  [<ffffffff8128747f>] bus_add_driver+0xfd/0x23a
>  [<ffffffff812882e8>] driver_register+0x93/0x10e
>  [<ffffffff812c383f>] usb_register_driver+0x7e/0x12a
>  [<ffffffffa0257000>] ? 0xffffffffa0256fff
>  [<ffffffffa0257000>] ? 0xffffffffa0256fff
>  [<ffffffffa0257040>] snd_usb_audio_init+0x40/0x1000 [snd_usb_audio]
>  [<ffffffff810001ff>] do_one_initcall+0x7f/0x134
>  [<ffffffffa0257000>] ? 0xffffffffa0256fff
>  [<ffffffff810688d4>] sys_init_module+0x16cf/0x195e
>  [<ffffffff8106516c>] ? free_notes_attrs+0x4d/0x4d
>  [<ffffffff810c38cb>] ? mmap_region+0x1c7/0x469
>  [<ffffffff813856d2>] system_call_fastpath+0x16/0x1b
> ---[ end trace c1baea1a25a91564 ]---

Looks like the PCM substream assignment is buggy.
Does the patch (untested at all) below help?


thanks,

Takashi

---
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 0d37238..2b9ffff 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -119,6 +119,7 @@ struct snd_usb_substream {
 	unsigned long unlink_mask;	/* bitmask of unlinked urbs */
 
 	/* data and sync endpoints for this stream */
+	unsigned int ep_num;		/* the endpoint number */
 	struct snd_usb_endpoint *data_endpoint;
 	struct snd_usb_endpoint *sync_endpoint;
 	unsigned long flags;
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 6b7d7a2..083ed81 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -97,6 +97,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
 	subs->formats |= fp->formats;
 	subs->num_formats++;
 	subs->fmt_type = fp->fmt_type;
+	subs->ep_num = fp->endpoint;
 }
 
 /*
@@ -119,9 +120,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
 		if (as->fmt_type != fp->fmt_type)
 			continue;
 		subs = &as->substream[stream];
-		if (!subs->data_endpoint)
-			continue;
-		if (subs->data_endpoint->ep_num == fp->endpoint) {
+		if (subs->ep_num == fp->endpoint) {
 			list_add_tail(&fp->list, &subs->fmt_list);
 			subs->num_formats++;
 			subs->formats |= fp->formats;
@@ -134,7 +133,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
 		if (as->fmt_type != fp->fmt_type)
 			continue;
 		subs = &as->substream[stream];
-		if (subs->data_endpoint)
+		if (subs->ep_num)
 			continue;
 		err = snd_pcm_new_stream(as->pcm, stream, 1);
 		if (err < 0)


More information about the Alsa-devel mailing list