Browse Source

qcacmn: Add DBR htc endpoint and service

Changes to add and connect DBR endpoint service

CRs-Fixed: 3212766
Change-Id: I442925677c331e3ad650a7e7b4dc64dd058d6595
Shwetha G K 2 years ago
parent
commit
1705770b9f
3 changed files with 90 additions and 0 deletions
  1. 21 0
      wmi/inc/wmi_unified_api.h
  2. 3 0
      wmi/inc/wmi_unified_priv.h
  3. 66 0
      wmi/src/wmi_unified.c

+ 21 - 0
wmi/inc/wmi_unified_api.h

@@ -482,6 +482,27 @@ wmi_diag_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
 }
 #endif
 
+#if defined(WLAN_DIAG_AND_DBR_OVER_SEPARATE_CE)
+/**
+ * wmi_dbr_connect_pdev_htc_service()
+ * WMI DBR API to get connect to HTC service
+ * @wmi_handle: handle to WMI.
+ * @htc_handle: handle to HTC.
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAULT for failure
+ */
+QDF_STATUS
+wmi_dbr_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+				 HTC_HANDLE htc_handle);
+#else
+static inline QDF_STATUS
+wmi_dbr_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+				 HTC_HANDLE htc_handle)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /*
  * WMI API to verify the host has enough credits to suspend
  *  @param wmi_handle      : handle to WMI.

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -3220,6 +3220,9 @@ struct wmi_soc {
 #if defined(WLAN_FEATURE_WMI_DIAG_OVER_CE7) || \
 	defined(WLAN_DIAG_AND_DBR_OVER_SEPARATE_CE)
 	HTC_ENDPOINT_ID wmi_diag_endpoint_id;
+#endif
+#if defined(WLAN_DIAG_AND_DBR_OVER_SEPARATE_CE)
+	HTC_ENDPOINT_ID wmi_dbr_endpoint_id;
 #endif
 	uint32_t wmi_events[wmi_events_max];
 	/* WMI service bitmap received from target */

+ 66 - 0
wmi/src/wmi_unified.c

@@ -2656,6 +2656,34 @@ static void wmi_control_diag_rx(void *ctx, HTC_PACKET *htc_packet)
 }
 #endif
 
+#if defined(WLAN_DIAG_AND_DBR_OVER_SEPARATE_CE)
+/**
+ * wmi_control_dbr_rx() - process dbr fw events callbacks
+ * @ctx: handle to wmi
+ * @htc_packet: pointer to htc packet
+ *
+ * Return: none
+ */
+static void wmi_control_dbr_rx(void *ctx, HTC_PACKET *htc_packet)
+{
+	struct wmi_soc *soc = (struct wmi_soc *)ctx;
+	struct wmi_unified *wmi_handle;
+	wmi_buf_t evt_buf;
+
+	evt_buf = (wmi_buf_t)htc_packet->pPktContext;
+	wmi_handle = soc->wmi_pdev[0];
+
+	if (!wmi_handle) {
+		wmi_err("unable to get wmi_handle for dbr event endpoint id:%d",
+			htc_packet->Endpoint);
+		qdf_nbuf_free(evt_buf);
+		return;
+	}
+
+	wmi_process_control_rx(wmi_handle, evt_buf);
+}
+#endif
+
 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI
 QDF_STATUS wmi_unified_cmd_send_over_qmi(struct wmi_unified *wmi_handle,
 					 wmi_buf_t buf, uint32_t buflen,
@@ -3601,6 +3629,44 @@ QDF_STATUS wmi_diag_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
 }
 #endif
 
+#if defined(WLAN_DIAG_AND_DBR_OVER_SEPARATE_CE)
+QDF_STATUS wmi_dbr_connect_pdev_htc_service(struct wmi_unified *wmi_handle,
+					    HTC_HANDLE htc_handle)
+{
+	QDF_STATUS status;
+	struct htc_service_connect_resp response = {0};
+	struct htc_service_connect_req connect = {0};
+
+	/* meta data is unused for now */
+	connect.pMetaData = NULL;
+	connect.MetaDataLength = 0;
+	connect.EpCallbacks.pContext = wmi_handle->soc;
+	connect.EpCallbacks.EpTxCompleteMultiple = NULL;
+	connect.EpCallbacks.EpRecv = wmi_control_dbr_rx /* wmi dbr rx */;
+	connect.EpCallbacks.EpRecvRefill = NULL;
+	connect.EpCallbacks.EpSendFull = NULL;
+	connect.EpCallbacks.EpTxComplete = NULL;
+	connect.EpCallbacks.ep_log_pkt = wmi_htc_log_pkt;
+
+	/* connect to wmi dbr service */
+	connect.service_id = WMI_CONTROL_DBR_SVC;
+	status = htc_connect_service(htc_handle, &connect, &response);
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		wmi_err("Failed to connect to WMI DBR service status:%d",
+			status);
+		return status;
+	}
+
+	if (wmi_handle->soc->is_async_ep)
+		htc_set_async_ep(htc_handle, response.Endpoint, true);
+
+	wmi_handle->soc->wmi_dbr_endpoint_id = response.Endpoint;
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * wmi_get_host_credits() -  WMI API to get updated host_credits
  *