From 81cb16678fbc0b5943053e0dbbe8623e202f3fca Mon Sep 17 00:00:00 2001 From: Komal Seelam Date: Thu, 29 Sep 2016 12:39:08 +0530 Subject: [PATCH] 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 --- core/hdd/inc/wlan_hdd_main.h | 1 + core/hdd/src/wlan_hdd_hostapd.c | 31 +++++++++++++++++-------------- core/hdd/src/wlan_hdd_main.c | 3 +++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index eccc4de357b3..e6d7cd9ee707 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/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; }; /** diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index bf299934952b..3145b14a65e8 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/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); } } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a35ea1832bbe..d480dab1f386 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/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)