wlan: Changes to acquire wakelock to avoid the apps suspend during the scan.
Acquire the wakelock to avoid the apps suspend during the scan. To
address the following issues.
1) Disconnected scenario: we are not allowing the suspend as WLAN is
not in BMPS/IMPS this result in android trying to suspend aggressively
and backing off for long time, this result in apps running at full
power for long time.
2) Connected scenario: If we allow the suspend during the scan, RIVA
will be stuck in full power because of resume BMPS.
CR-Fixed: 402255
Change-Id: I246d4f77e270baa21c9de66f5f1a2967d7cb85d9
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index e024861..b645567 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3505,6 +3505,7 @@
if (!req)
{
hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n");
+ pScanInfo->mScanPending = VOS_FALSE;
goto allow_suspend;
}
@@ -3536,12 +3537,8 @@
#endif
allow_suspend:
- /* release the wake lock */
- if((eConnectionState_NotConnected ==
- (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
- {
- hdd_allow_suspend();
- }
+ /* release the wake lock at the end of the scan*/
+ hdd_allow_suspend();
EXIT();
return 0;
@@ -3564,7 +3561,6 @@
v_U32_t scanId = 0;
int status = 0;
hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
- v_U8_t preventSuspend = 0;
#ifdef WLAN_FEATURE_P2P
v_U8_t* pP2pIe = NULL;
#endif
@@ -3797,14 +3793,15 @@
INIT_COMPLETION(pScanInfo->scan_req_completion_event);
- /*If the station is not connected and recieved a scan request, acquire the
- * wake lock to not request the suspend from Android*/
- if((eConnectionState_NotConnected ==
- (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
- {
- preventSuspend = 1;
- hdd_prevent_suspend();
- }
+ /* acquire the wakelock to avoid the apps suspend during the scan. To
+ * address the following issues.
+ * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in
+ * BMPS/IMPS this result in android trying to suspend aggressively and backing off
+ * for long time, this result in apps running at full power for long time.
+ * 2) Connected scenario: If we allow the suspend during the scan, RIVA will
+ * be stuck in full power because of resume BMPS
+ */
+ hdd_prevent_suspend();
status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
pAdapter->sessionId, &scanRequest, &scanId,
@@ -3816,10 +3813,7 @@
"%s: sme_ScanRequest returned error %d", __func__, status);
complete(&pScanInfo->scan_req_completion_event);
status = -EIO;
- if(preventSuspend)
- {
- hdd_allow_suspend();
- }
+ hdd_allow_suspend();
goto free_mem;
}