Lines Matching +full:txpower +full:-

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2010 Realtek Corporation.*/
34 return i ? i - 1 : 32; in _rtl8821ae_phy_calculate_bit_shift()
57 if (IS_VENDOR_8812A_C_CUT(rtlhal->version)) { in rtl8812ae_fixspur()
84 } else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8812ae_fixspur()
152 spin_lock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_query_rf_reg()
158 spin_unlock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_query_rf_reg()
178 spin_lock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_set_rf_reg()
189 spin_unlock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_set_rf_reg()
213 !((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
214 (IS_VENDOR_8812A_C_CUT(rtlhal->version)))) in _rtl8821ae_phy_rf_serial_read()
225 if ((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
226 (IS_VENDOR_8812A_C_CUT(rtlhal->version))) in _rtl8821ae_phy_rf_serial_read()
250 !((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
251 (IS_VENDOR_8812A_C_CUT(rtlhal->version)))) in _rtl8821ae_phy_rf_serial_read()
261 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_rf_serial_write()
262 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; in _rtl8821ae_phy_rf_serial_write()
274 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); in _rtl8821ae_phy_rf_serial_write()
276 "RFW-%d Addr[0x%x]=0x%x\n", in _rtl8821ae_phy_rf_serial_write()
277 rfpath, pphyreg->rf3wire_offset, data_and_addr); in _rtl8821ae_phy_rf_serial_write()
294 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_bb_config()
312 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_bb_config()
313 crystal_cap = rtlefuse->crystalcap & 0x3F; in rtl8821ae_phy_bb_config()
317 crystal_cap = rtlefuse->crystalcap & 0x3F; in rtl8821ae_phy_bb_config()
321 rtlphy->reg_837 = rtl_read_byte(rtlpriv, 0x837); in rtl8821ae_phy_bb_config()
337 switch (rtlhal->rfe_type) { in _rtl8812ae_phy_set_rfe_reg_24g()
359 if (rtlpriv->btcoexist.bt_coexistence) { in _rtl8812ae_phy_set_rfe_reg_24g()
385 switch (rtlhal->rfe_type) { in _rtl8812ae_phy_set_rfe_reg_5g()
393 if (rtlpriv->btcoexist.bt_coexistence) { in _rtl8812ae_phy_set_rfe_reg_5g()
440 s8 reg_swing_2g = -1;/* 0xff; */ in phy_get_tx_swing_8812A()
441 s8 reg_swing_5g = -1;/* 0xff; */ in phy_get_tx_swing_8812A()
442 s8 swing_2g = -1 * reg_swing_2g; in phy_get_tx_swing_8812A()
443 s8 swing_5g = -1 * reg_swing_5g; in phy_get_tx_swing_8812A()
445 const s8 auto_temp = -1; in phy_get_tx_swing_8812A()
450 (int)rtlefuse->autoload_failflag); in phy_get_tx_swing_8812A()
452 if (rtlefuse->autoload_failflag) { in phy_get_tx_swing_8812A()
454 rtldm->swing_diff_2g = swing_2g; in phy_get_tx_swing_8812A()
457 } else if (swing_2g == -3) { in phy_get_tx_swing_8812A()
458 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
459 } else if (swing_2g == -6) { in phy_get_tx_swing_8812A()
460 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
461 } else if (swing_2g == -9) { in phy_get_tx_swing_8812A()
462 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
464 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
468 rtldm->swing_diff_5g = swing_5g; in phy_get_tx_swing_8812A()
471 } else if (swing_5g == -3) { in phy_get_tx_swing_8812A()
472 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
473 } else if (swing_5g == -6) { in phy_get_tx_swing_8812A()
474 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
475 } else if (swing_5g == -9) { in phy_get_tx_swing_8812A()
476 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
478 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in phy_get_tx_swing_8812A()
479 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
482 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
487 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
488 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
489 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
500 } else if (swing_2g == -3) { in phy_get_tx_swing_8812A()
501 swing = 0x05; /* -3 dB */ in phy_get_tx_swing_8812A()
502 } else if (swing_2g == -6) { in phy_get_tx_swing_8812A()
503 swing = 0x0A; /* -6 dB */ in phy_get_tx_swing_8812A()
504 } else if (swing_2g == -9) { in phy_get_tx_swing_8812A()
505 swing = 0xFF; /* -9 dB */ in phy_get_tx_swing_8812A()
515 } else if (swing_5g == -3) { in phy_get_tx_swing_8812A()
516 swing = 0x05; /* -3 dB */ in phy_get_tx_swing_8812A()
517 } else if (swing_5g == -6) { in phy_get_tx_swing_8812A()
518 swing = 0x0A; /* -6 dB */ in phy_get_tx_swing_8812A()
519 } else if (swing_5g == -9) { in phy_get_tx_swing_8812A()
520 swing = 0xFF; /* -9 dB */ in phy_get_tx_swing_8812A()
532 /* 3 Path-A */ in phy_get_tx_swing_8812A()
535 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
537 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
541 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
543 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
544 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
547 rtldm->swing_diff_2g = -6; in phy_get_tx_swing_8812A()
549 rtldm->swing_diff_5g = -6; in phy_get_tx_swing_8812A()
550 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
553 rtldm->swing_diff_2g = -9; in phy_get_tx_swing_8812A()
555 rtldm->swing_diff_5g = -9; in phy_get_tx_swing_8812A()
556 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
558 /* 3 Path-B */ in phy_get_tx_swing_8812A()
561 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
563 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
567 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
569 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
570 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
573 rtldm->swing_diff_2g = -6; in phy_get_tx_swing_8812A()
575 rtldm->swing_diff_5g = -6; in phy_get_tx_swing_8812A()
576 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
579 rtldm->swing_diff_2g = -9; in phy_get_tx_swing_8812A()
581 rtldm->swing_diff_5g = -9; in phy_get_tx_swing_8812A()
582 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
596 u8 current_band = rtlhal->current_bandtype; in rtl8821ae_phy_switch_wirelessband()
601 rtlhal->current_bandtype = (enum band_type) band; in rtl8821ae_phy_switch_wirelessband()
603 if (rtlhal->current_bandtype == BAND_ON_2_4G) { in rtl8821ae_phy_switch_wirelessband()
607 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
614 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_switch_wirelessband()
619 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
627 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_phy_switch_wirelessband()
637 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
667 without long-run verification for scan issue. */ in rtl8821ae_phy_switch_wirelessband()
670 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_switch_wirelessband()
675 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
683 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_phy_switch_wirelessband()
691 rtlpriv->dm.ofdm_index[RF90_PATH_A]); in rtl8821ae_phy_switch_wirelessband()
694 if ((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in rtl8821ae_phy_switch_wirelessband()
695 (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)) { in rtl8821ae_phy_switch_wirelessband()
709 (rtldm->swing_diff_2g - rtldm->swing_diff_5g); in rtl8821ae_phy_switch_wirelessband()
712 (-1 * bb_diff_between_band); in rtl8821ae_phy_switch_wirelessband()
713 rtldm->default_ofdm_index += bb_diff_between_band * 2; in rtl8821ae_phy_switch_wirelessband()
729 u32 cut_ver = ((rtlhal->version & CHIP_VER_RTL_MASK) in _rtl8821ae_check_positive()
731 u32 intf = (rtlhal->interface == INTF_USB ? BIT(1) : BIT(0)); in _rtl8821ae_check_positive()
733 u8 board_type = ((rtlhal->board_type & BIT(4)) >> 4) << 0 | /* _GLNA */ in _rtl8821ae_check_positive()
734 ((rtlhal->board_type & BIT(3)) >> 3) << 1 | /* _GPA */ in _rtl8821ae_check_positive()
735 ((rtlhal->board_type & BIT(7)) >> 7) << 2 | /* _ALNA */ in _rtl8821ae_check_positive()
736 ((rtlhal->board_type & BIT(6)) >> 6) << 3 | /* _APA */ in _rtl8821ae_check_positive()
737 ((rtlhal->board_type & BIT(2)) >> 2) << 4; /* _BT */ in _rtl8821ae_check_positive()
743 rtlhal->package_type << 12 | in _rtl8821ae_check_positive()
747 u32 driver2 = rtlhal->type_glna << 0 | in _rtl8821ae_check_positive()
748 rtlhal->type_gpa << 8 | in _rtl8821ae_check_positive()
749 rtlhal->type_alna << 16 | in _rtl8821ae_check_positive()
750 rtlhal->type_apa << 24; in _rtl8821ae_check_positive()
763 rtlhal->board_type, rtlhal->package_type); in _rtl8821ae_check_positive()
809 u32 _board = rtlefuse->board_type; /*need efuse define*/ in _rtl8821ae_check_condition()
892 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_init_tx_power_by_rate()
901 rtlphy->tx_power_by_rate_offset[band] in _rtl8821ae_phy_init_tx_power_by_rate()
911 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_set_txpower_by_rate_base()
922 rtlphy->txpwr_by_rate_base_24g[path][txnum][0] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
925 rtlphy->txpwr_by_rate_base_24g[path][txnum][1] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
928 rtlphy->txpwr_by_rate_base_24g[path][txnum][2] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
931 rtlphy->txpwr_by_rate_base_24g[path][txnum][3] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
934 rtlphy->txpwr_by_rate_base_24g[path][txnum][4] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
937 rtlphy->txpwr_by_rate_base_24g[path][txnum][5] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
948 rtlphy->txpwr_by_rate_base_5g[path][txnum][0] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
951 rtlphy->txpwr_by_rate_base_5g[path][txnum][1] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
954 rtlphy->txpwr_by_rate_base_5g[path][txnum][2] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
957 rtlphy->txpwr_by_rate_base_5g[path][txnum][3] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
960 rtlphy->txpwr_by_rate_base_5g[path][txnum][4] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
979 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_txpower_by_rate_base()
992 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][0]; in _rtl8821ae_phy_get_txpower_by_rate_base()
995 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][1]; in _rtl8821ae_phy_get_txpower_by_rate_base()
998 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][2]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1001 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][3]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1004 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][4]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1007 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][5]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1018 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][0]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1021 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][1]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1024 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][2]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1027 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][3]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1030 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][4]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1049 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_store_txpower_by_rate_base()
1054 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][0] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1058 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][2] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1062 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][4] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1066 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][6] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1070 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][8] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1074 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][11] >> 8) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1078 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][2] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1082 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][4] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1086 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][6] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1090 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][8] >> 24) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1094 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][11] >> 8) & 0xFF; in _rtl8821ae_phy_store_txpower_by_rate_base()
1107 for (i = 3; i >= 0; --i) { in _phy_convert_txpower_dbm_to_relative_value()
1114 temp_value = (temp_value > base_val) ? temp_value - in _phy_convert_txpower_dbm_to_relative_value()
1115 base_val : base_val - temp_value; in _phy_convert_txpower_dbm_to_relative_value()
1128 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1136 temp_pwrlmt = rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1144 rtlphy->txpwr_limit_5g[regulation][bw][2][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1145 rtlphy->txpwr_limit_5g[regulation][bw][4][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1147 rtlphy->txpwr_limit_5g[regulation][bw][4][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1148 rtlphy->txpwr_limit_5g[regulation][bw][2][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1150 rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1151 rtlphy->txpwr_limit_5g[regulation][bw][5][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1153 rtlphy->txpwr_limit_5g[regulation][bw][5][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1154 rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1296 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1333 temp_pwrlmt = rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1341 rtlphy->txpwr_by_rate_base_24g[rf_path][RF_2TX][base_index2_4G]; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1344 rtlphy->txpwr_by_rate_base_24g[rf_path][RF_1TX][base_index2_4G]; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1347 temp_value = temp_pwrlmt - bw40_pwr_base_dbm2_4G; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1348 rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1354 …gulation %d][bw %d][rateSection %d][channel %d] = %d\n(TxPwrLimit in dBm %d - BW40PwrLmt2_4G[chann… in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1356 rtlphy->txpwr_limit_2_4g[regulation][bw] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1394 temp_pwrlmt = rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1403 rtlphy->txpwr_by_rate_base_5g[rf_path] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1407 rtlphy->txpwr_by_rate_base_5g[rf_path] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1412 temp_pwrlmt - bw40_pwr_base_dbm5G; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1413 rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1419 …egulation %d][bw %d][rateSection %d][channel %d] =%d\n(TxPwrLimit in dBm %d - BW40PwrLmt5G[chnl gr… in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1421 channel, rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1436 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_init_txpower_limit()
1447 rtlphy->txpwr_limit_2_4g in _rtl8821ae_phy_init_txpower_limit()
1456 rtlphy->txpwr_limit_5g in _rtl8821ae_phy_init_txpower_limit()
1468 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1474 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][0], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1479 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][1], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1482 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][2], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1487 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][3], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1490 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][4], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1496 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][5], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1500 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][6], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1505 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][7], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1508 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][8], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1511 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1516 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1519 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][10], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1522 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][11], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1527 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][1], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1530 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][2], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1535 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][3], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1538 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][4], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1543 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][5], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1546 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][6], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1551 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][7], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1554 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][8], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1557 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1562 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1565 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][10], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1568 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][11], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1591 *pint += (str[i] - '0'); in _rtl8812ae_get_integer_from_string()
1606 num--; in _rtl8812ae_eq_n_byte()
1617 s8 channel_index = -1; in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1621 channel_index = channel - 1; in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1631 if (channel_index == -1) in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1646 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_set_txpower_limit()
1702 if (ret == -1) in _rtl8812ae_phy_set_txpower_limit()
1707 prev_power_limit = rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_set_txpower_limit()
1712 rtlphy->txpwr_limit_2_4g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1719 rtlphy->txpwr_limit_2_4g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1726 if (ret == -1) in _rtl8812ae_phy_set_txpower_limit()
1731 prev_power_limit = rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1736 rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1742 rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1770 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_read_and_config_txpwr_lmt()
1798 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_bb8821a_config_parafile()
1805 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_phy_bb8821a_config_parafile()
1815 if (!rtlefuse->autoload_failflag) { in _rtl8821ae_phy_bb8821a_config_parafile()
1827 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_phy_bb8821a_config_parafile()
1837 rtlphy->cck_high_power = (bool)(rtl_get_bbreg(hw, in _rtl8821ae_phy_bb8821a_config_parafile()
1902 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in _rtl8821ae_phy_config_mac_with_headerfile()
1925 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_headerfile()
1937 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_headerfile()
1957 index = (u8)((regaddr - 0xC20) / 4); in _rtl8821ae_get_rate_section_index()
1959 index = (u8)((regaddr - 0xE20) / 4); in _rtl8821ae_get_rate_section_index()
1972 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_store_tx_power_by_rate()
1981 rfpath = MAX_RF_PATH - 1; in _rtl8821ae_store_tx_power_by_rate()
1985 txnum = MAX_RF_PATH - 1; in _rtl8821ae_store_tx_power_by_rate()
1987 rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; in _rtl8821ae_store_tx_power_by_rate()
1991 rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section]); in _rtl8821ae_store_tx_power_by_rate()
2004 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2026 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE && in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2032 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2130 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_hw_reg_originalvalue()
2132 rtlphy->default_initialgain[0] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2134 rtlphy->default_initialgain[1] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2136 rtlphy->default_initialgain[2] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2138 rtlphy->default_initialgain[3] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2143 rtlphy->default_initialgain[0], in rtl8821ae_phy_get_hw_reg_originalvalue()
2144 rtlphy->default_initialgain[1], in rtl8821ae_phy_get_hw_reg_originalvalue()
2145 rtlphy->default_initialgain[2], in rtl8821ae_phy_get_hw_reg_originalvalue()
2146 rtlphy->default_initialgain[3]); in rtl8821ae_phy_get_hw_reg_originalvalue()
2148 rtlphy->framesync = (u8)rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2150 rtlphy->framesync_c34 = rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2155 ROFDM0_RXDETECTOR3, rtlphy->framesync); in rtl8821ae_phy_get_hw_reg_originalvalue()
2161 struct rtl_phy *rtlphy = &rtlpriv->phy; in phy_init_bb_rf_register_definition()
2163 rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2164 rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2166 rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2167 rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2169 rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2170 rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2172 rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = RA_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2173 rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = RB_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2175 rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2176 rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2178 rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RA_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2179 rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RB_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2181 rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = RA_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2182 rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = RB_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2188 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_txpower_level()
2192 txpwr_level = rtlphy->cur_cck_txpwridx; in rtl8821ae_phy_get_txpower_level()
2195 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2202 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2219 *chnl_index = channel - 1; in _rtl8821ae_phy_get_chnl_index()
2337 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_get_txpower_limit()
2338 short band_temp = -1, regulation = -1, bandwidth_temp = -1, in _rtl8812ae_phy_get_txpower_limit()
2339 rate_section = -1, channel_temp = -1; in _rtl8812ae_phy_get_txpower_limit()
2343 if (rtlefuse->eeprom_regulatory == 2) in _rtl8812ae_phy_get_txpower_limit()
2453 if (band_temp == -1 || regulation == -1 || bandwidth_temp == -1 || in _rtl8812ae_phy_get_txpower_limit()
2454 rate_section == -1 || channel_temp == -1) { in _rtl8812ae_phy_get_txpower_limit()
2472 limits[i] = rtlphy->txpwr_limit_2_4g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2477 rtlphy->txpwr_limit_2_4g[regu][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2484 limits[i] = rtlphy->txpwr_limit_5g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2489 rtlphy->txpwr_limit_5g[regu][chnl] in _rtl8812ae_phy_get_txpower_limit()
2502 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_txpower_by_rate()
2580 tx_pwr_diff = (u8)(rtlphy->tx_power_by_rate_offset[band][path] in _rtl8821ae_phy_get_txpower_by_rate()
2584 if (rtlpriv->efuse.eeprom_regulatory != 2) { in _rtl8821ae_phy_get_txpower_by_rate()
2586 rtlphy->current_chan_bw, path, rate, in _rtl8821ae_phy_get_txpower_by_rate()
2587 rtlphy->current_channel); in _rtl8821ae_phy_get_txpower_by_rate()
2592 if (tx_pwr_diff < (-limit)) in _rtl8821ae_phy_get_txpower_by_rate()
2593 tx_pwr_diff = -limit; in _rtl8821ae_phy_get_txpower_by_rate()
2615 u8 index = (channel - 1); in _rtl8821ae_get_txpower_index()
2616 u8 txpower = 0; in _rtl8821ae_get_txpower_index() local
2620 if (((rtlhal->current_bandtype == BAND_ON_2_4G) && in _rtl8821ae_get_txpower_index()
2622 ((rtlhal->current_bandtype == BAND_ON_5G) && (channel <= 14))) { in _rtl8821ae_get_txpower_index()
2631 txpower = rtlefuse->txpwrlevel_cck[path][index]; in _rtl8821ae_get_txpower_index()
2633 txpower = rtlefuse->txpwrlevel_ht40_1s[path][index]; in _rtl8821ae_get_txpower_index()
2639 txpower += rtlefuse->txpwr_legacyhtdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2644 txpower += rtlefuse->txpwr_ht20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2647 txpower += rtlefuse->txpwr_ht20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2651 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2654 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2659 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2663 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2667 txpower = rtlefuse->txpwr_5g_bw40base[path][index]; in _rtl8821ae_get_txpower_index()
2674 txpower += rtlefuse->txpwr_5g_ofdmdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2680 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2684 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2689 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2693 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2704 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2705 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2709 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2710 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S] in _rtl8821ae_get_txpower_index()
2711 + rtlefuse->txpwr_5g_bw80diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2714 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_get_txpower_index()
2721 txpower -= powerdiff_byrate; in _rtl8821ae_get_txpower_index()
2723 txpower += powerdiff_byrate; in _rtl8821ae_get_txpower_index()
2726 txpower += rtlpriv->dm.remnant_ofdm_swing_idx[path]; in _rtl8821ae_get_txpower_index()
2728 txpower += rtlpriv->dm.remnant_cck_idx; in _rtl8821ae_get_txpower_index()
2730 if (txpower > MAX_POWER_INDEX) in _rtl8821ae_get_txpower_index()
2731 txpower = MAX_POWER_INDEX; in _rtl8821ae_get_txpower_index()
2733 return txpower; in _rtl8821ae_get_txpower_index()
3150 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_set_txpower_level_by_path()
3157 rtlphy->current_chan_bw, in _rtl8821ae_phy_set_txpower_level_by_path()
3168 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_txpower_training_by_path()
3173 if (path >= rtlphy->num_total_rfpath) in _rtl8821ae_phy_txpower_training_by_path()
3191 power_level = power_level - 10; in _rtl8821ae_phy_txpower_training_by_path()
3193 power_level = power_level - 8; in _rtl8821ae_phy_txpower_training_by_path()
3195 power_level = power_level - 6; in _rtl8821ae_phy_txpower_training_by_path()
3208 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level_by_path()
3237 if (rtlhal->current_bandtype == BAND_ON_2_4G) in rtl8821ae_phy_set_txpower_level_by_path()
3248 if (rtlphy->num_total_rfpath >= 2) { in rtl8821ae_phy_set_txpower_level_by_path()
3257 _rtl8821ae_phy_txpower_training_by_path(hw, rtlphy->current_chan_bw, in rtl8821ae_phy_set_txpower_level_by_path()
3261 /*just in case, write txpower in DW, to reduce time*/
3265 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level()
3268 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; ++path) in rtl8821ae_phy_set_txpower_level()
3281 offset = -7; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3285 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3288 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3305 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3312 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3319 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3355 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_secondary_chnl()
3359 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) { in _rtl8821ae_phy_get_secondary_chnl()
3360 if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3362 else if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3367 if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3368 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3370 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3371 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3373 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3374 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3376 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3377 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3381 } else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { in _rtl8821ae_phy_get_secondary_chnl()
3382 if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3384 else if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3395 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode_callback()
3401 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? in rtl8821ae_phy_set_bw_mode_callback()
3403 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40 ? in rtl8821ae_phy_set_bw_mode_callback()
3406 _rtl8821ae_phy_set_reg_bw(rtlpriv, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3410 switch (rtlphy->current_chan_bw) { in rtl8821ae_phy_set_bw_mode_callback()
3415 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3426 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3429 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3451 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3454 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3464 rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3468 rtl8812ae_fixspur(hw, rtlphy->current_chan_bw, rtlphy->current_channel); in rtl8821ae_phy_set_bw_mode_callback()
3470 rtl8821ae_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3471 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode_callback()
3480 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode()
3482 u8 tmp_bw = rtlphy->current_chan_bw; in rtl8821ae_phy_set_bw_mode()
3484 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_set_bw_mode()
3486 rtlphy->set_bwmode_inprogress = true; in rtl8821ae_phy_set_bw_mode()
3492 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode()
3493 rtlphy->current_chan_bw = tmp_bw; in rtl8821ae_phy_set_bw_mode()
3501 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl_callback()
3502 u8 channel = rtlphy->current_channel; in rtl8821ae_phy_sw_chnl_callback()
3507 "switch to channel%d\n", rtlphy->current_channel); in rtl8821ae_phy_sw_chnl_callback()
3523 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; path++) { in rtl8821ae_phy_sw_chnl_callback()
3539 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_sw_chnl_callback()
3555 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl()
3558 u8 channel = rtlphy->current_channel; in rtl8821ae_phy_sw_chnl()
3560 if (rtlphy->sw_chnl_inprogress) in rtl8821ae_phy_sw_chnl()
3562 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_sw_chnl()
3570 while (rtlphy->lck_inprogress && timecount < timeout) { in rtl8821ae_phy_sw_chnl()
3575 if (rtlphy->current_channel > 14 && rtlhal->current_bandtype != BAND_ON_5G) in rtl8821ae_phy_sw_chnl()
3577 else if (rtlphy->current_channel <= 14 && rtlhal->current_bandtype != BAND_ON_2_4G) in rtl8821ae_phy_sw_chnl()
3580 rtlphy->sw_chnl_inprogress = true; in rtl8821ae_phy_sw_chnl()
3586 rtlphy->current_channel, rtlhal->current_bandtype); in rtl8821ae_phy_sw_chnl()
3591 rtl8821ae_phy_set_txpower_level(hw, rtlphy->current_channel); in rtl8821ae_phy_sw_chnl()
3594 rtlphy->sw_chnl_inprogress = false; in rtl8821ae_phy_sw_chnl()
3612 return place-13; in _rtl8812ae_get_right_chnl_place_for_iqk()
3629 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_macbb()
3643 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_afe()
3657 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_rf()
3674 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_configure_mac()
3687 /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx_fill_iqc()
3713 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_rx_fill_iqc()
3733 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_iqk_tx()
3748 rtlphy->current_chan_bw); in _rtl8821ae_iqk_tx()
3749 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) in _rtl8821ae_iqk_tx()
3756 /* Path-A LOK */ in _rtl8821ae_iqk_tx()
3757 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_tx()
3758 /*========Path-A AFE all on========*/ in _rtl8821ae_iqk_tx()
3771 rtl_set_bbreg(hw, 0xc00, 0xf, 0x4); /*hardware 3-wire off*/ in _rtl8821ae_iqk_tx()
3794 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3797 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3811 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3814 switch (rtlphy->current_chan_bw) { in _rtl8821ae_iqk_tx()
3825 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3828 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3844 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3846 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3870 tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
3929 tx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
3930 tx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
3991 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4007 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4033 rx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
4104 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4122 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4127 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /* pDM_Odm->SupportInterface == 1 */ in _rtl8821ae_iqk_tx()
4181 rx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
4182 rx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
4189 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4202 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4261 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4279 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4284 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /*pDM_Odm->SupportInterface == 1*/ in _rtl8821ae_iqk_tx()
4339 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4368 dx = (tx_x0[i]>>21) - (tx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4369 if (dx < 3 && dx > -3) { in _rtl8821ae_iqk_tx()
4370 dy = (tx_y0[i]>>21) - (tx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4371 if (dy < 3 && dy > -3) { in _rtl8821ae_iqk_tx()
4398 dx = (rx_x0[i]>>21) - (rx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4399 if (dx < 4 && dx > -4) { in _rtl8821ae_iqk_tx()
4400 dy = (rx_y0[i]>>21) - (rx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4401 if (dy < 4 && dy > -4) { in _rtl8821ae_iqk_tx()
4431 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_rf()
4453 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_afe()
4457 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_restore_afe()
4478 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_macbb()
4550 rtldm->thermalvalue_iqk = thermal_value; in rtl8812ae_do_iqk()
4557 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_iq_calibrate()
4559 if (!rtlphy->lck_inprogress) { in rtl8821ae_phy_iq_calibrate()
4560 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4561 rtlphy->lck_inprogress = true; in rtl8821ae_phy_iq_calibrate()
4562 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4566 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4567 rtlphy->lck_inprogress = false; in rtl8821ae_phy_iq_calibrate()
4568 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4575 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_reset_iqk_result()
4580 (int)(sizeof(rtlphy->iqk_matrix) / in rtl8821ae_reset_iqk_result()
4585 rtlphy->iqk_matrix[i].value[0][0] = 0x100; in rtl8821ae_reset_iqk_result()
4586 rtlphy->iqk_matrix[i].value[0][2] = 0x100; in rtl8821ae_reset_iqk_result()
4587 rtlphy->iqk_matrix[i].value[0][4] = 0x100; in rtl8821ae_reset_iqk_result()
4588 rtlphy->iqk_matrix[i].value[0][6] = 0x100; in rtl8821ae_reset_iqk_result()
4590 rtlphy->iqk_matrix[i].value[0][1] = 0x0; in rtl8821ae_reset_iqk_result()
4591 rtlphy->iqk_matrix[i].value[0][3] = 0x0; in rtl8821ae_reset_iqk_result()
4592 rtlphy->iqk_matrix[i].value[0][5] = 0x0; in rtl8821ae_reset_iqk_result()
4593 rtlphy->iqk_matrix[i].value[0][7] = 0x0; in rtl8821ae_reset_iqk_result()
4595 rtlphy->iqk_matrix[i].iqk_done = false; in rtl8821ae_reset_iqk_result()
4606 rtldm->thermalvalue_iqk = thermal_value; in rtl8821ae_do_iqk()
4626 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io_cmd()
4630 "-->IO Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io_cmd()
4631 iotype, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io_cmd()
4651 if (postprocessing && !rtlphy->set_io_inprogress) { in rtl8821ae_phy_set_io_cmd()
4652 rtlphy->set_io_inprogress = true; in rtl8821ae_phy_set_io_cmd()
4653 rtlphy->current_io_type = iotype; in rtl8821ae_phy_set_io_cmd()
4665 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_phy_set_io()
4666 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io()
4669 "--->Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io()
4670 rtlphy->current_io_type, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io()
4671 switch (rtlphy->current_io_type) { in rtl8821ae_phy_set_io()
4673 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4675 rtl8821ae_dm_write_dig(hw, rtlphy->initgain_backup.xaagccore1); in rtl8821ae_phy_set_io()
4677 rtlphy->initgain_backup.cca); in rtl8821ae_phy_set_io()
4680 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4682 rtlphy->initgain_backup.xaagccore1 = dm_digtable->cur_igvalue; in rtl8821ae_phy_set_io()
4684 rtlphy->initgain_backup.cca = dm_digtable->cur_cck_cca_thres; in rtl8821ae_phy_set_io()
4691 rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4694 rtlphy->set_io_inprogress = false; in rtl8821ae_phy_set_io()
4696 "(%#x)\n", rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4723 if ((ppsc->rfpwr_state == ERFOFF) && in _rtl8821ae_phy_set_rf_power_state()
4739 jiffies_to_msecs(jiffies - in _rtl8821ae_phy_set_rf_power_state()
4740 ppsc->last_sleep_jiffies)); in _rtl8821ae_phy_set_rf_power_state()
4741 ppsc->last_awake_jiffies = jiffies; in _rtl8821ae_phy_set_rf_power_state()
4744 if (mac->link_state == MAC80211_LINKED) { in _rtl8821ae_phy_set_rf_power_state()
4745 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4748 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4755 ring = &pcipriv->dev.tx_ring[queue_id]; in _rtl8821ae_phy_set_rf_power_state()
4757 skb_queue_len(&ring->queue) == 0) { in _rtl8821ae_phy_set_rf_power_state()
4764 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4774 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4779 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { in _rtl8821ae_phy_set_rf_power_state()
4785 if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { in _rtl8821ae_phy_set_rf_power_state()
4786 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4789 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4801 ppsc->rfpwr_state = rfpwr_state; in _rtl8821ae_phy_set_rf_power_state()
4812 if (rfpwr_state == ppsc->rfpwr_state) in rtl8821ae_phy_set_rf_power_state()