summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Babu Kumaravel <kganesh@qti.qualcomm.com>2013-12-29 01:36:07 +0530
committerPrakash Dhavali <pdhavali@codeaurora.org>2014-01-16 21:46:19 -0800
commit91b2d2e73da39c7469d7693c37a5111d4cf78bc0 (patch)
treeb670b20b5c171e72b8d26a32ca4c9e737873e128
parentbd41122978e475cd58d9440805b28d71d41accf7 (diff)
qcacld:Handle Deferred Sleep Timer incase of suspend scenario
Since wow is holding the wakelock to ensure there is no frame during suspend HIF Lock is removed. Further before going into suspend if the deferred sleep timer is running then cacel the timer and put the chip into sleep mode if required. . Change-Id: If36d4fd04dc1fdb85c9e6fd18e797e129f361c55 CRs-Fixed: 594416
-rw-r--r--CORE/SERVICES/COMMON/hif.h2
-rw-r--r--CORE/SERVICES/COMMON/htc_api.h1
-rw-r--r--CORE/SERVICES/HIF/PCIe/hif_pci.c28
-rw-r--r--CORE/SERVICES/HIF/PCIe/hif_pci.h1
-rw-r--r--CORE/SERVICES/HTC/htc.c8
-rw-r--r--CORE/SERVICES/WMA/wma.c14
6 files changed, 46 insertions, 8 deletions
diff --git a/CORE/SERVICES/COMMON/hif.h b/CORE/SERVICES/COMMON/hif.h
index 4de405463595..2726fa829b8d 100644
--- a/CORE/SERVICES/COMMON/hif.h
+++ b/CORE/SERVICES/COMMON/hif.h
@@ -645,6 +645,8 @@ extern void HIFTargetSleepStateAdjust(A_target_id_t targid, A_BOOL sleep_ok, A_B
extern void
HIFSetTargetSleep(HIF_DEVICE *hif_device, A_BOOL sleep_ok, A_BOOL wait_for_it);
extern A_BOOL HIFTargetForcedAwake(A_target_id_t targid);
+extern void
+HIFCancelDeferredTargetSleep(HIF_DEVICE *hif_device);
#define A_TARGET_ID(hifDevice) HIFGetTargetId(hifDevice)
diff --git a/CORE/SERVICES/COMMON/htc_api.h b/CORE/SERVICES/COMMON/htc_api.h
index 1770f6c06b0d..d3f4b79bd8b3 100644
--- a/CORE/SERVICES/COMMON/htc_api.h
+++ b/CORE/SERVICES/COMMON/htc_api.h
@@ -685,4 +685,5 @@ struct s_htc_msg{
void *htc_get_targetdef(HTC_HANDLE htc_handle);
void HTCSetTargetToSleep(void *context);
+void HTCCancelDeferredTargetSleep(void *context);
#endif /* _HTC_API_H_ */
diff --git a/CORE/SERVICES/HIF/PCIe/hif_pci.c b/CORE/SERVICES/HIF/PCIe/hif_pci.c
index 72c24a8fab9f..e30be61e33db 100644
--- a/CORE/SERVICES/HIF/PCIe/hif_pci.c
+++ b/CORE/SERVICES/HIF/PCIe/hif_pci.c
@@ -52,7 +52,6 @@
#define ATH_MODULE_NAME hif
#include <a_debug.h>
#include "hif_pci.h"
-#include "vos_lock.h"
/* use credit flow control over HTC */
unsigned int htc_credit_flow = 1;
@@ -1523,7 +1522,6 @@ HIFStop(HIF_DEVICE *hif_device)
adf_os_timer_cancel(&hif_state->sleep_timer);
adf_os_timer_free(&hif_state->sleep_timer);
- vos_wake_lock_destroy(&hif_state->hif_wake_lock);
hif_state->started = FALSE;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-%s\n",__FUNCTION__));
@@ -1960,7 +1958,6 @@ HIF_sleep_entry(void *arg)
A_PCI_WRITE32(pci_addr + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
hif_state->fake_sleep = FALSE;
- vos_wake_lock_release(&hif_state->hif_wake_lock);
} else {
adf_os_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
@@ -1972,6 +1969,29 @@ HIF_sleep_entry(void *arg)
adf_os_spin_unlock(&hif_state->keep_awake_lock);
}
+void
+HIFCancelDeferredTargetSleep(HIF_DEVICE *hif_device)
+{
+ struct HIF_CE_state *hif_state = (struct HIF_CE_state *)hif_device;
+ A_target_id_t pci_addr = TARGID_TO_PCI_ADDR(hif_state->targid);
+ struct hif_pci_softc *sc = hif_state->sc;
+
+ adf_os_spin_lock(&hif_state->keep_awake_lock);
+ /*
+ * If the deferred sleep timer is running cancel it
+ * and put the soc into sleep.
+ */
+ if (hif_state->fake_sleep == TRUE) {
+ adf_os_timer_cancel(&hif_state->sleep_timer);
+ if (hif_state->verified_awake == FALSE) {
+ A_PCI_WRITE32(pci_addr + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
+ }
+ hif_state->fake_sleep = FALSE;
+ }
+ adf_os_spin_unlock(&hif_state->keep_awake_lock);
+}
+
/*
* Called from PCI layer whenever a new PCI device is probed.
* Initializes per-device HIF state and notifies the main
@@ -2010,7 +2030,6 @@ HIF_PCIDeviceProbed(hif_handle_t hif_hdl)
hif_state->sleep_ticks = 0;
adf_os_timer_init(NULL, &hif_state->sleep_timer,
HIF_sleep_entry, (void *)hif_state);
- vos_wake_lock_init(&hif_state->hif_wake_lock, "hif_wake_lock");
hif_state->fw_indicator_address = FW_INDICATOR_ADDRESS;
hif_state->targid = A_TARGET_ID(sc->hif_device);
@@ -2295,7 +2314,6 @@ HIFTargetSleepStateAdjust(A_target_id_t targid,
adf_os_timer_cancel(&hif_state->sleep_timer);
adf_os_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
- vos_wake_lock_acquire(&hif_state->hif_wake_lock);
}
adf_os_spin_unlock(&hif_state->keep_awake_lock);
} else {
diff --git a/CORE/SERVICES/HIF/PCIe/hif_pci.h b/CORE/SERVICES/HIF/PCIe/hif_pci.h
index e17bc33b24c4..ebea6fca261f 100644
--- a/CORE/SERVICES/HIF/PCIe/hif_pci.h
+++ b/CORE/SERVICES/HIF/PCIe/hif_pci.h
@@ -95,7 +95,6 @@ struct HIF_CE_state {
A_BOOL verified_awake;
A_BOOL fake_sleep;
adf_os_timer_t sleep_timer;
- vos_wake_lock_t hif_wake_lock;
unsigned long sleep_ticks;
//struct task_struct *pci_dev_inserted_thread;
diff --git a/CORE/SERVICES/HTC/htc.c b/CORE/SERVICES/HTC/htc.c
index 9880891b1ee8..2a6172a26989 100644
--- a/CORE/SERVICES/HTC/htc.c
+++ b/CORE/SERVICES/HTC/htc.c
@@ -781,3 +781,11 @@ void HTCSetTargetToSleep(void *context)
#endif
#endif
}
+
+void HTCCancelDeferredTargetSleep(void *context)
+{
+#if CONFIG_ATH_PCIE_MAX_PERF == 0
+ struct ol_softc *sc = (struct ol_softc *)context;
+ HIFCancelDeferredTargetSleep(sc->hif_hdl);
+#endif
+}
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index 623b211a8415..ab8bfabee9e7 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -9405,6 +9405,9 @@ int wma_enable_wow_in_fw(WMA_HANDLE handle)
WMA_LOGD("WOW enabled successfully in fw");
+ HTCCancelDeferredTargetSleep(vos_get_context(VOS_MODULE_ID_HIF,
+ wma->vos_context));
+
wma->wow.wow_enable_cmd_sent = TRUE;
return VOS_STATUS_SUCCESS;
}
@@ -14165,8 +14168,15 @@ int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
return -1;
}
vos_event_reset(&wma_handle->target_suspend);
- return vos_wait_single_event(&wma_handle->target_suspend,
- WMA_TGT_SUSPEND_COMPLETE_TIMEOUT);
+ if (vos_wait_single_event(&wma_handle->target_suspend,
+ WMA_TGT_SUSPEND_COMPLETE_TIMEOUT)
+ != VOS_STATUS_SUCCESS) {
+ WMA_LOGE("Failed to suspend target");
+ return -1;
+ }
+ HTCCancelDeferredTargetSleep(vos_get_context(VOS_MODULE_ID_HIF,
+ wma_handle->vos_context));
+ return 0;
}
void wma_target_suspend_complete(void *context)