OSDN Git Service

usb: dwc3: gadget: Fix PM runtime get/put in case of remote wakeup
authorAzhar Shaikh <azhars@codeaurora.org>
Mon, 27 Apr 2015 22:09:23 +0000 (15:09 -0700)
committerDavid Keitel <dkeitel@codeaurora.org>
Tue, 22 Mar 2016 18:07:07 +0000 (11:07 -0700)
commit2c455f7be19ae4deb0884cef204746b386a7e199
tree7de64aa107bbb18ebb594fc65a1acf05e3c5e819
parent1a2f71ae4f42c46341c419c41914672930d52a32
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>
drivers/usb/dwc3/gadget.c