linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Johan Hovold <johan+linaro@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Krishna Kurapati <quic_kriskura@quicinc.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Doug Anderson <dianders@chromium.org>,
	Pavankumar Kondeti <quic_pkondeti@quicinc.com>,
	quic_ppratap@quicinc.com, quic_vpulyala@quicinc.com,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 8/9] usb: dwc3: qcom: fix wakeup implementation
Date: Fri, 5 Aug 2022 09:58:35 -0700	[thread overview]
Message-ID: <Yu1MO9sgPslEDAjR@google.com> (raw)
In-Reply-To: <Yuv7AM/5jtO/pgcm@google.com>

On Thu, Aug 04, 2022 at 09:59:44AM -0700, Matthias Kaehlcke wrote:
> On Thu, Aug 04, 2022 at 05:10:00PM +0200, Johan Hovold wrote:
> > It is the Qualcomm glue wakeup interrupts that may be able to wake the
> > system from suspend and this can now be described in the devicetree.
> > 
> > Move the wakeup-source property handling over from the core driver and
> > instead propagate the capability setting to the core device during
> > probe.
> > 
> > This is needed as there is currently no way for the core driver to query
> > the wakeup setting of the glue device, but it is the core driver that
> > manages the PHY power state during suspend.
> > 
> > Also don't leave the PHYs enabled when system wakeup has been disabled
> > through sysfs.
> > 
> > Fixes: 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system suspend")
> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > ---
> >  drivers/usb/dwc3/core.c      | 5 ++---
> >  drivers/usb/dwc3/dwc3-qcom.c | 6 +++++-
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index 16d1f328775f..8c8e32651473 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -1822,7 +1822,6 @@ static int dwc3_probe(struct platform_device *pdev)
> >  
> >  	platform_set_drvdata(pdev, dwc);
> >  	dwc3_cache_hwparams(dwc);
> > -	device_init_wakeup(&pdev->dev, of_property_read_bool(dev->of_node, "wakeup-source"));
> >  
> >  	spin_lock_init(&dwc->lock);
> >  	mutex_init(&dwc->mutex);
> > @@ -1984,7 +1983,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
> >  		dwc3_core_exit(dwc);
> >  		break;
> >  	case DWC3_GCTL_PRTCAP_HOST:
> > -		if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) {
> > +		if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
> 
> Let me explain the rationale for why device_can_wakeup() was used here:
> 
> On QCOM SC7180 based Chromebooks we observe that the onboard USB hub consumes
> ~80 mW during system suspend when the PHYs are disabled, as opposed to ~17 mW
> when the PHYs remain enabled. This is a significant delta when the device is
> on a battery power.
> 
> The initial idea was to leave the PHYs always enabled (in a low power mode),
> but then I dug up commit c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs
> on system_suspend in host mode"), which provides a rationale for the PHYs
> being powered off:
> 
>   Commit 689bf72c6e0d ("usb: dwc3: Don't reinitialize core during
>   host bus-suspend/resume") updated suspend/resume routines to not
>   power_off and reinit PHYs/core for host mode.
>   It broke platforms that rely on DWC3 core to power_off PHYs to
>   enter low power state on system suspend.
> 
> Unfortunately we don't know which platforms are impacted by this. The idea
> behind using device_can_wakeup() was to use it as a proxy for platforms
> that are *not* impacted. If a platform supports USB wakeup supposedly the
> SoC can enter its low power mode during system suspend with the PHYs
> enabled.
> 
> By now I'm not 100% sure if the above assumption is correct. I recently
> saw allegations that the power consumption of a given QC SoC with USB
> wakeup support drops significantly when wakeup is disabled (i.e. when
> the PHYs are off), but haven't confirmed this yet.

So far power measurements don't support the claim that SoC power
consumption is substantially lower with USB wakeup disabled/the PHYs
off. I asked the person who made that claim to provide more
details/data (the discussion is in an internal forum).

  reply	other threads:[~2022-08-05 16:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 15:09 [PATCH v2 0/9] usb: dwc3: qcom: fix wakeup implementation Johan Hovold
2022-08-04 15:09 ` [PATCH v2 1/9] usb: dwc3: fix PHY disable sequence Johan Hovold
2022-08-06 13:48   ` Manivannan Sadhasivam
2022-08-04 15:09 ` [PATCH v2 2/9] Revert "usb: dwc3: qcom: Keep power domain on to retain controller status" Johan Hovold
2022-08-06 13:52   ` Manivannan Sadhasivam
2022-08-04 15:09 ` [PATCH v2 3/9] usb: dwc3: qcom: fix gadget-only builds Johan Hovold
2022-08-04 18:18   ` Randy Dunlap
2022-08-06 14:15   ` Manivannan Sadhasivam
2022-08-06 16:04     ` Johan Hovold
2022-08-06 16:42       ` Manivannan Sadhasivam
2022-08-06 16:51         ` Johan Hovold
2022-08-08 13:05   ` Greg Kroah-Hartman
2022-08-08 13:34     ` Johan Hovold
2022-08-18 17:44       ` Greg Kroah-Hartman
2022-08-04 15:09 ` [PATCH v2 4/9] usb: dwc3: qcom: fix use-after-free on runtime-PM wakeup Johan Hovold
2022-08-04 15:53   ` Matthias Kaehlcke
2022-08-06 14:33   ` Manivannan Sadhasivam
2022-08-06 16:08     ` Johan Hovold
2022-08-06 16:44       ` Manivannan Sadhasivam
2022-08-04 15:09 ` [PATCH v2 5/9] usb: dwc3: qcom: fix runtime PM wakeup Johan Hovold
2022-08-04 20:00   ` Matthias Kaehlcke
2022-08-06 14:35   ` Manivannan Sadhasivam
2022-08-04 15:09 ` [PATCH v2 6/9] usb: dwc3: qcom: fix peripheral and OTG suspend Johan Hovold
2022-08-04 21:38   ` kernel test robot
2022-08-05  6:58     ` Johan Hovold
2022-08-05  7:10       ` Johan Hovold
2022-08-04 15:09 ` [PATCH v2 7/9] dt-bindings: usb: qcom,dwc3: add wakeup-source property Johan Hovold
2022-08-06 15:08   ` Manivannan Sadhasivam
2022-08-06 16:41     ` Johan Hovold
2022-08-06 16:52       ` Manivannan Sadhasivam
2022-08-06 17:09         ` Johan Hovold
2022-08-08  8:05           ` Manivannan Sadhasivam
2022-08-04 15:10 ` [PATCH v2 8/9] usb: dwc3: qcom: fix wakeup implementation Johan Hovold
2022-08-04 16:59   ` Matthias Kaehlcke
2022-08-05 16:58     ` Matthias Kaehlcke [this message]
2022-08-06 16:22       ` Johan Hovold
2022-08-08 17:22         ` Matthias Kaehlcke
2022-08-06 14:57   ` Manivannan Sadhasivam
2022-08-06 16:33     ` Johan Hovold
2022-08-04 15:10 ` [PATCH v2 9/9] usb: dwc3: qcom: clean up suspend callbacks Johan Hovold
2022-08-04 17:08   ` Matthias Kaehlcke
2022-08-04 15:15 ` [PATCH v2 0/9] usb: dwc3: qcom: fix wakeup implementation Johan Hovold

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=Yu1MO9sgPslEDAjR@google.com \
    --to=mka@chromium.org \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan+linaro@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_kriskura@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_vpulyala@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).