Skip to content

Commit

Permalink
bus: mhi: Early MHI resume failure in non M3 state
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Bhaumik Bhatt <[email protected]>
Reviewed-by: Manivannan Sadhasivam <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Manivannan Sadhasivam <[email protected]>
  • Loading branch information
Loic Poulain authored and Mani-Sadhasivam committed Mar 10, 2021
1 parent 8de5ad9 commit 020d3b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/bus/mhi/core/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 020d3b2

Please sign in to comment.