drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c- Extension
.c- Size
- 145496 bytes
- Lines
- 4788
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../wifi.h../pci.h../ps.hreg.hdef.hphy.hrf.hdm.htable.htrx.h../btcoexist/halbt_precomp.hhw.h../efuse.h
Detected Declarations
function rtl8812ae_fixspurfunction rtl8821ae_phy_query_bb_regfunction rtl8821ae_phy_set_bb_regfunction rtl8821ae_phy_query_rf_regfunction rtl8821ae_phy_set_rf_regfunction _rtl8821ae_phy_rf_serial_readfunction _rtl8821ae_phy_rf_serial_writefunction rtl8821ae_phy_mac_configfunction rtl8821ae_phy_bb_configfunction rtl8821ae_phy_rf_configfunction _rtl8812ae_phy_set_rfe_reg_24gfunction _rtl8812ae_phy_set_rfe_reg_5gfunction phy_get_tx_swing_8812Afunction rtl8821ae_phy_switch_wirelessbandfunction _rtl8821ae_check_positivefunction _rtl8821ae_check_conditionfunction _rtl8821ae_config_rf_regfunction _rtl8821ae_config_rf_radio_afunction _rtl8821ae_config_rf_radio_bfunction _rtl8821ae_config_bb_regfunction _rtl8821ae_phy_init_tx_power_by_ratefunction _rtl8821ae_phy_set_txpower_by_rate_basefunction _rtl8821ae_phy_get_txpower_by_rate_basefunction _rtl8821ae_phy_store_txpower_by_rate_basefunction _phy_convert_txpower_dbm_to_relative_valuefunction _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limitfunction _rtl8812ae_phy_get_txpower_by_rate_base_indexfunction _rtl8812ae_phy_convert_txpower_limit_to_power_indexfunction _rtl8821ae_phy_init_txpower_limitfunction _rtl8821ae_phy_convert_txpower_dbm_to_relative_valuefunction _rtl8821ae_phy_txpower_by_rate_configurationfunction _rtl8812ae_get_integer_from_stringfunction _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmtfunction _rtl8812ae_phy_set_txpower_limitfunction _rtl8812ae_phy_config_bb_txpwr_lmtfunction _rtl8821ae_phy_read_and_config_txpwr_lmtfunction _rtl8821ae_phy_bb8821a_config_parafilefunction __rtl8821ae_phy_config_with_headerfilefunction _rtl8821ae_phy_config_mac_with_headerfilefunction _rtl8821ae_phy_config_bb_with_headerfilefunction _rtl8821ae_get_rate_section_indexfunction _rtl8821ae_store_tx_power_by_ratefunction _rtl8821ae_phy_config_bb_with_pgheaderfilefunction rtl8812ae_phy_config_rf_with_headerfilefunction rtl8821ae_phy_config_rf_with_headerfilefunction rtl8821ae_phy_get_hw_reg_originalvaluefunction phy_init_bb_rf_register_definitionfunction rtl8821ae_phy_get_txpower_level
Annotated Snippet
if (rtlpriv->btcoexist.bt_coexistence) {
rtl_set_bbreg(hw, RA_RFE_PINMUX, 0xffffff, 0x777777);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD,
0x77777777);
rtl_set_bbreg(hw, RA_RFE_INV, 0x33f00000, 0x000);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x000);
break;
}
fallthrough;
case 0:
case 2:
default:
rtl_set_bbreg(hw, RA_RFE_PINMUX, BMASKDWORD, 0x77777777);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD, 0x77777777);
rtl_set_bbreg(hw, RA_RFE_INV, BMASKRFEINV, 0x000);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x000);
break;
}
}
static void _rtl8812ae_phy_set_rfe_reg_5g(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
u8 tmp;
switch (rtlhal->rfe_type) {
case 0:
rtl_set_bbreg(hw, RA_RFE_PINMUX, BMASKDWORD, 0x77337717);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD, 0x77337717);
rtl_set_bbreg(hw, RA_RFE_INV, BMASKRFEINV, 0x010);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x010);
break;
case 1:
if (rtlpriv->btcoexist.bt_coexistence) {
rtl_set_bbreg(hw, RA_RFE_PINMUX, 0xffffff, 0x337717);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD,
0x77337717);
rtl_set_bbreg(hw, RA_RFE_INV, 0x33f00000, 0x000);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x000);
} else {
rtl_set_bbreg(hw, RA_RFE_PINMUX, BMASKDWORD,
0x77337717);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD,
0x77337717);
rtl_set_bbreg(hw, RA_RFE_INV, BMASKRFEINV, 0x000);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x000);
}
break;
case 3:
rtl_set_bbreg(hw, RA_RFE_PINMUX, BMASKDWORD, 0x54337717);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD, 0x54337717);
rtl_set_bbreg(hw, RA_RFE_INV, BMASKRFEINV, 0x010);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x010);
rtl_set_bbreg(hw, 0x900, 0x00000303, 0x1);
break;
case 5:
rtl_write_byte(rtlpriv, RA_RFE_PINMUX + 2, 0x33);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD, 0x77337777);
tmp = rtl_read_byte(rtlpriv, RA_RFE_INV + 3);
rtl_write_byte(rtlpriv, RA_RFE_INV + 3, tmp | 0x1);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x010);
break;
case 2:
case 4:
default:
rtl_set_bbreg(hw, RA_RFE_PINMUX, BMASKDWORD, 0x77337777);
rtl_set_bbreg(hw, RB_RFE_PINMUX, BMASKDWORD, 0x77337777);
rtl_set_bbreg(hw, RA_RFE_INV, BMASKRFEINV, 0x010);
rtl_set_bbreg(hw, RB_RFE_INV, BMASKRFEINV, 0x010);
break;
}
}
u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8 band,
u8 rf_path)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_dm *rtldm = rtl_dm(rtlpriv);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
s8 reg_swing_2g = -1;/* 0xff; */
s8 reg_swing_5g = -1;/* 0xff; */
s8 swing_2g = -1 * reg_swing_2g;
s8 swing_5g = -1 * reg_swing_5g;
u32 out = 0x200;
const s8 auto_temp = -1;
rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD,
"===> PHY_GetTXBBSwing_8812A, bbSwing_2G: %d, bbSwing_5G: %d,autoload_failflag=%d.\n",
Annotation
- Immediate include surface: `../wifi.h`, `../pci.h`, `../ps.h`, `reg.h`, `def.h`, `phy.h`, `rf.h`, `dm.h`.
- Detected declarations: `function rtl8812ae_fixspur`, `function rtl8821ae_phy_query_bb_reg`, `function rtl8821ae_phy_set_bb_reg`, `function rtl8821ae_phy_query_rf_reg`, `function rtl8821ae_phy_set_rf_reg`, `function _rtl8821ae_phy_rf_serial_read`, `function _rtl8821ae_phy_rf_serial_write`, `function rtl8821ae_phy_mac_config`, `function rtl8821ae_phy_bb_config`, `function rtl8821ae_phy_rf_config`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.