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

Commit a1de935a authored by Bhaumik Bhatt's avatar Bhaumik Bhatt
Browse files

mhi: cntrl: qcom: remove DDR bus scale votes in fast suspends



Remove DDR bus scale votes if doing a suspend which involves
handing off link control to the DRV processor.

Change-Id: Iaba7d0b3f389443af6eca99232f148bc461f4e9a
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent 283c2816
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -579,12 +579,17 @@ static int mhi_arch_drv_suspend(struct mhi_controller *mhi_cntrl)
	if (cur_link_info->target_link_speed != PCI_EXP_LNKSTA_CLS_2_5GB) {
		link_info.target_link_speed = PCI_EXP_LNKSTA_CLS_2_5GB;
		link_info.target_link_width = cur_link_info->target_link_width;
		ret = mhi_arch_pcie_scale_bw(mhi_cntrl, pci_dev, &link_info);

		ret = msm_pcie_set_link_bandwidth(pci_dev,
						  link_info.target_link_speed,
						  link_info.target_link_width);
		if (ret) {
			MHI_ERR("Failed to switch Gen1 speed\n");
			return -EBUSY;
		}

		/* no DDR votes when doing a drv suspend */
		mhi_arch_set_bus_request(mhi_cntrl, 0);
		bw_switched = true;
	}

@@ -593,9 +598,7 @@ static int mhi_arch_drv_suspend(struct mhi_controller *mhi_cntrl)
				  pci_dev, NULL, mhi_cntrl->wake_set ?
				  MSM_PCIE_CONFIG_NO_L1SS_TO : 0);

	/*
	 * we failed to suspend and scaled down pcie bw.. need to scale up again
	 */
	/* failed to suspend and scaled down pcie bw, need to scale up again */
	if (ret && bw_switched) {
		mhi_arch_pcie_scale_bw(mhi_cntrl, pci_dev, cur_link_info);
		return ret;
@@ -713,10 +716,15 @@ int mhi_arch_link_resume(struct mhi_controller *mhi_cntrl)
	case MHI_FAST_LINK_OFF:
		ret = msm_pcie_pm_control(MSM_PCIE_RESUME, mhi_cntrl->bus,
					  pci_dev, NULL, 0);
		if (ret ||
		    cur_info->target_link_speed == PCI_EXP_LNKSTA_CLS_2_5GB)
		if (ret)
			break;

		if (cur_info->target_link_speed == PCI_EXP_LNKSTA_CLS_2_5GB) {
			mhi_arch_set_bus_request(mhi_cntrl,
						 cur_info->target_link_speed);
			break;
		}

		/*
		 * BW request from device isn't for gen 1 link speed, we can
		 * only print an error here.