Lines Matching refs:dig
3818 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_read_gain_table() local
3828 gain_arr = dig->lna_gain_g; in rtw89_phy_dig_read_gain_table()
3834 gain_arr = dig->tia_gain_g; in rtw89_phy_dig_read_gain_table()
3840 gain_arr = dig->lna_gain_a; in rtw89_phy_dig_read_gain_table()
3846 gain_arr = dig->tia_gain_a; in rtw89_phy_dig_read_gain_table()
3869 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_update_gain_para() local
3878 dig->ib_pkpwr = sign_extend32(tmp >> DIG_GAIN_SHIFT, U8_MAX_BIT); in rtw89_phy_dig_update_gain_para()
3879 dig->ib_pbk = rtw89_phy_read32_mask(rtwdev, R_PATH0_IB_PBK, in rtw89_phy_dig_update_gain_para()
3882 dig->ib_pkpwr, dig->ib_pbk); in rtw89_phy_dig_update_gain_para()
3897 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_update_rssi_info() local
3901 dig->igi_rssi = ch_info->rssi_min >> 1; in rtw89_phy_dig_update_rssi_info()
3904 dig->igi_rssi = rssi_nolink; in rtw89_phy_dig_update_rssi_info()
3910 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_update_para() local
3917 dig->lna_gain = dig->lna_gain_g; in rtw89_phy_dig_update_para()
3918 dig->tia_gain = dig->tia_gain_g; in rtw89_phy_dig_update_para()
3920 dig->force_gaincode_idx_en = false; in rtw89_phy_dig_update_para()
3921 dig->dyn_pd_th_en = true; in rtw89_phy_dig_update_para()
3925 dig->lna_gain = dig->lna_gain_a; in rtw89_phy_dig_update_para()
3926 dig->tia_gain = dig->tia_gain_a; in rtw89_phy_dig_update_para()
3928 dig->force_gaincode_idx_en = true; in rtw89_phy_dig_update_para()
3929 dig->dyn_pd_th_en = true; in rtw89_phy_dig_update_para()
3932 memcpy(dig->fa_th, fa_th_src, sizeof(dig->fa_th)); in rtw89_phy_dig_update_para()
3933 memcpy(dig->igi_rssi_th, igi_rssi_th, sizeof(dig->igi_rssi_th)); in rtw89_phy_dig_update_para()
3942 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_para_reset() local
3944 dig->cur_gaincode.lna_idx = LNA_IDX_MAX; in rtw89_phy_dig_para_reset()
3945 dig->cur_gaincode.tia_idx = TIA_IDX_MAX; in rtw89_phy_dig_para_reset()
3946 dig->cur_gaincode.rxb_idx = RXB_IDX_MAX; in rtw89_phy_dig_para_reset()
3947 dig->force_gaincode.lna_idx = LNA_IDX_MAX; in rtw89_phy_dig_para_reset()
3948 dig->force_gaincode.tia_idx = TIA_IDX_MAX; in rtw89_phy_dig_para_reset()
3949 dig->force_gaincode.rxb_idx = RXB_IDX_MAX; in rtw89_phy_dig_para_reset()
3951 dig->dyn_igi_max = igi_max_performance_mode; in rtw89_phy_dig_para_reset()
3952 dig->dyn_igi_min = dynamic_igi_min; in rtw89_phy_dig_para_reset()
3953 dig->dyn_pd_th_max = dynamic_pd_threshold_max; in rtw89_phy_dig_para_reset()
3954 dig->pd_low_th_ofst = pd_low_th_offset; in rtw89_phy_dig_para_reset()
3955 dig->is_linked_pre = false; in rtw89_phy_dig_para_reset()
3966 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_lna_idx_by_rssi() local
3969 if (rssi < dig->igi_rssi_th[0]) in rtw89_phy_dig_lna_idx_by_rssi()
3971 else if (rssi < dig->igi_rssi_th[1]) in rtw89_phy_dig_lna_idx_by_rssi()
3973 else if (rssi < dig->igi_rssi_th[2]) in rtw89_phy_dig_lna_idx_by_rssi()
3975 else if (rssi < dig->igi_rssi_th[3]) in rtw89_phy_dig_lna_idx_by_rssi()
3977 else if (rssi < dig->igi_rssi_th[4]) in rtw89_phy_dig_lna_idx_by_rssi()
3987 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_tia_idx_by_rssi() local
3990 if (rssi < dig->igi_rssi_th[0]) in rtw89_phy_dig_tia_idx_by_rssi()
4003 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_rxb_idx_by_rssi() local
4004 s8 lna_gain = dig->lna_gain[set->lna_idx]; in rtw89_phy_dig_rxb_idx_by_rssi()
4005 s8 tia_gain = dig->tia_gain[set->tia_idx]; in rtw89_phy_dig_rxb_idx_by_rssi()
4010 rxb_idx_tmp += dig->ib_pkpwr - dig->ib_pbk - wb_rssi; in rtw89_phy_dig_rxb_idx_by_rssi()
4035 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_igi_offset_by_env() local
4038 u8 igi_offset = dig->fa_rssi_ofst; in rtw89_phy_dig_igi_offset_by_env()
4043 if (fa_ratio < dig->fa_th[0]) in rtw89_phy_dig_igi_offset_by_env()
4045 else if (fa_ratio < dig->fa_th[1]) in rtw89_phy_dig_igi_offset_by_env()
4047 else if (fa_ratio < dig->fa_th[2]) in rtw89_phy_dig_igi_offset_by_env()
4049 else if (fa_ratio < dig->fa_th[3]) in rtw89_phy_dig_igi_offset_by_env()
4060 dig->fa_rssi_ofst = igi_offset; in rtw89_phy_dig_igi_offset_by_env()
4064 dig->fa_th[3], dig->fa_th[2], dig->fa_th[1], dig->fa_th[0]); in rtw89_phy_dig_igi_offset_by_env()
4133 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_config_igi() local
4138 if (dig->force_gaincode_idx_en) { in rtw89_phy_dig_config_igi()
4139 rtw89_phy_dig_set_igi_cr(rtwdev, dig->force_gaincode); in rtw89_phy_dig_config_igi()
4143 rtw89_phy_dig_gaincode_by_rssi(rtwdev, dig->igi_fa_rssi, in rtw89_phy_dig_config_igi()
4144 &dig->cur_gaincode); in rtw89_phy_dig_config_igi()
4145 rtw89_phy_dig_set_igi_cr(rtwdev, dig->cur_gaincode); in rtw89_phy_dig_config_igi()
4155 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_dyn_pd_th() local
4156 u8 final_rssi = 0, under_region = dig->pd_low_th_ofst; in rtw89_phy_dig_dyn_pd_th()
4180 dig->dyn_pd_th_max = dig->igi_rssi; in rtw89_phy_dig_dyn_pd_th()
4182 final_rssi = min_t(u8, rssi, dig->igi_rssi); in rtw89_phy_dig_dyn_pd_th()
4219 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig_reset() local
4221 dig->bypass_dig = false; in rtw89_phy_dig_reset()
4223 rtw89_phy_dig_set_igi_cr(rtwdev, dig->force_gaincode); in rtw89_phy_dig_reset()
4232 struct rtw89_dig_info *dig = &rtwdev->dig; in rtw89_phy_dig() local
4235 if (unlikely(dig->bypass_dig)) { in rtw89_phy_dig()
4236 dig->bypass_dig = false; in rtw89_phy_dig()
4240 if (!dig->is_linked_pre && is_linked) { in rtw89_phy_dig()
4243 } else if (dig->is_linked_pre && !is_linked) { in rtw89_phy_dig()
4247 dig->is_linked_pre = is_linked; in rtw89_phy_dig()
4252 dig->dyn_igi_min = (dig->igi_rssi > IGI_RSSI_MIN) ? in rtw89_phy_dig()
4253 dig->igi_rssi - IGI_RSSI_MIN : 0; in rtw89_phy_dig()
4254 dig->dyn_igi_max = dig->dyn_igi_min + IGI_OFFSET_MAX; in rtw89_phy_dig()
4255 dig->igi_fa_rssi = dig->dyn_igi_min + dig->fa_rssi_ofst; in rtw89_phy_dig()
4257 dig->igi_fa_rssi = clamp(dig->igi_fa_rssi, dig->dyn_igi_min, in rtw89_phy_dig()
4258 dig->dyn_igi_max); in rtw89_phy_dig()
4262 dig->igi_rssi, dig->dyn_igi_max, dig->dyn_igi_min, in rtw89_phy_dig()
4263 dig->igi_fa_rssi); in rtw89_phy_dig()
4267 rtw89_phy_dig_dyn_pd_th(rtwdev, dig->igi_fa_rssi, dig->dyn_pd_th_en); in rtw89_phy_dig()
4269 if (dig->dyn_pd_th_en && dig->igi_fa_rssi > dig->dyn_pd_th_max) in rtw89_phy_dig()