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

Commit 007b6cca authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: add support for handling MHI SYS ERROR state in low power mode



It's possible for device to enter error state immediately after
entering low power mode. This change add supports for it by
forcing a sys error check during a fail resume.

CRs-Fixed: 2373857
Change-Id: I7fcf1804dcc147397e0ff4e0e3f59749396a90e2
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent dda88913
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1381,12 +1381,20 @@ void mhi_ctrl_ev_task(unsigned long data)
{
	struct mhi_event *mhi_event = (struct mhi_event *)data;
	struct mhi_controller *mhi_cntrl = mhi_event->mhi_cntrl;
	enum mhi_dev_state state = MHI_STATE_MAX;
	enum mhi_dev_state state;
	enum MHI_PM_STATE pm_state = 0;
	int ret;

	MHI_VERB("Enter for ev_index:%d\n", mhi_event->er_index);

	/*
	 * we can check pm_state w/o a lock here because there is no way
	 * pm_state can change from reg access valid to no access while this
	 * therad being executed.
	 */
	if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		return;

	/* process ctrl events events */
	ret = mhi_event->process_event(mhi_cntrl, mhi_event, U32_MAX);

@@ -1396,7 +1404,6 @@ void mhi_ctrl_ev_task(unsigned long data)
	 */
	if (!ret) {
		write_lock_irq(&mhi_cntrl->pm_lock);
		if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		state = mhi_get_mhi_state(mhi_cntrl);
		if (state == MHI_STATE_SYS_ERR) {
			MHI_ERR("MHI system error detected\n");
+6 −0
Original line number Diff line number Diff line
@@ -1045,6 +1045,12 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
		MHI_ERR("Did not enter M0 state, cur_state:%s pm_state:%s\n",
			TO_MHI_STATE_STR(mhi_cntrl->dev_state),
			to_mhi_pm_state_str(mhi_cntrl->pm_state));

		/*
		 * It's possible device already in error state and we didn't
		 * process it due to low power mode, force a check
		 */
		mhi_intvec_threaded_handlr(0, mhi_cntrl);
		return -EIO;
	}