Lines Matching +full:channel +full:- +full:11
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2018-2019 Realtek Corporation
26 ether_addr_copy(efuse->addr, map->e.mac_addr); in rtw8822be_efuse_parsing()
32 ether_addr_copy(efuse->addr, map->u.mac_addr); in rtw8822bu_efuse_parsing()
38 ether_addr_copy(efuse->addr, map->s.mac_addr); in rtw8822bs_efuse_parsing()
43 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_read_efuse()
49 efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(7)); in rtw8822b_read_efuse()
50 efuse->rfe_option = map->rfe_option; in rtw8822b_read_efuse()
51 efuse->rf_board_option = map->rf_board_option; in rtw8822b_read_efuse()
52 efuse->crystal_cap = map->xtal_k; in rtw8822b_read_efuse()
53 efuse->pa_type_2g = map->pa_type; in rtw8822b_read_efuse()
54 efuse->pa_type_5g = map->pa_type; in rtw8822b_read_efuse()
55 efuse->lna_type_2g = map->lna_type_2g[0]; in rtw8822b_read_efuse()
56 efuse->lna_type_5g = map->lna_type_5g[0]; in rtw8822b_read_efuse()
57 efuse->channel_plan = map->channel_plan; in rtw8822b_read_efuse()
58 efuse->country_code[0] = map->country_code[0]; in rtw8822b_read_efuse()
59 efuse->country_code[1] = map->country_code[1]; in rtw8822b_read_efuse()
60 efuse->bt_setting = map->rf_bt_setting; in rtw8822b_read_efuse()
61 efuse->regd = map->rf_board_option & 0x7; in rtw8822b_read_efuse()
62 efuse->thermal_meter[RF_PATH_A] = map->thermal_meter; in rtw8822b_read_efuse()
63 efuse->thermal_meter_k = map->thermal_meter; in rtw8822b_read_efuse()
66 efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i]; in rtw8822b_read_efuse()
80 return -ENOTSUPP; in rtw8822b_read_efuse()
95 rtw_write32_mask(rtwdev, 0x1990, (BIT(11) | BIT(10)), 0x3); in rtw8822b_phy_rfe_init()
99 rtw_write32_mask(rtwdev, 0x974, (BIT(11) | BIT(10)), 0x3); in rtw8822b_phy_rfe_init()
127 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_pwrtrack_init()
132 dm_info->default_ofdm_index = 24; in rtw8822b_pwrtrack_init()
134 dm_info->default_ofdm_index = swing_idx; in rtw8822b_pwrtrack_init()
136 for (path = RF_PATH_A; path < rtwdev->hal.rf_path_num; path++) { in rtw8822b_pwrtrack_init()
137 ewma_thermal_init(&dm_info->avg_thermal[path]); in rtw8822b_pwrtrack_init()
138 dm_info->delta_power_index[path] = 0; in rtw8822b_pwrtrack_init()
140 dm_info->pwr_trk_triggered = false; in rtw8822b_pwrtrack_init()
141 dm_info->pwr_trk_init_trigger = true; in rtw8822b_pwrtrack_init()
142 dm_info->thermal_meter_k = rtwdev->efuse.thermal_meter_k; in rtw8822b_pwrtrack_init()
154 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_phy_set_param()
170 crystal_cap = rtwdev->efuse.crystal_cap & 0x3F; in rtw8822b_phy_set_param()
178 rtw8822b_config_trx_mode(rtwdev, hal->antenna_tx, hal->antenna_rx, in rtw8822b_phy_set_param()
268 /* Set beacon cotnrol - enable TSF and other related functions */ in rtw8822b_mac_init()
290 static void rtw8822b_set_channel_rfe_efem(struct rtw_dev *rtwdev, u8 channel) in rtw8822b_set_channel_rfe_efem() argument
292 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_channel_rfe_efem()
294 if (IS_CH_2G_BAND(channel)) { in rtw8822b_set_channel_rfe_efem()
304 rtw_write32s_mask(rtwdev, REG_RFEINV, BIT(11) | BIT(10) | 0x3f, 0x0); in rtw8822b_set_channel_rfe_efem()
306 if (hal->antenna_rx == BB_PATH_AB || in rtw8822b_set_channel_rfe_efem()
307 hal->antenna_tx == BB_PATH_AB) { in rtw8822b_set_channel_rfe_efem()
310 } else if (hal->antenna_rx == hal->antenna_tx) { in rtw8822b_set_channel_rfe_efem()
319 static void rtw8822b_set_channel_rfe_ifem(struct rtw_dev *rtwdev, u8 channel) in rtw8822b_set_channel_rfe_ifem() argument
321 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_channel_rfe_ifem()
323 if (IS_CH_2G_BAND(channel)) { in rtw8822b_set_channel_rfe_ifem()
333 rtw_write32s_mask(rtwdev, REG_RFEINV, BIT(11) | BIT(10) | 0x3f, 0x0); in rtw8822b_set_channel_rfe_ifem()
335 if (IS_CH_2G_BAND(channel)) { in rtw8822b_set_channel_rfe_ifem()
336 if (hal->antenna_rx == BB_PATH_AB || in rtw8822b_set_channel_rfe_ifem()
337 hal->antenna_tx == BB_PATH_AB) { in rtw8822b_set_channel_rfe_ifem()
340 } else if (hal->antenna_rx == hal->antenna_tx) { in rtw8822b_set_channel_rfe_ifem()
387 *reg82c = cca_ccut->reg82c[col]; in rtw8822b_get_cca_val()
388 *reg830 = cca_ccut->reg830[col]; in rtw8822b_get_cca_val()
389 *reg838 = cca_ccut->reg838[col]; in rtw8822b_get_cca_val()
397 void (*rtw_set_channel_rfe)(struct rtw_dev *rtwdev, u8 channel);
421 static void rtw8822b_set_channel_cca(struct rtw_dev *rtwdev, u8 channel, u8 bw, in rtw8822b_set_channel_cca() argument
424 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_channel_cca()
425 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_set_channel_cca()
431 if (IS_CH_2G_BAND(channel)) { in rtw8822b_set_channel_cca()
432 cca_ccut = rfe_info->cca_ccut_2g; in rtw8822b_set_channel_cca()
434 if (hal->antenna_rx == BB_PATH_A || in rtw8822b_set_channel_cca()
435 hal->antenna_rx == BB_PATH_B) in rtw8822b_set_channel_cca()
440 cca_ccut = rfe_info->cca_ccut_5g; in rtw8822b_set_channel_cca()
442 if (hal->antenna_rx == BB_PATH_A || in rtw8822b_set_channel_cca()
443 hal->antenna_rx == BB_PATH_B) in rtw8822b_set_channel_cca()
451 switch (rfe_info->fem) { in rtw8822b_set_channel_cca()
455 if (rfe_info->ifem_ext) in rtw8822b_set_channel_cca()
462 if (IS_CH_2G_BAND(channel)) in rtw8822b_set_channel_cca()
470 if ((hal->cut_version == RTW_CHIP_VER_CUT_B && in rtw8822b_set_channel_cca()
475 (efuse->rfe_option == 5 && col == CCUT_IDX_2R_5G)) in rtw8822b_set_channel_cca()
483 if (is_efem_cca && !(hal->cut_version == RTW_CHIP_VER_CUT_B)) in rtw8822b_set_channel_cca()
486 if (bw == RTW_CHANNEL_WIDTH_20 && IS_CH_5G_BAND_MID(channel)) in rtw8822b_set_channel_cca()
498 static void rtw8822b_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) in rtw8822b_set_channel_rf() argument
507 #define RF18_BW_MASK (BIT(11) | BIT(10)) in rtw8822b_set_channel_rf()
508 #define RF18_BW_20M (BIT(11) | BIT(10)) in rtw8822b_set_channel_rf()
509 #define RF18_BW_40M (BIT(11)) in rtw8822b_set_channel_rf()
513 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_channel_rf()
521 rf_reg18 |= (IS_CH_2G_BAND(channel) ? RF18_BAND_2G : RF18_BAND_5G); in rtw8822b_set_channel_rf()
522 rf_reg18 |= (channel & RF18_CHANNEL_MASK); in rtw8822b_set_channel_rf()
523 if (channel > 144) in rtw8822b_set_channel_rf()
525 else if (channel >= 80) in rtw8822b_set_channel_rf()
543 if (IS_CH_2G_BAND(channel)) in rtw8822b_set_channel_rf()
545 else if (IS_CH_5G_BAND_1(channel) || IS_CH_5G_BAND_2(channel)) in rtw8822b_set_channel_rf()
546 rf_reg_be = low_band[(channel - 36) >> 1]; in rtw8822b_set_channel_rf()
547 else if (IS_CH_5G_BAND_3(channel)) in rtw8822b_set_channel_rf()
548 rf_reg_be = middle_band[(channel - 100) >> 1]; in rtw8822b_set_channel_rf()
549 else if (IS_CH_5G_BAND_4(channel)) in rtw8822b_set_channel_rf()
550 rf_reg_be = high_band[(channel - 149) >> 1]; in rtw8822b_set_channel_rf()
556 /* need to set 0xdf[18]=1 before writing RF18 when channel 144 */ in rtw8822b_set_channel_rf()
557 if (channel == 144) in rtw8822b_set_channel_rf()
563 if (hal->rf_type > RF_1T1R) in rtw8822b_set_channel_rf()
577 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_toggle_igi()
581 rtw_write32_mask(rtwdev, REG_RXIGI_A, 0x7f, igi - 2); in rtw8822b_toggle_igi()
583 rtw_write32_mask(rtwdev, REG_RXIGI_B, 0x7f, igi - 2); in rtw8822b_toggle_igi()
588 hal->antenna_rx | (hal->antenna_rx << 4)); in rtw8822b_toggle_igi()
611 static void rtw8822b_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw, in rtw8822b_set_channel_bb() argument
614 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_set_channel_bb()
615 u8 rfe_option = efuse->rfe_option; in rtw8822b_set_channel_bb()
618 if (IS_CH_2G_BAND(channel)) { in rtw8822b_set_channel_bb()
626 if (channel == 14) { in rtw8822b_set_channel_bb()
635 } else if (IS_CH_5G_BAND(channel)) { in rtw8822b_set_channel_bb()
641 if (IS_CH_5G_BAND_1(channel) || IS_CH_5G_BAND_2(channel)) in rtw8822b_set_channel_bb()
643 else if (IS_CH_5G_BAND_3(channel)) in rtw8822b_set_channel_bb()
645 else if (IS_CH_5G_BAND_4(channel)) in rtw8822b_set_channel_bb()
648 if (IS_CH_5G_BAND_1(channel)) in rtw8822b_set_channel_bb()
650 else if (IS_CH_5G_BAND_2(channel)) in rtw8822b_set_channel_bb()
652 else if (channel >= 100 && channel <= 116) in rtw8822b_set_channel_bb()
654 else if (channel >= 118 && channel <= 177) in rtw8822b_set_channel_bb()
717 static void rtw8822b_set_channel(struct rtw_dev *rtwdev, u8 channel, u8 bw, in rtw8822b_set_channel() argument
720 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_set_channel()
723 if (WARN(efuse->rfe_option >= ARRAY_SIZE(rtw8822b_rfe_info), in rtw8822b_set_channel()
724 "rfe_option %d is out of boundary\n", efuse->rfe_option)) in rtw8822b_set_channel()
727 rfe_info = &rtw8822b_rfe_info[efuse->rfe_option]; in rtw8822b_set_channel()
729 rtw8822b_set_channel_bb(rtwdev, channel, bw, primary_chan_idx); in rtw8822b_set_channel()
730 rtw_set_channel_mac(rtwdev, channel, bw, primary_chan_idx); in rtw8822b_set_channel()
731 rtw8822b_set_channel_rf(rtwdev, channel, bw); in rtw8822b_set_channel()
734 rtw8822b_set_channel_cca(rtwdev, channel, bw, rfe_info); in rtw8822b_set_channel()
735 (*rfe_info->rtw_set_channel_rfe)(rtwdev, channel); in rtw8822b_set_channel()
741 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_config_trx_mode()
743 u8 ch = rtwdev->hal.current_channel; in rtw8822b_config_trx_mode()
747 if (WARN(efuse->rfe_option >= ARRAY_SIZE(rtw8822b_rfe_info), in rtw8822b_config_trx_mode()
748 "rfe_option %d is out of boundary\n", efuse->rfe_option)) in rtw8822b_config_trx_mode()
751 rfe_info = &rtw8822b_rfe_info[efuse->rfe_option]; in rtw8822b_config_trx_mode()
784 if (is_tx2_path || rtwdev->mp_mode) { in rtw8822b_config_trx_mode()
811 for (counter = 100; counter > 0; counter--) { in rtw8822b_config_trx_mode()
836 (*rfe_info->rtw_set_channel_rfe)(rtwdev, ch); in rtw8822b_config_trx_mode()
842 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in query_phy_status_page0()
843 s8 min_rx_power = -120; in query_phy_status_page0()
847 pkt_stat->rx_power[RF_PATH_A] = pwdb - 110; in query_phy_status_page0()
848 pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1); in query_phy_status_page0()
849 pkt_stat->bw = RTW_CHANNEL_WIDTH_20; in query_phy_status_page0()
850 pkt_stat->signal_power = max(pkt_stat->rx_power[RF_PATH_A], in query_phy_status_page0()
852 dm_info->rssi[RF_PATH_A] = pkt_stat->rssi; in query_phy_status_page0()
858 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in query_phy_status_page1()
860 s8 min_rx_power = -120; in query_phy_status_page1()
866 if (pkt_stat->rate > DESC_RATE11M && pkt_stat->rate < DESC_RATEMCS0) in query_phy_status_page1()
880 pkt_stat->rx_power[RF_PATH_A] = GET_PHY_STAT_P1_PWDB_A(phy_status) - 110; in query_phy_status_page1()
881 pkt_stat->rx_power[RF_PATH_B] = GET_PHY_STAT_P1_PWDB_B(phy_status) - 110; in query_phy_status_page1()
882 pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 2); in query_phy_status_page1()
883 pkt_stat->bw = bw; in query_phy_status_page1()
884 pkt_stat->signal_power = max3(pkt_stat->rx_power[RF_PATH_A], in query_phy_status_page1()
885 pkt_stat->rx_power[RF_PATH_B], in query_phy_status_page1()
888 dm_info->curr_rx_rate = pkt_stat->rate; in query_phy_status_page1()
890 pkt_stat->rx_evm[RF_PATH_A] = GET_PHY_STAT_P1_RXEVM_A(phy_status); in query_phy_status_page1()
891 pkt_stat->rx_evm[RF_PATH_B] = GET_PHY_STAT_P1_RXEVM_B(phy_status); in query_phy_status_page1()
893 pkt_stat->rx_snr[RF_PATH_A] = GET_PHY_STAT_P1_RXSNR_A(phy_status); in query_phy_status_page1()
894 pkt_stat->rx_snr[RF_PATH_B] = GET_PHY_STAT_P1_RXSNR_B(phy_status); in query_phy_status_page1()
896 pkt_stat->cfo_tail[RF_PATH_A] = GET_PHY_STAT_P1_CFO_TAIL_A(phy_status); in query_phy_status_page1()
897 pkt_stat->cfo_tail[RF_PATH_B] = GET_PHY_STAT_P1_CFO_TAIL_B(phy_status); in query_phy_status_page1()
899 for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { in query_phy_status_page1()
900 rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); in query_phy_status_page1()
901 dm_info->rssi[path] = rssi; in query_phy_status_page1()
902 dm_info->rx_snr[path] = pkt_stat->rx_snr[path] >> 1; in query_phy_status_page1()
903 dm_info->cfo_tail[path] = (pkt_stat->cfo_tail[path] * 5) >> 1; in query_phy_status_page1()
905 rx_evm = pkt_stat->rx_evm[path]; in query_phy_status_page1()
911 evm_dbm = ((u8)-rx_evm >> 1); in query_phy_status_page1()
913 dm_info->rx_evm_dbm[path] = evm_dbm; in query_phy_status_page1()
940 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_tx_power_index_by_rate()
948 pwr_index = hal->tx_pwr_tbl[path][rate]; in rtw8822b_set_tx_power_index_by_rate()
962 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_tx_power_index()
965 for (path = 0; path < hal->rf_path_num; path++) { in rtw8822b_set_tx_power_index()
987 struct rtw_hal *hal = &rtwdev->hal; in rtw8822b_set_antenna()
994 return -EINVAL; in rtw8822b_set_antenna()
999 return -EINVAL; in rtw8822b_set_antenna()
1002 hal->antenna_tx = antenna_tx; in rtw8822b_set_antenna()
1003 hal->antenna_rx = antenna_rx; in rtw8822b_set_antenna()
1021 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_false_alarm_statistics()
1032 dm_info->cck_fa_cnt = cck_fa_cnt; in rtw8822b_false_alarm_statistics()
1033 dm_info->ofdm_fa_cnt = ofdm_fa_cnt; in rtw8822b_false_alarm_statistics()
1034 dm_info->total_fa_cnt = ofdm_fa_cnt; in rtw8822b_false_alarm_statistics()
1035 dm_info->total_fa_cnt += cck_enable ? cck_fa_cnt : 0; in rtw8822b_false_alarm_statistics()
1038 dm_info->cck_ok_cnt = crc32_cnt & 0xffff; in rtw8822b_false_alarm_statistics()
1039 dm_info->cck_err_cnt = (crc32_cnt & 0xffff0000) >> 16; in rtw8822b_false_alarm_statistics()
1041 dm_info->ofdm_ok_cnt = crc32_cnt & 0xffff; in rtw8822b_false_alarm_statistics()
1042 dm_info->ofdm_err_cnt = (crc32_cnt & 0xffff0000) >> 16; in rtw8822b_false_alarm_statistics()
1044 dm_info->ht_ok_cnt = crc32_cnt & 0xffff; in rtw8822b_false_alarm_statistics()
1045 dm_info->ht_err_cnt = (crc32_cnt & 0xffff0000) >> 16; in rtw8822b_false_alarm_statistics()
1047 dm_info->vht_ok_cnt = crc32_cnt & 0xffff; in rtw8822b_false_alarm_statistics()
1048 dm_info->vht_err_cnt = (crc32_cnt & 0xffff0000) >> 16; in rtw8822b_false_alarm_statistics()
1051 dm_info->ofdm_cca_cnt = ((cca32_cnt & 0xffff0000) >> 16); in rtw8822b_false_alarm_statistics()
1052 dm_info->total_cca_cnt = dm_info->ofdm_cca_cnt; in rtw8822b_false_alarm_statistics()
1055 dm_info->cck_cca_cnt = cca32_cnt & 0xffff; in rtw8822b_false_alarm_statistics()
1056 dm_info->total_cca_cnt += dm_info->cck_cca_cnt; in rtw8822b_false_alarm_statistics()
1109 /* enable PTA (3-wire function form BT side) */ in rtw8822b_coex_cfg_init()
1124 struct rtw_coex *coex = &rtwdev->coex; in rtw8822b_coex_cfg_ant_switch()
1125 struct rtw_coex_dm *coex_dm = &coex->dm; in rtw8822b_coex_cfg_ant_switch()
1126 struct rtw_coex_rfe *coex_rfe = &coex->rfe; in rtw8822b_coex_cfg_ant_switch()
1130 if (((ctrl_type << 8) + pos_type) == coex_dm->cur_switch_status) in rtw8822b_coex_cfg_ant_switch()
1133 coex_dm->cur_switch_status = (ctrl_type << 8) + pos_type; in rtw8822b_coex_cfg_ant_switch()
1135 if (coex_rfe->ant_switch_diversity && in rtw8822b_coex_cfg_ant_switch()
1139 polarity_inverse = (coex_rfe->ant_switch_polarity == 1); in rtw8822b_coex_cfg_ant_switch()
1152 if (coex_rfe->rfe_module_type != 0x4 && in rtw8822b_coex_cfg_ant_switch()
1153 coex_rfe->rfe_module_type != 0x2) in rtw8822b_coex_cfg_ant_switch()
1220 struct rtw_coex *coex = &rtwdev->coex; in rtw8822b_coex_cfg_rfe_type()
1221 struct rtw_coex_rfe *coex_rfe = &coex->rfe; in rtw8822b_coex_cfg_rfe_type()
1222 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_coex_cfg_rfe_type()
1225 coex_rfe->rfe_module_type = rtwdev->efuse.rfe_option; in rtw8822b_coex_cfg_rfe_type()
1226 coex_rfe->ant_switch_polarity = 0; in rtw8822b_coex_cfg_rfe_type()
1227 coex_rfe->ant_switch_diversity = false; in rtw8822b_coex_cfg_rfe_type()
1228 if (coex_rfe->rfe_module_type == 0x12 || in rtw8822b_coex_cfg_rfe_type()
1229 coex_rfe->rfe_module_type == 0x15 || in rtw8822b_coex_cfg_rfe_type()
1230 coex_rfe->rfe_module_type == 0x16) in rtw8822b_coex_cfg_rfe_type()
1231 coex_rfe->ant_switch_exist = false; in rtw8822b_coex_cfg_rfe_type()
1233 coex_rfe->ant_switch_exist = true; in rtw8822b_coex_cfg_rfe_type()
1235 if (coex_rfe->rfe_module_type == 2 || in rtw8822b_coex_cfg_rfe_type()
1236 coex_rfe->rfe_module_type == 4) { in rtw8822b_coex_cfg_rfe_type()
1243 coex_rfe->wlg_at_btg = false; in rtw8822b_coex_cfg_rfe_type()
1245 if (efuse->share_ant && in rtw8822b_coex_cfg_rfe_type()
1246 coex_rfe->ant_switch_exist && !is_ext_fem) in rtw8822b_coex_cfg_rfe_type()
1247 coex_rfe->ant_switch_with_bt = true; in rtw8822b_coex_cfg_rfe_type()
1249 coex_rfe->ant_switch_with_bt = false; in rtw8822b_coex_cfg_rfe_type()
1268 struct rtw_coex *coex = &rtwdev->coex; in rtw8822b_coex_cfg_wl_tx_power()
1269 struct rtw_coex_dm *coex_dm = &coex->dm; in rtw8822b_coex_cfg_wl_tx_power()
1274 if (wl_pwr == coex_dm->cur_wl_pwr_lvl) in rtw8822b_coex_cfg_wl_tx_power()
1277 coex_dm->cur_wl_pwr_lvl = wl_pwr; in rtw8822b_coex_cfg_wl_tx_power()
1279 if (coex_dm->cur_wl_pwr_lvl >= ARRAY_SIZE(wl_tx_power)) in rtw8822b_coex_cfg_wl_tx_power()
1280 coex_dm->cur_wl_pwr_lvl = ARRAY_SIZE(wl_tx_power) - 1; in rtw8822b_coex_cfg_wl_tx_power()
1282 pwr = wl_tx_power[coex_dm->cur_wl_pwr_lvl]; in rtw8822b_coex_cfg_wl_tx_power()
1290 struct rtw_coex *coex = &rtwdev->coex; in rtw8822b_coex_cfg_wl_rx_gain()
1291 struct rtw_coex_dm *coex_dm = &coex->dm; in rtw8822b_coex_cfg_wl_rx_gain()
1319 if (low_gain == coex_dm->cur_wl_rx_low_gain_en) in rtw8822b_coex_cfg_wl_rx_gain()
1322 coex_dm->cur_wl_rx_low_gain_en = low_gain; in rtw8822b_coex_cfg_wl_rx_gain()
1324 if (coex_dm->cur_wl_rx_low_gain_en) { in rtw8822b_coex_cfg_wl_rx_gain()
1325 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], Hi-Li Table On!\n"); in rtw8822b_coex_cfg_wl_rx_gain()
1335 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], Hi-Li Table Off!\n"); in rtw8822b_coex_cfg_wl_rx_gain()
1351 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_txagc_swing_offset()
1352 s8 delta_pwr_idx = dm_info->delta_power_index[path]; in rtw8822b_txagc_swing_offset()
1353 u8 swing_upper_bound = dm_info->default_ofdm_index + 10; in rtw8822b_txagc_swing_offset()
1357 u8 swing_index = dm_info->default_ofdm_index; in rtw8822b_txagc_swing_offset()
1364 swing_index = dm_info->default_ofdm_index; in rtw8822b_txagc_swing_offset()
1367 swing_index = dm_info->default_ofdm_index + in rtw8822b_txagc_swing_offset()
1368 delta_pwr_idx - tx_pwr_idx_offset; in rtw8822b_txagc_swing_offset()
1372 if (dm_info->default_ofdm_index > abs(delta_pwr_idx)) in rtw8822b_txagc_swing_offset()
1374 dm_info->default_ofdm_index + delta_pwr_idx; in rtw8822b_txagc_swing_offset()
1384 swing_index = RTW_TXSCALE_SIZE - 1; in rtw8822b_txagc_swing_offset()
1416 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_pwrtrack_set()
1418 u8 channel = rtwdev->hal.current_channel; in rtw8822b_pwrtrack_set() local
1419 u8 band_width = rtwdev->hal.current_band_width; in rtw8822b_pwrtrack_set()
1421 u8 tx_rate = dm_info->tx_rate; in rtw8822b_pwrtrack_set()
1422 u8 max_pwr_idx = rtwdev->chip->max_power_index; in rtw8822b_pwrtrack_set()
1425 band_width, channel, regd); in rtw8822b_pwrtrack_set()
1429 pwr_idx_offset = max_pwr_idx - tx_pwr_idx; in rtw8822b_pwrtrack_set()
1438 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_phy_pwrtrack_path()
1445 power_idx_last = dm_info->delta_power_index[path]; in rtw8822b_phy_pwrtrack_path()
1453 dm_info->delta_power_index[path] = power_idx_cur; in rtw8822b_phy_pwrtrack_path()
1459 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_phy_pwrtrack()
1465 if (rtwdev->efuse.thermal_meter[RF_PATH_A] == 0xff) in rtw8822b_phy_pwrtrack()
1472 if (dm_info->pwr_trk_init_trigger) in rtw8822b_phy_pwrtrack()
1473 dm_info->pwr_trk_init_trigger = false; in rtw8822b_phy_pwrtrack()
1478 for (path = 0; path < rtwdev->hal.rf_path_num; path++) in rtw8822b_phy_pwrtrack()
1488 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw8822b_pwr_track()
1489 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_pwr_track()
1491 if (efuse->power_track_type != 0) in rtw8822b_pwr_track()
1494 if (!dm_info->pwr_trk_triggered) { in rtw8822b_pwr_track()
1497 dm_info->pwr_trk_triggered = true; in rtw8822b_pwr_track()
1502 dm_info->pwr_trk_triggered = false; in rtw8822b_pwr_track()
1528 if (bfee->role == RTW_BFEE_SU) in rtw8822b_bf_config_bfee()
1530 else if (bfee->role == RTW_BFEE_MU) in rtw8822b_bf_config_bfee()
1553 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw8822b_adaptivity()
1557 igi = dm_info->igi_history[0]; in rtw8822b_adaptivity()
1558 if (dm_info->edcca_mode == RTW_EDCCA_NORMAL) { in rtw8822b_adaptivity()
1560 h2l = l2h - EDCCA_L2H_H2L_DIFF_NORMAL; in rtw8822b_adaptivity()
1562 l2h = min_t(s8, igi, dm_info->l2h_th_ini); in rtw8822b_adaptivity()
1563 h2l = l2h - EDCCA_L2H_H2L_DIFF; in rtw8822b_adaptivity()
2160 /* Shared-Antenna Coex Table */
2162 {0xffffffff, 0xffffffff}, /* case-0 */
2167 {0xfafafafa, 0xfafafafa}, /* case-5 */
2172 {0x66555555, 0x6a5a5a5a}, /* case-10 */
2177 {0x66555555, 0xaaaaaaaa}, /* case-15 */
2182 {0xaa5555aa, 0x6a5a5a5a}, /* case-20 */
2187 {0xffffffff, 0x6a5a5aaa}, /* case-25 */
2192 {0x66556aaa, 0x6a5a6aaa}, /* case-30 */
2197 /* Non-Shared-Antenna Coex Table */
2199 {0xffffffff, 0xffffffff}, /* case-100 */
2204 {0xfafafafa, 0xfafafafa}, /* case-105 */
2209 {0x66555555, 0x6a5a5a5a}, /* case-110 */
2214 {0xffff55ff, 0xffff55ff}, /* case-115 */
2219 {0xffffffff, 0xaaaaaaaa}, /* case-120 */
2225 /* Shared-Antenna TDMA */
2227 { {0x00, 0x00, 0x00, 0x00, 0x00} }, /* case-0 */
2232 { {0x61, 0x10, 0x03, 0x11, 0x11} }, /* case-5 */
2237 { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-10 */
2242 { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-15 */
2247 { {0x51, 0x10, 0x03, 0x10, 0x50} }, /* case-20 */
2252 { {0x51, 0x10, 0x03, 0x10, 0x51} }, /* case-25 */
2257 /* Non-Shared-Antenna TDMA */
2259 { {0x00, 0x00, 0x00, 0x00, 0x00} }, /* case-100 */
2260 { {0x61, 0x45, 0x03, 0x11, 0x11} }, /* case-101 */
2264 { {0x61, 0x10, 0x03, 0x11, 0x11} }, /* case-105 */
2269 { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-110 */
2274 { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-115 */
2279 { {0x51, 0x10, 0x03, 0x10, 0x50} }, /* case-120 */
2283 /* rssi in percentage % (dbm = % - 100) */
2290 {0, 16, false, 7}, /* for WL-CPT */
2299 {0, 16, false, 7}, /* for WL-CPT */
2332 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2335 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2338 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2345 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2348 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2351 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2358 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2361 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2364 8, 8, 9, 10, 11, 11, 12, 13, 14, 14,
2371 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2374 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2377 8, 9, 9, 10, 11, 12, 13, 14, 14, 15,
2384 8, 9, 9, 9, 10, 10, 11, 11, 11, 12
2390 9, 10, 10, 11, 11, 12, 12, 12, 13, 13
2396 8, 9, 9, 9, 10, 10, 11, 11, 11, 12
2402 10, 11, 11, 12, 12, 13, 13, 14, 14, 15
2408 8, 9, 9, 9, 10, 10, 11, 11, 11, 12
2414 9, 10, 10, 11, 11, 12, 12, 12, 13, 13
2420 8, 9, 9, 9, 10, 10, 11, 11, 11, 12
2426 10, 11, 11, 12, 12, 13, 13, 14, 14, 15
2544 .l2h_th_ini_ad = -14 + EDCCA_IGI_BASE,