diff options
author | Ajay Agarwal <ajaya@codeaurora.org> | 2018-10-03 17:20:12 +0530 |
---|---|---|
committer | Ajay Agarwal <ajaya@codeaurora.org> | 2018-10-16 14:13:49 +0530 |
commit | 4a915f892eb44545e25349be42d1dc2cba0495fd (patch) | |
tree | 3dffd004afb44e54a87de46199f700831557a7ef | |
parent | 51abefff9fb42c8834acb643d6aa70d855e0cf43 (diff) |
usb: dwc3-msm: Flush bus_vote_w work on pm_suspend and freeze
Currently as a part of dwc3_msm_pm_suspend, driver calls suspend
routine which schedules bus_vote_w to remove bus votes from USB.
But it could be possible that the system freezes before the work
function could get called or completed. This will keep the USB
votes enabled and block XO shutdown.
Fix this by flushing the bus_vote_w at the end of pm_suspend to
ensure that bus votes are removed.
Change-Id: I578e3c4434eb04740f07f4dd0640a945a86fde8b
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
-rw-r--r-- | drivers/usb/dwc3/dwc3-msm.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 1e23738e20b3..5f547793eb9f 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -4059,10 +4059,13 @@ static int dwc3_msm_pm_suspend(struct device *dev) } ret = dwc3_msm_suspend(mdwc, false); - if (!ret) - atomic_set(&mdwc->pm_suspended, 1); + if (ret) + return ret; - return ret; + flush_work(&mdwc->bus_vote_w); + atomic_set(&mdwc->pm_suspended, 1); + + return 0; } static int dwc3_msm_pm_freeze(struct device *dev) @@ -4091,10 +4094,13 @@ static int dwc3_msm_pm_freeze(struct device *dev) mdwc->hs_phy->flags &= ~PHY_HOST_MODE; ret = dwc3_msm_suspend(mdwc, true); - if (!ret) - atomic_set(&mdwc->pm_suspended, 1); + if (ret) + return ret; - return ret; + flush_work(&mdwc->bus_vote_w); + atomic_set(&mdwc->pm_suspended, 1); + + return 0; } static int dwc3_msm_pm_resume(struct device *dev) |