mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
usb: dwc2: set op_state to peripheral when resume
The operation mode of controller will change to peripheral when resume if PD is power off during suspend, current code disconnect hcd and set lx state to L3 in this case to make sure the controller will be reinit in device mode, but that's not enough, the op_state is still host which is change when init or ID change interrupt occur. If the ID change happened after suspend the driver would miss the interrupt, so when the application call the pullup function to stop gadget and start again to change to another function, the disconnect gadget operation can't be done and the gadget restart directly. This will result in NULL point when gadget work. This patch set op_state to OTG_STATE_B_PERIPHERAL when resume in this case. Change-Id: Ifbafb7fae43d634cfa879c9a066d1e114db4196e Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com> Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
committed by
Frank Wang
parent
f3b41537fc
commit
f7ced1f320
@@ -743,6 +743,7 @@ static int __maybe_unused dwc2_resume(struct device *dev)
|
||||
if (dwc2->op_state == OTG_STATE_A_HOST && dwc2_is_device_mode(dwc2)) {
|
||||
spin_lock_irqsave(&dwc2->lock, flags);
|
||||
dwc2_hcd_disconnect(dwc2, true);
|
||||
dwc2->op_state = OTG_STATE_B_PERIPHERAL;
|
||||
dwc2->lx_state = DWC2_L3;
|
||||
if (!dwc2->driver)
|
||||
dwc2_hsotg_core_init_disconnected(dwc2, false);
|
||||
|
||||
Reference in New Issue
Block a user