From: Johan Hovold <johan@kernel.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Krishna Kurapati <quic_kriskura@quicinc.com>,
Pavankumar Kondeti <quic_pkondeti@quicinc.com>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: keep PHYs disabled during suspend
Date: Thu, 25 Aug 2022 15:12:52 +0200 [thread overview]
Message-ID: <Ywd1VBjbQTUeD+vD@hovoldconsulting.com> (raw)
In-Reply-To: <YwZUzeCTw2BupuMm@google.com>
On Wed, Aug 24, 2022 at 09:41:49AM -0700, Matthias Kaehlcke wrote:
> On Wed, Aug 24, 2022 at 10:27:44AM +0200, Johan Hovold wrote:
> > On Tue, Aug 23, 2022 at 11:33:18AM -0700, Matthias Kaehlcke wrote:
> > > Hi Johan,
> > >
> > > On Tue, Aug 23, 2022 at 02:40:47PM +0200, Johan Hovold wrote:
> > > > Commit 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system
> > > > suspend") started leaving the PHYs enabled during suspend for
> > > > wakeup-capable controllers even though it turns out this had nothing to
> > > > do with wakeup.
> > > >
> > > > Rather, the wakeup capability flag was (ab-)used as a proxy to configure
> > > > the suspend behaviour in an attempt to reduce power leakage on some
> > > > platforms.
> > > >
> > > > Stop abusing the wakeup configuration and restore the 5.19 behaviour of
> > > > keeping the PHYs powered off during suspend. If needed, a dedicated
> > > > mechanism for configuring the PHY power state during suspend can be
> > > > added later.
> > > >
> > > > Fixes: 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system suspend")
> > > > Link: https://lore.kernel.org/r/Yuv7AM/5jtO/pgcm@google.com
> > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > > > ---
> > > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> > > > index 9a94b1ab8f7a..9995395baa12 100644
> > > > --- a/drivers/usb/dwc3/dwc3-qcom.c
> > > > +++ b/drivers/usb/dwc3/dwc3-qcom.c
> > > > @@ -904,7 +904,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> > > >
> > > > wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
> > > > device_init_wakeup(&pdev->dev, wakeup_source);
> > > > - device_init_wakeup(&qcom->dwc3->dev, wakeup_source);
> > >
> > > Surprisingly this part breaks wakeup on sc7x80, with the above removal
> > > of the device_may_wakeup() checks it is not clear to me why wakeup needs
> > > to be enabled for the core.
> >
> > I can't explain that behaviour either. This change doesn't affect the
> > wakeup_path flag and genpd, and notably wakeup still works here with
> > sc8280xp.
> It turns out the dwc3 core wakeup flags are evaluated by:
>
> int usb_phy_roothub_suspend(struct device *controller_dev,
> struct usb_phy_roothub *phy_roothub)
> {
> usb_phy_roothub_power_off(phy_roothub);
>
> /* keep the PHYs initialized so the device can wake up the system */
> if (device_may_wakeup(controller_dev))
> return 0;
>
> return usb_phy_roothub_exit(phy_roothub);
> }
>
> 'controller_dev' is the dwc3 core. The root hub is un-initialized when wakeup is
> disabled. That causes wakeup to fail, and also happens to be the/one cause of
> the high power consumption of an onboard USB hub that I mentioned earlier in
> another thread.
Bah, I forgot about the USB core PHY management mess. This should be
disabled as the dwc3 driver manages the PHYs itself.
But because it currently enabled, the PHY was kept powered-on by USB
core (unless dropping device_init_wakeup()) and this indicates that that
is indeed needed for wakeup on your platform.
So this patch should be dropped, and I'll send a patch disabling the USB
core PHY management for dwc3 instead.
Johan
prev parent reply other threads:[~2022-08-25 13:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 12:40 [PATCH] usb: dwc3: keep PHYs disabled during suspend Johan Hovold
2022-08-23 18:33 ` Matthias Kaehlcke
2022-08-24 8:27 ` Johan Hovold
2022-08-24 16:41 ` Matthias Kaehlcke
2022-08-25 13:12 ` Johan Hovold [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=Ywd1VBjbQTUeD+vD@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan+linaro@kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mka@chromium.org \
--cc=quic_kriskura@quicinc.com \
--cc=quic_pkondeti@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox