phy_msm_usb: Fix crash when switching from peripheral to host mode
When system boots up, USB driver waits using wait_for_completion()
event for the initial VBUS state notification from PMIC.
Once VBUS initial state is reported to USB after PMIC driver
initialization, USB sets the completion variable pmic_vbus_done
to value 1. Later wait_for_completion() event sets the variable
pmic_vbus_done to value 0.
For USB cable disconnect/connect events, PMIC notifies to USB
through msm_otg_set_vbus_state() and USB queues msm_otg_sm_work()
to process the disconnect/connect events. For the crash scenario,
as the variable pmic_vbus_done value is set to zero, hence USB
returns from msm_otg_set_vbus_state() without queuing the
msm_otg_sm_work() due to which USB disconnect event is not processed
and crash happens when USB switching from peripheral to host mode.
Fixing the issue using a static flag init which will be initialized
to false. Once VBUS initial state is reported to USB after PMIC
driver initialization, set the static flag init to true.
CRs-Fixed: 607067
Change-Id: Id229537f9223a031f68b793725021225e13376a7
Signed-off-by:
Saket Saurabh <ssaurabh@codeaurora.org>
Loading
Please register or sign in to comment