From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Faisal Hassan <faisal.hassan@oss.qualcomm.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@intel.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Wesley Cheng <wesley.cheng@oss.qualcomm.com>,
Sriram Dash <sriram.dash@oss.qualcomm.com>,
Jack Pham <jack.pham@oss.qualcomm.com>,
Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>,
Shazad Hussain <shazad.hussain@oss.qualcomm.com>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/7] usb: dwc3: qcom: Distinguish PM and runtime suspend/resume paths
Date: Fri, 11 Sep 2026 23:51:58 +0000 [thread overview]
Message-ID: <aqSUEQ6_9VbFj-Qh@vbox> (raw)
In-Reply-To: <20260903153827.3463313-3-faisal.hassan@oss.qualcomm.com>
On Thu, Sep 03, 2026, Faisal Hassan wrote:
> The dwc3_qcom_suspend() and dwc3_qcom_resume() functions
> handle both system PM and runtime PM paths but cannot
> differentiate between them, preventing distinct power
> management strategies.
>
> Refactor suspend/resume functions to accept pm_message_t
> instead of boolean wakeup flags. Use PMSG_IS_AUTO()
> to identify runtime PM (PMSG_AUTO_SUSPEND/RESUME) versus
> system PM (PMSG_SUSPEND/RESUME) paths.
>
> Preserve existing wakeup behavior: always enable wakeup
> for runtime suspend, check device_may_wakeup() for system
> suspend.
>
> Follow dwc3/core.c pattern to enable future per-path
> strategies like differentiated power states.
>
> Co-developed-by: Sriram Dash <sriram.dash@oss.qualcomm.com>
> Signed-off-by: Sriram Dash <sriram.dash@oss.qualcomm.com>
> Signed-off-by: Faisal Hassan <faisal.hassan@oss.qualcomm.com>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 34 ++++++++++++++++++++++++++--------
> 1 file changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 49698a31b2f4..6d25f81800a7 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -335,14 +335,24 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
> dwc3_qcom_enable_port_interrupts(&qcom->ports[i]);
> }
>
> -static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
> +static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, pm_message_t msg)
> {
> u32 val;
> int i, ret;
> + bool wakeup;
>
> if (qcom->is_suspended)
> return 0;
>
> + /*
> + * For runtime suspend, always enable wakeup.
> + * For system suspend, check device wakeup capability.
> + */
> + if (PMSG_IS_AUTO(msg))
> + wakeup = true;
> + else
> + wakeup = device_may_wakeup(qcom->dev);
> +
> for (i = 0; i < qcom->num_ports; i++) {
> val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> @@ -369,14 +379,24 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
> return 0;
> }
>
> -static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
> +static int dwc3_qcom_resume(struct dwc3_qcom *qcom, pm_message_t msg)
> {
> int ret;
> int i;
> + bool wakeup;
>
> if (!qcom->is_suspended)
> return 0;
>
> + /*
> + * For runtime resume, always assume wakeup was enabled.
> + * For system resume, check device wakeup capability.
> + */
> + if (PMSG_IS_AUTO(msg))
> + wakeup = true;
> + else
> + wakeup = device_may_wakeup(qcom->dev);
> +
> if (dwc3_qcom_is_host(qcom) && wakeup)
> dwc3_qcom_disable_interrupts(qcom);
>
> @@ -759,14 +779,13 @@ static int dwc3_qcom_pm_suspend(struct device *dev)
> {
> struct dwc3 *dwc = dev_get_drvdata(dev);
> struct dwc3_qcom *qcom = to_dwc3_qcom(dwc);
> - bool wakeup = device_may_wakeup(dev);
> int ret;
>
> ret = dwc3_pm_suspend(&qcom->dwc);
> if (ret)
> return ret;
>
> - ret = dwc3_qcom_suspend(qcom, wakeup);
> + ret = dwc3_qcom_suspend(qcom, PMSG_SUSPEND);
> if (ret)
> return ret;
>
> @@ -779,10 +798,9 @@ static int dwc3_qcom_pm_resume(struct device *dev)
> {
> struct dwc3 *dwc = dev_get_drvdata(dev);
> struct dwc3_qcom *qcom = to_dwc3_qcom(dwc);
> - bool wakeup = device_may_wakeup(dev);
> int ret;
>
> - ret = dwc3_qcom_resume(qcom, wakeup);
> + ret = dwc3_qcom_resume(qcom, PMSG_RESUME);
> if (ret)
> return ret;
>
> @@ -819,7 +837,7 @@ static int dwc3_qcom_runtime_suspend(struct device *dev)
> if (ret)
> return ret;
>
> - return dwc3_qcom_suspend(qcom, true);
> + return dwc3_qcom_suspend(qcom, PMSG_AUTO_SUSPEND);
> }
>
> static int dwc3_qcom_runtime_resume(struct device *dev)
> @@ -828,7 +846,7 @@ static int dwc3_qcom_runtime_resume(struct device *dev)
> struct dwc3_qcom *qcom = to_dwc3_qcom(dwc);
> int ret;
>
> - ret = dwc3_qcom_resume(qcom, true);
> + ret = dwc3_qcom_resume(qcom, PMSG_AUTO_RESUME);
> if (ret)
> return ret;
>
> --
> 2.34.1
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
next prev parent reply other threads:[~2026-09-11 23:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 15:38 [PATCH v2 0/7] usb: dwc3: qcom: Add firmware-managed resource support for SA8255P Faisal Hassan
2026-09-03 15:38 ` [PATCH v2 1/7] usb: dwc3: qcom: re-enable wakeup interrupts on failed resume Faisal Hassan
2026-09-11 23:48 ` Thinh Nguyen
2026-09-03 15:38 ` [PATCH v2 2/7] usb: dwc3: qcom: Distinguish PM and runtime suspend/resume paths Faisal Hassan
2026-09-11 23:51 ` Thinh Nguyen [this message]
2026-09-03 15:38 ` [PATCH v2 3/7] dt-bindings: usb: Add qcom,sa8255p-dwc3 for firmware-managed resources Faisal Hassan
2026-09-07 9:08 ` Krzysztof Kozlowski
2026-09-03 15:38 ` [PATCH v2 4/7] usb: host: xhci-plat: Support XHCI_RESET_ON_RESUME via device property Faisal Hassan
2026-09-03 15:38 ` [PATCH v2 5/7] usb: dwc3: add xhci-reset-on-resume property for power-loss resume Faisal Hassan
2026-09-04 6:09 ` Krishna Kurapati
2026-09-12 1:03 ` Thinh Nguyen
2026-09-03 15:38 ` [PATCH v2 6/7] usb: dwc3: qcom: Support broken suspend for SA8255P Faisal Hassan
2026-09-12 1:24 ` Thinh Nguyen
2026-09-03 15:38 ` [PATCH v2 7/7] usb: dwc3: qcom: Support firmware-managed resource states for power management Faisal Hassan
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=aqSUEQ6_9VbFj-Qh@vbox \
--to=thinh.nguyen@synopsys.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=faisal.hassan@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack.pham@oss.qualcomm.com \
--cc=krishna.kurapati@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=shazad.hussain@oss.qualcomm.com \
--cc=sriram.dash@oss.qualcomm.com \
--cc=wesley.cheng@oss.qualcomm.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
all inboxes | Powered by JetHome®