Bug 15788

Summary: external usb sound card doesn't work after resume
Product: Drivers Reporter: François Valenduc (francoisvalenduc)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: CLOSED CODE_FIX    
Severity: normal CC: maciej.rutecki, Martin, power-management_other, rjw, stern
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.34-rc2 (or maybe already 2.6.34-rc1) Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216, 15310    
Attachments: output of dmesg
Outputs of dmesg and ubsmon
Unbind interfaces before resume is finished

Description François Valenduc 2010-04-15 10:16:23 UTC
My external usb sound card doesn't work after resume. What is strange is that it appears in lsusb output but not in aplay -l. I am using tuxonice but the problem also occurs with the suspend-to-disk functionality of the mainline kernel.
Comment 1 François Valenduc 2010-04-15 10:41:00 UTC
Created attachment 26010 [details]
output of dmesg

You can find the output of dmesg after hibernating and resuming. I tought that the lines "snd-usb-audio 3-2:1.0: no reset_resume for driver snd-usb-audio? were a problem. However, it also occurs with kernel 2.6.33.2 and my sound card works  after resume with this kernel.
Comment 2 François Valenduc 2010-05-05 16:46:21 UTC
This bug is already 20 olds and nobody seems to have seen it. I can use a workaround and unload the uhci-hcd module and load it after resume, but this is not needed with kernel 2.6.33 and I confirm that it occurs also with the default suspend-to disk implementation.
Comment 3 Martin Steigerwald 2010-05-31 19:56:57 UTC
I can confirm this on 2.6.34 while it works with 2.6.33.1 on my Amarok jukebox ThinkPad T23 with (from lsusb -v). I use TuxOnIce with hibernate, but I doubt its related to TuxOnIce and I can test with in-kernel-snapshotting or userspace software suspend as well.

Bus 001 Device 004: ID 0763:2007 Midiman M-Audio Sonica Theater
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0763 Midiman
  idProduct          0x2007 M-Audio Sonica Theater
  bcdDevice            1.01
  iManufacturer           1 M-Audio
  iProduct                2 Sonica Theater
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          871
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
[... please tell if you need more ...]


I get the following in syslog:

May 31 16:14:48 localhost kernel: usb 1-1: USB disconnect, address 2
May 31 16:14:57 localhost kernel: usb 1-1: new full speed USB device using uhci_hcd and address 3
May 31 16:14:58 localhost kernel: usb 1-1: New USB device found, idVendor=0763, idProduct=2007
May 31 16:14:58 localhost kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 31 16:14:58 localhost kernel: usb 1-1: Product: Sonica Theater
May 31 16:14:58 localhost kernel: usb 1-1: Manufacturer: M-Audio
May 31 18:41:41 localhost kernel: usb usb1: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb2: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb3: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb4: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb5: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb6: root hub lost power or was reset
May 31 18:41:41 localhost kernel: usb usb4: USB disconnect, address 1
May 31 18:41:41 localhost kernel: usb 4-1: USB disconnect, address 2
May 31 18:41:41 localhost kernel: usb 1-1: reset full speed USB device using uhci_hcd and address 3
May 31 18:41:41 localhost kernel: usb usb5: USB disconnect, address 1
May 31 18:41:41 localhost kernel: usb usb6: USB disconnect, address 1
May 31 18:41:41 localhost kernel: usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
May 31 18:41:41 localhost kernel: usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
May 31 18:41:41 localhost kernel: usb usb4: Product: OHCI Host Controller
May 31 18:41:41 localhost kernel: usb usb4: Manufacturer: Linux 2.6.34-tp23-toi-3.1-04981-gb9a071a ohci_hcd
May 31 18:41:41 localhost kernel: usb usb4: SerialNumber: 0000:03:00.0

And then IMHO most importantly:

May 31 18:41:41 localhost kernel: snd-usb-audio 1-1:1.0: no reset_resume for driver snd-usb-audio?
May 31 18:41:41 localhost kernel: snd-usb-audio 1-1:1.1: no reset_resume for driver snd-usb-audio?
May 31 18:41:41 localhost kernel: snd-usb-audio 1-1:1.2: no reset_resume for driver snd-usb-audio?

With

deepdance:~> cat /proc/version
Linux version 2.6.34-tp23-toi-3.1-04981-gb9a071a (martin@deepdance) (gcc version 4.4.4 (Debian 4.4.4-1) ) #1 PREEMPT 
2010

