From c10df1510e8d856efd0779da7bef609b160d6fa5 Mon Sep 17 00:00:00 2001 From: Prashanth Bhatta Date: Tue, 18 Aug 2015 20:45:58 -0700 Subject: qcacld: Remove calls to runtime prevent/allow suspend With the new change I846930213cfd28e8fbe172f4871a9cd0f99bc835 to not to allow runtime suspend whenever wake_locks are held, there is no need of explicitly calling prevent/allow runtime suspend APIs as they will be duplicate requests. Also do not call runtime prevent/allow suspend APIs during SSR as HIF context may not be available during SSR. Moreover, runtime PM will not be triggered till SSR completes so it is not necessary. Change-Id: Ida8fc93e90e28978ac11dacd1e571786c5475a29 CRs-fixed: 892870 --- CORE/SERVICES/WMA/wma.c | 4 ---- CORE/VOSS/src/vos_lock.c | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 749cd19a3805..bc5ba2d29797 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -2906,14 +2906,12 @@ static int wma_extscan_operations_ind_handler(tp_wma_handle wma, uint8_t *buf) vos_wake_lock_timeout_acquire(&wma->extscan_wake_lock, WMA_EXTSCAN_CYCLE_WAKE_LOCK_DURATION, WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN); - vos_runtime_pm_prevent_suspend(); goto exit_handler; case WMI_EXTSCAN_CYCLE_COMPLETED_EVENT: WMA_LOGD("%s: received WMI_EXTSCAN_CYCLE_COMPLETED_EVENT", __func__); vos_wake_lock_release(&wma->extscan_wake_lock, WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN); - vos_runtime_pm_allow_suspend(); goto exit_handler; default: WMA_LOGE("%s: Unknown event %d from target", @@ -15259,7 +15257,6 @@ static void wma_prevent_suspend_check(tp_wma_handle wma) wma->ap_client_cnt++; if (wma->ap_client_cnt == wma->wlan_resource_config.num_offload_peers) { - vos_runtime_pm_prevent_suspend(); vos_wake_lock_acquire(&wma->wow_wake_lock, WIFI_POWER_EVENT_WAKELOCK_ADD_STA); WMA_LOGW("%s: %d clients connected, prevent suspend", @@ -15272,7 +15269,6 @@ static void wma_allow_suspend_check(tp_wma_handle wma) wma->ap_client_cnt--; if (wma->ap_client_cnt == wma->wlan_resource_config.num_offload_peers - 1) { - vos_runtime_pm_allow_suspend(); vos_wake_lock_release(&wma->wow_wake_lock, WIFI_POWER_EVENT_WAKELOCK_DEL_STA); WMA_LOGW("%s: %d clients connected, allow suspend", diff --git a/CORE/VOSS/src/vos_lock.c b/CORE/VOSS/src/vos_lock.c index 3d86a5546187..4af764042e78 100644 --- a/CORE/VOSS/src/vos_lock.c +++ b/CORE/VOSS/src/vos_lock.c @@ -551,8 +551,18 @@ VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock, WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT, WIFI_POWER_EVENT_WAKELOCK_TAKEN); - if (reason != WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT) + /* + * Dont prevent Autosuspend for these reasons, either it is not required to + * do so or runtime functionality is not available at this time + */ + switch(reason) { + case WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT: + case WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT: + break; + default: vos_runtime_pm_prevent_suspend(); + break; + } #if defined CONFIG_CNSS cnss_pm_wake_lock(pLock); #elif defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK) @@ -619,8 +629,19 @@ VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock, uint32_t reason) vos_runtime_pm_allow_suspend(); #endif #endif - if (reason != WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT) + /* + * Dont allow autosuspend for these reasons, these reasons doesn't prevent + * the autosuspend so no need to call allow. + */ + switch(reason) { + case WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT: + case WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT: + break; + default: vos_runtime_pm_allow_suspend(); + break; + } + return VOS_STATUS_SUCCESS; } -- cgit v1.2.3