From 2cbfa1f019e46e6d8e36126c0b617dc4de509116 Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 14 Dec 2021 09:53:36 +0800 Subject: [PATCH] usb: dwc3: debugfs: Fix mode switch for rockchip When switch dwc3 mode to device on rockchip platform, it may fails to connect to usb host because the auto suspend delay is only 100ms. This patch sets the switch mode to desired_role_sw_mode, and it can avoid to enter runtime suspend. Fixes: 5ac62b80f747 ("usb: dwc3: fix runtime pm for rockchip") Signed-off-by: William Wu Change-Id: If3f7faee1e9550322a80f297136b8faf1ebed301 --- drivers/usb/dwc3/debugfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 23f4682ad104..dc81e8349470 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -440,6 +440,10 @@ static ssize_t dwc3_mode_write(struct file *file, if (!strncmp(buf, "otg", 3)) mode = DWC3_GCTL_PRTCAP_OTG; +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) + dwc->desired_role_sw_mode = mode; +#endif + dwc3_set_mode(dwc, mode); return count;