浏览代码

qcacmn: Add wmi support for btcoex duty cycle command

A new iwpriv command has been added to configure the period
and wlan duration for a btcoex duty cycle.

As a part of this registring the wmi_service_btcoex_duty_cycle
for WMI_SERVICE_BTCOEX_DUTY_CYCLE.

Also send_btcoex_wlan_priority_cmd registrtaion for btcoex
duty cycle command in non_tlv_ops.

Change-Id: I7f3bfdfd9804566d6d0b7cce7025e99db57d0e23
Acked-by: Basamma Yakkanahalli <[email protected]>
CRs-Fixed: 1064437
Sathish Kumar 8 年之前
父节点
当前提交
92c7904b41

+ 1 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -466,6 +466,7 @@ typedef enum _ol_ath_param_t {
 	OL_ATH_PARAM_CHANNEL_SWITCH_COUNT = 338,
 	OL_ATH_PARAM_ALWAYS_PRIMARY = 339,
 	OL_ATH_PARAM_FAST_LANE = 340,
+	OL_ATH_GET_BTCOEX_DUTY_CYCLE = 341,
 	OL_ATH_PARAM_SECONDARY_OFFSET_IE = 342,
 	OL_ATH_PARAM_WIDE_BAND_SUB_ELEMENT = 343,
 	OL_ATH_PARAM_PREFERRED_UPLINK = 344,

+ 4 - 1
wmi/inc/wmi_unified_api.h

@@ -884,7 +884,10 @@ QDF_STATUS wmi_send_pdev_caldata_version_check_cmd(void *wmi_hdl,
 				uint32_t value);
 
 QDF_STATUS wmi_unified_send_btcoex_wlan_priority_cmd(void *wmi_hdl,
-				int value);
+				struct btcoex_cfg_params *param);
+
+QDF_STATUS wmi_unified_send_btcoex_duty_cycle_cmd(void *wmi_hdl,
+				struct btcoex_cfg_params *param);
 
 QDF_STATUS wmi_unified_set_atf_cmd_send(void *wmi_hdl,
 				struct set_atf_params *param);

+ 33 - 0
wmi/inc/wmi_unified_param.h

@@ -4169,6 +4169,38 @@ struct gpio_output_params {
 	uint32_t set;
 };
 
+/* flags bit 0: to configure wlan priority bitmap */
+#define WMI_HOST_BTCOEX_PARAM_FLAGS_WLAN_PRIORITY_BITMAP_BIT (1<<0)
+/* flags bit 1: to configure both period and wlan duration */
+#define WMI_HOST_BTCOEX_PARAM_FLAGS_DUTY_CYCLE_BIT (1<<1)
+struct btcoex_cfg_params {
+	/* WLAN priority bitmask for different frame types */
+	uint32_t  btcoex_wlan_priority_bitmap;
+	/* This command is used to configure different btcoex params
+	 * in different situations.The host sets the appropriate bit(s)
+	 * in btcoex_param_flags to indicate which configuration parameters
+	 * are valid within a particular BT coex config message, so that one
+	 * BT configuration parameter can be configured without affecting
+	 * other BT configuration parameters.E.g. if the host wants to
+	 * configure only btcoex_wlan_priority_bitmap it sets only
+	 * WMI_BTCOEX_PARAM_FLAGS_WLAN_PRIORITY_BITMAP_BIT in
+	 * btcoex_param_flags so that firmware will not overwrite
+	 * other params with default value passed in the command.
+	 * Host can also set multiple bits in btcoex_param_flags
+	 * to configure more than one param in single message.
+	 */
+	uint32_t btcoex_param_flags;
+	/* period denotes the total time in milliseconds which WLAN and BT share
+	 * configured percentage for transmission and reception.
+	 */
+	uint32_t period;
+	/* wlan duration is the time in milliseconds given for wlan
+	 * in above period.
+	 */
+	uint32_t wlan_duration;
+};
+
+
 #define WMI_HOST_RTT_REPORT_CFR	0
 #define WMI_HOST_RTT_NO_REPORT_CFR	1
 #define WMI_HOST_RTT_AGGREGATE_REPORT_NON_CFR	2
@@ -5228,6 +5260,7 @@ typedef enum {
 	wmi_service_tx_mode_push_pull,
 	wmi_service_tx_mode_dynamic,
 	wmi_service_check_cal_version,
+	wmi_service_btcoex_duty_cycle,
 
 	wmi_services_max,
 } wmi_conv_service_ids;

+ 6 - 1
wmi/inc/wmi_unified_priv.h

@@ -986,7 +986,12 @@ QDF_STATUS
 			uint32_t value);
 
 QDF_STATUS
-(*send_btcoex_wlan_priority_cmd)(wmi_unified_t wmi_handle, int value);
+(*send_btcoex_wlan_priority_cmd)(wmi_unified_t wmi_handle,
+			struct btcoex_cfg_params *param);
+
+QDF_STATUS
+(*send_btcoex_duty_cycle_cmd)(wmi_unified_t wmi_handle,
+			struct btcoex_cfg_params *param);
 
 QDF_STATUS (*extract_wds_addr_event)(wmi_unified_t wmi_handle,
 	void *evt_buf, uint16_t len, wds_addr_event_t *wds_ev);

+ 23 - 3
wmi/src/wmi_unified_api.c

