diff options
| -rw-r--r-- | core/hdd/inc/wlan_hdd_main.h | 2 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 38 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.h | 9 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 5 | ||||
| -rw-r--r-- | core/mac/inc/wni_api.h | 1 | ||||
| -rw-r--r-- | core/sme/inc/sme_api.h | 10 | ||||
| -rw-r--r-- | core/sme/inc/sme_internal.h | 1 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 23 | ||||
| -rw-r--r-- | core/wma/inc/wma_internal.h | 14 | ||||
| -rw-r--r-- | core/wma/src/wma_features.c | 35 | ||||
| -rw-r--r-- | core/wma/src/wma_main.c | 10 |
11 files changed, 148 insertions, 0 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 28cf0d988e91..925b01824490 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1694,6 +1694,8 @@ struct hdd_context_s { struct vendor_oui *probe_req_voui; struct hdd_nud_stats_context nud_stats_context; uint32_t track_arp_ip; + uint8_t bt_a2dp_active:1; + uint8_t bt_vo_active:1; }; /*--------------------------------------------------------------------------- diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 1ef68434a711..268694f60dcf 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -8870,6 +8870,44 @@ static int wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, #undef QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE #undef QCA_ATTR_NUD_STATS_GET_MAX +void hdd_bt_activity_cb(void *context, uint32_t bt_activity) +{ + hdd_context_t *hdd_ctx = (hdd_context_t *)context; + int status; + + status = wlan_hdd_validate_context(hdd_ctx); + if (0 != status) + return; + + if (bt_activity == WLAN_COEX_EVENT_BT_A2DP_PROFILE_ADD) + hdd_ctx->bt_a2dp_active = 1; + else if (bt_activity == WLAN_COEX_EVENT_BT_A2DP_PROFILE_REMOVE) + hdd_ctx->bt_a2dp_active = 0; + else if (bt_activity == WLAN_COEX_EVENT_BT_VOICE_PROFILE_ADD) + hdd_ctx->bt_vo_active = 1; + else if (bt_activity == WLAN_COEX_EVENT_BT_VOICE_PROFILE_REMOVE) + hdd_ctx->bt_vo_active = 0; + else + return; + + hdd_info("a2dp_active:%d vo_active:%d", hdd_ctx->bt_a2dp_active, + hdd_ctx->bt_vo_active); +} + +/** + * wlan_hdd_is_bt_in_progress() - check if bt activity is in progress + * @hdd_ctx : HDD context + * + * Return: true if BT activity is in progress else false + */ +static inline bool wlan_hdd_is_bt_in_progress(hdd_context_t *hdd_ctx) +{ + if (hdd_ctx->bt_a2dp_active || hdd_ctx->bt_vo_active) + return true; + + return false; +} + #ifdef FEATURE_WLAN_CH_AVOID /** * wlan_hdd_is_channel_to_avoid() - Check channel to avoid diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 3a09f049ed0b..de3c37eb1ad9 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -3766,4 +3766,13 @@ void hdd_process_defer_disconnect(hdd_adapter_t *adapter); * Return: 0 for success, non-zero for failure */ int wlan_hdd_try_disconnect(hdd_adapter_t *adapter); + +/** + * hdd_bt_activity_cb() - callback function to receive bt activity + * @context: HDD context + * @bt_activity: specifies the kind of bt activity + * + * Return: none + */ +void hdd_bt_activity_cb(void *context, uint32_t bt_activity); #endif diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index fe032d1cc75a..15c7cfbb243a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8959,6 +8959,11 @@ int hdd_register_cb(hdd_context_t *hdd_ctx) wlan_hdd_dcc_register_for_dcc_stats_event(hdd_ctx); + status = sme_set_bt_activity_info_cb(hdd_ctx->hHal, + hdd_bt_activity_cb); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("set bt activity info callback failed"); + EXIT(); return ret; diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index 37f9b279394c..d27472f6a5c9 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -267,6 +267,7 @@ enum eWniMsgTypes { eWNI_SME_RSO_CMD_STATUS_IND, eWMI_SME_LL_STATS_IND, eWNI_SME_DEL_ALL_TDLS_PEERS, + eWNI_SME_BT_ACTIVITY_INFO_IND, eWNI_SME_MSG_TYPES_END }; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 80995bebff8b..add07344d121 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1531,6 +1531,16 @@ void sme_set_5g_band_pref(tHalHandle hal_handle, struct sme_5g_band_pref_params *pref_params); /** + * sme_set_bt_activity_info_cb - set the callback handler for bt events + * @hal: handle returned by mac_open + * @cb: callback handler + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_bt_activity_info_cb(tHalHandle hal, + void (*cb)(void *, uint32_t profile_info)); + +/** * sme_scan_get_result_for_bssid - gets the scan result from scan cache for the * bssid specified * @hal: handle returned by mac_open diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 50f2f8b13633..e149b55f56ba 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -260,6 +260,7 @@ typedef struct tagSmeStruct { void (*rso_cmd_status_cb)(void *hdd_context, struct rso_cmd_status *rso_status); void (*get_arp_stats_cb)(void *, struct rsp_stats *); + void (*bt_activity_info_cb)(void *context, uint32_t bt_activity); } tSmeStruct, *tpSmeStruct; #endif /* #if !defined( __SMEINTERNAL_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index ad24b1222bcc..f2ec7c49a73b 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -3035,6 +3035,11 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, cds_msg_t *pMsg) pMsg->bodyptr); qdf_mem_free(pMsg->bodyptr); break; + case eWNI_SME_BT_ACTIVITY_INFO_IND: + if (pMac->sme.bt_activity_info_cb) + pMac->sme.bt_activity_info_cb(pMac->hHdd, + pMsg->bodyval); + break; default: if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) @@ -17515,3 +17520,21 @@ QDF_STATUS sme_delete_all_tdls_peers(tHalHandle hal, uint8_t session_id) return status; } + +QDF_STATUS sme_set_bt_activity_info_cb(tHalHandle hal, + void (*cb)(void *, uint32_t bt_activity)) +{ + QDF_STATUS status; + tpAniSirGlobal mac = PMAC_STRUCT(hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac->sme.bt_activity_info_cb = cb; + sme_release_global_lock(&mac->sme); + sme_debug("bt activity info callback set"); + } else { + sme_debug("sme_acquire_global_lock failed %d", status); + } + + return status; +} diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 45f1c72f0e90..1471e61c1fda 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1350,4 +1350,18 @@ QDF_STATUS wma_send_vdev_stop_to_fw(t_wma_handle *wma, uint8_t vdev_id); int wma_get_arp_stats_handler(void *handle, uint8_t *data, uint32_t data_len); + +/** + * wma_wlan_bt_activity_evt_handler - event handler to handle bt activity + * @handle: the WMA handle + * @event: buffer with the event parameters + * @len: length of the buffer + * + * This function receives BT activity event from firmware and passes the event + * information to upper layers + * + * Return: 0 on success + */ +int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event, + uint32_t len); #endif diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 67d9708a6263..ad0260f08348 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -8935,3 +8935,38 @@ inline QDF_STATUS wma_send_udp_resp_offload_cmd(tp_wma_handle wma_handle, return QDF_STATUS_E_FAILURE; } #endif + +int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event, uint32_t len) +{ + wmi_coex_bt_activity_event_fixed_param *fixed_param; + WMI_WLAN_COEX_BT_ACTIVITY_EVENTID_param_tlvs *param_buf = + (WMI_WLAN_COEX_BT_ACTIVITY_EVENTID_param_tlvs *)event; + cds_msg_t sme_msg = {0}; + QDF_STATUS qdf_status; + + if (!param_buf) { + WMA_LOGE(FL("Invalid BT activity event buffer")); + return -EINVAL; + } + + fixed_param = param_buf->fixed_param; + if (!fixed_param) { + WMA_LOGE(FL("Invalid BT activity event fixed param buffer")); + return -EINVAL; + } + + WMA_LOGI(FL("Received BT activity event %u"), + fixed_param->coex_profile_evt); + + sme_msg.type = eWNI_SME_BT_ACTIVITY_INFO_IND; + sme_msg.bodyptr = NULL; + sme_msg.bodyval = fixed_param->coex_profile_evt; + + qdf_status = cds_mq_post_message(QDF_MODULE_ID_SME, &sme_msg); + if (QDF_IS_STATUS_ERROR(qdf_status)) { + WMA_LOGE(FL("Failed to post msg to SME")); + return -EINVAL; + } + + return 0; +} diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 7475cd99825e..95cd77571c18 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -3249,6 +3249,16 @@ QDF_STATUS wma_start(void *cds_ctx) goto end; } + status = wmi_unified_register_event_handler(wma_handle->wmi_handle, + WMI_WLAN_COEX_BT_ACTIVITY_EVENTID, + wma_wlan_bt_activity_evt_handler, + WMA_RX_SERIALIZER_CTX); + if (!QDF_IS_STATUS_SUCCESS(status)) { + WMA_LOGE("Failed to register coex bt activity event handler"); + qdf_status = QDF_STATUS_E_FAILURE; + goto end; + } + end: WMA_LOGD("%s: Exit", __func__); return qdf_status; |
