usb: f_gsi: Resume USB on handling disconnect event in suspend state
Currently USB GSI function driver releases pm runtime usage count and
child count on receiving suspend event i.e. it doesn't prevent USB going
into LPM. There is race condition seen while USB going into LPM in
parallel USB GSI driver is trying to free allocated TRB ring. Due to USB
SMMU usage, it is must to have USB SMMU attach while freeing TRB ring.
Hence fix this issue by incrementing pm runtime usage count and child
count when handling disconnect event while USB GSI state is suspended
before trying to free TRB ring.
Change-Id: Icd9d43a6cd8956a1bdca219ad9686a57e89989c8
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c
index 0065c06..4cd3780 100644
--- a/drivers/usb/gadget/function/f_gsi.c
+++ b/drivers/usb/gadget/function/f_gsi.c
@@ -1083,9 +1083,11 @@
ipa_resume_work_handler(d_port);
d_port->sm_state = STATE_CONNECTED;
} else if (event == EVT_DISCONNECTED) {
+ usb_gadget_autopm_get(d_port->gadget);
ipa_disconnect_work_handler(d_port);
d_port->sm_state = STATE_INITIALIZED;
log_event_dbg("%s: ST_SUS_EVT_DIS", __func__);
+ usb_gadget_autopm_put_async(d_port->gadget);
}
break;
default: