Lines Matching +full:trim +full:- +full:data +full:- +full:valid
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2022-2023 Realtek Corporation
236 {255, 0, 0, 7}, /* 0 -> original */
237 {255, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
238 {255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
239 {255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
240 {255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
241 {255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
248 {255, 0, 0, 7}, /* 0 -> original */
249 {255, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
250 {255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
251 {255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
252 {255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
253 {255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
361 if (rtwdev->hal.cv == CHIP_CAV) { in rtw8851b_pwr_on_func()
364 rtwdev->hal.cv = val8; in rtw8851b_pwr_on_func()
369 if (rtwdev->hal.cv != CHIP_CAV) { in rtw8851b_pwr_on_func()
445 if (rtwdev->hal.cv == CHIP_CAV) { in rtw8851b_pwr_off_func()
460 ether_addr_copy(efuse->addr, map->e.mac_addr); in rtw8851b_efuse_parsing()
461 efuse->rfe_type = map->rfe_type; in rtw8851b_efuse_parsing()
462 efuse->xtal_cap = map->xtal_k; in rtw8851b_efuse_parsing()
468 struct rtw89_tssi_info *tssi = &rtwdev->tssi; in rtw8851b_efuse_parsing_tssi()
469 struct rtw8851b_tssi_offset *ofst[] = {&map->path_a_tssi}; in rtw8851b_efuse_parsing_tssi()
472 tssi->thermal[RF_PATH_A] = map->path_a_therm; in rtw8851b_efuse_parsing_tssi()
475 memcpy(tssi->tssi_cck[i], ofst[i]->cck_tssi, in rtw8851b_efuse_parsing_tssi()
476 sizeof(ofst[i]->cck_tssi)); in rtw8851b_efuse_parsing_tssi()
481 i, j, tssi->tssi_cck[i][j]); in rtw8851b_efuse_parsing_tssi()
483 memcpy(tssi->tssi_mcs[i], ofst[i]->bw40_tssi, in rtw8851b_efuse_parsing_tssi()
484 sizeof(ofst[i]->bw40_tssi)); in rtw8851b_efuse_parsing_tssi()
485 memcpy(tssi->tssi_mcs[i] + TSSI_MCS_2G_CH_GROUP_NUM, in rtw8851b_efuse_parsing_tssi()
486 ofst[i]->bw40_1s_tssi_5g, sizeof(ofst[i]->bw40_1s_tssi_5g)); in rtw8851b_efuse_parsing_tssi()
491 i, j, tssi->tssi_mcs[i][j]); in rtw8851b_efuse_parsing_tssi()
495 static bool _decode_efuse_gain(u8 data, s8 *high, s8 *low) in _decode_efuse_gain() argument
498 *high = sign_extend32(u8_get_bits(data, GENMASK(7, 4)), 3); in _decode_efuse_gain()
500 *low = sign_extend32(u8_get_bits(data, GENMASK(3, 0)), 3); in _decode_efuse_gain()
502 return data != 0xff; in _decode_efuse_gain()
508 struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain; in rtw8851b_efuse_parsing_gain_offset()
509 bool valid = false; in rtw8851b_efuse_parsing_gain_offset() local
511 valid |= _decode_efuse_gain(map->rx_gain_2g_cck, in rtw8851b_efuse_parsing_gain_offset()
512 &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_2G_CCK], in rtw8851b_efuse_parsing_gain_offset()
514 valid |= _decode_efuse_gain(map->rx_gain_2g_ofdm, in rtw8851b_efuse_parsing_gain_offset()
515 &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_2G_OFDM], in rtw8851b_efuse_parsing_gain_offset()
517 valid |= _decode_efuse_gain(map->rx_gain_5g_low, in rtw8851b_efuse_parsing_gain_offset()
518 &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_LOW], in rtw8851b_efuse_parsing_gain_offset()
520 valid |= _decode_efuse_gain(map->rx_gain_5g_mid, in rtw8851b_efuse_parsing_gain_offset()
521 &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_MID], in rtw8851b_efuse_parsing_gain_offset()
523 valid |= _decode_efuse_gain(map->rx_gain_5g_high, in rtw8851b_efuse_parsing_gain_offset()
524 &gain->offset[RF_PATH_A][RTW89_GAIN_OFFSET_5G_HIGH], in rtw8851b_efuse_parsing_gain_offset()
527 gain->offset_valid = valid; in rtw8851b_efuse_parsing_gain_offset()
533 struct rtw89_efuse *efuse = &rtwdev->efuse; in rtw8851b_read_efuse()
538 efuse->country_code[0] = map->country_code[0]; in rtw8851b_read_efuse()
539 efuse->country_code[1] = map->country_code[1]; in rtw8851b_read_efuse()
543 switch (rtwdev->hci.type) { in rtw8851b_read_efuse()
548 return -EOPNOTSUPP; in rtw8851b_read_efuse()
551 rtw89_info(rtwdev, "chip rfe_type is %d\n", efuse->rfe_type); in rtw8851b_read_efuse()
558 struct rtw89_tssi_info *tssi = &rtwdev->tssi; in rtw8851b_phycap_parsing_tssi()
560 u32 addr = rtwdev->chip->phycap_addr; in rtw8851b_phycap_parsing_tssi()
568 ofst = tssi_trim_addr[i] - addr - j; in rtw8851b_phycap_parsing_tssi()
569 tssi->tssi_trim[i][j] = phycap_map[ofst]; in rtw8851b_phycap_parsing_tssi()
577 memset(tssi->tssi_trim, 0, sizeof(tssi->tssi_trim)); in rtw8851b_phycap_parsing_tssi()
579 "[TSSI][TRIM] no PG, set all trim info to 0\n"); in rtw8851b_phycap_parsing_tssi()
585 "[TSSI] path=%d idx=%d trim=0x%x addr=0x%x\n", in rtw8851b_phycap_parsing_tssi()
586 i, j, tssi->tssi_trim[i][j], in rtw8851b_phycap_parsing_tssi()
587 tssi_trim_addr[i] - j); in rtw8851b_phycap_parsing_tssi()
593 struct rtw89_power_trim_info *info = &rtwdev->pwr_trim; in rtw8851b_phycap_parsing_thermal_trim()
595 u32 addr = rtwdev->chip->phycap_addr; in rtw8851b_phycap_parsing_thermal_trim()
599 info->thermal_trim[i] = phycap_map[thm_trim_addr[i] - addr]; in rtw8851b_phycap_parsing_thermal_trim()
602 "[THERMAL][TRIM] path=%d thermal_trim=0x%x\n", in rtw8851b_phycap_parsing_thermal_trim()
603 i, info->thermal_trim[i]); in rtw8851b_phycap_parsing_thermal_trim()
605 if (info->thermal_trim[i] != 0xff) in rtw8851b_phycap_parsing_thermal_trim()
606 info->pg_thermal_trim = true; in rtw8851b_phycap_parsing_thermal_trim()
617 struct rtw89_power_trim_info *info = &rtwdev->pwr_trim; in rtw8851b_thermal_trim()
620 if (!info->pg_thermal_trim) { in rtw8851b_thermal_trim()
622 "[THERMAL][TRIM] no PG, do nothing\n"); in rtw8851b_thermal_trim()
628 val = __thm_setting(info->thermal_trim[i]); in rtw8851b_thermal_trim()
632 "[THERMAL][TRIM] path=%d thermal_setting=0x%x\n", in rtw8851b_thermal_trim()
641 struct rtw89_power_trim_info *info = &rtwdev->pwr_trim; in rtw8851b_phycap_parsing_pa_bias_trim()
643 u32 addr = rtwdev->chip->phycap_addr; in rtw8851b_phycap_parsing_pa_bias_trim()
647 info->pa_bias_trim[i] = phycap_map[pabias_trim_addr[i] - addr]; in rtw8851b_phycap_parsing_pa_bias_trim()
650 "[PA_BIAS][TRIM] path=%d pa_bias_trim=0x%x\n", in rtw8851b_phycap_parsing_pa_bias_trim()
651 i, info->pa_bias_trim[i]); in rtw8851b_phycap_parsing_pa_bias_trim()
653 if (info->pa_bias_trim[i] != 0xff) in rtw8851b_phycap_parsing_pa_bias_trim()
654 info->pg_pa_bias_trim = true; in rtw8851b_phycap_parsing_pa_bias_trim()
660 struct rtw89_power_trim_info *info = &rtwdev->pwr_trim; in rtw8851b_pa_bias_trim()
664 if (!info->pg_pa_bias_trim) { in rtw8851b_pa_bias_trim()
666 "[PA_BIAS][TRIM] no PG, do nothing\n"); in rtw8851b_pa_bias_trim()
672 pabias_2g = u8_get_bits(info->pa_bias_trim[i], GENMASK(3, 0)); in rtw8851b_pa_bias_trim()
673 pabias_5g = u8_get_bits(info->pa_bias_trim[i], GENMASK(7, 4)); in rtw8851b_pa_bias_trim()
676 "[PA_BIAS][TRIM] path=%d 2G=0x%x 5G=0x%x\n", in rtw8851b_pa_bias_trim()
689 struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain; in rtw8851b_phycap_parsing_gain_comp()
690 u32 phycap_addr = rtwdev->chip->phycap_addr; in rtw8851b_phycap_parsing_gain_comp()
691 bool valid = false; in rtw8851b_phycap_parsing_gain_comp() local
693 u8 data; in rtw8851b_phycap_parsing_gain_comp() local
700 data = phycap_map[comp_addrs[path][i] - phycap_addr]; in rtw8851b_phycap_parsing_gain_comp()
701 valid |= _decode_efuse_gain(data, NULL, in rtw8851b_phycap_parsing_gain_comp()
702 &gain->comp[path][i]); in rtw8851b_phycap_parsing_gain_comp()
705 gain->comp_valid = valid; in rtw8851b_phycap_parsing_gain_comp()
726 /* 2 continual 32-bit registers for 32 GPIOs, and each GPIO occupies 2 bits */ in rtw8851b_set_bb_gpio()
733 /* 4 continual 32-bit registers for 32 GPIOs, and each GPIO occupies 4 bits */ in rtw8851b_set_bb_gpio()
762 rtw89_write8_mask(rtwdev, def->addr, def->mask, def->data); in rtw8851b_set_mac_gpio()
767 u8 rfe_type = rtwdev->efuse.rfe_type; in rtw8851b_rfe_gpio()
796 switch (chan->band_width) { in rtw8851b_set_channel_mac()
807 switch (chan->band_width) { in rtw8851b_set_channel_mac()
824 if (chan->channel > 14) { in rtw8851b_set_channel_mac()
847 u8 ch_element = primary_ch - 1; in rtw8851b_ctrl_sco_cck()
917 const struct rtw89_phy_bb_gain_info *gain = &rtwdev->bb_gain.ax; in rtw8851b_set_gain_error()
931 val = gain->lna_gain[gain_band][path][i]; in rtw8851b_set_gain_error()
942 val = gain->tia_gain[gain_band][path][i]; in rtw8851b_set_gain_error()
953 struct rtw89_phy_efuse_gain *efuse_gain = &rtwdev->efuse_gain; in rtw8851b_set_gain_offset()
960 if (!efuse_gain->comp_valid) in rtw8851b_set_gain_offset()
964 tmp = efuse_gain->comp[path][subband]; in rtw8851b_set_gain_offset()
970 if (!efuse_gain->offset_valid) in rtw8851b_set_gain_offset()
975 offset_a = -efuse_gain->offset[RF_PATH_A][gain_ofdm_band]; in rtw8851b_set_gain_offset()
977 tmp = -((offset_a << 2) + (efuse_gain->offset_base[RTW89_PHY_0] >> 2)); in rtw8851b_set_gain_offset()
981 offset_ofdm = -efuse_gain->offset[RF_PATH_A][gain_ofdm_band]; in rtw8851b_set_gain_offset()
982 offset_cck = -efuse_gain->offset[RF_PATH_A][0]; in rtw8851b_set_gain_offset()
984 tmp = (offset_ofdm << 4) + efuse_gain->offset_base[RTW89_PHY_0]; in rtw8851b_set_gain_offset()
988 tmp = (offset_ofdm << 4) + efuse_gain->rssi_base[RTW89_PHY_0]; in rtw8851b_set_gain_offset()
993 tmp = (offset_cck << 3) + (efuse_gain->offset_base[RTW89_PHY_0] >> 1); in rtw8851b_set_gain_offset()
1003 const struct rtw89_phy_bb_gain_info *gain = &rtwdev->bb_gain.ax; in rtw8851b_set_rxsc_rpl_comp()
1007 val = u32_encode_bits(gain->rpl_ofst_20[band][RF_PATH_A], B_P0_RPL1_20_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1008 u32_encode_bits(gain->rpl_ofst_40[band][RF_PATH_A][0], B_P0_RPL1_40_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1009 u32_encode_bits(gain->rpl_ofst_40[band][RF_PATH_A][1], B_P0_RPL1_41_MASK); in rtw8851b_set_rxsc_rpl_comp()
1014 val = u32_encode_bits(gain->rpl_ofst_40[band][RF_PATH_A][2], B_P0_RTL2_42_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1015 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][0], B_P0_RTL2_80_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1016 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][1], B_P0_RTL2_81_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1017 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][10], B_P0_RTL2_8A_MASK); in rtw8851b_set_rxsc_rpl_comp()
1021 val = u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][2], B_P0_RTL3_82_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1022 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][3], B_P0_RTL3_83_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1023 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][4], B_P0_RTL3_84_MASK) | in rtw8851b_set_rxsc_rpl_comp()
1024 u32_encode_bits(gain->rpl_ofst_80[band][RF_PATH_A][9], B_P0_RTL3_89_MASK); in rtw8851b_set_rxsc_rpl_comp()
1033 u8 subband = chan->subband_type; in rtw8851b_ctrl_ch()
1034 u8 central_ch = chan->channel; in rtw8851b_ctrl_ch()
1048 if (chan->band_type == RTW89_BAND_6G) in rtw8851b_ctrl_ch()
1181 u8 center_chan = chan->channel; in rtw8851b_spur_freq()
1183 switch (chan->band_type) { in rtw8851b_spur_freq()
1216 freq_diff = (spur_freq - chan->freq) * 1000000; in rtw8851b_set_csi_tone_idx()
1246 rtw89_phy_write32_mask(rtwdev, nbi->notch1_en.addr, in rtw8851b_set_nbi_tone_idx()
1247 nbi->notch1_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1248 rtw89_phy_write32_mask(rtwdev, nbi->notch2_en.addr, in rtw8851b_set_nbi_tone_idx()
1249 nbi->notch2_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1253 fc = chan->freq; in rtw8851b_set_nbi_tone_idx()
1254 if (chan->band_width == RTW89_CHANNEL_WIDTH_160) { in rtw8851b_set_nbi_tone_idx()
1255 fc = (spur_freq > fc) ? fc + 40 : fc - 40; in rtw8851b_set_nbi_tone_idx()
1257 chan->channel < chan->primary_channel) || in rtw8851b_set_nbi_tone_idx()
1259 chan->channel > chan->primary_channel)) in rtw8851b_set_nbi_tone_idx()
1263 freq_diff = (spur_freq - fc) * 1000000; in rtw8851b_set_nbi_tone_idx()
1267 if (chan->band_width == RTW89_CHANNEL_WIDTH_20) { in rtw8851b_set_nbi_tone_idx()
1270 u16 tone_para = (chan->band_width == RTW89_CHANNEL_WIDTH_40) ? in rtw8851b_set_nbi_tone_idx()
1278 if (chan->band_width == RTW89_CHANNEL_WIDTH_160 && notch2_chk) { in rtw8851b_set_nbi_tone_idx()
1279 rtw89_phy_write32_mask(rtwdev, nbi->notch2_idx.addr, in rtw8851b_set_nbi_tone_idx()
1280 nbi->notch2_idx.mask, nbi_tone_idx); in rtw8851b_set_nbi_tone_idx()
1281 rtw89_phy_write32_mask(rtwdev, nbi->notch2_frac_idx.addr, in rtw8851b_set_nbi_tone_idx()
1282 nbi->notch2_frac_idx.mask, nbi_frac_tone_idx); in rtw8851b_set_nbi_tone_idx()
1283 rtw89_phy_write32_mask(rtwdev, nbi->notch2_en.addr, in rtw8851b_set_nbi_tone_idx()
1284 nbi->notch2_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1285 rtw89_phy_write32_mask(rtwdev, nbi->notch2_en.addr, in rtw8851b_set_nbi_tone_idx()
1286 nbi->notch2_en.mask, 1); in rtw8851b_set_nbi_tone_idx()
1287 rtw89_phy_write32_mask(rtwdev, nbi->notch1_en.addr, in rtw8851b_set_nbi_tone_idx()
1288 nbi->notch1_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1290 rtw89_phy_write32_mask(rtwdev, nbi->notch1_idx.addr, in rtw8851b_set_nbi_tone_idx()
1291 nbi->notch1_idx.mask, nbi_tone_idx); in rtw8851b_set_nbi_tone_idx()
1292 rtw89_phy_write32_mask(rtwdev, nbi->notch1_frac_idx.addr, in rtw8851b_set_nbi_tone_idx()
1293 nbi->notch1_frac_idx.mask, nbi_frac_tone_idx); in rtw8851b_set_nbi_tone_idx()
1294 rtw89_phy_write32_mask(rtwdev, nbi->notch1_en.addr, in rtw8851b_set_nbi_tone_idx()
1295 nbi->notch1_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1296 rtw89_phy_write32_mask(rtwdev, nbi->notch1_en.addr, in rtw8851b_set_nbi_tone_idx()
1297 nbi->notch1_en.mask, 1); in rtw8851b_set_nbi_tone_idx()
1298 rtw89_phy_write32_mask(rtwdev, nbi->notch2_en.addr, in rtw8851b_set_nbi_tone_idx()
1299 nbi->notch2_en.mask, 0); in rtw8851b_set_nbi_tone_idx()
1305 if (chan->band_type == RTW89_BAND_2G && in rtw8851b_set_cfr()
1306 chan->band_width == RTW89_CHANNEL_WIDTH_20 && in rtw8851b_set_cfr()
1307 (chan->channel == 1 || chan->channel == 13)) { in rtw8851b_set_cfr()
1331 u8 pri_ch = chan->pri_ch_idx; in rtw8851b_5m_mask()
1335 switch (chan->band_width) { in rtw8851b_5m_mask()
1470 struct rtw89_phy_efuse_gain *gain = &rtwdev->efuse_gain; in rtw8851b_bb_sethw()
1481 gain->offset_base[RTW89_PHY_0] = in rtw8851b_bb_sethw()
1483 gain->rssi_base[RTW89_PHY_0] = in rtw8851b_bb_sethw()
1490 u8 band = chan->band_type, chan_idx; in rtw8851b_set_channel_bb()
1491 bool cck_en = chan->channel <= 14; in rtw8851b_set_channel_bb()
1492 u8 pri_ch_idx = chan->pri_ch_idx; in rtw8851b_set_channel_bb()
1495 rtw8851b_ctrl_sco_cck(rtwdev, chan->primary_channel); in rtw8851b_set_channel_bb()
1498 rtw8851b_ctrl_bw(rtwdev, pri_ch_idx, chan->band_width, phy_idx); in rtw8851b_set_channel_bb()
1503 if (chan->band_type == RTW89_BAND_5G) { in rtw8851b_set_channel_bb()
1515 chan_idx = rtw89_encode_chan_idx(rtwdev, chan->primary_channel, band); in rtw8851b_set_channel_bb()
1565 rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL); in rtw8851b_set_channel_help()
1570 rtw8851b_bb_reset_en(rtwdev, chan->band_type, phy_idx, false); in rtw8851b_set_channel_help()
1575 rtw8851b_bb_reset_en(rtwdev, chan->band_type, phy_idx, true); in rtw8851b_set_channel_help()
1576 rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en); in rtw8851b_set_channel_help()
1582 rtwdev->is_tssi_mode[RF_PATH_A] = false; in rtw8851b_rfk_init()
1583 rtwdev->is_tssi_mode[RF_PATH_B] = false; in rtw8851b_rfk_init()
1596 enum rtw89_chanctx_idx chanctx_idx = rtwvif_link->chanctx_idx; in rtw8851b_rfk_channel()
1597 enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx; in rtw8851b_rfk_channel()
1616 rtw8851b_wifi_scan_notify(rtwdev, start, rtwvif_link->phy_idx, in rtw8851b_rfk_scan()
1617 rtwvif_link->chanctx_idx); in rtw8851b_rfk_scan()
1644 tssi_ofst_cw = (u32)((s16)tssi_16dbm_cw + (ref << 1) - (16 << 3)); in rtw8851b_bb_cal_txpwr_ref()
1707 u8 ch = chan->channel; in rtw8851b_bb_set_tx_shape_dfir()
1741 const struct rtw89_rfe_parms *rfe_parms = rtwdev->rfe_parms; in rtw8851b_set_tx_shape()
1742 u8 band = chan->band_type; in rtw8851b_set_tx_shape()
1744 u8 tx_shape_cck = (*rfe_parms->tx_shape.lmt)[band][RTW89_RS_CCK][regd]; in rtw8851b_set_tx_shape()
1745 u8 tx_shape_ofdm = (*rfe_parms->tx_shape.lmt)[band][RTW89_RS_OFDM][regd]; in rtw8851b_set_tx_shape()
1777 if (pw_ofst < -16 || pw_ofst > 15) { in rtw8851b_set_txpwr_ul_tb_offset()
1788 pw_ofst = max_t(s8, pw_ofst - 3, -16); in rtw8851b_set_txpwr_ul_tb_offset()
1825 if (chan->band_type == RTW89_BAND_2G) { in rtw8851b_ctrl_nbtg_bt_tx()
1864 if (chan->band_type == RTW89_BAND_2G) { in rtw8851b_ctrl_btg_bt_rx()
1901 rtw8851b_set_gain_offset(rtwdev, chan->subband_type, RTW89_PHY_0); in rtw8851b_bb_ctrl_rx_path()
1914 if (rtwdev->hal.rx_nss == 1) { in rtw8851b_bb_cfg_txrx_path()
1926 if (rtwdev->is_tssi_mode[rf_path]) { in rtw8851b_get_thermal()
1943 const struct rtw89_btc_ver *ver = rtwdev->btc.ver; in rtw8851b_btc_set_rfe()
1944 union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo; in rtw8851b_btc_set_rfe()
1946 if (ver->fcxinit == 7) { in rtw8851b_btc_set_rfe()
1947 md->md_v7.rfe_type = rtwdev->efuse.rfe_type; in rtw8851b_btc_set_rfe()
1948 md->md_v7.kt_ver = rtwdev->hal.cv; in rtw8851b_btc_set_rfe()
1949 md->md_v7.bt_solo = 0; in rtw8851b_btc_set_rfe()
1950 md->md_v7.switch_type = BTC_SWITCH_INTERNAL; in rtw8851b_btc_set_rfe()
1951 md->md_v7.ant.isolation = 10; in rtw8851b_btc_set_rfe()
1952 md->md_v7.kt_ver_adie = rtwdev->hal.acv; in rtw8851b_btc_set_rfe()
1954 if (md->md_v7.rfe_type == 0) in rtw8851b_btc_set_rfe()
1957 /* rfe_type 3*n+1: 1-Ant(shared), in rtw8851b_btc_set_rfe()
1958 * 3*n+2: 2-Ant+Div(non-shared), in rtw8851b_btc_set_rfe()
1959 * 3*n+3: 2-Ant+no-Div(non-shared) in rtw8851b_btc_set_rfe()
1961 md->md_v7.ant.num = (md->md_v7.rfe_type % 3 == 1) ? 1 : 2; in rtw8851b_btc_set_rfe()
1962 /* WL-1ss at S0, btg at s0 (On 1 WL RF) */ in rtw8851b_btc_set_rfe()
1963 md->md_v7.ant.single_pos = RF_PATH_A; in rtw8851b_btc_set_rfe()
1964 md->md_v7.ant.btg_pos = RF_PATH_A; in rtw8851b_btc_set_rfe()
1965 md->md_v7.ant.stream_cnt = 1; in rtw8851b_btc_set_rfe()
1967 if (md->md_v7.ant.num == 1) { in rtw8851b_btc_set_rfe()
1968 md->md_v7.ant.type = BTC_ANT_SHARED; in rtw8851b_btc_set_rfe()
1969 md->md_v7.bt_pos = BTC_BT_BTG; in rtw8851b_btc_set_rfe()
1970 md->md_v7.wa_type = 1; in rtw8851b_btc_set_rfe()
1971 md->md_v7.ant.diversity = 0; in rtw8851b_btc_set_rfe()
1973 md->md_v7.ant.type = BTC_ANT_DEDICATED; in rtw8851b_btc_set_rfe()
1974 md->md_v7.bt_pos = BTC_BT_ALONE; in rtw8851b_btc_set_rfe()
1975 md->md_v7.switch_type = BTC_SWITCH_EXTERNAL; in rtw8851b_btc_set_rfe()
1976 md->md_v7.wa_type = 0; in rtw8851b_btc_set_rfe()
1977 if (md->md_v7.rfe_type % 3 == 2) in rtw8851b_btc_set_rfe()
1978 md->md_v7.ant.diversity = 1; in rtw8851b_btc_set_rfe()
1980 rtwdev->btc.btg_pos = md->md_v7.ant.btg_pos; in rtw8851b_btc_set_rfe()
1981 rtwdev->btc.ant_type = md->md_v7.ant.type; in rtw8851b_btc_set_rfe()
1983 md->md.rfe_type = rtwdev->efuse.rfe_type; in rtw8851b_btc_set_rfe()
1984 md->md.cv = rtwdev->hal.cv; in rtw8851b_btc_set_rfe()
1985 md->md.bt_solo = 0; in rtw8851b_btc_set_rfe()
1986 md->md.switch_type = BTC_SWITCH_INTERNAL; in rtw8851b_btc_set_rfe()
1987 md->md.ant.isolation = 10; in rtw8851b_btc_set_rfe()
1988 md->md.kt_ver_adie = rtwdev->hal.acv; in rtw8851b_btc_set_rfe()
1990 if (md->md.rfe_type == 0) in rtw8851b_btc_set_rfe()
1993 /* rfe_type 3*n+1: 1-Ant(shared), in rtw8851b_btc_set_rfe()
1994 * 3*n+2: 2-Ant+Div(non-shared), in rtw8851b_btc_set_rfe()
1995 * 3*n+3: 2-Ant+no-Div(non-shared) in rtw8851b_btc_set_rfe()
1997 md->md.ant.num = (md->md.rfe_type % 3 == 1) ? 1 : 2; in rtw8851b_btc_set_rfe()
1998 /* WL-1ss at S0, btg at s0 (On 1 WL RF) */ in rtw8851b_btc_set_rfe()
1999 md->md.ant.single_pos = RF_PATH_A; in rtw8851b_btc_set_rfe()
2000 md->md.ant.btg_pos = RF_PATH_A; in rtw8851b_btc_set_rfe()
2001 md->md.ant.stream_cnt = 1; in rtw8851b_btc_set_rfe()
2003 if (md->md.ant.num == 1) { in rtw8851b_btc_set_rfe()
2004 md->md.ant.type = BTC_ANT_SHARED; in rtw8851b_btc_set_rfe()
2005 md->md.bt_pos = BTC_BT_BTG; in rtw8851b_btc_set_rfe()
2006 md->md.wa_type = 1; in rtw8851b_btc_set_rfe()
2007 md->md.ant.diversity = 0; in rtw8851b_btc_set_rfe()
2009 md->md.ant.type = BTC_ANT_DEDICATED; in rtw8851b_btc_set_rfe()
2010 md->md.bt_pos = BTC_BT_ALONE; in rtw8851b_btc_set_rfe()
2011 md->md.switch_type = BTC_SWITCH_EXTERNAL; in rtw8851b_btc_set_rfe()
2012 md->md.wa_type = 0; in rtw8851b_btc_set_rfe()
2013 if (md->md.rfe_type % 3 == 2) in rtw8851b_btc_set_rfe()
2014 md->md.ant.diversity = 1; in rtw8851b_btc_set_rfe()
2016 rtwdev->btc.btg_pos = md->md.ant.btg_pos; in rtw8851b_btc_set_rfe()
2017 rtwdev->btc.ant_type = md->md.ant.type; in rtw8851b_btc_set_rfe()
2025 group--; /* Tx-group=1, Rx-group=2 */ in rtw8851b_set_trx_mask()
2027 if (rtwdev->btc.ant_type == BTC_ANT_SHARED) /* 1-Ant */ in rtw8851b_set_trx_mask()
2040 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw8851b_btc_init_cfg()
2041 struct rtw89_btc *btc = &rtwdev->btc; in rtw8851b_btc_init_cfg()
2042 union rtw89_btc_module_info *md = &btc->mdinfo; in rtw8851b_btc_init_cfg()
2043 const struct rtw89_btc_ver *ver = btc->ver; in rtw8851b_btc_init_cfg()
2049 /* set WL Tx response = Hi-Pri */ in rtw8851b_btc_init_cfg()
2050 chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_TX_RESP, true); in rtw8851b_btc_init_cfg()
2051 chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_BEACON, true); in rtw8851b_btc_init_cfg()
2053 if (ver->fcxinit == 7) { in rtw8851b_btc_init_cfg()
2054 str_cnt = md->md_v7.ant.stream_cnt; in rtw8851b_btc_init_cfg()
2055 ant_sing_pos = md->md_v7.ant.single_pos; in rtw8851b_btc_init_cfg()
2057 str_cnt = md->md.ant.stream_cnt; in rtw8851b_btc_init_cfg()
2058 ant_sing_pos = md->md.ant.single_pos; in rtw8851b_btc_init_cfg()
2061 /* for 1-Ant && 1-ss case: only 1-path */ in rtw8851b_btc_init_cfg()
2071 /* set rf gnt-debug off */ in rtw8851b_btc_init_cfg()
2074 /* set DEBUG_LUT_RFMODE_MASK = 1 to start trx-mask-setup */ in rtw8851b_btc_init_cfg()
2077 /* if GNT_WL=0 && BT=SS_group --> WL Tx/Rx = THRU */ in rtw8851b_btc_init_cfg()
2080 /* if GNT_WL=0 && BT=Rx_group --> WL-Rx = THRU + WL-Tx = MASK */ in rtw8851b_btc_init_cfg()
2083 /* if GNT_WL = 0 && BT = Tx_group --> in rtw8851b_btc_init_cfg()
2084 * Shared-Ant && BTG-path:WL mask(0x55f), others:WL THRU(0x5ff) in rtw8851b_btc_init_cfg()
2086 if (btc->ant_type == BTC_ANT_SHARED && btc->btg_pos == path) in rtw8851b_btc_init_cfg()
2091 /* set DEBUG_LUT_RFMODE_MASK = 0 to stop trx-mask-setup */ in rtw8851b_btc_init_cfg()
2101 btc->cx.wl.status.map.init_ok = true; in rtw8851b_btc_init_cfg()
2139 s16 data:9; member
2147 s16 data:9; member
2177 val = arg.all_time.data; in rtw8851b_btc_set_wl_txpwr_ctrl()
2190 val = arg.gnt_bt.data; in rtw8851b_btc_set_wl_txpwr_ctrl()
2203 val = clamp_t(s8, val, -100, 0) + 100; in rtw8851b_btc_get_bt_rssi()
2217 struct rtw89_btc *btc = &rtwdev->btc; in rtw8851b_btc_wl_s1_standby()
2219 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWE, RFREG_MASK, 0x80000); in rtw8851b_btc_wl_s1_standby()
2220 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWA, RFREG_MASK, 0x1); in rtw8851b_btc_wl_s1_standby()
2221 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWD1, RFREG_MASK, 0x110); in rtw8851b_btc_wl_s1_standby()
2223 /* set WL standby = Rx for GNT_BT_Tx = 1->0 settle issue */ in rtw8851b_btc_wl_s1_standby()
2225 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWD0, RFREG_MASK, 0x179c); in rtw8851b_btc_wl_s1_standby()
2227 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWD0, RFREG_MASK, 0x208); in rtw8851b_btc_wl_s1_standby()
2229 rtw89_write_rf(rtwdev, btc->btg_pos, RR_LUTWE, RFREG_MASK, 0x0); in rtw8851b_btc_wl_s1_standby()
2239 /* To improve BT ACI in co-rx in rtw8851b_btc_set_wl_rx_gain()
2243 struct rtw89_btc *btc = &rtwdev->btc; in rtw8851b_btc_set_wl_rx_gain()
2250 btc->dm.wl_lna2 = 0; in rtw8851b_btc_set_wl_rx_gain()
2252 case 1: /* for FDD free-run */ in rtw8851b_btc_set_wl_rx_gain()
2253 btc->dm.wl_lna2 = 0; in rtw8851b_btc_set_wl_rx_gain()
2255 case 2: /* for BTG Co-Rx*/ in rtw8851b_btc_set_wl_rx_gain()
2256 btc->dm.wl_lna2 = 1; in rtw8851b_btc_set_wl_rx_gain()
2260 if (btc->dm.wl_lna2 == 0) { in rtw8851b_btc_set_wl_rx_gain()
2269 val = rf->data; in rtw8851b_btc_set_wl_rx_gain()
2270 /* bit[10] = 1 if non-shared-ant for 8851b */ in rtw8851b_btc_set_wl_rx_gain()
2271 if (btc->ant_type == BTC_ANT_DEDICATED) in rtw8851b_btc_set_wl_rx_gain()
2274 rtw89_write_rf(rtwdev, btc->btg_pos, rf->addr, LNA2_51B_MA, val); in rtw8851b_btc_set_wl_rx_gain()
2282 u16 chan = phy_ppdu->chan_idx; in rtw8851b_fill_freq_with_ppdu()
2290 status->freq = ieee80211_channel_to_frequency(ch, band); in rtw8851b_fill_freq_with_ppdu()
2291 status->band = band; in rtw8851b_fill_freq_with_ppdu()
2299 u8 *rx_power = phy_ppdu->rssi; in rtw8851b_query_ppdu()
2301 status->signal = RTW89_RSSI_RAW_TO_DBM(rx_power[RF_PATH_A]); in rtw8851b_query_ppdu()
2303 for (path = 0; path < rtwdev->chip->rf_path_num; path++) { in rtw8851b_query_ppdu()
2304 status->chains |= BIT(path); in rtw8851b_query_ppdu()
2305 status->chain_signal[path] = RTW89_RSSI_RAW_TO_DBM(rx_power[path]); in rtw8851b_query_ppdu()
2307 if (phy_ppdu->valid) in rtw8851b_query_ppdu()