diff mbox series

[2/3] ASoC: qcom: q6apm: add support for reading firmware name from DT

Message ID 20230628102621.15016-3-srinivas.kandagatla@linaro.org
State New
Headers show
Series ASoC: qcom: get tplg firmware-name from device tree | expand

Commit Message

Srinivas Kandagatla June 28, 2023, 10:26 a.m. UTC
Currently firmware file name is autogenerated based on card name and model number,
however this imposed a restriction of finding firmware in a single firmware path.
Platform specific firmwares are normally located in sub folders of the SoC.

Provide more flexibity by reading firmware-name from DT.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/topology.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index cccc59b570b9..ccb4efc15648 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -1258,16 +1258,16 @@  static struct snd_soc_tplg_ops audioreach_tplg_ops  = {
 
 int audioreach_tplg_init(struct snd_soc_component *component)
 {
-	struct snd_soc_card *card = component->card;
 	struct device *dev = component->dev;
 	const struct firmware *fw;
-	char *tplg_fw_name;
+	const char *tplg_fw_name;
 	int ret;
 
-	/* Inline with Qualcomm UCM configs and linux-firmware path */
-	tplg_fw_name = kasprintf(GFP_KERNEL, "qcom/%s/%s-tplg.bin", card->driver_name, card->name);
-	if (!tplg_fw_name)
-		return -ENOMEM;
+	ret = of_property_read_string(dev->of_node, "firmware-name",  &tplg_fw_name);
+	if (ret < 0) {
+		dev_err(dev, "firmware-name property missing in Device tree\n");
+		return ret;
+	}
 
 	ret = request_firmware(&fw, tplg_fw_name, dev);
 	if (ret < 0) {
@@ -1283,8 +1283,6 @@  int audioreach_tplg_init(struct snd_soc_component *component)
 
 	release_firmware(fw);
 err:
-	kfree(tplg_fw_name);
-
 	return ret;
 }
 EXPORT_SYMBOL_GPL(audioreach_tplg_init);