Browse Source

Merge "qca-wifi: Add support to send LCR WMI command to FW"

Linux Build Service Account 4 năm trước cách đây
mục cha
commit
5e193c76cd
3 tập tin đã thay đổi với 79 bổ sung0 xóa
  1. 10 0
      wmi/inc/wmi_unified_ap_api.h
  2. 8 0
      wmi/src/wmi_unified_ap_api.c
  3. 61 0
      wmi/src/wmi_unified_ap_tlv.c

+ 10 - 0
wmi/inc/wmi_unified_ap_api.h

@@ -24,6 +24,7 @@
 #define _WMI_UNIFIED_AP_API_H_
 
 #include "wmi_unified_param.h"
+#include <wmi_unified_ap_params.h>
 
 /**
  *  wmi_unified_beacon_send_cmd() - WMI beacon send function
@@ -770,4 +771,13 @@ QDF_STATUS wmi_unified_set_radio_tx_mode_select_cmd_send(
 		wmi_unified_t wmi_handle,
 		struct wmi_pdev_enable_tx_mode_selection *tx_mode_select_param);
 
+/**
+ * wmi_unified_send_lcr_cmd() - Send LCR command to FW
+ * @wmi_handle: WMI handle
+ * @lcr_info: Pointer to LCR structure
+ *
+ * Return: QDF_STATUS_SUCCESS if success, else returns proper error code.
+ */
+QDF_STATUS wmi_unified_send_lcr_cmd(wmi_unified_t wmi_handle,
+				    struct wmi_wifi_pos_lcr_info *lcr_info);
 #endif /* _WMI_UNIFIED_AP_API_H_ */

+ 8 - 0
wmi/src/wmi_unified_ap_api.c

@@ -617,3 +617,11 @@ QDF_STATUS wmi_unified_set_radio_tx_mode_select_cmd_send(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_unified_send_lcr_cmd(wmi_unified_t wmi_handle,
+				    struct wmi_wifi_pos_lcr_info *lcr_info)
+{
+	if (wmi_handle->ops->send_lcr_cmd)
+		return wmi_handle->ops->send_lcr_cmd(wmi_handle, lcr_info);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 61 - 0
wmi/src/wmi_unified_ap_tlv.c

@@ -21,6 +21,7 @@
 #include "wmi_unified_priv.h"
 #include "wmi_unified_ap_api.h"
 #include <wlan_utility.h>
+#include "wmi_unified_rtt.h"
 
 /**
  * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw
@@ -2594,6 +2595,65 @@ set_radio_tx_mode_select_cmd_tlv(wmi_unified_t wmi,
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS send_lcr_cmd_tlv(wmi_unified_t wmi_handle,
+				   struct wmi_wifi_pos_lcr_info *lcr_info)
+{
+	struct wmi_rtt_oem_req_head *req_head;
+	struct wmi_rtt_oem_lcr_cfg_head *lcr_config;
+	uint8_t req_head_len = sizeof(struct wmi_rtt_oem_req_head);
+	uint32_t lcr_cfg_head_len = sizeof(struct wmi_rtt_oem_lcr_cfg_head);
+	uint8_t *buf;
+	uint32_t buf_len;
+	uint8_t *civic_info;
+	uint8_t lcr_info_len;
+
+	buf_len = req_head_len + lcr_cfg_head_len;
+
+	buf = qdf_mem_malloc(buf_len * sizeof(uint8_t));
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	qdf_mem_zero(buf, buf_len);
+
+	/* Add the wmi_rtt_oem_req_head TLV */
+	req_head = (struct wmi_rtt_oem_req_head *)buf;
+	WMIRTT_TLV_SET_HDR(&req_head->tlv_header,
+			   WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_req_head,
+			   req_head_len);
+
+	req_head->sub_type = RTT_MSG_SUBTYPE_CONFIGURE_LCR;
+	req_head->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+							wmi_handle,
+							lcr_info->pdev_id);
+	WMI_RTT_REQ_ID_SET((req_head->req_id), lcr_info->req_id);
+
+	lcr_config = (struct wmi_rtt_oem_lcr_cfg_head *)(buf + req_head_len);
+	WMIRTT_TLV_SET_HDR(&lcr_config->tlv_header,
+			   WMIRTT_TLV_TAG_STRUC_wmi_rtt_oem_lcr_cfg_head,
+			   lcr_cfg_head_len);
+
+	/* The following subtraction and addition of the value 2 to length is
+	 * being done because Country code which is 2 bytes comes separately
+	 * from the actual Civic Info string.
+	 */
+	lcr_info_len = (lcr_info->civic_len > (CIVIC_INFO_LEN - 2)) ?
+				   (CIVIC_INFO_LEN - 2) : lcr_info->civic_len;
+
+	WMI_RTT_LOC_CIVIC_LENGTH_SET(lcr_config->loc_civic_params,
+				     (lcr_info_len + 2));
+
+	civic_info = (uint8_t *)lcr_config->civic_info;
+	civic_info[0] = lcr_info->country_code[0];
+	civic_info[1] = lcr_info->country_code[1];
+	qdf_mem_copy(&civic_info[2], lcr_info->civic_info, lcr_info->civic_len);
+
+	if (wmi_handle->ops->send_start_oem_data_cmd)
+		return wmi_handle->ops->send_start_oem_data_cmd(wmi_handle,
+								buf_len, buf);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 void wmi_ap_attach_tlv(wmi_unified_t wmi_handle)
 {
 	struct wmi_ops *ops = wmi_handle->ops;
@@ -2665,4 +2725,5 @@ void wmi_ap_attach_tlv(wmi_unified_t wmi_handle)
 				extract_multi_vdev_restart_resp_event_tlv;
 	ops->multisoc_tbtt_sync_cmd = send_multisoc_tbtt_sync_cmd_tlv;
 	ops->set_radio_tx_mode_select_cmd = set_radio_tx_mode_select_cmd_tlv;
+	ops->send_lcr_cmd = send_lcr_cmd_tlv;
 }