From: Daniel Baluta <daniel.baluta@oss.nxp.com>
To: alsa-devel@alsa-project.org,
pierre-louis.bossart@linux.intel.com, broonie@kernel.org,
robh+dt@kernel.org, devicetree@vger.kernel.org
Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
perex@perex.cz, tiwai@suse.com, daniel.baluta@gmail.com,
Daniel Baluta <daniel.baluta@nxp.com>
Subject: [PATCH 1/3] ASoC: SOF: Parse fw/tplg filename from DT
Date: Thu, 15 Jul 2021 17:18:00 +0300 [thread overview]
Message-ID: <20210715141802.880911-2-daniel.baluta@oss.nxp.com> (raw)
In-Reply-To: <20210715141802.880911-1-daniel.baluta@oss.nxp.com>
From: Daniel Baluta <daniel.baluta@nxp.com>
Introduce two DT properties in dsp node:
* fw-filename, optional property giving the firmware filename
(if this is missing fw filename is read from board description)
* tplg-filename, mandatory giving the topology filename.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
sound/soc/sof/sof-of-dev.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c
index d1a21edfa05d..770935191823 100644
--- a/sound/soc/sof/sof-of-dev.c
+++ b/sound/soc/sof/sof-of-dev.c
@@ -65,11 +65,28 @@ static void sof_of_probe_complete(struct device *dev)
pm_runtime_put_autosuspend(dev);
}
+int sof_of_parse(struct platform_device *pdev)
+{
+ struct snd_sof_pdata *sof_pdata = platform_get_drvdata(pdev);
+ struct device_node *np = pdev->dev.of_node;
+ int ret;
+
+ /* firmware-name is optional in DT */
+ of_property_read_string(np, "firmware-name", &sof_pdata->fw_filename);
+
+ ret = of_property_read_string(np, "tplg-name", &sof_pdata->tplg_filename);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
static int sof_of_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct sof_dev_desc *desc;
struct snd_sof_pdata *sof_pdata;
+ int ret;
dev_info(&pdev->dev, "DT DSP detected");
@@ -77,6 +94,8 @@ static int sof_of_probe(struct platform_device *pdev)
if (!sof_pdata)
return -ENOMEM;
+ platform_set_drvdata(pdev, sof_pdata);
+
desc = device_get_match_data(dev);
if (!desc)
return -ENODEV;
@@ -94,6 +113,16 @@ static int sof_of_probe(struct platform_device *pdev)
sof_pdata->fw_filename_prefix = sof_pdata->desc->default_fw_path;
sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path;
+ ret = sof_of_parse(pdev);
+ if (ret < 0) {
+ dev_err(dev, "Could not parse SOF OF DSP node\n");
+ return ret;
+ }
+
+ /* use default fw filename if none provided in DT */
+ if (!sof_pdata->fw_filename)
+ sof_pdata->fw_filename = desc->default_fw_filename;
+
/* set callback to be called on successful device probe to enable runtime_pm */
sof_pdata->sof_probe_complete = sof_of_probe_complete;
--
2.27.0
next prev parent reply other threads:[~2021-07-15 14:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 14:17 [PATCH 0/3] Read firmware, tplg and machine driver name from dts node Daniel Baluta
2021-07-15 14:18 ` Daniel Baluta [this message]
2021-07-15 14:39 ` [PATCH 1/3] ASoC: SOF: Parse fw/tplg filename from DT Mark Brown
2021-07-16 14:31 ` Daniel Baluta
2021-07-20 14:54 ` Daniel Baluta
2021-07-20 15:28 ` Pierre-Louis Bossart
2021-07-21 12:59 ` Mark Brown
2021-07-21 13:28 ` Pierre-Louis Bossart
2021-07-21 17:00 ` Mark Brown
2021-07-15 14:18 ` [PATCH 2/3] ASoC: SOF: Introduce machine driver name Daniel Baluta
2021-07-15 14:18 ` [PATCH 3/3] dt-bindings: dsp: fsl: Document newly introduced fsl,properties Daniel Baluta
2021-07-15 14:59 ` Rob Herring
2021-07-16 14:25 ` Daniel Baluta
2021-07-15 15:51 ` Rob Herring
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=20210715141802.880911-2-daniel.baluta@oss.nxp.com \
--to=daniel.baluta@oss.nxp.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=daniel.baluta@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).