This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x g_audio gadget issue

Hi all,

On my AM335X evaluation board I'm trying to use g_audio gadget in order to export the internal audio codec to
the host PC. The insmod operation is ok, but when the USB link is detected I got a lot of "gadget: ep1out queue req: -108" errors. The audio codec is detected but not usable from the PC host:

root@am335x-evm:~#
root@am335x-evm:~# modprobe g_audio
[ 540.661682] gadget: Hardware params: access 3, format 2, channels 2, rate 48000
[ 540.669647] gadget: audio_buf_size 48000, req_buf_size 200, req_count 256
[ 540.676818] gadget: Linux USB Audio Gadget, version: Dec 18, 2008
[ 540.683319] gadget: g_audio ready
[ 540.686920] musb-hdrc musb-hdrc.0: MUSB HDRC host driver
[ 540.692535] musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 2
[ 540.700378] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 540.707489] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 540.714996] usb usb2: Product: MUSB HDRC host driver
[ 540.720184] usb usb2: Manufacturer: Linux 3.2.0 musb-hcd
[ 540.725738] usb usb2: SerialNumber: musb-hdrc.0
[ 540.731079] hub 2-0:1.0: USB hub found
[ 540.735015] hub 2-0:1.0: 1 port detected
root@am335x-evm:~# 
root@am335x-evm:~# [ 550.798522] gadget: high-speed config #1: Linux USB Audio Gadget
[ 550.805725] gadget: ep1out queue req: -108
[ 550.961212] gadget: ep1out queue req: -108
[ 550.965850] gadget: ep1out queue req: -108
[ 550.970520] gadget: ep1out queue req: -108
[ 550.975524] gadget: ep1out queue req: -108
[ 550.980529] gadget: ep1out queue req: -108
[ 550.985717] gadget: ep1out queue req: -108
[ 550.990386] gadget: ep1out queue req: -108
......
......


I'm using latest SDK (6.0.0.0).
Any suggestions?

Many thanks,
Andrea

  • Andrea,

    g_audio gadget is not validated and supported on AM335x Linux SDK.

    In a quick look of this '-108' error, I can tell in Line 577 in drivers/usb/gadget/f_audio.c when calling usb_ep_enable(out_ep), out_ep->desc is empty, which causes the error.

    But assigning ->desc to a proper data location does not make g_audio fully working - then I faced kernel OOPS due to g_audio does not tear down out_ep properly when playing with unplugging/plugging the USB cable and rmmod/insmod g_audio.ko.

  • Bin,

    I'm trying to investigate more deeply this issue.
    Could you please suggest me how to assigning ->desc to a proper data location?

    Regards,
    Andrea

     

  • Please try this:

    diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
    index ec7ffcd..871b0e6 100644
    --- a/drivers/usb/gadget/f_audio.c
    +++ b/drivers/usb/gadget/f_audio.c
    @@ -574,6 +574,7 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
     
            if (intf == 1) {
                    if (alt == 1) {
    +                       out_ep->desc = &as_out_ep_desc;
                            usb_ep_enable(out_ep);
                            out_ep->driver_data = audio;
                            audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);