wcn36xx: Allow firmware name to be overridden by DT
authorBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 24 Aug 2021 17:12:25 +0000 (10:12 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Sun, 29 Aug 2021 07:11:13 +0000 (10:11 +0300)
The WLAN NV firmware blob differs between platforms, and possibly
devices, so add support in the wcn36xx driver for reading the path of
this file from DT in order to allow these files to live in a generic
file system (or linux-firmware).

For some reason the parent (wcnss_ctrl) also needs to upload this blob,
so rather than specifying the same information in both nodes wcn36xx
reads the string from the parent's of_node.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210824171225.686683-1-bjorn.andersson@linaro.org
drivers/net/wireless/ath/wcn36xx/main.c
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/ath/wcn36xx/wcn36xx.h

index 67f4db662402be29cb406450629398afbbd198b6..ec913ec991f3ff706afdc6ce6c9b45d3fdc9372e 100644 (file)
@@ -1503,6 +1503,13 @@ static int wcn36xx_probe(struct platform_device *pdev)
                goto out_wq;
        }
 
+       wcn->nv_file = WLAN_NV_FILE;
+       ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
+       if (ret < 0 && ret != -EINVAL) {
+               wcn36xx_err("failed to read \"firmware-name\" property: %d\n", ret);
+               goto out_wq;
+       }
+
        wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
        if (IS_ERR(wcn->smd_channel)) {
                wcn36xx_err("failed to open WLAN_CTRL channel\n");
index 0e3be17d8ceafe2274f58f2ddaf2df457ee0a4d0..57fa857b290b79a86fc8ffe0e46d52c052bc34c2 100644 (file)
@@ -504,10 +504,10 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
        u16 fm_offset = 0;
 
        if (!wcn->nv) {
-               ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev);
+               ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev);
                if (ret) {
                        wcn36xx_err("Failed to load nv file %s: %d\n",
-                                     WLAN_NV_FILE, ret);
+                                   wcn->nv_file, ret);
                        goto out;
                }
        }
index 0feb235b5a426b0aec9b6fcfde809c3a4691377e..add6e527e83306eaa1a841c3b7c793f5289b692b 100644 (file)
@@ -199,6 +199,7 @@ struct wcn36xx {
        struct device           *dev;
        struct list_head        vif_list;
 
+       const char              *nv_file;
        const struct firmware   *nv;
 
        u8                      fw_revision;