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

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

Merge "mhi: cntrl: qcom: enable pm runtime in mission mode only"

parents f288b978 ff891d78
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -117,12 +117,11 @@ static void mhi_arch_pci_link_state_cb(struct msm_pcie_notify *notify)

		arch_info->drv_connected = true;

		pm_runtime_allow(&pci_dev->dev);

		mutex_lock(&mhi_cntrl->pm_mutex);

		/* if we're in amss attempt a suspend */
		if (mhi_dev->powered_on && mhi_cntrl->ee == MHI_EE_AMSS) {
			pm_runtime_allow(&pci_dev->dev);
			pm_runtime_mark_last_busy(&pci_dev->dev);
			pm_request_autosuspend(&pci_dev->dev);
		}
@@ -202,26 +201,33 @@ void mhi_arch_esoc_ops_power_off(void *priv, bool mdm_state)
	struct mhi_controller *mhi_cntrl = priv;
	struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
	struct arch_info *arch_info = mhi_dev->arch_info;
	struct pci_dev *pci_dev = mhi_dev->pci_dev;

	MHI_LOG("Enter: mdm_crashed:%d\n", mdm_state);

	/*
	 * Abort system suspend if system is preparing to go to suspend
	 * by grabbing wake source.
	 * If system is suspended, wait for pm notifier callback to notify
	 * that resume has occurred with PM_POST_SUSPEND event.
	 */
	pm_stay_awake(&mhi_cntrl->mhi_dev->dev);
	wait_for_completion(&arch_info->pm_completion);

	/* if link is in drv suspend, wake it up */
	pm_runtime_get_sync(&pci_dev->dev);

	mutex_lock(&mhi_cntrl->pm_mutex);
	if (!mhi_dev->powered_on) {
		MHI_LOG("Not in active state\n");
		mutex_unlock(&mhi_cntrl->pm_mutex);
		pm_runtime_put_noidle(&pci_dev->dev);
		return;
	}
	mhi_dev->powered_on = false;
	mutex_unlock(&mhi_cntrl->pm_mutex);

	/*
	 * Abort system suspend if system is preparing to go to suspend
	 * by grabbing wake source.
	 * If system is suspended, wait for pm notifier callback to notify
	 * that resume has occurred with PM_POST_SUSPEND event.
	 */
	pm_stay_awake(&mhi_cntrl->mhi_dev->dev);
	wait_for_completion(&arch_info->pm_completion);
	pm_runtime_put_noidle(&pci_dev->dev);

	MHI_LOG("Triggering shutdown process\n");
	mhi_power_down(mhi_cntrl, !mdm_state);
+2 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ static int mhi_runtime_suspend(struct device *dev)

	if (ret) {
		MHI_LOG("Abort due to ret:%d\n", ret);
		mhi_dev->suspend_mode = MHI_ACTIVE_STATE;
		goto exit_runtime_suspend;
	}

@@ -364,6 +365,7 @@ int mhi_system_suspend(struct device *dev)

	if (ret) {
		MHI_LOG("Abort due to ret:%d\n", ret);
		mhi_dev->suspend_mode = MHI_ACTIVE_STATE;
		goto exit_system_suspend;
	}