From 568bd9eb3aa414d8e21660dc171f322808c8d60c Mon Sep 17 00:00:00 2001 From: Sergei Makarenkov Date: Sat, 11 Mar 2017 10:53:38 +0300 Subject: [PATCH] TX power control for RTL8814AU --- hal/rtl8814a/rtl8814a_dm.c | 1 + hal/rtl8814a/rtl8814a_phycfg.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hal/rtl8814a/rtl8814a_dm.c b/hal/rtl8814a/rtl8814a_dm.c index 0bf002a..ef538b0 100644 --- a/hal/rtl8814a/rtl8814a_dm.c +++ b/hal/rtl8814a/rtl8814a_dm.c @@ -469,6 +469,7 @@ void rtl8814_init_dm_priv(IN PADAPTER Adapter) PHYDM_InitDebugSetting(podmpriv); pHalData->TxPwrInPercentage = TX_PWR_PERCENTAGE_3; + pHalData->CurrentTxPwrIdx = 18; } diff --git a/hal/rtl8814a/rtl8814a_phycfg.c b/hal/rtl8814a/rtl8814a_phycfg.c index a686721..9075e86 100644 --- a/hal/rtl8814a/rtl8814a_phycfg.c +++ b/hal/rtl8814a/rtl8814a_phycfg.c @@ -1211,6 +1211,16 @@ PHY_SetRFPowerState8814A( todo */ //1 5. Tx Power setting API +VOID +phy_TxPwrAdjInPercentage( + IN PADAPTER Adapter, + OUT u8* pTxPwrIdx) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + int txPower = *pTxPwrIdx + pHalData->CurrentTxPwrIdx - 18; + + *pTxPwrIdx = txPower > RF6052_MAX_TX_PWR ? RF6052_MAX_TX_PWR : txPower; +} VOID PHY_GetTxPowerLevel8814( @@ -1305,7 +1315,7 @@ PHY_GetTxPowerIndex_8814A( limit = PHY_GetTxPowerLimit( pAdapter, pAdapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel); powerDiffByRate = powerDiffByRate > limit ? limit : powerDiffByRate; - /* DBG_871X("Rate-0x%x: (TxPower, PowerDiffByRate Path-%c) = (0x%X, %d)\n", Rate, ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), txPower, powerDiffByRate); */ + /*DBG_871X("Rate-0x%x: (TxPower, PowerDiffByRate Path-%c) = (0x%X, %d)\n", Rate, ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), txPower, powerDiffByRate);*/ txPower += powerDiffByRate; @@ -1315,6 +1325,7 @@ PHY_GetTxPowerIndex_8814A( CCX_CellPowerLimit( pAdapter, Channel, Rate, &txPower ); #endif #endif + phy_TxPwrAdjInPercentage(pAdapter, (u8 *)&txPower); if(txPower > MAX_POWER_INDEX) txPower = MAX_POWER_INDEX; @@ -1322,8 +1333,8 @@ PHY_GetTxPowerIndex_8814A( //(pHalData->bautoload_fail_flag || pHalData->EfuseMap[EFUSE_INIT_MAP][EEPROM_TX_PWR_INX_JAGUAR] == 0xFF)) //txPower = 0x12; - /* DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n", ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), Channel, - txPower, txPower); */ + /*DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n", ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), Channel, + txPower, txPower);*/ return (u8) txPower; }