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

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

Merge "mhi: cntrl: qcom: save POR PCIe link speed during probe"

parents 567ddc33 30fe7600
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -341,9 +341,11 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
	struct arch_info *arch_info = mhi_dev->arch_info;
	char node[32];
	int ret;
	u16 linkstat;

	if (!arch_info) {
		struct msm_pcie_register_event *reg_event;
		struct mhi_link_info *cur_link_info;

		arch_info = devm_kzalloc(&mhi_dev->pci_dev->dev,
					 sizeof(*arch_info), GFP_KERNEL);
@@ -410,6 +412,20 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
			  mhi_arch_pcie_bw_scale_work);
		mhi_dev->bw_scale = mhi_arch_pcie_bw_scale_cb;

		/* store the current bw info */
		ret = pcie_capability_read_word(mhi_dev->pci_dev,
						PCI_EXP_LNKSTA, &linkstat);
		if (ret)
			return ret;

		cur_link_info = &arch_info->current_link_info;
		cur_link_info->target_link_speed =
			linkstat & PCI_EXP_LNKSTA_CLS;
		cur_link_info->target_link_width =
			(linkstat & PCI_EXP_LNKSTA_NLW) >>
			PCI_EXP_LNKSTA_NLW_SHIFT;
		mhi_cntrl->mhi_link_info = *cur_link_info;

		mhi_driver_register(&mhi_bl_driver);
	}

+15 −1
Original line number Diff line number Diff line
@@ -799,6 +799,10 @@ static int pci_pm_suspend_noirq(struct device *dev)
		}
	}

	/* if d3hot is not supported bail out */
	if (pci_dev->no_d3hot)
		return 0;

	if (!pci_dev->state_saved) {
		pci_save_state(pci_dev);
		if (pci_power_manageable(pci_dev))
@@ -831,6 +835,7 @@ static int pci_pm_resume_noirq(struct device *dev)
	struct device_driver *drv = dev->driver;
	int error = 0;

	if (!pci_dev->no_d3hot)
		pci_pm_default_resume_early(pci_dev);

	if (pci_has_legacy_pm_support(pci_dev))
@@ -1204,6 +1209,10 @@ static int pci_pm_runtime_suspend(struct device *dev)
		return 0;
	}

	/* if d3hot is not supported bail out */
	if (pci_dev->no_d3hot)
		return 0;

	if (!pci_dev->state_saved) {
		pci_save_state(pci_dev);
		pci_finish_runtime_suspend(pci_dev);
@@ -1218,6 +1227,10 @@ static int pci_pm_runtime_resume(struct device *dev)
	struct pci_dev *pci_dev = to_pci_dev(dev);
	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;

	/* we skipped d3hot processing so skip re-init */
	if (pci_dev->no_d3hot)
		goto skip_restore;

	/*
	 * Restoring config space is necessary even if the device is not bound
	 * to a driver because although we left it in D0, it may have gone to
@@ -1235,6 +1248,7 @@ static int pci_pm_runtime_resume(struct device *dev)
	pci_enable_wake(pci_dev, PCI_D0, false);
	pci_fixup_device(pci_fixup_resume, pci_dev);

skip_restore:
	rc = pm->runtime_resume(dev);

	pci_dev->runtime_d3cold = false;
+1 −0
Original line number Diff line number Diff line
@@ -337,6 +337,7 @@ struct pci_dev {
	unsigned int	d2_support:1;	/* Low power state D2 is supported */
	unsigned int	no_d1d2:1;	/* D1 and D2 are forbidden */
	unsigned int	no_d3cold:1;	/* D3cold is forbidden */
	unsigned int	no_d3hot:1;	/* D3hot is forbidden */
	unsigned int	bridge_d3:1;	/* Allow D3 for bridge */
	unsigned int	d3cold_allowed:1;	/* D3cold is allowed by user */
	unsigned int	mmio_always_on:1;	/* disallow turning off io/mem