mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2024-11-29 00:17:41 +00:00
Preliminary tx power control implemented. Switch channel to apply tx power settings.
This commit is contained in:
parent
ffa2eb7b9f
commit
c2cac9b8f6
@ -496,6 +496,7 @@ void rtl8812_init_dm_priv(IN PADAPTER Adapter)
|
|||||||
PHYDM_InitDebugSetting(podmpriv);
|
PHYDM_InitDebugSetting(podmpriv);
|
||||||
|
|
||||||
pHalData->TxPwrInPercentage = TX_PWR_PERCENTAGE_3;
|
pHalData->TxPwrInPercentage = TX_PWR_PERCENTAGE_3;
|
||||||
|
pHalData->CurrentTxPwrIdx = 18;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +547,7 @@ phy_TxPwrAdjInPercentage(
|
|||||||
if(*pTxPwrIdx > RF6052_MAX_TX_PWR)
|
if(*pTxPwrIdx > RF6052_MAX_TX_PWR)
|
||||||
*pTxPwrIdx = RF6052_MAX_TX_PWR;
|
*pTxPwrIdx = RF6052_MAX_TX_PWR;
|
||||||
|
|
||||||
|
#if 0
|
||||||
//
|
//
|
||||||
// <Roger_Notes> NEC Spec: dB = 10*log(X/Y), X: target value, Y: default value.
|
// <Roger_Notes> NEC Spec: dB = 10*log(X/Y), X: target value, Y: default value.
|
||||||
// For example: TxPower 50%, 10*log(50/100)=(nearly)-3dB
|
// For example: TxPower 50%, 10*log(50/100)=(nearly)-3dB
|
||||||
@ -564,7 +565,9 @@ phy_TxPwrAdjInPercentage(
|
|||||||
{
|
{
|
||||||
*pTxPwrIdx -=6;
|
*pTxPwrIdx -=6;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
*pTxPwrIdx += pHalData->CurrentTxPwrIdx;
|
||||||
|
*pTxPwrIdx -= 18;
|
||||||
if(*pTxPwrIdx > RF6052_MAX_TX_PWR) // Avoid underflow condition.
|
if(*pTxPwrIdx > RF6052_MAX_TX_PWR) // Avoid underflow condition.
|
||||||
*pTxPwrIdx = RF6052_MAX_TX_PWR;
|
*pTxPwrIdx = RF6052_MAX_TX_PWR;
|
||||||
}
|
}
|
||||||
@ -720,7 +723,7 @@ PHY_GetTxPowerIndex_8812A(
|
|||||||
if ( txPower % 2 == 1 && !IS_NORMAL_CHIP(pHalData->VersionID))
|
if ( txPower % 2 == 1 && !IS_NORMAL_CHIP(pHalData->VersionID))
|
||||||
--txPower;
|
--txPower;
|
||||||
|
|
||||||
//DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n", ((RFPath==0)?'A':'B'), Channel,txPower, txPower);
|
DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n", ((RFPath==0)?'A':'B'), Channel,txPower, txPower);
|
||||||
|
|
||||||
return (u8) txPower;
|
return (u8) txPower;
|
||||||
}
|
}
|
||||||
|
@ -386,6 +386,7 @@ typedef struct hal_com_data
|
|||||||
u8 CurrentOfdm24GTxPwrIdx;
|
u8 CurrentOfdm24GTxPwrIdx;
|
||||||
u8 CurrentBW2024GTxPwrIdx;
|
u8 CurrentBW2024GTxPwrIdx;
|
||||||
u8 CurrentBW4024GTxPwrIdx;
|
u8 CurrentBW4024GTxPwrIdx;
|
||||||
|
u8 CurrentTxPwrIdx;
|
||||||
|
|
||||||
// Read/write are allow for following hardware information variables
|
// Read/write are allow for following hardware information variables
|
||||||
u8 pwrGroupCnt;
|
u8 pwrGroupCnt;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#endif /* Linux kernel >= 4.0.0 */
|
#endif /* Linux kernel >= 4.0.0 */
|
||||||
|
|
||||||
#include <rtw_wifi_regd.h>
|
#include <rtw_wifi_regd.h>
|
||||||
|
#include <hal_data.h>
|
||||||
|
|
||||||
#define RTW_MAX_MGMT_TX_CNT (8)
|
#define RTW_MAX_MGMT_TX_CNT (8)
|
||||||
#define RTW_MAX_MGMT_TX_MS_GAS (500)
|
#define RTW_MAX_MGMT_TX_MS_GAS (500)
|
||||||
@ -3441,11 +3442,25 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
|
|||||||
struct wireless_dev *wdev,
|
struct wireless_dev *wdev,
|
||||||
#endif
|
#endif
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
enum nl80211_tx_power_setting type, int mbm)
|
enum nl80211_tx_power_setting type,
|
||||||
#else
|
#else
|
||||||
enum tx_power_setting type, int dbm)
|
enum tx_power_setting type,
|
||||||
#endif
|
#endif
|
||||||
|
int value)
|
||||||
{
|
{
|
||||||
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
|
value /= 100;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(value < 0)
|
||||||
|
value = 0;
|
||||||
|
if(value > 40)
|
||||||
|
value = 40;
|
||||||
|
|
||||||
|
pHalData->CurrentTxPwrIdx = value;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
|
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
|
||||||
int ret;
|
int ret;
|
||||||
@ -3472,7 +3487,6 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DBG_8192C("%s\n", __func__);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3482,9 +3496,10 @@ static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
|||||||
#endif
|
#endif
|
||||||
int *dbm)
|
int *dbm)
|
||||||
{
|
{
|
||||||
DBG_8192C("%s\n", __func__);
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
|
|
||||||
*dbm = (12);
|
*dbm = pHalData->CurrentTxPwrIdx;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user