Split the ath12k driver into two kernel modules:
- ath12k.ko for shared logic across multiple targets
- ath12k_wifi7.ko for Wi-Fi 7 specific configuration and routines
The common module (ath12k.ko) must be loaded prior to any device-specific
module, as the latter depends on exported symbols from the former.
As part of this restructuring, Wi-Fi 7 specific files are moved into a
dedicated `wifi7/` directory and built as a separate module. Common
symbols are exported accordingly, with further adjustments planned
in upcoming patches to support architecture-dependent separation.
This modularization improves maintainability and scalability by enabling
clean separation of hardware-specific logic from the shared driver core.
+-----------------+
| |
| ath12k.ko |
| (common) |
+---------------+ | |
| | +-----------------+
| ath12k.ko | ===========>
| | +------------------+
+---------------+ | |
| ath12k_wifi7.ko |
| (wifi7 family) |
| |
+------------------+
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1
Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250812-ath12k-mod-v1-10-8c9b0eb9335d@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
# SPDX-License-Identifier: BSD-3-Clause-Clear
obj-$(CONFIG_ATH12K) += ath12k.o
ath12k-y += core.o \
- core_wifi7.o \
hal.o \
hal_tx.o \
hal_rx.o \
wmi.o \
- wmi_wifi7.o \
mac.o \
reg.o \
htc.o \
dp_rx.o \
debug.o \
ce.o \
- ce_wifi7.o \
peer.o \
dbring.o \
- hw_wifi7.o \
mhi.o \
- mhi_wifi7.o \
pci.o \
- pci_wifi7.o \
dp_mon.o \
fw.o \
p2p.o
-ath12k-$(CONFIG_ATH12K_AHB) += ahb.o ahb_wifi7.o
+ath12k-$(CONFIG_ATH12K_AHB) += ahb.o
+
+obj-$(CONFIG_ATH12K) += wifi7/
+
ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o
ath12k-$(CONFIG_ACPI) += acpi.o
ath12k-$(CONFIG_ATH12K_TRACING) += trace.o
return platform_driver_register(ahb_driver);
}
+EXPORT_SYMBOL(ath12k_ahb_register_driver);
void ath12k_ahb_unregister_driver(const enum ath12k_device_family device_id)
{
platform_driver_unregister(ahb_driver);
ath12k_ahb_family_drivers[device_id] = NULL;
}
+EXPORT_SYMBOL(ath12k_ahb_unregister_driver);
{
return ath12k_core_get_max_station_per_radio(ab) + TARGET_NUM_VDEVS(ab);
}
+EXPORT_SYMBOL(ath12k_core_get_max_peers_per_radio);
struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab,
int index)
return ATH12K_QMI_MEMORY_MODE_DEFAULT;
}
+EXPORT_SYMBOL(ath12k_core_get_memory_mode);
int ath12k_core_pre_init(struct ath12k_base *ab)
{
kfree(ab);
return NULL;
}
+
+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies WLAN devices");
+MODULE_LICENSE("Dual BSD/GPL");
/* TODO: Trace the log */
va_end(args);
}
+EXPORT_SYMBOL(ath12k_info);
void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
{
/* TODO: Trace the log */
va_end(args);
}
+EXPORT_SYMBOL(ath12k_err);
void __ath12k_warn(struct device *dev, const char *fmt, ...)
{
/* TODO: Trace the log */
va_end(args);
}
+EXPORT_SYMBOL(__ath12k_warn);
#ifdef CONFIG_ATH12K_DEBUG
va_end(args);
}
+EXPORT_SYMBOL(__ath12k_dbg);
void ath12k_dbg_dump(struct ath12k_base *ab,
enum ath12k_debug_mask mask,
dev_kfree_skb_any(skb);
}
+EXPORT_SYMBOL(ath12k_dp_htt_htc_t2h_msg_handler);
static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
struct sk_buff_head *msdu_list,
return ret;
}
+EXPORT_SYMBOL(ath12k_dp_rxdma_ring_sel_config_qcn9274);
int ath12k_dp_rxdma_ring_sel_config_wcn7850(struct ath12k_base *ab)
{
return ret;
}
+EXPORT_SYMBOL(ath12k_dp_rxdma_ring_sel_config_wcn7850);
int ath12k_dp_rx_htt_setup(struct ath12k_base *ab)
{
.rx_desc_get_desc_size = ath12k_hw_qcn9274_get_rx_desc_size,
.rx_desc_get_msdu_src_link_id = ath12k_hw_qcn9274_rx_desc_get_msdu_src_link,
};
+EXPORT_SYMBOL(hal_rx_qcn9274_ops);
static bool ath12k_hw_qcn9274_compact_rx_desc_get_first_msdu(struct hal_rx_desc *desc)
{
.rxdma_ring_wmask_rx_msdu_end = ath12k_hal_qcn9274_rx_msdu_end_wmask_get,
.get_hal_rx_compact_ops = ath12k_hal_qcn9274_get_hal_rx_compact_ops,
};
+EXPORT_SYMBOL(hal_qcn9274_ops);
static bool ath12k_hw_wcn7850_rx_desc_get_first_msdu(struct hal_rx_desc *desc)
{
.rx_desc_get_desc_size = ath12k_hw_wcn7850_get_rx_desc_size,
.rx_desc_get_msdu_src_link_id = ath12k_hw_wcn7850_rx_desc_get_msdu_src_link,
};
+EXPORT_SYMBOL(hal_rx_wcn7850_ops);
const struct hal_ops hal_wcn7850_ops = {
.create_srng_config = ath12k_hal_srng_create_config_wcn7850,
.rxdma_ring_wmask_rx_msdu_end = NULL,
.get_hal_rx_compact_ops = NULL,
};
+EXPORT_SYMBOL(hal_wcn7850_ops);
static int ath12k_hal_alloc_cont_rdp(struct ath12k_base *ab)
{
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#include <linux/skbuff.h>
#include <linux/ctype.h>
out:
kfree_skb(skb);
}
+EXPORT_SYMBOL(ath12k_htc_rx_completion_handler);
static void ath12k_htc_control_rx_complete(struct ath12k_base *ab,
struct sk_buff *skb)
ab_pci->pci_ops->release(ab);
return val;
}
+EXPORT_SYMBOL(ath12k_pci_read32);
void ath12k_pci_write32(struct ath12k_base *ab, u32 offset, u32 value)
{
return pci_register_driver(pci_driver);
}
+EXPORT_SYMBOL(ath12k_pci_register_driver);
void ath12k_pci_unregister_driver(const enum ath12k_device_family device_id)
{
pci_unregister_driver(&ath12k_pci_family_drivers[device_id]->driver);
ath12k_pci_family_drivers[device_id] = NULL;
}
+EXPORT_SYMBOL(ath12k_pci_unregister_driver);
return NULL;
}
+EXPORT_SYMBOL(ath12k_peer_ml_find);
struct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id,
const u8 *addr)
return NULL;
}
+EXPORT_SYMBOL(ath12k_peer_find_by_addr);
static struct ath12k_peer *ath12k_peer_find_by_ml_id(struct ath12k_base *ab,
int ml_peer_id)
--- /dev/null
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+obj-$(CONFIG_ATH12K) += ath12k_wifi7.o
+ath12k_wifi7-y += core.o \
+ pci.o \
+ wmi.o \
+ mhi.o \
+ ce.o \
+ hw.o
+
+ath12k_wifi7-$(CONFIG_ATH12K_AHB) += ahb.o
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/soc/qcom/mdt_loader.h>
+#include "../ahb.h"
#include "ahb.h"
-#include "ahb_wifi7.h"
-#include "debug.h"
-#include "hif.h"
-#include "hw_wifi7.h"
+#include "../debug.h"
+#include "../hif.h"
+#include "hw.h"
static const struct of_device_id ath12k_wifi7_ahb_of_match[] = {
{ .compatible = "qcom,ipq5332-wifi",
#include <linux/bitops.h>
#include <linux/bitfield.h>
-#include "core.h"
+#include "../core.h"
+#include "../ce.h"
#include "ce.h"
-#include "ce_wifi7.h"
-#include "dp_rx.h"
+#include "../dp_rx.h"
/* Copy Engine (CE) configs for QCN9274 */
/* Target firmware's Copy Engine configuration. */
*/
#include <linux/module.h>
-#include "ahb.h"
+#include "../ahb.h"
+#include "../pci.h"
#include "pci.h"
-#include "pci_wifi7.h"
-#include "ahb_wifi7.h"
+#include "ahb.h"
static int ahb_err, pci_err;
#include <linux/bitops.h>
#include <linux/bitfield.h>
-#include "debug.h"
-#include "core.h"
+#include "../debug.h"
+#include "../core.h"
+#include "../ce.h"
#include "ce.h"
-#include "ce_wifi7.h"
+#include "../hw.h"
#include "hw.h"
-#include "hw_wifi7.h"
+#include "../mhi.h"
#include "mhi.h"
-#include "dp_rx.h"
-#include "peer.h"
-#include "wmi_wifi7.h"
-#include "mhi_wifi7.h"
+#include "../dp_rx.h"
+#include "../peer.h"
+#include "wmi.h"
static const guid_t wcn7850_uuid = GUID_INIT(0xf634f534, 0x6147, 0x11ec,
0x90, 0xd6, 0x02, 0x42,
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
+#include "../mhi.h"
#include "mhi.h"
-#include "mhi_wifi7.h"
static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
{
#include <linux/pci.h>
+#include "../pci.h"
#include "pci.h"
-#include "pci_wifi7.h"
-#include "core.h"
-#include "hif.h"
-#include "mhi.h"
-#include "hw_wifi7.h"
+#include "../core.h"
+#include "../hif.h"
+#include "../mhi.h"
+#include "hw.h"
#define QCN9274_DEVICE_ID 0x1109
#define WCN7850_DEVICE_ID 0x1107
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
-#include "core.h"
-#include "wmi_wifi7.h"
+#include "../core.h"
+#include "wmi.h"
void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
struct ath12k_wmi_resource_config_arg *config)