drivers/net/wireless/realtek/rtlwifi/ps.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/ps.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/ps.c- Extension
.c- Size
- 25719 bytes
- Lines
- 984
- 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.
- 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.hbase.hps.hlinux/export.hbtcoexist/rtl_btc.h
Detected Declarations
function rtl_ps_enable_nicfunction rtl_ps_disable_nicfunction rtl_ps_set_rf_statefunction _rtl_ps_inactive_psfunction rtl_ips_nic_off_wq_callbackfunction rtl_ips_nic_offfunction rtl_ips_nic_onfunction rtl_get_fwlps_dozefunction rtl_lps_set_psmodefunction rtl_lps_enter_corefunction rtl_lps_leave_corefunction rtl_swlps_beaconfunction rtl_swlps_rf_awakefunction rtl_swlps_rfon_wq_callbackfunction rtl_swlps_rf_sleepfunction MAX_SW_LPS_SLEEP_INTVfunction rtl_lps_change_work_callbackfunction rtl_lps_enterfunction rtl_lps_leavefunction rtl_swlps_wq_callbackfunction rtl_p2p_noa_iefunction rtl_p2p_action_iefunction rtl_p2p_ps_cmdfunction rtl_p2p_infoexport rtl_ps_enable_nicexport rtl_ps_disable_nicexport rtl_ips_nic_onexport rtl_swlps_beaconexport rtl_lps_change_work_callbackexport rtl_lps_enterexport rtl_lps_leaveexport rtl_p2p_info
Annotated Snippet
if (ppsc->rfchange_inprogress) {
spin_unlock(&rtlpriv->locks.rf_ps_lock);
rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING,
"RF Change in progress! Wait to set..state_toset(%d).\n",
state_toset);
/* Set RF after the previous action is done. */
while (ppsc->rfchange_inprogress) {
rfwait_cnt++;
mdelay(1);
/*Wait too long, return false to avoid
*to be stuck here.
*/
if (rfwait_cnt > 100)
return false;
}
} else {
ppsc->rfchange_inprogress = true;
spin_unlock(&rtlpriv->locks.rf_ps_lock);
break;
}
}
switch (state_toset) {
case ERFON:
ppsc->rfoff_reason &= (~changesource);
if ((changesource == RF_CHANGE_BY_HW) &&
(ppsc->hwradiooff)) {
ppsc->hwradiooff = false;
}
if (!ppsc->rfoff_reason) {
ppsc->rfoff_reason = 0;
actionallowed = true;
}
break;
case ERFOFF:
if ((changesource == RF_CHANGE_BY_HW) && !ppsc->hwradiooff) {
ppsc->hwradiooff = true;
}
ppsc->rfoff_reason |= changesource;
actionallowed = true;
break;
case ERFSLEEP:
ppsc->rfoff_reason |= changesource;
actionallowed = true;
break;
default:
pr_err("switch case %#x not processed\n", state_toset);
break;
}
if (actionallowed)
rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset);
spin_lock(&rtlpriv->locks.rf_ps_lock);
ppsc->rfchange_inprogress = false;
spin_unlock(&rtlpriv->locks.rf_ps_lock);
return actionallowed;
}
static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
ppsc->swrf_processing = true;
if (ppsc->inactive_pwrstate == ERFON &&
rtlhal->interface == INTF_PCI) {
if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) &&
RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
rtlpriv->intf_ops->disable_aspm(hw);
RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
}
}
rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate,
RF_CHANGE_BY_IPS);
Annotation
- Immediate include surface: `wifi.h`, `base.h`, `ps.h`, `linux/export.h`, `btcoexist/rtl_btc.h`.
- Detected declarations: `function rtl_ps_enable_nic`, `function rtl_ps_disable_nic`, `function rtl_ps_set_rf_state`, `function _rtl_ps_inactive_ps`, `function rtl_ips_nic_off_wq_callback`, `function rtl_ips_nic_off`, `function rtl_ips_nic_on`, `function rtl_get_fwlps_doze`, `function rtl_lps_set_psmode`, `function rtl_lps_enter_core`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.