Explorar o código

qcacmn: Add fwtest interface

Add wmi fw test interface to support generic fw test command.

Change-Id: Ic2dc113e3a698555c0fdcbafb30df154f6deb97d
CRs-Fixed: 1045265
Anurag Chouhan %!s(int64=9) %!d(string=hai) anos
pai
achega
459e015c3f
Modificáronse 2 ficheiros con 65 adicións e 0 borrados
  1. 22 0
      wmi_unified_api.c
  2. 43 0
      wmi_unified_tlv.c

+ 22 - 0
wmi_unified_api.c

@@ -3233,6 +3233,28 @@ QDF_STATUS wmi_unified_roam_synch_complete_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
+/**
+ * wmi_unified_fw_test_cmd() - send fw test command to fw.
+ * @wmi_hdl: wmi handle
+ * @wmi_fwtest: fw test command
+ *
+ * This function sends fw test command to fw.
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_fw_test_cmd(void *wmi_hdl,
+				   struct set_fwtest_params *wmi_fwtest)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_fw_test_cmd)
+		return wmi_handle->ops->send_fw_test_cmd(wmi_handle,
+				  wmi_fwtest);
+
+	return QDF_STATUS_E_FAILURE;
+
+}
+
 /**
  * wmi_unified_unit_test_cmd() - send unit test command to fw.
  * @wmi_hdl: wmi handle

+ 43 - 0
wmi_unified_tlv.c

@@ -10104,6 +10104,48 @@ QDF_STATUS send_process_roam_synch_complete_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * send_fw_test_cmd_tlv() - send fw test command to fw.
+ * @wmi_handle: wmi handle
+ * @wmi_fwtest: fw test command
+ *
+ * This function sends fw test command to fw.
+ *
+ * Return: CDF STATUS
+ */
+QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle,
+			       struct set_fwtest_params *wmi_fwtest)
+{
+	wmi_fwtest_set_param_cmd_fixed_param *cmd;
+	wmi_buf_t wmi_buf;
+	uint16_t len;
+
+	len = sizeof(*cmd);
+
+	wmi_buf = wmi_buf_alloc(wmi_handle, len);
+	if (!wmi_buf) {
+		WMI_LOGE("%s: wmai_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+		       wmi_fwtest_set_param_cmd_fixed_param));
+	cmd->param_id = wmi_fwtest->arg;
+	cmd->param_value = wmi_fwtest->value;
+
+	if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len,
+				 WMI_FWTEST_CMDID)) {
+		WMI_LOGP("%s: failed to send fw test command", __func__);
+		qdf_nbuf_free(wmi_buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * send_unit_test_cmd_tlv() - send unit test command to fw.
  * @wmi_handle: wmi handle
@@ -12095,6 +12137,7 @@ struct wmi_ops tlv_ops =  {
 	.extract_profile_data = extract_profile_data_tlv,
 	.extract_chan_info_event = extract_chan_info_event_tlv,
 	.extract_channel_hopping_event = extract_channel_hopping_event_tlv,
+	.send_fw_test_cmd = send_fw_test_cmd_tlv,
 };
 
 #ifdef WMI_TLV_AND_NON_TLV_SUPPORT