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

Commit 261d527d authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

mhi: core: notify MHI control driver if MHI device enters an error state



Notify control driver whenever MHI device enters error state. So,
control driver can perform control specific cleanup.

CRs-Fixed: 2359699
Change-Id: I7fdd8f5d64b4184ac49a62dcb1c7187b19860131
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 4e3c5e9b
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -1280,20 +1280,32 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev)
	struct mhi_controller *mhi_cntrl = dev;
	enum mhi_dev_state state = MHI_STATE_MAX;
	enum MHI_PM_STATE pm_state = 0;
	enum mhi_ee ee;

	MHI_VERB("Enter\n");

	write_lock_irq(&mhi_cntrl->pm_lock);
	if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
	if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) {
		state = mhi_get_mhi_state(mhi_cntrl);
		ee = mhi_get_exec_env(mhi_cntrl);
	}

	if (state == MHI_STATE_SYS_ERR) {
		MHI_ERR("MHI system error detected\n");
		pm_state = mhi_tryset_pm_state(mhi_cntrl,
					       MHI_PM_SYS_ERR_DETECT);
	}
	write_unlock_irq(&mhi_cntrl->pm_lock);
	if (pm_state == MHI_PM_SYS_ERR_DETECT)
	if (pm_state == MHI_PM_SYS_ERR_DETECT) {
		wake_up_all(&mhi_cntrl->state_event);

		/* for fatal errors, we let controller decide next step */
		if (MHI_IN_PBL(ee))
			mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
					     MHI_CB_FATAL_ERROR);
		else
			schedule_work(&mhi_cntrl->syserr_worker);
	}

	MHI_VERB("Exit\n");

+5 −0
Original line number Diff line number Diff line
@@ -498,6 +498,11 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl,
		TO_MHI_STATE_STR(mhi_cntrl->dev_state),
		to_mhi_pm_state_str(transition_state));

	/* We must notify MHI control driver so it can clean up first */
	if (transition_state == MHI_PM_SYS_ERR_PROCESS)
		mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
				     MHI_CB_SYS_ERROR);

	mutex_lock(&mhi_cntrl->pm_mutex);
	write_lock_irq(&mhi_cntrl->pm_lock);
	prev_state = mhi_cntrl->pm_state;
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ 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_SYS_ERROR: MHI device enter error state (may recover)
 * @MHI_CB_FATAL_ERROR: MHI device entered fatal error
 */
enum MHI_CB {
	MHI_CB_IDLE,
@@ -27,6 +29,8 @@ enum MHI_CB {
	MHI_CB_LPM_ENTER,
	MHI_CB_LPM_EXIT,
	MHI_CB_EE_RDDM,
	MHI_CB_SYS_ERROR,
	MHI_CB_FATAL_ERROR,
};

/**