Bug 1214049

Summary: USB audio dies after idle
Product: [openSUSE] openSUSE Distribution Reporter: Aaron Williams <aaron.w2>
Component: KernelAssignee: openSUSE Kernel Bugs <kernel-bugs>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: aaron.w2, tiwai
Version: Leap 15.5   
Target Milestone: ---   
Hardware: Other   
OS: openSUSE Leap 15.5   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: lsusb -v output

Description Aaron Williams 2023-08-07 22:54:12 UTC
Created attachment 868666 [details]
lsusb -v output

After a recent kernel update within the past week or so I have been experiencing a problem where if audio is stopped for a while it will never restart when using a USB HID audio device.  In the logs I see the following:

usb_set_interface failed (-19)

I have swapped the cable and that made no difference.
Note that if audio is constantly active it will continue to work without issues.

[33346.442012] usb 7-4: New USB device found, idVendor=1852, idProduct=7022, bcdDevice= 0.01
[33346.442023] usb 7-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[33346.442027] usb 7-4: Product: DigiHug USB Audio
[33346.442031] usb 7-4: Manufacturer: GFEC ASSP
[33346.529561] input: GFEC ASSP DigiHug USB Audio as /devices/pci0000:40/0000:40:07.1/0000:45:00.3/usb7/7-4/7-4:1.0/0003:1852:7022.001B/input/input54
[33346.586066] hid-generic 0003:1852:7022.001B: input,hidraw11: USB HID v1.00 Device [GFEC ASSP DigiHug USB Audio] on usb-0000:45:00.3-4/input0
[33360.314128] usb 3-1.3.1: reset high-speed USB device number 36 using xhci_hcd

Note that the audio recovers if I unplug and reconnect the audio device.

It does not matter which application is generating the audio.

The USB audio device is also plugged directly into a motherboard USB port and not a hub.

Desktop is running KDE factory.
Kernel is 5.14.21-150400.24.74-default #1 SMP PREEMPT_DYNAMIC

I have a lot of USB devices connected.
Comment 1 Takashi Iwai 2023-08-08 06:56:17 UTC
Please give the dmesg output including the error.

Also, please try to boot with the older kernel that worked (while keeping the rest system as is), and verify whether the bug doesn't happen with it -- i.e. confirming it's a kernel regression.
Comment 2 Aaron Williams 2024-01-30 02:11:35 UTC
This seems to be related to Pulse Audio. If I restart Pulse Audio the audio returns. 

I have set the following but this does not seem to help:
allow-exit = no
exit-idle-time = -1

Note that I have a few other settings:
default-sample-format = s24le
alternate-sample-rate = 48000
default-sample-rate = 96000
resample-method = soxr-vhq
Comment 3 Takashi Iwai 2024-01-30 08:12:54 UTC
I guess it's rather a problem of the device (firmware) after the auto PM.
Keeping the stream from pulseaudio prevents the device being runtime-suspended, hence you can work around it by that.

Could you try to create the file /etc/modprobe.d/90-usb-audio.conf, including the following line, and retest?

options snd-usb-audio quirk_flags=0x200

If you have more than one USB audio devices on the machine, pass the value at the right position (or just pass multiples like 0x200,0x200).
Comment 4 Aaron Williams 2024-02-11 02:02:51 UTC
This made no difference.

I do not know why it is displaying so many fields. It never used to. The device only has one stereo output and no inputs.  Note that when I took this output this is after numerous instances of me unplugging and replugging it to restore audio support.  A year ago, I never had any issues with USB audio with this device, and it worked flawlessly. It's not a low-end audio device but a tube-based DAC.

From dmesg after plugging it in:
[95317.904587] usb 7-4: new full-speed USB device number 12 using xhci_hcd
[95318.144255] usb 7-4: New USB device found, idVendor=1852, idProduct=7022, bcdDevice= 0.01
[95318.144276] usb 7-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[95318.144286] usb 7-4: Product: DigiHug USB Audio
[95318.144295] usb 7-4: Manufacturer: GFEC ASSP
[95318.191593] input: GFEC ASSP DigiHug USB Audio as /devices/pci0000:40/0000:40:07.1/0000:45:00.3/usb7/7-4/7-4:1.0/0003:1852:7022.0016/input/input53
[95318.248916] hid-generic 0003:1852:7022.0016: input,hidraw0: USB HID v1.00 Device [GFEC ASSP DigiHug USB Audio] on usb-0000:45:00.3-4/input0

lsusb -v -d 1852:7022

