Lines Matching +full:tx +full:- +full:swing +full:- +full:low

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2010 Realtek Corporation.*/
17 0x081, /* 0, -12.0dB */
18 0x088, /* 1, -11.5dB */
19 0x090, /* 2, -11.0dB */
20 0x099, /* 3, -10.5dB */
21 0x0A2, /* 4, -10.0dB */
22 0x0AC, /* 5, -9.5dB */
23 0x0B6, /* 6, -9.0dB */
24 0x0C0, /* 7, -8.5dB */
25 0x0CC, /* 8, -8.0dB */
26 0x0D8, /* 9, -7.5dB */
27 0x0E5, /* 10, -7.0dB */
28 0x0F2, /* 11, -6.5dB */
29 0x101, /* 12, -6.0dB */
30 0x110, /* 13, -5.5dB */
31 0x120, /* 14, -5.0dB */
32 0x131, /* 15, -4.5dB */
33 0x143, /* 16, -4.0dB */
34 0x156, /* 17, -3.5dB */
35 0x16A, /* 18, -3.0dB */
36 0x180, /* 19, -2.5dB */
37 0x197, /* 20, -2.0dB */
38 0x1AF, /* 21, -1.5dB */
39 0x1C8, /* 22, -1.0dB */
40 0x1E3, /* 23, -0.5dB */
57 0x081, /* 0, -12.0dB */
58 0x088, /* 1, -11.5dB */
59 0x090, /* 2, -11.0dB */
60 0x099, /* 3, -10.5dB */
61 0x0A2, /* 4, -10.0dB */
62 0x0AC, /* 5, -9.5dB */
63 0x0B6, /* 6, -9.0dB */
64 0x0C0, /* 7, -8.5dB */
65 0x0CC, /* 8, -8.0dB */
66 0x0D8, /* 9, -7.5dB */
67 0x0E5, /* 10, -7.0dB */
68 0x0F2, /* 11, -6.5dB */
69 0x101, /* 12, -6.0dB */
70 0x110, /* 13, -5.5dB */
71 0x120, /* 14, -5.0dB */
72 0x131, /* 15, -4.5dB */
73 0x143, /* 16, -4.0dB */
74 0x156, /* 17, -3.5dB */
75 0x16A, /* 18, -3.0dB */
76 0x180, /* 19, -2.5dB */
77 0x197, /* 20, -2.0dB */
78 0x1AF, /* 21, -1.5dB */
79 0x1C8, /* 22, -1.0dB */
80 0x1E3, /* 23, -0.5dB */
237 if (rtlpriv->dm.swing_idx_ofdm[RF90_PATH_A] <= in rtl8821ae_dm_txpower_track_adjust()
238 rtlpriv->dm.swing_idx_ofdm_base[RF90_PATH_A]) { in rtl8821ae_dm_txpower_track_adjust()
240 pwr_val = rtldm->swing_idx_ofdm_base[RF90_PATH_A] - in rtl8821ae_dm_txpower_track_adjust()
241 rtldm->swing_idx_ofdm[RF90_PATH_A]; in rtl8821ae_dm_txpower_track_adjust()
244 pwr_val = rtldm->swing_idx_ofdm[RF90_PATH_A] - in rtl8821ae_dm_txpower_track_adjust()
245 rtldm->swing_idx_ofdm_base[RF90_PATH_A]; in rtl8821ae_dm_txpower_track_adjust()
248 if (rtldm->swing_idx_cck <= rtldm->swing_idx_cck_base) { in rtl8821ae_dm_txpower_track_adjust()
250 pwr_val = rtldm->swing_idx_cck_base - in rtl8821ae_dm_txpower_track_adjust()
251 rtldm->swing_idx_cck; in rtl8821ae_dm_txpower_track_adjust()
254 pwr_val = rtldm->swing_idx_cck - in rtl8821ae_dm_txpower_track_adjust()
255 rtldm->swing_idx_cck_base; in rtl8821ae_dm_txpower_track_adjust()
274 rtldm->swing_idx_cck_base = rtldm->default_cck_index; in rtl8821ae_dm_clear_txpower_tracking_state()
275 rtldm->swing_idx_cck = rtldm->default_cck_index; in rtl8821ae_dm_clear_txpower_tracking_state()
276 rtldm->cck_index = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
279 rtldm->swing_idx_ofdm_base[p] = rtldm->default_ofdm_index; in rtl8821ae_dm_clear_txpower_tracking_state()
280 rtldm->swing_idx_ofdm[p] = rtldm->default_ofdm_index; in rtl8821ae_dm_clear_txpower_tracking_state()
281 rtldm->ofdm_index[p] = rtldm->default_ofdm_index; in rtl8821ae_dm_clear_txpower_tracking_state()
283 rtldm->power_index_offset[p] = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
284 rtldm->delta_power_index[p] = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
285 rtldm->delta_power_index_last[p] = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
287 rtldm->absolute_ofdm_swing_idx[p] = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
288 rtldm->remnant_ofdm_swing_idx[p] = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
290 /*Initial at Modify Tx Scaling Mode*/ in rtl8821ae_dm_clear_txpower_tracking_state()
291 rtldm->modify_txagc_flag_path_a = false; in rtl8821ae_dm_clear_txpower_tracking_state()
292 /*Initial at Modify Tx Scaling Mode*/ in rtl8821ae_dm_clear_txpower_tracking_state()
293 rtldm->modify_txagc_flag_path_b = false; in rtl8821ae_dm_clear_txpower_tracking_state()
294 rtldm->remnant_cck_idx = 0; in rtl8821ae_dm_clear_txpower_tracking_state()
295 rtldm->thermalvalue = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_clear_txpower_tracking_state()
296 rtldm->thermalvalue_iqk = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_clear_txpower_tracking_state()
297 rtldm->thermalvalue_lck = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_clear_txpower_tracking_state()
306 bb_swing = phy_get_tx_swing_8812A(hw, rtlhal->current_bandtype, in rtl8821ae_dm_get_swing_index()
325 rtlpriv->dm.txpower_track_control = true; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
326 rtldm->thermalvalue = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
327 rtldm->thermalvalue_iqk = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
328 rtldm->thermalvalue_lck = rtlefuse->eeprom_thermalmeter; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
331 rtldm->default_ofdm_index = in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
334 rtldm->default_cck_index = 24; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
336 rtldm->swing_idx_cck_base = rtldm->default_cck_index; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
337 rtldm->cck_index = rtldm->default_cck_index; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
340 rtldm->swing_idx_ofdm_base[p] = in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
341 rtldm->default_ofdm_index; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
342 rtldm->ofdm_index[p] = rtldm->default_ofdm_index; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
343 rtldm->delta_power_index[p] = 0; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
344 rtldm->power_index_offset[p] = 0; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
345 rtldm->delta_power_index_last[p] = 0; in rtl8821ae_dm_initialize_txpower_tracking_thermalmeter()
353 rtlpriv->dm.current_turbo_edca = false; in rtl8821ae_dm_init_edca_turbo()
354 rtlpriv->dm.is_any_nonbepkts = false; in rtl8821ae_dm_init_edca_turbo()
355 rtlpriv->dm.is_cur_rdlstate = false; in rtl8821ae_dm_init_edca_turbo()
361 struct rate_adaptive *p_ra = &rtlpriv->ra; in rtl8821ae_dm_init_rate_adaptive_mask()
363 p_ra->ratr_state = DM_RATR_STA_INIT; in rtl8821ae_dm_init_rate_adaptive_mask()
364 p_ra->pre_ratr_state = DM_RATR_STA_INIT; in rtl8821ae_dm_init_rate_adaptive_mask()
366 rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; in rtl8821ae_dm_init_rate_adaptive_mask()
367 if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) in rtl8821ae_dm_init_rate_adaptive_mask()
368 rtlpriv->dm.useramask = true; in rtl8821ae_dm_init_rate_adaptive_mask()
370 rtlpriv->dm.useramask = false; in rtl8821ae_dm_init_rate_adaptive_mask()
372 p_ra->high_rssi_thresh_for_ra = 50; in rtl8821ae_dm_init_rate_adaptive_mask()
373 p_ra->low_rssi_thresh_for_ra40m = 20; in rtl8821ae_dm_init_rate_adaptive_mask()
380 rtlpriv->dm.crystal_cap = rtlpriv->efuse.crystalcap; in rtl8821ae_dm_init_dynamic_atc_switch()
382 rtlpriv->dm.atc_status = rtl_get_bbreg(hw, ROFDM1_CFOTRACKING, BIT(11)); in rtl8821ae_dm_init_dynamic_atc_switch()
383 rtlpriv->dm.cfo_threshold = CFO_THRESHOLD_XTAL; in rtl8821ae_dm_init_dynamic_atc_switch()
389 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_dm_common_info_self_init()
392 rtlphy->cck_high_power = in rtl8821ae_dm_common_info_self_init()
399 rtlpriv->dm.rfpath_rxenable[0] = true; in rtl8821ae_dm_common_info_self_init()
401 rtlpriv->dm.rfpath_rxenable[1] = true; in rtl8821ae_dm_common_info_self_init()
407 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_dm_init()
410 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_init()
411 rtlphy->lck_inprogress = false; in rtl8821ae_dm_init()
412 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_init()
414 rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; in rtl8821ae_dm_init()
426 struct dig_t *rtl_dm_dig = &rtlpriv->dm_digtable; in rtl8821ae_dm_find_minimum_rssi()
430 if ((mac->link_state < MAC80211_LINKED) && in rtl8821ae_dm_find_minimum_rssi()
431 (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { in rtl8821ae_dm_find_minimum_rssi()
432 rtl_dm_dig->min_undec_pwdb_for_dm = 0; in rtl8821ae_dm_find_minimum_rssi()
435 if (mac->link_state >= MAC80211_LINKED) { in rtl8821ae_dm_find_minimum_rssi()
436 if (mac->opmode == NL80211_IFTYPE_AP || in rtl8821ae_dm_find_minimum_rssi()
437 mac->opmode == NL80211_IFTYPE_ADHOC) { in rtl8821ae_dm_find_minimum_rssi()
438 rtl_dm_dig->min_undec_pwdb_for_dm = in rtl8821ae_dm_find_minimum_rssi()
439 rtlpriv->dm.entry_min_undec_sm_pwdb; in rtl8821ae_dm_find_minimum_rssi()
442 rtlpriv->dm.entry_min_undec_sm_pwdb); in rtl8821ae_dm_find_minimum_rssi()
444 rtl_dm_dig->min_undec_pwdb_for_dm = in rtl8821ae_dm_find_minimum_rssi()
445 rtlpriv->dm.undec_sm_pwdb; in rtl8821ae_dm_find_minimum_rssi()
448 rtl_dm_dig->min_undec_pwdb_for_dm); in rtl8821ae_dm_find_minimum_rssi()
451 rtl_dm_dig->min_undec_pwdb_for_dm = in rtl8821ae_dm_find_minimum_rssi()
452 rtlpriv->dm.entry_min_undec_sm_pwdb; in rtl8821ae_dm_find_minimum_rssi()
455 rtl_dm_dig->min_undec_pwdb_for_dm); in rtl8821ae_dm_find_minimum_rssi()
459 rtl_dm_dig->min_undec_pwdb_for_dm); in rtl8821ae_dm_find_minimum_rssi()
467 rtlpriv->stats.rx_rssi_percentage[0]); in rtl8812ae_dm_rssi_dump_to_register()
469 rtlpriv->stats.rx_rssi_percentage[1]); in rtl8812ae_dm_rssi_dump_to_register()
473 rtlpriv->stats.rx_evm_dbm[0]); in rtl8812ae_dm_rssi_dump_to_register()
475 rtlpriv->stats.rx_evm_dbm[1]); in rtl8812ae_dm_rssi_dump_to_register()
479 (u8)(rtlpriv->stats.rx_snr_db[0])); in rtl8812ae_dm_rssi_dump_to_register()
481 (u8)(rtlpriv->stats.rx_snr_db[1])); in rtl8812ae_dm_rssi_dump_to_register()
485 rtlpriv->stats.rx_cfo_short[0]); in rtl8812ae_dm_rssi_dump_to_register()
487 rtlpriv->stats.rx_cfo_short[1]); in rtl8812ae_dm_rssi_dump_to_register()
491 rtlpriv->stats.rx_cfo_tail[0]); in rtl8812ae_dm_rssi_dump_to_register()
493 rtlpriv->stats.rx_cfo_tail[1]); in rtl8812ae_dm_rssi_dump_to_register()
499 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_check_rssi_monitor()
509 cur_rxokcnt = rtlpriv->stats.rxbytesunicast - last_rxokcnt; in rtl8821ae_dm_check_rssi_monitor()
510 last_txokcnt = rtlpriv->stats.txbytesunicast; in rtl8821ae_dm_check_rssi_monitor()
511 last_rxokcnt = rtlpriv->stats.rxbytesunicast; in rtl8821ae_dm_check_rssi_monitor()
518 if (mac->opmode == NL80211_IFTYPE_AP || in rtl8821ae_dm_check_rssi_monitor()
519 mac->opmode == NL80211_IFTYPE_ADHOC || in rtl8821ae_dm_check_rssi_monitor()
520 mac->opmode == NL80211_IFTYPE_MESH_POINT) { in rtl8821ae_dm_check_rssi_monitor()
521 spin_lock_bh(&rtlpriv->locks.entry_list_lock); in rtl8821ae_dm_check_rssi_monitor()
522 list_for_each_entry(drv_priv, &rtlpriv->entry_list, list) { in rtl8821ae_dm_check_rssi_monitor()
523 if (drv_priv->rssi_stat.undec_sm_pwdb < in rtl8821ae_dm_check_rssi_monitor()
526 drv_priv->rssi_stat.undec_sm_pwdb; in rtl8821ae_dm_check_rssi_monitor()
527 if (drv_priv->rssi_stat.undec_sm_pwdb > in rtl8821ae_dm_check_rssi_monitor()
530 drv_priv->rssi_stat.undec_sm_pwdb; in rtl8821ae_dm_check_rssi_monitor()
532 spin_unlock_bh(&rtlpriv->locks.entry_list_lock); in rtl8821ae_dm_check_rssi_monitor()
536 rtlpriv->dm.entry_max_undec_sm_pwdb = in rtl8821ae_dm_check_rssi_monitor()
542 rtlpriv->dm.entry_max_undec_sm_pwdb = 0; in rtl8821ae_dm_check_rssi_monitor()
546 rtlpriv->dm.entry_min_undec_sm_pwdb = in rtl8821ae_dm_check_rssi_monitor()
552 rtlpriv->dm.entry_min_undec_sm_pwdb = 0; in rtl8821ae_dm_check_rssi_monitor()
556 if (rtlpriv->dm.useramask) { in rtl8821ae_dm_check_rssi_monitor()
557 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_dm_check_rssi_monitor()
558 if (mac->mode == WIRELESS_MODE_AC_24G || in rtl8821ae_dm_check_rssi_monitor()
559 mac->mode == WIRELESS_MODE_AC_5G || in rtl8821ae_dm_check_rssi_monitor()
560 mac->mode == WIRELESS_MODE_AC_ONLY) in rtl8821ae_dm_check_rssi_monitor()
561 stbc_tx = (mac->vht_cur_stbc & in rtl8821ae_dm_check_rssi_monitor()
564 stbc_tx = (mac->ht_cur_stbc & in rtl8821ae_dm_check_rssi_monitor()
569 (u8)(rtlpriv->dm.undec_sm_pwdb & 0xFF); in rtl8821ae_dm_check_rssi_monitor()
572 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_check_rssi_monitor()
579 rtl_write_byte(rtlpriv, 0x4fe, rtlpriv->dm.undec_sm_pwdb); in rtl8821ae_dm_check_rssi_monitor()
581 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_check_rssi_monitor()
584 dm_digtable->rssi_val_min = rtlpriv->dm_digtable.min_undec_pwdb_for_dm; in rtl8821ae_dm_check_rssi_monitor()
590 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_write_cck_cca_thres()
592 if (dm_digtable->cur_cck_cca_thres != current_cca) in rtl8821ae_dm_write_cck_cca_thres()
595 dm_digtable->pre_cck_cca_thres = dm_digtable->cur_cck_cca_thres; in rtl8821ae_dm_write_cck_cca_thres()
596 dm_digtable->cur_cck_cca_thres = current_cca; in rtl8821ae_dm_write_cck_cca_thres()
602 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_write_dig()
604 if (dm_digtable->stop_dig) in rtl8821ae_dm_write_dig()
607 if (dm_digtable->cur_igvalue != current_igi) { in rtl8821ae_dm_write_dig()
610 if (rtlpriv->phy.rf_type != RF_1T1R) in rtl8821ae_dm_write_dig()
614 dm_digtable->cur_igvalue = current_igi; in rtl8821ae_dm_write_dig()
620 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_dig()
627 u8 current_igi = dm_digtable->cur_igvalue; in rtl8821ae_dm_dig()
631 if (mac->act_scanning) { in rtl8821ae_dm_dig()
638 dig_min_0 = dm_digtable->dig_min_0; in rtl8821ae_dm_dig()
639 first_connect = (mac->link_state >= MAC80211_LINKED) && in rtl8821ae_dm_dig()
640 (!dm_digtable->media_connect_0); in rtl8821ae_dm_dig()
641 first_disconnect = (mac->link_state < MAC80211_LINKED) && in rtl8821ae_dm_dig()
642 (dm_digtable->media_connect_0); in rtl8821ae_dm_dig()
648 if (rtlhal->hw_type != HARDWARE_TYPE_RTL8821AE) in rtl8821ae_dm_dig()
655 if (mac->link_state >= MAC80211_LINKED) { in rtl8821ae_dm_dig()
656 if (rtlhal->hw_type != HARDWARE_TYPE_RTL8821AE) in rtl8821ae_dm_dig()
661 if ((dm_digtable->rssi_val_min + offset) > dm_dig_max) in rtl8821ae_dm_dig()
662 dm_digtable->rx_gain_max = dm_dig_max; in rtl8821ae_dm_dig()
663 else if ((dm_digtable->rssi_val_min + offset) < dm_dig_min) in rtl8821ae_dm_dig()
664 dm_digtable->rx_gain_max = dm_dig_min; in rtl8821ae_dm_dig()
666 dm_digtable->rx_gain_max = in rtl8821ae_dm_dig()
667 dm_digtable->rssi_val_min + offset; in rtl8821ae_dm_dig()
670 "dm_digtable->rssi_val_min=0x%x,dm_digtable->rx_gain_max = 0x%x\n", in rtl8821ae_dm_dig()
671 dm_digtable->rssi_val_min, in rtl8821ae_dm_dig()
672 dm_digtable->rx_gain_max); in rtl8821ae_dm_dig()
673 if (rtlpriv->dm.one_entry_only) { in rtl8821ae_dm_dig()
676 if (dm_digtable->rssi_val_min - offset < dm_dig_min) in rtl8821ae_dm_dig()
678 else if (dm_digtable->rssi_val_min - in rtl8821ae_dm_dig()
683 dm_digtable->rssi_val_min - offset; in rtl8821ae_dm_dig()
692 dm_digtable->rx_gain_max = dm_dig_max; in rtl8821ae_dm_dig()
697 if (rtlpriv->falsealm_cnt.cnt_all > 10000) { in rtl8821ae_dm_dig()
701 if (dm_digtable->large_fa_hit != 3) in rtl8821ae_dm_dig()
702 dm_digtable->large_fa_hit++; in rtl8821ae_dm_dig()
703 if (dm_digtable->forbidden_igi < current_igi) { in rtl8821ae_dm_dig()
704 dm_digtable->forbidden_igi = current_igi; in rtl8821ae_dm_dig()
705 dm_digtable->large_fa_hit = 1; in rtl8821ae_dm_dig()
708 if (dm_digtable->large_fa_hit >= 3) { in rtl8821ae_dm_dig()
709 if ((dm_digtable->forbidden_igi + 1) > in rtl8821ae_dm_dig()
710 dm_digtable->rx_gain_max) in rtl8821ae_dm_dig()
711 dm_digtable->rx_gain_min = in rtl8821ae_dm_dig()
712 dm_digtable->rx_gain_max; in rtl8821ae_dm_dig()
714 dm_digtable->rx_gain_min = in rtl8821ae_dm_dig()
715 (dm_digtable->forbidden_igi + 1); in rtl8821ae_dm_dig()
716 dm_digtable->recover_cnt = 3600; in rtl8821ae_dm_dig()
720 if (dm_digtable->recover_cnt != 0) { in rtl8821ae_dm_dig()
721 dm_digtable->recover_cnt--; in rtl8821ae_dm_dig()
723 if (dm_digtable->large_fa_hit < 3) { in rtl8821ae_dm_dig()
724 if ((dm_digtable->forbidden_igi - 1) < in rtl8821ae_dm_dig()
726 dm_digtable->forbidden_igi = in rtl8821ae_dm_dig()
728 dm_digtable->rx_gain_min = in rtl8821ae_dm_dig()
733 dm_digtable->forbidden_igi--; in rtl8821ae_dm_dig()
734 dm_digtable->rx_gain_min = in rtl8821ae_dm_dig()
735 (dm_digtable->forbidden_igi + 1); in rtl8821ae_dm_dig()
740 dm_digtable->large_fa_hit = 0; in rtl8821ae_dm_dig()
745 "pDM_DigTable->LargeFAHit=%d\n", in rtl8821ae_dm_dig()
746 dm_digtable->large_fa_hit); in rtl8821ae_dm_dig()
748 if (rtlpriv->dm.dbginfo.num_qry_beacon_pkt < 10) in rtl8821ae_dm_dig()
749 dm_digtable->rx_gain_min = dm_dig_min; in rtl8821ae_dm_dig()
751 if (dm_digtable->rx_gain_min > dm_digtable->rx_gain_max) in rtl8821ae_dm_dig()
752 dm_digtable->rx_gain_min = dm_digtable->rx_gain_max; in rtl8821ae_dm_dig()
755 if (mac->link_state >= MAC80211_LINKED) { in rtl8821ae_dm_dig()
759 if (dm_digtable->rssi_val_min <= dig_max_of_min) in rtl8821ae_dm_dig()
760 current_igi = dm_digtable->rssi_val_min; in rtl8821ae_dm_dig()
766 if (rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH2) in rtl8821ae_dm_dig()
768 else if (rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH1) in rtl8821ae_dm_dig()
770 else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) in rtl8821ae_dm_dig()
771 current_igi = current_igi - 2; in rtl8821ae_dm_dig()
773 if ((rtlpriv->dm.dbginfo.num_qry_beacon_pkt < 10) && in rtl8821ae_dm_dig()
774 (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH1)) { in rtl8821ae_dm_dig()
775 current_igi = dm_digtable->rx_gain_min; in rtl8821ae_dm_dig()
784 current_igi = dm_digtable->rx_gain_min; in rtl8821ae_dm_dig()
791 if (rtlpriv->falsealm_cnt.cnt_all > 2000) in rtl8821ae_dm_dig()
793 else if (rtlpriv->falsealm_cnt.cnt_all > 600) in rtl8821ae_dm_dig()
795 else if (rtlpriv->falsealm_cnt.cnt_all < 300) in rtl8821ae_dm_dig()
796 current_igi = current_igi - 2; in rtl8821ae_dm_dig()
808 if (current_igi > dm_digtable->rx_gain_max) in rtl8821ae_dm_dig()
809 current_igi = dm_digtable->rx_gain_max; in rtl8821ae_dm_dig()
810 if (current_igi < dm_digtable->rx_gain_min) in rtl8821ae_dm_dig()
811 current_igi = dm_digtable->rx_gain_min; in rtl8821ae_dm_dig()
815 dm_digtable->rx_gain_max, dm_digtable->rx_gain_min); in rtl8821ae_dm_dig()
817 "TotalFA=%d\n", rtlpriv->falsealm_cnt.cnt_all); in rtl8821ae_dm_dig()
822 dm_digtable->media_connect_0 = in rtl8821ae_dm_dig()
823 ((mac->link_state >= MAC80211_LINKED) ? true : false); in rtl8821ae_dm_dig()
824 dm_digtable->dig_min_0 = dig_min_0; in rtl8821ae_dm_dig()
832 rtlpriv->dm.tx_rate = 0xff; in rtl8821ae_dm_common_info_self_update()
834 rtlpriv->dm.one_entry_only = false; in rtl8821ae_dm_common_info_self_update()
836 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_STATION && in rtl8821ae_dm_common_info_self_update()
837 rtlpriv->mac80211.link_state >= MAC80211_LINKED) { in rtl8821ae_dm_common_info_self_update()
838 rtlpriv->dm.one_entry_only = true; in rtl8821ae_dm_common_info_self_update()
842 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP || in rtl8821ae_dm_common_info_self_update()
843 rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC || in rtl8821ae_dm_common_info_self_update()
844 rtlpriv->mac80211.opmode == NL80211_IFTYPE_MESH_POINT) { in rtl8821ae_dm_common_info_self_update()
845 spin_lock_bh(&rtlpriv->locks.entry_list_lock); in rtl8821ae_dm_common_info_self_update()
846 cnt = list_count_nodes(&rtlpriv->entry_list); in rtl8821ae_dm_common_info_self_update()
847 spin_unlock_bh(&rtlpriv->locks.entry_list_lock); in rtl8821ae_dm_common_info_self_update()
850 rtlpriv->dm.one_entry_only = true; in rtl8821ae_dm_common_info_self_update()
857 struct false_alarm_statistics *falsealm_cnt = &rtlpriv->falsealm_cnt; in rtl8821ae_dm_false_alarm_counter_statistics()
861 falsealm_cnt->cnt_ofdm_fail = in rtl8821ae_dm_false_alarm_counter_statistics()
863 falsealm_cnt->cnt_cck_fail = in rtl8821ae_dm_false_alarm_counter_statistics()
867 if (cck_enable) /*if(pDM_Odm->pBandType == ODM_BAND_2_4G)*/ in rtl8821ae_dm_false_alarm_counter_statistics()
868 falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail + in rtl8821ae_dm_false_alarm_counter_statistics()
869 falsealm_cnt->cnt_cck_fail; in rtl8821ae_dm_false_alarm_counter_statistics()
871 falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail; in rtl8821ae_dm_false_alarm_counter_statistics()
881 falsealm_cnt->cnt_cck_fail); in rtl8821ae_dm_false_alarm_counter_statistics()
883 falsealm_cnt->cnt_ofdm_fail); in rtl8821ae_dm_false_alarm_counter_statistics()
885 falsealm_cnt->cnt_all); in rtl8821ae_dm_false_alarm_counter_statistics()
893 if (!rtlpriv->dm.tm_trigger) { in rtl8812ae_dm_check_txpower_tracking_thermalmeter()
898 rtlpriv->dm.tm_trigger = 1; in rtl8812ae_dm_check_txpower_tracking_thermalmeter()
912 if (mac->link_state >= MAC80211_LINKED) { in rtl8821ae_dm_iq_calibrate()
913 if (rtldm->linked_interval < 3) in rtl8821ae_dm_iq_calibrate()
914 rtldm->linked_interval++; in rtl8821ae_dm_iq_calibrate()
916 if (rtldm->linked_interval == 2) { in rtl8821ae_dm_iq_calibrate()
917 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_iq_calibrate()
923 rtldm->linked_interval = 0; in rtl8821ae_dm_iq_calibrate()
934 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8812ae_get_delta_swing_table()
936 u8 channel = rtlphy->current_channel; in rtl8812ae_get_delta_swing_table()
937 u8 rate = rtldm->tx_rate; in rtl8812ae_get_delta_swing_table()
984 rtldm->tx_rate = rate; in rtl8821ae_dm_update_init_rate()
986 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { in rtl8821ae_dm_update_init_rate()
1153 /*-----------------------------------------------------------------------------
1156 * Overview: 88E change all channel tx power accordign to flag.
1169 *---------------------------------------------------------------------------
1177 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8812ae_dm_txpwr_track_set_pwr()
1183 if (rtldm->tx_rate != 0xFF) in rtl8812ae_dm_txpwr_track_set_pwr()
1185 rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate); in rtl8812ae_dm_txpwr_track_set_pwr()
1237 pwr_tracking_limit = 22; /*-1dB*/ in rtl8812ae_dm_txpwr_track_set_pwr()
1255 pwr_tracking_limit = 22; /*-1dB*/ in rtl8812ae_dm_txpwr_track_set_pwr()
1271 (rtldm->ofdm_index[RF90_PATH_A] > in rtl8812ae_dm_txpwr_track_set_pwr()
1274 rtldm->ofdm_index[RF90_PATH_A]; in rtl8812ae_dm_txpwr_track_set_pwr()
1277 …"pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_A]=%d,pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_A]=%d\n… in rtl8812ae_dm_txpwr_track_set_pwr()
1278 rtldm->ofdm_index[RF90_PATH_A], in rtl8812ae_dm_txpwr_track_set_pwr()
1287 rtldm->ofdm_index[RF90_PATH_B] > in rtl8812ae_dm_txpwr_track_set_pwr()
1290 rtldm->ofdm_index[RF90_PATH_B]; in rtl8812ae_dm_txpwr_track_set_pwr()
1293 …"pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_B]=%d, pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_B]=%d\… in rtl8812ae_dm_txpwr_track_set_pwr()
1294 rtldm->ofdm_index[RF90_PATH_B], in rtl8812ae_dm_txpwr_track_set_pwr()
1302 "pDM_Odm->DefaultOfdmIndex=%d, pDM_Odm->Absolute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n", in rtl8812ae_dm_txpwr_track_set_pwr()
1303 rtldm->default_ofdm_index, in rtl8812ae_dm_txpwr_track_set_pwr()
1304 rtldm->absolute_ofdm_swing_idx[rf_path], in rtl8812ae_dm_txpwr_track_set_pwr()
1307 final_ofdm_swing_index = rtldm->default_ofdm_index + in rtl8812ae_dm_txpwr_track_set_pwr()
1308 rtldm->absolute_ofdm_swing_idx[rf_path]; in rtl8812ae_dm_txpwr_track_set_pwr()
1313 rtldm->remnant_cck_idx = in rtl8812ae_dm_txpwr_track_set_pwr()
1314 final_ofdm_swing_index - in rtl8812ae_dm_txpwr_track_set_pwr()
1319 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8812ae_dm_txpwr_track_set_pwr()
1320 final_ofdm_swing_index - in rtl8812ae_dm_txpwr_track_set_pwr()
1326 rtldm->modify_txagc_flag_path_a = true; in rtl8812ae_dm_txpwr_track_set_pwr()
1330 rtlphy->current_channel, in rtl8812ae_dm_txpwr_track_set_pwr()
1336 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8812ae_dm_txpwr_track_set_pwr()
1338 rtldm->remnant_cck_idx = final_ofdm_swing_index; in rtl8812ae_dm_txpwr_track_set_pwr()
1340 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8812ae_dm_txpwr_track_set_pwr()
1346 rtldm->modify_txagc_flag_path_a = true; in rtl8812ae_dm_txpwr_track_set_pwr()
1350 rtlphy->current_channel, RF90_PATH_A); in rtl8812ae_dm_txpwr_track_set_pwr()
1354 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8812ae_dm_txpwr_track_set_pwr()
1363 if (rtldm->modify_txagc_flag_path_a) { in rtl8812ae_dm_txpwr_track_set_pwr()
1364 rtldm->remnant_cck_idx = 0; in rtl8812ae_dm_txpwr_track_set_pwr()
1365 rtldm->remnant_ofdm_swing_idx[rf_path] = 0; in rtl8812ae_dm_txpwr_track_set_pwr()
1369 rtlphy->current_channel, RF90_PATH_A); in rtl8812ae_dm_txpwr_track_set_pwr()
1370 rtldm->modify_txagc_flag_path_a = false; in rtl8812ae_dm_txpwr_track_set_pwr()
1374 "******Path_A pDM_Odm->Modify_TxAGC_Flag = FALSE\n"); in rtl8812ae_dm_txpwr_track_set_pwr()
1381 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8812ae_dm_txpwr_track_set_pwr()
1382 final_ofdm_swing_index - in rtl8812ae_dm_txpwr_track_set_pwr()
1389 rtldm->modify_txagc_flag_path_b = true; in rtl8812ae_dm_txpwr_track_set_pwr()
1393 rtlphy->current_channel, RF90_PATH_B); in rtl8812ae_dm_txpwr_track_set_pwr()
1398 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8812ae_dm_txpwr_track_set_pwr()
1400 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8812ae_dm_txpwr_track_set_pwr()
1406 rtldm->modify_txagc_flag_path_b = true; in rtl8812ae_dm_txpwr_track_set_pwr()
1410 rtlphy->current_channel, RF90_PATH_B); in rtl8812ae_dm_txpwr_track_set_pwr()
1414 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8812ae_dm_txpwr_track_set_pwr()
1423 if (rtldm->modify_txagc_flag_path_b) { in rtl8812ae_dm_txpwr_track_set_pwr()
1424 rtldm->remnant_ofdm_swing_idx[rf_path] = 0; in rtl8812ae_dm_txpwr_track_set_pwr()
1428 rtlphy->current_channel, RF90_PATH_B); in rtl8812ae_dm_txpwr_track_set_pwr()
1430 rtldm->modify_txagc_flag_path_b = in rtl8812ae_dm_txpwr_track_set_pwr()
1434 "******Path_B pDM_Odm->Modify_TxAGC_Flag = FALSE\n"); in rtl8812ae_dm_txpwr_track_set_pwr()
1453 /* OFDM BB Swing should be less than +3.0dB, */ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1455 /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1458 * the final index of OFDM/CCK swing table. in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1472 rtldm->txpower_trackinginit = true; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1475 …"pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\… in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1476 rtldm->swing_idx_cck_base, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1477 rtldm->swing_idx_ofdm_base[RF90_PATH_A], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1478 rtldm->default_ofdm_index); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1485 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1486 if (!rtldm->txpower_track_control || in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1487 rtlefuse->eeprom_thermalmeter == 0 || in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1488 rtlefuse->eeprom_thermalmeter == 0xFF) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1493 if (rtlhal->reloadtxpowerindex) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1498 rtldm->thermalvalue_avg[rtldm->thermalvalue_avg_index] = thermal_value; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1499 rtldm->thermalvalue_avg_index++; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1500 if (rtldm->thermalvalue_avg_index == AVG_THERMAL_NUM_8812A) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1502 rtldm->thermalvalue_avg_index = 0; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1505 if (rtldm->thermalvalue_avg[i]) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1506 thermal_value_avg += rtldm->thermalvalue_avg[i]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1516 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1523 delta = (thermal_value > rtldm->thermalvalue) ? in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1524 (thermal_value - rtldm->thermalvalue) : in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1525 (rtldm->thermalvalue - thermal_value); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1526 delta_lck = (thermal_value > rtldm->thermalvalue_lck) ? in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1527 (thermal_value - rtldm->thermalvalue_lck) : in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1528 (rtldm->thermalvalue_lck - thermal_value); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1529 delta_iqk = (thermal_value > rtldm->thermalvalue_iqk) ? in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1530 (thermal_value - rtldm->thermalvalue_iqk) : in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1531 (rtldm->thermalvalue_iqk - thermal_value); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1544 rtldm->thermalvalue_lck = thermal_value; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1548 /*7. If necessary, move the index of swing table to adjust Tx power.*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1550 if (delta > 0 && rtldm->txpower_track_control) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1554 delta = thermal_value > rtlefuse->eeprom_thermalmeter ? in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1555 (thermal_value - rtlefuse->eeprom_thermalmeter) : in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1556 (rtlefuse->eeprom_thermalmeter - thermal_value); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1559 delta = TXPWR_TRACK_TABLE_SIZE - 1; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1563 if (thermal_value > rtlefuse->eeprom_thermalmeter) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1567 rtldm->delta_power_index_last[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1568 rtldm->delta_power_index[RF90_PATH_A]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1569 rtldm->delta_power_index[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1572 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1574 /*Record delta swing for mix mode power tracking*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1577 "******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1578 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1583 rtldm->delta_power_index_last[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1584 rtldm->delta_power_index[RF90_PATH_B]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1585 rtldm->delta_power_index[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1588 rtldm->absolute_ofdm_swing_idx[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1590 /*Record delta swing for mix mode power tracking*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1593 "******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1594 rtldm->absolute_ofdm_swing_idx[RF90_PATH_B]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1600 rtldm->delta_power_index_last[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1601 rtldm->delta_power_index[RF90_PATH_A]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1602 rtldm->delta_power_index[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1603 -1 * delta_swing_table_idx_tdown_a[delta]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1605 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1606 -1 * delta_swing_table_idx_tdown_a[delta]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1607 /* Record delta swing for mix mode power tracking*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1609 "******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1610 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1616 rtldm->delta_power_index_last[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1617 rtldm->delta_power_index[RF90_PATH_B]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1618 rtldm->delta_power_index[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1619 -1 * delta_swing_table_idx_tdown_b[delta]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1621 rtldm->absolute_ofdm_swing_idx[RF90_PATH_B] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1622 -1 * delta_swing_table_idx_tdown_b[delta]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1623 /*Record delta swing for mix mode power tracking*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1626 "******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1627 rtldm->absolute_ofdm_swing_idx[RF90_PATH_B]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1632 …"============================= [Path-%c]Calculating PowerIndexOffset =============================… in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1635 if (rtldm->delta_power_index[p] == in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1636 rtldm->delta_power_index_last[p]) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1639 rtldm->power_index_offset[p] = 0; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1641 rtldm->power_index_offset[p] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1642 rtldm->delta_power_index[p] - in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1643 rtldm->delta_power_index_last[p]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1648 "[Path-%c] PowerIndexOffset(%d) =DeltaPowerIndex(%d) -DeltaPowerIndexLast(%d)\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1650 rtldm->power_index_offset[p], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1651 rtldm->delta_power_index[p], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1652 rtldm->delta_power_index_last[p]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1654 rtldm->ofdm_index[p] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1655 rtldm->swing_idx_ofdm_base[p] + in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1656 rtldm->power_index_offset[p]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1657 rtldm->cck_index = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1658 rtldm->swing_idx_cck_base + in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1659 rtldm->power_index_offset[p]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1661 rtldm->swing_idx_cck = rtldm->cck_index; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1662 rtldm->swing_idx_ofdm[p] = rtldm->ofdm_index[p]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1664 /****Print BB Swing Base and Index Offset */ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1668 rtldm->swing_idx_cck, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1669 rtldm->swing_idx_cck_base, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1670 rtldm->power_index_offset[p]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1673 rtldm->swing_idx_ofdm[p], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1675 rtldm->swing_idx_ofdm_base[p], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1676 rtldm->power_index_offset[p]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1680 if (rtldm->ofdm_index[p] > TXSCALE_TABLE_SIZE - 1) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1681 rtldm->ofdm_index[p] = TXSCALE_TABLE_SIZE - 1; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1682 else if (rtldm->ofdm_index[p] < ofdm_min_index) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1683 rtldm->ofdm_index[p] = ofdm_min_index; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1687 if (rtldm->cck_index > TXSCALE_TABLE_SIZE - 1) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1688 rtldm->cck_index = TXSCALE_TABLE_SIZE - 1; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1689 else if (rtldm->cck_index < 0) in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1690 rtldm->cck_index = 0; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1693 …"The thermal meter is unchanged or TxPowerTracking OFF(%d): ThermalValue: %d , pDM_Odm->RFCalibrat… in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1694 rtldm->txpower_track_control, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1696 rtldm->thermalvalue); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1699 rtldm->power_index_offset[p] = 0; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1701 /*Print Swing base & current*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1703 "TxPowerTracking: [CCK] Swing Current Index: %d,Swing Base Index: %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1704 rtldm->cck_index, rtldm->swing_idx_cck_base); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1707 "TxPowerTracking: [OFDM] Swing Current Index: %d,Swing Base Index[%c]: %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1708 rtldm->ofdm_index[p], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1710 rtldm->swing_idx_ofdm_base[p]); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1713 if ((rtldm->power_index_offset[RF90_PATH_A] != 0 || in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1714 rtldm->power_index_offset[RF90_PATH_B] != 0) && in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1715 rtldm->txpower_track_control) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1716 /*7.2 Configure the Swing Table to adjust Tx Power. in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1717 *Always TRUE after Tx Power is adjusted by power tracking. in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1721 *to increase TX power. Otherwise, EVM will be bad. in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1723 *2012/04/25 MH Add for tx power tracking to set in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1724 *tx power in tx agc for 88E. in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1726 if (thermal_value > rtldm->thermalvalue) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1729 rtldm->power_index_offset[RF90_PATH_A], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1731 rtlefuse->eeprom_thermalmeter, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1732 rtldm->thermalvalue); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1736 rtldm->power_index_offset[RF90_PATH_B], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1738 rtlefuse->eeprom_thermalmeter, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1739 rtldm->thermalvalue); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1740 } else if (thermal_value < rtldm->thermalvalue) { /*Low temperature*/ in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1743 rtldm->power_index_offset[RF90_PATH_A], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1745 rtlefuse->eeprom_thermalmeter, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1746 rtldm->thermalvalue); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1750 rtldm->power_index_offset[RF90_PATH_B], in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1752 rtlefuse->eeprom_thermalmeter, in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1753 rtldm->thermalvalue); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1756 if (thermal_value > rtlefuse->eeprom_thermalmeter) { in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1759 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1769 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1778 rtldm->swing_idx_cck_base = rtldm->swing_idx_cck; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1780 rtldm->swing_idx_ofdm_base[p] = in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1781 rtldm->swing_idx_ofdm[p]; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1784 "pDM_Odm->RFCalibrateInfo.ThermalValue =%d ThermalValue= %d\n", in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1785 rtldm->thermalvalue, thermal_value); in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1787 rtldm->thermalvalue = thermal_value; in rtl8812ae_dm_txpower_tracking_callback_thermalmeter()
1803 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_get_delta_swing_table()
1805 u8 channel = rtlphy->current_channel; in rtl8821ae_get_delta_swing_table()
1806 u8 rate = rtldm->tx_rate; in rtl8821ae_get_delta_swing_table()
1832 /*-----------------------------------------------------------------------------
1835 * Overview: 88E change all channel tx power accordign to flag.
1848 *---------------------------------------------------------------------------
1856 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_dm_txpwr_track_set_pwr()
1862 if (rtldm->tx_rate != 0xFF) in rtl8821ae_dm_txpwr_track_set_pwr()
1863 tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate); in rtl8821ae_dm_txpwr_track_set_pwr()
1904 pwr_tracking_limit = 22; /*-1dB*/ in rtl8821ae_dm_txpwr_track_set_pwr()
1917 (rtldm->ofdm_index[RF90_PATH_A] > in rtl8821ae_dm_txpwr_track_set_pwr()
1920 rtldm->ofdm_index[RF90_PATH_A]; in rtl8821ae_dm_txpwr_track_set_pwr()
1922 …"pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_A]=%d,pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_A]=%d\n… in rtl8821ae_dm_txpwr_track_set_pwr()
1923 rtldm->ofdm_index[RF90_PATH_A], in rtl8821ae_dm_txpwr_track_set_pwr()
1931 "pDM_Odm->DefaultOfdmIndex=%d,pDM_Odm->Absolute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n", in rtl8821ae_dm_txpwr_track_set_pwr()
1932 rtldm->default_ofdm_index, in rtl8821ae_dm_txpwr_track_set_pwr()
1933 rtldm->absolute_ofdm_swing_idx[rf_path], in rtl8821ae_dm_txpwr_track_set_pwr()
1937 rtldm->default_ofdm_index + in rtl8821ae_dm_txpwr_track_set_pwr()
1938 rtldm->absolute_ofdm_swing_idx[rf_path]; in rtl8821ae_dm_txpwr_track_set_pwr()
1942 rtldm->remnant_cck_idx = in rtl8821ae_dm_txpwr_track_set_pwr()
1943 final_ofdm_swing_index - in rtl8821ae_dm_txpwr_track_set_pwr()
1946 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8821ae_dm_txpwr_track_set_pwr()
1947 final_ofdm_swing_index - in rtl8821ae_dm_txpwr_track_set_pwr()
1954 rtldm->modify_txagc_flag_path_a = true; in rtl8821ae_dm_txpwr_track_set_pwr()
1958 rtlphy->current_channel, in rtl8821ae_dm_txpwr_track_set_pwr()
1964 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8821ae_dm_txpwr_track_set_pwr()
1966 rtldm->remnant_cck_idx = final_ofdm_swing_index; in rtl8821ae_dm_txpwr_track_set_pwr()
1968 rtldm->remnant_ofdm_swing_idx[rf_path] = in rtl8821ae_dm_txpwr_track_set_pwr()
1974 rtldm->modify_txagc_flag_path_a = true; in rtl8821ae_dm_txpwr_track_set_pwr()
1978 rtlphy->current_channel, RF90_PATH_A); in rtl8821ae_dm_txpwr_track_set_pwr()
1982 rtldm->remnant_ofdm_swing_idx[rf_path]); in rtl8821ae_dm_txpwr_track_set_pwr()
1991 if (rtldm->modify_txagc_flag_path_a) { in rtl8821ae_dm_txpwr_track_set_pwr()
1992 rtldm->remnant_cck_idx = 0; in rtl8821ae_dm_txpwr_track_set_pwr()
1993 rtldm->remnant_ofdm_swing_idx[rf_path] = 0; in rtl8821ae_dm_txpwr_track_set_pwr()
1997 rtlphy->current_channel, RF90_PATH_A); in rtl8821ae_dm_txpwr_track_set_pwr()
1999 rtldm->modify_txagc_flag_path_a = false; in rtl8821ae_dm_txpwr_track_set_pwr()
2003 "******Path_A pDM_Odm->Modify_TxAGC_Flag= FALSE\n"); in rtl8821ae_dm_txpwr_track_set_pwr()
2019 struct rtl_phy *rtlphy = &rtlpriv->phy; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2025 u8 ofdm_min_index = 6; /*OFDM BB Swing should be less than +3.0dB */ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2026 /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2030 * index of OFDM/CCK swing table. in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2040 rtldm->txpower_trackinginit = true; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2043 …"===>%s,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmI… in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2045 rtldm->swing_idx_cck_base, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2046 rtldm->swing_idx_ofdm_base[RF90_PATH_A], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2047 rtldm->default_ofdm_index); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2051 if (!rtldm->txpower_track_control || in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2052 rtlefuse->eeprom_thermalmeter == 0 || in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2053 rtlefuse->eeprom_thermalmeter == 0xFF) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2058 if (rtlhal->reloadtxpowerindex) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2064 rtldm->thermalvalue_avg[rtldm->thermalvalue_avg_index] = thermal_value; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2065 rtldm->thermalvalue_avg_index++; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2066 if (rtldm->thermalvalue_avg_index == AVG_THERMAL_NUM_8812A) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2068 rtldm->thermalvalue_avg_index = 0; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2071 if (rtldm->thermalvalue_avg[i]) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2072 thermal_value_avg += rtldm->thermalvalue_avg[i]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2082 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2089 delta = (thermal_value > rtldm->thermalvalue) ? in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2090 (thermal_value - rtldm->thermalvalue) : in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2091 (rtldm->thermalvalue - thermal_value); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2092 delta_lck = (thermal_value > rtldm->thermalvalue_lck) ? in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2093 (thermal_value - rtldm->thermalvalue_lck) : in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2094 (rtldm->thermalvalue_lck - thermal_value); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2095 delta_iqk = (thermal_value > rtldm->thermalvalue_iqk) ? in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2096 (thermal_value - rtldm->thermalvalue_iqk) : in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2097 (rtldm->thermalvalue_iqk - thermal_value); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2109 rtldm->thermalvalue_lck = thermal_value; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2113 /*7. If necessary, move the index of swing table to adjust Tx power.*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2115 if (delta > 0 && rtldm->txpower_track_control) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2119 delta = thermal_value > rtlefuse->eeprom_thermalmeter ? in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2120 (thermal_value - rtlefuse->eeprom_thermalmeter) : in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2121 (rtlefuse->eeprom_thermalmeter - thermal_value); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2124 delta = TXSCALE_TABLE_SIZE - 1; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2128 if (thermal_value > rtlefuse->eeprom_thermalmeter) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2132 rtldm->delta_power_index_last[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2133 rtldm->delta_power_index[RF90_PATH_A]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2134 rtldm->delta_power_index[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2137 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2139 /*Record delta swing for mix mode power tracking*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2142 "******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2143 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2149 rtldm->delta_power_index_last[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2150 rtldm->delta_power_index[RF90_PATH_A]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2151 rtldm->delta_power_index[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2152 -1 * delta_swing_table_idx_tdown_a[delta]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2154 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2155 -1 * delta_swing_table_idx_tdown_a[delta]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2156 /* Record delta swing for mix mode power tracking*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2158 "******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2159 rtldm->absolute_ofdm_swing_idx[RF90_PATH_A]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2164 …"\n\n================================ [Path-%c]Calculating PowerIndexOffset ======================… in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2169 if (rtldm->delta_power_index[p] == in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2170 rtldm->delta_power_index_last[p]) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2172 rtldm->power_index_offset[p] = 0; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2174 rtldm->power_index_offset[p] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2175 rtldm->delta_power_index[p] - in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2176 rtldm->delta_power_index_last[p]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2180 "[Path-%c] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2182 rtldm->power_index_offset[p], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2183 rtldm->delta_power_index[p] , in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2184 rtldm->delta_power_index_last[p]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2186 rtldm->ofdm_index[p] = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2187 rtldm->swing_idx_ofdm_base[p] + in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2188 rtldm->power_index_offset[p]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2189 rtldm->cck_index = in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2190 rtldm->swing_idx_cck_base + in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2191 rtldm->power_index_offset[p]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2193 rtldm->swing_idx_cck = rtldm->cck_index; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2194 rtldm->swing_idx_ofdm[p] = rtldm->ofdm_index[p]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2196 /*********Print BB Swing Base and Index Offset********/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2200 rtldm->swing_idx_cck, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2201 rtldm->swing_idx_cck_base, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2202 rtldm->power_index_offset[p]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2205 rtldm->swing_idx_ofdm[p], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2207 rtldm->swing_idx_ofdm_base[p], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2208 rtldm->power_index_offset[p]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2212 if (rtldm->ofdm_index[p] > TXSCALE_TABLE_SIZE - 1) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2213 rtldm->ofdm_index[p] = TXSCALE_TABLE_SIZE - 1; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2214 else if (rtldm->ofdm_index[p] < ofdm_min_index) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2215 rtldm->ofdm_index[p] = ofdm_min_index; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2219 if (rtldm->cck_index > TXSCALE_TABLE_SIZE - 1) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2220 rtldm->cck_index = TXSCALE_TABLE_SIZE - 1; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2221 else if (rtldm->cck_index < 0) in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2222 rtldm->cck_index = 0; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2225 …"The thermal meter is unchanged or TxPowerTracking OFF(%d):ThermalValue: %d , pDM_Odm->RFCalibrate… in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2226 rtldm->txpower_track_control, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2228 rtldm->thermalvalue); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2231 rtldm->power_index_offset[p] = 0; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2234 "TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2235 /*Print Swing base & current*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2236 rtldm->cck_index, rtldm->swing_idx_cck_base); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2239 "TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%c]: %d\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2240 rtldm->ofdm_index[p], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2242 rtldm->swing_idx_ofdm_base[p]); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2245 if ((rtldm->power_index_offset[RF90_PATH_A] != 0 || in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2246 rtldm->power_index_offset[RF90_PATH_B] != 0) && in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2247 rtldm->txpower_track_control) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2248 /*7.2 Configure the Swing Table to adjust Tx Power.*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2249 /*Always TRUE after Tx Power is adjusted by power tracking.*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2253 * to increase TX power. Otherwise, EVM will be bad. in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2255 * 2012/04/25 MH Add for tx power tracking to in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2256 * set tx power in tx agc for 88E. in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2258 if (thermal_value > rtldm->thermalvalue) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2261 rtldm->power_index_offset[RF90_PATH_A], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2263 rtlefuse->eeprom_thermalmeter, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2264 rtldm->thermalvalue); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2265 } else if (thermal_value < rtldm->thermalvalue) { /*Low temperature*/ in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2268 rtldm->power_index_offset[RF90_PATH_A], in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2270 rtlefuse->eeprom_thermalmeter, in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2271 rtldm->thermalvalue); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2274 if (thermal_value > rtlefuse->eeprom_thermalmeter) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2277 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2287 thermal_value, rtlefuse->eeprom_thermalmeter); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2296 rtldm->swing_idx_cck_base = rtldm->swing_idx_cck; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2298 rtldm->swing_idx_ofdm_base[p] = rtldm->swing_idx_ofdm[p]; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2301 "pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n", in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2302 rtldm->thermalvalue, thermal_value); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2304 rtldm->thermalvalue = thermal_value; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2310 if (!rtlphy->lck_inprogress) { in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2311 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2312 rtlphy->lck_inprogress = true; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2313 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2317 spin_lock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2318 rtlphy->lck_inprogress = false; in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2319 spin_unlock(&rtlpriv->locks.iqk_lock); in rtl8821ae_dm_txpower_tracking_callback_thermalmeter()
2329 if (!rtlpriv->dm.tm_trigger) { in rtl8821ae_dm_check_txpower_tracking_thermalmeter()
2334 rtlpriv->dm.tm_trigger = 1; in rtl8821ae_dm_check_txpower_tracking_thermalmeter()
2341 rtlpriv->dm.tm_trigger = 0; in rtl8821ae_dm_check_txpower_tracking_thermalmeter()
2350 struct rate_adaptive *p_ra = &rtlpriv->ra; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2351 u32 low_rssithresh_for_ra = p_ra->low2high_rssi_thresh_for_ra40m; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2352 u32 high_rssithresh_for_ra = p_ra->high_rssi_thresh_for_ra; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2362 if (!rtlpriv->dm.useramask) { in rtl8821ae_dm_refresh_rate_adaptive_mask()
2368 if (mac->link_state == MAC80211_LINKED && in rtl8821ae_dm_refresh_rate_adaptive_mask()
2369 mac->opmode == NL80211_IFTYPE_STATION) { in rtl8821ae_dm_refresh_rate_adaptive_mask()
2370 switch (p_ra->pre_ratr_state) { in rtl8821ae_dm_refresh_rate_adaptive_mask()
2382 if (rtlpriv->dm.undec_sm_pwdb > in rtl8821ae_dm_refresh_rate_adaptive_mask()
2384 p_ra->ratr_state = DM_RATR_STA_HIGH; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2385 else if (rtlpriv->dm.undec_sm_pwdb > in rtl8821ae_dm_refresh_rate_adaptive_mask()
2387 p_ra->ratr_state = DM_RATR_STA_MIDDLE; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2389 p_ra->ratr_state = DM_RATR_STA_LOW; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2391 if (p_ra->pre_ratr_state != p_ra->ratr_state) { in rtl8821ae_dm_refresh_rate_adaptive_mask()
2394 rtlpriv->dm.undec_sm_pwdb); in rtl8821ae_dm_refresh_rate_adaptive_mask()
2396 "RSSI_LEVEL = %d\n", p_ra->ratr_state); in rtl8821ae_dm_refresh_rate_adaptive_mask()
2399 p_ra->pre_ratr_state, p_ra->ratr_state); in rtl8821ae_dm_refresh_rate_adaptive_mask()
2402 sta = rtl_find_sta(hw, mac->bssid); in rtl8821ae_dm_refresh_rate_adaptive_mask()
2404 rtlpriv->cfg->ops->update_rate_tbl(hw, in rtl8821ae_dm_refresh_rate_adaptive_mask()
2405 sta, p_ra->ratr_state, true); in rtl8821ae_dm_refresh_rate_adaptive_mask()
2408 p_ra->pre_ratr_state = p_ra->ratr_state; in rtl8821ae_dm_refresh_rate_adaptive_mask()
2416 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_refresh_basic_rate_mask()
2417 struct rtl_mac *mac = &rtlpriv->mac80211; in rtl8821ae_dm_refresh_basic_rate_mask()
2422 if (mac->link_state < MAC80211_LINKED) in rtl8821ae_dm_refresh_basic_rate_mask()
2424 else if (dm_digtable->rssi_val_min < 25) in rtl8821ae_dm_refresh_basic_rate_mask()
2426 else if (dm_digtable->rssi_val_min > 30) in rtl8821ae_dm_refresh_basic_rate_mask()
2433 basic_rate &= (!(basic_rate ^ mac->basic_rates)); in rtl8821ae_dm_refresh_basic_rate_mask()
2434 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_dm_refresh_basic_rate_mask()
2437 rtlpriv->cfg->ops->set_hw_reg(hw, in rtl8821ae_dm_refresh_basic_rate_mask()
2438 HW_VAR_BASIC_RATE, (u8 *)&mac->basic_rates); in rtl8821ae_dm_refresh_basic_rate_mask()
2481 /*Keep past Tx/Rx packet count for RT-to-RT EDCA turbo.*/ in rtl8821ae_dm_check_edca_turbo()
2498 if (rtlpriv->dm.dbginfo.num_non_be_pkt > 0x100) in rtl8821ae_dm_check_edca_turbo()
2499 rtlpriv->dm.is_any_nonbepkts = true; in rtl8821ae_dm_check_edca_turbo()
2500 rtlpriv->dm.dbginfo.num_non_be_pkt = 0; in rtl8821ae_dm_check_edca_turbo()
2506 pb_is_cur_rdl_state = &rtlpriv->dm.is_cur_rdlstate; in rtl8821ae_dm_check_edca_turbo()
2508 cur_tx_ok_cnt = rtlpriv->stats.txbytesunicast - rtldm->last_tx_ok_cnt; in rtl8821ae_dm_check_edca_turbo()
2509 cur_rx_ok_cnt = rtlpriv->stats.rxbytesunicast - rtldm->last_rx_ok_cnt; in rtl8821ae_dm_check_edca_turbo()
2511 rtldm->last_tx_ok_cnt = rtlpriv->stats.txbytesunicast; in rtl8821ae_dm_check_edca_turbo()
2512 rtldm->last_rx_ok_cnt = rtlpriv->stats.rxbytesunicast; in rtl8821ae_dm_check_edca_turbo()
2514 iot_peer = rtlpriv->mac80211.vendor; in rtl8821ae_dm_check_edca_turbo()
2516 b_edca_turbo_on = ((!rtlpriv->dm.is_any_nonbepkts) && in rtl8821ae_dm_check_edca_turbo()
2517 (!rtlpriv->dm.disable_framebursting)) ? in rtl8821ae_dm_check_edca_turbo()
2520 if (rtlpriv->rtlhal.hw_type != HARDWARE_TYPE_RTL8812AE) { in rtl8821ae_dm_check_edca_turbo()
2522 (mac->mode == WIRELESS_MODE_N_24G)) { in rtl8821ae_dm_check_edca_turbo()
2530 rtlpriv->dm.is_any_nonbepkts, in rtl8821ae_dm_check_edca_turbo()
2531 rtlpriv->dm.disable_framebursting); in rtl8821ae_dm_check_edca_turbo()
2556 rtlpriv->dm.current_turbo_edca = true; in rtl8821ae_dm_check_edca_turbo()
2562 if (rtlpriv->dm.current_turbo_edca) { in rtl8821ae_dm_check_edca_turbo()
2564 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, in rtl8821ae_dm_check_edca_turbo()
2567 rtlpriv->dm.current_turbo_edca = false; in rtl8821ae_dm_check_edca_turbo()
2570 rtlpriv->dm.is_any_nonbepkts = false; in rtl8821ae_dm_check_edca_turbo()
2571 rtldm->last_tx_ok_cnt = rtlpriv->stats.txbytesunicast; in rtl8821ae_dm_check_edca_turbo()
2572 rtldm->last_rx_ok_cnt = rtlpriv->stats.rxbytesunicast; in rtl8821ae_dm_check_edca_turbo()
2578 struct dig_t *dm_digtable = &rtlpriv->dm_digtable; in rtl8821ae_dm_cck_packet_detection_thresh()
2581 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) { in rtl8821ae_dm_cck_packet_detection_thresh()
2582 if (dm_digtable->rssi_val_min > 25) { in rtl8821ae_dm_cck_packet_detection_thresh()
2584 } else if ((dm_digtable->rssi_val_min <= 25) && in rtl8821ae_dm_cck_packet_detection_thresh()
2585 (dm_digtable->rssi_val_min > 10)) { in rtl8821ae_dm_cck_packet_detection_thresh()
2588 if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) in rtl8821ae_dm_cck_packet_detection_thresh()
2594 if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) in rtl8821ae_dm_cck_packet_detection_thresh()
2600 if (dm_digtable->cur_cck_cca_thres != cur_cck_cca_thresh) in rtl8821ae_dm_cck_packet_detection_thresh()
2604 dm_digtable->pre_cck_cca_thres = dm_digtable->cur_cck_cca_thres; in rtl8821ae_dm_cck_packet_detection_thresh()
2605 dm_digtable->cur_cck_cca_thres = cur_cck_cca_thresh; in rtl8821ae_dm_cck_packet_detection_thresh()
2607 "CCK cca thresh hold =%x\n", dm_digtable->cur_cck_cca_thres); in rtl8821ae_dm_cck_packet_detection_thresh()
2619 if (rtlpriv->mac80211.link_state < MAC80211_LINKED) { in rtl8821ae_dm_dynamic_atc_switch()
2621 if (rtldm->atc_status == ATC_STATUS_OFF) { in rtl8821ae_dm_dynamic_atc_switch()
2623 rtldm->atc_status = ATC_STATUS_ON; in rtl8821ae_dm_dynamic_atc_switch()
2628 "atc_status = %d\n", rtldm->atc_status); in rtl8821ae_dm_dynamic_atc_switch()
2630 if (rtldm->crystal_cap != rtlpriv->efuse.crystalcap) { in rtl8821ae_dm_dynamic_atc_switch()
2631 rtldm->crystal_cap = rtlpriv->efuse.crystalcap; in rtl8821ae_dm_dynamic_atc_switch()
2632 crystal_cap = rtldm->crystal_cap & 0x3f; in rtl8821ae_dm_dynamic_atc_switch()
2634 if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_dynamic_atc_switch()
2644 rtldm->crystal_cap); in rtl8821ae_dm_dynamic_atc_switch()
2646 /*1. Calculate CFO for path-A & path-B*/ in rtl8821ae_dm_dynamic_atc_switch()
2647 cfo_khz_a = (int)(rtldm->cfo_tail[0] * 3125) / 1280; in rtl8821ae_dm_dynamic_atc_switch()
2648 cfo_khz_b = (int)(rtldm->cfo_tail[1] * 3125) / 1280; in rtl8821ae_dm_dynamic_atc_switch()
2649 packet_count = rtldm->packet_count; in rtl8821ae_dm_dynamic_atc_switch()
2652 if (packet_count == rtldm->packet_count_pre) { in rtl8821ae_dm_dynamic_atc_switch()
2658 rtldm->packet_count_pre = packet_count; in rtl8821ae_dm_dynamic_atc_switch()
2661 rtldm->packet_count); in rtl8821ae_dm_dynamic_atc_switch()
2664 if (rtlpriv->phy.rf_type == RF_1T1R) in rtl8821ae_dm_dynamic_atc_switch()
2674 cfo_ave_diff = (rtldm->cfo_ave_pre >= cfo_ave) ? in rtl8821ae_dm_dynamic_atc_switch()
2675 (rtldm->cfo_ave_pre - cfo_ave) : in rtl8821ae_dm_dynamic_atc_switch()
2676 (cfo_ave - rtldm->cfo_ave_pre); in rtl8821ae_dm_dynamic_atc_switch()
2678 if (cfo_ave_diff > 20 && !rtldm->large_cfo_hit) { in rtl8821ae_dm_dynamic_atc_switch()
2681 rtldm->large_cfo_hit = true; in rtl8821ae_dm_dynamic_atc_switch()
2684 rtldm->large_cfo_hit = false; in rtl8821ae_dm_dynamic_atc_switch()
2686 rtldm->cfo_ave_pre = cfo_ave; in rtl8821ae_dm_dynamic_atc_switch()
2691 if (cfo_ave >= -rtldm->cfo_threshold && in rtl8821ae_dm_dynamic_atc_switch()
2692 cfo_ave <= rtldm->cfo_threshold && in rtl8821ae_dm_dynamic_atc_switch()
2693 rtldm->is_freeze == 0) { in rtl8821ae_dm_dynamic_atc_switch()
2694 if (rtldm->cfo_threshold == CFO_THRESHOLD_XTAL) { in rtl8821ae_dm_dynamic_atc_switch()
2695 rtldm->cfo_threshold = CFO_THRESHOLD_XTAL + 10; in rtl8821ae_dm_dynamic_atc_switch()
2696 rtldm->is_freeze = 1; in rtl8821ae_dm_dynamic_atc_switch()
2698 rtldm->cfo_threshold = CFO_THRESHOLD_XTAL; in rtl8821ae_dm_dynamic_atc_switch()
2703 rtldm->cfo_threshold); in rtl8821ae_dm_dynamic_atc_switch()
2706 if (cfo_ave > rtldm->cfo_threshold && rtldm->crystal_cap < 0x3f) in rtl8821ae_dm_dynamic_atc_switch()
2707 adjust_xtal = ((cfo_ave - CFO_THRESHOLD_XTAL) >> 2) + 1; in rtl8821ae_dm_dynamic_atc_switch()
2708 else if ((cfo_ave < -rtlpriv->dm.cfo_threshold) && in rtl8821ae_dm_dynamic_atc_switch()
2709 rtlpriv->dm.crystal_cap > 0) in rtl8821ae_dm_dynamic_atc_switch()
2710 adjust_xtal = ((cfo_ave + CFO_THRESHOLD_XTAL) >> 2) - 1; in rtl8821ae_dm_dynamic_atc_switch()
2713 rtldm->crystal_cap, adjust_xtal); in rtl8821ae_dm_dynamic_atc_switch()
2717 rtldm->is_freeze = 0; in rtl8821ae_dm_dynamic_atc_switch()
2718 rtldm->crystal_cap += adjust_xtal; in rtl8821ae_dm_dynamic_atc_switch()
2720 if (rtldm->crystal_cap > 0x3f) in rtl8821ae_dm_dynamic_atc_switch()
2721 rtldm->crystal_cap = 0x3f; in rtl8821ae_dm_dynamic_atc_switch()
2722 else if (rtldm->crystal_cap < 0) in rtl8821ae_dm_dynamic_atc_switch()
2723 rtldm->crystal_cap = 0; in rtl8821ae_dm_dynamic_atc_switch()
2725 crystal_cap = rtldm->crystal_cap & 0x3f; in rtl8821ae_dm_dynamic_atc_switch()
2727 if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_dynamic_atc_switch()
2737 rtldm->crystal_cap); in rtl8821ae_dm_dynamic_atc_switch()
2750 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, in rtl8821ae_dm_watchdog()
2753 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, in rtl8821ae_dm_watchdog()
2756 if (ppsc->p2p_ps_info.p2p_ps_mode) in rtl8821ae_dm_watchdog()
2759 spin_lock(&rtlpriv->locks.rf_ps_lock); in rtl8821ae_dm_watchdog()
2760 if ((ppsc->rfpwr_state == ERFON) && in rtl8821ae_dm_watchdog()
2762 (!ppsc->rfchange_inprogress)) { in rtl8821ae_dm_watchdog()
2772 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_watchdog()
2778 spin_unlock(&rtlpriv->locks.rf_ps_lock); in rtl8821ae_dm_watchdog()
2780 rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; in rtl8821ae_dm_watchdog()
2790 struct fast_ant_training *pfat_table = &rtldm->fat_table; in rtl8821ae_dm_set_tx_ant_by_tx_info()
2793 if (rtlhal->hw_type != HARDWARE_TYPE_RTL8812AE) in rtl8821ae_dm_set_tx_ant_by_tx_info()
2796 if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) in rtl8821ae_dm_set_tx_ant_by_tx_info()
2797 set_tx_desc_tx_ant(pdesc32, pfat_table->antsel_a[mac_id]); in rtl8821ae_dm_set_tx_ant_by_tx_info()