Skip to content

Commit

Permalink
soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
Browse files Browse the repository at this point in the history
The WLAN NV firmware blob differs between platforms, and possibly
devices, so add support in the wcnss_ctrl 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).

The new property is optional and the code falls back to the old filename
if the property isn't specified.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
Link: https://lore.kernel.org/r/20210312003318.3273536-5-bjorn.andersson@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
andersson committed Apr 6, 2021
1 parent ac3f278 commit 82ec0c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/soc/qcom/wcnss_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
struct wcnss_download_nv_req *req;
const struct firmware *fw;
struct device *dev = wcnss->dev;
const char *nvbin = NVBIN_FILE;
const void *data;
ssize_t left;
int ret;
Expand All @@ -208,10 +209,13 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
if (!req)
return -ENOMEM;

ret = request_firmware(&fw, NVBIN_FILE, dev);
ret = of_property_read_string(dev->of_node, "firmware-name", &nvbin);
if (ret < 0 && ret != -EINVAL)
goto free_req;

ret = request_firmware(&fw, nvbin, dev);
if (ret < 0) {
dev_err(dev, "Failed to load nv file %s: %d\n",
NVBIN_FILE, ret);
dev_err(dev, "Failed to load nv file %s: %d\n", nvbin, ret);
goto free_req;
}

Expand Down

0 comments on commit 82ec0c2

Please sign in to comment.