[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20231206065939.16958-1-frank.wang@rock-chips.com>
Date: Wed, 6 Dec 2023 14:59:39 +0800
From: Frank Wang <frank.wang@...k-chips.com>
To: Thinh.Nguyen@...opsys.com, gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
william.wu@...k-chips.com, wmc@...k-chips.com,
Frank Wang <frank.wang@...k-chips.com>
Subject: [PATCH] usb: dwc3: set pm runtime active before resume common
For device mode, if PM runtime autosuspend feature enabled, the
runtime power status of dwc3 may be suspended when run dwc3_resume(),
and dwc3 gadget would not be configured in dwc3_gadget_run_stop().
It would cause gadget connected failed if USB cable has been plugged
before PM resume. So move forward pm_runtime_set_active() to fix it.
Signed-off-by: Frank Wang <frank.wang@...k-chips.com>
---
drivers/usb/dwc3/core.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b101dbf8c5dc..d891989e8459 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -2340,12 +2340,15 @@ static int dwc3_resume(struct device *dev)
pinctrl_pm_select_default_state(dev);
+ pm_runtime_disable(dev);
+ pm_runtime_set_active(dev);
+
ret = dwc3_resume_common(dwc, PMSG_RESUME);
- if (ret)
+ if (ret) {
+ pm_runtime_set_suspended(dev);
return ret;
+ }
- pm_runtime_disable(dev);
- pm_runtime_set_active(dev);
pm_runtime_enable(dev);
return 0;
--
2.17.1
Powered by blists - more mailing lists