@@ -171,6 +171,7 @@ static void comp_common_builder(struct sof_ipc_comp *comp,
171171 config -> pipeline_id = comp -> pipeline_id ;
172172 config -> proc_domain = COMP_PROCESSING_DOMAIN_LL ;
173173 config -> type = comp -> type ;
174+ config -> ipc_config_size = comp -> size ;
174175
175176 /* buffers dont have the following data */
176177 if (comp -> type != SOF_COMP_BUFFER ) {
@@ -182,144 +183,6 @@ static void comp_common_builder(struct sof_ipc_comp *comp,
182183 config -> xrun_action = ipc_config -> xrun_action ;
183184 }
184185}
185- /*
186- * Stores all the "legacy" init IPC data locally.
187- */
188- union ipc_config_specific {
189- struct ipc_config_host host ;
190- struct ipc_config_dai dai ;
191- struct ipc_config_volume volume ;
192- struct ipc_config_src src ;
193- struct ipc_config_asrc asrc ;
194- struct ipc_config_tone tone ;
195- struct ipc_config_process process ;
196- struct ipc_comp_file file ;
197- } __attribute__((packed , aligned (4 )));
198-
199- /* build component specific data */
200- static int comp_specific_builder (struct sof_ipc_comp * comp ,
201- union ipc_config_specific * config )
202- {
203- #if CONFIG_LIBRARY
204- struct sof_ipc_comp_file * file = (struct sof_ipc_comp_file * )comp ;
205- #endif
206- struct sof_ipc_comp_host * host = (struct sof_ipc_comp_host * )comp ;
207- struct sof_ipc_comp_dai * dai = (struct sof_ipc_comp_dai * )comp ;
208- struct sof_ipc_comp_volume * vol = (struct sof_ipc_comp_volume * )comp ;
209- struct sof_ipc_comp_process * proc = (struct sof_ipc_comp_process * )comp ;
210- struct sof_ipc_comp_src * src = (struct sof_ipc_comp_src * )comp ;
211- struct sof_ipc_comp_asrc * asrc = (struct sof_ipc_comp_asrc * )comp ;
212- struct sof_ipc_comp_tone * tone = (struct sof_ipc_comp_tone * )comp ;
213-
214- memset (config , 0 , sizeof (* config ));
215-
216- switch (comp -> type ) {
217- #if CONFIG_LIBRARY
218- /* test bench maps host and DAIs to a file */
219- case SOF_COMP_FILEREAD :
220- case SOF_COMP_FILEWRITE :
221- if (IPC_TAIL_IS_SIZE_INVALID (* file ))
222- return - EBADMSG ;
223-
224- config -> file .channels = file -> channels ;
225- config -> file .fn = file -> fn ;
226- config -> file .frame_fmt = file -> frame_fmt ;
227- config -> file .mode = file -> mode ;
228- config -> file .rate = file -> rate ;
229- config -> file .direction = file -> direction ;
230-
231- /* For module_adapter_init_data() ipc_module_adapter compatibility */
232- config -> file .module_header .type = proc -> type ;
233- config -> file .module_header .size = proc -> size ;
234- config -> file .module_header .data = (uint8_t * )proc -> data -
235- sizeof (struct ipc_config_process );
236- break ;
237- #endif
238- case SOF_COMP_HOST :
239- case SOF_COMP_SG_HOST :
240- if (IPC_TAIL_IS_SIZE_INVALID (* host ))
241- return - EBADMSG ;
242- config -> host .direction = host -> direction ;
243- config -> host .no_irq = host -> no_irq ;
244- config -> host .dmac_config = host -> dmac_config ;
245- break ;
246- case SOF_COMP_DAI :
247- case SOF_COMP_SG_DAI :
248- if (IPC_TAIL_IS_SIZE_INVALID (* dai ))
249- return - EBADMSG ;
250- config -> dai .dai_index = dai -> dai_index ;
251- config -> dai .direction = dai -> direction ;
252- config -> dai .type = dai -> type ;
253- break ;
254- case SOF_COMP_VOLUME :
255- if (IPC_TAIL_IS_SIZE_INVALID (* vol ))
256- return - EBADMSG ;
257- config -> volume .channels = vol -> channels ;
258- config -> volume .initial_ramp = vol -> initial_ramp ;
259- config -> volume .max_value = vol -> max_value ;
260- config -> volume .min_value = vol -> min_value ;
261- config -> volume .ramp = vol -> ramp ;
262- break ;
263- case SOF_COMP_SRC :
264- if (IPC_TAIL_IS_SIZE_INVALID (* src ))
265- return - EBADMSG ;
266- config -> src .rate_mask = src -> rate_mask ;
267- config -> src .sink_rate = src -> sink_rate ;
268- config -> src .source_rate = src -> source_rate ;
269- break ;
270- case SOF_COMP_TONE :
271- if (IPC_TAIL_IS_SIZE_INVALID (* tone ))
272- return - EBADMSG ;
273- config -> tone .ampl_mult = tone -> ampl_mult ;
274- config -> tone .amplitude = tone -> amplitude ;
275- config -> tone .freq_mult = tone -> freq_mult ;
276- config -> tone .frequency = tone -> frequency ;
277- config -> tone .length = tone -> length ;
278- config -> tone .period = tone -> period ;
279- config -> tone .ramp_step = tone -> ramp_step ;
280- config -> tone .repeats = tone -> repeats ;
281- config -> tone .sample_rate = tone -> sample_rate ;
282- break ;
283- case SOF_COMP_ASRC :
284- if (IPC_TAIL_IS_SIZE_INVALID (* asrc ))
285- return - EBADMSG ;
286- config -> asrc .source_rate = asrc -> source_rate ;
287- config -> asrc .sink_rate = asrc -> sink_rate ;
288- config -> asrc .asynchronous_mode = asrc -> asynchronous_mode ;
289- config -> asrc .operation_mode = asrc -> operation_mode ;
290- break ;
291- case SOF_COMP_EQ_IIR :
292- case SOF_COMP_EQ_FIR :
293- case SOF_COMP_KEYWORD_DETECT :
294- case SOF_COMP_KPB :
295- case SOF_COMP_SELECTOR :
296- case SOF_COMP_DEMUX :
297- case SOF_COMP_MUX :
298- case SOF_COMP_DCBLOCK :
299- case SOF_COMP_SMART_AMP :
300- case SOF_COMP_MODULE_ADAPTER :
301- case SOF_COMP_NONE :
302- if (IPC_TAIL_IS_SIZE_INVALID (* proc ))
303- return - EBADMSG ;
304-
305- if (proc -> comp .hdr .size + proc -> size > SOF_IPC_MSG_MAX_SIZE )
306- return - EBADMSG ;
307-
308- config -> process .type = proc -> type ;
309- config -> process .size = proc -> size ;
310- #if CONFIG_LIBRARY || UNIT_TEST
311- config -> process .data = proc -> data + comp -> ext_data_length ;
312- #else
313- config -> process .data = proc -> data ;
314- #endif
315- break ;
316- case SOF_COMP_MIXER :
317- break ;
318- default :
319- return - EINVAL ;
320- }
321- return 0 ;
322- }
323186
324187struct ipc_comp_dev * ipc_get_comp_by_ppl_id (struct ipc * ipc ,
325188 uint16_t type , uint32_t ppl_id ,
@@ -343,7 +206,6 @@ struct ipc_comp_dev *ipc_get_comp_by_ppl_id(struct ipc *ipc,
343206struct comp_dev * comp_new (struct sof_ipc_comp * comp )
344207{
345208 struct comp_ipc_config config ;
346- union ipc_config_specific spec ;
347209 struct comp_dev * cdev ;
348210 const struct comp_driver * drv ;
349211
@@ -361,13 +223,8 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp)
361223 tr_info (& comp_tr , "comp new %pU type %d id %d.%d" ,
362224 drv -> tctx -> uuid_p , comp -> type , comp -> pipeline_id , comp -> id );
363225
364- /* build the component */
365- if (comp_specific_builder (comp , & spec ) < 0 ) {
366- comp_cl_err (drv , "comp_new(): component type not recognized" );
367- return NULL ;
368- }
369226 comp_common_builder (comp , & config );
370- cdev = drv -> ops .create (drv , & config , & spec );
227+ cdev = drv -> ops .create (drv , & config , comp );
371228 if (!cdev ) {
372229 comp_cl_err (drv , "comp_new(): unable to create the new component" );
373230 return NULL ;
0 commit comments