All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: =tiwai@suse.com,
	"Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	broonie@kernel.org, "Bard Liao" <yung-chuan.liao@linux.intel.com>
Subject: [PATCH 18/18] ASoC: SOF: topology: remove snd_sof_complete_pipeline()
Date: Mon, 14 Mar 2022 13:05:20 -0700	[thread overview]
Message-ID: <20220314200520.1233427-20-ranjani.sridharan@linux.intel.com> (raw)
In-Reply-To: <20220314200520.1233427-1-ranjani.sridharan@linux.intel.com>

Add a new topology IPC op, pipeline_complete in struct ipc_tplg_ops
and set the op for IPC3. Replace the calls to
snd_sof_complete_pipeline() with the calls to the topology IPC
pipeline_complete op.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.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>
---
 sound/soc/sof/ipc3-topology.c | 23 +++++++++++++++++++++++
 sound/soc/sof/sof-audio.c     | 18 ++++++++++++------
 sound/soc/sof/sof-audio.h     |  4 ++--
 sound/soc/sof/topology.c      | 23 -----------------------
 4 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c
index ea1311192877..fe1d5a56080a 100644
--- a/sound/soc/sof/ipc3-topology.c
+++ b/sound/soc/sof/ipc3-topology.c
@@ -1887,6 +1887,28 @@ static int sof_ipc3_widget_bind_event(struct snd_soc_component *scomp,
 	return -EINVAL;
 }
 
+static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
+{
+	struct sof_ipc_pipe_ready ready;
+	struct sof_ipc_reply reply;
+	int ret;
+
+	dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
+		swidget->widget->name, swidget->comp_id);
+
+	memset(&ready, 0, sizeof(ready));
+	ready.hdr.size = sizeof(ready);
+	ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
+	ready.comp_id = swidget->comp_id;
+
+	ret = sof_ipc_tx_message(sdev->ipc, ready.hdr.cmd, &ready, sizeof(ready), &reply,
+				 sizeof(reply));
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
 /* token list for each topology object */
 static enum sof_tokens host_token_list[] = {
 	SOF_CORE_TOKENS,
@@ -1988,6 +2010,7 @@ static const struct sof_ipc_tplg_ops ipc3_tplg_ops = {
 	.route_setup = sof_ipc3_route_setup,
 	.control_setup = sof_ipc3_control_setup,
 	.control_free = sof_ipc3_control_free,
+	.pipeline_complete = sof_ipc3_complete_pipeline,
 	.token_list = ipc3_token_list,
 };
 
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index c02dcad03b23..683c290bb69a 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -362,6 +362,7 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev,
 
 int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir)
 {
+	const struct sof_ipc_tplg_ops *ipc_tplg_ops = sdev->ipc->ops->tplg;
 	struct snd_soc_dapm_widget_list *list = spcm->stream[dir].list;
 	struct snd_soc_dapm_widget *widget;
 	int i, ret, num_widgets;
@@ -432,10 +433,12 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, in
 		if (pipe_widget->complete)
 			continue;
 
-		pipe_widget->complete = snd_sof_complete_pipeline(sdev, pipe_widget);
-		if (pipe_widget->complete < 0) {
-			ret = pipe_widget->complete;
-			goto widget_free;
+		if (ipc_tplg_ops->pipeline_complete) {
+			pipe_widget->complete = ipc_tplg_ops->pipeline_complete(sdev, pipe_widget);
+			if (pipe_widget->complete < 0) {
+				ret = pipe_widget->complete;
+				goto widget_free;
+			}
 		}
 	}
 
@@ -657,8 +660,11 @@ int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify)
 					return ret;
 			}
 
