usb: bam: Allow USB to attempt LPM after disconnecting IPA
If usb_bam_disconnect_ipa_prod() is called with a USB consumer, it
first does usb_bam_resume_core() which calls pm_runtime_resume()
to ensure USB is not in low power mode. However, this can race
with a pending idle request, and could potentially cancel the
suspend from happening.
Fix this by setting the pending_lpm flag in disconnect_ipa_prod().
This will allow the usb_bam_suspend_core() that gets called at the
end of usb_bam_disconnect_ipa() to actually go through and suspend
the USB controller. While at it, replace pm_runtime_suspend() with
pm_runtime_idle() since that allows the controller to perform any
pre-suspend handling if needed. Finally, move the call to
resume_core() to the beginning of usb_bam_disconnect_ipa() in
order to balance with the call to suspend_core() at the end.
Change-Id: I9f651338eaf092aa22215faaf8f7894937f1f944
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment