mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
usb: dwc3: core: add async probe for rockchip dwc3
The default autosuspend delay of PM runtime is 5000ms,
it's too long. For Rockchip DWC3 controller, if it supports
PM runtime management, e.g. RK3568 OTG port, then we expect
to put the DWC3 controller in runtime suspend at the end of
probe as soon as possible. This can fix the issue that race
condition between power down the DWC3 in runtime suspend and
access the DWC3 in dwc3_gadget_pullup() by userspace.
This patch uses pm_runtime_put_sync_suspend() instead of
pm_runtime_put if enable PM runtime. And according to the
commit f2a2b34e45 ("usb: dwc3: rockchip: use async_schedule
for initial dwc3"), we do pm_runtime_put_sync_suspend() in
async schedule to avoid increasing the boot time.
Change-Id: I378e57d272382d444f1ac52ea2961736e472e713
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
*/
|
||||
|
||||
#include <linux/async.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
@@ -1525,6 +1526,14 @@ static void dwc3_check_params(struct dwc3 *dwc)
|
||||
}
|
||||
}
|
||||
|
||||
static void dwc3_rockchip_async_probe(void *data, async_cookie_t cookie)
|
||||
{
|
||||
struct dwc3 *dwc = data;
|
||||
struct device *dev = dwc->dev;
|
||||
|
||||
pm_runtime_put_sync_suspend(dev);
|
||||
}
|
||||
|
||||
static int dwc3_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -1671,7 +1680,11 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||
goto err5;
|
||||
|
||||
dwc3_debugfs_init(dwc);
|
||||
pm_runtime_put(dev);
|
||||
|
||||
if (dwc->en_runtime)
|
||||
async_schedule(dwc3_rockchip_async_probe, dwc);
|
||||
else
|
||||
pm_runtime_put(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user