• Home
  • Raw
  • Download

Lines Matching refs:path

84 	u32 path, i;  in rtw8822c_dac_backup_reg()  local
99 for (path = 0; path < DACK_PATH_8822C; path++) { in rtw8822c_dac_backup_reg()
102 val = rtw_read_rf(rtwdev, path, reg, RFREG_MASK); in rtw8822c_dac_backup_reg()
103 backup_rf[path * i + i].reg = reg; in rtw8822c_dac_backup_reg()
104 backup_rf[path * i + i].val = val; in rtw8822c_dac_backup_reg()
113 u32 path, i; in rtw8822c_dac_restore_reg() local
119 for (path = 0; path < DACK_PATH_8822C; path++) { in rtw8822c_dac_restore_reg()
121 val = backup_rf[path * i + i].val; in rtw8822c_dac_restore_reg()
122 reg = backup_rf[path * i + i].reg; in rtw8822c_dac_restore_reg()
123 rtw_write_rf(rtwdev, path, reg, RFREG_MASK, val); in rtw8822c_dac_restore_reg()
208 static u32 rtw8822c_get_path_write_addr(u8 path) in rtw8822c_get_path_write_addr() argument
212 switch (path) { in rtw8822c_get_path_write_addr()
227 static u32 rtw8822c_get_path_read_addr(u8 path) in rtw8822c_get_path_read_addr() argument
231 switch (path) { in rtw8822c_get_path_read_addr()
367 u8 path, u32 *adc_ic, u32 *adc_qc) in rtw8822c_dac_cal_adc() argument
375 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DACK] ADCK path(%d)\n", path); in rtw8822c_dac_cal_adc()
377 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_adc()
378 switch (path) { in rtw8822c_dac_cal_adc()
392 if (path == RF_PATH_B) in rtw8822c_dac_cal_adc()
419 dm_info->dack_adck[path] = temp; in rtw8822c_dac_cal_adc()
441 rtw_write_rf(rtwdev, path, 0x8f, BIT(13), 0x1); in rtw8822c_dac_cal_adc()
444 static void rtw8822c_dac_cal_step1(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_step1() argument
450 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step1()
451 read_addr = rtw8822c_get_path_read_addr(path); in rtw8822c_dac_cal_step1()
453 rtw_write32(rtwdev, base_addr + 0x68, dm_info->dack_adck[path]); in rtw8822c_dac_cal_step1()
455 if (path == RF_PATH_A) { in rtw8822c_dac_cal_step1()
490 u8 path, u32 *ic_out, u32 *qc_out) in rtw8822c_dac_cal_step2() argument
495 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step2()
538 static void rtw8822c_dac_cal_step3(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dac_cal_step3() argument
548 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step3()
549 read_addr = rtw8822c_get_path_read_addr(path); in rtw8822c_dac_cal_step3()
615 static void rtw8822c_dac_cal_step4(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_step4() argument
617 u32 base_addr = rtw8822c_get_path_write_addr(path); in rtw8822c_dac_cal_step4()
626 u8 path, u8 vec, u32 w_addr, u32 r_addr) in rtw8822c_dac_cal_backup_vec() argument
638 dm_info->dack_msbk[path][vec][i] = val; in rtw8822c_dac_cal_backup_vec()
642 static void rtw8822c_dac_cal_backup_path(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_backup_path() argument
648 if (WARN_ON(path >= 2)) in rtw8822c_dac_cal_backup_path()
652 w_addr = rtw8822c_get_path_write_addr(path) + 0xb0; in rtw8822c_dac_cal_backup_path()
653 r_addr = rtw8822c_get_path_read_addr(path) + 0x10; in rtw8822c_dac_cal_backup_path()
654 rtw8822c_dac_cal_backup_vec(rtwdev, path, 0, w_addr, r_addr); in rtw8822c_dac_cal_backup_path()
657 w_addr = rtw8822c_get_path_write_addr(path) + 0xb0 + w_off; in rtw8822c_dac_cal_backup_path()
658 r_addr = rtw8822c_get_path_read_addr(path) + 0x10 + r_off; in rtw8822c_dac_cal_backup_path()
659 rtw8822c_dac_cal_backup_vec(rtwdev, path, 1, w_addr, r_addr); in rtw8822c_dac_cal_backup_path()
816 static bool rtw8822c_dac_cal_restore_path(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dac_cal_restore_path() argument
825 w_i = rtw8822c_get_path_write_addr(path) + 0xb0; in rtw8822c_dac_cal_restore_path()
826 r_i = rtw8822c_get_path_read_addr(path) + 0x08; in rtw8822c_dac_cal_restore_path()
827 w_q = rtw8822c_get_path_write_addr(path) + 0xb0 + w_off; in rtw8822c_dac_cal_restore_path()
828 r_q = rtw8822c_get_path_read_addr(path) + 0x08 + r_off; in rtw8822c_dac_cal_restore_path()
835 value = dm_info->dack_msbk[path][0][i]; in rtw8822c_dac_cal_restore_path()
848 value = dm_info->dack_msbk[path][1][i]; in rtw8822c_dac_cal_restore_path()
1004 u8 path; in rtw8822c_set_power_trim() local
1006 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_set_power_trim()
1007 rtw_write_rf(rtwdev, path, 0xee, BIT(19), 1); in rtw8822c_set_power_trim()
1008 RF_SET_POWER_TRIM(path, 0x0, 0); in rtw8822c_set_power_trim()
1009 RF_SET_POWER_TRIM(path, 0x1, 1); in rtw8822c_set_power_trim()
1010 RF_SET_POWER_TRIM(path, 0x2, 2); in rtw8822c_set_power_trim()
1011 RF_SET_POWER_TRIM(path, 0x3, 2); in rtw8822c_set_power_trim()
1012 RF_SET_POWER_TRIM(path, 0x4, 3); in rtw8822c_set_power_trim()
1013 RF_SET_POWER_TRIM(path, 0x5, 4); in rtw8822c_set_power_trim()
1014 RF_SET_POWER_TRIM(path, 0x6, 5); in rtw8822c_set_power_trim()
1015 RF_SET_POWER_TRIM(path, 0x7, 6); in rtw8822c_set_power_trim()
1016 RF_SET_POWER_TRIM(path, 0x8, 7); in rtw8822c_set_power_trim()
1017 RF_SET_POWER_TRIM(path, 0x9, 3); in rtw8822c_set_power_trim()
1018 RF_SET_POWER_TRIM(path, 0xa, 4); in rtw8822c_set_power_trim()
1019 RF_SET_POWER_TRIM(path, 0xb, 5); in rtw8822c_set_power_trim()
1020 RF_SET_POWER_TRIM(path, 0xc, 6); in rtw8822c_set_power_trim()
1021 RF_SET_POWER_TRIM(path, 0xd, 7); in rtw8822c_set_power_trim()
1022 RF_SET_POWER_TRIM(path, 0xe, 7); in rtw8822c_set_power_trim()
1023 rtw_write_rf(rtwdev, path, 0xee, BIT(19), 0); in rtw8822c_set_power_trim()
1030 u8 pg_pwr = 0xff, i, path, idx; in rtw8822c_power_trim() local
1049 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_power_trim()
1050 rtw_read8_physical_efuse(rtwdev, rf_efuse_5g[path][i], in rtw8822c_power_trim()
1056 bb_gain[path][idx] = FIELD_GET(PPG_5G_MASK, pg_pwr); in rtw8822c_power_trim()
1068 u8 pg_therm = 0xff, thermal[2] = {0}, path; in rtw8822c_thermal_trim() local
1070 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_thermal_trim()
1071 rtw_read8_physical_efuse(rtwdev, rf_efuse[path], &pg_therm); in rtw8822c_thermal_trim()
1077 thermal[path] = FIELD_GET(GENMASK(3, 1), pg_therm); in rtw8822c_thermal_trim()
1078 thermal[path] |= FIELD_PREP(BIT(3), pg_therm & BIT(0)); in rtw8822c_thermal_trim()
1079 rtw_write_rf(rtwdev, path, 0x43, RF_THEMAL_MASK, thermal[path]); in rtw8822c_thermal_trim()
1087 u8 pg_pa_bias = 0xff, path; in rtw8822c_pa_bias() local
1089 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_pa_bias()
1090 rtw_read8_physical_efuse(rtwdev, rf_efuse_2g[path], in rtw8822c_pa_bias()
1095 rtw_write_rf(rtwdev, path, 0x60, RF_PABIAS_2G_MASK, pg_pa_bias); in rtw8822c_pa_bias()
1097 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_pa_bias()
1098 rtw_read8_physical_efuse(rtwdev, rf_efuse_5g[path], in rtw8822c_pa_bias()
1101 rtw_write_rf(rtwdev, path, 0x60, RF_PABIAS_5G_MASK, pg_pa_bias); in rtw8822c_pa_bias()
1117 u8 path; in rtw8822c_pwrtrack_init() local
1119 for (path = RF_PATH_A; path < RTW_RF_PATH_MAX; path++) { in rtw8822c_pwrtrack_init()
1120 dm_info->delta_power_index[path] = 0; in rtw8822c_pwrtrack_init()
1121 ewma_thermal_init(&dm_info->avg_thermal[path]); in rtw8822c_pwrtrack_init()
1122 dm_info->thermal_avg[path] = 0xff; in rtw8822c_pwrtrack_init()
1766 int path; in query_phy_status_page0() local
1789 for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { in query_phy_status_page0()
1790 rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); in query_phy_status_page0()
1791 dm_info->rssi[path] = rssi; in query_phy_status_page0()
1809 int path; in query_phy_status_page1() local
1842 for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { in query_phy_status_page1()
1843 rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); in query_phy_status_page1()
1844 dm_info->rssi[path] = rssi; in query_phy_status_page1()
1845 dm_info->rx_snr[path] = pkt_stat->rx_snr[path] >> 1; in query_phy_status_page1()
1846 dm_info->cfo_tail[path] = (pkt_stat->cfo_tail[path] * 5) >> 1; in query_phy_status_page1()
1848 rx_evm = pkt_stat->rx_evm[path]; in query_phy_status_page1()
1856 dm_info->rx_evm_dbm[path] = evm_dbm; in query_phy_status_page1()
1928 u8 path; in rtw8822c_set_write_tx_power_ref() local
1930 for (path = 0; path < hal->rf_path_num; path++) { in rtw8822c_set_write_tx_power_ref()
1932 rtw_write32_mask(rtwdev, txref_cck[path], 0x7f0000, in rtw8822c_set_write_tx_power_ref()
1933 tx_pwr_ref_cck[path]); in rtw8822c_set_write_tx_power_ref()
1935 for (path = 0; path < hal->rf_path_num; path++) { in rtw8822c_set_write_tx_power_ref()
1937 rtw_write32_mask(rtwdev, txref_ofdm[path], 0x1fc00, in rtw8822c_set_write_tx_power_ref()
1938 tx_pwr_ref_ofdm[path]); in rtw8822c_set_write_tx_power_ref()
2454 static void rtw8822c_dpk_rxbb_dc_cal(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_rxbb_dc_cal() argument
2456 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84800); in rtw8822c_dpk_rxbb_dc_cal()
2458 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84801); in rtw8822c_dpk_rxbb_dc_cal()
2460 rtw_write_rf(rtwdev, path, 0x92, RFREG_MASK, 0x84800); in rtw8822c_dpk_rxbb_dc_cal()
2463 static u8 rtw8822c_dpk_dc_corr_check(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_dc_corr_check() argument
2520 u8 path; in rtw8822c_dpk_pre_setting() local
2522 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_pre_setting()
2523 rtw_write_rf(rtwdev, path, RF_RXAGC_OFFSET, RFREG_MASK, 0x0); in rtw8822c_dpk_pre_setting()
2524 rtw_write32(rtwdev, REG_NCTL0, 0x8 | (path << 1)); in rtw8822c_dpk_pre_setting()
2537 static u32 rtw8822c_dpk_rf_setting(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_rf_setting() argument
2541 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x50017); in rtw8822c_dpk_rf_setting()
2542 ori_txbb = rtw_read_rf(rtwdev, path, RF_TX_GAIN, RFREG_MASK); in rtw8822c_dpk_rf_setting()
2544 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TX_GAIN, 0x1); in rtw8822c_dpk_rf_setting()
2545 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_PWR_TRIM, 0x1); in rtw8822c_dpk_rf_setting()
2546 rtw_write_rf(rtwdev, path, RF_TX_GAIN_OFFSET, BIT_TX_OFFSET_VAL, 0x0); in rtw8822c_dpk_rf_setting()
2547 rtw_write_rf(rtwdev, path, RF_TX_GAIN, RFREG_MASK, ori_txbb); in rtw8822c_dpk_rf_setting()
2550 rtw_write_rf(rtwdev, path, RF_TX_GAIN_OFFSET, BIT_LB_ATT, 0x1); in rtw8822c_dpk_rf_setting()
2551 rtw_write_rf(rtwdev, path, RF_RXG_GAIN, BIT_RXG_GAIN, 0x0); in rtw8822c_dpk_rf_setting()
2553 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_TXA_LB_ATT, 0x0); in rtw8822c_dpk_rf_setting()
2554 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_ATT, 0x6); in rtw8822c_dpk_rf_setting()
2555 rtw_write_rf(rtwdev, path, RF_TXA_LB_SW, BIT_LB_SW, 0x1); in rtw8822c_dpk_rf_setting()
2556 rtw_write_rf(rtwdev, path, RF_RXA_MIX_GAIN, BIT_RXA_MIX_GAIN, 0); in rtw8822c_dpk_rf_setting()
2559 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_RXAGC, 0xf); in rtw8822c_dpk_rf_setting()
2560 rtw_write_rf(rtwdev, path, RF_DEBUG, BIT_DE_TRXBW, 0x1); in rtw8822c_dpk_rf_setting()
2561 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_RXBB, 0x0); in rtw8822c_dpk_rf_setting()
2564 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_TXBB, 0x2); in rtw8822c_dpk_rf_setting()
2566 rtw_write_rf(rtwdev, path, RF_BW_TRXBB, BIT_BW_TXBB, 0x1); in rtw8822c_dpk_rf_setting()
2568 rtw_write_rf(rtwdev, path, RF_EXT_TIA_BW, BIT(1), 0x1); in rtw8822c_dpk_rf_setting()
2575 static u16 rtw8822c_dpk_get_cmd(struct rtw_dev *rtwdev, u8 action, u8 path) in rtw8822c_dpk_get_cmd() argument
2582 cmd = 0x14 + path; in rtw8822c_dpk_get_cmd()
2585 cmd = 0x16 + path + bw; in rtw8822c_dpk_get_cmd()
2588 cmd = 0x1a + path; in rtw8822c_dpk_get_cmd()
2591 cmd = 0x1c + path + bw; in rtw8822c_dpk_get_cmd()
2600 static u8 rtw8822c_dpk_one_shot(struct rtw_dev *rtwdev, u8 path, u8 action) in rtw8822c_dpk_one_shot() argument
2618 0x8 | (path << 1)); in rtw8822c_dpk_one_shot()
2621 dpk_cmd = rtw8822c_dpk_get_cmd(rtwdev, action, path); in rtw8822c_dpk_one_shot()
2630 0x8 | (path << 1)); in rtw8822c_dpk_one_shot()
2641 static u16 rtw8822c_dpk_dgain_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_dgain_read() argument
2653 static u8 rtw8822c_dpk_thermal_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_thermal_read() argument
2655 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x1); in rtw8822c_dpk_thermal_read()
2656 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x0); in rtw8822c_dpk_thermal_read()
2657 rtw_write_rf(rtwdev, path, RF_T_METER, BIT(19), 0x1); in rtw8822c_dpk_thermal_read()
2660 return (u8)rtw_read_rf(rtwdev, path, RF_T_METER, 0x0007e); in rtw8822c_dpk_thermal_read()
2663 static u32 rtw8822c_dpk_pas_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_pas_read() argument
2667 rtw_write32(rtwdev, REG_NCTL0, 0x8 | (path << 1)); in rtw8822c_dpk_pas_read()
2712 static u8 rtw8822c_dpk_gainloss_result(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_gainloss_result() argument
2716 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_gainloss_result()
2727 static u8 rtw8822c_dpk_agc_gain_chk(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dpk_agc_gain_chk() argument
2733 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_agc_gain_chk()
2734 dgain = rtw8822c_dpk_dgain_read(rtwdev, path); in rtw8822c_dpk_agc_gain_chk()
2744 static u8 rtw8822c_dpk_agc_loss_chk(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_agc_loss_chk() argument
2748 loss = rtw8822c_dpk_pas_read(rtwdev, path); in rtw8822c_dpk_agc_loss_chk()
2768 u8 path; member
2776 data->txbb = (u8)rtw_read_rf(rtwdev, data->path, RF_TX_GAIN, in rtw8822c_gain_check_state()
2778 data->pga = (u8)rtw_read_rf(rtwdev, data->path, RF_MODE_TRXAGC, in rtw8822c_gain_check_state()
2786 state = rtw8822c_dpk_agc_gain_chk(rtwdev, data->path, in rtw8822c_gain_check_state()
2807 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xc); in rtw8822c_gain_large_state()
2809 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0x0); in rtw8822c_gain_large_state()
2822 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xc); in rtw8822c_gain_less_state()
2824 rtw_write_rf(rtwdev, data->path, RF_MODE_TRXAGC, BIT_RXAGC, 0xf); in rtw8822c_gain_less_state()
2844 rtw_write_rf(rtwdev, data->path, RF_TX_GAIN, BIT_GAIN_TXBB, data->txbb); in rtw8822c_gl_state()
2865 u8 path = data->path; in rtw8822c_loss_check_state() local
2868 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_GAIN_LOSS); in rtw8822c_loss_check_state()
2869 state = rtw8822c_dpk_agc_loss_chk(rtwdev, path); in rtw8822c_loss_check_state()
2880 static u8 rtw8822c_dpk_pas_agc(struct rtw_dev *rtwdev, u8 path, in rtw8822c_dpk_pas_agc() argument
2889 data.path = path; in rtw8822c_dpk_pas_agc()
2935 static void rtw8822c_dpk_coef_tbl_apply(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_coef_tbl_apply() argument
2943 dpk_info->coef[path][i] = rtw8822c_dpk_coef_transfer(rtwdev); in rtw8822c_dpk_coef_tbl_apply()
2947 static void rtw8822c_dpk_get_coef(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_get_coef() argument
2951 if (path == RF_PATH_A) { in rtw8822c_dpk_get_coef()
2954 } else if (path == RF_PATH_B) { in rtw8822c_dpk_get_coef()
2959 rtw8822c_dpk_coef_tbl_apply(rtwdev, path); in rtw8822c_dpk_get_coef()
2962 static u8 rtw8822c_dpk_coef_read(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_coef_read() argument
2969 coef_i = FIELD_GET(0x1fff0000, dpk_info->coef[path][addr]); in rtw8822c_dpk_coef_read()
2970 coef_q = FIELD_GET(0x1fff, dpk_info->coef[path][addr]); in rtw8822c_dpk_coef_read()
2980 static void rtw8822c_dpk_coef_write(struct rtw_dev *rtwdev, u8 path, u8 result) in rtw8822c_dpk_coef_write() argument
2997 coef = dpk_info->coef[path][addr]; in rtw8822c_dpk_coef_write()
2999 rtw_write32(rtwdev, reg[path] + addr * 4, coef); in rtw8822c_dpk_coef_write()
3004 u8 path, u8 result) in rtw8822c_dpk_fill_result() argument
3008 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_fill_result()
3015 dpk_info->result[path] = result; in rtw8822c_dpk_fill_result()
3016 dpk_info->dpk_txagc[path] = rtw_read8(rtwdev, REG_DPD_AGC); in rtw8822c_dpk_fill_result()
3018 rtw8822c_dpk_coef_write(rtwdev, path, result); in rtw8822c_dpk_fill_result()
3021 static u32 rtw8822c_dpk_gainloss(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_gainloss() argument
3026 ori_txbb = rtw8822c_dpk_rf_setting(rtwdev, path); in rtw8822c_dpk_gainloss()
3027 ori_txagc = (u8)rtw_read_rf(rtwdev, path, RF_MODE_TRXAGC, BIT_TXAGC); in rtw8822c_dpk_gainloss()
3029 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_dpk_gainloss()
3030 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_gainloss()
3031 rtw8822c_dpk_dgain_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3033 if (rtw8822c_dpk_dc_corr_check(rtwdev, path)) { in rtw8822c_dpk_gainloss()
3034 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_dpk_gainloss()
3035 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DAGC); in rtw8822c_dpk_gainloss()
3036 rtw8822c_dpk_dc_corr_check(rtwdev, path); in rtw8822c_dpk_gainloss()
3039 t1 = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3040 tx_bb = rtw8822c_dpk_pas_agc(rtwdev, path, false, true); in rtw8822c_dpk_gainloss()
3041 tx_agc_search = rtw8822c_dpk_gainloss_result(rtwdev, path); in rtw8822c_dpk_gainloss()
3048 rtw_write_rf(rtwdev, path, RF_TX_GAIN, BIT_GAIN_TXBB, tx_bb); in rtw8822c_dpk_gainloss()
3052 t2 = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_gainloss()
3054 dpk_info->thermal_dpk_delta[path] = abs(t2 - t1); in rtw8822c_dpk_gainloss()
3059 static u8 rtw8822c_dpk_by_path(struct rtw_dev *rtwdev, u32 tx_agc, u8 path) in rtw8822c_dpk_by_path() argument
3063 result = rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DO_DPK); in rtw8822c_dpk_by_path()
3065 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_by_path()
3069 rtw_write_rf(rtwdev, path, RF_MODE_TRXAGC, RFREG_MASK, 0x33e14); in rtw8822c_dpk_by_path()
3071 rtw8822c_dpk_get_coef(rtwdev, path); in rtw8822c_dpk_by_path()
3076 static void rtw8822c_dpk_cal_gs(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_cal_gs() argument
3081 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_cal_gs()
3089 if (path == RF_PATH_A) { in rtw8822c_dpk_cal_gs()
3106 0x05020000 | (BIT(path) << 28)); in rtw8822c_dpk_cal_gs()
3114 0x05020008 | (BIT(path) << 28)); in rtw8822c_dpk_cal_gs()
3117 rtw_write32_mask(rtwdev, REG_DPD_CTL0, MASKBYTE3, 0x8 | path); in rtw8822c_dpk_cal_gs()
3119 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_CAL_PWR); in rtw8822c_dpk_cal_gs()
3122 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_cal_gs()
3127 if (path == RF_PATH_A) in rtw8822c_dpk_cal_gs()
3138 if (path == RF_PATH_A) in rtw8822c_dpk_cal_gs()
3143 dpk_info->dpk_gs[path] = tmp_gs; in rtw8822c_dpk_cal_gs()
3151 u8 path; in rtw8822c_dpk_cal_coef1() local
3163 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_cal_coef1()
3164 i_scaling = 0x16c00 / dpk_info->dpk_gs[path]; in rtw8822c_dpk_cal_coef1()
3166 rtw_write32_mask(rtwdev, 0x1b18 + offset[path], MASKHWORD, in rtw8822c_dpk_cal_coef1()
3168 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3170 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3172 rtw_write32_mask(rtwdev, REG_DPD_CTL0_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3174 rtw_write32_mask(rtwdev, REG_DPD_CTL1_S0 + offset[path], in rtw8822c_dpk_cal_coef1()
3179 static void rtw8822c_dpk_on(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_on() argument
3183 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DPK_ON); in rtw8822c_dpk_on()
3185 rtw_write32_mask(rtwdev, REG_NCTL0, BIT_SUBPAGE, 0x8 | (path << 1)); in rtw8822c_dpk_on()
3188 if (test_bit(path, dpk_info->dpk_path_ok)) in rtw8822c_dpk_on()
3189 rtw8822c_dpk_cal_gs(rtwdev, path); in rtw8822c_dpk_on()
3193 u32 dpk_txagc, u8 path) in rtw8822c_dpk_check_pass() argument
3198 if (rtw8822c_dpk_coef_read(rtwdev, path)) in rtw8822c_dpk_check_pass()
3206 rtw8822c_dpk_fill_result(rtwdev, dpk_txagc, path, result); in rtw8822c_dpk_check_pass()
3214 u8 path; in rtw8822c_dpk_result_reset() local
3216 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_result_reset()
3217 clear_bit(path, dpk_info->dpk_path_ok); in rtw8822c_dpk_result_reset()
3219 0x8 | (path << 1)); in rtw8822c_dpk_result_reset()
3222 dpk_info->dpk_txagc[path] = 0; in rtw8822c_dpk_result_reset()
3223 dpk_info->result[path] = 0; in rtw8822c_dpk_result_reset()
3224 dpk_info->dpk_gs[path] = 0x5b; in rtw8822c_dpk_result_reset()
3225 dpk_info->pre_pwsf[path] = 0; in rtw8822c_dpk_result_reset()
3226 dpk_info->thermal_dpk[path] = rtw8822c_dpk_thermal_read(rtwdev, in rtw8822c_dpk_result_reset()
3227 path); in rtw8822c_dpk_result_reset()
3231 static void rtw8822c_dpk_calibrate(struct rtw_dev *rtwdev, u8 path) in rtw8822c_dpk_calibrate() argument
3237 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] s%d dpk start\n", path); in rtw8822c_dpk_calibrate()
3239 dpk_txagc = rtw8822c_dpk_gainloss(rtwdev, path); in rtw8822c_dpk_calibrate()
3241 dpk_fail = rtw8822c_dpk_by_path(rtwdev, dpk_txagc, path); in rtw8822c_dpk_calibrate()
3243 if (!rtw8822c_dpk_check_pass(rtwdev, dpk_fail, dpk_txagc, path)) in rtw8822c_dpk_calibrate()
3246 rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] s%d dpk finish\n", path); in rtw8822c_dpk_calibrate()
3248 if (dpk_info->result[path]) in rtw8822c_dpk_calibrate()
3249 set_bit(path, dpk_info->dpk_path_ok); in rtw8822c_dpk_calibrate()
3286 u8 path; in rtw8822c_dpk_reload_data() local
3293 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw8822c_dpk_reload_data()
3295 0x8 | (path << 1)); in rtw8822c_dpk_reload_data()
3301 rtw_write8(rtwdev, REG_DPD_AGC, dpk_info->dpk_txagc[path]); in rtw8822c_dpk_reload_data()
3303 rtw8822c_dpk_coef_write(rtwdev, path, in rtw8822c_dpk_reload_data()
3304 test_bit(path, dpk_info->dpk_path_ok)); in rtw8822c_dpk_reload_data()
3306 rtw8822c_dpk_one_shot(rtwdev, path, RTW_DPK_DPK_ON); in rtw8822c_dpk_reload_data()
3310 if (path == RF_PATH_A) in rtw8822c_dpk_reload_data()
3312 dpk_info->dpk_gs[path]); in rtw8822c_dpk_reload_data()
3315 dpk_info->dpk_gs[path]); in rtw8822c_dpk_reload_data()
3350 u8 path; in rtw8822c_do_dpk() local
3359 for (path = RF_PATH_A; path < DPK_RF_PATH_NUM; path++) in rtw8822c_do_dpk()
3360 ewma_thermal_init(&dpk_info->avg_thermal[path]); in rtw8822c_do_dpk()
3376 for (path = 0; path < rtwdev->hal.rf_path_num; path++) in rtw8822c_do_dpk()
3377 rtw8822c_dpk_rxbb_dc_cal(rtwdev, path); in rtw8822c_do_dpk()
3390 u8 path; in rtw8822c_dpk_track() local
3397 for (path = 0; path < DPK_RF_PATH_NUM; path++) { in rtw8822c_dpk_track()
3398 thermal_value[path] = rtw8822c_dpk_thermal_read(rtwdev, path); in rtw8822c_dpk_track()
3399 ewma_thermal_add(&dpk_info->avg_thermal[path], in rtw8822c_dpk_track()
3400 thermal_value[path]); in rtw8822c_dpk_track()
3401 thermal_value[path] = in rtw8822c_dpk_track()
3402 ewma_thermal_read(&dpk_info->avg_thermal[path]); in rtw8822c_dpk_track()
3403 delta_dpk[path] = dpk_info->thermal_dpk[path] - in rtw8822c_dpk_track()
3404 thermal_value[path]; in rtw8822c_dpk_track()
3405 offset[path] = delta_dpk[path] - in rtw8822c_dpk_track()
3406 dpk_info->thermal_dpk_delta[path]; in rtw8822c_dpk_track()
3407 offset[path] &= 0x7f; in rtw8822c_dpk_track()
3409 if (offset[path] != dpk_info->pre_pwsf[path]) { in rtw8822c_dpk_track()
3411 0x8 | (path << 1)); in rtw8822c_dpk_track()
3413 offset[path]); in rtw8822c_dpk_track()
3414 dpk_info->pre_pwsf[path] = offset[path]; in rtw8822c_dpk_track()
3513 static void rtw8822c_pwr_track_stats(struct rtw_dev *rtwdev, u8 path) in rtw8822c_pwr_track_stats() argument
3517 if (rtwdev->efuse.thermal_meter[path] == 0xff) in rtw8822c_pwr_track_stats()
3520 thermal_value = rtw_read_rf(rtwdev, path, RF_T_METER, 0x7e); in rtw8822c_pwr_track_stats()
3521 rtw_phy_pwrtrack_avg(rtwdev, thermal_value, path); in rtw8822c_pwr_track_stats()
3526 u8 path) in rtw8822c_pwr_track_path() argument
3531 delta = rtw_phy_pwrtrack_get_delta(rtwdev, path); in rtw8822c_pwr_track_path()
3532 dm_info->delta_power_index[path] = in rtw8822c_pwr_track_path()
3533 rtw_phy_pwrtrack_get_pwridx(rtwdev, swing_table, path, path, in rtw8822c_pwr_track_path()
3535 rtw8822c_pwrtrack_set(rtwdev, path); in rtw8822c_pwr_track_path()