From: Tony Lindgren <tony@atomide.com>
To: Bhushan Shah <bshah@kde.org>
Cc: Bin Liu <b-liu@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
Merlijn Wajer <merlijn@wizzup.org>, Pavel Machek <pavel@ucw.cz>,
Sebastian Reichel <sre@kernel.org>,
clayton@craftyguy.net
Subject: Re: [PATCH] usb: musb: fix idling for suspend after disconnect interrupt
Date: Tue, 27 Oct 2020 08:17:41 +0200 [thread overview]
Message-ID: <20201027061741.GD5639@atomide.com> (raw)
In-Reply-To: <20201027045519.GA947883@aquila.localdomain>
Hi,
* Bhushan Shah <bshah@kde.org> [201027 04:55]:
> Hi Tony,
>
> On Mon, Nov 25, 2019 at 07:41:51PM -0800, Tony Lindgren wrote:
> > When disconnected as USB B-device, we sometimes get a suspend interrupt
> > after disconnect interrupt. In that case we have devctl set to 99 with
> > VBUS still valid and musb_pm_runtime_check_session() wrongly things we
> > have an active session. We have no other interrupts after disconnect
> > coming in this case at least with the omap2430 glue.
>
> So I had been debugging a issue with musb_hrdc driver preventing a
> suspend on the pinephone, which is Allwinner A64 platform.
Great. After that you might want to take a look and make sure that musb
also gets idled properly during runtime with no devices connected :)
> Namely, if I have USB connected, and I try to suspend, it would hang
> until USB is disconnected. After enabling tracing, I realized that is
> hanging after this commit. Reverting it makes device suspend and resume
> correctly.
>
> Some more of debugging notes can be found at,
>
> https://gitlab.com/postmarketOS/pmaports/-/issues/839
>
> I wonder what would be right solution here? Disable this quirk somehow
> for device?
Hmm maybe we're just missing the check for suspend here. Maybe
give the following untested patch a try?
I'll give it a try here too but it might be few days.
Seems like we might be able to eventually simplify the suspend and
quirk check stuff, but let's fix the $subject issue first.
Regards,
Tony
8< ----------------------
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2005,10 +2005,14 @@ static void musb_pm_runtime_check_session(struct musb *musb)
MUSB_DEVCTL_HR;
switch (devctl & ~s) {
case MUSB_QUIRK_B_DISCONNECT_99:
- musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n");
- schedule_delayed_work(&musb->irq_work,
- msecs_to_jiffies(1000));
- break;
+ if (musb->quirk_retries && !musb->flush_irq_work) {
+ musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n");
+ schedule_delayed_work(&musb->irq_work,
+ msecs_to_jiffies(1000));
+ musb->quirk_retries--;
+ break;
+ }
+ /* fall through */
case MUSB_QUIRK_B_INVALID_VBUS_91:
if (musb->quirk_retries && !musb->flush_irq_work) {
musb_dbg(musb,
next prev parent reply other threads:[~2020-10-27 6:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 3:41 [PATCH] usb: musb: fix idling for suspend after disconnect interrupt Tony Lindgren
2019-11-26 10:20 ` Sergei Shtylyov
2019-11-26 17:45 ` Tony Lindgren
2019-12-12 17:21 ` Bin Liu
2019-12-12 17:26 ` Tony Lindgren
2019-12-12 16:00 ` Bin Liu
2019-12-12 16:09 ` Tony Lindgren
2019-12-12 17:08 ` Bin Liu
2019-12-12 17:15 ` Tony Lindgren
2020-10-27 4:55 ` Bhushan Shah
2020-10-27 6:17 ` Tony Lindgren [this message]
2020-10-27 7:59 ` Bhushan Shah
2020-10-28 8:42 ` Tony Lindgren
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=20201027061741.GD5639@atomide.com \
--to=tony@atomide.com \
--cc=b-liu@ti.com \
--cc=bshah@kde.org \
--cc=clayton@craftyguy.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=merlijn@wizzup.org \
--cc=pavel@ucw.cz \
--cc=sre@kernel.org \
/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.