All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Schmottlach <gschmottlach@gmail.com>
To: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Cc: Peter Chen <peter.chen@nxp.com>,
	"balbi@kernel.org" <balbi@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH 0/3] UAC2 Gadget: feedback endpoint support
Date: Fri, 13 Nov 2020 10:35:10 -0500	[thread overview]
Message-ID: <CAMS2kBF5Gvhnf7AzdeSFeVeWBLhtHM_hHfTvMLTN-3Jkh=BwHw@mail.gmail.com> (raw)
In-Reply-To: <CAB=otbSAGhDYxim9_fsyH4pZCLqgq+bxNJfv5hXqgQRVngVaig@mail.gmail.com>

On Thu, Nov 12, 2020 at 6:20 PM Ruslan Bilovol <ruslan.bilovol@gmail.com> wrote:
>
> On Wed, Nov 11, 2020 at 11:30 AM Peter Chen <peter.chen@nxp.com> wrote:
> >
> > On 20-11-08 02:18:28, Ruslan Bilovol wrote:
> > > Current UAC2 gadget implements capture/sync paths
> > > as two USB ISO ASYNC endpoints (IN and OUT).
> > >
> > > This violates USB spec which says that ISO ASYNC OUT endpoint
> > > should have feedback companion endpoint.
> > > See USB2.0 spec  "5.12.4.1 Synchronization Type": asynchronous
> > > sink provides explicit feedback (isochronous pipe).
> > > Interesting that for ISO ASYNC *IN* endpoint respective
> > > feedback isn't required since source provides implicit
> > > feedforward (data stream).
> > >
> > > While it's not an issue if UAC2 Gadget is connected to
> > > Linux host (Linux ignores missing feedback endpoint),
> > > with other hosts like Windows or MacOS the UAC2 Gadget
> > > isn't enumerated due to missing feedback endpoint.
> > >
> > > This patch series adds feedback endpoint support to
> > > UAC2 function, new control to UAC2 mixer which can
> > > be used by userspace tools (like alsaloop from alsa-utils)
> > > for updating feedback frequency reported to the host.
> > > This is useful for usecases when UAC2 Gadget's audio
> > > samples are played to another codec or audio card
> > > with its own internal freerunning clock so host can
> > > be notified that more/less samples are required.
> > >
> > > The alsaloop tool requires some (relatively small)
> > > modifications in order to start support driving
> > > feedback frequency through UAC2 mixer control.
> > > That change will be sent as a separate patch
> > > to ALSA community.
> > >
> > > Also added ability to switch ISO ASYNC OUT endpoint into
> > > adaptive endpoint which doesn't require feedback endpoint
> > > (as per USB spec).
> > >
> > > Ruslan Bilovol (3):
> > >   usb: gadget: f_uac2/u_audio: add feedback endpoint support
> > >   usb: gadget: f_uac2: add adaptive sync support for capture
> > >   usb: gadget: u_audio: add real feedback implementation
> >
> > Hi Ruslan,
> >
> > I applied your patches, but WIN10 still can't recognize it well.
> > The UAC1 is OK for WIN10 with the below same configuration.
> > Any debug information you would like to know to check it?
> >
> >
> > if [ "$FUNC" == "uac2" ]; then
> > mkdir functions/$FUNC".0"
> > echo 2 > functions/$FUNC".0"/p_ssize
> > echo 48000 > functions/$FUNC".0"/p_srate
> > echo 3 > functions/$FUNC".0"/p_chmask
> >
> > echo 2 > functions/$FUNC".0"/c_ssize
> > echo 48000 > functions/$FUNC".0"/c_srate
> > echo 3 > functions/$FUNC".0"/c_chmask
> > #echo 4 > functions/$FUNC".0"/req_number
> > ln -s functions/$FUNC".0" configs/c.1
> > echo high-speed > /sys/kernel/config/usb_gadget/g1/max_speed
> > fi
> >
>
> Hmm... I just tested below config and it works fine with my Win10.
> The only thing I noticed is Windows doesn't enable UAC2 gadget
> by default, but this can be done from Win10 sound settings
>
> --------------------------------->8--------------------------------------
> mkdir cfg
> mount none cfg -t configfs
> mkdir cfg/usb_gadget/g1
> cd cfg/usb_gadget/g1
> mkdir configs/c.1
> mkdir functions/uac2.0
>
> # 44.1 kHz sample rate
> echo 44100 > functions/uac2.0/c_srate
> echo 44100 > functions/uac2.0/p_srate
>
> mkdir strings/0x409
> mkdir configs/c.1/strings/0x409
> echo 0x0101 > idProduct
> echo 0x1d6b > idVendor
> echo my-serial-num > strings/0x409/serialnumber
> echo my-manufacturer > strings/0x409/manufacturer
> echo "Test gadget" > strings/0x409/product
> echo "Conf 1" > configs/c.1/strings/0x409/configuration
> echo 120 > configs/c.1/MaxPower
> ln -s functions/uac2.0 configs/c.1
> echo musb-hdrc.0 > UDC
> --------------------------------->8--------------------------------------
>
> Thanks,
> Ruslan

Hi Ruslan -

With your configuration (above) Win10 was able to recognize and load
the driver. What appears to prevent my configuration from loading is
the fact that I selected 48K as my sample rate and my capture/playback
channel mask includes more than two (2) channels. If I take your
configuration and change the sample rate (c_srate/p_srate) to 48000
Windows will fail to load the driver. Likewise, setting the
c_chmask/p_chmask to 7 (three channels) will also cause the driver to
fail to load.

You mentioned there is an option in Win10 Sound Settings to "enable"
UAC2 by default. I cannot find that option and I wonder if this is
what is preventing me from changing the sample rate or channel mask?
Could Windows be treating my audio gadget as a UAC1 device rather than
a fully multi-channel audio device (even though the usbaudio2.sys
driver is loaded)? Have you tried other configurations to verify your
Win10 box supports more than two channels and a 44.1K sample rate? I
look forward to your feedback and any suggestions you might offer.

Thanks,

Glenn

  reply	other threads:[~2020-11-13 15:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08  0:18 [PATCH 0/3] UAC2 Gadget: feedback endpoint support Ruslan Bilovol
2020-11-08  0:18 ` [PATCH 1/3] usb: gadget: f_uac2/u_audio: add " Ruslan Bilovol
2020-11-11  9:26   ` Peter Chen
2020-11-12 22:41     ` Ruslan Bilovol
2020-11-08  0:18 ` [PATCH 2/3] usb: gadget: f_uac2: add adaptive sync support for capture Ruslan Bilovol
2020-11-11  9:18   ` Peter Chen
2020-11-12 22:39     ` Ruslan Bilovol
2020-11-26 11:13   ` Jerome Brunet
2020-12-04 14:03     ` Ruslan Bilovol
2020-11-08  0:18 ` [PATCH 3/3] usb: gadget: u_audio: add real feedback implementation Ruslan Bilovol
2020-11-09  8:24   ` Pavel Hofman
2020-11-09  8:25     ` Pavel Hofman
2020-11-12 11:26     ` Pavel Hofman
2020-11-11  9:30 ` [PATCH 0/3] UAC2 Gadget: feedback endpoint support Peter Chen
2020-11-12 23:20   ` Ruslan Bilovol
2020-11-13 15:35     ` Glenn Schmottlach [this message]
2020-11-22 19:51       ` Ruslan Bilovol
2020-11-25 19:28         ` Glenn Schmottlach
2020-11-28 23:26           ` Ruslan Bilovol
2020-12-01 21:43             ` Glenn Schmottlach
2020-12-02 22:04               ` Glenn Schmottlach
2020-12-03 10:09                 ` Peter Chen
2020-12-03 22:07                   ` Glenn Schmottlach
2020-12-10 12:59                   ` Ruslan Bilovol
2020-12-11  7:22                     ` Peter Chen
2020-12-10 12:46               ` Ruslan Bilovol
2020-11-26 13:16         ` Jerome Brunet
2020-11-26 13:44           ` Pavel Hofman
2020-12-04 14:39             ` Ruslan Bilovol
2020-12-04 18:08               ` Pavel Hofman
2020-12-04 14:35           ` Ruslan Bilovol
2020-11-12 20:42 Glenn Schmottlach

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='CAMS2kBF5Gvhnf7AzdeSFeVeWBLhtHM_hHfTvMLTN-3Jkh=BwHw@mail.gmail.com' \
    --to=gschmottlach@gmail.com \
    --cc=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=ruslan.bilovol@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.