usb: phy: Add new OTG state OTG_STATE_B_SUSPENDED
This state is used to handle:- - Bus suspend followed by cable disconnect: pm usage count is incremented upon cable connect. Upon bus suspend, suspend interrupt kicks in otg state machine which moves device state to OTG_STATE_B_SUSPENDED from OTG_STATE_B_PERIPHERAL and decrements pm usage count. Upon cable unplug additional decrement of pm usage count is prevented. This state also takes care the handling of cable unplug followed by bus suspend interrupt. - Host initiated resume after bus suspend: Being in OTG_STATE_B_SUSPENDED after bus suspend, upon host initiated resume, wakeup interrupt kicks in otg state machine which moves device to OTG_STATE_B_PERIPHERAL state by incrementing pm usage count. - PC reboot with cable plugged in: After PC shutdown device goes to OTG_STATE_B_SUSPENDED state. After PC start power event irq thread kicks in otg state machine to move device to OTG_STATE_B_PERIPHERAL state and increments pm usage count. - Composition switch after bus suspend: dwc3_gadget_pullup() kicks in otg state machine to move device state from OTG_STATE_B_SUSPENDED to OTG_STATE_B_PERIPHERAL and increments pm usage count to prevent runtime suspend during device enumeration. Also, remove pm_runtime_set_active() which sets the PM runtime stauts as active to avoid pm_runtime_get_sync() failures which explicitly checks for runtime pm status. For example, if status is active, pm_runtime_get_sync() will just increments the counter without actually resuming the device. Change-Id: Id33b81911ef3894a00802b3e553840b9447f6269 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> [jackp@codeaurora.org: cherry-pick only phy.h and common.c] Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
5bf0c1d26a
commit
0cfa0c949f
2 changed files with 2 additions and 0 deletions
|
@ -34,6 +34,7 @@ const char *usb_otg_state_string(enum usb_otg_state state)
|
|||
[OTG_STATE_B_PERIPHERAL] = "b_peripheral",
|
||||
[OTG_STATE_B_WAIT_ACON] = "b_wait_acon",
|
||||
[OTG_STATE_B_HOST] = "b_host",
|
||||
[OTG_STATE_B_SUSPEND] = "b_suspend",
|
||||
};
|
||||
|
||||
if (state < 0 || state >= ARRAY_SIZE(names))
|
||||
|
|
|
@ -44,6 +44,7 @@ enum usb_otg_state {
|
|||
OTG_STATE_B_IDLE,
|
||||
OTG_STATE_B_SRP_INIT,
|
||||
OTG_STATE_B_PERIPHERAL,
|
||||
OTG_STATE_B_SUSPEND,
|
||||
|
||||
/* extra dual-role default-b states */
|
||||
OTG_STATE_B_WAIT_ACON,
|
||||
|
|
Loading…
Add table
Reference in a new issue