linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: Pavel Hofman <pavel.hofman@ivitera.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: usb: dwc2: Re: Maximum packet size in dwc2 gadget HS mode < 1024
Date: Fri, 11 Oct 2019 05:54:44 +0000	[thread overview]
Message-ID: <97fed6c8-e780-021f-4f93-64701a14bc3f@synopsys.com> (raw)
In-Reply-To: <52dc70dc-86e4-c47a-ae49-1f201b066b2e@ivitera.com>

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


       reply	other threads:[~2019-10-11  5:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3496ebef-c3b6-d884-8bd8-fed48e875b10@ivitera.com>
     [not found] ` <52dc70dc-86e4-c47a-ae49-1f201b066b2e@ivitera.com>
2019-10-11  5:54   ` Minas Harutyunyan [this message]
2019-10-11  7:45     ` usb: dwc2: Re: Maximum packet size in dwc2 gadget HS mode < 1024 Minas Harutyunyan
2019-10-13 18:39       ` Pavel Hofman
2019-10-24  6:33         ` Pavel Hofman
2019-10-24 12:47           ` Minas Harutyunyan
     [not found]             ` <5f7cc638-ed27-8f8f-95db-c1b198ebb8f5@ivitera.com>
2019-11-05 11:30               ` Minas Harutyunyan
2019-11-05 12:10                 ` Pavel Hofman
2019-11-05 13:27                   ` Minas Harutyunyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97fed6c8-e780-021f-4f93-64701a14bc3f@synopsys.com \
    --to=minas.harutyunyan@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pavel.hofman@ivitera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).