summaryrefslogtreecommitdiff
path: root/core/pld/src
diff options
context:
space:
mode:
authorYuanyuan Liu <yuanliu@codeaurora.org>2016-04-11 11:43:30 -0700
committerAkash Patel <akashp@codeaurora.org>2016-05-06 14:51:27 -0700
commitd698eb6cd3b7b29cfe73123b150a0cf5be91f008 (patch)
treeab44a789f19d003fd315cb5e8063f76a4857cf2d /core/pld/src
parent44c44772ad4effec4fa605e1ebe1b1bfb727c7cc (diff)
qcacld-3.0: Add support for registering runtime PM APIs
Add support for registering runtime PM APIs in PLD. CRs-Fixed: 1010156 Change-Id: I8747edd0f8fc4bd79f72f7fba4b65d8c6ebd6887
Diffstat (limited to 'core/pld/src')
-rw-r--r--core/pld/src/pld_pcie.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/core/pld/src/pld_pcie.c b/core/pld/src/pld_pcie.c
index ca7778059b55..ab3cbd1e52eb 100644
--- a/core/pld/src/pld_pcie.c
+++ b/core/pld/src/pld_pcie.c
@@ -198,6 +198,48 @@ static void pld_pcie_notify_handler(struct pci_dev *pdev, int state)
pld_context->ops->modem_status(&pdev->dev,
PLD_BUS_TYPE_PCIE, state);
}
+
+#ifdef FEATURE_RUNTIME_PM
+/**
+ * pld_pcie_runtime_suspend() - PM runtime suspend
+ * @pdev: PCIE device
+ *
+ * PM runtime suspend callback function.
+ *
+ * Return: int
+ */
+static int pld_pcie_runtime_suspend(struct pci_dev *pdev)
+{
+ struct pld_context *pld_context;
+
+ pld_context = pld_get_global_context();
+ if (pld_context->ops->runtime_suspend)
+ return pld_context->ops->runtime_suspend(&pdev->dev,
+ PLD_BUS_TYPE_PCIE);
+
+ return -ENODEV;
+}
+
+/**
+ * pld_pcie_runtime_resume() - PM runtime resume
+ * @pdev: PCIE device
+ *
+ * PM runtime resume callback function.
+ *
+ * Return: int
+ */
+static int pld_pcie_runtime_resume(struct pci_dev *pdev)
+{
+ struct pld_context *pld_context;
+
+ pld_context = pld_get_global_context();
+ if (pld_context->ops->runtime_resume)
+ return pld_context->ops->runtime_resume(&pdev->dev,
+ PLD_BUS_TYPE_PCIE);
+
+ return -ENODEV;
+}
+#endif
#endif
/**
@@ -246,6 +288,13 @@ static struct pci_device_id pld_pcie_id_table[] = {
};
#ifdef CONFIG_CNSS
+#ifdef FEATURE_RUNTIME_PM
+struct cnss_wlan_runtime_ops runtime_pm_ops = {
+ .runtime_suspend = pld_pcie_runtime_suspend,
+ .runtime_resume = pld_pcie_runtime_resume,
+};
+#endif
+
struct cnss_wlan_driver pld_pcie_ops = {
.name = "pld_pcie",
.id_table = pld_pcie_id_table,
@@ -259,6 +308,9 @@ struct cnss_wlan_driver pld_pcie_ops = {
.suspend = pld_pcie_suspend,
.resume = pld_pcie_resume,
#endif
+#ifdef FEATURE_RUNTIME_PM
+ .runtime_ops = &runtime_pm_ops,
+#endif
};
/**