USB microphone does not get the required bandwidth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

With kernel 4.20.8 as well as 5.0-rc6 I have the following problem.
I have an AT2020USBi microphone from audio-technica. This is a full speed USB 
device which supports 24 bit audio at up to 96 kHz. Although the hardware is 
only mono it requestes a wMaxPacketSize of 576 corresponding to 24 bit stereo 
at 96 kHz. According to my understanding this is compliant to the USB 2.0 
specification, because up to 80% of the bandwidth can be used for iso 
transfers. However the linux kernel does not grant this bandwidth although it 
is the only device connected to one port of a USB 2.0 hub. It reports:
usb 2-1.3: cannot submit urb 0, error -28: not enough bandwidth

I checked the logic in iso_stream_schedule and sitd_slot_ok from drivers/usb/
host/ehci-sched.c and found the following.
- The desired packet size fits into 4 uframes.
- The variables are calculated to hs_transfers = 4 and stream->ps.cs_mask = 
0xFC01 (line 1110).
- Searching for a suitable slot starts in iso_stream_schedule.
- Uframe 7 and 6 are not used. "if ((start % 8) >= 6) continue;" line 1530
- Uframe 5 to 1 are rejected, because the condition "mask & ~0xffff" in line 
1411 ist not met.
- Uframe 0 does not work, because there is alredy some reserved bandwith and 
tt_available fails.

I am not sure about the intended behavior of the code. If I apply the 
following change then the transfer is scheduled for uframe 5 to 2 and the 
microphone works well.

diff -up linux-4.20.8/drivers/usb/host/ehci-sched.c linux-4.20.8.new/drivers/
usb/host/ehci-sched.c
--- linux-4.20.8/drivers/usb/host/ehci-sched.c  2019-01-31 08:15:47.000000000 
+0100
+++ linux-4.20.8.new/drivers/usb/host/ehci-sched.c      2019-02-13 
22:05:10.622284415 +0100
@@ -1408,7 +1408,7 @@ sitd_slot_ok(
                return 0;
 
        /* for IN, don't wrap CSPLIT into the next frame */
-       if (mask & ~0xffff)
+       if (mask & ~0x3ffff)
                return 0;
 
        /* check bandwidth */

This is the relevant information sent by the microphone and captured with 
wireshark.

Class-specific Audio Streaming Interface Descriptor: Format type descriptor
    bLength: 20
    bDescriptorType: 0x24 (audio class interface)
    Subtype: Format type descriptor (0x02)
    FormatType: 1
    Number Channels: 2
    Subframe Size: 3
    Bit Resolution: 24
    Samples Frequence Type: 4
    Samples Frequence: 32000
    Samples Frequence: 44100
    Samples Frequence: 48000
    Samples Frequence: 96000
ENDPOINT DESCRIPTOR
    bLength: 9
    bDescriptorType: 0x05 (ENDPOINT)
    bEndpointAddress: 0x82  IN  Endpoint:2
    bmAttributes: 0x0d
    wMaxPacketSize: 576
    bInterval: 1

Best regards,
Michael Häckel






[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux