From: Felipe Balbi <balbi@kernel.org>
To: Pawel Laszczak <pawell@cadence.com>
Cc: gregkh@linuxfoundation.org, ruslan.bilovol@gmail.com,
jbrunet@baylibre.com, linux-usb@vger.kernel.org,
kurahul@cadence.com, peter.chen@kernel.org,
Pawel Laszczak <pawell@cadence.com>
Subject: Re: [PATCH v2 1/2] usb: gadget: f_uac2: Stop endpoint before enabling it.
Date: Mon, 26 Apr 2021 13:22:10 +0300 [thread overview]
Message-ID: <878s55l50t.fsf@kernel.org> (raw)
In-Reply-To: <20210426044815.5393-1-pawell@gli-login.cadence.com>
[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]
Hi,
Pawel Laszczak <pawell@cadence.com> writes:
> From: Pawel Laszczak <pawell@cadence.com>
>
> Patch adds disabling endpoint before enabling it during changing
> alternate setting. Lack of this functionality causes that in some
> cases uac2 queue the same request multiple time.
> Such situation can occur when host send set interface with
> alternate setting 1 twice.
Which host is doing that?
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
>
> ---
> Changelog:
> v2:
> - moved disabling endpoint into u_audio_start_playback
>
> drivers/usb/gadget/function/u_audio.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
> index 265c4d805f81..c4bbc9decaba 100644
> --- a/drivers/usb/gadget/function/u_audio.c
> +++ b/drivers/usb/gadget/function/u_audio.c
> @@ -401,6 +401,10 @@ int u_audio_start_playback(struct g_audio *audio_dev)
>
> ep = audio_dev->in_ep;
> prm = &uac->p_prm;
> +
> + if (prm->ep_enabled)
> + u_audio_stop_capture(audio_dev);
this looks to be a bug in f_uac2.c::afunc_set_alt(), actually. Note how
e.g. f_obex.c::obex_set_alt() is implemented:
> } else if (intf == obex->data_id) {
> if (alt > 1)
> goto fail;
>
> if (obex->port.in->enabled) {
if interface is already enabled...
> dev_dbg(&cdev->gadget->dev,
> "reset obex ttyGS%d\n", obex->port_num);
> gserial_disconnect(&obex->port);
...disable it first...
> }
>
> if (!obex->port.in->desc || !obex->port.out->desc) {
> dev_dbg(&cdev->gadget->dev,
> "init obex ttyGS%d\n", obex->port_num);
> if (config_ep_by_speed(cdev->gadget, f,
> obex->port.in) ||
> config_ep_by_speed(cdev->gadget, f,
> obex->port.out)) {
...before configuring endpoints again
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
next prev parent reply other threads:[~2021-04-26 10:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 4:48 [PATCH v2 1/2] usb: gadget: f_uac2: Stop endpoint before enabling it Pawel Laszczak
2021-04-26 10:22 ` Felipe Balbi [this message]
2021-04-26 10:47 ` Pawel Laszczak
2021-04-26 12:52 ` Felipe Balbi
2021-04-26 14:50 ` Alan Stern
2021-04-26 14:54 ` Felipe Balbi
2021-04-27 4:35 ` Pawel Laszczak
2021-04-28 10:33 ` Felipe Balbi
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=878s55l50t.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet@baylibre.com \
--cc=kurahul@cadence.com \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=peter.chen@kernel.org \
--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.