@@ -2126,7 +2126,6 @@ static int sof_complete(struct snd_soc_component *scomp)
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 ;
@@ -2145,37 +2144,38 @@ static int sof_complete(struct snd_soc_component *scomp)
2145
2144
}
2146
2145
}
2147
2146
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 );
2156
2155
if (ret < 0 ) {
2157
2156
dev_err (sdev -> dev , "failed updating IPC struct for %s\n" ,
2158
- swidget -> widget -> name );
2157
+ pipe_widget -> widget -> name );
2159
2158
return ret ;
2160
2159
}
2161
2160
}
2162
- }
2163
2161
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 );
2177
2167
if (ret < 0 )
2178
2168
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
+ }
2179
2179
}
2180
2180
}
2181
2181
0 commit comments