Bus 007 Device 012: ID 1852:7022 GYROCOM C&C Co., LTD Fiio E10
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1852 GYROCOM C&C Co., LTD
  idProduct          0x7022 Fiio E10
  bcdDevice            0.01
  iManufacturer           1 GFEC ASSP
  iProduct                2 DigiHug USB Audio
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x01ac
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      58
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0012  1x 18 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              3 aune T1MK2 TUBE USB DAC
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x005c
        bInCollection           2
        baInterfaceNr(0)        2
        baInterfaceNr(1)        3
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0603 Line Connector
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             5
        wTerminalType      0x0605 SPDIF interface
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             9
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             3
        wTerminalType      0x0605 SPDIF interface
        bAssocTerminal          0
        bSourceID              16
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             7
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID              11
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                14
        bSourceID               1
        bControlSize            1
        bmaControls(0)       0x01
          Mute Control
        bmaControls(1)       0x02
          Volume Control
        bmaControls(2)       0x02
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                16
        bSourceID               9
        bControlSize            1
        bmaControls(0)       0x01
          Mute Control
        bmaControls(1)       0x02
          Volume Control
        bmaControls(2)       0x02
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                11
        bNrInPins               2
        baSourceID(0)          14
        baSourceID(1)           5
        iSelector               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           7
        bDelay                  0 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            6 Discrete
        tSamFreq[ 0]         8000
        tSamFreq[ 1]        16000
        tSamFreq[ 2]        32000
        tSamFreq[ 3]        44100
        tSamFreq[ 4]        48000
        tSamFreq[ 5]        96000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0184  1x 388 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0002
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           7
        bDelay                  0 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           3
        bBitResolution         24
        bSamFreqType            6 Discrete
        tSamFreq[ 0]         8000
        tSamFreq[ 1]        16000
        tSamFreq[ 2]        32000
        tSamFreq[ 3]        44100
        tSamFreq[ 4]        48000
        tSamFreq[ 5]        96000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0246  1x 582 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0002
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           9
        bDelay                  0 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            6 Discrete
        tSamFreq[ 0]         8000
        tSamFreq[ 1]        16000
        tSamFreq[ 2]        32000
        tSamFreq[ 3]        44100
        tSamFreq[ 4]        48000
        tSamFreq[ 5]        96000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0184  1x 388 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0002
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           9
        bDelay                  0 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           3
        bBitResolution         24
        bSamFreqType            6 Discrete
        tSamFreq[ 0]         8000
        tSamFreq[ 1]        16000
        tSamFreq[ 2]        32000
        tSamFreq[ 3]        44100
        tSamFreq[ 4]        48000
        tSamFreq[ 5]        96000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0246  1x 582 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0002
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           9
        bDelay                  0 frames
        wFormatTag         0x2001 IEC1937_AC-3
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             3 (FORMAT_TYPE_III)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c0  1x 192 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0002
Device Status:     0x0000
  (Bus Powered)
Comment 5 Aaron Williams 2024-02-11 02:07:05 UTC
I do not see any dmesg output when it fails.  I believe the issue might be related to Pulse Audio.  I attempted to switch to pipewire but had no luck with pipewire.

There are several other audio sinks, including a couple of HDMI monitors (connected to an Nvidia RTX3060) and the built-in motherboard audio.
Comment 6 Aaron Williams 2024-02-11 02:07:19 UTC
The other audio sinks are not used, however.
Comment 7 Aaron Williams 2024-02-11 02:23:59 UTC
Restarting pulseaudio fixes the issue as well, although this disables all KDE volume and media controls. I.e. pulseaudio -k; pulseaudio
Comment 8 Takashi Iwai 2024-02-11 09:58:24 UTC
Hm, if no kernel error appears (unlike the original description), it can be indeed an issue of user-space.
Suppose it's a PA bug, you can try the pulseaudio and related packages to the latest version from OBS multimedia:libs repo.

Alternatively, you can switch to pipewire, too.
Comment 9 Aaron Williams 2024-02-12 20:50:18 UTC
I get the following logs in Pulse Audio when it fails to resume:
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-sink.c:1165 unsuspend()] Trying resume...
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:297 pa_alsa_set_hw_params()] Cannot disable ALSA period wakeups
D: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:343 pa_alsa_set_hw_params()] Maximum hw buffer size is 2000 ms
D: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:357 pa_alsa_set_hw_params()] Set buffer size first (to 192000 samples), period size second (to 96000 samples).
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:432 pa_alsa_set_hw_params()] ALSA period wakeups were not disabled
W: [alsa-sink-USB Audio][../src/modules/alsa/alsa-sink.c:1234 unsuspend()] Resume failed, couldn't restore original fragment settings. (Old: 1152000/576000, New 576000/288000)
D: [pulseaudio][../src/modules/module-udev-detect.c:295 verify_access()] /dev/snd/controlC2 is accessible: yes
D: [pulseaudio][../src/modules/module-udev-detect.c:368 verify_access()] Resuming all sinks and sources of card alsa_card.usb-GFEC_ASSP_DigiHug_USB_Audio-01.
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-sink.c:1165 unsuspend()] Trying resume...
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:297 pa_alsa_set_hw_params()] Cannot disable ALSA period wakeups
D: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:343 pa_alsa_set_hw_params()] Maximum hw buffer size is 2000 ms
D: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:357 pa_alsa_set_hw_params()] Set buffer size first (to 192000 samples), period size second (to 96000 samples).
I: [alsa-sink-USB Audio][../src/modules/alsa/alsa-util.c:432 pa_alsa_set_hw_params()] ALSA period wakeups were not disabled
W: [alsa-sink-USB Audio][../src/modules/alsa/alsa-sink.c:1234 unsuspend()] Resume failed, couldn't restore original fragment settings. (Old: 1152000/576000, New 576000/288000)
I have not updated Pulse Audio beyond what is included in 15.5 yet.
Comment 10 Takashi Iwai 2024-02-13 07:00:19 UTC
Is the result with quirk_flags?
And you see no error in kernel log, right?

You can upgrade to the latest pipewire & co from my update repo for Leap 15.5, OBS home:tiwai:leap-15.5:update.  This contains only the sound-related packages, so relatively safe to use.  The following commands will replace PulseAudio with pipewire:
  zypper ar obs://home:/tiwai:/leap-15.5:/update/standard sound-update
  zypper ref sound-update
  zypper in -r sound-update pipewire-pulseaudio

For reverting back to pulseaudio, install pulseaudio forcibly, instead:
  zypper in -f pulseaudio
Comment 11 Aaron Williams 2024-05-07 00:34:34 UTC
This problem was never solved and appears to be a bug in Pulse Audio.  I managed to switch to Pipewire and the problem does not exist with Pipewire.
Comment 12 Takashi Iwai 2024-05-07 05:29:14 UTC
The behavior differs slightly between PA and PW, maybe PA opens in different sample rates or such hardware configuration that screws up the device.

As there is a known workaround and it's a device-specific issue, I close the bug for now.  Feel free to reopen when it hits again.