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

Commit f9c8d6dd authored by Subramanian Ananthanarayanan's avatar Subramanian Ananthanarayanan Committed by Gerrit - the friendly Code Review server
Browse files

pci:switch: Implement PM ops for QPS615 support



Changes are to save and restore PCI switch config space as part
of system suspend/resume scenario.

Change-Id: I30a1024e1fb7f70e2274d6a6347fdce6e5b019cd
Signed-off-by: default avatarSubramanian Ananthanarayanan <skananth@codeaurora.org>
parent 64ddfd32
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@

#define DIODE_VENDOR_ID	0x12d8
#define DIODE_DEVICE_ID	0xb304
#define NTN3_VENDOR_ID	PCI_VENDOR_ID_TOSHIBA
#define NTN3_DEVICE_ID	0x0623

/*
 * @DIODE_ERRATA_0: Apply errata specific to the upstream port (USP).
@@ -256,6 +258,9 @@ static struct pci_device_id switch_qcom_pci_tbl[] = {
	{
		PCI_DEVICE(DIODE_VENDOR_ID, DIODE_DEVICE_ID),
	},
	{
		PCI_DEVICE(NTN3_VENDOR_ID, NTN3_DEVICE_ID),
	},
	{0},
};
MODULE_DEVICE_TABLE(pci, switch_qcom_pci_tbl);
@@ -314,11 +319,33 @@ static int switch_qcom_pci_probe(struct pci_dev *pdev,
	return 0;
}

static int switch_qcom_pci_suspend(struct device *dev)
{
	struct pci_dev *pdev = to_pci_dev(dev);

	pci_save_state(pdev);
	pci_set_power_state(pdev, PCI_D3hot);

	return 0;
}
static int switch_qcom_pci_resume(struct device *dev)
{
	struct pci_dev *pdev = to_pci_dev(dev);

	pci_set_power_state(pdev, PCI_D0);
	pci_restore_state(pdev);

	return 0;
}
const struct dev_pm_ops switch_qcom_pci_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(switch_qcom_pci_suspend, switch_qcom_pci_resume)
};
static struct pci_driver switch_qcom_pci_driver = {
	.name		= "pcie-qcom-switch",
	.id_table	= switch_qcom_pci_tbl,
	.probe		= switch_qcom_pci_probe,
	.remove		= switch_qcom_pci_remove,
	.driver.pm	= &switch_qcom_pci_pm_ops,
};

static int __init switch_qcom_pci_init(void)