USB: msm_otg: Fail suspend if !BSV is under processing
USB BAM driver is also responsible for putting USB OTG
in runtime suspend state during bus suspend or cable
disconnect. There is a handshake between usb_bam and
IPA for the same. msm_otg checks with usb_bam for the
same using msm_bam_lpm_ok() before entering suspend
to make sure that handshake between usb_bam and its
peer bam peripheral is finished.
In case that handshake takes more time and msm_bam_lpm_ok
returns FALSE then it is the responsibility of usb_bam
driver to put usb_otg in runtime_suspend later when
it is finished. But, there is chance that user disconnects
USB cable just when usb_bam is trying to put USB in
LPM and its processing is not finished by sm_work_fn.
This may result in stop_peripheral and msm_otg_suspend
racing with each other. Fix this by not allowing LPM if
cable is disconnected but OTG state is not B_IDLE. OTG
state is marked B_IDLE only after gadget driver is
disconnected or stopped.
CRs-fixed: 606558
Change-Id: I14b12ba52afd568bcb7fbc5a690ed135c3e90c55
Signed-off-by:
Manu Gautam <mgautam@codeaurora.org>
Loading
Please register or sign in to comment