Sfoglia il codice sorgente

qcacmn: Add the wmi interface changes for sending wlan time sync cmd

This patch adds the support for forming tlv commands
WMI_AUDIO_SYNC_TRIGGER_CMDID and WMI_AUDIO_SYNC_QTIMER_CMDID.

CRs-Fixed: 2607605
Change-Id: Ifaf2b43b60cf604d79d5649b27632422850a0d61
Surabhi Vishnoi 5 anni fa
parent
commit
7f64ef005b

+ 30 - 0
wmi/inc/wmi_unified_api.h

@@ -3817,4 +3817,34 @@ QDF_STATUS wmi_unified_extract_ani_level(wmi_unified_t wmi_handle,
 					 struct wmi_host_ani_level_event **info,
 					 uint32_t *num_freqs);
 #endif /* FEATURE_ANI_LEVEL_REQUEST */
+
+#ifdef FEATURE_WLAN_TIME_SYNC_FTM
+/**
+ * wmi_send_wlan_time_sync_ftm_trigger() - send wlan time sync ftm trigger cmd.
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @burst_mode: mode reg getting time sync relation from FW
+ *
+ * This function indicates the FW to trigger wlan time sync using FTM
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(void *wmi_handle,
+					       uint32_t vdev_id,
+					       bool burst_mode);
+
+/**
+ * wmi_send_wlan_time_sync_qtime() - send wlan time sync qtime cmd.
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @lpass_ts: audio qtime
+ *
+ * This function sends the wmi cmd to FW having audio qtime
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_send_wlan_time_sync_qtime(void *wmi_handle, uint32_t vdev_id,
+					 uint64_t lpass_ts);
+#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
+
 #endif /* _WMI_UNIFIED_API_H_ */

+ 10 - 0
wmi/inc/wmi_unified_priv.h

@@ -2154,6 +2154,16 @@ QDF_STATUS (*extract_ani_level)(uint8_t *evt_buf,
 QDF_STATUS (*extract_multi_vdev_restart_resp_event)(
 		wmi_unified_t wmi_handle, void *evt_buf,
 		struct multi_vdev_restart_resp *restart_rsp);
+
+#ifdef FEATURE_WLAN_TIME_SYNC_FTM
+QDF_STATUS (*send_wlan_time_sync_ftm_trigger_cmd)(wmi_unified_t wmi_handle,
+						  uint32_t vdev_id,
+						  bool burst_mode);
+QDF_STATUS (*send_wlan_ts_qtime_cmd)(wmi_unified_t wmi_handle,
+				     uint32_t vdev_id,
+				     uint64_t lpass_ts);
+#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
+
 };
 
 /* Forward declartion for psoc*/

+ 24 - 0
wmi/src/wmi_unified_api.c

@@ -3123,3 +3123,27 @@ wmi_unified_extract_roam_11kv_stats(wmi_unified_t wmi, void *evt_buf,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+#ifdef FEATURE_WLAN_TIME_SYNC_FTM
+QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(wmi_unified_t wmi_handle,
+					       uint32_t vdev_id,
+					       bool burst_mode)
+{
+	if (wmi_handle->ops->send_wlan_time_sync_ftm_trigger_cmd)
+		return wmi_handle->ops->send_wlan_time_sync_ftm_trigger_cmd
+				(wmi_handle, vdev_id, burst_mode);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wmi_send_wlan_time_sync_qtime(wmi_unified_t wmi_handle,
+					 uint32_t vdev_id,
+					 uint64_t lpass_ts)
+{
+	if (wmi_handle->ops->send_wlan_ts_qtime_cmd)
+		return wmi_handle->ops->send_wlan_ts_qtime_cmd(wmi_handle,
+					vdev_id, lpass_ts);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* FEATURE_WLAN_TIME_SYNC_FTM */

+ 77 - 0
wmi/src/wmi_unified_tlv.c

@@ -12934,6 +12934,78 @@ extract_roam_scan_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
 }
 #endif
 
+#ifdef FEATURE_WLAN_TIME_SYNC_FTM
+/**
+ * send_wlan_ts_ftm_trigger_cmd_tlv(): send wlan time sync cmd to FW
+ *
+ * @wmi: wmi handle
+ * @vdev_id: vdev id
+ * @burst_mode: Indicates whether relation derived using FTM is needed for
+ *		each FTM frame or only aggregated result is required.
+ *
+ * Send WMI_AUDIO_SYNC_TRIGGER_CMDID to FW.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS send_wlan_ts_ftm_trigger_cmd_tlv(wmi_unified_t wmi,
+						   uint32_t vdev_id,
+						   bool burst_mode)
+{
+	wmi_audio_sync_trigger_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi, len);
+	if (!buf) {
+		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_audio_sync_trigger_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_audio_sync_trigger_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_audio_sync_trigger_cmd_fixed_param));
+	cmd->vdev_id = vdev_id;
+	cmd->agg_relation = burst_mode ? false : true;
+	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_AUDIO_SYNC_TRIGGER_CMDID)) {
+		WMI_LOGE("%s: failed to send audio sync trigger cmd", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS send_wlan_ts_qtime_cmd_tlv(wmi_unified_t wmi,
+					     uint32_t vdev_id,
+					     uint64_t lpass_ts)
+{
+	wmi_audio_sync_qtimer_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi, len);
+	if (!buf) {
+		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_audio_sync_qtimer_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_audio_sync_qtimer_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_audio_sync_qtimer_cmd_fixed_param));
+	cmd->vdev_id = vdev_id;
+	cmd->qtimer_u32 = (uint32_t)((lpass_ts & 0xffffffff00000000LL) >> 32);
+	cmd->qtimer_l32 = (uint32_t)(lpass_ts & 0xffffffffLL);
+
+	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_AUDIO_SYNC_QTIMER_CMDID)) {
+		WMI_LOGP("%s: Failed to send audio qtime command", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
+
 struct wmi_ops tlv_ops =  {
 	.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
 	.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@@ -13248,6 +13320,11 @@ struct wmi_ops tlv_ops =  {
 	.extract_roam_scan_stats = extract_roam_scan_stats_tlv,
 	.extract_roam_result_stats = extract_roam_result_stats_tlv,
 	.extract_roam_11kv_stats = extract_roam_11kv_stats_tlv,
+
+#ifdef FEATURE_WLAN_TIME_SYNC_FTM
+	.send_wlan_time_sync_ftm_trigger_cmd = send_wlan_ts_ftm_trigger_cmd_tlv,
+	.send_wlan_ts_qtime_cmd = send_wlan_ts_qtime_cmd_tlv,
+#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
 };
 
 /**