Merge "wlan: WDA and WDI changes to support SW PTA"
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 6e17cfe..314fbf7 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -16795,6 +16795,110 @@
}
#endif /* MDNS_OFFLOAD */
+#ifdef FEATURE_WLAN_SW_PTA
+/**
+ * WDA_sw_pta_resp_cb() - WDA callback api to get sw pta resp status
+ * @status: SW PTA response status
+ * @user_data: user data
+ *
+ * Retrun: None
+ */
+static void WDA_sw_pta_resp_cb(uint8_t status, void *user_data)
+{
+ tWDA_ReqParams *wda_params = (tWDA_ReqParams *)user_data;
+ vos_msg_t msg;
+
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ "<------ %s", __func__);
+
+ if (!wda_params) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ "%s: wda_params received NULL", __func__);
+ VOS_ASSERT(0);
+ return;
+ }
+
+ if (!wda_params->wdaMsgParam) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ "%s: wda_params->wdaMsgParam is NULL", __func__);
+ VOS_ASSERT(0);
+ vos_mem_free(wda_params->wdaWdiApiMsgParam);
+ vos_mem_free(wda_params);
+ return;
+ }
+
+ /* VOS message wrapper */
+ msg.type = eWNI_SME_SW_PTA_RESP;
+ msg.bodyptr = NULL;
+ msg.bodyval = status;
+
+ if (vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t *)&msg) !=
+ VOS_STATUS_SUCCESS) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ "%s: Failed to post message to SME", __func__);
+ }
+
+ vos_mem_free(wda_params->wdaWdiApiMsgParam);
+ vos_mem_free(wda_params->wdaMsgParam);
+ vos_mem_free(wda_params);
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ "EXIT <------ %s ", __func__);
+}
+
+/* WDA_process_sw_pta_req - Process sw pta request
+ * @wda: wda handle
+ * @sw_pta_req: sw pta coex params request
+ *
+ * Return: VOS_STATUS
+ */
+static VOS_STATUS
+WDA_process_sw_pta_req(tWDA_CbContext *wda,
+ struct sir_sw_pta_req *sw_pta_req)
+{
+ struct wdi_sw_pta_req *wdi_sw_pta_req;
+ tWDA_ReqParams *wda_params;
+ WDI_Status wdi_status;
+
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, FL("Enter"));
+
+ wdi_sw_pta_req = (struct wdi_sw_pta_req *)
+ vos_mem_malloc(sizeof(tWDA_ReqParams));
+ if (!wdi_sw_pta_req) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ "%s: VOS MEM Alloc Failure", __func__);
+ vos_mem_free(sw_pta_req);
+ return VOS_STATUS_E_NOMEM;
+ }
+
+ wda_params = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
+ if (!wda_params) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ "%s: VOS MEM Alloc Failure", __func__);
+ vos_mem_free(wdi_sw_pta_req);
+ vos_mem_free(sw_pta_req);
+ }
+
+ memcpy(wdi_sw_pta_req, sw_pta_req, sizeof(*sw_pta_req));
+
+ /* Store Params pass it to WDI */
+ wda_params->wdaWdiApiMsgParam = (void *)wdi_sw_pta_req;
+ wda_params->pWdaContext = wda;
+ /* Store param pointer as passed in by caller */
+ wda_params->wdaMsgParam = sw_pta_req;
+
+ wdi_status = WDI_sw_pta_req(WDA_sw_pta_resp_cb, wdi_sw_pta_req,
+ wda_params);
+ if (IS_WDI_STATUS_FAILURE(wdi_status)) {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ FL("Error in WDA sw pta request"));
+ vos_mem_free(wdi_sw_pta_req);
+ vos_mem_free(sw_pta_req);
+ }
+
+ return CONVERT_WDI2VOS_STATUS(wdi_status);
+}
+#endif
+
/*
* FUNCTION: WDA_McProcessMsg
* Trigger DAL-AL to start CFG download
@@ -17870,6 +17974,13 @@
WDA_ProcessGetARPStatsReq(pWDA, (getArpStatsParams *)pMsg->bodyptr);
break;
}
+#ifdef FEATURE_WLAN_SW_PTA
+ case WDA_SW_PTA_REQ:
+ {
+ WDA_process_sw_pta_req(pWDA, (struct sir_sw_pta_req *)pMsg->bodyptr);
+ break;
+ }
+#endif
default:
{
VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
index 1af5b15..d635888 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -6680,6 +6680,34 @@
wpt_uint32 tsf_hi;
} wdi_cap_tsf_rsp_t;
+#ifdef FEATURE_WLAN_SW_PTA
+/**
+ * enum wdi_sw_pta_param_type - Type of sw pta coex param
+ * @WDI_SCO_STATUS: Enable/Disable SCO
+ * @WDI_NUD_STATUS: Enable/Disable NUD
+ * @WDI_BT_STATUS: Enable/Disable BT
+ */
+/* Copied from sirApi.h to avoid compile error */
+enum wdi_sw_pta_param_type {
+ WDI_SCO_STATUS,
+ WDI_NUD_STATUS,
+ WDI_BT_STATUS,
+};
+
+#define WDI_SW_PTA_COEX_PARAMS_MAX_LEN 32
+/**
+ * wdi_sw_pta_req - SW PTA coex params request
+ * @param_type: sw pta coex param type
+ * @length: sw pta coex params value length
+ * @value: sw pta coex params value
+ */
+struct wdi_sw_pta_req {
+ enum wdi_sw_pta_param_type param_type;
+ uint8_t length;
+ uint8_t value[WDI_SW_PTA_COEX_PARAMS_MAX_LEN];
+};
+#endif
+
/*----------------------------------------------------------------------------
* WDI callback types
*--------------------------------------------------------------------------*/
@@ -12563,5 +12591,21 @@
wdi_tsf_rsp_cb wdi_tsf_rsp_callback,
void *user_data);
+#ifdef FEATURE_WLAN_SW_PTA
+typedef void (*WDI_sw_pta_resp_cb)(uint8_t status, void *user_data);
+/**
+ * @WDI_sw_pta_req - SW PTA request
+ *
+ * @wdi_sw_pta_resp_cb: WDI sw pta response callback
+ * @wdi_sw_pta_req: sw pta request params
+ * @user_data: user data
+ *
+ * @Return: WDI_Status
+ */
+WDI_Status
+WDI_sw_pta_req(WDI_sw_pta_resp_cb wdi_sw_pta_resp_cb,
+ struct wdi_sw_pta_req *wdi_sw_pta_req,
+ void *user_data);
+#endif /* FEATURE_WLAN_SW_PTA */
#endif /* #ifndef WLAN_QCT_WDI_H */
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
index 17c0dbd..50aae4d 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -508,6 +508,12 @@
/* BLACKLIST Request */
WDI_BLACKLIST_REQ = 127,
WDI_SET_LOW_POWER_REQ = 128,
+
+#ifdef FEATURE_WLAN_SW_PTA
+ /* SW PTA coex params request */
+ WDI_SW_PTA_COEX_PARAMS_REQ = 129,
+#endif
+
WDI_MAX_REQ,
/*Send a suspend Indication down to HAL*/
@@ -901,6 +907,10 @@
WDI_BLACKLIST_RSP = 126,
WDI_SET_LOW_POWER_RSP = 127,
+#ifdef FEATURE_WLAN_SW_PTA
+ /* SW PTA coex params response */
+ WDI_SW_PTA_COEX_PARAMS_RSP = 128,
+#endif
/*-------------------------------------------------------------------------
Indications
!! Keep these last in the enum if possible
@@ -6931,5 +6941,31 @@
WDI_EventInfoType* pEventData
);
+#ifdef FEATURE_WLAN_SW_PTA
+/**
+ * WDI_process_sw_pta_req() - process sw pta coex params request
+ *
+ * @pWDICtx: pointer to the WLAN DAL context
+ * @pEventData: pointer to the event information structure
+ *
+ * @return Result of the function call
+ */
+WDI_Status
+WDI_process_sw_pta_req(WDI_ControlBlockType *pWDICtx,
+ WDI_EventInfoType *pEventData);
+
+/**
+ * WDI_process_sw_pta_resp() - process sw pta coex params response
+ *
+ * @pWDICtx: pointer to the WLAN DAL context
+ * @pEventData: pointer to the event information structure
+ *
+ * @return Result of the function call
+ */
+WDI_Status
+WDI_process_sw_pta_resp(WDI_ControlBlockType *pWDICtx,
+ WDI_EventInfoType *pEventData);
+#endif /* FEATURE_WLAN_SW_PTA */
+
#endif /*WLAN_QCT_WDI_I_H*/
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index 275f55a..327f9fc 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -551,6 +551,10 @@
WDI_ProcessBlackListReq, /* WDI_BLACKLIST_REQ*/
WDI_process_low_power_request, /* WDI_SET_LOW_POWER_REQ */
+#ifdef FEATURE_WLAN_SW_PTA
+ WDI_process_sw_pta_req, /* WDI_SW_PTA_COEX_PARAMS_REQ */
+#endif
+
/*-------------------------------------------------------------------------
Indications
-------------------------------------------------------------------------*/
@@ -906,7 +910,12 @@
WDI_ProcessGetArpStatsResp, /* WDI_FW_GET_ARP_STATS_RSP */
WDI_low_power_rsp_callback, /* WDI_SET_LOW_POWER_RSP */
- WDI_ProcessBlackListResp, /* WDI_BLACKLIST_RSP */
+ WDI_ProcessBlackListResp, /* WDI_BLACKLIST_RSP */
+
+#ifdef FEATURE_WLAN_SW_PTA
+ WDI_process_sw_pta_resp, /* WDI_SW_PTA_COEX_PARAMS_RESP */
+#endif
+
/*---------------------------------------------------------------------
Indications
---------------------------------------------------------------------*/
@@ -1386,6 +1395,9 @@
#endif
CASE_RETURN_STRING( WDI_FW_ARP_STATS_REQ );
CASE_RETURN_STRING( WDI_FW_GET_ARP_STATS_REQ );
+#ifdef FEATURE_WLAN_SW_PTA
+ CASE_RETURN_STRING(WDI_SW_PTA_COEX_PARAMS_REQ);
+#endif
default:
return "Unknown WDI MessageId";
@@ -1817,6 +1829,9 @@
CASE_RETURN_STRING (WDI_CAPTURE_GET_TSF_TSTAMP_RSP);
CASE_RETURN_STRING (WDI_BLACKLIST_RSP);
CASE_RETURN_STRING (WDI_SET_LOW_POWER_RSP);
+#ifdef FEATURE_WLAN_SW_PTA
+ CASE_RETURN_STRING(WDI_SW_PTA_COEX_PARAMS_RSP);
+#endif
default:
return "Unknown WDI MessageId";
}
@@ -25544,6 +25559,10 @@
return WLAN_HAL_FW_SET_CLEAR_ARP_STATS_REQ;
case WDI_FW_GET_ARP_STATS_REQ:
return WLAN_HAL_FW_GET_ARP_STATS_REQ;
+#ifdef FEATURE_WLAN_SW_PTA
+ case WDI_SW_PTA_COEX_PARAMS_REQ:
+ return WLAN_HAL_HOST_SW_PTA_COEX_PARAMS_REQ;
+#endif
default:
return WLAN_HAL_MSG_MAX;
}
@@ -25935,6 +25954,10 @@
return WDI_FW_GET_ARP_STATS_RSP;
case WLAN_HAL_POWER_CONTROL_MODE_CHANGE_RSP:
return WDI_SET_LOW_POWER_RSP;
+#ifdef FEATURE_WLAN_SW_PTA
+ case WLAN_HAL_HOST_SW_PTA_COEX_PARAMS_RSP:
+ return WDI_SW_PTA_COEX_PARAMS_RSP;
+#endif
default:
return eDRIVER_TYPE_MAX;
}
@@ -40092,4 +40115,107 @@
return WDI_STATUS_SUCCESS;
}
+
+#ifdef FEATURE_WLAN_SW_PTA
+WDI_Status
+WDI_sw_pta_req(WDI_sw_pta_resp_cb wdi_sw_pta_resp_cb,
+ struct wdi_sw_pta_req *wdi_sw_pta_req,
+ void *user_data)
+{
+ WDI_EventInfoType wdiEventData;
+
+ if (gWDIInitialized == eWLAN_PAL_FALSE) {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API called before module is initialized");
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "%s", __func__);
+
+ wdiEventData.wdiRequest = WDI_SW_PTA_COEX_PARAMS_REQ;
+ wdiEventData.pEventData = (void *)wdi_sw_pta_req;
+ wdiEventData.uEventDataSize = sizeof(*wdi_sw_pta_req);
+ wdiEventData.pUserData = user_data;
+ wdiEventData.pCBfnc = wdi_sw_pta_resp_cb;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+WDI_Status
+WDI_process_sw_pta_req(WDI_ControlBlockType *pWDICtx,
+ WDI_EventInfoType *pEventData)
+{
+ struct wdi_sw_pta_req *wdi_sw_pta_req;
+ wpt_uint8 *pSendBuffer = NULL;
+ tpHalSwPTAReq hal_sw_pta_req;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+ "WDI_process_sw_pta_req");
+
+ if (!pEventData) {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ if (WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(pWDICtx,
+ WDI_SW_PTA_COEX_PARAMS_REQ, sizeof(*hal_sw_pta_req),
+ &pSendBuffer, &usDataOffset, &usSendSize) ||
+ (usSendSize < (usDataOffset + sizeof(*hal_sw_pta_req)))) {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "Unable to get buffer in sw pta request %pK",
+ pEventData);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ wdi_sw_pta_req = (struct wdi_sw_pta_req *)pEventData->pEventData;
+
+ hal_sw_pta_req = (tpHalSwPTAReq) (pSendBuffer + usDataOffset);;
+ hal_sw_pta_req->param_type = wdi_sw_pta_req->param_type;
+ hal_sw_pta_req->length = wdi_sw_pta_req->length;
+ memcpy(hal_sw_pta_req->value, wdi_sw_pta_req->value,
+ wdi_sw_pta_req->length);
+
+ return WDI_SendMsg(pWDICtx, pSendBuffer, usSendSize,
+ pEventData->pCBfnc, pEventData->pUserData,
+ WDI_SW_PTA_COEX_PARAMS_RSP);
+}
+
+WDI_Status
+WDI_process_sw_pta_resp(WDI_ControlBlockType *wdi_ctx,
+ WDI_EventInfoType *pEventData)
+{
+ WDI_sw_pta_resp_cb wdi_sw_pta_resp_cb;
+ uint8_t sw_pta_status;
+
+ if ((!wdi_ctx) || (!pEventData) ||
+ !pEventData->pEventData) {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ sw_pta_status = *((uint8_t *)pEventData->pEventData);
+
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ "%s : Received SW PTA coex params response, status : %d",
+ __func__, sw_pta_status);
+
+ wdi_sw_pta_resp_cb = (WDI_sw_pta_resp_cb)wdi_ctx->pfncRspCB;
+ if (wdi_sw_pta_resp_cb) {
+ wdi_sw_pta_resp_cb(sw_pta_status, wdi_ctx->pRspCBUserData);
+ } else {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ "%s : wdi_sw_pta_resp_cb is NULL", __func__);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ return WDI_STATUS_SUCCESS;
+}
+#endif /* FEATURE_WLAN_SW_PTA */
#endif
diff --git a/riva/inc/wlan_hal_msg.h b/riva/inc/wlan_hal_msg.h
index fef1636..8e038fb 100644
--- a/riva/inc/wlan_hal_msg.h
+++ b/riva/inc/wlan_hal_msg.h
@@ -635,6 +635,8 @@
WLAN_HAL_QPOWER_ENABLE_BY_HOST_IND = 361,
WLAN_HAL_BLACK_LIST_SSID_REQ = 362,
WLAN_HAL_BLACK_LIST_SSID_RSP = 363,
+ WLAN_HAL_HOST_SW_PTA_COEX_PARAMS_REQ = 364,
+ WLAN_HAL_HOST_SW_PTA_COEX_PARAMS_RSP = 365,
WLAN_HAL_MSG_MAX = WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE
}tHalHostMsgType;
@@ -9771,4 +9773,32 @@
#else
#endif
+#ifdef FEATURE_WLAN_SW_PTA
+/**
+ * enum hal_sw_pta_param_type - Type of sw pta coex param
+ * @WDI_SCO_STATUS: Enable/Disable SCO
+ * @WDI_NUD_STATUS: Enable/Disable NUD
+ * @WDI_BT_STATUS: Enable/Disable BT
+ */
+/* Copied from sirApi.h to avoid compile error */
+enum hal_sw_pta_param_type {
+ HAL_SW_PTA_SCO_STATUS = 0,
+ HAL_SW_PTA_NUD_STATUS = 1,
+ HAL_SW_PTA_BT_STATUS = 2,
+ HAL_SW_PTA_MAX = WLAN_HAL_MAX_ENUM_SIZE
+};
+
+#define HAL_SW_PTA_COEX_PARAMS_MAX_LEN 32
+/**
+ * hal_sw_pta_req - SW PTA coex params request
+ * @param_type: sw pta coex param type
+ * @length: sw pta coex params value length
+ * @value: sw pta coex params value
+ */
+typedef PACKED_PRE struct PACKED_POST {
+ enum hal_sw_pta_param_type param_type;
+ uint8_t length;
+ uint8_t value[HAL_SW_PTA_COEX_PARAMS_MAX_LEN];
+} tHalSwPTAReq, *tpHalSwPTAReq;
+#endif
#endif /* _WLAN_HAL_MSG_H_ */