Browse Source

qcacmn: Do not access bus in suspend_noirq

The WLAN suspend process has three phases:
	1) protocol suspend
	2) bus suspend
	3) bus suspend, no-irq

Currently, it is assumed by the WLAN driver that the bus will not be put
down until after step 3. Moving forward, however, the PCIe driver will
be putting the bus link down between steps 2 and 3. In order to
accommodate this, move flushing the tasklets to phase 2, up from phase
3. This will ensure the WLAN driver is done accessing the bus before the
PCIe driver puts it down.

Change-Id: I47a22b7fd940ddc1bad78265b59461c178ee7ad4
CRs-Fixed: 2423628
Dustin Brown 6 years ago
parent
commit
13835b1aa2
1 changed files with 21 additions and 4 deletions
  1. 21 4
      hif/src/pcie/if_pci.c

+ 21 - 4
hif/src/pcie/if_pci.c

@@ -2532,8 +2532,16 @@ void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag)
  */
 int hif_pci_bus_suspend(struct hif_softc *scn)
 {
+	hif_apps_irqs_disable(GET_HIF_OPAQUE_HDL(scn));
+
+	if (hif_drain_tasklets(scn)) {
+		hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn));
+		return -EBUSY;
+	}
+
 	/* Stop the HIF Sleep Timer */
 	hif_cancel_deferred_target_sleep(scn);
+
 	return 0;
 }
 
@@ -2583,7 +2591,15 @@ static int __hif_check_link_status(struct hif_softc *scn)
  */
 int hif_pci_bus_resume(struct hif_softc *scn)
 {
-	return __hif_check_link_status(scn);
+	int errno;
+
+	errno = __hif_check_link_status(scn);
+	if (errno)
+		return errno;
+
+	hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn));
+
+	return 0;
 }
 
 /**
@@ -2597,12 +2613,11 @@ int hif_pci_bus_resume(struct hif_softc *scn)
  */
 int hif_pci_bus_suspend_noirq(struct hif_softc *scn)
 {
-	if (hif_drain_tasklets(scn) != 0)
-		return -EBUSY;
-
 	if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn)))
 		qdf_atomic_set(&scn->link_suspended, 1);
 
+	hif_apps_wake_irq_enable(GET_HIF_OPAQUE_HDL(scn));
+
 	return 0;
 }
 
@@ -2617,6 +2632,8 @@ int hif_pci_bus_suspend_noirq(struct hif_softc *scn)
  */
 int hif_pci_bus_resume_noirq(struct hif_softc *scn)
 {
+	hif_apps_wake_irq_disable(GET_HIF_OPAQUE_HDL(scn));
+
 	if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn)))
 		qdf_atomic_set(&scn->link_suspended, 0);