linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/3] ASoC: SOF: Introduce machine driver name
Date: Thu, 15 Jul 2021 17:18:01 +0300	[thread overview]
Message-ID: <20210715141802.880911-3-daniel.baluta@oss.nxp.com> (raw)
In-Reply-To: <20210715141802.880911-1-daniel.baluta@oss.nxp.com>

From: Daniel Baluta <daniel.baluta@nxp.com>

ACPI creates tables with information about the machine driver.
With DT there is no need for such tables because we can directly
get all the information needed from DT file.

This patch introduces machine driver property inside dsp node.

Notice that sof_pdata->machine_drv_name is the OF equivalent of
sof_pdata->machine (snd_soc_acpi_mach). We don't need more
information than machine_drv_name for OF platforms (for now).

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 include/sound/sof.h        | 1 +
 sound/soc/sof/pcm.c        | 5 ++++-
 sound/soc/sof/sof-audio.c  | 2 +-
 sound/soc/sof/sof-of-dev.c | 5 +++++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/sound/sof.h b/include/sound/sof.h
index 23b374311d16..191607945432 100644
--- a/include/sound/sof.h
+++ b/include/sound/sof.h
@@ -51,6 +51,7 @@ struct snd_sof_pdata {
 	/* machine */
 	struct platform_device *pdev_mach;
 	const struct snd_soc_acpi_mach *machine;
+	const char *machine_drv_name; /* machine driver name, set only for OF case */
 
 	void *hw_pdata;
 };
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 27244dc043ce..47def9240e7c 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -885,7 +885,10 @@ void snd_sof_new_platform_drv(struct snd_sof_dev *sdev)
 	struct snd_sof_pdata *plat_data = sdev->pdata;
 	const char *drv_name;
 
-	drv_name = plat_data->machine->drv_name;
+	if (plat_data->machine)
+		drv_name = plat_data->machine->drv_name;
+	else
+		drv_name = plat_data->machine_drv_name;
 
 	pd->name = "sof-audio-component";
 	pd->probe = sof_pcm_probe;
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index 10aa0d8ea186..aebfa5150fa1 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -884,7 +884,7 @@ int sof_machine_check(struct snd_sof_dev *sdev)
 
 		/* find machine */
 		snd_sof_machine_select(sdev);
-		if (sof_pdata->machine) {
+		if (sof_pdata->machine || sof_pdata->machine_drv_name) {
 			snd_sof_set_mach_params(sof_pdata->machine, sdev);
 			return 0;
 		}
diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c
index 770935191823..18bfe5b78966 100644
--- a/sound/soc/sof/sof-of-dev.c
+++ b/sound/soc/sof/sof-of-dev.c
@@ -78,6 +78,11 @@ int sof_of_parse(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
+	ret = of_property_read_string(np, "machine-drv-name",
+				      &sof_pdata->machine_drv_name);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
-- 
2.27.0


  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 ` [PATCH 1/3] ASoC: SOF: Parse fw/tplg filename from DT Daniel Baluta
2021-07-15 14:39   ` 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 ` Daniel Baluta [this message]
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-3-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).