diff options
Diffstat (limited to 'drivers/staging/rtl8723bs/hal/hal_com_phycfg.c')
-rw-r--r-- | drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 250 |
1 files changed, 43 insertions, 207 deletions
diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 10250642d30a..94d11689b4ac 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -12,15 +12,13 @@ #include <linux/kernel.h> u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 Band, u8 RfPath, - u8 TxNum, enum RATE_SECTION RateSection) + u8 TxNum, enum rate_section RateSection) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u8 value = 0; - if (RfPath > ODM_RF_PATH_D) { - DBG_871X("Invalid Rf Path %d in PHY_GetTxPowerByRateBase()\n", RfPath); + if (RfPath > ODM_RF_PATH_D) return 0; - } if (Band == BAND_ON_2_4G) { switch (RateSection) { @@ -55,8 +53,6 @@ u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 Band, u8 RfPath, value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9]; break; default: - DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", - RateSection, RfPath, TxNum); break; } } else if (Band == BAND_ON_5G) { @@ -89,12 +85,9 @@ u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 Band, u8 RfPath, value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][8]; break; default: - DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", - RateSection, RfPath, TxNum); break; } - } else - DBG_871X("Invalid Band %d in PHY_GetTxPowerByRateBase()\n", Band); + } return value; } @@ -104,17 +97,15 @@ phy_SetTxPowerByRateBase( struct adapter *Adapter, u8 Band, u8 RfPath, - enum RATE_SECTION RateSection, + enum rate_section RateSection, u8 TxNum, u8 Value ) { struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - if (RfPath > ODM_RF_PATH_D) { - DBG_871X("Invalid Rf Path %d in phy_SetTxPowerByRatBase()\n", RfPath); + if (RfPath > ODM_RF_PATH_D) return; - } if (Band == BAND_ON_2_4G) { switch (RateSection) { @@ -149,8 +140,6 @@ phy_SetTxPowerByRateBase( pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9] = Value; break; default: - DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", - RateSection, RfPath, TxNum); break; } } else if (Band == BAND_ON_5G) { @@ -183,12 +172,9 @@ phy_SetTxPowerByRateBase( pHalData->TxPwrByRateBase5G[RfPath][TxNum][8] = Value; break; default: - DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", - RateSection, RfPath, TxNum); break; } - } else - DBG_871X("Invalid Band %d in phy_SetTxPowerByRateBase()\n", Band); + } } static void @@ -198,71 +184,52 @@ struct adapter *padapter { u8 path, base; - /* DBG_871X("===>%s\n", __func__); */ - for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_B; ++path) { base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_11M); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, CCK, RF_1TX, base); - /* DBG_871X("Power index base of 2.4G path %d 1Tx CCK = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_54M); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, OFDM, RF_1TX, base); - /* DBG_871X("Power index base of 2.4G path %d 1Tx OFDM = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, HT_MCS0_MCS7, RF_1TX, base); - /* DBG_871X("Power index base of 2.4G path %d 1Tx MCS0-7 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_2TX, MGN_MCS15); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, HT_MCS8_MCS15, RF_2TX, base); - /* DBG_871X("Power index base of 2.4G path %d 2Tx MCS8-15 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_3TX, MGN_MCS23); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, HT_MCS16_MCS23, RF_3TX, base); - /* DBG_871X("Power index base of 2.4G path %d 3Tx MCS16-23 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_VHT1SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base); - /* DBG_871X("Power index base of 2.4G path %d 1Tx VHT1SS = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_2TX, MGN_VHT2SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base); - /* DBG_871X("Power index base of 2.4G path %d 2Tx VHT2SS = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_3TX, MGN_VHT3SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, VHT_3SSMCS0_3SSMCS9, RF_3TX, base); - /* DBG_871X("Power index base of 2.4G path %d 3Tx VHT3SS = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_1TX, MGN_54M); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, OFDM, RF_1TX, base); - /* DBG_871X("Power index base of 5G path %d 1Tx OFDM = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_1TX, MGN_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, HT_MCS0_MCS7, RF_1TX, base); - /* DBG_871X("Power index base of 5G path %d 1Tx MCS0~7 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_2TX, MGN_MCS15); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, HT_MCS8_MCS15, RF_2TX, base); - /* DBG_871X("Power index base of 5G path %d 2Tx MCS8~15 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_3TX, MGN_MCS23); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, HT_MCS16_MCS23, RF_3TX, base); - /* DBG_871X("Power index base of 5G path %d 3Tx MCS16~23 = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_1TX, MGN_VHT1SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base); - /* DBG_871X("Power index base of 5G path %d 1Tx VHT1SS = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_2TX, MGN_VHT2SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base); - /* DBG_871X("Power index base of 5G path %d 2Tx VHT2SS = > 0x%x\n", path, base); */ base = PHY_GetTxPowerByRate(padapter, BAND_ON_5G, path, RF_3TX, MGN_VHT2SS_MCS7); phy_SetTxPowerByRateBase(padapter, BAND_ON_5G, path, VHT_3SSMCS0_3SSMCS9, RF_3TX, base); - /* DBG_871X("Power index base of 5G path %d 3Tx VHT3SS = > 0x%x\n", path, base); */ } - - /* DBG_871X("<===%s\n", __func__); */ } u8 PHY_GetRateSectionIndexOfTxPowerByRate( @@ -270,7 +237,7 @@ u8 PHY_GetRateSectionIndexOfTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; u8 index = 0; if (pDM_Odm->PhyRegPgVersion == 0) { @@ -325,7 +292,6 @@ u8 PHY_GetRateSectionIndexOfTxPowerByRate( index = 13; break; default: - DBG_871X("Invalid RegAddr 0x3%x in PHY_GetRateSectionIndexOfTxPowerByRate()", RegAddr); break; } } @@ -715,7 +681,6 @@ PHY_GetRateValuesOfTxPowerByRate( break; default: - DBG_871X("Invalid RegAddr 0x%x in %s()\n", RegAddr, __func__); break; } } @@ -736,20 +701,14 @@ static void PHY_StoreTxPowerByRateNew( PHY_GetRateValuesOfTxPowerByRate(padapter, RegAddr, BitMask, Data, rateIndex, PwrByRateVal, &rateNum); - if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { - DBG_871X("Invalid Band %d\n", Band); + if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) return; - } - if (RfPath > ODM_RF_PATH_D) { - DBG_871X("Invalid RfPath %d\n", RfPath); + if (RfPath > ODM_RF_PATH_D) return; - } - if (TxNum > ODM_RF_PATH_D) { - DBG_871X("Invalid TxNum %d\n", TxNum); + if (TxNum > ODM_RF_PATH_D) return; - } for (i = 0; i < rateNum; ++i) { if (rateIndex[i] == PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS0) || @@ -768,8 +727,6 @@ static void PHY_StoreTxPowerByRateOld( u8 index = PHY_GetRateSectionIndexOfTxPowerByRate(padapter, RegAddr, BitMask); pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][index] = Data; - /* DBG_871X("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", pHalData->pwrGroupCnt, */ - /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); */ } void PHY_InitTxPowerByRate(struct adapter *padapter) @@ -795,7 +752,7 @@ void PHY_StoreTxPowerByRate( ) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; if (pDM_Odm->PhyRegPgVersion > 0) PHY_StoreTxPowerByRateNew(padapter, Band, RfPath, TxNum, RegAddr, BitMask, Data); @@ -806,9 +763,7 @@ void PHY_StoreTxPowerByRate( pHalData->pwrGroupCnt++; else if (RegAddr == rTxAGC_B_Mcs15_Mcs12 && pHalData->rf_type != RF_1T1R) pHalData->pwrGroupCnt++; - } else - DBG_871X("Invalid PHY_REG_PG.txt version %d\n", pDM_Odm->PhyRegPgVersion); - + } } static void @@ -845,8 +800,6 @@ struct adapter *padapter MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7, MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9 }; - /* DBG_871X("===>PHY_ConvertTxPowerByRateInDbmToRelativeValues()\n"); */ - for (band = BAND_ON_2_4G; band <= BAND_ON_5G; ++band) { for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path) { for (txNum = RF_1TX; txNum < RF_MAX_TX_NUM; ++txNum) { @@ -908,8 +861,6 @@ struct adapter *padapter } } } - - /* DBG_871X("<===PHY_ConvertTxPowerByRateInDbmToRelativeValues()\n"); */ } /* @@ -1003,8 +954,7 @@ void PHY_SetTxPowerIndexByRateSection( pHalData->CurrentChannelBW, Channel, vhtRates4T, ARRAY_SIZE(vhtRates4T)); - } else - DBG_871X("Invalid RateSection %d in %s", RateSection, __func__); + } } static bool phy_GetChnlIndex(u8 Channel, u8 *ChannelIdx) @@ -1039,7 +989,7 @@ u8 PHY_GetTxPowerIndexBase( struct adapter *padapter, u8 RFPath, u8 Rate, - enum CHANNEL_WIDTH BandWidth, + enum channel_width BandWidth, u8 Channel, bool *bIn24G ) @@ -1049,31 +999,21 @@ u8 PHY_GetTxPowerIndexBase( u8 txPower = 0; u8 chnlIdx = (Channel-1); - if (HAL_IsLegalChannel(padapter, Channel) == false) { + if (HAL_IsLegalChannel(padapter, Channel) == false) chnlIdx = 0; - DBG_871X("Illegal channel!!\n"); - } *bIn24G = phy_GetChnlIndex(Channel, &chnlIdx); - /* DBG_871X("[%s] Channel Index: %d\n", (*bIn24G?"2.4G":"5G"), chnlIdx); */ - if (*bIn24G) { /* 3 ============================== 2.4 G ============================== */ if (IS_CCK_RATE(Rate)) txPower = pHalData->Index24G_CCK_Base[RFPath][chnlIdx]; else if (MGN_6M <= Rate) txPower = pHalData->Index24G_BW40_Base[RFPath][chnlIdx]; - else - DBG_871X("PHY_GetTxPowerIndexBase: INVALID Rate.\n"); - - /* DBG_871X("Base Tx power(RF-%c, Rate #%d, Channel Index %d) = 0x%X\n", */ - /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ /* OFDM-1T */ - if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) { + if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) txPower += pHalData->OFDM_24G_Diff[RFPath][TX_1S]; - /* DBG_871X("+PowerDiff 2.4G (RF-%c): (OFDM-1T) = (%d)\n", ((RFPath == 0)?'A':'B'), pHalData->OFDM_24G_Diff[RFPath][TX_1S]); */ - } + if (BandWidth == CHANNEL_WIDTH_20) { /* BW20-1S, BW20-2S */ if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW20_24G_Diff[RFPath][TX_1S]; @@ -1084,9 +1024,6 @@ u8 PHY_GetTxPowerIndexBase( if ((MGN_MCS24 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW20_24G_Diff[RFPath][TX_4S]; - /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW20-1S, BW20-2S, BW20-3S, BW20-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW20_24G_Diff[RFPath][TX_1S], pHalData->BW20_24G_Diff[RFPath][TX_2S], */ - /* pHalData->BW20_24G_Diff[RFPath][TX_3S], pHalData->BW20_24G_Diff[RFPath][TX_4S]); */ } else if (BandWidth == CHANNEL_WIDTH_40) { /* BW40-1S, BW40-2S */ if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW40_24G_Diff[RFPath][TX_1S]; @@ -1097,9 +1034,6 @@ u8 PHY_GetTxPowerIndexBase( if ((MGN_MCS24 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW40_24G_Diff[RFPath][TX_4S]; - /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW40-1S, BW40-2S, BW40-3S, BW40-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ - /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ } /* Willis suggest adopt BW 40M power index while in BW 80 mode */ else if (BandWidth == CHANNEL_WIDTH_80) { @@ -1112,24 +1046,14 @@ u8 PHY_GetTxPowerIndexBase( if ((MGN_MCS24 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW40_24G_Diff[RFPath][TX_4S]; - /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW40-1S, BW40-2S, BW40-3S, BW40-4T) = (%d, %d, %d, %d) P.S. Current is in BW 80MHz\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ - /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ } } else {/* 3 ============================== 5 G ============================== */ if (MGN_6M <= Rate) txPower = pHalData->Index5G_BW40_Base[RFPath][chnlIdx]; - else - DBG_871X("===> mpt_ProQueryCalTxPower_Jaguar: INVALID Rate.\n"); - - /* DBG_871X("Base Tx power(RF-%c, Rate #%d, Channel Index %d) = 0x%X\n", */ - /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ /* OFDM-1T */ - if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) { + if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) txPower += pHalData->OFDM_5G_Diff[RFPath][TX_1S]; - /* DBG_871X("+PowerDiff 5G (RF-%c): (OFDM-1T) = (%d)\n", ((RFPath == 0)?'A':'B'), pHalData->OFDM_5G_Diff[RFPath][TX_1S]); */ - } /* BW20-1S, BW20-2S */ if (BandWidth == CHANNEL_WIDTH_20) { @@ -1142,9 +1066,6 @@ u8 PHY_GetTxPowerIndexBase( if ((MGN_MCS24 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW20_5G_Diff[RFPath][TX_4S]; - /* DBG_871X("+PowerDiff 5G (RF-%c): (BW20-1S, BW20-2S, BW20-3S, BW20-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW20_5G_Diff[RFPath][TX_1S], pHalData->BW20_5G_Diff[RFPath][TX_2S], */ - /* pHalData->BW20_5G_Diff[RFPath][TX_3S], pHalData->BW20_5G_Diff[RFPath][TX_4S]); */ } else if (BandWidth == CHANNEL_WIDTH_40) { /* BW40-1S, BW40-2S */ if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW40_5G_Diff[RFPath][TX_1S]; @@ -1155,9 +1076,6 @@ u8 PHY_GetTxPowerIndexBase( if ((MGN_MCS24 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW40_5G_Diff[RFPath][TX_4S]; - /* DBG_871X("+PowerDiff 5G(RF-%c): (BW40-1S, BW40-2S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW40_5G_Diff[RFPath][TX_1S], pHalData->BW40_5G_Diff[RFPath][TX_2S], */ - /* pHalData->BW40_5G_Diff[RFPath][TX_3S], pHalData->BW40_5G_Diff[RFPath][TX_4S]); */ } else if (BandWidth == CHANNEL_WIDTH_80) { /* BW80-1S, BW80-2S */ /* <20121220, Kordan> Get the index of array "Index5G_BW80_Base". */ u8 channel5G_80M[CHANNEL_MAX_NUMBER_5G_80M] = {42, 58, 106, 122, 138, 155, 171}; @@ -1175,10 +1093,6 @@ u8 PHY_GetTxPowerIndexBase( txPower += pHalData->BW80_5G_Diff[RFPath][TX_3S]; if ((MGN_MCS23 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT4SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) txPower += pHalData->BW80_5G_Diff[RFPath][TX_4S]; - - /* DBG_871X("+PowerDiff 5G(RF-%c): (BW80-1S, BW80-2S, BW80-3S, BW80-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ - /* pHalData->BW80_5G_Diff[RFPath][TX_1S], pHalData->BW80_5G_Diff[RFPath][TX_2S], */ - /* pHalData->BW80_5G_Diff[RFPath][TX_3S], pHalData->BW80_5G_Diff[RFPath][TX_4S]); */ } } @@ -1188,20 +1102,16 @@ u8 PHY_GetTxPowerIndexBase( s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate) { struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; s8 offset = 0; if (pDM_Odm->RFCalibrateInfo.TxPowerTrackControl == false) return offset; - if ((Rate == MGN_1M) || (Rate == MGN_2M) || (Rate == MGN_5_5M) || (Rate == MGN_11M)) { + if ((Rate == MGN_1M) || (Rate == MGN_2M) || (Rate == MGN_5_5M) || (Rate == MGN_11M)) offset = pDM_Odm->Remnant_CCKSwingIdx; - /* DBG_871X("+Remnant_CCKSwingIdx = 0x%x\n", RFPath, Rate, pDM_Odm->Remnant_CCKSwingIdx); */ - } else { + else offset = pDM_Odm->Remnant_OFDMSwingIdx[RFPath]; - /* DBG_871X("+Remanant_OFDMSwingIdx[RFPath %u][Rate 0x%x] = 0x%x\n", RFPath, Rate, pDM_Odm->Remnant_OFDMSwingIdx[RFPath]); */ - - } return offset; } @@ -1463,7 +1373,6 @@ u8 PHY_GetRateIndexOfTxPowerByRate(u8 Rate) index = 83; break; default: - DBG_871X("Invalid rate 0x%x in %s\n", Rate, __func__); break; } return index; @@ -1481,22 +1390,17 @@ s8 PHY_GetTxPowerByRate( padapter->registrypriv.RegEnableTxPowerByRate == 0) return 0; - if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { - DBG_871X("Invalid band %d in %s\n", Band, __func__); + if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) return value; - } - if (RFPath > ODM_RF_PATH_D) { - DBG_871X("Invalid RfPath %d in %s\n", RFPath, __func__); + + if (RFPath > ODM_RF_PATH_D) return value; - } - if (TxNum >= RF_MAX_TX_NUM) { - DBG_871X("Invalid TxNum %d in %s\n", TxNum, __func__); + + if (TxNum >= RF_MAX_TX_NUM) return value; - } - if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) { - DBG_871X("Invalid RateIndex %d in %s\n", rateIndex, __func__); + + if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) return value; - } return pHalData->TxPwrByRateOffset[Band][RFPath][TxNum][rateIndex]; @@ -1514,22 +1418,17 @@ void PHY_SetTxPowerByRate( struct hal_com_data *pHalData = GET_HAL_DATA(padapter); u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); - if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { - DBG_871X("Invalid band %d in %s\n", Band, __func__); + if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) return; - } - if (RFPath > ODM_RF_PATH_D) { - DBG_871X("Invalid RfPath %d in %s\n", RFPath, __func__); + + if (RFPath > ODM_RF_PATH_D) return; - } - if (TxNum >= RF_MAX_TX_NUM) { - DBG_871X("Invalid TxNum %d in %s\n", TxNum, __func__); + + if (TxNum >= RF_MAX_TX_NUM) return; - } - if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) { - DBG_871X("Invalid RateIndex %d in %s\n", rateIndex, __func__); + + if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) return; - } pHalData->TxPwrByRateOffset[Band][RFPath][TxNum][rateIndex] = Value; } @@ -1556,7 +1455,7 @@ void PHY_SetTxPowerLevelByPath(struct adapter *Adapter, u8 channel, u8 path) void PHY_SetTxPowerIndexByRateArray( struct adapter *padapter, u8 RFPath, - enum CHANNEL_WIDTH BandWidth, + enum channel_width BandWidth, u8 Channel, u8 *Rates, u8 RateArraySize @@ -1601,16 +1500,12 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) if (channel5G[i] == Channel) channelIndex = i; } - } else - DBG_871X("Invalid Band %d in %s", Band, __func__); - - if (channelIndex == -1) - DBG_871X("Invalid Channel %d of Band %d in %s", Channel, Band, __func__); + } return channelIndex; } -static s16 get_bandwidth_idx(const enum CHANNEL_WIDTH bandwidth) +static s16 get_bandwidth_idx(const enum channel_width bandwidth) { switch (bandwidth) { case CHANNEL_WIDTH_20: @@ -1667,13 +1562,12 @@ static s16 get_rate_sctn_idx(const u8 rate) case MGN_VHT4SS_MCS9: return 9; default: - DBG_871X("Wrong rate 0x%x\n", rate); return -1; } } s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, - enum BAND_TYPE band_type, enum CHANNEL_WIDTH bandwidth, + enum band_type band_type, enum channel_width bandwidth, u8 rf_path, u8 data_rate, u8 channel) { s16 idx_band = -1; @@ -1709,9 +1603,6 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, break; } - /* DBG_871X("pMgntInfo->RegPwrTblSel %d, final regulation %d\n", */ - /* adapter->registrypriv.RegPwrTblSel, idx_regulation); */ - if (band_type == BAND_ON_2_4G) idx_band = 0; else if (band_type == BAND_ON_5G) @@ -1720,9 +1611,6 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, idx_bandwidth = get_bandwidth_idx(bandwidth); idx_rate_sctn = get_rate_sctn_idx(data_rate); - if (band_type == BAND_ON_5G && idx_rate_sctn == 0) - DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate); - /* workaround for wrong index combination to obtain tx power limit, */ /* OFDM only exists in BW 20M */ /* CCK table will only be given in BW 20M */ @@ -1737,13 +1625,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, channel = phy_GetChannelIndexOfTxPowerLimit(band_type, channel); if (idx_band == -1 || idx_regulation == -1 || idx_bandwidth == -1 || - idx_rate_sctn == -1 || idx_channel == -1) { - /* DBG_871X("Wrong index value to access power limit table [band %d][regulation %d][bandwidth %d][rf_path %d][rate_section %d][chnlGroup %d]\n", */ - /* idx_band, idx_regulation, idx_bandwidth, rf_path, */ - /* idx_rate_sctn, channel); */ - + idx_rate_sctn == -1 || idx_channel == -1) return MAX_POWER_INDEX; - } if (band_type == BAND_ON_2_4G) { s8 limits[10] = {0}; u8 i = 0; @@ -1780,32 +1663,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, [idx_rate_sctn] [idx_channel] [rf_path]; - } else { - DBG_871X("No power limit table of the specified band\n"); } - /* combine 5G VHT & HT rate */ - /* 5G 20M and 40M HT and VHT can cross reference */ - /* - if (band_type == BAND_ON_5G && pwr_lmt == MAX_POWER_INDEX) { - if (idx_bandwidth == 0 || idx_bandwidth == 1) { - RT_TRACE(COMP_INIT, DBG_LOUD, ("No power limit table of the specified band %d, bandwidth %d, ratesection %d, rf path %d\n", - idx_band, idx_bandwidth, - idx_rate_sctn, rf_path)); - if (idx_rate_sctn == 2) - pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][4][idx_channel][rf_path]; - else if (idx_rate_sctn == 4) - pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][2][idx_channel][rf_path]; - else if (idx_rate_sctn == 3) - pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][5][idx_channel][rf_path]; - else if (idx_rate_sctn == 5) - pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][3][idx_channel][rf_path]; - } - } - */ - - /* DBG_871X("TxPwrLmt[Regulation %d][Band %d][BW %d][RFPath %d][Rate 0x%x][Chnl %d] = %d\n", */ - /* idx_regulation, hal_data->CurrentBandType, bandwidth, rf_path, data_rate, channel, pwr_lmt); */ return pwr_lmt; } @@ -1823,7 +1682,6 @@ static void phy_CrossReferenceHTAndVHTTxPowerLimit(struct adapter *padapter) if (tempPwrLmt == MAX_POWER_INDEX) { u8 baseSection = 2, refSection = 6; if (bw == 0 || bw == 1) { /* 5G 20M 40M VHT and HT can cross reference */ - /* DBG_871X("No power limit table of the specified band %d, bandwidth %d, ratesection %d, channel %d, rf path %d\n", */ /* 1, bw, rateSection, channel, ODM_RF_PATH_A); */ if (rateSection >= 2 && rateSection <= 9) { if (rateSection == 2) { @@ -1854,8 +1712,6 @@ static void phy_CrossReferenceHTAndVHTTxPowerLimit(struct adapter *padapter) pHalData->TxPwrLimit_5G[regulation][bw][baseSection][channel][ODM_RF_PATH_A] = pHalData->TxPwrLimit_5G[regulation][bw][refSection][channel][ODM_RF_PATH_A]; } - - /* DBG_871X("use other value %d", tempPwrLmt); */ } } } @@ -1872,8 +1728,6 @@ void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter) s8 tempValue = 0, tempPwrLmt = 0; u8 rfPath = 0; - /* DBG_871X("=====> PHY_ConvertTxPowerLimitToPowerIndex()\n"); */ - phy_CrossReferenceHTAndVHTTxPowerLimit(Adapter); for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) { @@ -1908,8 +1762,6 @@ void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter) } } } - - /* DBG_871X("<===== PHY_ConvertTxPowerLimitToPowerIndex()\n"); */ } void PHY_InitTxPowerLimit(struct adapter *Adapter) @@ -1917,8 +1769,6 @@ void PHY_InitTxPowerLimit(struct adapter *Adapter) struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); u8 i, j, k, l, m; - /* DBG_871X("=====> PHY_InitTxPowerLimit()!\n"); */ - for (i = 0; i < MAX_REGULATION_NUM; ++i) { for (j = 0; j < MAX_2_4G_BANDWIDTH_NUM; ++j) for (k = 0; k < MAX_RATE_SECTION_NUM; ++k) @@ -1934,8 +1784,6 @@ void PHY_InitTxPowerLimit(struct adapter *Adapter) for (l = 0; l < MAX_RF_PATH_NUM; ++l) pHalData->TxPwrLimit_5G[i][j][k][m][l] = MAX_POWER_INDEX; } - - /* DBG_871X("<===== PHY_InitTxPowerLimit()!\n"); */ } void PHY_SetTxPowerLimit( @@ -1953,12 +1801,8 @@ void PHY_SetTxPowerLimit( u8 regulation = 0, bandwidth = 0, rateSection = 0, channel; s8 powerLimit = 0, prevPowerLimit, channelIndex; - /* DBG_871X("Index of power limit table [band %s][regulation %s][bw %s][rate section %s][rf path %s][chnl %s][val %s]\n", */ - /* Band, Regulation, Bandwidth, RateSection, RfPath, Channel, PowerLimit); */ - - if (!GetU1ByteIntegerFromStringInDecimal((s8 *)Channel, &channel) || - !GetU1ByteIntegerFromStringInDecimal((s8 *)PowerLimit, &powerLimit)) - DBG_871X("Illegal index of power limit table [chnl %s][val %s]\n", Channel, PowerLimit); + GetU1ByteIntegerFromStringInDecimal((s8 *)Channel, &channel); + GetU1ByteIntegerFromStringInDecimal((s8 *)PowerLimit, &powerLimit); powerLimit = powerLimit > MAX_POWER_INDEX ? MAX_POWER_INDEX : powerLimit; @@ -1991,11 +1835,8 @@ void PHY_SetTxPowerLimit( rateSection = 8; else if (eqNByte(RateSection, (u8 *)("VHT"), 3) && eqNByte(RfPath, (u8 *)("4T"), 2)) rateSection = 9; - else { - DBG_871X("Wrong rate section!\n"); + else return; - } - if (eqNByte(Bandwidth, (u8 *)("20M"), 3)) bandwidth = 0; @@ -2017,8 +1858,6 @@ void PHY_SetTxPowerLimit( if (powerLimit < prevPowerLimit) pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A] = powerLimit; - /* DBG_871X("2.4G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n", */ - /* regulation, bandwidth, rateSection, channelIndex, pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ } else if (eqNByte(Band, (u8 *)("5G"), 2)) { channelIndex = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, channel); @@ -2030,10 +1869,7 @@ void PHY_SetTxPowerLimit( if (powerLimit < prevPowerLimit) pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A] = powerLimit; - /* DBG_871X("5G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n", */ - /* regulation, bandwidth, rateSection, channel, pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ } else { - DBG_871X("Cannot recognize the band info in %s\n", Band); return; } } |