drivers/net/wireless/ath/ath12k/core.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/core.c- Extension
.c- Size
- 54094 bytes
- Lines
- 2359
- 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.
- 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
linux/export.hlinux/module.hlinux/slab.hlinux/remoteproc.hlinux/firmware.hlinux/of.hlinux/of_graph.hahb.hcore.hdp_tx.hdp_rx.hdebug.hdebugfs.hfw.hhif.hpci.hwow.hdp_cmn.hpeer.h
Detected Declarations
function ath12k_core_rfkill_configfunction ath12k_core_continue_suspend_resumefunction ath12k_core_suspendfunction ath12k_core_suspend_latefunction ath12k_core_resume_earlyfunction ath12k_core_resumefunction __ath12k_core_create_board_namefunction ath12k_core_create_board_namefunction ath12k_core_create_fallback_board_namefunction ath12k_core_create_bus_type_board_namefunction ath12k_core_free_bdffunction ath12k_core_parse_bd_ie_boardfunction ath12k_core_fetch_board_data_api_nfunction ath12k_core_fetch_board_data_api_1function ath12k_core_fetch_bdffunction ath12k_core_fetch_regdbfunction ath12k_core_get_max_station_per_radiofunction ath12k_core_get_max_peers_per_radiofunction ath12k_core_to_group_ref_getfunction ath12k_core_to_group_ref_putfunction ath12k_core_stopfunction ath12k_core_check_cc_code_bdfextfunction ath12k_core_check_smbiosfunction ath12k_core_soc_createfunction ath12k_core_soc_destroyfunction ath12k_core_pdev_createfunction ath12k_core_pdev_destroyfunction ath12k_core_startfunction ath12k_core_device_cleanupfunction ath12k_core_device_setupfunction ath12k_core_hw_group_stopfunction ath12k_get_num_partner_linkfunction __ath12k_mac_mlo_readyfunction ath12k_mac_mlo_readyfunction for_each_arfunction ath12k_core_mlo_setupfunction ath12k_core_hw_group_startfunction ath12k_core_start_firmwarefunction ath12k_core_hw_group_start_readyfunction ath12k_fw_stats_pdevs_freefunction list_for_each_entry_safefunction ath12k_fw_stats_bcn_freefunction list_for_each_entry_safefunction ath12k_fw_stats_vdevs_freefunction list_for_each_entry_safefunction ath12k_fw_stats_initfunction ath12k_fw_stats_freefunction ath12k_fw_stats_reset
Annotated Snippet
if (ret && ret != -EOPNOTSUPP) {
ath12k_warn(ab, "failed to configure rfkill: %d", ret);
return ret;
}
}
return ret;
}
/* Check if we need to continue with suspend/resume operation.
* Return:
* a negative value: error happens and don't continue.
* 0: no error but don't continue.
* positive value: no error and do continue.
*/
static int ath12k_core_continue_suspend_resume(struct ath12k_base *ab)
{
struct ath12k *ar;
if (!ab->hw_params->supports_suspend)
return -EOPNOTSUPP;
/* so far single_pdev_only chips have supports_suspend as true
* so pass 0 as a dummy pdev_id here.
*/
ar = ab->pdevs[0].ar;
if (!ar || !ar->ah || ar->ah->state != ATH12K_HW_STATE_OFF)
return 0;
return 1;
}
int ath12k_core_suspend(struct ath12k_base *ab)
{
struct ath12k *ar;
int ret, i;
ret = ath12k_core_continue_suspend_resume(ab);
if (ret <= 0)
return ret;
for (i = 0; i < ab->num_radios; i++) {
ar = ab->pdevs[i].ar;
if (!ar)
continue;
wiphy_lock(ath12k_ar_to_hw(ar)->wiphy);
ret = ath12k_mac_wait_tx_complete(ar);
if (ret) {
wiphy_unlock(ath12k_ar_to_hw(ar)->wiphy);
ath12k_warn(ab, "failed to wait tx complete: %d\n", ret);
return ret;
}
wiphy_unlock(ath12k_ar_to_hw(ar)->wiphy);
}
/* PM framework skips suspend_late/resume_early callbacks
* if other devices report errors in their suspend callbacks.
* However ath12k_core_resume() would still be called because
* here we return success thus kernel put us on dpm_suspended_list.
* Since we won't go through a power down/up cycle, there is
* no chance to call complete(&ab->restart_completed) in
* ath12k_core_restart(), making ath12k_core_resume() timeout.
* So call it here to avoid this issue. This also works in case
* no error happens thus suspend_late/resume_early get called,
* because it will be reinitialized in ath12k_core_resume_early().
*/
complete(&ab->restart_completed);
return 0;
}
EXPORT_SYMBOL(ath12k_core_suspend);
int ath12k_core_suspend_late(struct ath12k_base *ab)
{
int ret;
ret = ath12k_core_continue_suspend_resume(ab);
if (ret <= 0)
return ret;
ath12k_acpi_stop(ab);
ath12k_hif_irq_disable(ab);
ath12k_hif_ce_irq_disable(ab);
ath12k_hif_power_down(ab, true);
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/slab.h`, `linux/remoteproc.h`, `linux/firmware.h`, `linux/of.h`, `linux/of_graph.h`, `ahb.h`.
- Detected declarations: `function ath12k_core_rfkill_config`, `function ath12k_core_continue_suspend_resume`, `function ath12k_core_suspend`, `function ath12k_core_suspend_late`, `function ath12k_core_resume_early`, `function ath12k_core_resume`, `function __ath12k_core_create_board_name`, `function ath12k_core_create_board_name`, `function ath12k_core_create_fallback_board_name`, `function ath12k_core_create_bus_type_board_name`.
- 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.