All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Pelletier <plr.vincent@gmail.com>
To: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Subject: Re: dwc2 gadget rejecting new AIO transfer when bus is suspended
Date: Tue, 5 Jan 2021 13:46:53 +0000	[thread overview]
Message-ID: <20210105134653.621bed8a@gmail.com> (raw)
In-Reply-To: <a87cca5e-786c-ca45-a98c-1429680621a6@synopsys.com>

Hello Artur,

On Tue, 29 Dec 2020 07:29:27 +0000, Artur Petrosyan <Arthur.Petrosyan@synopsys.com> wrote:
> Refactoring the driver to always accept any EP request independent of 
> the state (suspend), requires lot of investigation. We will decide and 
> implement later.
> 
> For your case we suggest the following workaround in 
> "dwc2_hsotg_ep_queue()" function to additionally check "hsotg->power_down":

I did test your change (with a trivial adaptation, see below) on
5.11.0-rc1 and I can confirm the AIO submission is accepted in my
use-case, despite a 4-seconds sleep between UDC being bound and AIO
submission to try to trigger the issue (which it does on an unpatched
5.10).

The gadget goes on to correctly respond to the host, so this looks good
to me.

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0a0d11151cfb8..dc676f3b1d799 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1387,7 +1387,7 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 		req->zero, req->short_not_ok);
 
 	/* Prevent new request submission when controller is suspended */
-	if (hs->lx_state != DWC2_L0) {
+	if (hs->lx_state != DWC2_L0 && hs->params.power_down) {
 		dev_dbg(hs->dev, "%s: submit request only in active state\n",
 			__func__);
 		return -EAGAIN;

Regards,
-- 
Vincent Pelletier

      reply	other threads:[~2021-01-05 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 12:50 dwc2 gadget rejecting new AIO transfer when bus is suspended Vincent Pelletier
2020-12-25 10:56 ` Artur Petrosyan
2020-12-26  0:46   ` Vincent Pelletier
2020-12-26 16:52     ` Alan Stern
2020-12-27  1:49       ` Vincent Pelletier
2020-12-29  7:29         ` Artur Petrosyan
2021-01-05 13:46           ` Vincent Pelletier [this message]

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=20210105134653.621bed8a@gmail.com \
    --to=plr.vincent@gmail.com \
    --cc=Arthur.Petrosyan@synopsys.com \
    --cc=Minas.Harutyunyan@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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.