summaryrefslogtreecommitdiffstats
path: root/drivers/bus/mhi
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2021-03-05 17:14:01 +0100
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2021-03-10 20:11:22 +0530
commit020d3b26c07abe274ac17f64999bbd3bf3342195 (patch)
tree996dc769709bd086f6f4ad0b0240d89ffe9c5d8d /drivers/bus/mhi
parent8de5ad99414347ad08e6ebc2260be1d2e009cb9a (diff)
downloadlinux-stable-020d3b26c07abe274ac17f64999bbd3bf3342195.tar.gz
linux-stable-020d3b26c07abe274ac17f64999bbd3bf3342195.tar.bz2
linux-stable-020d3b26c07abe274ac17f64999bbd3bf3342195.zip
bus: mhi: Early MHI resume failure in non M3 state
MHI suspend/resume are symmetric and balanced procedures. If device is not in M3 state on a resume, that means something happened behind our back. In this case resume is aborted and error reported, to let the controller handle the situation. This is mainly requested for system wide suspend-resume operation in PCI context which may lead to power-down/reset of the controller which will then lose its MHI context. In such cases, PCI driver is supposed to recover and reinitialize the device. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/1614960841-20233-1-git-send-email-loic.poulain@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/bus/mhi')
-rw-r--r--drivers/bus/mhi/core/pm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 681960c72d2a..d61e6369a6e1 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -880,6 +880,9 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
return -EIO;
+ if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3)
+ return -EINVAL;
+
/* Notify clients about exiting LPM */
list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
mutex_lock(&itr->mutex);