Lines Matching +full:txpower +full:- +full:5 +full:g
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()
86 else if (channel <= 14) /*2.4G only*/ 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()
345 case 5: 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()
409 case 5: 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()
628 } else {/* 5G band */ in rtl8821ae_phy_switch_wirelessband()
631 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_switch_wirelessband()
657 "PHY_SwitchWirelessBand8812(): Switch to 5G Band. Count = %d reg41A=0x%x\n", 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()
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()
868 mdelay(5); in _rtl8821ae_config_bb_reg()
874 udelay(5); in _rtl8821ae_config_bb_reg()
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()
935 "Invalid RateSection %d in Band 2.4G,Rf Path %d, %dTx in PHY_SetTxPowerByRateBase()\n", 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()
958 "Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in PHY_SetTxPowerByRateBase()\n", 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()
1005 "Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", 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()
1028 "Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", 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()
1133 if (bw == 0 || bw == 1) { /*5G 20M 40M VHT and HT can cross reference*/ 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()
1146 } else if (rate_section == 5) { 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()
1211 "Wrong rate 0x%x to obtain index in 2.4G in PHY_GetTxPowerByRateBaseIndex()\n", in _rtl8812ae_phy_get_txpower_by_rate_base_index()
1278 "Wrong rate 0x%x to obtain index in 5G in PHY_GetTxPowerByRateBaseIndex()\n", in _rtl8812ae_phy_get_txpower_by_rate_base_index()
1290 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1307 /* obtain the base dBm values in 2.4G band 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()
1363 /* obtain the base dBm values in 5G band in _rtl8812ae_phy_convert_txpower_limit_to_power_index()
1382 } else if (rate_section == 5) { /*VHT 2T*/ 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()
1395 if (rate_section == 3 || rate_section == 5) 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()
1441 rtlphy->txpwr_limit_2_4g in _rtl8821ae_phy_init_txpower_limit()
1450 rtlphy->txpwr_limit_5g 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()
1668 rate_section = 5; in _rtl8812ae_phy_set_txpower_limit()
1679 if (strcmp(pband, "2.4G") == 0) { 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()
1699 "2.4G [regula %d][bw %d][sec %d][chnl %d][val %d]\n", in _rtl8812ae_phy_set_txpower_limit()
1701 rtlphy->txpwr_limit_2_4g[regulation][bandwidth] in _rtl8812ae_phy_set_txpower_limit()
1703 } else if (strcmp(pband, "5G") == 0) { 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()
1722 "5G: [regul %d][bw %d][sec %d][chnl %d][val %d]\n", 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()
1768 const char *chnl = array[i+5]; 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()
2005 v6 = array[i+5]; 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()
2018 mdelay(5); in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2024 udelay(5); in _rtl8821ae_phy_config_bb_with_pgheaderfile()
2108 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_hw_reg_originalvalue()
2110 rtlphy->default_initialgain[0] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2112 rtlphy->default_initialgain[1] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2114 rtlphy->default_initialgain[2] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2116 rtlphy->default_initialgain[3] = in rtl8821ae_phy_get_hw_reg_originalvalue()
2121 rtlphy->default_initialgain[0], in rtl8821ae_phy_get_hw_reg_originalvalue()
2122 rtlphy->default_initialgain[1], in rtl8821ae_phy_get_hw_reg_originalvalue()
2123 rtlphy->default_initialgain[2], in rtl8821ae_phy_get_hw_reg_originalvalue()
2124 rtlphy->default_initialgain[3]); in rtl8821ae_phy_get_hw_reg_originalvalue()
2126 rtlphy->framesync = (u8)rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2128 rtlphy->framesync_c34 = rtl_get_bbreg(hw, in rtl8821ae_phy_get_hw_reg_originalvalue()
2133 ROFDM0_RXDETECTOR3, rtlphy->framesync); in rtl8821ae_phy_get_hw_reg_originalvalue()
2139 struct rtl_phy *rtlphy = &rtlpriv->phy; in phy_init_bb_rf_register_definition()
2141 rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2142 rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; in phy_init_bb_rf_register_definition()
2144 rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2145 rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2147 rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2148 rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; in phy_init_bb_rf_register_definition()
2150 rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = RA_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2151 rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = RB_LSSIWRITE_8821A; in phy_init_bb_rf_register_definition()
2153 rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2154 rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RHSSIREAD_8821AE; in phy_init_bb_rf_register_definition()
2156 rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RA_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2157 rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RB_SIREAD_8821A; in phy_init_bb_rf_register_definition()
2159 rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = RA_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2160 rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = RB_PIREAD_8821A; in phy_init_bb_rf_register_definition()
2166 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_get_txpower_level()
2170 txpwr_level = rtlphy->cur_cck_txpwridx; in rtl8821ae_phy_get_txpower_level()
2173 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2180 txpwr_level = rtlphy->cur_ofdm24g_txpwridx; in rtl8821ae_phy_get_txpower_level()
2197 *chnl_index = channel - 1; in _rtl8821ae_phy_get_chnl_index()
2249 rate_section = 5; in _rtl8821ae_phy_get_ratesection_intxpower_byrate()
2315 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8812ae_phy_get_txpower_limit()
2316 short band_temp = -1, regulation = -1, bandwidth_temp = -1, in _rtl8812ae_phy_get_txpower_limit()
2317 rate_section = -1, channel_temp = -1; in _rtl8812ae_phy_get_txpower_limit()
2321 if (rtlefuse->eeprom_regulatory == 2) in _rtl8812ae_phy_get_txpower_limit()
2397 rate_section = 5; in _rtl8812ae_phy_get_txpower_limit()
2407 "Wrong rate 0x%x: No CCK in 5G Band\n", rate); in _rtl8812ae_phy_get_txpower_limit()
2431 if (band_temp == -1 || regulation == -1 || bandwidth_temp == -1 || in _rtl8812ae_phy_get_txpower_limit()
2432 rate_section == -1 || channel_temp == -1) { in _rtl8812ae_phy_get_txpower_limit()
2450 limits[i] = rtlphy->txpwr_limit_2_4g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2455 rtlphy->txpwr_limit_2_4g[regu][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2462 limits[i] = rtlphy->txpwr_limit_5g[i][bdwidth] in _rtl8812ae_phy_get_txpower_limit()
2467 rtlphy->txpwr_limit_5g[regu][chnl] in _rtl8812ae_phy_get_txpower_limit()
2480 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_txpower_by_rate()
2558 tx_pwr_diff = (u8)(rtlphy->tx_power_by_rate_offset[band][path] in _rtl8821ae_phy_get_txpower_by_rate()
2562 if (rtlpriv->efuse.eeprom_regulatory != 2) { in _rtl8821ae_phy_get_txpower_by_rate()
2564 rtlphy->current_chan_bw, path, rate, in _rtl8821ae_phy_get_txpower_by_rate()
2565 rtlphy->current_channel); in _rtl8821ae_phy_get_txpower_by_rate()
2570 if (tx_pwr_diff < (-limit)) in _rtl8821ae_phy_get_txpower_by_rate()
2571 tx_pwr_diff = -limit; in _rtl8821ae_phy_get_txpower_by_rate()
2593 u8 index = (channel - 1); in _rtl8821ae_get_txpower_index()
2594 u8 txpower = 0; in _rtl8821ae_get_txpower_index() local
2598 if (((rtlhal->current_bandtype == BAND_ON_2_4G) && in _rtl8821ae_get_txpower_index()
2600 ((rtlhal->current_bandtype == BAND_ON_5G) && (channel <= 14))) { in _rtl8821ae_get_txpower_index()
2609 txpower = rtlefuse->txpwrlevel_cck[path][index]; in _rtl8821ae_get_txpower_index()
2611 txpower = rtlefuse->txpwrlevel_ht40_1s[path][index]; in _rtl8821ae_get_txpower_index()
2617 txpower += rtlefuse->txpwr_legacyhtdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2622 txpower += rtlefuse->txpwr_ht20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2625 txpower += rtlefuse->txpwr_ht20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2629 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2632 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2637 txpower += rtlefuse->txpwr_ht40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2641 txpower += rtlefuse->txpwr_ht40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2645 txpower = rtlefuse->txpwr_5g_bw40base[path][index]; in _rtl8821ae_get_txpower_index()
2652 txpower += rtlefuse->txpwr_5g_ofdmdiff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2658 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2662 txpower += rtlefuse->txpwr_5g_bw20diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2667 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2671 txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2682 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2683 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S]; in _rtl8821ae_get_txpower_index()
2687 txpower = rtlefuse->txpwr_5g_bw80base[path][index] in _rtl8821ae_get_txpower_index()
2688 + rtlefuse->txpwr_5g_bw80diff[path][TX_1S] in _rtl8821ae_get_txpower_index()
2689 + rtlefuse->txpwr_5g_bw80diff[path][TX_2S]; in _rtl8821ae_get_txpower_index()
2692 if (rtlefuse->eeprom_regulatory != 2) in _rtl8821ae_get_txpower_index()
2699 txpower -= powerdiff_byrate; in _rtl8821ae_get_txpower_index()
2701 txpower += powerdiff_byrate; in _rtl8821ae_get_txpower_index()
2704 txpower += rtlpriv->dm.remnant_ofdm_swing_idx[path]; in _rtl8821ae_get_txpower_index()
2706 txpower += rtlpriv->dm.remnant_cck_idx; in _rtl8821ae_get_txpower_index()
2708 if (txpower > MAX_POWER_INDEX) in _rtl8821ae_get_txpower_index()
2709 txpower = MAX_POWER_INDEX; in _rtl8821ae_get_txpower_index()
2711 return txpower; in _rtl8821ae_get_txpower_index()
3128 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_set_txpower_level_by_path()
3135 rtlphy->current_chan_bw, in _rtl8821ae_phy_set_txpower_level_by_path()
3146 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_txpower_training_by_path()
3151 if (path >= rtlphy->num_total_rfpath) in _rtl8821ae_phy_txpower_training_by_path()
3169 power_level = power_level - 10; in _rtl8821ae_phy_txpower_training_by_path()
3171 power_level = power_level - 8; in _rtl8821ae_phy_txpower_training_by_path()
3173 power_level = power_level - 6; in _rtl8821ae_phy_txpower_training_by_path()
3186 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level_by_path()
3215 if (rtlhal->current_bandtype == BAND_ON_2_4G) in rtl8821ae_phy_set_txpower_level_by_path()
3226 if (rtlphy->num_total_rfpath >= 2) { in rtl8821ae_phy_set_txpower_level_by_path()
3235 _rtl8821ae_phy_txpower_training_by_path(hw, rtlphy->current_chan_bw, in rtl8821ae_phy_set_txpower_level_by_path()
3239 /*just in case, write txpower in DW, to reduce time*/
3243 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_txpower_level()
3246 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; ++path) in rtl8821ae_phy_set_txpower_level()
3259 offset = -7; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3263 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3266 offset = -8; in _rtl8821ae_phy_txpwr_idx_to_dbm()
3283 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3290 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3297 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_phy_scan_operation_backup()
3333 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_phy_get_secondary_chnl()
3337 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) { in _rtl8821ae_phy_get_secondary_chnl()
3338 if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3340 else if (mac->cur_80_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3345 if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3346 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3348 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3349 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) in _rtl8821ae_phy_get_secondary_chnl()
3351 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) && in _rtl8821ae_phy_get_secondary_chnl()
3352 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3354 else if ((mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) && in _rtl8821ae_phy_get_secondary_chnl()
3355 (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_UPPER)) in _rtl8821ae_phy_get_secondary_chnl()
3359 } else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { in _rtl8821ae_phy_get_secondary_chnl()
3360 if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_UPPER) in _rtl8821ae_phy_get_secondary_chnl()
3362 else if (mac->cur_40_prime_sc == PRIME_CHNL_OFFSET_LOWER) in _rtl8821ae_phy_get_secondary_chnl()
3373 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode_callback()
3379 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? in rtl8821ae_phy_set_bw_mode_callback()
3381 (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40 ? in rtl8821ae_phy_set_bw_mode_callback()
3384 _rtl8821ae_phy_set_reg_bw(rtlpriv, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3388 switch (rtlphy->current_chan_bw) { in rtl8821ae_phy_set_bw_mode_callback()
3393 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3404 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3407 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3429 if (rtlphy->reg_837 & BIT(2)) in rtl8821ae_phy_set_bw_mode_callback()
3430 l1pk_val = 5; in rtl8821ae_phy_set_bw_mode_callback()
3432 if (rtlphy->rf_type == RF_2T2R) in rtl8821ae_phy_set_bw_mode_callback()
3442 rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3446 rtl8812ae_fixspur(hw, rtlphy->current_chan_bw, rtlphy->current_channel); in rtl8821ae_phy_set_bw_mode_callback()
3448 rtl8821ae_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); in rtl8821ae_phy_set_bw_mode_callback()
3449 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode_callback()
3458 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_bw_mode()
3460 u8 tmp_bw = rtlphy->current_chan_bw; in rtl8821ae_phy_set_bw_mode()
3462 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_set_bw_mode()
3464 rtlphy->set_bwmode_inprogress = true; in rtl8821ae_phy_set_bw_mode()
3470 rtlphy->set_bwmode_inprogress = false; in rtl8821ae_phy_set_bw_mode()
3471 rtlphy->current_chan_bw = tmp_bw; in rtl8821ae_phy_set_bw_mode()
3479 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl_callback()
3480 u8 channel = rtlphy->current_channel; in rtl8821ae_phy_sw_chnl_callback()
3485 "switch to channel%d\n", rtlphy->current_channel); in rtl8821ae_phy_sw_chnl_callback()
3501 for (path = RF90_PATH_A; path < rtlphy->num_total_rfpath; path++) { in rtl8821ae_phy_sw_chnl_callback()
3517 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_phy_sw_chnl_callback()
3533 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_sw_chnl()
3537 if (rtlphy->sw_chnl_inprogress) in rtl8821ae_phy_sw_chnl()
3539 if (rtlphy->set_bwmode_inprogress) in rtl8821ae_phy_sw_chnl()
3547 while (rtlphy->lck_inprogress && timecount < timeout) { in rtl8821ae_phy_sw_chnl()
3552 if (rtlphy->current_channel > 14 && rtlhal->current_bandtype != BAND_ON_5G) in rtl8821ae_phy_sw_chnl()
3554 else if (rtlphy->current_channel <= 14 && rtlhal->current_bandtype != BAND_ON_2_4G) in rtl8821ae_phy_sw_chnl()
3557 rtlphy->sw_chnl_inprogress = true; in rtl8821ae_phy_sw_chnl()
3561 rtlphy->current_channel, rtlhal->current_bandtype); in rtl8821ae_phy_sw_chnl()
3566 rtl8821ae_phy_set_txpower_level(hw, rtlphy->current_channel); in rtl8821ae_phy_sw_chnl()
3569 rtlphy->sw_chnl_inprogress = false; in rtl8821ae_phy_sw_chnl()
3576 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, in _rtl8812ae_get_right_chnl_place_for_iqk()
3587 return place-13; in _rtl8812ae_get_right_chnl_place_for_iqk()
3604 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_macbb()
3618 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_afe()
3632 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_backup_rf()
3649 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_configure_mac()
3662 /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx_fill_iqc()
3688 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_rx_fill_iqc()
3708 struct rtl_phy *rtlphy = &rtlpriv->phy; in _rtl8821ae_iqk_tx()
3723 rtlphy->current_chan_bw); in _rtl8821ae_iqk_tx()
3724 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) in _rtl8821ae_iqk_tx()
3731 /* Path-A LOK */ in _rtl8821ae_iqk_tx()
3732 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /*[31] = 0 --> Page C*/ in _rtl8821ae_iqk_tx()
3733 /*========Path-A AFE all on========*/ in _rtl8821ae_iqk_tx()
3746 rtl_set_bbreg(hw, 0xc00, 0xf, 0x4); /*hardware 3-wire off*/ in _rtl8821ae_iqk_tx()
3769 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3772 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3786 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3789 switch (rtlphy->current_chan_bw) { in _rtl8821ae_iqk_tx()
3800 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3803 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3819 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
3821 if (rtlhal->current_bandtype) in _rtl8821ae_iqk_tx()
3845 tx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
3904 tx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
3905 tx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
3966 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
3982 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4008 rx_dt[cal] = (vdf_y[1]>>20)-(vdf_y[0]>>20); in _rtl8821ae_iqk_tx()
4079 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4097 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4102 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /* pDM_Odm->SupportInterface == 1 */ in _rtl8821ae_iqk_tx()
4156 rx_x0[cal] = vdf_x[k-1]; in _rtl8821ae_iqk_tx()
4157 rx_y0[cal] = vdf_y[k-1]; in _rtl8821ae_iqk_tx()
4164 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4177 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4236 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4254 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_tx()
4259 rtl_write_dword(rtlpriv, 0xc8c, 0x28160d00); /*pDM_Odm->SupportInterface == 1*/ in _rtl8821ae_iqk_tx()
4314 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_tx()
4343 dx = (tx_x0[i]>>21) - (tx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4344 if (dx < 3 && dx > -3) { in _rtl8821ae_iqk_tx()
4345 dy = (tx_y0[i]>>21) - (tx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4346 if (dy < 3 && dy > -3) { in _rtl8821ae_iqk_tx()
4373 dx = (rx_x0[i]>>21) - (rx_x0[ii]>>21); in _rtl8821ae_iqk_tx()
4374 if (dx < 4 && dx > -4) { in _rtl8821ae_iqk_tx()
4375 dy = (rx_y0[i]>>21) - (rx_y0[ii]>>21); in _rtl8821ae_iqk_tx()
4376 if (dy < 4 && dy > -4) { in _rtl8821ae_iqk_tx()
4406 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_rf()
4428 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_afe()
4432 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */ in _rtl8821ae_iqk_restore_afe()
4453 rtl_set_bbreg(hw, 0x82c, BIT(31), 0x0); /* [31] = 0 --> Page C */ in _rtl8821ae_iqk_restore_macbb()
4525 rtldm->thermalvalue_iqk = thermal_value; in rtl8812ae_do_iqk()
4532 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_iq_calibrate()
4534 if (!rtlphy->lck_inprogress) { in rtl8821ae_phy_iq_calibrate()
4535 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4536 rtlphy->lck_inprogress = true; in rtl8821ae_phy_iq_calibrate()
4537 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4541 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4542 rtlphy->lck_inprogress = false; in rtl8821ae_phy_iq_calibrate()
4543 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_phy_iq_calibrate()
4550 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_reset_iqk_result()
4555 (int)(sizeof(rtlphy->iqk_matrix) / in rtl8821ae_reset_iqk_result()
4560 rtlphy->iqk_matrix[i].value[0][0] = 0x100; in rtl8821ae_reset_iqk_result()
4561 rtlphy->iqk_matrix[i].value[0][2] = 0x100; in rtl8821ae_reset_iqk_result()
4562 rtlphy->iqk_matrix[i].value[0][4] = 0x100; in rtl8821ae_reset_iqk_result()
4563 rtlphy->iqk_matrix[i].value[0][6] = 0x100; in rtl8821ae_reset_iqk_result()
4565 rtlphy->iqk_matrix[i].value[0][1] = 0x0; in rtl8821ae_reset_iqk_result()
4566 rtlphy->iqk_matrix[i].value[0][3] = 0x0; in rtl8821ae_reset_iqk_result()
4567 rtlphy->iqk_matrix[i].value[0][5] = 0x0; in rtl8821ae_reset_iqk_result()
4568 rtlphy->iqk_matrix[i].value[0][7] = 0x0; in rtl8821ae_reset_iqk_result()
4570 rtlphy->iqk_matrix[i].iqk_done = false; in rtl8821ae_reset_iqk_result()
4581 rtldm->thermalvalue_iqk = thermal_value; in rtl8821ae_do_iqk()
4601 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io_cmd()
4605 "-->IO Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io_cmd()
4606 iotype, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io_cmd()
4626 if (postprocessing && !rtlphy->set_io_inprogress) { in rtl8821ae_phy_set_io_cmd()
4627 rtlphy->set_io_inprogress = true; in rtl8821ae_phy_set_io_cmd()
4628 rtlphy->current_io_type = iotype; in rtl8821ae_phy_set_io_cmd()
4640 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_phy_set_io()
4641 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_phy_set_io()
4644 "--->Cmd(%#x), set_io_inprogress(%d)\n", in rtl8821ae_phy_set_io()
4645 rtlphy->current_io_type, rtlphy->set_io_inprogress); in rtl8821ae_phy_set_io()
4646 switch (rtlphy->current_io_type) { in rtl8821ae_phy_set_io()
4648 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4650 rtl8821ae_dm_write_dig(hw, rtlphy->initgain_backup.xaagccore1); in rtl8821ae_phy_set_io()
4652 rtlphy->initgain_backup.cca); in rtl8821ae_phy_set_io()
4655 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) in rtl8821ae_phy_set_io()
4657 rtlphy->initgain_backup.xaagccore1 = dm_digtable->cur_igvalue; in rtl8821ae_phy_set_io()
4659 rtlphy->initgain_backup.cca = dm_digtable->cur_cck_cca_thres; in rtl8821ae_phy_set_io()
4666 rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4669 rtlphy->set_io_inprogress = false; in rtl8821ae_phy_set_io()
4671 "(%#x)\n", rtlphy->current_io_type); in rtl8821ae_phy_set_io()
4698 if ((ppsc->rfpwr_state == ERFOFF) && in _rtl8821ae_phy_set_rf_power_state()
4714 jiffies_to_msecs(jiffies - in _rtl8821ae_phy_set_rf_power_state()
4715 ppsc->last_sleep_jiffies)); in _rtl8821ae_phy_set_rf_power_state()
4716 ppsc->last_awake_jiffies = jiffies; in _rtl8821ae_phy_set_rf_power_state()
4719 if (mac->link_state == MAC80211_LINKED) { in _rtl8821ae_phy_set_rf_power_state()
4720 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4723 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4730 ring = &pcipriv->dev.tx_ring[queue_id]; in _rtl8821ae_phy_set_rf_power_state()
4732 skb_queue_len(&ring->queue) == 0) { in _rtl8821ae_phy_set_rf_power_state()
4739 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4749 skb_queue_len(&ring->queue)); in _rtl8821ae_phy_set_rf_power_state()
4754 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { in _rtl8821ae_phy_set_rf_power_state()
4760 if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { in _rtl8821ae_phy_set_rf_power_state()
4761 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4764 rtlpriv->cfg->ops->led_control(hw, in _rtl8821ae_phy_set_rf_power_state()
4776 ppsc->rfpwr_state = rfpwr_state; in _rtl8821ae_phy_set_rf_power_state()
4787 if (rfpwr_state == ppsc->rfpwr_state) in rtl8821ae_phy_set_rf_power_state()