From: Daniel Mack <daniel@zonque.org>
To: Peter Chen <peter.chen@freescale.com>
Cc: balbi@ti.com, linux-usb@vger.kernel.org, andrzej.p@samsung.com,
tiwai@suse.de, stable@vger.kernel.org,
Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [PATCH v2 1/1] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth
Date: Thu, 23 Jul 2015 12:15:01 +0200 [thread overview]
Message-ID: <55B0BEA5.4000609@zonque.org> (raw)
In-Reply-To: <20150723083536.GB7115@shlinux2>
On 07/23/2015 10:35 AM, Peter Chen wrote:
> Assume the interval for each packet is 2ms, the rate is 192 kbytes
> for both FS & HS:
> uac2->p_interval = 2000;
> uac2->p_pktsize = 192 kbytes / 2000 = 96 bytes
>
> And the uac2->p_pktsize is real usb packet length, it means hardware
> would expect there are 96 bytes per 2ms, but the real frame rate is 192k,
> and it needs to 192 * 2 bytes per 2ms in the bus, am I missing
> something?
Hmm? The numerator in that division ('rate') includes the actual frame size:
rate = opts->p_srate * uac2->p_framesize;
uac2->p_pktsize = rate / uac2->p_interval;
Which means for 192KHz, stereo 16bit, rate is 768000. In this case,
bInterval = 4 doesn't work, as the packets would become >512 bytes, so
the bandwidth wouldn't suffice.
> Another think I am not understand is why playback uses IN endpoint?
> Don't this playback mean the data is from host, and play at device side?
That's a little confusing on first sight, but actually quite logical:
The ALSA capture stream is the one that allows applications on the
gadget to record audio, which is data that is sent *from* the host
(playback on their side) to the device, using OUT tokens.
The ALSA playback stream is the one that allows applications on the
gadget to playback audio, which is data that is sent *to* the host
(capture on their side) by the device, using IN tokens.
Thanks,
Daniel
next prev parent reply other threads:[~2015-07-23 10:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 6:45 [PATCH v2 1/1] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth Peter Chen
2015-07-22 8:04 ` Daniel Mack
2015-07-22 7:17 ` Peter Chen
2015-07-22 8:23 ` Peter Chen
2015-07-22 10:11 ` Daniel Mack
2015-07-23 1:00 ` Peter Chen
2015-07-23 6:11 ` Daniel Mack
2015-07-23 8:35 ` Peter Chen
2015-07-23 10:15 ` Daniel Mack [this message]
2015-07-23 20:09 ` Alan Stern
2015-07-23 21:02 ` Daniel Mack
2015-07-24 3:59 ` Peter Chen
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=55B0BEA5.4000609@zonque.org \
--to=daniel@zonque.org \
--cc=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@freescale.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tiwai@suse.de \
/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).