summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKanchanapally, Vidyullatha <vkanchan@qti.qualcomm.com>2017-03-10 02:52:30 +0530
committerSandeep Puligilla <spuligil@codeaurora.org>2017-03-20 15:49:01 -0700
commit31736589525e66f4e5d8f4a73e1c7407e966610e (patch)
treeb3438282ca037cb8b5e26d5b533b474e16956efb
parentb953b6607c24071e9accabc8e603c67ae74ddb63 (diff)
qcacld-3.0: Add handler for new WMI BT event
Add handler for the new WMI BT activity event and propagate the BT event till HDD. These BT activity events will be used for MBO enhancements to decide whether to accept the BTM request from AP or not. Change-Id: Ib426b2eb62821528d006dacc66e30d167d7bde5d CRs-Fixed: 2007107
-rw-r--r--core/hdd/inc/wlan_hdd_main.h2
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c38
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.h9
-rw-r--r--core/hdd/src/wlan_hdd_main.c5
-rw-r--r--core/mac/inc/wni_api.h1
-rw-r--r--core/sme/inc/sme_api.h10
-rw-r--r--core/sme/inc/sme_internal.h1
-rw-r--r--core/sme/src/common/sme_api.c24
-rw-r--r--core/wma/inc/wma_internal.h14
-rw-r--r--core/wma/src/wma_features.c35
-rw-r--r--core/wma/src/wma_main.c10
11 files changed, 149 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 2a7544f9247f..10eefe7c3ae2 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;
+}
+
const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index 48f6105e68a6..fac6d1df84a2 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -3685,4 +3685,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 48be0e56b683..75895f76c7f2 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -8949,6 +8949,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 91f75a30e243..a21fb2bfac88 100644
--- a/core/mac/inc/wni_api.h
+++ b/core/mac/inc/wni_api.h
@@ -266,6 +266,7 @@ enum eWniMsgTypes {
eWNI_SME_LOST_LINK_INFO_IND,
eWNI_SME_RSO_CMD_STATUS_IND,
eWMI_SME_LL_STATS_IND,
+ 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 40cd3945ed5c..313b3222d5eb 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1513,4 +1513,14 @@ QDF_STATUS sme_rso_cmd_status_cb(tHalHandle hal,
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));
+
#endif /* #if !defined( __SME_API_H ) */
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 031fda30ab18..10c8d8faa91c 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -3126,6 +3126,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)
@@ -17724,3 +17729,22 @@ QDF_STATUS sme_get_nud_debug_stats(tHalHandle hal,
return QDF_STATUS_SUCCESS;
}
+
+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);
+ sms_log(mac, LOG1, FL("bt activity info callback set"));
+ } else {
+ sms_log(mac, LOGE,
+ FL("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 4a89445b2109..a80509ff16c9 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;