Bläddra i källkod

qcacld-3.0: Register suspend_noirq/resume_noirq to kernel

Register suspend_noirq/resume_noirq callbacks to kernel. It will
make sure no wake up is pending from firmware and if initial wake
up is received then failing it should trigger resume.

Change-Id: I1882011cab7365a026827a60c44375f0f1dc6102
Yue Ma 8 år sedan
förälder
incheckning
e42c8453ee
1 ändrade filer med 54 tillägg och 0 borttagningar
  1. 54 0
      core/pld/src/pld_pcie.c

+ 54 - 0
core/pld/src/pld_pcie.c

@@ -278,6 +278,58 @@ static int pld_pcie_resume(struct pci_dev *pdev)
 	pld_context = pld_get_global_context();
 	return pld_context->ops->resume(&pdev->dev, PLD_BUS_TYPE_PCIE);
 }
+
+/**
+ * pld_pcie_suspend_noirq() - Complete the actions started by suspend()
+ * @pdev: PCI device
+ *
+ * Complete the actions started by suspend().  Carry out any additional
+ * operations required for suspending the device that might be racing
+ * with its driver's interrupt handler, which is guaranteed not to run
+ * while suspend_noirq() is being executed.
+ *
+ * Return: 0 for success
+ *         Non zero failure code for errors
+ */
+static int pld_pcie_suspend_noirq(struct pci_dev *pdev)
+{
+	struct pld_context *pld_context;
+
+	pld_context = pld_get_global_context();
+	if (!pld_context)
+		return -EINVAL;
+
+	if (pld_context->ops->suspend_noirq)
+		return pld_context->ops->
+			suspend_noirq(&pdev->dev, PLD_BUS_TYPE_PCIE);
+	return 0;
+}
+
+/**
+ * pld_pcie_resume_noirq() - Prepare for the execution of resume()
+ * @pdev: PCI device
+ *
+ * Prepare for the execution of resume() by carrying out any additional
+ * operations required for resuming the device that might be racing with
+ * its driver's interrupt handler, which is guaranteed not to run while
+ * resume_noirq() is being executed.
+ *
+ * Return: 0 for success
+ *         Non zero failure code for errors
+ */
+static int pld_pcie_resume_noirq(struct pci_dev *pdev)
+{
+	struct pld_context *pld_context;
+
+	pld_context = pld_get_global_context();
+	if (!pld_context)
+		return -EINVAL;
+
+	if (pld_context->ops->resume_noirq)
+		return pld_context->ops->
+			resume_noirq(&pdev->dev, PLD_BUS_TYPE_PCIE);
+	return 0;
+}
 #endif
 
 static struct pci_device_id pld_pcie_id_table[] = {
@@ -310,6 +362,8 @@ struct cnss_wlan_driver pld_pcie_ops = {
 #ifdef CONFIG_PM
 	.suspend    = pld_pcie_suspend,
 	.resume     = pld_pcie_resume,
+	.suspend_noirq = pld_pcie_suspend_noirq,
+	.resume_noirq  = pld_pcie_resume_noirq,
 #endif
 #ifdef FEATURE_RUNTIME_PM
 	.runtime_ops = &runtime_pm_ops,