drivers/net/wireless/realtek/rtw88/rtw8821a.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw88/rtw8821a.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw88/rtw8821a.c- Extension
.c- Size
- 36647 bytes
- Lines
- 1232
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
main.hcoex.hphy.hreg.hrtw88xxa.hrtw8821a.hrtw8821a_table.htx.h
Detected Declarations
function rtw8821a_power_offfunction rtw8821a_cck_rx_pwrfunction rtw8821a_query_phy_statusfunction rtw8821a_cfg_ldo25function rtw8821a_iqk_restore_rffunction rtw8821a_iqk_restore_afefunction rtw8821a_iqk_rx_fillfunction rtw8821a_iqk_tx_fillfunction rtw8821a_iqk_tx_vdf_truefunction rtw8821a_iqk_tx_vdf_falsefunction rtw8821a_iqk_rxfunction rtw8821a_iqkfunction rtw8821a_do_iqkfunction rtw8821a_phy_calibrationfunction rtw8821a_pwr_trackfunction rtw8821a_led_setfunction rtw8821a_fill_txdesc_checksumfunction rtw8821a_coex_cfg_initfunction rtw8821a_coex_cfg_ant_switchfunction rtw8821a_coex_cfg_gnt_fixfunction rtw8821a_coex_cfg_wl_tx_powerfunction rtw8821a_coex_cfg_wl_rx_gainexport rtw8821a_hw_spec
Annotated Snippet
switch (k) {
case 0:
/* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */
rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE,
0x18008c38);
/* RX_Tone_idx[9:0], RxK_Mask[29] */
rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c38);
rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x0);
break;
case 1:
rtw_write32_mask(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE,
BIT(28), 0x0);
rtw_write32_mask(rtwdev, REG_OFDM0_A_TX_AFE,
BIT(28), 0x0);
rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x0);
break;
case 2:
rtw_dbg(rtwdev, RTW_DBG_RFK,
"vdf_y[1] = %x vdf_y[0] = %x\n",
vdf_y[1] >> 21 & 0x00007ff,
vdf_y[0] >> 21 & 0x00007ff);
rtw_dbg(rtwdev, RTW_DBG_RFK,
"vdf_x[1] = %x vdf_x[0] = %x\n",
vdf_x[1] >> 21 & 0x00007ff,
vdf_x[0] >> 21 & 0x00007ff);
tx_dt[cal] = (vdf_y[1] >> 20) - (vdf_y[0] >> 20);
tx_dt[cal] = (16 * tx_dt[cal]) * 10000 / 15708;
tx_dt[cal] = (tx_dt[cal] >> 1) + (tx_dt[cal] & BIT(0));
/* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */
rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE,
0x18008c20);
/* RX_Tone_idx[9:0], RxK_Mask[29] */
rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c20);
rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x1);
rtw_write32_mask(rtwdev, REG_INTPO_SETA, 0x3fff0000,
tx_dt[cal] & 0x00003fff);
break;
}
rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000);
for (cal_retry = 0; cal_retry < 10; cal_retry++) {
/* one shot */
rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000);
rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000);
mdelay(10);
rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000);
for (delay_count = 0; delay_count < 20; delay_count++) {
iqk_ready = rtw_read32_mask(rtwdev,
REG_IQKA_END,
BIT(10));
/* Originally: if (~iqk_ready || delay_count > 20)
* that looks like a typo so make it more explicit
*/
iqk_ready = true;
if (iqk_ready)
break;
mdelay(1);
}
if (delay_count < 20) {
/* ============TXIQK Check============== */
tx_fail = rtw_read32_mask(rtwdev,
REG_IQKA_END,
BIT(12));
/* Originally: if (~tx_fail) {
* It looks like a typo, so make it more explicit.
*/
tx_fail = false;
if (!tx_fail) {
rtw_write32(rtwdev, REG_RFECTL_A,
0x02000000);
vdf_x[k] = rtw_read32_mask(rtwdev,
REG_IQKA_END,
0x07ff0000);
vdf_x[k] <<= 21;
rtw_write32(rtwdev, REG_RFECTL_A,
0x04000000);
Annotation
- Immediate include surface: `main.h`, `coex.h`, `phy.h`, `reg.h`, `rtw88xxa.h`, `rtw8821a.h`, `rtw8821a_table.h`, `tx.h`.
- Detected declarations: `function rtw8821a_power_off`, `function rtw8821a_cck_rx_pwr`, `function rtw8821a_query_phy_status`, `function rtw8821a_cfg_ldo25`, `function rtw8821a_iqk_restore_rf`, `function rtw8821a_iqk_restore_afe`, `function rtw8821a_iqk_rx_fill`, `function rtw8821a_iqk_tx_fill`, `function rtw8821a_iqk_tx_vdf_true`, `function rtw8821a_iqk_tx_vdf_false`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.