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

Commit 536f885c authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: notify mission mode transition to control driver



MHI control driver require notification from core layer soon as
device enter mission mode transition.

CRs-Fixed: 2457211
Change-Id: Ifbfc60164ffd52290e23b395ea6aa590ec19f26a
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 1ff48618
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -436,27 +436,31 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl)

	MHI_LOG("Processing Mission Mode Transition\n");

	/* force MHI to be in M0 state before continuing */
	ret = __mhi_device_get_sync(mhi_cntrl);
	if (ret)
		return ret;

	ret = -EIO;

	write_lock_irq(&mhi_cntrl->pm_lock);
	if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl);
	write_unlock_irq(&mhi_cntrl->pm_lock);

	read_lock_bh(&mhi_cntrl->pm_lock);
	if (!MHI_IN_MISSION_MODE(mhi_cntrl->ee))
		goto error_mission_mode;
		return -EIO;

	wake_up_all(&mhi_cntrl->state_event);

	mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
			     MHI_CB_EE_MISSION_MODE);

	/* force MHI to be in M0 state before continuing */
	ret = __mhi_device_get_sync(mhi_cntrl);
	if (ret)
		return ret;

	read_lock_bh(&mhi_cntrl->pm_lock);

	/* add elements to all HW event rings */
	if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
	if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
		ret = -EIO;
		goto error_mission_mode;
	}

	mhi_event = mhi_cntrl->mhi_event;
	for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) {
@@ -490,8 +494,6 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl)
	/* setup sysfs nodes for userspace votes */
	mhi_create_vote_sysfs(mhi_cntrl);

	ret = 0;

	read_lock_bh(&mhi_cntrl->pm_lock);

error_mission_mode:
+1 −0
Original line number Diff line number Diff line
@@ -2263,6 +2263,7 @@ static void ipa_mpm_mhi_status_cb(struct mhi_device *mhi_dev,
	case MHI_CB_SYS_ERROR:
	case MHI_CB_FATAL_ERROR:
	case MHI_CB_BW_REQ:
	case MHI_CB_EE_MISSION_MODE:
		IPA_MPM_ERR("unexpected event %d\n", mhi_cb);
		break;
	}
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ struct mhi_buf_info;
 * @MHI_CB_LPM_ENTER: MHI host entered low power mode
 * @MHI_CB_LPM_EXIT: MHI host about to exit low power mode
 * @MHI_CB_EE_RDDM: MHI device entered RDDM execution enviornment
 * @MHI_CB_EE_MISSION_MODE: MHI device entered Mission Mode ee
 * @MHI_CB_SYS_ERROR: MHI device enter error state (may recover)
 * @MHI_CB_FATAL_ERROR: MHI device entered fatal error
 * @MHI_CB_BW_REQ: Received a bandwidth switch request from device
@@ -30,6 +31,7 @@ enum MHI_CB {
	MHI_CB_LPM_ENTER,
	MHI_CB_LPM_EXIT,
	MHI_CB_EE_RDDM,
	MHI_CB_EE_MISSION_MODE,
	MHI_CB_SYS_ERROR,
	MHI_CB_FATAL_ERROR,
	MHI_CB_BW_REQ,