All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] usb: dwc3: qcom: Keep wakeup option default off
@ 2026-11-03  6:14 Peter Chen
  2026-11-03  6:14 ` [RFC PATCH 1/1] " Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2026-11-03  6:14 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Greg Kroah-Hartman, Johan Hovold, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Wesley Cheng, Udipto Goswami, Jack Pham,
	Pratham Pratap, Krishna Kurapati, Prashanth K, Elson Serrao,
	linux-arm-msm, linux-usb, linux-kernel, Peter Chen

This RFC proposes changing the default USB system wakeup policy of the
Qualcomm DWC3 glue driver, and asks for feedback on whether the change
of default is acceptable.

Current policy
--------------
When the controller node has the "wakeup-source" property, dwc3-qcom
calls device_init_wakeup(dev, true). USB is then a system wakeup
source by default. Users who do NOT want the system woken up by USB
have to disable it:

  echo disabled > /sys/devices/.../<dwc3 device>/power/wakeup

Proposed policy
---------------
"wakeup-source" only describes that the controller is capable of
waking up the system (see
Documentation/devicetree/bindings/power/wakeup-source.txt), so with
this patch the driver only marks the device as wakeup capable, and
power/wakeup starts out "disabled". Users who NEED USB as a wakeup
source have to enable it:

  echo enabled > /sys/devices/.../<dwc3 device>/power/wakeup

The motivation is:

- Users do not expect USB activity (connect/disconnect or USB line status
  changes) to wake up the system unless they asked for it.

- Power consumption. With wakeup enabled, host mode system suspend
  keeps the controller and PHYs powered (dwc3_core_exit() is skipped
  and the genpd is not powered off) so that the wakeup interrupts can
  fire. Today this extra power is spent by default, even on systems
  where USB is never used as a wakeup source and the controller could
  be fully powered off during suspend.

Comparison
----------
                       Current (default on)       Proposed (default off)
                       --------------------       ----------------------
Initial power/wakeup   enabled                    disabled
User action            write "disabled" if USB    write "enabled" if USB
                       wakeup is NOT wanted       wakeup IS wanted
Unexpected wakeups     possible (connect,         none unless the user
                       disconnect, noise)         opted in
Host mode suspend      controller/PHYs powered,   dwc3_core_exit() and
                       wakeup IRQs armed, genpd   genpd powered off
                       kept on
Suspend power          higher, even if USB        lower, USB fully powered
                       wakeup is never used       off
Attached devices on    stay suspended, resume     reset-resumed or
resume                 quickly                    re-enumerated

Possible regression
-------------------
This is a user-visible change for existing platforms. Many Qualcomm
arm64 DTs set "wakeup-source" on the USB controller, with this patch:

- USB wakeup stops working until userspace (or a udev
  rule) writes "enabled" to the controller's power/wakeup.

- In host mode, because device_may_wakeup() is now false by default,
  system suspend takes the full power down path in
  dwc3_suspend_common() (dwc3_core_exit()) and dwc3_qcom_suspend()
  powers off the genpd. The controller resume may fail if power down
  path has not tested.

Comments on which policy is preferred for USB controllers, and whether
the regression above is acceptable, are welcome.

Peter Chen (1):
  usb: dwc3: qcom: Keep wakeup option default off

 drivers/usb/dwc3/dwc3-qcom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH 1/1] usb: dwc3: qcom: Keep wakeup option default off
  2026-11-03  6:14 [RFC PATCH 0/1] usb: dwc3: qcom: Keep wakeup option default off Peter Chen
@ 2026-11-03  6:14 ` Peter Chen
  2026-11-03  6:24   ` sashiko-bot
  2026-11-04 13:57   ` Krishna Kurapati
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Chen @ 2026-11-03  6:14 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Greg Kroah-Hartman, Johan Hovold, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Wesley Cheng, Udipto Goswami, Jack Pham,
	Pratham Pratap, Krishna Kurapati, Prashanth K, Elson Serrao,
	linux-arm-msm, linux-usb, linux-kernel, Peter Chen

The "wakeup-source" property, as described in
Documentation/devicetree/bindings/power/wakeup-source.txt, only says
that a device is capable of waking up the system. Whether wakeup is
actually enabled is a policy decision, and drivers use
device_may_wakeup() to decide whether to arm the hardware wakeup logic.

Currently dwc3-qcom calls device_init_wakeup(dev, true) when the
property is present, so USB wakeup is enabled by default and users who
do not want USB activity (e.g. connect/disconnect) to wake up the system
may have to disable it through power/wakeup, otherwise, unexpected wakeup
may happen.

Having wakeup enabled by default also costs power. In host mode,
when device_may_wakeup() is true, system suspend keeps the controller
and PHYs powered (dwc3_core_exit() is skipped and the genpd is not
powered off) so that the wakeup interrupts can fire, even on systems
where USB is never used as a wakeup source and could be fully powered
off.

For USB controllers, keep the wakeup option default off and only mark
the device as wakeup capable, so that the user decides which USB port
is used as a system wakeup source. Users who need it can enable it with:

  echo enabled > /sys/devices/.../<dwc3 device>/power/wakeup

While at it, drop the local wakeup_source variable and use
device_property_read_bool() like the other property reads in probe.

Signed-off-by: Peter Chen <peter.chen@oss.qualcomm.com>
---
 drivers/usb/dwc3/dwc3-qcom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 8116dc94c181..1451b5eaccce 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -653,7 +653,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 	struct resource		*r;
 	int			ret;
 	bool			ignore_pipe_clk;
