* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
@ 2026-09-29 17:16 ` Huang Wei
2026-10-02 23:55 ` Thinh Nguyen
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Huang Wei @ 2026-09-29 17:16 UTC (permalink / raw)
To: Fabricio Akio
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel,
linux-arm-msm, huangwei
Hi Fabricio,
This matches what I'd expect from the PHY behaviour - in peripheral
mode the device disconnects before the glue suspends, so there is no
link left to park in L2, and the unconditional check is just log noise
on every suspend. Restricting it to the host-with-wakeup case that
actually relies on L2 retention looks right.
The untested host path is low risk in a specific way: for host with
wakeup the check runs exactly as before, so the patch only silences
the cases where L2 is not expected. And since the runtime PM paths
pass wakeup unconditionally, host runtime suspend still gets the
check, which seems to be the intended behaviour.
Tested on real hardware in the mode that was noisy - nice.
Reviewed-by: Huang Wei <huangwei@kylinos.cn>
Thanks,
Huang Wei
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
2026-09-29 17:16 ` Huang Wei
@ 2026-10-02 23:55 ` Thinh Nguyen
2026-10-04 9:31 ` Joonhoe Kim
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Thinh Nguyen @ 2026-10-02 23:55 UTC (permalink / raw)
To: fabricioakio
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm
On Mon, Sep 28, 2026, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
>
> In peripheral mode the core disconnects and powers the PHY off before
> the glue suspends, so the link never enters L2 and every system
> suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> the one case that parks the PHY in L2.
>
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---
> Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
> 7.2.3 tree, in peripheral mode with the cable attached: the "HS-PHY not
> in L2" message appears on every system suspend without this patch, and
> not over three consecutive cycles with it. Host mode is untested, since
> this board runs the controller in peripheral mode. The board binds
> dwc3-qcom-legacy, so the same change in dwc3-qcom.c is build-tested
> only. Applies unchanged to next-20260928.
> ---
> drivers/usb/dwc3/dwc3-qcom-legacy.c | 16 ++++++++++++----
> drivers/usb/dwc3/dwc3-qcom.c | 16 ++++++++++++----
> 2 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c
> index d3fad0fcfdac..ba3f70dea4ab 100644
> --- a/drivers/usb/dwc3/dwc3-qcom-legacy.c
> +++ b/drivers/usb/dwc3/dwc3-qcom-legacy.c
> @@ -431,10 +431,18 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
> if (qcom->is_suspended)
> return 0;
>
> - 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))
> - dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1);
> + /*
> + * Only a host with wakeup enabled keeps the HS PHY powered and parks
> + * it in L2 across suspend. A peripheral disconnects from the bus and
> + * powers the PHY off first, so its link never enters L2.
> + */
> + if (dwc3_qcom_is_host(qcom) && wakeup) {
> + 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))
> + dev_err(qcom->dev, "port-%d HS-PHY not in L2\n",
> + i + 1);
> + }
> }
>
> for (i = qcom->num_clocks - 1; i >= 0; i--)
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index ac68b4218b56..e0920da280ce 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -343,10 +343,18 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
> if (qcom->is_suspended)
> return 0;
>
> - 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))
> - dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1);
> + /*
> + * Only a host with wakeup enabled keeps the HS PHY powered and parks
> + * it in L2 across suspend. A peripheral disconnects from the bus and
> + * powers the PHY off first, so its link never enters L2.
> + */
> + if (dwc3_qcom_is_host(qcom) && wakeup) {
> + 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))
> + dev_err(qcom->dev, "port-%d HS-PHY not in L2\n",
> + i + 1);
> + }
> }
> clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks);
>
>
> ---
> base-commit: 6375e61c01e93e35ee7acd336a689ac1fae4b509
> change-id: 20260928-dwc3-qcom-l2-check-e3b55acefb62
>
> Best regards,
> --
> Fabricio Akio <fabricioakio@gmail.com>
>
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
2026-09-29 17:16 ` Huang Wei
2026-10-02 23:55 ` Thinh Nguyen
@ 2026-10-04 9:31 ` Joonhoe Kim
2026-10-04 9:34 ` Joonhoe Kim
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Joonhoe Kim @ 2026-10-04 9:31 UTC (permalink / raw)
To: Fabricio Akio
Cc: Joonhoe Kim, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
linux-kernel, linux-arm-msm
On Mon, Sep 28, 2026 at 03:16:28PM -0300, Fabricio Akio wrote:
> Host mode is untested, since this board runs the controller in
> peripheral mode.
I tried the host side on a Lenovo Legion Tab Y700 Gen 5 (SM8850,
dwc3-qcom), v7.3-rc4 plus board patches, s2idle with an RTC wakeup:
- host with wakeup disabled (USB 2.0 hub, USB 3 flash drive behind
it): "HS-PHY not in L2" on every suspend before, none with the
patch; the devices are still there after resume
- host with wakeup enabled: no message, the port does reach L2
- peripheral (connected to a PC): no message
Tested-by: Joonhoe Kim <26rote@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
` (2 preceding siblings ...)
2026-10-04 9:31 ` Joonhoe Kim
@ 2026-10-04 9:34 ` Joonhoe Kim
2026-10-05 9:58 ` Pankaj Patil
2026-10-21 13:44 ` Konrad Dybcio
5 siblings, 0 replies; 9+ messages in thread
From: Joonhoe Kim @ 2026-10-04 9:34 UTC (permalink / raw)
To: Fabricio Akio
Cc: Joonhoe Kim, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
linux-kernel, linux-arm-msm
On Mon, Sep 28, 2026 at 03:16:28PM -0300, Fabricio Akio wrote:
> Host mode is untested, since this board runs the controller in
> peripheral mode.
I tried the host side on a Lenovo Legion Tab Y700 Gen 5 (SM8850,
dwc3-qcom), v7.3-rc4 plus board patches, s2idle with an RTC wakeup:
- host with wakeup disabled (USB 2.0 hub, USB 3 flash drive behind
it): "HS-PHY not in L2" on every suspend before, none with the
patch; the devices are still there after resume
- host with wakeup enabled: no message, the port does reach L2
- peripheral (connected to a PC): no message
Tested-by: Joonhoe Kim <26rote@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
` (3 preceding siblings ...)
2026-10-04 9:34 ` Joonhoe Kim
@ 2026-10-05 9:58 ` Pankaj Patil
2026-10-21 13:44 ` Konrad Dybcio
5 siblings, 0 replies; 9+ messages in thread
From: Pankaj Patil @ 2026-10-05 9:58 UTC (permalink / raw)
To: fabricioakio, Thinh Nguyen, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, linux-arm-msm
On 9/28/2026 11:46 PM, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
>
> In peripheral mode the core disconnects and powers the PHY off before
> the glue suspends, so the link never enters L2 and every system
> suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> the one case that parks the PHY in L2.
>
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---
> Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
> 7.2.3 tree, in peripheral mode with the cable attached: the "HS-PHY not
> in L2" message appears on every system suspend without this patch, and
> not over three consecutive cycles with it. Host mode is untested, since
> this board runs the controller in peripheral mode. The board binds
> dwc3-qcom-legacy, so the same change in dwc3-qcom.c is build-tested
> only. Applies unchanged to next-20260928.
> ---
Tested on Glymur-CRD
Tested-by: Pankaj Patil <pankaj.patil@oss.qualcomm.com>
Reviewed-by: Pankaj Patil <pankaj.patil@oss.qualcomm.com>
[...]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
` (4 preceding siblings ...)
2026-10-05 9:58 ` Pankaj Patil
@ 2026-10-21 13:44 ` Konrad Dybcio
2026-10-22 3:27 ` Peter Chen
5 siblings, 1 reply; 9+ messages in thread
From: Konrad Dybcio @ 2026-10-21 13:44 UTC (permalink / raw)
To: fabricioakio, Thinh Nguyen, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, linux-arm-msm, Wesley Cheng, Krishna Kurapati
On 9/28/26 8:16 PM, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
>
> In peripheral mode the core disconnects and powers the PHY off before
> the glue suspends, so the link never enters L2 and every system
> suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> the one case that parks the PHY in L2.
>
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---
I think we should be able to retain the link in L2 in device
mode too upon suspend, but that needs more plumbing on the
clock/gdsc side? (+Cc)
Konrad
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-10-21 13:44 ` Konrad Dybcio
@ 2026-10-22 3:27 ` Peter Chen
2026-10-22 23:44 ` Thinh Nguyen
0 siblings, 1 reply; 9+ messages in thread
From: Peter Chen @ 2026-10-22 3:27 UTC (permalink / raw)
To: Konrad Dybcio, Thinh Nguyen, Wesley Cheng
Cc: fabricioakio, Greg Kroah-Hartman, linux-usb, linux-kernel,
linux-arm-msm, Krishna Kurapati
On 26-10-21 15:44:52, Konrad Dybcio wrote:
> On 9/28/26 8:16 PM, Fabricio Akio via B4 Relay wrote:
> > From: Fabricio Akio <fabricioakio@gmail.com>
> >
> > In peripheral mode the core disconnects and powers the PHY off before
> > the glue suspends, so the link never enters L2 and every system
> > suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> > the one case that parks the PHY in L2.
> >
> > Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> > ---
>
> I think we should be able to retain the link in L2 in device
> mode too upon suspend, but that needs more plumbing on the
> clock/gdsc side? (+Cc)
>
From what I see, dwc3 core just keeps gadget (device mode) disconnecting
when dwc3 core enters suspend. The reason is probably dwc3 core wakeup signal
(through .dwc3_gadget_wakeup or dwc3_gadget_func_wakeup) is send by software.
When the system has suspended, no software has run, so can't trigger wakeup.
For runtime suspend, current dwc3 core doesn't consider link suspend event
(eg, L2/U3) as low power event, and doesn't put dwc3 core entering runtime
suspend, so the link is always L2 or U3.
Thinh/Wesley, if I understand wrong, please correct me.
--
Thanks,
Peter Chen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
2026-10-22 3:27 ` Peter Chen
@ 2026-10-22 23:44 ` Thinh Nguyen
0 siblings, 0 replies; 9+ messages in thread
From: Thinh Nguyen @ 2026-10-22 23:44 UTC (permalink / raw)
To: Peter Chen
Cc: Konrad Dybcio, Thinh Nguyen, Wesley Cheng, fabricioakio,
Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm,
Krishna Kurapati
On Wed, Oct 21, 2026, Peter Chen wrote:
> On 26-10-21 15:44:52, Konrad Dybcio wrote:
> > On 9/28/26 8:16 PM, Fabricio Akio via B4 Relay wrote:
> > > From: Fabricio Akio <fabricioakio@gmail.com>
> > >
> > > In peripheral mode the core disconnects and powers the PHY off before
> > > the glue suspends, so the link never enters L2 and every system
> > > suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> > > the one case that parks the PHY in L2.
> > >
> > > Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> > > ---
> >
> > I think we should be able to retain the link in L2 in device
> > mode too upon suspend, but that needs more plumbing on the
> > clock/gdsc side? (+Cc)
> >
>
> From what I see, dwc3 core just keeps gadget (device mode) disconnecting
> when dwc3 core enters suspend. The reason is probably dwc3 core wakeup signal
> (through .dwc3_gadget_wakeup or dwc3_gadget_func_wakeup) is send by software.
> When the system has suspended, no software has run, so can't trigger wakeup.
Remote wakeup isn't the limitation. The host decides when to put the
link to L2/U3, and the device must still respond to a host resume or
reset while suspended. If the core is powered down and its state is
lost, it can't do that. To support this, we'd need to implement device
hibernation.
>
> For runtime suspend, current dwc3 core doesn't consider link suspend event
> (eg, L2/U3) as low power event, and doesn't put dwc3 core entering runtime
> suspend, so the link is always L2 or U3.
>
Right, dwc3 won't runtime suspend while connected, regardless of the
link state.
Fabricio's patch is fine as is.
Thanks,
Thinh
^ permalink raw reply [flat|nested] 9+ messages in thread