mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
usb: dwc3: core: init current_dr_role in async probe
During dwc3 probe, it init the current_dr_role in drd_work, and it must make sure that the current_dr_role is initialized to DWC3_GCTL_PRTCAP_DEVICE or DWC3_GCTL_PRTCAP_HOST if it support dule role mode before do async probe. However, the drd_work and dwc3_rockchip_async_probe are handled asynchronously, if the drd_work is handled prior to async probe, it may fail to call dwc3_core_exit from dwc3_runtime_suspend in async probe because of uninitialized current_dr_role. If this case happens, the USB 2.0/3.0 PHY power on/off operations are unbalanced. This patch get the extcon state before do runtime suspend in async probe, and init the current_dr_role according to the extcon state. Signed-off-by: William Wu <william.wu@rock-chips.com> Change-Id: I4d1f7683d3ef3c5580f35be52d28821c47f6457f
This commit is contained in:
@@ -1538,6 +1538,15 @@ static void dwc3_rockchip_async_probe(void *data, async_cookie_t cookie)
|
||||
{
|
||||
struct dwc3 *dwc = data;
|
||||
struct device *dev = dwc->dev;
|
||||
int id;
|
||||
|
||||
if (dwc->edev && !dwc->drd_connected) {
|
||||
id = extcon_get_state(dwc->edev, EXTCON_USB_HOST);
|
||||
if (id < 0)
|
||||
id = 0;
|
||||
dwc->current_dr_role = id ? DWC3_GCTL_PRTCAP_HOST :
|
||||
DWC3_GCTL_PRTCAP_DEVICE;
|
||||
}
|
||||
|
||||
pm_runtime_put_sync_suspend(dev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user