Lines Matching refs:path

93 	u32 path, i;  in rtw8822c_dac_backup_reg()  local
108 for (path = 0; path < DACK_PATH_8822C; path++) { in rtw8822c_dac_backup_reg()
111 val = rtw_read_rf(rtwdev, path, reg, RFREG_MASK); in rtw8822c_dac_backup_reg()
112 backup_rf[path * i + i].reg = reg; in rtw8822c_dac_backup_reg()
113 backup_rf[path * i + i].val = val; in rtw8822c_dac_backup_reg()
122 u32 path, i; in rtw8822c_dac_restore_reg() local
128 for (path = 0; path < DACK_PATH_8822C; path++) { in rtw8822c_dac_restore_reg()
130 val = backup_rf[path * i + i].val; in rtw8822c_dac_restore_reg()
131 reg = backup_rf[path * i + i].reg; in rtw8822c_dac_restore_reg()
132 rtw_write_rf(rtwdev, path, reg, RFREG_MASK, val); in rtw8822c_dac_restore_reg()
217 static u32 rtw8822c_get_path_write_addr(u8 path) in rtw8822c_get_path_write_addr() argument
221 switch (path) { in rtw8822c_get_path_write_addr()
236 static u32 rtw8822c_get_path_read_addr(u8 path) in rtw8822c_get_path_read_addr() argument
240 switch (path) { in rtw8822c_get_path_read_addr()
376 u8 path, u32 *adc_ic, u32 *adc_qc) in rtw8822c_dac_cal_adc() argument
384 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DACK] ADCK path(%d)\n", path); in rtw8822c_dac_cal_adc()
386 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_adc()
387 switch (path) { in rtw8822c_dac_cal_adc()
401 if (path == RF_PATH_B) in rtw8822c_dac_cal_adc()
428 dm_info->dack_adck[path] = temp; in rtw8822c_dac_cal_adc()
450 rtw_write_rf(rtwdev, path, 0x8f, BIT(13), 0x1); in rtw8822c_dac_cal_adc()
453 static void rtw8822c_dac_cal_step1(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_step1() argument
459 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step1()
460 read_addr = rtw8822c_get_path_read_addr(path); in rtw8822c_dac_cal_step1()
462 rtw_write32(rtwdev, base_addr + 0x68, dm_info->dack_adck[path]); in rtw8822c_dac_cal_step1()
464 if (path == RF_PATH_A) { in rtw8822c_dac_cal_step1()
499 u8 path, u32 *ic_out, u32 *qc_out) in rtw8822c_dac_cal_step2() argument
504 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step2()
547 static void rtw8822c_dac_cal_step3(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dac_cal_step3() argument
557 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step3()
558 read_addr = rtw8822c_get_path_read_addr(path); in rtw8822c_dac_cal_step3()
624 static void rtw8822c_dac_cal_step4(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_step4() argument
626 u32 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step4()
635 u8 path, u8 vec, u32 w_addr, u32 r_addr) in rtw8822c_dac_cal_backup_vec() argument
647 dm_info->dack_msbk[path][vec][i] = val; in rtw8822c_dac_cal_backup_vec()
651 static void rtw8822c_dac_cal_backup_path(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_backup_path() argument
657 if (WARN_ON(path >= 2)) in rtw8822c_dac_cal_backup_path()
661 w_addr = rtw8822c_get_path_write_addr(path) + 0xb0; in rtw8822c_dac_cal_backup_path()
662 r_addr = rtw8822c_get_path_read_addr(path) + 0x10; in rtw8822c_dac_cal_backup_path()
663 rtw8822c_dac_cal_backup_vec(rtwdev, path, 0, w_addr, r_addr); in rtw8822c_dac_cal_backup_path()
666 w_addr = rtw8822c_get_path_write_addr(path) + 0xb0 + w_off; in rtw8822c_dac_cal_backup_path()
667 r_addr = rtw8822c_get_path_read_addr(path) + 0x10 + r_off; in rtw8822c_dac_cal_backup_path()
668 rtw8822c_dac_cal_backup_vec(rtwdev, path, 1, w_addr, r_addr); in rtw8822c_dac_cal_backup_path()
825 static bool rtw8822c_dac_cal_restore_path(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_restore_path() argument
834 w_i = rtw8822c_get_path_write_addr(path) + 0xb0; in rtw8822c_dac_cal_restore_path()
835 r_i = rtw8822c_get_path_read_addr(path) + 0x08; in rtw8822c_dac_cal_restore_path()
836 w_q = rtw8822c_get_path_write_addr(path) + 0xb0 + w_off; in rtw8822c_dac_cal_restore_path()
837 r_q = rtw8822c_get_path_read_addr(path) + 0x08 + r_off; in rtw8822c_dac_cal_restore_path()
844 value = dm_info->dack_msbk[path][0][i]; in rtw8822c_dac_cal_restore_path()
857 value = dm_info->dack_msbk[path][1][i]; in rtw8822c_dac_cal_restore_path()
1013 u8 path; in rtw8822c_set_power_trim() local
1015 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_set_power_trim()
1016 rtw_write_rf(rtwdev, path, 0xee, BIT(19), 1); in rtw8822c_set_power_trim()
1017 RF_SET_POWER_TRIM(path, 0x0, 0); in rtw8822c_set_power_trim()
1018 RF_SET_POWER_TRIM(path, 0x1, 1); in rtw8822c_set_power_trim()
1019 RF_SET_POWER_TRIM(path, 0x2, 2); in rtw8822c_set_power_trim()
1020 RF_SET_POWER_TRIM(path, 0x3, 2); in rtw8822c_set_power_trim()
1021 RF_SET_POWER_TRIM(path, 0x4, 3); in rtw8822c_set_power_trim()
1022 RF_SET_POWER_TRIM(path, 0x5, 4); in rtw8822c_set_power_trim()
1023 RF_SET_POWER_TRIM(path, 0x6, 5); in rtw8822c_set_power_trim()
1024 RF_SET_POWER_TRIM(path, 0x7, 6); in rtw8822c_set_power_trim()
1025 RF_SET_POWER_TRIM(path, 0x8, 7); in rtw8822c_set_power_trim()
1026 RF_SET_POWER_TRIM(path, 0x9, 3); in rtw8822c_set_power_trim()
1027 RF_SET_POWER_TRIM(path, 0xa, 4); in rtw8822c_set_power_trim()
1028 RF_SET_POWER_TRIM(path, 0xb, 5); in rtw8822c_set_power_trim()
1029 RF_SET_POWER_TRIM(path, 0xc, 6); in rtw8822c_set_power_trim()
1030 RF_SET_POWER_TRIM(path, 0xd, 7); in rtw8822c_set_power_trim()
1031 RF_SET_POWER_TRIM(path, 0xe, 7); in rtw8822c_set_power_trim()
1032 rtw_write_rf(rtwdev, path, 0xee, BIT(19), 0); in rtw8822c_set_power_trim()
1039 u8 pg_pwr = 0xff, i, path, idx; in rtw8822c_power_trim() local
1058 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_power_trim()
1059 rtw_read8_physical_efuse(rtwdev, rf_efuse_5g[path][i], in rtw8822c_power_trim()
1065 bb_gain[path][idx] = FIELD_GET(PPG_5G_MASK, pg_pwr); in rtw8822c_power_trim()
1077 u8 pg_therm = 0xff, thermal[2] = {0}, path; in rtw8822c_thermal_trim() local
1079 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_thermal_trim()
1080 rtw_read8_physical_efuse(rtwdev, rf_efuse[path], &pg_therm); in rtw8822c_thermal_trim()
1086 thermal[path] = FIELD_GET(GENMASK(3, 1), pg_therm); in rtw8822c_thermal_trim()
1087 thermal[path] |= FIELD_PREP(BIT(3), pg_therm & BIT(0)); in rtw8822c_thermal_trim()
1088 rtw_write_rf(rtwdev, path, 0x43, RF_THEMAL_MASK, thermal[path]); in rtw8822c_thermal_trim()
1096 u8 pg_pa_bias = 0xff, path; in rtw8822c_pa_bias() local
1098 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_pa_bias()
1099 rtw_read8_physical_efuse(rtwdev, rf_efuse_2g[path], in rtw8822c_pa_bias()
1104 rtw_write_rf(rtwdev, path, RF_PA, RF_PABIAS_2G_MASK, pg_pa_bias); in rtw8822c_pa_bias()
1106 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_pa_bias()
1107 rtw_read8_physical_efuse(rtwdev, rf_efuse_5g[path], in rtw8822c_pa_bias()
1110 rtw_write_rf(rtwdev, path, RF_PA, RF_PABIAS_5G_MASK, pg_pa_bias); in rtw8822c_pa_bias()
1163 u8 path; in rtw8822c_rfk_power_save() local
1165 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_rfk_power_save()
1166 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in rtw8822c_rfk_power_save()
1229 static void rtw8822c_txgapk_bb_dpk(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_bb_dpk() argument
1242 if (path == RF_PATH_A) { in rtw8822c_txgapk_bb_dpk()
1249 } else if (path == RF_PATH_B) { in rtw8822c_txgapk_bb_dpk()
1261 static void rtw8822c_txgapk_afe_dpk(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_afe_dpk() argument
1267 if (path == RF_PATH_A) { in rtw8822c_txgapk_afe_dpk()
1269 } else if (path == RF_PATH_B) { in rtw8822c_txgapk_afe_dpk()
1272 rtw_err(rtwdev, "[TXGAPK] unknown path %d!!\n", path); in rtw8822c_txgapk_afe_dpk()
1297 static void rtw8822c_txgapk_afe_dpk_restore(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_afe_dpk_restore() argument
1303 if (path == RF_PATH_A) { in rtw8822c_txgapk_afe_dpk_restore()
1305 } else if (path == RF_PATH_B) { in rtw8822c_txgapk_afe_dpk_restore()
1308 rtw_err(rtwdev, "[TXGAPK] unknown path %d!!\n", path); in rtw8822c_txgapk_afe_dpk_restore()
1330 static void rtw8822c_txgapk_bb_dpk_restore(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_bb_dpk_restore() argument
1334 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TX_GAIN, 0x0); in rtw8822c_txgapk_bb_dpk_restore()
1335 rtw_write_rf(rtwdev, path, RF_DIS_BYPASS_TXBB, BIT_TIA_BYPASS, 0x0); in rtw8822c_txgapk_bb_dpk_restore()
1336 rtw_write_rf(rtwdev, path, RF_DIS_BYPASS_TXBB, BIT_TXBB, 0x0); in rtw8822c_txgapk_bb_dpk_restore()
1349 if (path == RF_PATH_A) { in rtw8822c_txgapk_bb_dpk_restore()
1356 } else if (path == RF_PATH_B) { in rtw8822c_txgapk_bb_dpk_restore()
1380 u8 band, u8 path) in _rtw8822c_txgapk_write_gain_bb_table() argument
1386 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in _rtw8822c_txgapk_write_gain_bb_table()
1409 v = txgapk->rf3f_bp[band][gain][path]; in _rtw8822c_txgapk_write_gain_bb_table()
1412 tmp_3f = txgapk->rf3f_bp[band][gain][path]; in _rtw8822c_txgapk_write_gain_bb_table()
1417 txgapk->rf3f_bp[band][gain][path]); in _rtw8822c_txgapk_write_gain_bb_table()
1419 tmp_3f = txgapk->rf3f_bp[band][gain][path]; in _rtw8822c_txgapk_write_gain_bb_table()
1429 band, tmp_3f, path); in _rtw8822c_txgapk_write_gain_bb_table()
1435 u8 path, band; in rtw8822c_txgapk_write_gain_bb_table() local
1441 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_txgapk_write_gain_bb_table()
1443 band, path); in rtw8822c_txgapk_write_gain_bb_table()
1448 static void rtw8822c_txgapk_read_offset(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_read_offset() argument
1459 if (path >= ARRAY_SIZE(cfg1_1b00) || in rtw8822c_txgapk_read_offset()
1460 path >= ARRAY_SIZE(cfg2_1b00) || in rtw8822c_txgapk_read_offset()
1461 path >= ARRAY_SIZE(set_pi) || in rtw8822c_txgapk_read_offset()
1462 path >= ARRAY_SIZE(path_setting)) { in rtw8822c_txgapk_read_offset()
1463 rtw_warn(rtwdev, "[TXGAPK] wrong path %d\n", path); in rtw8822c_txgapk_read_offset()
1467 rtw_write32_mask(rtwdev, REG_ANTMAP0, BIT_ANT_PATH, path + 1); in rtw8822c_txgapk_read_offset()
1470 rtw_write32_mask(rtwdev, path_setting[path], MASK20BITS, 0x33312); in rtw8822c_txgapk_read_offset()
1471 rtw_write32_mask(rtwdev, path_setting[path], BIT_PATH_EN, 0x1); in rtw8822c_txgapk_read_offset()
1472 rtw_write32_mask(rtwdev, set_pi[path], BITS_RFC_DIRECT, 0x0); in rtw8822c_txgapk_read_offset()
1473 rtw_write_rf(rtwdev, path, RF_LUTDBG, BIT_TXA_TANK, 0x1); in rtw8822c_txgapk_read_offset()
1474 rtw_write_rf(rtwdev, path, RF_IDAC, BIT_TX_MODE, 0x820); in rtw8822c_txgapk_read_offset()
1475 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in rtw8822c_txgapk_read_offset()
1486 rtw_write32_mask(rtwdev, REG_NCTL0, MASKDWORD, cfg1_1b00[path]); in rtw8822c_txgapk_read_offset()
1487 rtw_write32_mask(rtwdev, REG_NCTL0, MASKDWORD, cfg2_1b00[path]); in rtw8822c_txgapk_read_offset()
1493 rtw_write32_mask(rtwdev, set_pi[path], BITS_RFC_DIRECT, 0x2); in rtw8822c_txgapk_read_offset()
1494 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in rtw8822c_txgapk_read_offset()
1500 txgapk->offset[0][path] = (s8)FIELD_GET(BIT_GAPK_RPT0, val); in rtw8822c_txgapk_read_offset()
1501 txgapk->offset[1][path] = (s8)FIELD_GET(BIT_GAPK_RPT1, val); in rtw8822c_txgapk_read_offset()
1502 txgapk->offset[2][path] = (s8)FIELD_GET(BIT_GAPK_RPT2, val); in rtw8822c_txgapk_read_offset()
1503 txgapk->offset[3][path] = (s8)FIELD_GET(BIT_GAPK_RPT3, val); in rtw8822c_txgapk_read_offset()
1504 txgapk->offset[4][path] = (s8)FIELD_GET(BIT_GAPK_RPT4, val); in rtw8822c_txgapk_read_offset()
1505 txgapk->offset[5][path] = (s8)FIELD_GET(BIT_GAPK_RPT5, val); in rtw8822c_txgapk_read_offset()
1506 txgapk->offset[6][path] = (s8)FIELD_GET(BIT_GAPK_RPT6, val); in rtw8822c_txgapk_read_offset()
1507 txgapk->offset[7][path] = (s8)FIELD_GET(BIT_GAPK_RPT7, val); in rtw8822c_txgapk_read_offset()
1512 txgapk->offset[8][path] = (s8)FIELD_GET(BIT_GAPK_RPT0, val); in rtw8822c_txgapk_read_offset()
1513 txgapk->offset[9][path] = (s8)FIELD_GET(BIT_GAPK_RPT1, val); in rtw8822c_txgapk_read_offset()
1516 if (txgapk->offset[i][path] & BIT(3)) in rtw8822c_txgapk_read_offset()
1517 txgapk->offset[i][path] = txgapk->offset[i][path] | in rtw8822c_txgapk_read_offset()
1522 txgapk->offset[i][path], i, path); in rtw8822c_txgapk_read_offset()
1525 static void rtw8822c_txgapk_calculate_offset(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_calculate_offset() argument
1542 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in rtw8822c_txgapk_calculate_offset()
1545 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TX_GAIN, 0x1); in rtw8822c_txgapk_calculate_offset()
1546 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x5000f); in rtw8822c_txgapk_calculate_offset()
1547 rtw_write_rf(rtwdev, path, RF_TX_GAIN_OFFSET, BIT_RF_GAIN, 0x0); in rtw8822c_txgapk_calculate_offset()
1548 rtw_write_rf(rtwdev, path, RF_RXG_GAIN, BIT_RXG_GAIN, 0x1); in rtw8822c_txgapk_calculate_offset()
1549 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RXAGC, 0x0f); in rtw8822c_txgapk_calculate_offset()
1550 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TRXBW, 0x1); in rtw8822c_txgapk_calculate_offset()
1551 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_TXBB, 0x1); in rtw8822c_txgapk_calculate_offset()
1552 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_RXBB, 0x0); in rtw8822c_txgapk_calculate_offset()
1553 rtw_write_rf(rtwdev, path, RF_EXT_TIA_BW, BIT_PW_EXT_TIA, 0x1); in rtw8822c_txgapk_calculate_offset()
1558 rtw8822c_txgapk_read_offset(rtwdev, path); in rtw8822c_txgapk_calculate_offset()
1564 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SEL_PATH, path); in rtw8822c_txgapk_calculate_offset()
1567 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TX_GAIN, 0x1); in rtw8822c_txgapk_calculate_offset()
1568 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x50011); in rtw8822c_txgapk_calculate_offset()
1569 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_TXA_LB_ATT, 0x3); in rtw8822c_txgapk_calculate_offset()
1570 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_ATT, 0x3); in rtw8822c_txgapk_calculate_offset()
1571 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_SW, 0x1); in rtw8822c_txgapk_calculate_offset()
1572 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_calculate_offset()
1574 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RXAGC, 0x12); in rtw8822c_txgapk_calculate_offset()
1575 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TRXBW, 0x1); in rtw8822c_txgapk_calculate_offset()
1576 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_RXBB, 0x0); in rtw8822c_txgapk_calculate_offset()
1577 rtw_write_rf(rtwdev, path, RF_EXT_TIA_BW, BIT_PW_EXT_TIA, 0x1); in rtw8822c_txgapk_calculate_offset()
1578 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RF_MODE, 0x5); in rtw8822c_txgapk_calculate_offset()
1592 rtw8822c_txgapk_read_offset(rtwdev, path); in rtw8822c_txgapk_calculate_offset()
1599 static void rtw8822c_txgapk_rf_restore(struct rtw_dev *rtwdev, u8 path) in rtw8822c_txgapk_rf_restore() argument
1603 if (path >= rtwdev->hal.rf_path_num) in rtw8822c_txgapk_rf_restore()
1606 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RF_MODE, 0x3); in rtw8822c_txgapk_rf_restore()
1607 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TRXBW, 0x0); in rtw8822c_txgapk_rf_restore()
1608 rtw_write_rf(rtwdev, path, RF_EXT_TIA_BW, BIT_PW_EXT_TIA, 0x0); in rtw8822c_txgapk_rf_restore()
1640 u8 path, band = RF_BAND_2G_OFDM, channel = txgapk->channel; in rtw8822c_txgapk_write_tx_gain() local
1661 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_txgapk_write_tx_gain()
1665 v = txgapk->rf3f_bp[band][j][path]; in rtw8822c_txgapk_write_tx_gain()
1669 offset_tmp[i] += txgapk->offset[j][path]; in rtw8822c_txgapk_write_tx_gain()
1670 txgapk->fianl_offset[i][path] = offset_tmp[i]; in rtw8822c_txgapk_write_tx_gain()
1673 v = txgapk->rf3f_bp[band][i][path]; in rtw8822c_txgapk_write_tx_gain()
1677 txgapk->rf3f_bp[band][i][path]); in rtw8822c_txgapk_write_tx_gain()
1679 txgapk->rf3f_fs[path][i] = offset_tmp[i]; in rtw8822c_txgapk_write_tx_gain()
1686 rtw_write_rf(rtwdev, path, RF_LUTWE2, RFREG_MASK, 0x10000); in rtw8822c_txgapk_write_tx_gain()
1688 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_write_tx_gain()
1692 txgapk->rf3f_bp[band][i][path], in rtw8822c_txgapk_write_tx_gain()
1694 rtw_write_rf(rtwdev, path, RF_LUTWD0, in rtw8822c_txgapk_write_tx_gain()
1701 rtw_write_rf(rtwdev, path, RF_LUTWE2, RFREG_MASK, 0x0); in rtw8822c_txgapk_write_tx_gain()
1712 u8 path, band, gain, rf0_idx; in rtw8822c_txgapk_save_all_tx_gain_table() local
1728 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_txgapk_save_all_tx_gain_table()
1729 rf18 = rtw_read_rf(rtwdev, path, RF_CFGCH, RFREG_MASK); in rtw8822c_txgapk_save_all_tx_gain_table()
1732 three_wire[path], BIT_3WIRE_EN, 0x0); in rtw8822c_txgapk_save_all_tx_gain_table()
1733 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_save_all_tx_gain_table()
1735 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_save_all_tx_gain_table()
1737 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_save_all_tx_gain_table()
1739 rtw_write_rf(rtwdev, path, in rtw8822c_txgapk_save_all_tx_gain_table()
1743 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, in rtw8822c_txgapk_save_all_tx_gain_table()
1745 v = rtw_read_rf(rtwdev, path, in rtw8822c_txgapk_save_all_tx_gain_table()
1747 txgapk->rf3f_bp[band][gain][path] = v & BIT_DATA_L; in rtw8822c_txgapk_save_all_tx_gain_table()
1751 txgapk->rf3f_bp[band][gain][path], in rtw8822c_txgapk_save_all_tx_gain_table()
1752 band, path); in rtw8822c_txgapk_save_all_tx_gain_table()
1755 rtw_write_rf(rtwdev, path, RF_CFGCH, RFREG_MASK, rf18); in rtw8822c_txgapk_save_all_tx_gain_table()
1757 three_wire[path], BIT_3WIRE_EN, 0x3); in rtw8822c_txgapk_save_all_tx_gain_table()
1769 u8 path; in rtw8822c_txgapk() local
1791 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_txgapk()
1792 txgapk->channel = rtw_read_rf(rtwdev, path, in rtw8822c_txgapk()
1794 rtw8822c_txgapk_bb_dpk(rtwdev, path); in rtw8822c_txgapk()
1795 rtw8822c_txgapk_afe_dpk(rtwdev, path); in rtw8822c_txgapk()
1796 rtw8822c_txgapk_calculate_offset(rtwdev, path); in rtw8822c_txgapk()
1797 rtw8822c_txgapk_rf_restore(rtwdev, path); in rtw8822c_txgapk()
1798 rtw8822c_txgapk_afe_dpk_restore(rtwdev, path); in rtw8822c_txgapk()
1799 rtw8822c_txgapk_bb_dpk_restore(rtwdev, path); in rtw8822c_txgapk()
1831 u8 path; in rtw8822c_pwrtrack_init() local
1833 for (path = RF_PATH_A; path < RTW_RF_PATH_MAX; path++) { in rtw8822c_pwrtrack_init()
1834 dm_info->delta_power_index[path] = 0; in rtw8822c_pwrtrack_init()
1835 ewma_thermal_init(&dm_info->avg_thermal[path]); in rtw8822c_pwrtrack_init()
1836 dm_info->thermal_avg[path] = 0xff; in rtw8822c_pwrtrack_init()
2536 int path; in query_phy_status_page0() local
2559 for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { in query_phy_status_page0()
2560 rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); in query_phy_status_page0()
2561 dm_info->rssi[path] = rssi; in query_phy_status_page0()
2580 int path; in query_phy_status_page1() local
2613 for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { in query_phy_status_page1()
2614 rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); in query_phy_status_page1()
2615 dm_info->rssi[path] = rssi; in query_phy_status_page1()
2616 if (path == RF_PATH_A) { in query_phy_status_page1()
2619 } else if (path == RF_PATH_B) { in query_phy_status_page1()
2623 dm_info->rx_snr[path] = pkt_stat->rx_snr[path] >> 1; in query_phy_status_page1()
2624 dm_info->cfo_tail[path] = (pkt_stat->cfo_tail[path] * 5) >> 1; in query_phy_status_page1()
2626 rx_evm = pkt_stat->rx_evm[path]; in query_phy_status_page1()
2634 dm_info->rx_evm_dbm[path] = evm_dbm; in query_phy_status_page1()
2708 u8 path; in rtw8822c_set_write_tx_power_ref() local
2710 for (path = 0; path < hal->rf_path_num; path++) { in rtw8822c_set_write_tx_power_ref()
2712 rtw_write32_mask(rtwdev, txref_cck[path], 0x7f0000, in rtw8822c_set_write_tx_power_ref()
2713 tx_pwr_ref_cck[path]); in rtw8822c_set_write_tx_power_ref()
2715 for (path = 0; path < hal->rf_path_num; path++) { in rtw8822c_set_write_tx_power_ref()
2717 rtw_write32_mask(rtwdev, txref_ofdm[path], 0x1fc00, in rtw8822c_set_write_tx_power_ref()
2718 tx_pwr_ref_ofdm[path]); in rtw8822c_set_write_tx_power_ref()
3243 static void rtw8822c_dpk_rxbb_dc_cal(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_rxbb_dc_cal() argument
3245 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84800); in rtw8822c_dpk_rxbb_dc_cal()
3247 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84801); in rtw8822c_dpk_rxbb_dc_cal()
3249 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84800); in rtw8822c_dpk_rxbb_dc_cal()
3252 static u8 rtw8822c_dpk_dc_corr_check(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_dc_corr_check() argument
3309 u8 path; in rtw8822c_dpk_pre_setting() local
3311 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_pre_setting()
3312 rtw_write_rf(rtwdev, path, RF_RXAGC_OFFSET, RFREG_MASK, 0x0); in rtw8822c_dpk_pre_setting()
3313 rtw_write32(rtwdev, REG_NCTL0, 0x8 | (path << 1)); in rtw8822c_dpk_pre_setting()
3326 static u32 rtw8822c_dpk_rf_setting(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_rf_setting() argument
3330 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x50017); in rtw8822c_dpk_rf_setting()
3331 ori_txbb = rtw_read_rf(rtwdev, path, RF_TX_GAIN, RFREG_MASK); in rtw8822c_dpk_rf_setting()
3333 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TX_GAIN, 0x1); in rtw8822c_dpk_rf_setting()
3334 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_PWR_TRIM, 0x1); in rtw8822c_dpk_rf_setting()
3335 rtw_write_rf(rtwdev, path, RF_TX_GAIN_OFFSET, BIT_BB_GAIN, 0x0); in rtw8822c_dpk_rf_setting()
3336 rtw_write_rf(rtwdev, path, RF_TX_GAIN, RFREG_MASK, ori_txbb); in rtw8822c_dpk_rf_setting()
3339 rtw_write_rf(rtwdev, path, RF_TX_GAIN_OFFSET, BIT_RF_GAIN, 0x1); in rtw8822c_dpk_rf_setting()
3340 rtw_write_rf(rtwdev, path, RF_RXG_GAIN, BIT_RXG_GAIN, 0x0); in rtw8822c_dpk_rf_setting()
3342 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_TXA_LB_ATT, 0x0); in rtw8822c_dpk_rf_setting()
3343 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_ATT, 0x6); in rtw8822c_dpk_rf_setting()
3344 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_SW, 0x1); in rtw8822c_dpk_rf_setting()
3345 rtw_write_rf(rtwdev, path, RF_RXA_MIX_GAIN, BIT_RXA_MIX_GAIN, 0); in rtw8822c_dpk_rf_setting()
3348 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RXAGC, 0xf); in rtw8822c_dpk_rf_setting()
3349 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TRXBW, 0x1); in rtw8822c_dpk_rf_setting()
3350 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_RXBB, 0x0); in rtw8822c_dpk_rf_setting()
3353 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_TXBB, 0x2); in rtw8822c_dpk_rf_setting()
3355 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_TXBB, 0x1); in rtw8822c_dpk_rf_setting()
3357 rtw_write_rf(rtwdev, path, RF_EXT_TIA_BW, BIT(1), 0x1); in rtw8822c_dpk_rf_setting()
3364 static u16 rtw8822c_dpk_get_cmd(struct rtw_dev *rtwdev, u8 action, u8 path) in rtw8822c_dpk_get_cmd() argument
3371 cmd = 0x14 + path; in rtw8822c_dpk_get_cmd()
3374 cmd = 0x16 + path + bw; in rtw8822c_dpk_get_cmd()
3377 cmd = 0x1a + path; in rtw8822c_dpk_get_cmd()
3380 cmd = 0x1c + path + bw; in rtw8822c_dpk_get_cmd()
3389 static u8 rtw8822c_dpk_one_shot(struct rtw_dev *rtwdev, u8 path, u8 action) in rtw8822c_dpk_one_shot() argument
3407 0x8 | (path << 1)); in rtw8822c_dpk_one_shot()
3410 dpk_cmd = rtw8822c_dpk_get_cmd(rtwdev, action, path); in rtw8822c_dpk_one_shot()
3419 0x8 | (path << 1)); in rtw8822c_dpk_one_shot()
3430 static u16 rtw8822c_dpk_dgain_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_dgain_read() argument
3442 static u8 rtw8822c_dpk_thermal_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_thermal_read() argument
3444 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x1); in rtw8822c_dpk_thermal_read()
3445 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x0); in rtw8822c_dpk_thermal_read()
3446 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x1); in rtw8822c_dpk_thermal_read()
3449 return (u8)rtw_read_rf(rtwdev, path, RF_T_METER, 0x0007e); in rtw8822c_dpk_thermal_read()
3452 static u32 rtw8822c_dpk_pas_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_pas_read() argument
3456 rtw_write32(rtwdev, REG_NCTL0, 0x8 | (path << 1)); in rtw8822c_dpk_pas_read()
3501 static u8 rtw8822c_dpk_gainloss_result(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_gainloss_result() argument
3505 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_gainloss_result()
3516 static u8 rtw8822c_dpk_agc_gain_chk(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dpk_agc_gain_chk() argument
3522 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_agc_gain_chk()
3523 dgain = rtw8822c_dpk_dgain_read(rtwdev, path); in rtw8822c_dpk_agc_gain_chk()
3533 static u8 rtw8822c_dpk_agc_loss_chk(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_agc_loss_chk() argument
3537 loss = rtw8822c_dpk_pas_read(rtwdev, path); in rtw8822c_dpk_agc_loss_chk()
3557 u8 path; member
3565 data->txbb = (u8)rtw_read_rf(rtwdev, data->path, RF_TX_GAIN, in rtw8822c_gain_check_state()
3567 data->pga = (u8)rtw_read_rf(rtwdev, data->path, RF_MODE_TRXAGC, in rtw8822c_gain_check_state()
3575 state = rtw8822c_dpk_agc_gain_chk(rtwdev, data->path, in rtw8822c_gain_check_state()
3596 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xc); in rtw8822c_gain_large_state()
3598 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0x0); in rtw8822c_gain_large_state()
3611 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xc); in rtw8822c_gain_less_state()
3613 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xf); in rtw8822c_gain_less_state()
3633 rtw_write_rf(rtwdev, data->path, RF_TX_GAIN, BIT_GAIN_TXBB, data->txbb); in rtw8822c_gl_state()
3654 u8 path = data->path; in rtw8822c_loss_check_state() local
3657 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_GAIN_LOSS); in rtw8822c_loss_check_state()
3658 state = rtw8822c_dpk_agc_loss_chk(rtwdev, path); in rtw8822c_loss_check_state()
3669 static u8 rtw8822c_dpk_pas_agc(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dpk_pas_agc() argument
3678 data.path = path; in rtw8822c_dpk_pas_agc()
3724 static void rtw8822c_dpk_coef_tbl_apply(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_coef_tbl_apply() argument
3732 dpk_info->coef[path][i] = rtw8822c_dpk_coef_transfer(rtwdev); in rtw8822c_dpk_coef_tbl_apply()
3736 static void rtw8822c_dpk_get_coef(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_get_coef() argument
3740 if (path == RF_PATH_A) { in rtw8822c_dpk_get_coef()
3743 } else if (path == RF_PATH_B) { in rtw8822c_dpk_get_coef()
3748 rtw8822c_dpk_coef_tbl_apply(rtwdev, path); in rtw8822c_dpk_get_coef()
3751 static u8 rtw8822c_dpk_coef_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_coef_read() argument
3758 coef_i = FIELD_GET(0x1fff0000, dpk_info->coef[path][addr]); in rtw8822c_dpk_coef_read()
3759 coef_q = FIELD_GET(0x1fff, dpk_info->coef[path][addr]); in rtw8822c_dpk_coef_read()
3769 static void rtw8822c_dpk_coef_write(struct rtw_dev *rtwdev, u8 path, u8 result) in rtw8822c_dpk_coef_write() argument
3786 coef = dpk_info->coef[path][addr]; in rtw8822c_dpk_coef_write()
3788 rtw_write32(rtwdev, reg[path] + addr * 4, coef); in rtw8822c_dpk_coef_write()
3793 u8 path, u8 result) in rtw8822c_dpk_fill_result() argument
3797 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_fill_result()
3804 dpk_info->result[path] = result; in rtw8822c_dpk_fill_result()
3805 dpk_info->dpk_txagc[path] = rtw_read8(rtwdev, REG_DPD_AGC); in rtw8822c_dpk_fill_result()
3807 rtw8822c_dpk_coef_write(rtwdev, path, result); in rtw8822c_dpk_fill_result()
3810 static u32 rtw8822c_dpk_gainloss(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_gainloss() argument
3815 ori_txbb = rtw8822c_dpk_rf_setting(rtwdev, path); in rtw8822c_dpk_gainloss()
3816 ori_txagc = (u8)rtw_read_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_TXAGC); in rtw8822c_dpk_gainloss()
3818 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_dpk_gainloss()
3819 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_gainloss()
3820 rtw8822c_dpk_dgain_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3822 if (rtw8822c_dpk_dc_corr_check(rtwdev, path)) { in rtw8822c_dpk_gainloss()
3823 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_dpk_gainloss()
3824 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_gainloss()
3825 rtw8822c_dpk_dc_corr_check(rtwdev, path); in rtw8822c_dpk_gainloss()
3828 t1 = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3829 tx_bb = rtw8822c_dpk_pas_agc(rtwdev, path, false, true); in rtw8822c_dpk_gainloss()
3830 tx_agc_search = rtw8822c_dpk_gainloss_result(rtwdev, path); in rtw8822c_dpk_gainloss()
3837 rtw_write_rf(rtwdev, path, RF_TX_GAIN, BIT_GAIN_TXBB, tx_bb); in rtw8822c_dpk_gainloss()
3841 t2 = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3843 dpk_info->thermal_dpk_delta[path] = abs(t2 - t1); in rtw8822c_dpk_gainloss()
3848 static u8 rtw8822c_dpk_by_path(struct rtw_dev *rtwdev, u32 tx_agc, u8 path) in rtw8822c_dpk_by_path() argument
3852 result = rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DO_DPK); in rtw8822c_dpk_by_path()
3854 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_by_path()
3858 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x33e14); in rtw8822c_dpk_by_path()
3860 rtw8822c_dpk_get_coef(rtwdev, path); in rtw8822c_dpk_by_path()
3865 static void rtw8822c_dpk_cal_gs(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_cal_gs() argument
3870 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_cal_gs()
3878 if (path == RF_PATH_A) { in rtw8822c_dpk_cal_gs()
3895 0x05020000 | (BIT(path) << 28)); in rtw8822c_dpk_cal_gs()
3903 0x05020008 | (BIT(path) << 28)); in rtw8822c_dpk_cal_gs()
3906 rtw_write32_mask(rtwdev, REG_DPD_CTL0, MASKBYTE3, 0x8 | path); in rtw8822c_dpk_cal_gs()
3908 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_CAL_PWR); in rtw8822c_dpk_cal_gs()
3911 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_cal_gs()
3916 if (path == RF_PATH_A) in rtw8822c_dpk_cal_gs()
3927 if (path == RF_PATH_A) in rtw8822c_dpk_cal_gs()
3932 dpk_info->dpk_gs[path] = tmp_gs; in rtw8822c_dpk_cal_gs()
3940 u8 path; in rtw8822c_dpk_cal_coef1() local
3952 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_cal_coef1()
3953 i_scaling = 0x16c00 / dpk_info->dpk_gs[path]; in rtw8822c_dpk_cal_coef1()
3955 rtw_write32_mask(rtwdev, 0x1b18 + offset[path], MASKHWORD, in rtw8822c_dpk_cal_coef1()
3957 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3959 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3961 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3963 rtw_write32_mask(rtwdev, REG_DPD_CTL1_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3968 static void rtw8822c_dpk_on(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_on() argument
3972 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DPK_ON); in rtw8822c_dpk_on()
3974 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_on()
3977 if (test_bit(path, dpk_info->dpk_path_ok)) in rtw8822c_dpk_on()
3978 rtw8822c_dpk_cal_gs(rtwdev, path); in rtw8822c_dpk_on()
3982 u32 dpk_txagc, u8 path) in rtw8822c_dpk_check_pass() argument
3987 if (rtw8822c_dpk_coef_read(rtwdev, path)) in rtw8822c_dpk_check_pass()
3995 rtw8822c_dpk_fill_result(rtwdev, dpk_txagc, path, result); in rtw8822c_dpk_check_pass()
4003 u8 path; in rtw8822c_dpk_result_reset() local
4005 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_result_reset()
4006 clear_bit(path, dpk_info->dpk_path_ok); in rtw8822c_dpk_result_reset()
4008 0x8 | (path << 1)); in rtw8822c_dpk_result_reset()
4011 dpk_info->dpk_txagc[path] = 0; in rtw8822c_dpk_result_reset()
4012 dpk_info->result[path] = 0; in rtw8822c_dpk_result_reset()
4013 dpk_info->dpk_gs[path] = 0x5b; in rtw8822c_dpk_result_reset()
4014 dpk_info->pre_pwsf[path] = 0; in rtw8822c_dpk_result_reset()
4015 dpk_info->thermal_dpk[path] = rtw8822c_dpk_thermal_read(rtwdev, in rtw8822c_dpk_result_reset()
4016 path); in rtw8822c_dpk_result_reset()
4020 static void rtw8822c_dpk_calibrate(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_calibrate() argument
4026 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] s%d dpk start\n", path); in rtw8822c_dpk_calibrate()
4028 dpk_txagc = rtw8822c_dpk_gainloss(rtwdev, path); in rtw8822c_dpk_calibrate()
4030 dpk_fail = rtw8822c_dpk_by_path(rtwdev, dpk_txagc, path); in rtw8822c_dpk_calibrate()
4032 if (!rtw8822c_dpk_check_pass(rtwdev, dpk_fail, dpk_txagc, path)) in rtw8822c_dpk_calibrate()
4035 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] s%d dpk finish\n", path); in rtw8822c_dpk_calibrate()
4037 if (dpk_info->result[path]) in rtw8822c_dpk_calibrate()
4038 set_bit(path, dpk_info->dpk_path_ok); in rtw8822c_dpk_calibrate()
4075 u8 path; in rtw8822c_dpk_reload_data() local
4082 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_reload_data()
4084 0x8 | (path << 1)); in rtw8822c_dpk_reload_data()
4090 rtw_write8(rtwdev, REG_DPD_AGC, dpk_info->dpk_txagc[path]); in rtw8822c_dpk_reload_data()
4092 rtw8822c_dpk_coef_write(rtwdev, path, in rtw8822c_dpk_reload_data()
4093 test_bit(path, dpk_info->dpk_path_ok)); in rtw8822c_dpk_reload_data()
4095 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DPK_ON); in rtw8822c_dpk_reload_data()
4099 if (path == RF_PATH_A) in rtw8822c_dpk_reload_data()
4101 dpk_info->dpk_gs[path]); in rtw8822c_dpk_reload_data()
4104 dpk_info->dpk_gs[path]); in rtw8822c_dpk_reload_data()
4139 u8 path; in rtw8822c_do_dpk() local
4148 for (path = RF_PATH_A; path < DPK_RF_PATH_NUM; path++) in rtw8822c_do_dpk()
4149 ewma_thermal_init(&dpk_info->avg_thermal[path]); in rtw8822c_do_dpk()
4165 for (path = 0; path < rtwdev->hal.rf_path_num; path++) in rtw8822c_do_dpk()
4166 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_do_dpk()
4182 u8 path; in rtw8822c_dpk_track() local
4189 for (path = 0; path < DPK_RF_PATH_NUM; path++) { in rtw8822c_dpk_track()
4190 thermal_value[path] = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_track()
4191 ewma_thermal_add(&dpk_info->avg_thermal[path], in rtw8822c_dpk_track()
4192 thermal_value[path]); in rtw8822c_dpk_track()
4193 thermal_value[path] = in rtw8822c_dpk_track()
4194 ewma_thermal_read(&dpk_info->avg_thermal[path]); in rtw8822c_dpk_track()
4195 delta_dpk[path] = dpk_info->thermal_dpk[path] - in rtw8822c_dpk_track()
4196 thermal_value[path]; in rtw8822c_dpk_track()
4197 offset[path] = delta_dpk[path] - in rtw8822c_dpk_track()
4198 dpk_info->thermal_dpk_delta[path]; in rtw8822c_dpk_track()
4199 offset[path] &= 0x7f; in rtw8822c_dpk_track()
4201 if (offset[path] != dpk_info->pre_pwsf[path]) { in rtw8822c_dpk_track()
4203 0x8 | (path << 1)); in rtw8822c_dpk_track()
4205 offset[path]); in rtw8822c_dpk_track()
4206 dpk_info->pre_pwsf[path] = offset[path]; in rtw8822c_dpk_track()
4435 static void rtw8822c_pwr_track_stats(struct rtw_dev *rtwdev, u8 path) in rtw8822c_pwr_track_stats() argument
4439 if (rtwdev->efuse.thermal_meter[path] == 0xff) in rtw8822c_pwr_track_stats()
4442 thermal_value = rtw_read_rf(rtwdev, path, RF_T_METER, 0x7e); in rtw8822c_pwr_track_stats()
4443 rtw_phy_pwrtrack_avg(rtwdev, thermal_value, path); in rtw8822c_pwr_track_stats()
4448 u8 path) in rtw8822c_pwr_track_path() argument
4453 delta = rtw_phy_pwrtrack_get_delta(rtwdev, path); in rtw8822c_pwr_track_path()
4454 dm_info->delta_power_index[path] = in rtw8822c_pwr_track_path()
4455 rtw_phy_pwrtrack_get_pwridx(rtwdev, swing_table, path, path, in rtw8822c_pwr_track_path()
4457 rtw8822c_pwrtrack_set(rtwdev, path); in rtw8822c_pwr_track_path()