usb: gadget: gsi: Use pm_runtime related API from state machine
Currently USB GSI function driver increments USB gadget device's
pm usage count on set_alt() and decrements on USB bus suspend or
USB cable disconnect case. Current code is not decrementing this
usage count when sm_state is STATE_INITIALIZED and USB cable is
disconnected (i.e. event EVT_DISCONNECTED posted). In this case,
USB doesn't go into low power mode although USB cable is disconnected.
Hence to handle this case make sure to increment USB device's PM
usage count from state machine instead of set_alt().
Also fix one of bug where state machine is peeking event but it is
not deleting same event from queue which shall result into using
same event multiple time in different states.
Use usb_gadget_autopm_get() instead of usb_gadget_autopm_get_noresume()
as noresume variant only increment usage count which is not sufficient
condition to prevent USB to go into LPM. usb_gadget_autopm_get()
increments both usage count and child count.
Change-Id: I667aef9208d14b2dff5944ad6ad9b053797c4ac9
Signed-off-by:
Mayank Rana <mrana@codeaurora.org>
Loading
Please register or sign in to comment