drivers/net/wireless/realtek/rtw88/wow.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw88/wow.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw88/wow.c- Extension
.c- Size
- 22268 bytes
- Lines
- 914
- 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.
- 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
main.hfw.hwow.hreg.hdebug.hmac.hps.h
Detected Declarations
function rtw_wow_show_wakeup_reasonfunction rtw_wow_pattern_write_camfunction rtw_wow_pattern_write_cam_entfunction __rtw_cal_crc16function rtw_calc_crcfunction rtw_wow_pattern_generatefunction rtw_wow_pattern_clear_camfunction rtw_wow_pattern_writefunction rtw_wow_pattern_clearfunction rtw_wow_bb_stopfunction rtw_wow_bb_startfunction rtw_wow_rx_dma_stopfunction rtw_wow_rx_dma_startfunction rtw_wow_check_fw_statusfunction rtw_wow_fw_security_type_iterfunction rtw_wow_fw_security_typefunction rtw_wow_fw_startfunction rtw_wow_fw_stopfunction rtw_wow_avoid_reset_macfunction rtw_wow_fw_media_status_iterfunction rtw_wow_fw_media_statusfunction rtw_wow_config_wow_fw_rsvd_pagefunction rtw_wow_config_normal_fw_rsvd_pagefunction rtw_wow_swap_fwfunction rtw_wow_check_pnofunction rtw_wow_leave_linked_psfunction rtw_wow_leave_no_link_psfunction rtw_wow_leave_psfunction rtw_wow_restore_psfunction rtw_wow_enter_linked_psfunction rtw_wow_enter_no_link_psfunction rtw_wow_enter_psfunction rtw_wow_stop_trxfunction rtw_wow_startfunction rtw_wow_enablefunction rtw_wow_stopfunction rtw_wow_resume_trxfunction rtw_wow_disablefunction rtw_wow_vif_iterfunction rtw_wow_set_wakeupsfunction rtw_wow_clear_wakeupsfunction rtw_wow_suspendfunction rtw_wow_resume
Annotated Snippet
if ((mask[i / 8] >> (i % 8)) & 0x01) {
content[count] = pattern[i];
count++;
}
}
rtw_pattern->crc = rtw_calc_crc(content, count);
}
static void rtw_wow_pattern_clear_cam(struct rtw_dev *rtwdev)
{
bool ret;
rtw_write32(rtwdev, REG_WKFMCAM_CMD, BIT_WKFCAM_POLLING_V1 |
BIT_WKFCAM_CLR_V1);
ret = check_hw_ready(rtwdev, REG_WKFMCAM_CMD, BIT_WKFCAM_POLLING_V1, 0);
if (!ret)
rtw_err(rtwdev, "failed to clean pattern cam\n");
}
static void rtw_wow_pattern_write(struct rtw_dev *rtwdev)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
struct rtw_wow_pattern *rtw_pattern = rtw_wow->patterns;
int i = 0;
for (i = 0; i < rtw_wow->pattern_cnt; i++)
rtw_wow_pattern_write_cam_ent(rtwdev, i, rtw_pattern + i);
}
static void rtw_wow_pattern_clear(struct rtw_dev *rtwdev)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
rtw_wow_pattern_clear_cam(rtwdev);
rtw_wow->pattern_cnt = 0;
memset(rtw_wow->patterns, 0, sizeof(rtw_wow->patterns));
}
static void rtw_wow_bb_stop(struct rtw_dev *rtwdev)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
/* wait 100ms for firmware to finish TX */
msleep(100);
if (!rtw_read32_mask(rtwdev, REG_BCNQ_INFO, BIT_MGQ_CPU_EMPTY))
rtw_warn(rtwdev, "Wrong status of MGQ_CPU empty!\n");
rtw_wow->txpause = rtw_read8(rtwdev, REG_TXPAUSE);
rtw_write8(rtwdev, REG_TXPAUSE, 0xff);
rtw_write8_clr(rtwdev, REG_SYS_FUNC_EN, BIT_FEN_BB_RSTB);
}
static void rtw_wow_bb_start(struct rtw_dev *rtwdev)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, BIT_FEN_BB_RSTB);
rtw_write8(rtwdev, REG_TXPAUSE, rtw_wow->txpause);
}
static void rtw_wow_rx_dma_stop(struct rtw_dev *rtwdev)
{
/* wait 100ms for HW to finish rx dma */
msleep(100);
rtw_write32_set(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE);
if (!check_hw_ready(rtwdev, REG_RXPKT_NUM, BIT_RXDMA_IDLE, 1))
rtw_err(rtwdev, "failed to stop rx dma\n");
}
static void rtw_wow_rx_dma_start(struct rtw_dev *rtwdev)
{
rtw_write32_clr(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE);
}
static int rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable)
{
int ret;
u8 check;
u32 check_dis;
if (wow_enable) {
ret = read_poll_timeout(rtw_read8, check, !check, 1000,
100000, true, rtwdev,
REG_WOWLAN_WAKE_REASON);
Annotation
- Immediate include surface: `main.h`, `fw.h`, `wow.h`, `reg.h`, `debug.h`, `mac.h`, `ps.h`.
- Detected declarations: `function rtw_wow_show_wakeup_reason`, `function rtw_wow_pattern_write_cam`, `function rtw_wow_pattern_write_cam_ent`, `function __rtw_cal_crc16`, `function rtw_calc_crc`, `function rtw_wow_pattern_generate`, `function rtw_wow_pattern_clear_cam`, `function rtw_wow_pattern_write`, `function rtw_wow_pattern_clear`, `function rtw_wow_bb_stop`.
- 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.