All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.intel.com,
	ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
	yung-chuan.liao@linux.intel.com, rander.wang@intel.com
Subject: [PATCH 06/11] ASoC: SOF: ipc4-topology: Always parse the output formats in topology
Date: Mon, 13 Mar 2023 14:48:51 +0200	[thread overview]
Message-ID: <20230313124856.8140-7-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20230313124856.8140-1-peter.ujfalusi@linux.intel.com>

From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

Parse the output formats available in topology always. Whether the
output format is sent in the init instance payload or not is decided
when sof_ipc4_init_audio_fmt() is invoked.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/ipc4-topology.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index b6933fa1a36d..0e1e4fc9224c 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -171,15 +171,13 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
  * @swidget: pointer to struct snd_sof_widget containing tuples
  * @available_fmt: pointer to struct sof_ipc4_available_audio_format being filling in
  * @module_base_cfg: Pointer to the base_config in the module init IPC payload
- * @has_out_format: true if available_fmt contains output format
  *
  * Return: 0 if successful
  */
 static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  struct snd_sof_widget *swidget,
 				  struct sof_ipc4_available_audio_format *available_fmt,
-				  struct sof_ipc4_base_module_cfg *module_base_cfg,
-				  bool has_out_format)
+				  struct sof_ipc4_base_module_cfg *module_base_cfg)
 {
 	struct sof_ipc4_base_module_cfg *base_config;
 	struct sof_ipc4_audio_format *out_format, *in_format;
@@ -249,9 +247,6 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  sizeof(struct sof_ipc4_audio_format),
 				  available_fmt->audio_fmt_num);
 
-	if (!has_out_format)
-		return 0;
-
 	out_format = kcalloc(available_fmt->audio_fmt_num, sizeof(*out_format), GFP_KERNEL);
 	if (!out_format) {
 		ret = -ENOMEM;
@@ -362,7 +357,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
-				     &ipc4_copier->data.base_config, true);
+				     &ipc4_copier->data.base_config);
 	if (ret)
 		goto free_copier;
 
@@ -461,7 +456,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
-				     &ipc4_copier->data.base_config, true);
+				     &ipc4_copier->data.base_config);
 	if (ret)
 		goto free_copier;
 
@@ -668,9 +663,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
 	gain->data.channels = SOF_IPC4_GAIN_ALL_CHANNELS_MASK;
 	gain->data.init_val = SOF_IPC4_VOL_ZERO_DB;
 
-	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, &gain->base_config,
-				     false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, &gain->base_config);
 	if (ret)
 		goto err;
 
@@ -735,9 +728,8 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
 
 	swidget->private = mixer;
 
-	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &mixer->available_fmt,
-				     &mixer->base_config, false);
+				     &mixer->base_config);
 	if (ret)
 		goto err;
 
@@ -767,9 +759,7 @@ static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
 
 	swidget->private = src;
 
-	/* The out_audio_fmt in topology is ignored as it is not required by SRC */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, &src->base_config,
-				     false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, &src->base_config);
 	if (ret)
 		goto err;
 
-- 
2.39.2


  parent reply	other threads:[~2023-03-13 12:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 12:48 [PATCH 00/11] ASoC: SOF: ipc4: Add support for formats per pins Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 01/11] ASoC: SOF: rename a couple of tokens Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 02/11] ASoC: SOF: Use input/output pin consistently Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 03/11] ASoC: SOF: ipc4-topology: Add a new field in struct sof_ipc4_available_audio_format Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 04/11] ASoC: SOF: ipc4-topology: Do not parse the DMA_BUFFER_SIZE token Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 05/11] ASoC: SOF: ipc4-topology: Parse the SOF_COMP_TOKENS only once Peter Ujfalusi
2023-03-13 12:48 ` Peter Ujfalusi [this message]
2023-03-13 12:48 ` [PATCH 07/11] ASoC: SOF: ipc4-topology: Modify the type of available input/output formats Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 08/11] ASoC: SOF: ipc4-topology: Modify the signature of sof_ipc4_init_audio_fmt() Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 09/11] ASoC: SOF: ipc4-topology: Remove the ref_audio_fmt field Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 10/11] ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format count Peter Ujfalusi
2023-03-13 12:48 ` [PATCH 11/11] ASoC: SOF: ipc4-topology: Search only pin 0 formats Peter Ujfalusi
2023-03-14 15:12 ` [PATCH 00/11] ASoC: SOF: ipc4: Add support for formats per pins Mark Brown

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=20230313124856.8140-7-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.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 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.