-			swidget->complete =
-				snd_sof_complete_pipeline(sdev, swidget);
+			if (ipc_tplg_ops->pipeline_complete) {
+				swidget->complete = ipc_tplg_ops->pipeline_complete(sdev, swidget);
+				if (swidget->complete < 0)
+					return swidget->complete;
+			}
 			break;
 		default:
 			break;
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index a14b872ea261..622d43707b27 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -68,6 +68,7 @@ struct sof_ipc_tplg_widget_ops {
  *		initialized to 0.
  * @control_setup: Function pointer for setting up kcontrol IPC-specific data
  * @control_free: Function pointer for freeing kcontrol IPC-specific data
+ * @pipeline_complete: Function pointer for pipeline complete IPC
  */
 struct sof_ipc_tplg_ops {
 	const struct sof_ipc_tplg_widget_ops *widget;
@@ -75,6 +76,7 @@ struct sof_ipc_tplg_ops {
 	const struct sof_token_info *token_list;
 	int (*control_setup)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
 	int (*control_free)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
+	int (*pipeline_complete)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
 };
 
 /** struct snd_sof_tuple - Tuple info
@@ -318,8 +320,6 @@ void snd_sof_control_notify(struct snd_sof_dev *sdev,
  * be freed by snd_soc_unregister_component,
  */
 int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file);
-int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
-			      struct snd_sof_widget *swidget);
 
 /*
  * Stream IPC
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 70677a36c304..367fbe2d5b31 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1825,29 +1825,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
 	return ret;
 }
 
-int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
-			      struct snd_sof_widget *swidget)
-{
-	struct sof_ipc_pipe_ready ready;
-	struct sof_ipc_reply reply;
-	int ret;
-
-	dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
-		swidget->widget->name, swidget->comp_id);
-
-	memset(&ready, 0, sizeof(ready));
-	ready.hdr.size = sizeof(ready);
-	ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
-	ready.comp_id = swidget->comp_id;
-
-	ret = sof_ipc_tx_message(sdev->ipc,
-				 ready.hdr.cmd, &ready, sizeof(ready), &reply,
-				 sizeof(reply));
-	if (ret < 0)
-		return ret;
-	return 1;
-}
-
 /**
  * sof_set_pipe_widget - Set pipe_widget for a component
  * @sdev: pointer to struct snd_sof_dev
-- 
2.25.1


  parent reply	other threads:[~2022-03-14 20:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 20:05 [PATCH 00/18] Introduce IPC abstraction for SOF topology parsing Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 01/18] ASoC: SOF: Introduce struct snd_sof_dai_link Ranjani Sridharan
2022-03-14 20:05 ` [PATCH] ASoC: SOF: IPC4-tooplogy: Add ccore tokens Ranjani Sridharan
2022-03-14 20:07   ` Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 02/18] ASoC: SOF: IPC: Introduce IPC ops Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 03/18] ASoC: SOF: topology: Add helper function for processing tuple arrays Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 04/18] ASoC: SOF: Introduce IPC3 ops Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 05/18] ASoC: SOF: topology: Make scheduler widget parsing IPC agnostic Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 06/18] ASoC: SOF: topology: Make buffer " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 07/18] ASoC: SOF: topology: Make pga " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 08/18] ASoC: SOF: topology: Make mixer " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 09/18] ASoC: SOF: topology: Make mux/demux " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 10/18] ASoC: SOF: topology: Make src " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 11/18] ASoC: SOF: topology: Make asrc " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 12/18] ASoC: SOF: topology: Make siggen " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 13/18] ASoC: SOF: topology: Make effect " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 14/18] ASoC: SOF: topology: Make route setup " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 15/18] ASoC: SOF: topology: Make DAI widget parsing " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 16/18] ASoC: SOF: topology: Make control " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 17/18] ASoC: SOF: topology: Make widget binding " Ranjani Sridharan
2022-03-14 20:05 ` Ranjani Sridharan [this message]
2022-03-16 20:36 ` [PATCH 00/18] Introduce IPC abstraction for SOF topology parsing 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=20220314200520.1233427-20-ranjani.sridharan@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc==tiwai@suse.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@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.