]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath11k: add usecase firmware handling based on device compatible
authorMiaoqing Pan <miaoqing.pan@oss.qualcomm.com>
Wed, 21 Jan 2026 09:50:54 +0000 (17:50 +0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 30 Jan 2026 15:12:37 +0000 (07:12 -0800)
For M.2 WLAN chips, there is no suitable DTS node to specify the
firmware-name property. In addition, assigning firmware for the
M.2 PCIe interface causes chips that do not use usecase specific
firmware to fail. Therefore, abandoning the approach of specifying
firmware in DTS. As an alternative, propose a static lookup table
mapping device compatible to firmware names. Currently, only WCN6855
HW2.1 requires this.

However, support for the firmware-name property is retained to keep
the ABI backwards compatible.

For details on usecase specific firmware, see:
https://lore.kernel.org/all/20250522013444.1301330-3-miaoqing.pan@oss.qualcomm.com/.

Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04685-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1

Fixes: edbbc647c4f3 ("wifi: ath11k: support usercase-specific firmware overrides")
Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20260121095055.3683957-2-miaoqing.pan@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath11k/core.c
drivers/net/wireless/ath/ath11k/core.h

index de84906d1b27dcafc048bd7d2dc0f03b5b8bb4be..3f6f4db5b7ee1aba79fd7526e5d59d068e0f4a2e 100644 (file)
@@ -1044,6 +1044,33 @@ static const struct dmi_system_id ath11k_pm_quirk_table[] = {
        {}
 };
 
+static const struct __ath11k_core_usecase_firmware_table {
+       u32 hw_rev;
+       const char *compatible;
+       const char *firmware_name;
+} ath11k_core_usecase_firmware_table[] = {
+       { ATH11K_HW_WCN6855_HW21, "qcom,lemans-evk", "nfa765"},
+       { ATH11K_HW_WCN6855_HW21, "qcom,monaco-evk", "nfa765"},
+       { ATH11K_HW_WCN6855_HW21, "qcom,hamoa-iot-evk", "nfa765"},
+       { /* Sentinel */ }
+};
+
+const char *ath11k_core_get_usecase_firmware(struct ath11k_base *ab)
+{
+       const struct __ath11k_core_usecase_firmware_table *entry = NULL;
+
+       entry = ath11k_core_usecase_firmware_table;
+       while (entry->compatible) {
+               if (ab->hw_rev == entry->hw_rev &&
+                   of_machine_is_compatible(entry->compatible))
+                       return entry->firmware_name;
+               entry++;
+       }
+
+       return NULL;
+}
+EXPORT_SYMBOL(ath11k_core_get_usecase_firmware);
+
 void ath11k_fw_stats_pdevs_free(struct list_head *head)
 {
        struct ath11k_fw_stats_pdev *i, *tmp;
index 3f41e6569a787adef70149d6af4420d02c9d0aa1..a0d725923ef24d4099f5696e5a9746b5daadb392 100644 (file)
@@ -1292,6 +1292,7 @@ bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab);
 
 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
                                                    const char *filename);
+const char *ath11k_core_get_usecase_firmware(struct ath11k_base *ab);
 
 static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state)
 {
@@ -1346,6 +1347,9 @@ static inline void ath11k_core_create_firmware_path(struct ath11k_base *ab,
 
        of_property_read_string(ab->dev->of_node, "firmware-name", &fw_name);
 
+       if (!fw_name)
+               fw_name = ath11k_core_get_usecase_firmware(ab);
+
        if (fw_name && strncmp(filename, "board", 5))
                snprintf(buf, buf_len, "%s/%s/%s/%s", ATH11K_FW_DIR,
                         ab->hw_params.fw.dir, fw_name, filename);