Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 541cf8b3 authored by Mayank Rana's avatar Mayank Rana Committed by Hemant Kumar
Browse files

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: default avatarMayank Rana <mrana@codeaurora.org>
parent 60aacdb7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment