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

Commit dda88913 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: always try forcing device into rddm when bus master requests



Let bus master determine the link states. Whenever bus master request
device to enter rddm always try enter rddm regardless of current
software state.

CRs-Fixed: 2373857
Change-Id: I9e5a993f3e7311c4367b7fd82385d4f0dcacc932
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent d7bfff08
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -60,14 +60,8 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl)
	 * returning from this function, we expect device to reset.
	 *
	 * Normaly, we would read/write pm_state only after grabbing
	 * pm_lock, since we're in a panic, skipping it.
	 */

	if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		return -EIO;

	/*
	 * There is no gurantee this state change would take effect since
	 * pm_lock, since we're in a panic, skipping it. Also there is no
	 * gurantee this state change would take effect since
	 * we're setting it w/o grabbing pmlock, it's best effort
	 */
	mhi_cntrl->pm_state = MHI_PM_LD_ERR_FATAL_DETECT;
+0 −21
Original line number Diff line number Diff line
@@ -1124,22 +1124,8 @@ int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl)
		to_mhi_pm_state_str(mhi_cntrl->pm_state),
		TO_MHI_EXEC_STR(mhi_cntrl->ee));

	/* before rddm mode, we need to enter M0 state */
	ret = __mhi_device_get_sync(mhi_cntrl);
	if (ret)
		return ret;

	mutex_lock(&mhi_cntrl->pm_mutex);
	write_lock_irq(&mhi_cntrl->pm_lock);
	if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		goto no_reg_access;

	MHI_LOG("Triggering SYS_ERR to force rddm state\n");

	mhi_set_mhi_state(mhi_cntrl, MHI_STATE_SYS_ERR);
	mhi_cntrl->wake_put(mhi_cntrl, false);
	write_unlock_irq(&mhi_cntrl->pm_lock);
	mutex_unlock(&mhi_cntrl->pm_mutex);

	/* wait for rddm event */
	MHI_LOG("Waiting for device to enter RDDM state\n");
@@ -1153,12 +1139,5 @@ int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl)
		TO_MHI_EXEC_STR(mhi_cntrl->ee), ret);

	return ret;

no_reg_access:
	mhi_cntrl->wake_put(mhi_cntrl, false);
	write_unlock_irq(&mhi_cntrl->pm_lock);
	mutex_unlock(&mhi_cntrl->pm_mutex);

	return -EIO;
}
EXPORT_SYMBOL(mhi_force_rddm_mode);