Skip to content

Commit 61ad28f

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: topology: remove snd_sof_complete_pipeline()
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> Link: https://lore.kernel.org/r/20220314200520.1233427-20-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8ef1439 commit 61ad28f

4 files changed

Lines changed: 37 additions & 31 deletions

File tree

sound/soc/sof/ipc3-topology.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,28 @@ static int sof_ipc3_widget_bind_event(struct snd_soc_component *scomp,
18871887
return -EINVAL;
18881888
}
18891889

1890+
static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
1891+
{
1892+
struct sof_ipc_pipe_ready ready;
1893+
struct sof_ipc_reply reply;
1894+
int ret;
1895+
1896+
dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
1897+
swidget->widget->name, swidget->comp_id);
1898+
1899+
memset(&ready, 0, sizeof(ready));
1900+
ready.hdr.size = sizeof(ready);
1901+
ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
1902+
ready.comp_id = swidget->comp_id;
1903+
1904+
ret = sof_ipc_tx_message(sdev->ipc, ready.hdr.cmd, &ready, sizeof(ready), &reply,
1905+
sizeof(reply));
1906+
if (ret < 0)
1907+
return ret;
1908+
1909+
return 1;
1910+
}
1911+
18901912
/* token list for each topology object */
18911913
static enum sof_tokens host_token_list[] = {
18921914
SOF_CORE_TOKENS,
@@ -1988,6 +2010,7 @@ static const struct sof_ipc_tplg_ops ipc3_tplg_ops = {
19882010
.route_setup = sof_ipc3_route_setup,
19892011
.control_setup = sof_ipc3_control_setup,
19902012
.control_free = sof_ipc3_control_free,
2013+
.pipeline_complete = sof_ipc3_complete_pipeline,
19912014
.token_list = ipc3_token_list,
19922015
};
19932016

sound/soc/sof/sof-audio.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev,
362362

363363
int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir)
364364
{
365+
const struct sof_ipc_tplg_ops *ipc_tplg_ops = sdev->ipc->ops->tplg;
365366
struct snd_soc_dapm_widget_list *list = spcm->stream[dir].list;
366367
struct snd_soc_dapm_widget *widget;
367368
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
432433
if (pipe_widget->complete)
433434
continue;
434435

435-
pipe_widget->complete = snd_sof_complete_pipeline(sdev, pipe_widget);
436-
if (pipe_widget->complete < 0) {
437-
ret = pipe_widget->complete;
438-
goto widget_free;
436+
if (ipc_tplg_ops->pipeline_complete) {
437+
pipe_widget->complete = ipc_tplg_ops->pipeline_complete(sdev, pipe_widget);
438+
if (pipe_widget->complete < 0) {
439+
ret = pipe_widget->complete;
440+
goto widget_free;
441+
}
439442
}
440443
}
441444

@@ -657,8 +660,11 @@ int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify)
657660
return ret;
658661
}
659662

660-
swidget->complete =
661-
snd_sof_complete_pipeline(sdev, swidget);
663+
if (ipc_tplg_ops->pipeline_complete) {
664+
swidget->complete = ipc_tplg_ops->pipeline_complete(sdev, swidget);
665+
if (swidget->complete < 0)
666+
return swidget->complete;
667+
}
662668
break;
663669
default:
664670
break;

sound/soc/sof/sof-audio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ struct sof_ipc_tplg_widget_ops {
6868
* initialized to 0.
6969
* @control_setup: Function pointer for setting up kcontrol IPC-specific data
7070
* @control_free: Function pointer for freeing kcontrol IPC-specific data
71+
* @pipeline_complete: Function pointer for pipeline complete IPC
7172
*/
7273
struct sof_ipc_tplg_ops {
7374
const struct sof_ipc_tplg_widget_ops *widget;
7475
int (*route_setup)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);
7576
const struct sof_token_info *token_list;
7677
int (*control_setup)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
7778
int (*control_free)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
79+
int (*pipeline_complete)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
7880
};
7981

8082
/** struct snd_sof_tuple - Tuple info
@@ -318,8 +320,6 @@ void snd_sof_control_notify(struct snd_sof_dev *sdev,
318320
* be freed by snd_soc_unregister_component,
319321
*/
320322
int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file);
321-
int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
322-
struct snd_sof_widget *swidget);
323323

324324
/*
325325
* Stream IPC

sound/soc/sof/topology.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,29 +1825,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
18251825
return ret;
18261826
}
18271827

1828-
int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
1829-
struct snd_sof_widget *swidget)
1830-
{
1831-
struct sof_ipc_pipe_ready ready;
1832-
struct sof_ipc_reply reply;
1833-
int ret;
1834-
1835-
dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
1836-
swidget->widget->name, swidget->comp_id);
1837-
1838-
memset(&ready, 0, sizeof(ready));
1839-
ready.hdr.size = sizeof(ready);
1840-
ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE;
1841-
ready.comp_id = swidget->comp_id;
1842-
1843-
ret = sof_ipc_tx_message(sdev->ipc,
1844-
ready.hdr.cmd, &ready, sizeof(ready), &reply,
1845-
sizeof(reply));
1846-
if (ret < 0)
1847-
return ret;
1848-
return 1;
1849-
}
1850-
18511828
/**
18521829
* sof_set_pipe_widget - Set pipe_widget for a component
18531830
* @sdev: pointer to struct snd_sof_dev

0 commit comments

Comments
 (0)