Эх сурвалжийг харах

qcacld-3.0: Add support for audio transport switch event

Based on the new requirement, add support for vendor event to
switch the audio transport bearer.

Change-Id: Iff5733c7552674fb84d225d1aef183577105a276
CRs-Fixed: 3585390
Ashish Kumar Dhanotiya 1 жил өмнө
parent
commit
a8c35ba698

+ 12 - 0
core/hdd/inc/wlan_hdd_ll_lt_sap.h

@@ -57,4 +57,16 @@ int wlan_hdd_cfg80211_ll_lt_sap_transport_switch(struct wiphy *wiphy,
 						 const void *data,
 						 int data_len);
 
+/**
+ * wlan_hdd_send_audio_transport_switch_req_event() - Audio transport switch
+ * event
+ * @adapter:              pointer to adapter structure.
+ * @audio_switch_mode:    audio switch mode.
+ *
+ * Return:   Return the Success or Failure code.
+ */
+int wlan_hdd_send_audio_transport_switch_req_event(struct hdd_adapter *adapter,
+						   uint8_t audio_switch_mode);
+
+
 #endif /* __WLAN_HDD_LL_LT_SAP_H */

+ 6 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -2130,6 +2130,12 @@ static const struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] =
 	},
 #endif
 	FEATURE_AFC_VENDOR_EVENTS
+
+	[QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH_INDEX] = {
+		.vendor_id = QCA_NL80211_VENDOR_ID,
+		.subcmd = QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH,
+	},
+
 };
 
 /**

+ 48 - 0
core/hdd/src/wlan_hdd_ll_lt_sap.c

@@ -23,6 +23,7 @@
 #include "wlan_hdd_ll_lt_sap.h"
 #include "wlan_ll_sap_ucfg_api.h"
 #include "osif_sync.h"
+#include "wlan_hdd_cfg80211.h"
 
 const struct nla_policy
 	wlan_hdd_ll_lt_sap_transport_switch_policy
@@ -110,6 +111,53 @@ __wlan_hdd_cfg80211_ll_lt_sap_transport_switch(struct wiphy *wiphy,
 	return -EINVAL;
 }
 
+int wlan_hdd_send_audio_transport_switch_req_event(struct hdd_adapter *adapter,
+						   uint8_t audio_switch_mode)
+{
+	struct sk_buff *vendor_event;
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	uint32_t len;
+
+	hdd_enter();
+
+	if (wlan_hdd_validate_context(hdd_ctx)) {
+		hdd_err("Invalid context");
+		return -EINVAL;
+	}
+	if (hdd_validate_adapter(adapter)) {
+		hdd_err("Invalid adapter");
+		return -EINVAL;
+	}
+
+	len = nla_total_size(sizeof(uint8_t)) + NLMSG_HDRLEN;
+
+	vendor_event = wlan_cfg80211_vendor_event_alloc(
+			hdd_ctx->wiphy,
+			&adapter->wdev,
+			len,
+			QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH_INDEX,
+			GFP_KERNEL);
+
+	if (!vendor_event) {
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
+		return -ENOMEM;
+	}
+
+	if (nla_put_u8(vendor_event,
+		       QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_TYPE,
+		       audio_switch_mode)) {
+		hdd_err("VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_TYPE put fail");
+		wlan_cfg80211_vendor_free_skb(vendor_event);
+		return -EINVAL;
+	}
+
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+
+	hdd_debug("transport switch request sent on %s interface",
+		   netdev_name(adapter->dev));
+	return 0;
+}
+
 int wlan_hdd_cfg80211_ll_lt_sap_transport_switch(struct wiphy *wiphy,
 						 struct wireless_dev *wdev,
 						 const void *data,