wlan: New feature, Set TX Power with SAP mode.
Current SET_TX_MAX_POWER command will limit TX power.
Set TX power is new requirement from customer
Change-Id: If40f45d3cfca46df8313d1d6213b04002e80165f
CRs-fixed: 451750
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
index 7dd86ae..6ed59f0 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -2943,6 +2943,18 @@
}WDI_SetMaxTxPowerInfoType;
/*---------------------------------------------------------------------------
+ WDI_SetTxPowerInfoType
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+ wpt_uint8 bssIdx;
+ /* In request power == MaxTxpower to be used.*/
+ wpt_uint8 ucPower;
+
+}WDI_SetTxPowerInfoType;
+
+/*---------------------------------------------------------------------------
WDI_SetMaxTxPowerParamsType
---------------------------------------------------------------------------*/
typedef struct
@@ -2960,6 +2972,23 @@
void* pUserData;
}WDI_SetMaxTxPowerParamsType;
+/*---------------------------------------------------------------------------
+ WDI_SetTxPowerParamsType
+---------------------------------------------------------------------------*/
+typedef struct
+{
+ /*Link Info*/
+ WDI_SetTxPowerInfoType wdiTxPowerInfo;
+
+ /*Request status callback offered by UMAC - it is called if the current
+ req has returned PENDING as status; it delivers the status of sending
+ the message over the BUS */
+ WDI_ReqStatusCb wdiReqStatusCB;
+
+ /*The user data passed in by UMAC, it will be sent back when the above
+ function pointer will be called */
+ void* pUserData;
+}WDI_SetTxPowerParamsType;
/*---------------------------------------------------------------------------
WDI_SetMaxTxPowerRspMsg
@@ -2975,6 +3004,20 @@
}WDI_SetMaxTxPowerRspMsg;
+/*---------------------------------------------------------------------------
+ WDI_SetTxPowerRspMsg
+---------------------------------------------------------------------------*/
+
+typedef struct
+{
+ /* In response, power==tx power used for management frames*/
+ wpt_int8 ucPower;
+
+ /*Result of the operation*/
+ WDI_Status wdiStatus;
+
+}WDI_SetTxPowerRspMsg;
+
typedef struct
{
wpt_uint8 ucOpp_ps;
@@ -5495,6 +5538,26 @@
void* pUserData);
/*---------------------------------------------------------------------------
+ WDA_SetTxPowerRspCb
+
+ DESCRIPTION
+
+ This callback is invoked by DAL when it has received a set max Tx Power response from
+ the underlying device.
+
+ PARAMETERS
+
+ IN
+ wdiStatus: response status received from HAL
+ pUserData: user data
+
+ RETURN VALUE
+ The result code associated with performing the operation
+---------------------------------------------------------------------------*/
+typedef void (*WDA_SetTxPowerRspCb)(WDI_SetTxPowerRspMsg *wdiSetTxPowerRsp,
+ void* pUserData);
+
+/*---------------------------------------------------------------------------
WDI_UpdateProbeRspTemplateRspCb
DESCRIPTION
@@ -7170,6 +7233,32 @@
void* pUserData
);
+
+/**
+ @brief WDI_SetTxPowerReq will be called when the upper
+ MAC wants to set Tx Power to HW.
+ In state BUSY this request will be queued. Request won't
+ be allowed in any other state.
+
+
+ @param pwdiSetTxPowerParams: set TS Power parameters
+ BSSID and target TX Power with dbm included
+
+ wdiReqStatusCb: callback for passing back the response
+
+ pUserData: user data will be passed back with the
+ callback
+
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetTxPowerReq
+(
+ WDI_SetTxPowerParamsType* pwdiSetTxPowerParams,
+ WDA_SetTxPowerRspCb wdiReqStatusCb,
+ void* pUserData
+);
+
/**
@brief WDI_SetMaxTxPowerReq will be called when the upper
MAC wants to set Max Tx Power to HW. Upon the
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
index bcbf933..ea68ff5 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -442,6 +442,9 @@
/*WLAN DAL Get Roam Rssi Request*/
WDI_GET_ROAM_RSSI_REQ = 81,
+ /*WLAN DAL Set Tx Power Request*/
+ WDI_SET_TX_POWER_REQ = 82,
+
WDI_MAX_REQ,
/*Send a suspend Indication down to HAL*/
@@ -703,6 +706,8 @@
/* WLAN DAL Get Roam Rssi Response*/
WDI_GET_ROAM_RSSI_RESP = 80,
+ WDI_SET_TX_POWER_RESP = 81,
+
/*-------------------------------------------------------------------------
Indications
!! Keep these last in the enum if possible
@@ -2176,6 +2181,22 @@
);
/**
+ @brief Process Set Tx Power Request function (called when Main
+ FSM allows it)
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_ProcessSetTxPowerReq
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+);
+
+/**
@brief Process P2P Notice Of Absence Request function (called when Main FSM
allows it)
@@ -3342,6 +3363,23 @@
WDI_EventInfoType* pEventData
);
+ /**
+ @brief Process Set Tx Power Rsp function (called when a response
+ is being received over the bus from HAL)
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPowerRsp
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+);
+
/**
@brief Process Nv download(called when a response
is being received over the bus from HAL)
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index b6fd364..b25953a 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -343,14 +343,15 @@
#else
NULL,
#endif
- /*-------------------------------------------------------------------------
- Indications
- -------------------------------------------------------------------------*/
#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
WDI_ProcessGetRoamRssiReq, /* WDI_GET_ROAM_RSSI_REQ */
#else
- NULL,
+ NULL,
#endif
+ WDI_ProcessSetTxPowerReq, /* WDI_SET_TX_POWER_REQ*/
+ /*-------------------------------------------------------------------------
+ Indications
+ -------------------------------------------------------------------------*/
WDI_ProcessHostSuspendInd, /* WDI_HOST_SUSPEND_IND*/
WDI_ProcessTrafficStatsInd, /* WDI_TRAFFIC_STATS_IND*/
};
@@ -512,12 +513,15 @@
WDI_ProcessFeatureCapsExchangeRsp, /* WDI_FEATURE_CAPS_EXCHANGE_RESP */
#ifdef WLAN_FEATURE_11AC
WDI_ProcessUpdateVHTOpModeRsp, /* WDI_UPDATE_VHT_OP_MODE_RESP */
+#else
+ NULL,
#endif
#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
WDI_ProcessGetRoamRssiRsp, /* WDI_GET_ROAM_RSSI_RESP */
#else
NULL,
#endif
+ WDI_ProcessSetTxPowerRsp, /* WDI_SET_TX_POWER_RESP */
/*---------------------------------------------------------------------
Indications
@@ -2696,6 +2700,57 @@
return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
}
+/**
+ @brief WDI_SetTxPowerReq will be called when the upper
+ MAC wants to set Tx Power to HW.
+ In state BUSY this request will be queued. Request won't
+ be allowed in any other state.
+
+
+ @param pwdiSetTxPowerParams: set TS Power parameters
+ BSSID and target TX Power with dbm included
+
+ wdiReqStatusCb: callback for passing back the response
+
+ pUserData: user data will be passed back with the
+ callback
+
+ @return Result of the function call
+*/
+WDI_Status
+WDI_SetTxPowerReq
+(
+ WDI_SetTxPowerParamsType* pwdiSetTxPowerParams,
+ WDA_SetTxPowerRspCb wdiReqStatusCb,
+ void* pUserData
+)
+{
+ WDI_EventInfoType wdiEventData;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*------------------------------------------------------------------------
+ Sanity Check
+ ------------------------------------------------------------------------*/
+ if ( eWLAN_PAL_FALSE == gWDIInitialized )
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API call before module is initialized - Fail request");
+
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ /*------------------------------------------------------------------------
+ Fill in Event data and post to the Main FSM
+ ------------------------------------------------------------------------*/
+ wdiEventData.wdiRequest = WDI_SET_TX_POWER_REQ;
+ wdiEventData.pEventData = pwdiSetTxPowerParams;
+ wdiEventData.uEventDataSize = sizeof(*pwdiSetTxPowerParams);
+ wdiEventData.pCBfnc = wdiReqStatusCb;
+ wdiEventData.pUserData = pUserData;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
#ifdef FEATURE_WLAN_CCX
WDI_Status
WDI_TSMStatsReq
@@ -11840,6 +11895,80 @@
}
+/**
+ @brief Process Set Tx Power Request function (called when Main
+ FSM allows it)
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status WDI_ProcessSetTxPowerReq
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ WDI_SetTxPowerParamsType* pwdiSetTxPowerParams = NULL;
+ WDA_SetTxPowerRspCb wdiSetTxPowerRspCb;
+ wpt_uint8* pSendBuffer = NULL;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+ tSetTxPwrReqMsg *halSetTxPower = NULL;;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*-------------------------------------------------------------------------
+ Sanity check
+ -------------------------------------------------------------------------*/
+ if (( NULL == pEventData ) ||
+ ( NULL == pEventData->pEventData ) ||
+ ( NULL == pEventData->pCBfnc ))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ pwdiSetTxPowerParams =
+ (WDI_SetTxPowerParamsType*)pEventData->pEventData;
+ wdiSetTxPowerRspCb =
+ (WDA_SetTxPowerRspCb)pEventData->pCBfnc;
+
+ /*-----------------------------------------------------------------------
+ Get message buffer
+ -----------------------------------------------------------------------*/
+ if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TX_POWER_REQ,
+ sizeof(tSetTxPwrReqParams),
+ &pSendBuffer, &usDataOffset, &usSendSize))||
+ ( usSendSize < (usDataOffset + sizeof(tSetTxPwrReqParams)
+ )))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "Unable to get Set Max Tx Power req %x %x %x",
+ pEventData, pwdiSetTxPowerParams, wdiSetTxPowerRspCb);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ halSetTxPower = (tSetTxPwrReqMsg *)(pSendBuffer+usDataOffset);
+ halSetTxPower->setTxPwrReqParams.txPower =
+ pwdiSetTxPowerParams->wdiTxPowerInfo.ucPower;
+ halSetTxPower->setTxPwrReqParams.bssIdx =
+ pwdiSetTxPowerParams->wdiTxPowerInfo.bssIdx;
+
+ pWDICtx->wdiReqStatusCB = pwdiSetTxPowerParams->wdiReqStatusCB;
+ pWDICtx->pReqStatusUserData = pwdiSetTxPowerParams->pUserData;
+
+ /*-------------------------------------------------------------------------
+ Send Set Tx Power Request to HAL
+ -------------------------------------------------------------------------*/
+ return WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+ wdiSetTxPowerRspCb, pEventData->pUserData,
+ WDI_SET_TX_POWER_RESP);
+}
/**
@brief Process P2P Notice Of Absence Request function (called when Main FSM
@@ -17128,6 +17257,66 @@
return WDI_STATUS_SUCCESS;
}
+ /**
+ @brief Process Set Tx Power Rsp function (called when a response
+ is being received over the bus from HAL)
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetTxPowerRsp
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ tSetTxPwrRspMsg halTxpowerrsp;
+ WDI_SetTxPowerRspMsg wdiSetTxPowerRspMsg;
+ WDA_SetTxPowerRspCb wdiReqStatusCb;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*-------------------------------------------------------------------------
+ Sanity check
+ -------------------------------------------------------------------------*/
+ if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+ ( NULL == 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;
+ }
+
+ wdiReqStatusCb = (WDA_SetTxPowerRspCb)pWDICtx->pfncRspCB;
+
+ /*-------------------------------------------------------------------------
+ Extract response and send it to UMAC
+ -------------------------------------------------------------------------*/
+ wpalMemoryCopy(&halTxpowerrsp.setTxPwrRspParams,
+ pEventData->pEventData,
+ sizeof(halTxpowerrsp.setTxPwrRspParams));
+
+ if (eHAL_STATUS_SUCCESS != halTxpowerrsp.setTxPwrRspParams.status)
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "Error status returned in Set Tx Power Response ");
+ WDI_DetectedDeviceError(pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ wdiSetTxPowerRspMsg.wdiStatus =
+ WDI_HAL_2_WDI_STATUS(halTxpowerrsp.setTxPwrRspParams.status);
+
+ /*Notify UMAC*/
+ wdiReqStatusCb(&wdiSetTxPowerRspMsg, pWDICtx->pRspCBUserData);
+
+ return WDI_STATUS_SUCCESS;
+}
+
/**
@brief Process P2P Group Owner Notice Of Absense Rsp function (called
when a response is being received over the bus from HAL)
@@ -21326,6 +21515,8 @@
return WLAN_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ;
case WDI_SET_MAX_TX_POWER_REQ:
return WLAN_HAL_SET_MAX_TX_POWER_REQ;
+ case WDI_SET_TX_POWER_REQ:
+ return WLAN_HAL_SET_TX_POWER_REQ;
case WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ:
return WLAN_HAL_SET_P2P_GONOA_REQ;
case WDI_ENTER_IMPS_REQ:
@@ -21546,6 +21737,8 @@
return WDI_HAL_TX_PER_HIT_IND;
case WLAN_HAL_SET_MAX_TX_POWER_RSP:
return WDI_SET_MAX_TX_POWER_RESP;
+ case WLAN_HAL_SET_TX_POWER_RSP:
+ return WDI_SET_TX_POWER_RESP;
case WLAN_HAL_SET_P2P_GONOA_RSP:
return WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP;
case WLAN_HAL_ENTER_IMPS_RSP: