Răsfoiți Sursa

qcacld-3.0: Hold wake lock for connection attempt

Hold a short wake lock when a connection attempt is made to help ensure
the device does not power collapse in the middle.

Change-Id: Ia9e20df5481340224fa4c272b58152eec27790a9
CRs-Fixed: 2053126
Dustin Brown 8 ani în urmă
părinte
comite
ceed67eebf

+ 3 - 0
core/hdd/inc/wlan_hdd_power.h

@@ -40,6 +40,9 @@
 
 #define HDD_MAX_CMP_PER_PACKET_FILTER	5
 
+#define HDD_WAKELOCK_TIMEOUT_CONNECT 1000
+#define HDD_WAKELOCK_TIMEOUT_RESUME 1000
+
 /**
  * enum pkt_filter_protocol_layer - packet filter protocol layer
  * @HDD_FILTER_PROTO_TYPE_INVALID: Invalid initial value

+ 3 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -13929,6 +13929,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 
 		qdf_runtime_pm_prevent_suspend(pAdapter->connect_rpm_ctx.
 					       connect);
+		hdd_prevent_suspend_timeout(HDD_WAKELOCK_TIMEOUT_CONNECT,
+					    WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 		qdf_status = sme_roam_connect(WLAN_HDD_GET_HAL_CTX(pAdapter),
 					  pAdapter->sessionId, pRoamProfile,
 					  &roamId);
@@ -13946,6 +13948,7 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 						      eConnectionState_NotConnected);
 			qdf_runtime_pm_allow_suspend(pAdapter->connect_rpm_ctx.
 						     connect);
+			hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 		}
 
 		/* Reset connect_in_progress */

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -4542,6 +4542,7 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
 		status, gfp, connect_timeout, timeout_reason);
 
 	qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
+	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 }
 #else
 void hdd_connect_result(struct net_device *dev, const u8 *bssid,
@@ -4556,6 +4557,7 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
 	cfg80211_connect_result(dev, bssid, req_ie, req_ie_len,
 				resp_ie, resp_ie_len, status, gfp);
 	qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
+	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 }
 #endif
 

+ 3 - 3
core/hdd/src/wlan_hdd_power.c

@@ -87,7 +87,6 @@
 #else
 #define HDD_SSR_BRING_UP_TIME 30000
 #endif
-#define HDD_WAKE_LOCK_RESUME_DURATION 1000
 
 /* Type declarations */
 
@@ -1706,7 +1705,7 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
 				 * process the connect request to AP
 				 */
 				hdd_prevent_suspend_timeout(
-					HDD_WAKE_LOCK_RESUME_DURATION,
+					HDD_WAKELOCK_TIMEOUT_RESUME,
 					WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN);
 				cfg80211_sched_scan_results(pHddCtx->wiphy);
 			}
@@ -1994,7 +1993,8 @@ static void hdd_start_dhcp_ind(hdd_adapter_t *adapter)
 
 	hdd_debug("DHCP start indicated through power save");
 	qdf_runtime_pm_prevent_suspend(adapter->connect_rpm_ctx.connect);
-	hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_DHCP);
+	hdd_prevent_suspend_timeout(HDD_WAKELOCK_TIMEOUT_CONNECT,
+				    WIFI_POWER_EVENT_WAKELOCK_DHCP);
 	sme_dhcp_start_ind(hdd_ctx->hHal, adapter->device_mode,
 			   adapter->macAddressCurrent.bytes,
 			   adapter->sessionId);

+ 3 - 2
core/hdd/src/wlan_hdd_scan.c

@@ -44,6 +44,7 @@
 #include "wlan_hdd_trace.h"
 #include "wlan_hdd_scan.h"
 #include "wlan_policy_mgr_api.h"
+#include "wlan_hdd_power.h"
 #include "wma_api.h"
 #include "cds_utils.h"
 
@@ -1304,8 +1305,8 @@ allow_suspend:
 		 * app's is suspending and not ableto process the connect
 		 * request to AP
 		 */
-		hdd_prevent_suspend_timeout(1000,
-			WIFI_POWER_EVENT_WAKELOCK_SCAN);
+		hdd_prevent_suspend_timeout(HDD_WAKELOCK_TIMEOUT_CONNECT,
+					    WIFI_POWER_EVENT_WAKELOCK_SCAN);
 	} else {
 		/* Release the spin lock */
 		qdf_spin_unlock(&hddctx->hdd_scan_req_q_lock);