-	bool			wakeup_source;
 
 	qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
 	if (!qcom)
@@ -757,8 +756,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 	if (ret)
 		goto remove_core;
 
-	wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
-	device_init_wakeup(&pdev->dev, wakeup_source);
+	if (device_property_read_bool(dev, "wakeup-source"))
+		device_set_wakeup_capable(dev, true);
 
 	qcom->is_suspended = false;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/1] usb: dwc3: qcom: Keep wakeup option default off
  2026-11-03  6:14 ` [RFC PATCH 1/1] " Peter Chen
@ 2026-11-03  6:24   ` sashiko-bot
  2026-11-04 13:57   ` Krishna Kurapati
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-03  6:24 UTC (permalink / raw)
  To: Peter Chen; +Cc: linux-usb

> The "wakeup-source" property, as described in
> Documentation/devicetree/bindings/power/wakeup-source.txt, only says
> that a device is capable of waking up the system. Whether wakeup is
> actually enabled is a policy decision, and drivers use
> device_may_wakeup() to decide whether to arm the hardware wakeup logic.
> 
> Currently dwc3-qcom calls device_init_wakeup(dev, true) when the
> property is present, so USB wakeup is enabled by default and users who
> do not want USB activity (e.g. connect/disconnect) to wake up the system
> may have to disable it through power/wakeup, otherwise, unexpected wakeup
> may happen.
> 
> Having wakeup enabled by default also costs power. In host mode,
> when device_may_wakeup() is true, system suspend keeps the controller
> and PHYs powered (dwc3_core_exit() is skipped and the genpd is not
> powered off) so that the wakeup interrupts can fire, even on systems
> where USB is never used as a wakeup source and could be fully powered
> off.
> 
> For USB controllers, keep the wakeup option default off and only mark
> the device as wakeup capable, so that the user decides which USB port
> is used as a system wakeup source. Users who need it can enable it with:
> 
>   echo enabled > /sys/devices/.../<dwc3 device>/power/wakeup
> 
> While at it, drop the local wakeup_source variable and use
> device_property_read_bool() like the other property reads in probe.
> 
> Signed-off-by: Peter Chen <peter.chen@oss.qualcomm.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103061401.2942139-1-peter.chen@oss.qualcomm.com?part=1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/1] usb: dwc3: qcom: Keep wakeup option default off
  2026-11-03  6:14 ` [RFC PATCH 1/1] " Peter Chen
  2026-11-03  6:24   ` sashiko-bot
@ 2026-11-04 13:57   ` Krishna Kurapati
  1 sibling, 0 replies; 4+ messages in thread
From: Krishna Kurapati @ 2026-11-04 13:57 UTC (permalink / raw)
  To: Peter Chen, Thinh Nguyen, cros-qcom-dts-watchers
  Cc: Greg Kroah-Hartman, Johan Hovold, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Wesley Cheng, Udipto Goswami, Jack Pham,
	Pratham Pratap, Prashanth K, Elson Serrao, linux-arm-msm,
	linux-usb, linux-kernel



On 11/3/2026 11:44 AM, Peter Chen wrote:
> The "wakeup-source" property, as described in
> Documentation/devicetree/bindings/power/wakeup-source.txt, only says
> that a device is capable of waking up the system. Whether wakeup is
> actually enabled is a policy decision, and drivers use
> device_may_wakeup() to decide whether to arm the hardware wakeup logic.
> 
> Currently dwc3-qcom calls device_init_wakeup(dev, true) when the
> property is present, so USB wakeup is enabled by default and users who
> do not want USB activity (e.g. connect/disconnect) to wake up the system
> may have to disable it through power/wakeup, otherwise, unexpected wakeup
> may happen.
> 
> Having wakeup enabled by default also costs power. In host mode,
> when device_may_wakeup() is true, system suspend keeps the controller
> and PHYs powered (dwc3_core_exit() is skipped and the genpd is not
> powered off) so that the wakeup interrupts can fire, even on systems
> where USB is never used as a wakeup source and could be fully powered
> off.
> 
> For USB controllers, keep the wakeup option default off and only mark
> the device as wakeup capable, so that the user decides which USB port
> is used as a system wakeup source. Users who need it can enable it with:
> 
>    echo enabled > /sys/devices/.../<dwc3 device>/power/wakeup
> 
> While at it, drop the local wakeup_source variable and use
> device_property_read_bool() like the other property reads in probe.
> 

++cros-qcom-dts-watchers since this is used in chromium userspace and 
modifications might be needed there as well.

Regards,
Krishna,

> Signed-off-by: Peter Chen <peter.chen@oss.qualcomm.com>
> ---
>   drivers/usb/dwc3/dwc3-qcom.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 8116dc94c181..1451b5eaccce 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -653,7 +653,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>   	struct resource		*r;
>   	int			ret;
>   	bool			ignore_pipe_clk;
> -	bool			wakeup_source;
>   
>   	qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
>   	if (!qcom)
> @@ -757,8 +756,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto remove_core;
>   
> -	wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
> -	device_init_wakeup(&pdev->dev, wakeup_source);
> +	if (device_property_read_bool(dev, "wakeup-source"))
> +		device_set_wakeup_capable(dev, true);
>   
>   	qcom->is_suspended = false;
>   


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-04 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03  6:14 [RFC PATCH 0/1] usb: dwc3: qcom: Keep wakeup option default off Peter Chen
2026-11-03  6:14 ` [RFC PATCH 1/1] " Peter Chen
2026-11-03  6:24   ` sashiko-bot
2026-11-04 13:57   ` Krishna Kurapati

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.