@@ -6387,20 +6387,40 @@ QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl,
 /*
  * wmi_unified_send_btcoex_wlan_priority_cmd() - send btcoex priority commands
  * @wmi_handle: wmi handle
- * @value: Priority value
+ * @param :     wmi btcoex cfg params
  *
  * Send WMI_BTCOEX_CFG_CMDID parameters to fw.
  *
  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
  */
 QDF_STATUS wmi_unified_send_btcoex_wlan_priority_cmd(void *wmi_hdl,
-				int value)
+				struct btcoex_cfg_params *param)
 {
 	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
 
 	if (wmi->ops->send_btcoex_wlan_priority_cmd)
 		return wmi->ops->send_btcoex_wlan_priority_cmd(wmi,
-				  value);
+				  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+/**
+ *  wmi_unified_send_btcoex_duty_cycle_cmd() - send btcoex duty cycle commands
+ * @wmi_handle: wmi handle
+ * @param:      wmi btcoex cfg params
+ *
+ * Send WMI_BTCOEX_CFG_CMDID parameters to fw.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS wmi_unified_send_btcoex_duty_cycle_cmd(void *wmi_hdl,
+				struct btcoex_cfg_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_btcoex_duty_cycle_cmd)
+		return wmi->ops->send_btcoex_duty_cycle_cmd(wmi,
+				param);
 
 	return QDF_STATUS_E_FAILURE;
 }

+ 41 - 3
wmi/src/wmi_unified_non_tlv.c

@@ -5214,12 +5214,13 @@ send_pdev_caldata_version_check_cmd_non_tlv(wmi_unified_t wmi_handle,
 /**
  * send_btcoex_wlan_priority_cmd_non_tlv() - send btcoex wlan priority fw
  * @wmi_handle: wmi handle
- * @value:	priority value
+ * @param: btcoex config params
  *
  * Return: 0 for success or error code
  */
 QDF_STATUS
-send_btcoex_wlan_priority_cmd_non_tlv(wmi_unified_t wmi_handle, int value)
+send_btcoex_wlan_priority_cmd_non_tlv(wmi_unified_t wmi_handle,
+				struct btcoex_cfg_params *param)
 {
 	wmi_buf_t buf;
 	wmi_btcoex_cfg_cmd *cmd;
@@ -5231,7 +5232,41 @@ send_btcoex_wlan_priority_cmd_non_tlv(wmi_unified_t wmi_handle, int value)
 		return QDF_STATUS_E_FAILURE;
 	}
 	cmd = (wmi_btcoex_cfg_cmd *) wmi_buf_data(buf);
-	cmd->btcoex_wlan_priority_bitmap = value;
+
+	cmd->btcoex_wlan_priority_bitmap = param->btcoex_wlan_priority_bitmap;
+	cmd->btcoex_param_flags = param->btcoex_param_flags;
+	if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_BTCOEX_CFG_CMDID)) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_btcoex_duty_cycle_cmd_non_tlv() - send btcoex wlan priority fw
+ * @wmi_handle: wmi handle
+ * @param:	period and duration
+ *
+ * Return: 0 for success or error code
+ */
+QDF_STATUS
+send_btcoex_duty_cycle_cmd_non_tlv(wmi_unified_t wmi_handle,
+				struct btcoex_cfg_params *param)
+{
+	wmi_buf_t buf;
+	wmi_btcoex_cfg_cmd *cmd;
+	int len = sizeof(wmi_btcoex_cfg_cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_btcoex_cfg_cmd *) wmi_buf_data(buf);
+	cmd->wlan_duration = param->wlan_duration;
+	cmd->period = param->period;
+	cmd->btcoex_param_flags = param->btcoex_param_flags;
 	if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_BTCOEX_CFG_CMDID)) {
 		wmi_buf_free(buf);
 		return QDF_STATUS_E_FAILURE;
@@ -7879,6 +7914,7 @@ struct wmi_ops non_tlv_ops =  {
 	.send_pdev_caldata_version_check_cmd =
 			send_pdev_caldata_version_check_cmd_non_tlv,
 	.send_btcoex_wlan_priority_cmd = send_btcoex_wlan_priority_cmd_non_tlv,
+	.send_btcoex_duty_cycle_cmd = send_btcoex_duty_cycle_cmd_non_tlv,
 
 	.get_target_cap_from_service_ready = extract_service_ready_non_tlv,
 	.extract_fw_version = extract_fw_version_non_tlv,
@@ -8039,6 +8075,8 @@ static void populate_non_tlv_service(uint32_t *wmi_service)
 	wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_TX_MODE_DYNAMIC;
 	wmi_service[wmi_service_check_cal_version] =
 				WMI_SERVICE_CHECK_CAL_VERSION;
+	wmi_service[wmi_service_btcoex_duty_cycle] =
+				WMI_SERVICE_BTCOEX_DUTY_CYCLE;
 
 	wmi_service[wmi_service_roam_scan_offload] = WMI_SERVICE_UNAVAILABLE;
 	wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_UNAVAILABLE;

+ 1 - 0
wmi/src/wmi_unified_tlv.c

@@ -13103,6 +13103,7 @@ static void populate_tlv_service(uint32_t *wmi_service)
 	wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE;
 	wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE;
 	wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE;
+	wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE;
 }
 
 /**