which is mainline 2.6.34 except for TuxOnIce from Nigel Cunningham 2.6.34 git repo at http://git.kernel.org

I have to unplug and replug the sound card in order for Phonon to recognize it again. At least this seems to work with

deepdance:~> apt-show-versions | egrep "(^phonon|amarok$|kdelibs5/)"
kdelibs5/squeeze uptodate 4:4.4.3-2
phonon/squeeze uptodate 4:4.6.0really4.4.1-2
phonon-backend-gstreamer/squeeze uptodate 4:4.6.0really4.4.1-2
phonon-backend-xine/squeeze uptodate 4:4.6.0really4.4.1-2

using the xine plugin of it.

Expected results:

As with 2.6.33 for which I removed unloading of the usbaudio module hack that I had in my hibernate script configuration, playback should resume on resume from a snapshot cycle. I am initiating a playback cycle without stopping Amarok.
Comment 4 Martin Steigerwald 2010-05-31 20:01:38 UTC
Hmmm, overread that "no reset_resume for driver snd-usb-audio?" appear for 2.6.33.2 as well. Well then I have no idea.
Comment 5 Martin Steigerwald 2010-06-03 10:42:18 UTC
I did go back to 2.6.33.1 and at the moment have more important things to do. Is there someone else who experiences this bug who still runs 2.6.34 and can have a quick look? Or someone who has time to install 2.6.34 again and look?

BTW the module unloading trick did not work. Thats why I downgraded to 2.6.33.1 again. I am using hibernate script with TuxOnIce.

Re: [linux-pm] [regression] Please add bug 15788 and 15969, usb sound / radeon kms broken after snapshot cycle
From: Oliver Neukum <oneukum@suse.de>  (SUSE)
To: linux-pm@lists.linux-foundation.org
Cc: Martin Steigerwald <Martin@lichtvoll.de>, "Rafael J. Wysocki" <rjw@sisk.pl>, linux-kernel@vger.kernel.org
Date: Dienstag 10:02:59
[...]
    
Am Montag, 31. Mai 2010 22:15:04 schrieb Martin Steigerwald:
> 
> Hi Rafael,
> 
> please add
> 
> Bug 15788 -  external usb sound card doesn't work after resume
> https://bugzilla.kernel.org/show_bug.cgi?id=15788

Does it show up in /proc/asound/cards ?

        Regards
                Oliver
Comment 6 Alan Stern 2010-06-03 13:58:24 UTC
François, can you obtain usbmon traces under both 2.6.33 and 2.6.34?  The differences might explain why one works and the other does not.  The instructions for usbmon are in Documentation/usb/usbmon.txt.

At the same time, you should keep the dmesg logs from the two tests, and attach them along with the usbmon output.  Use a kernel with CONFIG_USB_DEBUG enabled.
Comment 7 François Valenduc 2010-06-03 18:52:26 UTC
Created attachment 26637 [details]
Outputs of dmesg and ubsmon

So, as you asked, you can find in this attachment the outputs of dmesg and usbmon under 2.6.33 and 2.6.34. I captured the usbmon traces by only listening at the bus corresponding to the usb audio card. Is it sufficient or should I also try with all buses ?
Comment 8 Alan Stern 2010-06-04 15:39:34 UTC
Created attachment 26650 [details]
Unbind interfaces before resume is finished

Good, I think I see what the problem is.  Try out this patch; it ought to make things work the same as they did in 2.6.33.
Comment 9 François Valenduc 2010-06-04 16:20:17 UTC
This patch indeed solves my problem.

Thanks for your help.
Comment 10 Martin Steigerwald 2010-06-06 11:07:36 UTC
Thanks, Alan and François. Alan, did you push this for inclusion in stable patches for 2.6.34 already? Or do you need another tester? I can give the patch a spin in the next days I think.
Comment 11 Alan Stern 2010-06-06 11:15:11 UTC
On Sun, 6 Jun 2010 bugzilla-daemon@bugzilla.kernel.org wrote:

> Thanks, Alan and François. Alan, did you push this for inclusion in stable
> patches for 2.6.34 already? Or do you need another tester? I can give the
> patch
> a spin in the next days I think.

It has already been accepted for 2.6.35; it's probably in 2.6.35-rc2 (I 
haven't checked).  When the next 2.6.34 stable release is issued, the 
patch should be in there too.

Alan Stern
Comment 12 Rafael J. Wysocki 2010-06-13 12:14:24 UTC
Fixed by commit c043f1245654a726925529007210e9f786426448 .