summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDustin Brown <dustinb@codeaurora.org>2016-11-10 11:17:40 -0800
committerqcabuildsw <qcabuildsw@localhost>2016-11-29 16:09:15 -0800
commitdce31e6193e9d78f02bd1117bcf2fda3c69fbb09 (patch)
tree451f9ef53e72c26e27dca9f47926664d8b5f7b33
parentdb237c4af794922659248866983c2ee51c23781e (diff)
qcacld-3.0: For WOW enable, pass unit-test flag to FW
For unit-test suspend, pass a Host-to-Target Communication (HTC) Wakeup flag to firmware with the WOW Enable command. This flag tells firmware to always use the HTC wakeup method, even if GPIO (or any other) wakeup method is available. This enables support for unit-test suspend on emulation platforms with incomplete PCIe implementations, for example. Change-Id: I82a70973b0d8845e05d6c82ab207ddef27447099 CRs-Fixed: 1093342
-rw-r--r--core/hdd/inc/wlan_hdd_power.h12
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c23
-rw-r--r--core/hdd/src/wlan_hdd_power.c2
-rw-r--r--core/wma/inc/wma_api.h8
-rw-r--r--core/wma/src/wma_features.c19
5 files changed, 48 insertions, 16 deletions
diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h
index 4623d9bb6b83..e9262637a513 100644
--- a/core/hdd/inc/wlan_hdd_power.h
+++ b/core/hdd/inc/wlan_hdd_power.h
@@ -223,6 +223,18 @@ void wlan_hdd_inc_suspend_stats(hdd_context_t *hdd_ctx,
*/
#ifdef WLAN_SUSPEND_RESUME_TEST
/**
+ * wlan_hdd_unit_test_bus_suspend() - suspend the wlan bus
+ * @state: state containing the suspend source event
+ *
+ * This function does the same as wlan_hdd_bus_suspend, but additionally passes
+ * the appropriate flags to FW, indicating this is a unit-test suspend and it
+ * should use an HTC wakeup method to resume.
+ *
+ * Return: 0 for success or error code
+ */
+int wlan_hdd_unit_test_bus_suspend(pm_message_t state);
+
+/**
* hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend
* @wiphy: the kernel wiphy struct for the device being resumed
* @dev: the kernel net_device struct for the device being resumed
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index 20290b8f9280..22189d3e28f2 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -494,6 +494,7 @@ static void wlan_hdd_notify_handler(int state)
/**
* __wlan_hdd_bus_suspend() - handles platform supsend
* @state: suspend message from the kernel
+ * @wow_flags: bitmap of WMI WOW flags to pass to FW
*
* Does precondtion validation. Ensures that a subsystem restart isn't in
* progress. Ensures that no load or unload is in progress.
@@ -505,7 +506,7 @@ static void wlan_hdd_notify_handler(int state)
* -EBUSY or -EAGAIN if another opperation is in progress and
* wlan will not be ready to suspend in time.
*/
-static int __wlan_hdd_bus_suspend(pm_message_t state)
+static int __wlan_hdd_bus_suspend(pm_message_t state, uint32_t wow_flags)
{
hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
void *hif_ctx;
@@ -532,7 +533,7 @@ static int __wlan_hdd_bus_suspend(pm_message_t state)
if (err)
goto done;
- err = wma_bus_suspend();
+ err = wma_bus_suspend(wow_flags);
if (err)
goto resume_oltxrx;
@@ -559,12 +560,26 @@ int wlan_hdd_bus_suspend(pm_message_t state)
int ret;
cds_ssr_protect(__func__);
- ret = __wlan_hdd_bus_suspend(state);
+ ret = __wlan_hdd_bus_suspend(state, 0);
cds_ssr_unprotect(__func__);
return ret;
}
+#ifdef WLAN_SUSPEND_RESUME_TEST
+int wlan_hdd_unit_test_bus_suspend(pm_message_t state)
+{
+ int ret;
+
+ cds_ssr_protect(__func__);
+ ret = __wlan_hdd_bus_suspend(state, WMI_WOW_FLAG_UNIT_TEST_ENABLE |
+ WMI_WOW_FLAG_DO_HTC_WAKEUP);
+ cds_ssr_unprotect(__func__);
+
+ return ret;
+}
+#endif
+
/**
* __wlan_hdd_bus_suspend_noirq() - handle .suspend_noirq callback
*
@@ -822,7 +837,7 @@ static int __wlan_hdd_runtime_suspend(struct device *dev)
if (status)
goto resume_txrx;
- status = wma_runtime_suspend();
+ status = wma_runtime_suspend(0);
if (status)
goto resume_htc;
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index b808bf38807b..8249b069083e 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -2531,7 +2531,7 @@ int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev)
goto resume_done;
state.event = PM_EVENT_SUSPEND;
- suspend_err = wlan_hdd_bus_suspend(state);
+ suspend_err = wlan_hdd_unit_test_bus_suspend(state);
if (suspend_err)
goto cfg80211_resume;
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index e321cd1af6d2..d6ca6d14e875 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -142,9 +142,9 @@ QDF_STATUS wma_set_reg_domain(void *clientCtxt, v_REGDOMAIN_t regId);
QDF_STATUS wma_get_wcnss_software_version(void *p_cds_gctx,
uint8_t *pVersion,
uint32_t versionBufferSize);
-int wma_runtime_suspend(void);
+int wma_runtime_suspend(uint32_t wow_flags);
int wma_runtime_resume(void);
-int wma_bus_suspend(void);
+int wma_bus_suspend(uint32_t wow_flags);
int wma_is_target_wake_up_received(void);
int wma_clear_target_wake_up(void);
QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
@@ -155,8 +155,8 @@ QDF_STATUS wma_resume_target(WMA_HANDLE handle);
QDF_STATUS wma_disable_wow_in_fw(WMA_HANDLE handle);
QDF_STATUS wma_disable_d0wow_in_fw(WMA_HANDLE handle);
bool wma_is_wow_mode_selected(WMA_HANDLE handle);
-QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle);
-QDF_STATUS wma_enable_d0wow_in_fw(WMA_HANDLE handle);
+QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle, uint32_t wow_flags);
+QDF_STATUS wma_enable_d0wow_in_fw(WMA_HANDLE handle, uint32_t wow_flags);
bool wma_check_scan_in_progress(WMA_HANDLE handle);
void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 5e817443a536..1f404cfbbaad 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -3873,10 +3873,11 @@ void wma_enable_disable_wakeup_event(WMA_HANDLE handle,
/**
* wma_enable_wow_in_fw() - wnable wow in fw
* @wma: wma handle
+ * @wow_flags: bitmap of WMI WOW flags to pass to FW
*
* Return: QDF status
*/
-QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
+QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle, uint32_t wow_flags)
{
tp_wma_handle wma = handle;
int ret;
@@ -3912,6 +3913,7 @@ QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
param.enable = true;
param.can_suspend_link = htc_can_suspend_link(wma->htc_handle);
+ param.flags = wow_flags;
ret = wmi_unified_wow_enable_send(wma->wmi_handle, &param,
WMA_WILDCARD_PDEV_ID);
if (ret) {
@@ -6446,13 +6448,14 @@ failure:
/**
* __wma_bus_suspend(): handles bus suspend for wma
* @type: is this suspend part of runtime suspend or system suspend?
+ * @wow_flags: bitmap of WMI WOW flags to pass to FW
*
* Bails if a scan is in progress.
* Calls the appropriate handlers based on configuration and event.
*
* Return: 0 for success or error code
*/
-static int __wma_bus_suspend(enum qdf_suspend_type type)
+static int __wma_bus_suspend(enum qdf_suspend_type type, uint32_t wow_flags)
{
WMA_HANDLE handle = cds_get_context(QDF_MODULE_ID_WMA);
if (NULL == handle) {
@@ -6476,7 +6479,7 @@ static int __wma_bus_suspend(enum qdf_suspend_type type)
wma_is_wow_mode_selected(handle));
if (wma_is_wow_mode_selected(handle)) {
- QDF_STATUS status = wma_enable_wow_in_fw(handle);
+ QDF_STATUS status = wma_enable_wow_in_fw(handle, wow_flags);
return qdf_status_to_os_return(status);
}
@@ -6485,6 +6488,7 @@ static int __wma_bus_suspend(enum qdf_suspend_type type)
/**
* wma_runtime_suspend() - handles runtime suspend request from hdd
+ * @wow_flags: bitmap of WMI WOW flags to pass to FW
*
* Calls the appropriate handler based on configuration and event.
* Last busy marking should prevent race conditions between processing
@@ -6496,22 +6500,23 @@ static int __wma_bus_suspend(enum qdf_suspend_type type)
*
* Return: 0 for success or error code
*/
-int wma_runtime_suspend(void)
+int wma_runtime_suspend(uint32_t wow_flags)
{
- return __wma_bus_suspend(QDF_RUNTIME_SUSPEND);
+ return __wma_bus_suspend(QDF_RUNTIME_SUSPEND, wow_flags);
}
/**
* wma_bus_suspend() - handles bus suspend request from hdd
+ * @wow_flags: bitmap of WMI WOW flags to pass to FW
*
* Calls the appropriate handler based on configuration and event
*
* Return: 0 for success or error code
*/
-int wma_bus_suspend(void)
+int wma_bus_suspend(uint32_t wow_flags)
{
- return __wma_bus_suspend(QDF_SYSTEM_SUSPEND);
+ return __wma_bus_suspend(QDF_SYSTEM_SUSPEND, wow_flags);
}
/**