From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: gadget: Inform system of suspended state
Date: Tue, 18 Jun 2024 00:26:16 +0000 [thread overview]
Message-ID: <20240618002546.hsabtxmyp2qzlkey@synopsys.com> (raw)
In-Reply-To: <20240617234624.bitqpa3brkgil6tj@synopsys.com>
On Mon, Jun 17, 2024, Thinh Nguyen wrote:
> On Thu, Jun 13, 2024, Mike Looijmans wrote:
> > >
> > > Wait, I thought the host initiated the usb suspend. Did you trigger usb
> > > suspend by putting the host in suspend? Or does the suspend event only
> > > come when you perform a disconnect?
> >
> > All I do is unplug the cable. The host (PC running Ubuntu 22) doesn't eject
> > or suspend or anything like that.
> >
>
> This is a very typical connect/disconnect flow. I'm surprised that it's
> not caught on your platform before. What's the compatible string for
> your platform?
>
> >
> > >
> > > Can you confirm if the suspend event was there before you disconnect the
> > > device?
> >
> > Disconnecting the cable is what leads to the "suspend" event.
> >
>
> Can you try this:
>
> It's a simple workaround, but may not catch the issue while operating in
> Fullspeed.
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 89fc690fdf34..894ca1044281 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -4339,6 +4339,18 @@ static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc,
> {
> enum dwc3_link_state next = evtinfo & DWC3_LINK_STATE_MASK;
>
> + if (next == DWC3_LINK_STATE_U3) {
> + u8 speed;
> + u32 reg;
> +
> + reg = dwc3_readl(dwc->regs, DWC3_DSTS);
> + speed = reg & DWC3_DSTS_CONNECTSPD;
> + if (dwc->speed != speed) {
Minor tweak to this condition to this instead:
if (dwc->gadget->speed != USB_SPEED_UNKNOWN &&
dwc->speed != speed) {
> + dwc3_gadget_disconnect_interrupt(dwc);
> + return;
> + }
> + }
> +
> if (!dwc->suspended && next == DWC3_LINK_STATE_U3) {
> dwc->suspended = true;
> dwc3_suspend_gadget(dwc);
>
>
> Otherwise, there's no other SW workaround that I can think of.
>
Thanks,
Thinh
next prev parent reply other threads:[~2024-06-18 0:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.c5f44c79-75b2-43c1-a791-806fe8b693cd@emailsignatures365.codetwo.com>
2024-06-03 13:13 ` [PATCH] usb: dwc3: gadget: Inform system of suspended state Mike Looijmans
2024-06-04 1:03 ` Thinh Nguyen
2024-06-04 5:26 ` Mike Looijmans
2024-06-04 6:45 ` Krishna Kurapati PSSNV
2024-06-04 8:25 ` Mike Looijmans
2024-06-04 8:52 ` Krishna Kurapati PSSNV
2024-06-04 23:06 ` Thinh Nguyen
2024-06-05 14:32 ` Mike Looijmans
2024-06-06 0:28 ` Thinh Nguyen
2024-06-06 5:52 ` Mike Looijmans
2024-06-06 15:11 ` Mike Looijmans
2024-06-06 20:21 ` Thinh Nguyen
2024-06-07 6:10 ` Mike Looijmans
2024-06-07 22:57 ` Thinh Nguyen
2024-06-11 4:59 ` Mike Looijmans
2024-06-11 8:02 ` Mike Looijmans
2024-06-13 0:32 ` Thinh Nguyen
2024-06-13 8:51 ` Mike Looijmans
2024-06-17 23:46 ` Thinh Nguyen
2024-06-18 0:26 ` Thinh Nguyen [this message]
2024-06-05 14:41 ` Mike Looijmans
2024-06-06 0:29 ` Thinh Nguyen
2026-03-05 9:45 ` Ravineet Singh
2026-03-06 2:06 ` Thinh Nguyen
2026-03-06 12:07 ` Ravineet Singh
2026-03-06 23:05 ` Thinh Nguyen
2026-03-09 9:52 ` Ravineet Singh
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=20240618002546.hsabtxmyp2qzlkey@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=mike.looijmans@topic.nl \
/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