Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230321092654.7292-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ranjani Sridharan and committed by
Mark Brown
3d3e223f 446967a4

+24 -24
+24 -24
sound/soc/sof/topology.c
··· 2126 2126 { 2127 2127 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); 2128 2128 const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); 2129 - struct snd_sof_widget *swidget, *comp_swidget; 2130 2129 const struct sof_ipc_tplg_widget_ops *widget_ops; 2131 2130 struct snd_sof_control *scontrol; 2132 2131 struct snd_sof_pipeline *spipe; ··· 2144 2145 } 2145 2146 } 2146 2147 2147 - /* 2148 - * then update all widget IPC structures. If any of the ipc_setup callbacks fail, the 2149 - * topology will be removed and all widgets will be unloaded resulting in freeing all 2150 - * associated memories. 2151 - */ 2152 - list_for_each_entry(swidget, &sdev->widget_list, list) { 2153 - if (widget_ops && widget_ops[swidget->id].ipc_setup) { 2154 - ret = widget_ops[swidget->id].ipc_setup(swidget); 2148 + /* set up the IPC structures for the pipeline widgets */ 2149 + list_for_each_entry(spipe, &sdev->pipeline_list, list) { 2150 + struct snd_sof_widget *pipe_widget = spipe->pipe_widget; 2151 + struct snd_sof_widget *swidget; 2152 + 2153 + /* Update the scheduler widget's IPC structure */ 2154 + if (widget_ops && widget_ops[pipe_widget->id].ipc_setup) { 2155 + ret = widget_ops[pipe_widget->id].ipc_setup(pipe_widget); 2155 2156 if (ret < 0) { 2156 2157 dev_err(sdev->dev, "failed updating IPC struct for %s\n", 2157 - swidget->widget->name); 2158 + pipe_widget->widget->name); 2158 2159 return ret; 2159 2160 } 2160 2161 } 2161 - } 2162 2162 2163 - /* set the pipe_widget and apply the dynamic_pipeline_widget_flag */ 2164 - list_for_each_entry(spipe, &sdev->pipeline_list, list) { 2165 - struct snd_sof_widget *pipe_widget = spipe->pipe_widget; 2166 - 2167 - /* 2168 - * Apply the dynamic_pipeline_widget flag and set the pipe_widget field 2169 - * for all widgets that have the same pipeline ID as the scheduler widget. 2170 - * Skip the scheduler widgets as they have their pipeline set during widget_ready 2171 - */ 2172 - list_for_each_entry(comp_swidget, &sdev->widget_list, list) 2173 - if (comp_swidget->widget->id != snd_soc_dapm_scheduler && 2174 - comp_swidget->pipeline_id == pipe_widget->pipeline_id) { 2175 - ret = sof_set_widget_pipeline(sdev, spipe, comp_swidget); 2163 + /* set the pipeline and update the IPC structure for the non scheduler widgets */ 2164 + list_for_each_entry(swidget, &sdev->widget_list, list) 2165 + if (swidget->widget->id != snd_soc_dapm_scheduler && 2166 + swidget->pipeline_id == pipe_widget->pipeline_id) { 2167 + ret = sof_set_widget_pipeline(sdev, spipe, swidget); 2176 2168 if (ret < 0) 2177 2169 return ret; 2170 + 2171 + if (widget_ops && widget_ops[swidget->id].ipc_setup) { 2172 + ret = widget_ops[swidget->id].ipc_setup(swidget); 2173 + if (ret < 0) { 2174 + dev_err(sdev->dev, 2175 + "failed updating IPC struct for %s\n", 2176 + swidget->widget->name); 2177 + return ret; 2178 + } 2179 + } 2178 2180 } 2179 2181 } 2180 2182