drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c- Extension
.c- Size
- 117265 bytes
- Lines
- 4034
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../wifi.h../efuse.h../base.h../regd.h../cam.h../ps.h../pci.hreg.hdef.hphy.hdm.hfw.hled.hhw.h../pwrseqcmd.hpwrseq.h../btcoexist/rtl_btc.h
Detected Declarations
function _rtl8821ae_return_beacon_queue_skbfunction _rtl8821ae_set_bcn_ctrl_regfunction _rtl8821ae_stop_tx_beaconfunction _rtl8821ae_resume_tx_beaconfunction _rtl8821ae_enable_bcn_sub_funcfunction _rtl8821ae_disable_bcn_sub_funcfunction _rtl8821ae_set_fw_clock_onfunction _rtl8821ae_set_fw_clock_offfunction _rtl8821ae_set_fw_ps_rf_onfunction _rtl8821ae_fwlps_leavefunction _rtl8821ae_fwlps_enterfunction _rtl8821ae_download_rsvd_pagefunction rtl8821ae_get_hw_regfunction rtl8821ae_set_hw_regfunction _rtl8821ae_llt_writefunction _rtl8821ae_llt_table_initfunction _rtl8821ae_gen_refresh_led_statefunction _rtl8821ae_init_macfunction _rtl8821ae_hw_configurefunction _rtl8821ae_mdio_readfunction _rtl8821ae_mdio_writefunction _rtl8821ae_dbi_readfunction _rtl8821ae_dbi_writefunction _rtl8821ae_enable_aspm_back_doorfunction rtl8821ae_enable_hw_security_configfunction rtl8821ae_macid_initialize_mediastatusfunction _rtl8821ae_check_pcie_dma_hangfunction _rtl8821ae_reset_pcie_interface_dmafunction _rtl8821ae_get_wakeup_reasonfunction _rtl8821ae_init_trx_desc_hw_addressfunction _rtl8821ae_init_llt_tablefunction _rtl8821ae_dynamic_rqpnfunction _rtl8821ae_simple_initialize_adapterfunction _rtl8821ae_enable_l1offfunction _rtl8821ae_enable_ltrfunction _rtl8821ae_wowlan_initialize_adapterfunction _rtl8812ae_bb8812_config_1tfunction _rtl8821ae_poweroff_adapterfunction rtl8821ae_hw_initfunction _rtl8821ae_read_chip_versionfunction _rtl8821ae_set_media_statusfunction rtl8821ae_set_check_bssidfunction rtl8821ae_set_network_typefunction rtl8821ae_set_qosfunction rtl8821ae_clear_interruptfunction rtl8821ae_enable_interruptfunction rtl8821ae_disable_interruptfunction _rtl8821ae_clear_pci_pme_status
Annotated Snippet
if (rtlhal->fw_clk_change_in_progress) {
while (rtlhal->fw_clk_change_in_progress) {
spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
count++;
udelay(100);
if (count > 1000)
goto change_done;
spin_lock_bh(&rtlpriv->locks.fw_ps_lock);
}
spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
} else {
rtlhal->fw_clk_change_in_progress = false;
spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
goto change_done;
}
}
change_done:
if (IS_IN_LOW_POWER_STATE_8821AE(rtlhal->fw_ps_state)) {
rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_SET_RPWM,
(u8 *)(&rpwm_val));
if (FW_PS_IS_ACK(rpwm_val)) {
isr_regaddr = REG_HISR;
content = rtl_read_dword(rtlpriv, isr_regaddr);
while (!(content & IMR_CPWM) && (count < 500)) {
udelay(50);
count++;
content = rtl_read_dword(rtlpriv, isr_regaddr);
}
if (content & IMR_CPWM) {
rtl_write_word(rtlpriv, isr_regaddr, 0x0100);
rtlhal->fw_ps_state = FW_PS_STATE_RF_ON_8821AE;
rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD,
"Receive CPWM INT!!! Set rtlhal->FwPSState = %X\n",
rtlhal->fw_ps_state);
}
}
spin_lock_bh(&rtlpriv->locks.fw_ps_lock);
rtlhal->fw_clk_change_in_progress = false;
spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
if (b_schedule_timer)
mod_timer(&rtlpriv->works.fw_clockoff_timer,
jiffies + MSECS(10));
} else {
spin_lock_bh(&rtlpriv->locks.fw_ps_lock);
rtlhal->fw_clk_change_in_progress = false;
spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
}
}
static void _rtl8821ae_set_fw_clock_off(struct ieee80211_hw *hw,
u8 rpwm_val)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl8192_tx_ring *ring;
enum rf_pwrstate rtstate;
bool b_schedule_timer = false;
u8 queue;
if (!rtlhal->fw_ready)
return;
if (!rtlpriv->psc.fw_current_inpsmode)
return;
if (!rtlhal->allow_sw_to_change_hwclc)
return;
rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, (u8 *)(&rtstate));
if (rtstate == ERFOFF || rtlpriv->psc.inactive_pwrstate == ERFOFF)
return;
for (queue = 0; queue < RTL_PCI_MAX_TX_QUEUE_COUNT; queue++) {
ring = &rtlpci->tx_ring[queue];
if (skb_queue_len(&ring->queue)) {
b_schedule_timer = true;
break;
}
}
if (b_schedule_timer) {
mod_timer(&rtlpriv->works.fw_clockoff_timer,
jiffies + MSECS(10));
return;
}
if (FW_PS_STATE(rtlhal->fw_ps_state) !=
FW_PS_STATE_RF_OFF_LOW_PWR_8821AE) {
spin_lock_bh(&rtlpriv->locks.fw_ps_lock);
if (!rtlhal->fw_clk_change_in_progress) {
Annotation
- Immediate include surface: `../wifi.h`, `../efuse.h`, `../base.h`, `../regd.h`, `../cam.h`, `../ps.h`, `../pci.h`, `reg.h`.
- Detected declarations: `function _rtl8821ae_return_beacon_queue_skb`, `function _rtl8821ae_set_bcn_ctrl_reg`, `function _rtl8821ae_stop_tx_beacon`, `function _rtl8821ae_resume_tx_beacon`, `function _rtl8821ae_enable_bcn_sub_func`, `function _rtl8821ae_disable_bcn_sub_func`, `function _rtl8821ae_set_fw_clock_on`, `function _rtl8821ae_set_fw_clock_off`, `function _rtl8821ae_set_fw_ps_rf_on`, `function _rtl8821ae_fwlps_leave`.
- 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.