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

Commit f4c64019 authored by Prashanth Bhatta's avatar Prashanth Bhatta
Browse files

cnss: Set D3hot state only after saving config space



CNSS saves the PCIe config space but that is done after entering
D3hot state. In D3hot, PCIe endpoint would be aggressive to go to
low power mode. Because of this saving and restoring config space
may take longer time. With this change, about 5 times improvement
is seen while saving/restoring the config space.

Change-Id: I847e8efeab7b0ce5b4ddcec367997ae14373900d
Signed-off-by: default avatarPrashanth Bhatta <bhattap@codeaurora.org>
parent 53d2912c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3046,6 +3046,10 @@ int cnss_auto_suspend(void)
	if (penv->pcie_link_state) {
		pci_save_state(pdev);
		penv->saved_state = pci_store_saved_state(pdev);
		pci_disable_device(pdev);
		ret = pci_set_power_state(pdev, PCI_D3hot);
		if (ret)
			pr_err("%s: Set D3Hot failed: %d\n", __func__, ret);
		if (msm_pcie_pm_control(MSM_PCIE_SUSPEND,
			cnss_get_pci_dev_bus_number(pdev),
			pdev, NULL, PM_OPTIONS)) {
@@ -3081,6 +3085,9 @@ int cnss_auto_resume(void)
			ret = -EAGAIN;
			goto out;
		}
		ret = pci_enable_device(pdev);
		if (ret)
			pr_err("%s: enable device failed: %d\n", __func__, ret);
		penv->pcie_link_state = PCIE_LINK_UP;
	}

@@ -3089,6 +3096,7 @@ int cnss_auto_resume(void)
			&penv->saved_state);

	pci_restore_state(pdev);
	pci_set_master(pdev);

	atomic_set(&penv->auto_suspended, 0);
out: