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

Commit a656c074 authored by Yan He's avatar Yan He
Browse files

msm: pcie: Enable WAKE IRQ all the time



When WLAN driver has suspended but PCIe bus driver has not
suspended yet, there is a small window that WiFi HW asserts WAKE
gpio but the wake IRQ is not enabled yet. Thus, PCIe bus driver
will enable WAKE IRQ all the time and abort any ongoing suspend
process after receives WAKE IRQ.

Change-Id: I3fc199c7b165ed00f3db9eee5eabc08faaf96e34
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent ce71070e
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1451,9 +1451,6 @@ static int msm_pcie_pm_suspend(struct pci_dev *dev, u32 rc_idx,

	msm_pcie_disable(rc_idx, PM_PIPE_CLK | PM_CLK | PM_VREG);

	PCIE_DBG("enabling wake_n\n");
	enable_irq(msm_pcie_dev[rc_idx].wake_n);

	return ret;
}

@@ -1478,9 +1475,6 @@ static int msm_pcie_pm_resume(struct pci_dev *dev, u32 rc_idx,
{
	int ret;

	PCIE_DBG("disabling wake_n\n");
	disable_irq(msm_pcie_dev[rc_idx].wake_n);

	spin_lock_irqsave(&msm_pcie_dev[rc_idx].cfg_lock,
				msm_pcie_dev[rc_idx].irqsave_flags);
	msm_pcie_dev[rc_idx].cfg_access = true;
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/types.h>
#include <linux/pm_wakeup.h>
#include <mach/msm_pcie.h>

#define MSM_PCIE_MAX_VREG 3
@@ -169,6 +170,8 @@ struct msm_pcie_dev_t {
	bool                         user_suspend;
	struct pci_saved_state	     *saved_state;

	struct wakeup_source	     ws;

	bool                         l1ss_supported;
	bool                         aux_clk_sync;
};
+14 −4
Original line number Diff line number Diff line
@@ -39,7 +39,13 @@

static irqreturn_t handle_wake_irq(int irq, void *data)
{
	PCIE_DBG("\n");
	struct msm_pcie_dev_t *dev = data;

	PCIE_DBG("PCIe WAKE is asserted by Endpoint\n");

	__pm_stay_awake(&dev->ws);
	__pm_relax(&dev->ws);

	return IRQ_HANDLED;
}

@@ -322,6 +328,9 @@ int32_t msm_pcie_irq_init(struct msm_pcie_dev_t *dev)
	struct device *pdev = &dev->pdev->dev;

	PCIE_DBG("\n");

	wakeup_source_init(&dev->ws, "pcie_wakeup_source");

	/* register handler for physical MSI interrupt line */
	rc = devm_request_irq(pdev,
		dev->irq[MSM_PCIE_INT_MSI].num, handle_msi_irq,
@@ -346,9 +355,6 @@ int32_t msm_pcie_irq_init(struct msm_pcie_dev_t *dev)
		return rc;
	}

	/* PCIE_WAKE_N should be enabled only during system suspend */
	disable_irq(dev->wake_n);

	/* Create a virtual domain of interrupts */
	dev->irq_domain = irq_domain_add_linear(dev->pdev->dev.of_node,
			PCIE_MSI_NR_IRQS,
@@ -356,6 +362,7 @@ int32_t msm_pcie_irq_init(struct msm_pcie_dev_t *dev)
			&dev);
	if (!dev->irq_domain) {
		pr_err("PCIe: Unable to initialize irq domain\n");
		disable_irq(dev->wake_n);
		return PTR_ERR(dev->irq_domain);
	}

@@ -367,4 +374,7 @@ int32_t msm_pcie_irq_init(struct msm_pcie_dev_t *dev)
void msm_pcie_irq_deinit(struct msm_pcie_dev_t *dev)
{
	PCIE_DBG("\n");

	wakeup_source_trash(&dev->ws);
	disable_irq(dev->wake_n);
}