Hi Pavel,

On 10/11/2019 9:54 AM, Minas Harutyunyan wrote:
> Hi Pavel,
> 
> On 10/10/2019 8:36 PM, Pavel Hofman wrote:
>> I forgot version information - branch 5.3
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_raspberrypi_linux_tree_rpi-2D5.3.y_drivers_usb_dwc2&d=DwICBA&c=DPL6_X_6JkXFx7AXWqB0tg&r=cQBKt4q-qzNVC53rNAwuwplH23V61rHQhhULvdLA0U8&m=roVTrb8UpajEEelBpJicBEnDNjj4_Ee8-BPoSHmYa-8&s=6Ijfw31Oy-ep8P8YzooBpOpciF5CLCBeGj7iYuXzQMQ&e=
>> with latest version of
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_torvalds_linux_blob_master_drivers_usb_dwc2_gadget.c&d=DwICBA&c=DPL6_X_6JkXFx7AXWqB0tg&r=cQBKt4q-qzNVC53rNAwuwplH23V61rHQhhULvdLA0U8&m=roVTrb8UpajEEelBpJicBEnDNjj4_Ee8-BPoSHmYa-8&s=eEEdIx-XNzSx7PzLmt5XYWeoRfeqyI1W5aZLt2GNSok&e=
>> (i.e. only a few patches behind upstream master).
>>
>> Dne 10. 10. 19 v 18:33 Pavel Hofman napsal(a):
>>> Dear Mr. Harutyunyan,
>>>
>>> I am turning to you as the core developer of the dwc2 driver in linux.
>>> I would like to ask you for help with debugging the following issue:
>>>
>>> I would like to improve the g_audio gadget for RaspberryPi4 (the
>>> gadget alsa device stalls when no USB communication occurs + a few
>>> other issues but this is not important now).
>>>
>>> EP IN works perfectly, I could pass audio 768kHz/3 bytes/3 channels
>>> which is the maximum for one endpoint (768/8 * 3 * 3 = 864 bytes every
>>> 125us frame)
>>>
>>> But for EP OUT, every g_audio configuration creating USB packet size >
>>> 900 bytes (approx) results in dwc2/gadget.c not passing any data to
>>> the audio function (req->actual is always zero).
>>>
>>> For interval=8 (bInterval = 4, i.e. data every 1ms):
>>>
>>> * 32kHz/1byte/28 channels = 896 bytes packet size -> working perfect,
>>> bitperfect transmission
>>>
>>> * 32kHz/1byte/29 channels = 928 bytes packet size -> no data passed to
>>> g_audio.c (dwc2_hsotg_handle_outdone() is never called in
>>> dwc2_hsotg_epint()
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_torvalds_linux_blob_master_drivers_usb_dwc2_gadget.c-23L3039&d=DwICBA&c=DPL6_X_6JkXFx7AXWqB0tg&r=cQBKt4q-qzNVC53rNAwuwplH23V61rHQhhULvdLA0U8&m=roVTrb8UpajEEelBpJicBEnDNjj4_Ee8-BPoSHmYa-8&s=wMRtUtO5zFAK062HmVWxGAVxbpX9h9wlpzJaQU_URkg&e=
>>> )
>>>
>>> I tried for different packet sizes, every setup below 900 bytes works,
>>> every setup above 900 bytes does not work.
>>>
>>> Tested with host x86 linux PC and USB loopback on the same RPi (from
>>> the other USB onboard controller), exactly same behavior for both hosts.
>>>
>>> It looks as if the DWC2 considers all isochronous packets with size >
>>> 900 bytes as incomplete. I do not have a hardware USB analyzer, but
>>> wireshark on the host PC shows the packets are properly passed to the
>>> USB controller in linux.
>>>
>>>
>>> I found a DWC2 datasheet at
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.intel.com_content_www_us_en_programmable_documentation_sfo1410144425160.html&d=DwICBA&c=DPL6_X_6JkXFx7AXWqB0tg&r=cQBKt4q-qzNVC53rNAwuwplH23V61rHQhhULvdLA0U8&m=roVTrb8UpajEEelBpJicBEnDNjj4_Ee8-BPoSHmYa-8&s=bHXds7A-CT3K5jg2C8JX8Gvcl2Yy-ojtuLM5Z4AkrFc&e=
>>> .
>>>
>>> I can provide any debugging information, debugfs of the dwc2 module,
>>> kernel dynamic debug traces etc.
>>>
>>> RPi4 would make a great audio device if the gadget mode worked
>>> reliably. I can fix/code the alsa device issues, but USB core is above
>>> my skills.
>>>
>>> Thank you very much in advance.
>>>
>>> Best regards,
>>>
>>> Pavel Hofman.
> 
> First of all I'll prefer communicate via Linux-usb mailing list
> <linux-usb@vger.kernel.org>. Let's keep this mailing list address in CC.
> And one more thing, keep on the beginning of subject follow string:
> "usb: dwc2:"
> 
> Thank you for your email. I'll dedicate time on the next week to debug
> your case.
> 
> Thanks,
> Minas
> 
Could you please send regdump and debug log for failing case.

Thanks,
Minas

Reply via email to