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 /CORE/VOSS | |
| 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
Diffstat (limited to 'CORE/VOSS')
| -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 |
6 files changed, 161 insertions, 11 deletions
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) |
