Skip to content

Commit 3d3e223

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: topology: Set pipeline widget before updating IPC structures
Set up the IPC structure for scheduler widgets and set the pipeline widget before updating the IPC structures for all widgets. This will be needed to look up pipeline information during IPC structure set up. Signed-off-by: Ranjani Sridharan <[email protected]> Signed-off-by: Jyri Sarha <[email protected]> Reviewed-by: Rander Wang <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 446967a commit 3d3e223

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

sound/soc/sof/topology.c

+24-24
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,6 @@ static int sof_complete(struct snd_soc_component *scomp)
21262126
{
21272127
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
21282128
const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
2129-
struct snd_sof_widget *swidget, *comp_swidget;
21302129
const struct sof_ipc_tplg_widget_ops *widget_ops;
21312130
struct snd_sof_control *scontrol;
21322131
struct snd_sof_pipeline *spipe;
@@ -2145,37 +2144,38 @@ static int sof_complete(struct snd_soc_component *scomp)
21452144
}
21462145
}
21472146

2148-
/*
2149-
* then update all widget IPC structures. If any of the ipc_setup callbacks fail, the
2150-
* topology will be removed and all widgets will be unloaded resulting in freeing all
2151-
* associated memories.
2152-
*/
2153-
list_for_each_entry(swidget, &sdev->widget_list, list) {
2154-
if (widget_ops && widget_ops[swidget->id].ipc_setup) {
2155-
ret = widget_ops[swidget->id].ipc_setup(swidget);
2147+
/* set up the IPC structures for the pipeline widgets */
2148+
list_for_each_entry(spipe, &sdev->pipeline_list, list) {
2149+
struct snd_sof_widget *pipe_widget = spipe->pipe_widget;
2150+
struct snd_sof_widget *swidget;
2151+
2152+
/* Update the scheduler widget's IPC structure */
2153+
if (widget_ops && widget_ops[pipe_widget->id].ipc_setup) {
2154+
ret = widget_ops[pipe_widget->id].ipc_setup(pipe_widget);
21562155
if (ret < 0) {
21572156
dev_err(sdev->dev, "failed updating IPC struct for %s\n",
2158-
swidget->widget->name);
2157+
pipe_widget->widget->name);
21592158
return ret;
21602159
}
21612160
}
2162-
}
21632161

2164-
/* set the pipe_widget and apply the dynamic_pipeline_widget_flag */
2165-
list_for_each_entry(spipe, &sdev->pipeline_list, list) {
2166-
struct snd_sof_widget *pipe_widget = spipe->pipe_widget;
2167-
2168-
/*
2169-
* Apply the dynamic_pipeline_widget flag and set the pipe_widget field
2170-
* for all widgets that have the same pipeline ID as the scheduler widget.
2171-
* Skip the scheduler widgets as they have their pipeline set during widget_ready
2172-
*/
2173-
list_for_each_entry(comp_swidget, &sdev->widget_list, list)
2174-
if (comp_swidget->widget->id != snd_soc_dapm_scheduler &&
2175-
comp_swidget->pipeline_id == pipe_widget->pipeline_id) {
2176-
ret = sof_set_widget_pipeline(sdev, spipe, comp_swidget);
2162+
/* set the pipeline and update the IPC structure for the non scheduler widgets */
2163+
list_for_each_entry(swidget, &sdev->widget_list, list)
2164+
if (swidget->widget->id != snd_soc_dapm_scheduler &&
2165+
swidget->pipeline_id == pipe_widget->pipeline_id) {
2166+
ret = sof_set_widget_pipeline(sdev, spipe, swidget);
21772167
if (ret < 0)
21782168
return ret;
2169+
2170+
if (widget_ops && widget_ops[swidget->id].ipc_setup) {
2171+
ret = widget_ops[swidget->id].ipc_setup(swidget);
2172+
if (ret < 0) {
2173+
dev_err(sdev->dev,
2174+
"failed updating IPC struct for %s\n",
2175+
swidget->widget->name);
2176+
return ret;
2177+
}
2178+
}
21792179
}
21802180
}
21812181

0 commit comments

Comments
 (0)