mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2024-11-22 21:34:37 +00:00
Implemented txpower control
This commit is contained in:
parent
8e0a042805
commit
fa35b99b42
2
Makefile
2
Makefile
@ -183,7 +183,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_RTL8812A)_$(CONFIG_RTL8821A)_$(CONFIG_RTL8814A), y_y_y)
|
ifeq ($(CONFIG_RTL8812A)_$(CONFIG_RTL8821A)_$(CONFIG_RTL8814A), y_y_y)
|
||||||
|
|
||||||
EXTRA_CFLAGS += -DDRV_NAME=\"rtl88XXau\"
|
EXTRA_CFLAGS += -DDRV_NAME=\"88XXau\"
|
||||||
ifeq ($(CONFIG_USB_HCI), y)
|
ifeq ($(CONFIG_USB_HCI), y)
|
||||||
USER_MODULE_NAME = 88XXau
|
USER_MODULE_NAME = 88XXau
|
||||||
endif
|
endif
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
* Global var
|
* Global var
|
||||||
* ************************************************************ */
|
* ************************************************************ */
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
dm_CheckProtection(
|
dm_CheckProtection(
|
||||||
IN PADAPTER Adapter
|
IN PADAPTER Adapter
|
||||||
@ -141,7 +140,6 @@ dm_InterruptMigration(
|
|||||||
BOOLEAN IntMtToSet = _FALSE;
|
BOOLEAN IntMtToSet = _FALSE;
|
||||||
BOOLEAN ACIntToSet = _FALSE;
|
BOOLEAN ACIntToSet = _FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* Retrieve current interrupt migration and Tx four ACs IMR settings first. */
|
/* Retrieve current interrupt migration and Tx four ACs IMR settings first. */
|
||||||
bCurrentIntMt = pHalData->bInterruptMigration;
|
bCurrentIntMt = pHalData->bInterruptMigration;
|
||||||
bCurrentACIntDisable = pHalData->bDisableTxInt;
|
bCurrentACIntDisable = pHalData->bDisableTxInt;
|
||||||
@ -262,7 +260,6 @@ rtl8812_InitHalDm(
|
|||||||
/* Adapter->fix_rate = 0xFF; */
|
/* Adapter->fix_rate = 0xFF; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
rtl8812_HalDmWatchDog(
|
rtl8812_HalDmWatchDog(
|
||||||
IN PADAPTER Adapter
|
IN PADAPTER Adapter
|
||||||
@ -350,6 +347,8 @@ void rtl8812_init_dm_priv(IN PADAPTER Adapter)
|
|||||||
|
|
||||||
Init_ODM_ComInfo_8812(Adapter);
|
Init_ODM_ComInfo_8812(Adapter);
|
||||||
odm_init_all_timers(podmpriv);
|
odm_init_all_timers(podmpriv);
|
||||||
|
|
||||||
|
pHalData->CurrentTxPwrIdx = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtl8812_deinit_dm_priv(IN PADAPTER Adapter)
|
void rtl8812_deinit_dm_priv(IN PADAPTER Adapter)
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
// Global var
|
// Global var
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
dm_CheckProtection(
|
dm_CheckProtection(
|
||||||
IN PADAPTER Adapter
|
IN PADAPTER Adapter
|
||||||
@ -51,13 +50,10 @@ dm_CheckProtection(
|
|||||||
else
|
else
|
||||||
RateThreshold = MGN_MCS3;
|
RateThreshold = MGN_MCS3;
|
||||||
|
|
||||||
if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold)
|
if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold) {
|
||||||
{
|
|
||||||
pMgntInfo->bDmDisableProtect = TRUE;
|
pMgntInfo->bDmDisableProtect = TRUE;
|
||||||
DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pMgntInfo->bDmDisableProtect = FALSE;
|
pMgntInfo->bDmDisableProtect = FALSE;
|
||||||
DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
||||||
}
|
}
|
||||||
@ -74,14 +70,13 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
|
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
|
||||||
|
|
||||||
tmp1byte = rtw_read8(padapter, REG_GPIO_EXT_CTRL_8814A);
|
tmp1byte = rtw_read8(padapter, REG_GPIO_EXT_CTRL_8814A);
|
||||||
//DBG_871X("CheckPbcGPIO - %x\n", tmp1byte);
|
//DBG_871X("CheckPbcGPIO - %x\n", tmp1byte);
|
||||||
|
|
||||||
if (tmp1byte == 0xff)
|
if (tmp1byte == 0xff)
|
||||||
return ;
|
return ;
|
||||||
else if (tmp1byte & BIT3)
|
else if (tmp1byte & BIT3) {
|
||||||
{
|
|
||||||
// Here we only set bPbcPressed to TRUE. After trigger PBC, the variable will be set to FALSE
|
// Here we only set bPbcPressed to TRUE. After trigger PBC, the variable will be set to FALSE
|
||||||
DBG_871X("CheckPbcGPIO - PBC is pressed\n");
|
DBG_871X("CheckPbcGPIO - PBC is pressed\n");
|
||||||
bPbcPressed = _TRUE;
|
bPbcPressed = _TRUE;
|
||||||
@ -120,7 +115,6 @@ dm_InterruptMigration(
|
|||||||
BOOLEAN IntMtToSet = _FALSE;
|
BOOLEAN IntMtToSet = _FALSE;
|
||||||
BOOLEAN ACIntToSet = _FALSE;
|
BOOLEAN ACIntToSet = _FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* Retrieve current interrupt migration and Tx four ACs IMR settings first. */
|
/* Retrieve current interrupt migration and Tx four ACs IMR settings first. */
|
||||||
bCurrentIntMt = pHalData->bInterruptMigration;
|
bCurrentIntMt = pHalData->bInterruptMigration;
|
||||||
bCurrentACIntDisable = pHalData->bDisableTxInt;
|
bCurrentACIntDisable = pHalData->bDisableTxInt;
|
||||||
@ -215,7 +209,7 @@ static void Init_ODM_ComInfo_8814(PADAPTER Adapter)
|
|||||||
cut_ver = ODM_CUT_A;
|
cut_ver = ODM_CUT_A;
|
||||||
else if(IS_B_CUT(pHalData->version_id))
|
else if(IS_B_CUT(pHalData->version_id))
|
||||||
cut_ver = ODM_CUT_B;
|
cut_ver = ODM_CUT_B;
|
||||||
else if(IS_C_CUT(pHalData->version_id))
|
else if(IS_C_CUT(pHalData->version_id))
|
||||||
cut_ver = ODM_CUT_C;
|
cut_ver = ODM_CUT_C;
|
||||||
else if(IS_D_CUT(pHalData->version_id))
|
else if(IS_D_CUT(pHalData->version_id))
|
||||||
cut_ver = ODM_CUT_D;
|
cut_ver = ODM_CUT_D;
|
||||||
@ -224,14 +218,13 @@ static void Init_ODM_ComInfo_8814(PADAPTER Adapter)
|
|||||||
else
|
else
|
||||||
cut_ver = ODM_CUT_A;
|
cut_ver = ODM_CUT_A;
|
||||||
|
|
||||||
odm_cmn_info_init(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
|
odm_cmn_info_init(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
|
||||||
odm_cmn_info_init(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver);
|
odm_cmn_info_init(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver);
|
||||||
|
|
||||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType);
|
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType);
|
||||||
|
|
||||||
//odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKFWOFFLOAD, pHalData->RegIQKFWOffload);
|
//odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKFWOFFLOAD, pHalData->RegIQKFWOffload);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -253,7 +246,6 @@ rtl8814_InitHalDm(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
rtl8814_HalDmWatchDog(
|
rtl8814_HalDmWatchDog(
|
||||||
IN PADAPTER Adapter
|
IN PADAPTER Adapter
|
||||||
@ -342,7 +334,7 @@ void rtl8814_init_dm_priv(IN PADAPTER Adapter)
|
|||||||
odm_init_all_timers(podmpriv );
|
odm_init_all_timers(podmpriv );
|
||||||
//PHYDM_InitDebugSetting(podmpriv);
|
//PHYDM_InitDebugSetting(podmpriv);
|
||||||
|
|
||||||
pHalData->CurrentTxPwrIdx = 18;
|
pHalData->CurrentTxPwrIdx = 20;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,17 +354,16 @@ void rtl8814_deinit_dm_priv(IN PADAPTER Adapter)
|
|||||||
void AntDivCompare8814(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
void AntDivCompare8814(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
||||||
{
|
{
|
||||||
//PADAPTER Adapter = pDM_Odm->Adapter ;
|
//PADAPTER Adapter = pDM_Odm->Adapter ;
|
||||||
|
|
||||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||||
if(0 != pHalData->AntDivCfg )
|
if (0 != pHalData->AntDivCfg) {
|
||||||
{
|
|
||||||
//DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi),
|
//DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi),
|
||||||
// src->Rssi,query_rx_pwr_percentage(src->Rssi));
|
// src->Rssi,query_rx_pwr_percentage(src->Rssi));
|
||||||
//select optimum_antenna for before linked =>For antenna diversity
|
//select optimum_antenna for before linked =>For antenna diversity
|
||||||
if(dst->Rssi >= src->Rssi )//keep org parameter
|
if (dst->Rssi >= src->Rssi )//keep org parameter
|
||||||
{
|
{
|
||||||
src->Rssi = dst->Rssi;
|
src->Rssi = dst->Rssi;
|
||||||
src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
|
src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,26 +371,24 @@ void AntDivCompare8814(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
|||||||
// Add new function to reset the state of antenna diversity before link.
|
// Add new function to reset the state of antenna diversity before link.
|
||||||
u8 AntDivBeforeLink8814(PADAPTER Adapter )
|
u8 AntDivBeforeLink8814(PADAPTER Adapter )
|
||||||
{
|
{
|
||||||
|
|
||||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||||
struct dm_struct * pDM_Odm =&pHalData->odmpriv;
|
struct dm_struct * pDM_Odm =&pHalData->odmpriv;
|
||||||
SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
|
SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
|
||||||
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
|
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
|
||||||
|
|
||||||
// Condition that does not need to use antenna diversity.
|
// Condition that does not need to use antenna diversity.
|
||||||
if(pHalData->AntDivCfg==0)
|
if (pHalData->AntDivCfg==0) {
|
||||||
{
|
|
||||||
//DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n");
|
//DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n");
|
||||||
return _FALSE;
|
return _FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
|
||||||
{
|
|
||||||
return _FALSE;
|
return _FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(pDM_SWAT_Table->SWAS_NoLink_State == 0){
|
if (pDM_SWAT_Table->SWAS_NoLink_State == 0) {
|
||||||
//switch channel
|
//switch channel
|
||||||
pDM_SWAT_Table->SWAS_NoLink_State = 1;
|
pDM_SWAT_Table->SWAS_NoLink_State = 1;
|
||||||
pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT;
|
pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT;
|
||||||
@ -408,12 +397,10 @@ u8 AntDivBeforeLink8814(PADAPTER Adapter )
|
|||||||
rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE);
|
rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE);
|
||||||
//DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX");
|
//DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX");
|
||||||
return _TRUE;
|
return _TRUE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pDM_SWAT_Table->SWAS_NoLink_State = 0;
|
pDM_SWAT_Table->SWAS_NoLink_State = 0;
|
||||||
return _FALSE;
|
return _FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif //CONFIG_ANTENNA_DIVERSITY
|
#endif //CONFIG_ANTENNA_DIVERSITY
|
||||||
|
@ -493,7 +493,6 @@ typedef struct hal_com_data {
|
|||||||
u8 txpwr_limit_loaded:1;
|
u8 txpwr_limit_loaded:1;
|
||||||
u8 txpwr_limit_from_file:1;
|
u8 txpwr_limit_from_file:1;
|
||||||
u8 rf_power_tracking_type;
|
u8 rf_power_tracking_type;
|
||||||
|
|
||||||
u8 CurrentTxPwrIdx;
|
u8 CurrentTxPwrIdx;
|
||||||
|
|
||||||
/* Read/write are allow for following hardware information variables */
|
/* Read/write are allow for following hardware information variables */
|
||||||
|
@ -4142,6 +4142,27 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
|
|||||||
enum tx_power_setting type, int dbm)
|
enum tx_power_setting type, int dbm)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
|
int value;
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
|
value = mbm/100;
|
||||||
|
#else
|
||||||
|
value = dbm;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(value < 0)
|
||||||
|
value = 0;
|
||||||
|
if(value > 40)
|
||||||
|
value = 40;
|
||||||
|
|
||||||
|
if(type == NL80211_TX_POWER_FIXED) {
|
||||||
|
pHalData->CurrentTxPwrIdx = value;
|
||||||
|
rtw_hal_set_tx_power_level(padapter, pHalData->current_channel);
|
||||||
|
} else
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
|
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
|
||||||
int ret;
|
int ret;
|
||||||
@ -4178,9 +4199,12 @@ static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
|||||||
#endif
|
#endif
|
||||||
int *dbm)
|
int *dbm)
|
||||||
{
|
{
|
||||||
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
|
|
||||||
RTW_INFO("%s\n", __func__);
|
RTW_INFO("%s\n", __func__);
|
||||||
|
|
||||||
*dbm = (12);
|
*dbm = pHalData->CurrentTxPwrIdx;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user