Lines Matching +full:21 +full:- +full:k

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2010 Realtek Corporation.*/
51 if (IS_VENDOR_8812A_C_CUT(rtlhal->version)) { in rtl8812ae_fixspur()
78 } else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8812ae_fixspur()
146 spin_lock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_query_rf_reg()
152 spin_unlock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_query_rf_reg()
172 spin_lock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_set_rf_reg()
183 spin_unlock(&rtlpriv->locks.rf_lock); in rtl8821ae_phy_set_rf_reg()
207 !((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
208 (IS_VENDOR_8812A_C_CUT(rtlhal->version)))) in _rtl8821ae_phy_rf_serial_read()
219 if ((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
220 (IS_VENDOR_8812A_C_CUT(rtlhal->version))) in _rtl8821ae_phy_rf_serial_read()
244 !((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in _rtl8821ae_phy_rf_serial_read()
245 (IS_VENDOR_8812A_C_CUT(rtlhal->version)))) in _rtl8821ae_phy_rf_serial_read()
255 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_rf_serial_write()
256 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; in _rtl8821ae_phy_rf_serial_write()
268 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); in _rtl8821ae_phy_rf_serial_write()
270 "RFW-%d Addr[0x%x]=0x%x\n", in _rtl8821ae_phy_rf_serial_write()
271 rfpath, pphyreg->rf3wire_offset, data_and_addr); in _rtl8821ae_phy_rf_serial_write()
288 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_bb_config()
306 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_bb_config()
307 crystal_cap = rtlefuse->crystalcap & 0x3F; in rtl8821ae_phy_bb_config()
311 crystal_cap = rtlefuse->crystalcap & 0x3F; in rtl8821ae_phy_bb_config()
315 rtlphy->reg_837 = rtl_read_byte(rtlpriv, 0x837); in rtl8821ae_phy_bb_config()
331 switch (rtlhal->rfe_type) { in _rtl8812ae_phy_set_rfe_reg_24g()
353 if (rtlpriv->btcoexist.bt_coexistence) { in _rtl8812ae_phy_set_rfe_reg_24g()
379 switch (rtlhal->rfe_type) { in _rtl8812ae_phy_set_rfe_reg_5g()
387 if (rtlpriv->btcoexist.bt_coexistence) { in _rtl8812ae_phy_set_rfe_reg_5g()
434 s8 reg_swing_2g = -1;/* 0xff; */ in phy_get_tx_swing_8812A()
435 s8 reg_swing_5g = -1;/* 0xff; */ in phy_get_tx_swing_8812A()
436 s8 swing_2g = -1 * reg_swing_2g; in phy_get_tx_swing_8812A()
437 s8 swing_5g = -1 * reg_swing_5g; in phy_get_tx_swing_8812A()
439 const s8 auto_temp = -1; in phy_get_tx_swing_8812A()
444 (int)rtlefuse->autoload_failflag); in phy_get_tx_swing_8812A()
446 if (rtlefuse->autoload_failflag) { in phy_get_tx_swing_8812A()
448 rtldm->swing_diff_2g = swing_2g; in phy_get_tx_swing_8812A()
451 } else if (swing_2g == -3) { in phy_get_tx_swing_8812A()
452 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
453 } else if (swing_2g == -6) { in phy_get_tx_swing_8812A()
454 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
455 } else if (swing_2g == -9) { in phy_get_tx_swing_8812A()
456 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
458 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
462 rtldm->swing_diff_5g = swing_5g; in phy_get_tx_swing_8812A()
465 } else if (swing_5g == -3) { in phy_get_tx_swing_8812A()
466 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
467 } else if (swing_5g == -6) { in phy_get_tx_swing_8812A()
468 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
469 } else if (swing_5g == -9) { in phy_get_tx_swing_8812A()
470 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
472 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in phy_get_tx_swing_8812A()
473 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
476 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
481 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
482 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
483 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
494 } else if (swing_2g == -3) { in phy_get_tx_swing_8812A()
495 swing = 0x05; /* -3 dB */ in phy_get_tx_swing_8812A()
496 } else if (swing_2g == -6) { in phy_get_tx_swing_8812A()
497 swing = 0x0A; /* -6 dB */ in phy_get_tx_swing_8812A()
498 } else if (swing_2g == -9) { in phy_get_tx_swing_8812A()
499 swing = 0xFF; /* -9 dB */ in phy_get_tx_swing_8812A()
509 } else if (swing_5g == -3) { in phy_get_tx_swing_8812A()
510 swing = 0x05; /* -3 dB */ in phy_get_tx_swing_8812A()
511 } else if (swing_5g == -6) { in phy_get_tx_swing_8812A()
512 swing = 0x0A; /* -6 dB */ in phy_get_tx_swing_8812A()
513 } else if (swing_5g == -9) { in phy_get_tx_swing_8812A()
514 swing = 0xFF; /* -9 dB */ in phy_get_tx_swing_8812A()
526 /* 3 Path-A */ in phy_get_tx_swing_8812A()
529 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
531 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
535 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
537 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
538 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
541 rtldm->swing_diff_2g = -6; in phy_get_tx_swing_8812A()
543 rtldm->swing_diff_5g = -6; in phy_get_tx_swing_8812A()
544 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
547 rtldm->swing_diff_2g = -9; in phy_get_tx_swing_8812A()
549 rtldm->swing_diff_5g = -9; in phy_get_tx_swing_8812A()
550 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
552 /* 3 Path-B */ in phy_get_tx_swing_8812A()
555 rtldm->swing_diff_2g = 0; in phy_get_tx_swing_8812A()
557 rtldm->swing_diff_5g = 0; in phy_get_tx_swing_8812A()
561 rtldm->swing_diff_2g = -3; in phy_get_tx_swing_8812A()
563 rtldm->swing_diff_5g = -3; in phy_get_tx_swing_8812A()
564 out = 0x16A; /* -3 dB */ in phy_get_tx_swing_8812A()
567 rtldm->swing_diff_2g = -6; in phy_get_tx_swing_8812A()
569 rtldm->swing_diff_5g = -6; in phy_get_tx_swing_8812A()
570 out = 0x101; /* -6 dB */ in phy_get_tx_swing_8812A()
573 rtldm->swing_diff_2g = -9; in phy_get_tx_swing_8812A()
575 rtldm->swing_diff_5g = -9; in phy_get_tx_swing_8812A()
576 out = 0x0B6; /* -9 dB */ in phy_get_tx_swing_8812A()
590 u8 current_band = rtlhal->current_bandtype; in rtl8821ae_phy_switch_wirelessband()
595 rtlhal->current_bandtype = (enum band_type) band; in rtl8821ae_phy_switch_wirelessband()
597 if (rtlhal->current_bandtype == BAND_ON_2_4G) { in rtl8821ae_phy_switch_wirelessband()
601 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
608 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_switch_wirelessband()
613 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
621 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_phy_switch_wirelessband()
631 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
661 without long-run verification for scan issue. */ in rtl8821ae_phy_switch_wirelessband()
664 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_phy_switch_wirelessband()
669 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
677 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_phy_switch_wirelessband()
685 rtlpriv->dm.ofdm_index[RF90_PATH_A]); in rtl8821ae_phy_switch_wirelessband()
688 if ((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) || in rtl8821ae_phy_switch_wirelessband()
689 (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)) { in rtl8821ae_phy_switch_wirelessband()
690 /* 0xC1C[31:21] */ in rtl8821ae_phy_switch_wirelessband()
693 /* 0xE1C[31:21] */ in rtl8821ae_phy_switch_wirelessband()
703 (rtldm->swing_diff_2g - rtldm->swing_diff_5g); in rtl8821ae_phy_switch_wirelessband()
706 (-1 * bb_diff_between_band); in rtl8821ae_phy_switch_wirelessband()
707 rtldm->default_ofdm_index += bb_diff_between_band * 2; in rtl8821ae_phy_switch_wirelessband()
723 u32 cut_ver = ((rtlhal->version & CHIP_VER_RTL_MASK) in _rtl8821ae_check_positive()
725 u32 intf = (rtlhal->interface == INTF_USB ? BIT(1) : BIT(0)); in _rtl8821ae_check_positive()
727 u8 board_type = ((rtlhal->board_type & BIT(4)) >> 4) << 0 | /* _GLNA */ in _rtl8821ae_check_positive()
728 ((rtlhal->board_type & BIT(3)) >> 3) << 1 | /* _GPA */ in _rtl8821ae_check_positive()
729 ((rtlhal->board_type & BIT(7)) >> 7) << 2 | /* _ALNA */ in _rtl8821ae_check_positive()
730 ((rtlhal->board_type & BIT(6)) >> 6) << 3 | /* _APA */ in _rtl8821ae_check_positive()
731 ((rtlhal->board_type & BIT(2)) >> 2) << 4; /* _BT */ in _rtl8821ae_check_positive()
737 rtlhal->package_type << 12 | in _rtl8821ae_check_positive()
741 u32 driver2 = rtlhal->type_glna << 0 | in _rtl8821ae_check_positive()
742 rtlhal->type_gpa << 8 | in _rtl8821ae_check_positive()
743 rtlhal->type_alna << 16 | in _rtl8821ae_check_positive()
744 rtlhal->type_apa << 24; in _rtl8821ae_check_positive()
757 rtlhal->board_type, rtlhal->package_type); in _rtl8821ae_check_positive()
803 u32 _board = rtlefuse->board_type; /*need efuse define*/ in _rtl8821ae_check_condition()
886 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_init_tx_power_by_rate()
895 rtlphy->tx_power_by_rate_offset[band] in _rtl8821ae_phy_init_tx_power_by_rate()
905 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_set_txpower_by_rate_base()
916 rtlphy->txpwr_by_rate_base_24g[path][txnum][0] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
919 rtlphy->txpwr_by_rate_base_24g[path][txnum][1] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
922 rtlphy->txpwr_by_rate_base_24g[path][txnum][2] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
925 rtlphy->txpwr_by_rate_base_24g[path][txnum][3] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
928 rtlphy->txpwr_by_rate_base_24g[path][txnum][4] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
931 rtlphy->txpwr_by_rate_base_24g[path][txnum][5] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
942 rtlphy->txpwr_by_rate_base_5g[path][txnum][0] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
945 rtlphy->txpwr_by_rate_base_5g[path][txnum][1] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
948 rtlphy->txpwr_by_rate_base_5g[path][txnum][2] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
951 rtlphy->txpwr_by_rate_base_5g[path][txnum][3] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
954 rtlphy->txpwr_by_rate_base_5g[path][txnum][4] = value; in _rtl8821ae_phy_set_txpower_by_rate_base()
973 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_txpower_by_rate_base()
986 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][0]; in _rtl8821ae_phy_get_txpower_by_rate_base()
989 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][1]; in _rtl8821ae_phy_get_txpower_by_rate_base()
992 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][2]; in _rtl8821ae_phy_get_txpower_by_rate_base()
995 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][3]; in _rtl8821ae_phy_get_txpower_by_rate_base()
998 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][4]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1001 value = rtlphy->txpwr_by_rate_base_24g[path][txnum][5]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1012 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][0]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1015 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][1]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1018 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][2]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1021 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][3]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1024 value = rtlphy->txpwr_by_rate_base_5g[path][txnum][4]; in _rtl8821ae_phy_get_txpower_by_rate_base()
1043 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_store_txpower_by_rate_base()
1048 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()
1052 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()
1056 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()
1060 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()
1064 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()
1068 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()
1072 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()
1076 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()
1080 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()
1084 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()
1088 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()
1101 for (i = 3; i >= 0; --i) { in _phy_convert_txpower_dbm_to_relative_value()
1108 temp_value = (temp_value > base_val) ? temp_value - in _phy_convert_txpower_dbm_to_relative_value()
1109 base_val : base_val - temp_value; in _phy_convert_txpower_dbm_to_relative_value()
1122 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1130 temp_pwrlmt = rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1138 rtlphy->txpwr_limit_5g[regulation][bw][2][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1139 rtlphy->txpwr_limit_5g[regulation][bw][4][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1141 rtlphy->txpwr_limit_5g[regulation][bw][4][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1142 rtlphy->txpwr_limit_5g[regulation][bw][2][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1144 rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1145 rtlphy->txpwr_limit_5g[regulation][bw][5][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1147 rtlphy->txpwr_limit_5g[regulation][bw][5][channel][RF90_PATH_A] = in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1148 rtlphy->txpwr_limit_5g[regulation][bw][3][channel][RF90_PATH_A]; in _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit()
1290 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1327 temp_pwrlmt = rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1335 rtlphy->txpwr_by_rate_base_24g[rf_path][RF_2TX][base_index2_4G]; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1338 rtlphy->txpwr_by_rate_base_24g[rf_path][RF_1TX][base_index2_4G]; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1341 temp_value = temp_pwrlmt - bw40_pwr_base_dbm2_4G; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1342 rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1348 …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()
1350 rtlphy->txpwr_limit_2_4g[regulation][bw] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1388 temp_pwrlmt = rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1397 rtlphy->txpwr_by_rate_base_5g[rf_path] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1401 rtlphy->txpwr_by_rate_base_5g[rf_path] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1406 temp_pwrlmt - bw40_pwr_base_dbm5G; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1407 rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1413 …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()
1415 channel, rtlphy->txpwr_limit_5g[regulation] in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1430 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_init_txpower_limit()
1431 u8 i, j, k, l, m; in _rtl8821ae_phy_init_txpower_limit() local
1438 for (k = 0; k < MAX_RATE_SECTION_NUM; ++k) in _rtl8821ae_phy_init_txpower_limit()
1441 rtlphy->txpwr_limit_2_4g in _rtl8821ae_phy_init_txpower_limit()
1442 [i][j][k][m][l] in _rtl8821ae_phy_init_txpower_limit()
1447 for (k = 0; k < MAX_RATE_SECTION_NUM; ++k) in _rtl8821ae_phy_init_txpower_limit()
1450 rtlphy->txpwr_limit_5g in _rtl8821ae_phy_init_txpower_limit()
1451 [i][j][k][m][l] in _rtl8821ae_phy_init_txpower_limit()
1462 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1468 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][0], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1473 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][1], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1476 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][2], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1481 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][3], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1484 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][4], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1490 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][5], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1494 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][6], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1499 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][7], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1502 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][8], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1505 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1510 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1513 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][10], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1516 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][11], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1521 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][1], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1524 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][2], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1529 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][3], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1532 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][4], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1537 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][5], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1540 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][6], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1545 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][7], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1548 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][8], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1551 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1556 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1559 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][10], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1562 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][11], in _rtl8821ae_phy_convert_txpower_dbm_to_relative_value()
1585 *pint += (str[i] - '0'); in _rtl8812ae_get_integer_from_string()
1599 s8 channel_index = -1; in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1603 channel_index = channel - 1; in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1613 if (channel_index == -1) in _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt()
1628 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_set_txpower_limit()
1684 if (ret == -1) in _rtl8812ae_phy_set_txpower_limit()
1689 prev_power_limit = rtlphy->txpwr_limit_2_4g[regulation] in _rtl8812ae_phy_set_txpower_limit()
1694 rtlphy->txpwr_limit_2_4g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1701 rtlphy->txpwr_limit_2_4g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1708 if (ret == -1) in _rtl8812ae_phy_set_txpower_limit()
1713 prev_power_limit = rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1718 rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1724 rtlphy->txpwr_limit_5g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1752 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_read_and_config_txpwr_lmt()
1780 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_bb8821a_config_parafile()
1787 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_phy_bb8821a_config_parafile()
1797 if (!rtlefuse->autoload_failflag) { in _rtl8821ae_phy_bb8821a_config_parafile()
1809 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_phy_bb8821a_config_parafile()
1819 rtlphy->cck_high_power = (bool)(rtl_get_bbreg(hw, in _rtl8821ae_phy_bb8821a_config_parafile()
1884 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in _rtl8821ae_phy_config_mac_with_headerfile()
1907 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_headerfile()
1919 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_headerfile()
1939 index = (u8)((regaddr - 0xC20) / 4); in _rtl8821ae_get_rate_section_index()
1941 index = (u8)((regaddr - 0xE20) / 4); in _rtl8821ae_get_rate_section_index()
1954 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_store_tx_power_by_rate()
1963 rfpath = MAX_RF_PATH - 1; in _rtl8821ae_store_tx_power_by_rate()
1967 txnum = MAX_RF_PATH - 1; in _rtl8821ae_store_tx_power_by_rate()
1969 rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; in _rtl8821ae_store_tx_power_by_rate()
1973 rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section]); in _rtl8821ae_store_tx_power_by_rate()
1986 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2008 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE && in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2014 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2106 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_hw_reg_originalvalue()
2108 rtlphy->default_initialgain[0] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2110 rtlphy->default_initialgain[1] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2112 rtlphy->default_initialgain[2] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2114 rtlphy->default_initialgain[3] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2119 rtlphy->default_initialgain[0], in rtl8821ae_phy_get_hw_reg_originalvalue()
2120 rtlphy->default_initialgain[1], in rtl8821ae_phy_get_hw_reg_originalvalue()
2121 rtlphy->default_initialgain[2], in rtl8821ae_phy_get_hw_reg_originalvalue()
2122 rtlphy->default_initialgain[3]); in rtl8821ae_phy_get_hw_reg_originalvalue()
2124 rtlphy->framesync = (u8)rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2126 rtlphy->framesync_c34 = rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2131 ROFDM0_RXDETECTOR3, rtlphy->framesync); in rtl8821ae_phy_get_hw_reg_originalvalue()
2137 struct rtl_phy *rtlphy = &rtlpriv->phy; in phy_init_bb_rf_register_definition()
2139 rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2140 rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2142 rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2143 rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2145 rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2146 rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2148 rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = RA_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2149 rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = RB_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2151 rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2152 rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2154 rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RA_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2155 rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RB_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2157 rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = RA_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2158 rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = RB_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2164 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_txpower_level()
2168 txpwr_level = rtlphy->cur_cck_txpwridx; in rtl8821ae_phy_get_txpower_level()
2171 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2178 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2195 *chnl_index = channel - 1; in _rtl8821ae_phy_get_chnl_index()
2313 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_get_txpower_limit()
2314 short band_temp = -1, regulation = -1, bandwidth_temp = -1, in _rtl8812ae_phy_get_txpower_limit()
2315 rate_section = -1, channel_temp = -1; in _rtl8812ae_phy_get_txpower_limit()
2319 if (rtlefuse->eeprom_regulatory == 2) in _rtl8812ae_phy_get_txpower_limit()
2429 if (band_temp == -1 || regulation == -1 || bandwidth_temp == -1 || in _rtl8812ae_phy_get_txpower_limit()
2430 rate_section == -1 || channel_temp == -1) { in _rtl8812ae_phy_get_txpower_limit()
2448 limits[i] = rtlphy->txpwr_limit_2_4g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2453 rtlphy->txpwr_limit_2_4g[regu][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2460 limits[i] = rtlphy->txpwr_limit_5g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2465 rtlphy->txpwr_limit_5g[regu][chnl] in _rtl8812ae_phy_get_txpower_limit()
2478 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_txpower_by_rate()
2556 tx_pwr_diff = (u8)(rtlphy->tx_power_by_rate_offset[band][path] in _rtl8821ae_phy_get_txpower_by_rate()
2560 if (rtlpriv->efuse.eeprom_regulatory != 2) { in _rtl8821ae_phy_get_txpower_by_rate()
2562 rtlphy->current_chan_bw, path, rate, in _rtl8821ae_phy_get_txpower_by_rate()
2563 rtlphy->current_channel); in _rtl8821ae_phy_get_txpower_by_rate()
2568 if (tx_pwr_diff < (-limit)) in _rtl8821ae_phy_get_txpower_by_rate()
2569 tx_pwr_diff = -limit; in _rtl8821ae_phy_get_txpower_by_rate()
2591 u8 index = (channel - 1); in _rtl8821ae_get_txpower_index()
2596 if (((rtlhal->current_bandtype == BAND_ON_2_4G) && in _rtl8821ae_get_txpower_index()
2598 ((rtlhal->current_bandtype == BAND_ON_5G) && (channel <= 14))) { in _rtl8821ae_get_txpower_index()
2607 txpower = rtlefuse->txpwrlevel_cck[path][index]; in _rtl8821ae_get_txpower_index()
2609 txpower = rtlefuse->txpwrlevel_ht40_1s[path][index]; in _rtl8821ae_get_txpower_index()
2615 txpower += rtlefuse->txpwr_legacyhtdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2620 txpower += rtlefuse->txpwr_ht20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2623 txpower += rtlefuse->txpwr_ht20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2627 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2630 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2635 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2639 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2643 txpower = rtlefuse->txpwr_5g_bw40base[path][index]; in _rtl8821ae_get_txpower_index()
2650 txpower += rtlefuse->txpwr_5g_ofdmdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2656 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2660 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2665 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2669 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2680 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2681 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2685 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2686 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S] in _rtl8821ae_get_txpower_index()
2687 + rtlefuse->txpwr_5g_bw80diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2690 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_get_txpower_index()
2697 txpower -= powerdiff_byrate; in _rtl8821ae_get_txpower_index()
2702 txpower += rtlpriv->dm.remnant_ofdm_swing_idx[path]; in _rtl8821ae_get_txpower_index()
2704 txpower += rtlpriv->dm.remnant_cck_idx; in _rtl8821ae_get_txpower_index()
3126 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_set_txpower_level_by_path()
3133 rtlphy->current_chan_bw, in _rtl8821ae_phy_set_txpower_level_by_path()
3144 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_txpower_training_by_path()
3149 if (path >= rtlphy->num_total_rfpath) in _rtl8821ae_phy_txpower_training_by_path()
3167 power_level = power_level - 10; in _rtl8821ae_phy_txpower_training_by_path()
3169 power_level = power_level - 8; in _rtl8821ae_phy_txpower_training_by_path()
3171 power_level = power_level - 6; in _rtl8821ae_phy_txpower_training_by_path()
3184 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level_by_path()
3213 if (rtlhal->current_bandtype == BAND_ON_2_4G) in rtl8821ae_phy_set_txpower_level_by_path()
3224 if (rtlphy->num_total_rfpath >= 2) { in rtl8821ae_phy_set_txpower_level_by_path()
3233 _rtl8821ae_phy_txpower_training_by_path(hw, rtlphy->current_chan_bw, in rtl8821ae_phy_set_txpower_level_by_path()
3241 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level()
3244 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; ++path) in rtl8821ae_phy_set_txpower_level()
3257 offset = -7; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3261 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3264 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3281 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3288 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3295 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3331 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_secondary_chnl()
3335 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) { in _rtl8821ae_phy_get_secondary_chnl()
3336 if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3338 else if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3343 if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3344 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3346 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3347 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3349 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3350 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3352 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3353 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3357 } else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { in _rtl8821ae_phy_get_secondary_chnl()
3358 if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3360 else if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3371 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode_callback()
3377 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? in rtl8821ae_phy_set_bw_mode_callback()
3379 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40 ? in rtl8821ae_phy_set_bw_mode_callback()
3382 _rtl8821ae_phy_set_reg_bw(rtlpriv, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3386 switch (rtlphy->current_chan_bw) { in rtl8821ae_phy_set_bw_mode_callback()
3391 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3402 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3405 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3420 /* 0x8ac[21,20,9:6,1,0]=8'b11100010 */ in rtl8821ae_phy_set_bw_mode_callback()
3427 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3430 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3440 rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3444 rtl8812ae_fixspur(hw, rtlphy->current_chan_bw, rtlphy->current_channel); in rtl8821ae_phy_set_bw_mode_callback()
3446 rtl8821ae_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3447 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode_callback()
3456 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode()
3458 u8 tmp_bw = rtlphy->current_chan_bw; in rtl8821ae_phy_set_bw_mode()
3460 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_set_bw_mode()
3462 rtlphy->set_bwmode_inprogress = true; in rtl8821ae_phy_set_bw_mode()
3468 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode()
3469 rtlphy->current_chan_bw = tmp_bw; in rtl8821ae_phy_set_bw_mode()
3477 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl_callback()
3478 u8 channel = rtlphy->current_channel; in rtl8821ae_phy_sw_chnl_callback()
3483 "switch to channel%d\n", rtlphy->current_channel); in rtl8821ae_phy_sw_chnl_callback()
3499 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; path++) { in rtl8821ae_phy_sw_chnl_callback()
3515 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_sw_chnl_callback()
3531 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl()
3535 if (rtlphy->sw_chnl_inprogress) in rtl8821ae_phy_sw_chnl()
3537 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_sw_chnl()
3545 while (rtlphy->lck_inprogress && timecount < timeout) { in rtl8821ae_phy_sw_chnl()
3550 if (rtlphy->current_channel > 14 && rtlhal->current_bandtype != BAND_ON_5G) in rtl8821ae_phy_sw_chnl()
3552 else if (rtlphy->current_channel <= 14 && rtlhal->current_bandtype != BAND_ON_2_4G) in rtl8821ae_phy_sw_chnl()
3555 rtlphy->sw_chnl_inprogress = true; in rtl8821ae_phy_sw_chnl()
3559 rtlphy->current_channel, rtlhal->current_bandtype); in rtl8821ae_phy_sw_chnl()
3564 rtl8821ae_phy_set_txpower_level(hw, rtlphy->current_channel); in rtl8821ae_phy_sw_chnl()
3567 rtlphy->sw_chnl_inprogress = false; in rtl8821ae_phy_sw_chnl()
3585 return place-13; in _rtl8812ae_get_right_chnl_place_for_iqk()
3602 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_macbb()
3616 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_afe()
3630 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_rf()
3647 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_configure_mac()
3660 /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx_fill_iqc()
3686 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_rx_fill_iqc()
3706 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_iqk_tx()
3716 int i, k, vdf_y[3], vdf_x[3], in _rtl8821ae_iqk_tx() local
3721 rtlphy->current_chan_bw); in _rtl8821ae_iqk_tx()
3722 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) in _rtl8821ae_iqk_tx()
3729 /* Path-A LOK */ in _rtl8821ae_iqk_tx()
3730 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_tx()
3731 /*========Path-A AFE all on========*/ in _rtl8821ae_iqk_tx()
3744 rtl_set_bbreg(hw, 0xc00, 0xf, 0x4); /*hardware 3-wire off*/ in _rtl8821ae_iqk_tx()
3767 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3770 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3784 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3787 switch (rtlphy->current_chan_bw) { in _rtl8821ae_iqk_tx()
3798 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3801 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3817 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3819 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3826 for (k = 0; k <= 2; k++) { in _rtl8821ae_iqk_tx()
3827 switch (k) { in _rtl8821ae_iqk_tx()
3840 "vdf_y[1] = %x;;;vdf_y[0] = %x\n", vdf_y[1]>>21 & 0x00007ff, vdf_y[0]>>21 & 0x00007ff); in _rtl8821ae_iqk_tx()
3842 "vdf_x[1] = %x;;;vdf_x[0] = %x\n", vdf_x[1]>>21 & 0x00007ff, vdf_x[0]>>21 & 0x00007ff); in _rtl8821ae_iqk_tx()
3843 tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
3880 vdf_x[k] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
3882 vdf_y[k] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
3901 if (k == 3) { in _rtl8821ae_iqk_tx()
3902 tx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
3903 tx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
3934 tx_x0[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
3936 tx_y0[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
3962 for (k = 0; k <= 2; k++) { in _rtl8821ae_iqk_tx()
3964 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3980 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3981 switch (k) { in _rtl8821ae_iqk_tx()
4000 vdf_y[1] >> 21 & 0x00007ff, in _rtl8821ae_iqk_tx()
4001 vdf_y[0] >> 21 & 0x00007ff); in _rtl8821ae_iqk_tx()
4004 vdf_x[1] >> 21 & 0x00007ff, in _rtl8821ae_iqk_tx()
4005 vdf_x[0] >> 21 & 0x00007ff); in _rtl8821ae_iqk_tx()
4006 rx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
4047 tx_x0_rxk[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4049 tx_y0_rxk[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4077 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4087 rtl_set_bbreg(hw, 0x978, 0x03FF8000, (tx_x0_rxk[cal])>>21&0x000007ff); in _rtl8821ae_iqk_tx()
4088 rtl_set_bbreg(hw, 0x978, 0x000007FF, (tx_y0_rxk[cal])>>21&0x000007ff); in _rtl8821ae_iqk_tx()
4095 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4100 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /* pDM_Odm->SupportInterface == 1 */ in _rtl8821ae_iqk_tx()
4102 if (k == 2) in _rtl8821ae_iqk_tx()
4130 vdf_x[k] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4132 vdf_y[k] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4153 if (k == 3) { in _rtl8821ae_iqk_tx()
4154 rx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
4155 rx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
4162 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4175 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4206 tx_x0_rxk[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4208 tx_y0_rxk[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4234 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4244 rtl_set_bbreg(hw, 0x978, 0x03FF8000, (tx_x0_rxk[cal])>>21&0x000007ff); in _rtl8821ae_iqk_tx()
4245 rtl_set_bbreg(hw, 0x978, 0x000007FF, (tx_y0_rxk[cal])>>21&0x000007ff); in _rtl8821ae_iqk_tx()
4252 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4257 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /*pDM_Odm->SupportInterface == 1*/ in _rtl8821ae_iqk_tx()
4285 rx_x0[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4287 rx_y0[cal] = rtl_get_bbreg(hw, 0xd00, 0x07ff0000)<<21; in _rtl8821ae_iqk_tx()
4312 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4332 (tx_x0_rxk[i]) >> 21 & 0x000007ff, i, in _rtl8821ae_iqk_tx()
4333 (tx_y0_rxk[i]) >> 21 & 0x000007ff); in _rtl8821ae_iqk_tx()
4336 (tx_x0[i]) >> 21 & 0x000007ff, i, in _rtl8821ae_iqk_tx()
4337 (tx_y0[i]) >> 21 & 0x000007ff); in _rtl8821ae_iqk_tx()
4341 dx = (tx_x0[i]>>21) - (tx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4342 if (dx < 3 && dx > -3) { in _rtl8821ae_iqk_tx()
4343 dy = (tx_y0[i]>>21) - (tx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4344 if (dy < 3 && dy > -3) { in _rtl8821ae_iqk_tx()
4345 tx_x = ((tx_x0[i]>>21) + (tx_x0[ii]>>21))/2; in _rtl8821ae_iqk_tx()
4346 tx_y = ((tx_y0[i]>>21) + (tx_y0[ii]>>21))/2; in _rtl8821ae_iqk_tx()
4367 (rx_x0[i])>>21&0x000007ff, i, in _rtl8821ae_iqk_tx()
4368 (rx_y0[i])>>21&0x000007ff); in _rtl8821ae_iqk_tx()
4371 dx = (rx_x0[i]>>21) - (rx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4372 if (dx < 4 && dx > -4) { in _rtl8821ae_iqk_tx()
4373 dy = (rx_y0[i]>>21) - (rx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4374 if (dy < 4 && dy > -4) { in _rtl8821ae_iqk_tx()
4375 rx_x = ((rx_x0[i]>>21) + (rx_x0[ii]>>21))/2; in _rtl8821ae_iqk_tx()
4376 rx_y = ((rx_y0[i]>>21) + (rx_y0[ii]>>21))/2; in _rtl8821ae_iqk_tx()
4404 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_rf()
4426 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_afe()
4430 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_restore_afe()
4451 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_macbb()
4523 rtldm->thermalvalue_iqk = thermal_value; in rtl8812ae_do_iqk()
4530 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_iq_calibrate()
4532 if (!rtlphy->lck_inprogress) { in rtl8821ae_phy_iq_calibrate()
4533 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4534 rtlphy->lck_inprogress = true; in rtl8821ae_phy_iq_calibrate()
4535 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4539 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4540 rtlphy->lck_inprogress = false; in rtl8821ae_phy_iq_calibrate()
4541 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4548 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_reset_iqk_result()
4553 (int)(sizeof(rtlphy->iqk_matrix) / in rtl8821ae_reset_iqk_result()
4558 rtlphy->iqk_matrix[i].value[0][0] = 0x100; in rtl8821ae_reset_iqk_result()
4559 rtlphy->iqk_matrix[i].value[0][2] = 0x100; in rtl8821ae_reset_iqk_result()
4560 rtlphy->iqk_matrix[i].value[0][4] = 0x100; in rtl8821ae_reset_iqk_result()
4561 rtlphy->iqk_matrix[i].value[0][6] = 0x100; in rtl8821ae_reset_iqk_result()
4563 rtlphy->iqk_matrix[i].value[0][1] = 0x0; in rtl8821ae_reset_iqk_result()
4564 rtlphy->iqk_matrix[i].value[0][3] = 0x0; in rtl8821ae_reset_iqk_result()
4565 rtlphy->iqk_matrix[i].value[0][5] = 0x0; in rtl8821ae_reset_iqk_result()
4566 rtlphy->iqk_matrix[i].value[0][7] = 0x0; in rtl8821ae_reset_iqk_result()
4568 rtlphy->iqk_matrix[i].iqk_done = false; in rtl8821ae_reset_iqk_result()
4579 rtldm->thermalvalue_iqk = thermal_value; in rtl8821ae_do_iqk()
4599 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io_cmd()
4603 "-->IO Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io_cmd()
4604 iotype, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io_cmd()
4624 if (postprocessing && !rtlphy->set_io_inprogress) { in rtl8821ae_phy_set_io_cmd()
4625 rtlphy->set_io_inprogress = true; in rtl8821ae_phy_set_io_cmd()
4626 rtlphy->current_io_type = iotype; in rtl8821ae_phy_set_io_cmd()
4638 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_phy_set_io()
4639 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io()
4642 "--->Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io()
4643 rtlphy->current_io_type, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io()
4644 switch (rtlphy->current_io_type) { in rtl8821ae_phy_set_io()
4646 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4648 rtl8821ae_dm_write_dig(hw, rtlphy->initgain_backup.xaagccore1); in rtl8821ae_phy_set_io()
4650 rtlphy->initgain_backup.cca); in rtl8821ae_phy_set_io()
4653 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4655 rtlphy->initgain_backup.xaagccore1 = dm_digtable->cur_igvalue; in rtl8821ae_phy_set_io()
4657 rtlphy->initgain_backup.cca = dm_digtable->cur_cck_cca_thres; in rtl8821ae_phy_set_io()
4664 rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4667 rtlphy->set_io_inprogress = false; in rtl8821ae_phy_set_io()
4669 "(%#x)\n", rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4696 if ((ppsc->rfpwr_state == ERFOFF) && in _rtl8821ae_phy_set_rf_power_state()
4712 jiffies_to_msecs(jiffies - in _rtl8821ae_phy_set_rf_power_state()
4713 ppsc->last_sleep_jiffies)); in _rtl8821ae_phy_set_rf_power_state()
4714 ppsc->last_awake_jiffies = jiffies; in _rtl8821ae_phy_set_rf_power_state()
4717 if (mac->link_state == MAC80211_LINKED) { in _rtl8821ae_phy_set_rf_power_state()
4718 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4721 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4728 ring = &pcipriv->dev.tx_ring[queue_id]; in _rtl8821ae_phy_set_rf_power_state()
4730 skb_queue_len(&ring->queue) == 0) { in _rtl8821ae_phy_set_rf_power_state()
4737 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4747 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4752 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { in _rtl8821ae_phy_set_rf_power_state()
4758 if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { in _rtl8821ae_phy_set_rf_power_state()
4759 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4762 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4774 ppsc->rfpwr_state = rfpwr_state; in _rtl8821ae_phy_set_rf_power_state()
4785 if (rfpwr_state == ppsc->rfpwr_state) in rtl8821ae_phy_set_rf_power_state()