drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c- Extension
.c- Size
- 123029 bytes
- Lines
- 3785
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
coex.hdebug.hmac.hphy.hreg.hrtw8851b.hrtw8851b_rfk.hrtw8851b_rfk_table.hrtw8851b_table.h
Detected Declarations
enum dpk_idenum dpk_agc_stepenum rtw8851b_iqk_typeenum rf_modeenum adc_ckenum dac_ckfunction _kpathfunction _adc_fifo_rstfunction _rfk_rf_direct_cntrlfunction _rfk_drf_direct_cntrlfunction _txck_forcefunction _rxck_forcefunction _wait_rx_modefunction _dack_resetfunction _drckfunction _addck_backupfunction _addck_reloadfunction _dack_backup_s0function _dack_reload_by_pathfunction _dack_reloadfunction _addckfunction _new_dadckfunction _dack_s0_pollfunction _dack_s0function _dackfunction _dack_dumpfunction _dack_manual_offfunction _dac_calfunction _rx_dck_infofunction _rxbb_ofst_swapfunction _set_rx_dckfunction _rx_dckfunction _iqk_sramfunction _iqk_rxk_settingfunction _iqk_check_calfunction _iqk_one_shotfunction _rxk_2g_group_selfunction _rxk_5g_group_selfunction _iqk_5g_nbrxkfunction _iqk_2g_nbrxkfunction _iqk_rxclk_settingfunction _txk_5g_group_selfunction _txk_2g_group_selfunction _iqk_5g_nbtxkfunction _iqk_2g_nbtxkfunction _iqk_2g_lokfunction _iqk_5g_lokfunction _iqk_txk_setting
Annotated Snippet
switch (step) {
case DPK_AGC_STEP_SYNC_DGAIN:
is_fail = _dpk_kip_set_rxagc(rtwdev, phy, path, kidx);
if (is_fail) {
goout = 1;
break;
}
dgain = _dpk_dgain_read(rtwdev);
if (dgain > 0x5fc || dgain < 0x556) {
_dpk_one_shot(rtwdev, phy, path, D_SYNC);
_dpk_dgain_read(rtwdev);
}
if (agc_cnt == 0) {
if (dpk->bp[path][kidx].band == RTW89_BAND_2G)
_dpk_bypass_rxiqc(rtwdev, path);
else
_dpk_lbk_rxiqk(rtwdev, phy, path);
}
step = DPK_AGC_STEP_GAIN_LOSS_IDX;
break;
case DPK_AGC_STEP_GAIN_LOSS_IDX:
tmp_gl_idx = _dpk_gainloss(rtwdev, phy, path, kidx);
if (_dpk_pas_read(rtwdev, true) == 2 && tmp_gl_idx > 0)
step = DPK_AGC_STEP_GL_LT_CRITERION;
else if ((tmp_gl_idx == 0 && _dpk_pas_read(rtwdev, true) == 1) ||
tmp_gl_idx >= 7)
step = DPK_AGC_STEP_GL_GT_CRITERION;
else if (tmp_gl_idx == 0)
step = DPK_AGC_STEP_GL_LT_CRITERION;
else
step = DPK_AGC_STEP_SET_TX_GAIN;
break;
case DPK_AGC_STEP_GL_GT_CRITERION:
if (tmp_dbm <= 7) {
goout = 1;
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[DPK] Txagc@lower bound!!\n");
} else {
tmp_dbm = max_t(u8, tmp_dbm - 3, 7);
_dpk_kip_set_txagc(rtwdev, phy, path, tmp_dbm, true);
}
step = DPK_AGC_STEP_SYNC_DGAIN;
agc_cnt++;
break;
case DPK_AGC_STEP_GL_LT_CRITERION:
if (tmp_dbm >= 24) {
goout = 1;
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[DPK] Txagc@upper bound!!\n");
} else {
tmp_dbm = min_t(u8, tmp_dbm + 2, 24);
_dpk_kip_set_txagc(rtwdev, phy, path, tmp_dbm, true);
}
step = DPK_AGC_STEP_SYNC_DGAIN;
agc_cnt++;
break;
case DPK_AGC_STEP_SET_TX_GAIN:
_dpk_kip_control_rfc(rtwdev, path, false);
tmp_rxbb = rtw89_read_rf(rtwdev, path, RR_MOD, RR_MOD_RXB);
tmp_rxbb = min_t(u8, tmp_rxbb + tmp_gl_idx, 0x1f);
rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_RXB, tmp_rxbb);
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[DPK] Adjust RXBB (%+d) = 0x%x\n",
tmp_gl_idx, tmp_rxbb);
_dpk_kip_control_rfc(rtwdev, path, true);
goout = 1;
break;
default:
goout = 1;
break;
}
} while (!goout && agc_cnt < 6 && limit-- > 0);
return is_fail;
}
static void _dpk_set_mdpd_para(struct rtw89_dev *rtwdev, u8 order)
{
switch (order) {
Annotation
- Immediate include surface: `coex.h`, `debug.h`, `mac.h`, `phy.h`, `reg.h`, `rtw8851b.h`, `rtw8851b_rfk.h`, `rtw8851b_rfk_table.h`.
- Detected declarations: `enum dpk_id`, `enum dpk_agc_step`, `enum rtw8851b_iqk_type`, `enum rf_mode`, `enum adc_ck`, `enum dac_ck`, `function _kpath`, `function _adc_fifo_rst`, `function _rfk_rf_direct_cntrl`, `function _rfk_drf_direct_cntrl`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.