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

Commit 5663044e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mhi: core: synchronize fast resume and state change event thread"

parents 738a5675 23590203
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1175,6 +1175,15 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
			{
				enum MHI_PM_STATE new_state;

				/*
				 * Don't process sys error if device support
				 * rddm since we will be processing rddm ee
				 * event instead of sys error state change event
				 */
				if (mhi_cntrl->ee == MHI_EE_RDDM ||
				    mhi_cntrl->rddm_image)
					break;

				MHI_ERR("MHI system error detected\n");
				write_lock_irq(&mhi_cntrl->pm_lock);
				new_state = mhi_tryset_pm_state(mhi_cntrl,
+8 −10
Original line number Diff line number Diff line
@@ -1273,6 +1273,9 @@ int mhi_pm_fast_resume(struct mhi_controller *mhi_cntrl, bool notify_client)
		}
	}

	/* do not process control events */
	tasklet_disable(&mhi_cntrl->mhi_event->task);

	write_lock_irq(&mhi_cntrl->pm_lock);
	/* restore the states */
	mhi_cntrl->pm_state = mhi_cntrl->saved_pm_state;
@@ -1284,19 +1287,14 @@ int mhi_pm_fast_resume(struct mhi_controller *mhi_cntrl, bool notify_client)
		mhi_pm_m0_transition(mhi_cntrl);
	case MHI_PM_M2:
		read_lock_bh(&mhi_cntrl->pm_lock);
		/*
		 * we're doing a double check of pm_state because by the time we
		 * grab the pm_lock, device may have already initiate a M0 on
		 * its own. If that's the case we should not be toggling device
		 * wake.
		 */
		if (mhi_cntrl->pm_state == MHI_PM_M2) {
		mhi_cntrl->wake_get(mhi_cntrl, true);
		mhi_cntrl->wake_put(mhi_cntrl, true);
		}
		read_unlock_bh(&mhi_cntrl->pm_lock);
	}

	/* now it's safe to process ctrl events */
	tasklet_enable(&mhi_cntrl->mhi_event->task);

	/*
	 * In fast suspend/resume case device is not aware host transition
	 * to suspend state. So, device could be triggering a interrupt while