diff options
| author | Chandrasekaran, Manishekar <cmshekar@qti.qualcomm.com> | 2015-04-01 11:51:28 +0530 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2015-04-07 17:16:10 +0530 |
| commit | dfdb58e86142bca3b5a7f8c63ce8db5fc237e883 (patch) | |
| tree | b5bf0fa954caca63357a3317681a4c3dee13932e | |
| parent | e762029dac2110cb9cb2a570da88ffebf9e06e64 (diff) | |
qcacld: Add support for host based wake lock events
This change adds new DIAG (EVENT_WLAN_WAKE_LOCK)
event within our existing DIAG framework. This
event will be generated whenever wake locks are
handled within the driver.
Change-Id: Ie19d1f5b50a34247cc58203d87bab8c1933ebbb8
CRs-Fixed: 816401
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 6 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 11 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_early_suspend.c | 9 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_hostapd.c | 12 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_ipa.c | 8 | ||||
| -rwxr-xr-x | CORE/HDD/src/wlan_hdd_main.c | 25 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_p2p.c | 22 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_softap_tx_rx.c | 3 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_tx_rx.c | 3 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 24 | ||||
| -rw-r--r-- | CORE/SVC/inc/wlan_nlink_srv.h | 3 | ||||
| -rw-r--r-- | CORE/SVC/src/nlink/wlan_nlink_srv.c | 19 | ||||
| -rw-r--r-- | CORE/VOSS/inc/event_defs.h | 1 | ||||
| -rw-r--r-- | CORE/VOSS/inc/i_vos_diag_core_event.h | 13 | ||||
| -rw-r--r-- | CORE/VOSS/inc/vos_diag_core_event.h | 68 | ||||
| -rw-r--r-- | CORE/VOSS/inc/vos_lock.h | 12 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_diag.c | 34 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_lock.c | 44 |
18 files changed, 252 insertions, 65 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index 9cfb5d944546..398862a49a3c 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -1642,9 +1642,9 @@ void wlan_hdd_incr_active_session(hdd_context_t *pHddCtx, void wlan_hdd_decr_active_session(hdd_context_t *pHddCtx, tVOS_CON_MODE mode); void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter); -void hdd_prevent_suspend(void); -void hdd_allow_suspend(void); -void hdd_prevent_suspend_timeout(v_U32_t timeout); +void hdd_prevent_suspend(uint32_t reason); +void hdd_allow_suspend(uint32_t reason); +void hdd_prevent_suspend_timeout(v_U32_t timeout, uint32_t reason); bool hdd_is_ssr_required(void); void hdd_set_ssr_required(e_hdd_ssr_required value); diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 33ff1253d2c3..be347a7e5d93 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -11821,12 +11821,12 @@ static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, allow_suspend: /* release the wake lock at the end of the scan*/ - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); /* Acquire wakelock to handle the case where APP's tries to suspend * immediately after the driver gets connect request(i.e after scan) * from supplicant, this result in app's is suspending and not able * to process the connect request to AP */ - hdd_prevent_suspend_timeout(1000); + hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); #ifdef FEATURE_WLAN_TDLS wlan_hdd_tdls_scan_done_callback(pAdapter); @@ -12319,7 +12319,7 @@ int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, * 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(); + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); #ifdef CONFIG_CNSS cnss_prevent_auto_suspend(__func__); #endif @@ -12349,7 +12349,7 @@ int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, status = -EIO; } - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); #ifdef CONFIG_CNSS cnss_allow_auto_suspend(__func__); #endif @@ -17394,7 +17394,8 @@ int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) * results in app's is in suspended state and not able to * process the connect request to AP */ - hdd_prevent_suspend_timeout(2000); + hdd_prevent_suspend_timeout(2000, + WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); cfg80211_sched_scan_results(pHddCtx->wiphy); } diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c index b97d44e38525..10d9dd6f9f65 100644 --- a/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -1721,7 +1721,7 @@ VOS_STATUS hdd_wlan_reset_initialization(void) hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Preventing the phone from going to suspend",__func__); // Prevent the phone from going to sleep - hdd_prevent_suspend(); + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); return VOS_STATUS_SUCCESS; } @@ -1973,8 +1973,7 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc) hdd_adapter_t *pAdapter; int i; - hdd_prevent_suspend(); - + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, TRUE); @@ -2176,7 +2175,7 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc) wlan_hdd_send_svc_nlink_msg(WLAN_SVC_FW_CRASHED_IND, NULL, 0); /* Allow the phone to go to sleep */ - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); /* register for riva power on lock */ if (req_riva_power_on_lock("wlan")) { @@ -2239,7 +2238,7 @@ err_vosclose: err_re_init: /* Allow the phone to go to sleep */ - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE); VOS_BUG(0); return -EPERM; diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c index ee90dad37ebc..11583c8c837c 100644 --- a/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/CORE/HDD/src/wlan_hdd_hostapd.c @@ -168,7 +168,8 @@ void hdd_hostapd_channel_allow_suspend(hdd_adapter_t *pAdapter, if (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channel)) { if (atomic_dec_and_test(&pHddCtx->sap_dfs_ref_cnt)) { hddLog(LOGE, FL("DFS: allowing suspend (chan %d)"), channel); - vos_wake_lock_release(&pHddCtx->sap_dfs_wakelock); + vos_wake_lock_release(&pHddCtx->sap_dfs_wakelock, + WIFI_POWER_EVENT_WAKELOCK_DFS); } } } @@ -206,7 +207,8 @@ void hdd_hostapd_channel_prevent_suspend(hdd_adapter_t *pAdapter, if (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channel)) { if (atomic_inc_return(&pHddCtx->sap_dfs_ref_cnt) == 1) { hddLog(LOGE, FL("DFS: preventing suspend (chan %d)"), channel); - vos_wake_lock_acquire(&pHddCtx->sap_dfs_wakelock); + vos_wake_lock_acquire(&pHddCtx->sap_dfs_wakelock, + WIFI_POWER_EVENT_WAKELOCK_DFS); } } } @@ -224,7 +226,8 @@ void hdd_hostapd_channel_wakelock_deinit(hdd_context_t *pHddCtx) { if (atomic_read(&pHddCtx->sap_dfs_ref_cnt)) { /* Release wakelock */ - vos_wake_lock_release(&pHddCtx->sap_dfs_wakelock); + vos_wake_lock_release(&pHddCtx->sap_dfs_wakelock, + WIFI_POWER_EVENT_WAKELOCK_DRIVER_EXIT); /* Reset the reference count */ atomic_set(&pHddCtx->sap_dfs_ref_cnt, 0); hddLog(LOGE, FL("DFS: allowing suspend")); @@ -1471,7 +1474,8 @@ VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCa wlan_hdd_auto_shutdown_enable(pHddCtx, VOS_FALSE); #endif vos_wake_lock_timeout_acquire(&pHddCtx->sap_wake_lock, - HDD_SAP_WAKE_LOCK_DURATION); + HDD_SAP_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_SAP); { struct station_info staInfo; v_U16_t iesLen = pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.iesLen; diff --git a/CORE/HDD/src/wlan_hdd_ipa.c b/CORE/HDD/src/wlan_hdd_ipa.c index 0a4594ae15aa..33b87b70a93c 100644 --- a/CORE/HDD/src/wlan_hdd_ipa.c +++ b/CORE/HDD/src/wlan_hdd_ipa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1619,7 +1619,8 @@ static int hdd_ipa_rm_request(struct hdd_ipa_priv *hdd_ipa) cancel_delayed_work(&hdd_ipa->wake_lock_work); if (hdd_ipa->wake_lock_released) { - vos_wake_lock_acquire(&hdd_ipa->wake_lock); + vos_wake_lock_acquire(&hdd_ipa->wake_lock, + WIFI_POWER_EVENT_WAKELOCK_IPA); hdd_ipa->wake_lock_released = false; } adf_os_spin_unlock_bh(&hdd_ipa->rm_lock); @@ -1638,7 +1639,8 @@ static void hdd_ipa_wake_lock_timer_func(struct work_struct *work) goto end; hdd_ipa->wake_lock_released = true; - vos_wake_lock_release(&hdd_ipa->wake_lock); + vos_wake_lock_release(&hdd_ipa->wake_lock, + WIFI_POWER_EVENT_WAKELOCK_IPA); end: adf_os_spin_unlock_bh(&hdd_ipa->rm_lock); diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 1c99e454acb1..43e5ae56810d 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -540,7 +540,7 @@ static void ready_to_auto_suspend(void *cb_context, boolean suspended) return; } - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND); if (!suspended) hddLog(LOG1, FL("Failed response for auto suspend")); { @@ -609,7 +609,7 @@ static void hdd_auto_suspend_timer_cb(v_PVOID_t usr_data) /* Prevent system suspend until auto suspend is completed, * that is to avoid race condition with system suspend */ - hdd_prevent_suspend(); + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND); hddLog(LOG1, FL("HDD starting auto-suspend.")); @@ -12127,19 +12127,20 @@ VOS_STATUS hdd_post_voss_start_config(hdd_context_t* pHddCtx) } /* wake lock APIs for HDD */ -void hdd_prevent_suspend(void) +void hdd_prevent_suspend(uint32_t reason) { - vos_wake_lock_acquire(&wlan_wake_lock); + vos_wake_lock_acquire(&wlan_wake_lock, reason); } -void hdd_allow_suspend(void) +void hdd_allow_suspend(uint32_t reason) { - vos_wake_lock_release(&wlan_wake_lock); + vos_wake_lock_release(&wlan_wake_lock, reason); } -void hdd_prevent_suspend_timeout(v_U32_t timeout) +void hdd_prevent_suspend_timeout(v_U32_t timeout, uint32_t reason) { - vos_wake_lock_timeout_acquire(&wlan_wake_lock, timeout); + vos_wake_lock_timeout_acquire(&wlan_wake_lock, timeout, + reason); } /**--------------------------------------------------------------------------- @@ -13500,7 +13501,7 @@ static int hdd_driver_init( void) ENTER(); vos_wake_lock_init(&wlan_wake_lock, "wlan"); - hdd_prevent_suspend(); + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); /* * The Krait is going to Idle/Stand Alone Power Save * more aggressively which is resulting in the longer driver load time. @@ -13522,7 +13523,7 @@ static int hdd_driver_init( void) WLAN_MODULE_NAME); if (ret_status < 0) { hdd_remove_pm_qos(); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); vos_wake_lock_destroy(&wlan_wake_lock); } return ret_status; @@ -13533,7 +13534,7 @@ static int hdd_driver_init( void) &wlan_wake_lock, WLAN_MODULE_NAME); if (ret_status < 0) { hdd_remove_pm_qos(); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); vos_wake_lock_destroy(&wlan_wake_lock); } return ret_status; @@ -13586,7 +13587,7 @@ static int hdd_driver_init( void) } hdd_remove_pm_qos(); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); if (ret_status) { hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN Driver Initialization failed", diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c index 8691e7e3258e..acdf04f33523 100644 --- a/CORE/HDD/src/wlan_hdd_p2p.c +++ b/CORE/HDD/src/wlan_hdd_p2p.c @@ -301,7 +301,7 @@ wlan_hdd_remain_on_channel_callback(tHalHandle hHal, void* pCtx, mutex_lock(&cfgState->remain_on_chan_ctx_lock); pAdapter->is_roc_inprogress = FALSE; mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); return eHAL_STATUS_SUCCESS; } @@ -388,7 +388,7 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) " indication", __func__); } - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); } else mutex_unlock(&cfgState->remain_on_chan_ctx_lock); @@ -534,7 +534,7 @@ void wlan_hdd_remain_on_chan_timeout(void *data) (WLAN_HDD_GET_CTX(pAdapter))->pvosContext); } - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); } @@ -588,7 +588,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, p2p_prevent_bus_auto_suspend(); - hdd_prevent_suspend(); + hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); INIT_COMPLETION(pAdapter->rem_on_chan_ready_event); //call sme API to start remain on channel. @@ -612,7 +612,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, pAdapter->is_roc_inprogress = FALSE; mutex_unlock(&cfgState->remain_on_chan_ctx_lock); vos_mem_free(pRemainChanCtx); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); return -EINVAL; } @@ -647,7 +647,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, pAdapter->is_roc_inprogress = FALSE; mutex_unlock(&cfgState->remain_on_chan_ctx_lock); vos_mem_free (pRemainChanCtx); - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); return -EINVAL; } @@ -670,7 +670,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, #else (WLAN_HDD_GET_CTX(pAdapter))->pvosContext); #endif - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); return -EINVAL; } @@ -1194,7 +1194,7 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel( struct wiphy *wiphy, hddLog( LOGE, "%s:wait on cancel_rem_on_chan_var timed out ", __func__); } - hdd_allow_suspend(); + hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); p2p_allow_bus_auto_suspend(); return 0; @@ -1782,7 +1782,8 @@ static void hdd_wlan_tx_complete( hdd_adapter_t* pAdapter, memset( skb->cb, 0, sizeof( skb->cb ) ); #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK vos_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); + HDD_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); #endif if (in_interrupt()) netif_rx( skb ); @@ -2413,7 +2414,8 @@ void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter, skb->ip_summed = CHECKSUM_NONE; #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK vos_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); + HDD_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); #endif rxstat = netif_rx_ni(skb); if( NET_RX_SUCCESS == rxstat ) diff --git a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c index 2886659ba691..ea45b5665858 100644 --- a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c +++ b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c @@ -1129,7 +1129,8 @@ VOS_STATUS hdd_softap_rx_packet_cbk(v_VOID_t *vosContext, skb->protocol = eth_type_trans(skb, skb->dev); #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK vos_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); + HDD_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); #endif rxstat = netif_rx_ni(skb); if (NET_RX_SUCCESS == rxstat) diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c index 65677bc6bd3e..f9d9f491a41a 100644 --- a/CORE/HDD/src/wlan_hdd_tx_rx.c +++ b/CORE/HDD/src/wlan_hdd_tx_rx.c @@ -1855,7 +1855,8 @@ VOS_STATUS hdd_rx_packet_cbk(v_VOID_t *vosContext, pAdapter->stats.rx_bytes += skb->len; #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK vos_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); + HDD_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); #endif rxstat = netif_rx_ni(skb); if (NET_RX_SUCCESS == rxstat) diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index f8e06458f06f..3b721dfe1f86 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -2727,12 +2727,14 @@ static int wma_extscan_operations_event_handler(void *handle, oprn_ind->status = 0; break; case WMI_EXTSCAN_CYCLE_STARTED_EVENT: - vos_wake_lock_acquire(&wma->extscan_wake_lock); + vos_wake_lock_acquire(&wma->extscan_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN); WMA_LOGD("%s: received WMI_EXTSCAN_CYCLE_STARTED_EVENT", __func__); goto exit_handler; case WMI_EXTSCAN_CYCLE_COMPLETED_EVENT: - vos_wake_lock_release(&wma->extscan_wake_lock); + vos_wake_lock_release(&wma->extscan_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN); WMA_LOGD("%s: received WMI_EXTSCAN_CYCLE_COMPLETED_EVENT", __func__); goto exit_handler; @@ -14496,7 +14498,8 @@ 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_wake_lock_acquire(&wma->wow_wake_lock); + vos_wake_lock_acquire(&wma->wow_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_ADD_STA); WMA_LOGW("%s: %d clients connected, prevent suspend", __func__, wma->ap_client_cnt); } @@ -14507,7 +14510,8 @@ 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_wake_lock_release(&wma->wow_wake_lock); + vos_wake_lock_release(&wma->wow_wake_lock, + WIFI_POWER_EVENT_WAKELOCK_DEL_STA); WMA_LOGW("%s: %d clients connected, allow suspend", __func__, wma->ap_client_cnt); } @@ -17871,7 +17875,8 @@ static int wma_wow_wakeup_host_event(void *handle, u_int8_t *event, if (wake_lock_duration) { vos_wake_lock_timeout_acquire(&wma->wow_wake_lock, - wake_lock_duration); + wake_lock_duration, + WIFI_POWER_EVENT_WAKELOCK_WOW); WMA_LOGA("Holding %d msec wake_lock", wake_lock_duration); } @@ -19547,7 +19552,8 @@ int wma_disable_wow_in_fw(WMA_HANDLE handle) WMA_LOGD("WDA_WLAN_AUTO_RESUME_IND posted %d", ret); } #endif - vos_wake_lock_timeout_acquire(&wma->wow_wake_lock, 2000); + vos_wake_lock_timeout_acquire(&wma->wow_wake_lock, 2000, + WIFI_POWER_EVENT_WAKELOCK_WOW); return ret; } @@ -25567,7 +25573,8 @@ static int wma_nlo_match_evt_handler(void *handle, u_int8_t *event, node->nlo_match_evt_received = TRUE; vos_wake_lock_timeout_acquire(&wma->pno_wake_lock, - WMA_PNO_WAKE_LOCK_TIMEOUT); + WMA_PNO_WAKE_LOCK_TIMEOUT, + WIFI_POWER_EVENT_WAKELOCK_PNO); return 0; } @@ -28301,7 +28308,8 @@ void wma_target_suspend_acknowledge(void *context) wma->wow_nack = wow_nack; vos_event_set(&wma->target_suspend); if (wow_nack) - vos_wake_lock_timeout_acquire(&wma->wow_wake_lock, WMA_WAKE_LOCK_TIMEOUT); + vos_wake_lock_timeout_acquire(&wma->wow_wake_lock, WMA_WAKE_LOCK_TIMEOUT, + WIFI_POWER_EVENT_WAKELOCK_WOW); } int wma_resume_target(WMA_HANDLE handle) diff --git a/CORE/SVC/inc/wlan_nlink_srv.h b/CORE/SVC/inc/wlan_nlink_srv.h index 68c02a3b0194..2d5db8b3c56c 100644 --- a/CORE/SVC/inc/wlan_nlink_srv.h +++ b/CORE/SVC/inc/wlan_nlink_srv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -59,4 +59,5 @@ int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler); int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler); int nl_srv_ucast(struct sk_buff * skb, int dst_pid, int flag); int nl_srv_bcast(struct sk_buff * skb); +int nl_srv_is_initialized(void); #endif diff --git a/CORE/SVC/src/nlink/wlan_nlink_srv.c b/CORE/SVC/src/nlink/wlan_nlink_srv.c index 9559a8cfc710..fa7afcc756e2 100644 --- a/CORE/SVC/src/nlink/wlan_nlink_srv.c +++ b/CORE/SVC/src/nlink/wlan_nlink_srv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -283,3 +283,20 @@ static void nl_srv_rcv_msg (struct sk_buff *skb, struct nlmsghdr *nlh) "NLINK: No handler for Netlink Msg [0x%X]", type); } } + +/** + * nl_srv_is_initialized() - This function is used check if the netlink + * service is initialized + * + * This function is used check if the netlink service is initialized + * + * Return: Return -EPERM if the service is not initialized + * + */ +int nl_srv_is_initialized() +{ + if (nl_srv_sock) + return 0; + else + return -EPERM; +} diff --git a/CORE/VOSS/inc/event_defs.h b/CORE/VOSS/inc/event_defs.h index f87f2ba46433..c8382fd8b943 100644 --- a/CORE/VOSS/inc/event_defs.h +++ b/CORE/VOSS/inc/event_defs.h @@ -1902,6 +1902,7 @@ typedef enum EVENT_SNS_DRV_MOTION_DETECT_SIG = 0x767, EVENT_SNS_DRV_OPMODE_CHANGE = 0x768, EVENT_WLAN_EAPOL = 0xA8D,/* 18 bytes payload */ + EVENT_WLAN_WAKE_LOCK = 0xAA2, /* 96 bytes payload */ EVENT_NEXT_UNUSED_EVENT, EVENT_RSVD_START = 0x0800, diff --git a/CORE/VOSS/inc/i_vos_diag_core_event.h b/CORE/VOSS/inc/i_vos_diag_core_event.h index 265485ab744d..a30e6d78e236 100644 --- a/CORE/VOSS/inc/i_vos_diag_core_event.h +++ b/CORE/VOSS/inc/i_vos_diag_core_event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -86,6 +86,17 @@ void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPaylo /*------------------------------------------------------------------------- Function declarations and documenation ------------------------------------------------------------------------*/ +#ifdef FEATURE_WLAN_DIAG_SUPPORT +void vos_log_wlock_diag(uint32_t reason, const char *wake_lock_name, + uint32_t timeout, uint32_t status); +#else +static inline void vos_log_wlock_diag(uint32_t reason, + const char *wake_lock_name, + uint32_t timeout, uint32_t status) +{ + +} +#endif /* FEATURE_WLAN_DIAG_SUPPORT */ #ifdef __cplusplus } diff --git a/CORE/VOSS/inc/vos_diag_core_event.h b/CORE/VOSS/inc/vos_diag_core_event.h index 99eb5edf9ad8..c5623576dd2b 100644 --- a/CORE/VOSS/inc/vos_diag_core_event.h +++ b/CORE/VOSS/inc/vos_diag_core_event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -54,6 +54,8 @@ extern "C" { #endif /* __cplusplus */ +#define WAKE_LOCK_NAME_LEN 80 + /*------------------------------------------------------------------------- Event ID: EVENT_WLAN_SECURITY ------------------------------------------------------------------------*/ @@ -258,6 +260,28 @@ struct vos_event_wlan_eapol }; /*------------------------------------------------------------------------- + Event ID: EVENT_WLAN_WAKE_LOCK + ------------------------------------------------------------------------*/ +/** + * struct vos_event_wlan_wake_lock - Structure holding the wakelock information + * @status: Whether the wakelock is taken/released + * @reason: Reason for taking this wakelock + * @timeout: Timeout value in case of timed wakelocks + * @name_len: Length of the name of the wakelock that will follow + * @name: Name of the wakelock + * + * This structure will hold the wakelock informations + */ +struct vos_event_wlan_wake_lock +{ + uint32_t status; + uint32_t reason; + uint32_t timeout; + uint32_t name_len; + char name[WAKE_LOCK_NAME_LEN]; +}; + +/*------------------------------------------------------------------------- Function declarations and documenation ------------------------------------------------------------------------*/ @@ -266,6 +290,48 @@ enum wifi_connectivity_events { WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED, }; +/** + * enum wake_lock_reason - Reason for taking wakelock + * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT: Driver initialization + * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT: Driver re-initialization + * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_EXIT: Driver shutdown + * @WIFI_POWER_EVENT_WAKELOCK_SCAN: Scan request/response handling + * @WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN: Extended scan request/response handling + * @WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN: Driver resume + * @WIFI_POWER_EVENT_WAKELOCK_ROC: Remain on channel request/response handling + * @WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND: Auto suspend related handling + * @WIFI_POWER_EVENT_WAKELOCK_IPA: IPA related handling + * @WIFI_POWER_EVENT_WAKELOCK_ADD_STA: Addition of STA + * @WIFI_POWER_EVENT_WAKELOCK_HOLD_RX: Wakelocks taken for receive + * @WIFI_POWER_EVENT_WAKELOCK_SAP: SoftAP related wakelocks + * @WIFI_POWER_EVENT_WAKELOCK_WOW: WoW feature related + * @WIFI_POWER_EVENT_WAKELOCK_PNO: PNO feature related + * @WIFI_POWER_EVENT_WAKELOCK_DEL_STA: Deletion of a station + * @WIFI_POWER_EVENT_WAKELOCK_DFS: DFS related wakelocks + * @WIFI_POWER_EVENT_WAKELOCK_MISC: Miscellaneous wakelocks + * + * This enum has the reason codes why the wakelocks were taken/released + */ +enum wake_lock_reason { + WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT, + WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT, + WIFI_POWER_EVENT_WAKELOCK_DRIVER_EXIT, + WIFI_POWER_EVENT_WAKELOCK_SCAN, + WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN, + WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN, + WIFI_POWER_EVENT_WAKELOCK_ROC, + WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND, + WIFI_POWER_EVENT_WAKELOCK_IPA, + WIFI_POWER_EVENT_WAKELOCK_ADD_STA, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX, + WIFI_POWER_EVENT_WAKELOCK_SAP, + WIFI_POWER_EVENT_WAKELOCK_WOW, + WIFI_POWER_EVENT_WAKELOCK_PNO, + WIFI_POWER_EVENT_WAKELOCK_DEL_STA, + WIFI_POWER_EVENT_WAKELOCK_DFS, + WIFI_POWER_EVENT_WAKELOCK_MISC, +}; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/CORE/VOSS/inc/vos_lock.h b/CORE/VOSS/inc/vos_lock.h index e26819b181a8..5298207553c0 100644 --- a/CORE/VOSS/inc/vos_lock.h +++ b/CORE/VOSS/inc/vos_lock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -264,33 +264,37 @@ VOS_STATUS vos_wake_lock_init(vos_wake_lock_t *pLock, const char *name); \brief vos_wake_lock_acquire() - acquires a wake lock \param pLock - the wake lock to acquire + reason - reason for taking wakelock \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock); +VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock, uint32_t reason); /*-------------------------------------------------------------------------- \brief vos_wake_lock_timeout_acquire() - acquires a wake lock with a timeout \param pLock - the wake lock to acquire + reason - reason for taking wakelock \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_timeout_acquire(vos_wake_lock_t *pLock, v_U32_t msec); +VOS_STATUS vos_wake_lock_timeout_acquire(vos_wake_lock_t *pLock, v_U32_t msec, + uint32_t reason); /*-------------------------------------------------------------------------- \brief vos_wake_lock_release() - releases a wake lock \param pLock - the wake lock to release + reason - reason for taking wakelock \return VOS_STATUS_SUCCESS - the lock was successfully released ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock); +VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock, uint32_t reason); /*-------------------------------------------------------------------------- diff --git a/CORE/VOSS/src/vos_diag.c b/CORE/VOSS/src/vos_diag.c index 9c4da903cfa8..9135bdd5bb3b 100644 --- a/CORE/VOSS/src/vos_diag.c +++ b/CORE/VOSS/src/vos_diag.c @@ -41,7 +41,7 @@ #include "wlan_nlink_common.h" #include "vos_sched.h" #include "wlan_ptt_sock_svc.h" - +#include "wlan_nlink_srv.h" #define PTT_MSG_DIAG_CMDS_TYPE 0x5050 @@ -189,6 +189,38 @@ void vos_log_submit(v_VOID_t *plog_hdr_ptr) return; } +/** + * vos_log_wlock_diag() - This function is used to send wake lock diag events + * @reason: Reason why the wakelock was taken or released + * @wake_lock_name: Function in which the wakelock was taken or released + * @timeout: Timeout value in case of timed wakelocks + * @status: Status field indicating whether the wake lock was taken/released + * + * This function is used to send wake lock diag events to user space + * + * Return: None + * + */ +void vos_log_wlock_diag(uint32_t reason, const char *wake_lock_name, + uint32_t timeout, uint32_t status) +{ + WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event, + struct vos_event_wlan_wake_lock); + + if (nl_srv_is_initialized() != 0) + return; + + wlan_diag_event.status = status; + wlan_diag_event.reason = reason; + wlan_diag_event.timeout = timeout; + wlan_diag_event.name_len = strlen(wake_lock_name); + strlcpy(&wlan_diag_event.name[0], + wake_lock_name, + wlan_diag_event.name_len+1); + + WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_WAKE_LOCK); +} + /**--------------------------------------------------------------------------- \brief vos_event_report_payload() - diff --git a/CORE/VOSS/src/vos_lock.c b/CORE/VOSS/src/vos_lock.c index 3be063c22cad..6b94df21a813 100644 --- a/CORE/VOSS/src/vos_lock.c +++ b/CORE/VOSS/src/vos_lock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -50,6 +50,7 @@ #include "vos_trace.h" #include "vos_api.h" #include "hif.h" +#include "i_vos_diag_core_event.h" #ifdef CONFIG_CNSS #include <net/cnss.h> #endif @@ -58,6 +59,9 @@ /*---------------------------------------------------------------------------- * Preprocessor Definitions and Constants * -------------------------------------------------------------------------*/ +#define WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT 0 +#define WIFI_POWER_EVENT_WAKELOCK_TAKEN 0 +#define WIFI_POWER_EVENT_WAKELOCK_RELEASED 1 /*---------------------------------------------------------------------------- * Type Declarations @@ -508,6 +512,28 @@ VOS_STATUS vos_wake_lock_init(vos_wake_lock_t *pLock, const char *name) return VOS_STATUS_SUCCESS; } +/** + * vos_wake_lock_name() - This function returns the name of the wakelock + * @pLock: Pointer to the wakelock + * + * This function returns the name of the wakelock + * + * Return: Pointer to the name if it is valid or a default string + * + */ +static const char* vos_wake_lock_name(vos_wake_lock_t *pLock) +{ +#if !defined(CONFIG_CNSS) && \ + !(defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)) + return "UNNAMED_WAKELOCK"; +#else + if (pLock->name) + return pLock->name; + else + return "UNNAMED_WAKELOCK"; +#endif +} + /*-------------------------------------------------------------------------- \brief vos_wake_lock_acquire() - acquires a wake lock @@ -517,8 +543,12 @@ VOS_STATUS vos_wake_lock_init(vos_wake_lock_t *pLock, const char *name) \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock) +VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock, + uint32_t reason) { + vos_log_wlock_diag(reason, vos_wake_lock_name(pLock), + WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT, + WIFI_POWER_EVENT_WAKELOCK_TAKEN); #if defined CONFIG_CNSS cnss_pm_wake_lock(pLock); #elif defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK) @@ -540,8 +570,11 @@ VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock) \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_timeout_acquire(vos_wake_lock_t *pLock, v_U32_t msec) +VOS_STATUS vos_wake_lock_timeout_acquire(vos_wake_lock_t *pLock, v_U32_t msec, + uint32_t reason) { + vos_log_wlock_diag(reason, vos_wake_lock_name(pLock), msec, + WIFI_POWER_EVENT_WAKELOCK_TAKEN); #if defined CONFIG_CNSS cnss_pm_wake_lock_timeout(pLock, msec); #elif defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK) @@ -559,8 +592,11 @@ VOS_STATUS vos_wake_lock_timeout_acquire(vos_wake_lock_t *pLock, v_U32_t msec) \return VOS_STATUS_SUCCESS - the lock was successfully released ------------------------------------------------------------------------*/ -VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock) +VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock, uint32_t reason) { + vos_log_wlock_diag(reason, vos_wake_lock_name(pLock), + WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT, + WIFI_POWER_EVENT_WAKELOCK_RELEASED); #if defined CONFIG_CNSS cnss_pm_wake_lock_release(pLock); #elif defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK) |
