All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, wcn36xx@lists.infradead.org,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
Date: Thu, 11 Mar 2021 16:33:17 -0800	[thread overview]
Message-ID: <20210312003318.3273536-5-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20210312003318.3273536-1-bjorn.andersson@linaro.org>

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.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/wcnss_ctrl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index 358526b9de06..2a06d631e415 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -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;
@@ -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;
 	}
 
-- 
2.29.2


  parent reply	other threads:[~2021-03-12  0:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
2021-03-22 21:00   ` Anibal Limon
2021-03-24 15:21   ` Rob Herring
2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
2021-03-15 11:58   ` Bryan O'Donoghue
2021-03-22 21:01   ` Anibal Limon
2021-03-12  0:33 ` [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev" Bjorn Andersson
2021-03-22 21:01   ` Anibal Limon
2021-03-12  0:33 ` Bjorn Andersson [this message]
2021-03-15 11:57   ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bryan O'Donoghue
2021-03-22 21:02   ` Anibal Limon
2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
2021-03-15 11:57   ` Bryan O'Donoghue
2021-03-15 12:01   ` Bryan O'Donoghue
2021-03-18 14:50     ` Bjorn Andersson
2021-03-19 14:41       ` Bryan O'Donoghue
2021-03-19 15:19   ` Stephan Gerhold
2021-03-22 21:03     ` Anibal Limon
2021-05-31 16:33     ` Bjorn Andersson
2021-03-18 16:48 ` [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Vinod Koul
2021-03-18 16:56 ` Jeffrey Hugo
2021-03-18 17:06   ` Bjorn Andersson
2021-03-18 18:12     ` Jeffrey Hugo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312003318.3273536-5-bjorn.andersson@linaro.org \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=wcn36xx@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.