OSDN Git Service
usb: dwc3: gadget: Fix PM runtime get/put in case of remote wakeup
In case of remote wakeup interrupt, dwc3_gadget_wakeup_work()
does a pm_runtime_get_sync() and dwc3_gadget_wakeup_interrupt()
does not notify OTG state machine about this state change.
Due to which OTG will be still in B_SUSPEND state.
Now when bus suspend happens, since OTG state machine is already in
B_SUSPEND state, it does not do a pm_runtime_put_autosuspend() and the
count is not decremented.
To fix, this do an unconditional pm_runtime_get_sync() and
pm_runtime_put_noidle() in dwc3_gadget_wakeup_work() to avoid any
unclocked register access. In dwc3_gadget_wakeup_interrupt() kick in
SM machine in all cases and handle the remote wakeup same as host
initiated resume, by clearing the B_SUSPEND bit so that OTG state machine
moves to B_PERIPHERAL state.
CRs-fixed: 829205
Change-Id: I270df517d5dd58fe28bf0087e0ba951c4e9e15ba
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>