Explorar o código

qcacld-3.0: Disable Runtime PM when dfs channels are used

During DFS scanning FW needs host access. Hence disable Runtime PM
to ensure link is active.

Change-Id: I307cec1c3e8451758bf2fa44a8dd43f257ab8780
CRs-Fixed: 1072520
Komal Seelam %!s(int64=8) %!d(string=hai) anos
pai
achega
81cb16678f
Modificáronse 3 ficheiros con 21 adicións e 14 borrados
  1. 1 0
      core/hdd/inc/wlan_hdd_main.h
  2. 17 14
      core/hdd/src/wlan_hdd_hostapd.c
  3. 3 0
      core/hdd/src/wlan_hdd_main.c

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -863,6 +863,7 @@ struct hdd_chan_change_params {
 struct hdd_runtime_pm_context {
 	qdf_runtime_lock_t scan;
 	qdf_runtime_lock_t roc;
+	qdf_runtime_lock_t dfs;
 };
 
 /**

+ 17 - 14
core/hdd/src/wlan_hdd_hostapd.c

@@ -149,14 +149,16 @@ static void hdd_hostapd_channel_allow_suspend(hdd_adapter_t *pAdapter,
 	if (pHostapdState->bssState == BSS_STOP)
 		return;
 
+	if (CHANNEL_STATE_DFS != cds_get_channel_state(channel))
+		return;
+
 	/* Release wakelock when no more DFS channels are used */
-	if (CHANNEL_STATE_DFS == cds_get_channel_state(channel)) {
-		if (atomic_dec_and_test(&pHddCtx->sap_dfs_ref_cnt)) {
-			hdd_err("DFS: allowing suspend (chan %d)",
-			       channel);
-			qdf_wake_lock_release(&pHddCtx->sap_dfs_wakelock,
-					      WIFI_POWER_EVENT_WAKELOCK_DFS);
-		}
+	if (atomic_dec_and_test(&pHddCtx->sap_dfs_ref_cnt)) {
+		hdd_err("DFS: allowing suspend (chan %d)", channel);
+		qdf_wake_lock_release(&pHddCtx->sap_dfs_wakelock,
+				      WIFI_POWER_EVENT_WAKELOCK_DFS);
+		qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.dfs);
+
 	}
 }
 
@@ -185,14 +187,15 @@ static void hdd_hostapd_channel_prevent_suspend(hdd_adapter_t *pAdapter,
 		(atomic_read(&pHddCtx->sap_dfs_ref_cnt) >= 1))
 		return;
 
+	if (CHANNEL_STATE_DFS != cds_get_channel_state(channel))
+		return;
+
 	/* Acquire wakelock if we have at least one DFS channel in use */
-	if (CHANNEL_STATE_DFS == cds_get_channel_state(channel)) {
-		if (atomic_inc_return(&pHddCtx->sap_dfs_ref_cnt) == 1) {
-			hdd_err("DFS: preventing suspend (chan %d)",
-			       channel);
-			qdf_wake_lock_acquire(&pHddCtx->sap_dfs_wakelock,
-					      WIFI_POWER_EVENT_WAKELOCK_DFS);
-		}
+	if (atomic_inc_return(&pHddCtx->sap_dfs_ref_cnt) == 1) {
+		hdd_err("DFS: preventing suspend (chan %d)", channel);
+		qdf_runtime_pm_prevent_suspend(pHddCtx->runtime_context.dfs);
+		qdf_wake_lock_acquire(&pHddCtx->sap_dfs_wakelock,
+				      WIFI_POWER_EVENT_WAKELOCK_DFS);
 	}
 }
 

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

@@ -2464,6 +2464,7 @@ static void hdd_runtime_suspend_context_init(hdd_context_t *hdd_ctx)
 
 	ctx->scan = qdf_runtime_lock_init("scan");
 	ctx->roc = qdf_runtime_lock_init("roc");
+	ctx->dfs = qdf_runtime_lock_init("dfs");
 }
 
 /**
@@ -2480,6 +2481,8 @@ static void hdd_runtime_suspend_context_deinit(hdd_context_t *hdd_ctx)
 	ctx->scan = NULL;
 	qdf_runtime_lock_deinit(ctx->roc);
 	ctx->roc = NULL;
+	qdf_runtime_lock_deinit(ctx->dfs);
+	ctx->dfs = NULL;
 }
 
 static void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter)