Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efb42990 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt Committed by Hemant Kumar
Browse files

mhi: core: add wait for m2 state change before suspend



Some controllers would like to wait for MHI state to change
to M2 before continuing with suspend. Allow for that by
providing a configurable timeout in milliseconds.

Change-Id: I9b700074de427dfc9f065e795e4fa2db26daae63
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent 773b595b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1145,6 +1145,11 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)
		return -EBUSY;
	}

	/* wait here if controller wants device to be in M2 before proceeding */
	wait_event_timeout(mhi_cntrl->state_event,
			   mhi_cntrl->dev_state == MHI_STATE_M2,
			   msecs_to_jiffies(mhi_cntrl->m2_timeout_ms));

	/* disable ctrl event processing */
	tasklet_disable(&mhi_cntrl->mhi_event->task);

+1 −0
Original line number Diff line number Diff line
@@ -253,6 +253,7 @@ struct mhi_controller {
	struct mhi_ctxt *mhi_ctxt;

	u32 timeout_ms;
	u32 m2_timeout_ms; /* wait time for host to continue suspend after m2 */

	/* caller should grab pm_mutex for suspend/resume operations */
	struct mutex pm_mutex;