diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index e30c6cbc51cb..3304a7298093 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -119,39 +119,6 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv, return NULL; } -static int module_adapter_sink_src_prepare(struct comp_dev *dev) -{ - struct processing_module *mod = comp_get_drvdata(dev); - struct list_item *blist; - int ret; - int i; - - /* acquire all sink and source buffers, get handlers to sink/source API */ - i = 0; - list_for_item(blist, &dev->bsink_list) { - struct comp_buffer *sink_buffer = - container_of(blist, struct comp_buffer, source_list); - mod->sinks[i] = audio_stream_get_sink(&sink_buffer->stream); - i++; - } - mod->num_of_sinks = i; - - i = 0; - list_for_item(blist, &dev->bsource_list) { - struct comp_buffer *source_buffer = - container_of(blist, struct comp_buffer, sink_list); - - mod->sources[i] = audio_stream_get_source(&source_buffer->stream); - i++; - } - mod->num_of_sources = i; - - /* Prepare module */ - ret = module_prepare(mod, mod->sources, mod->num_of_sources, mod->sinks, mod->num_of_sinks); - - return ret; -} - #if CONFIG_ZEPHYR_DP_SCHEDULER static int module_adapter_dp_queue_prepare(struct comp_dev *dev) { diff --git a/src/audio/module_adapter/module_adapter_ipc3.c b/src/audio/module_adapter/module_adapter_ipc3.c index 7c3a2f1afb29..920eb4f0f169 100644 --- a/src/audio/module_adapter/module_adapter_ipc3.c +++ b/src/audio/module_adapter/module_adapter_ipc3.c @@ -287,3 +287,36 @@ int module_adapter_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_s comp_dbg(dev, "module_adapter_cmd() done"); return ret; } + +int module_adapter_sink_src_prepare(struct comp_dev *dev) +{ + struct processing_module *mod = comp_get_drvdata(dev); + struct list_item *blist; + int ret; + int i; + + /* acquire all sink and source buffers, get handlers to sink/source API */ + i = 0; + list_for_item(blist, &dev->bsink_list) { + struct comp_buffer *sink_buffer = + container_of(blist, struct comp_buffer, source_list); + mod->sinks[i] = audio_stream_get_sink(&sink_buffer->stream); + i++; + } + mod->num_of_sinks = i; + + i = 0; + list_for_item(blist, &dev->bsource_list) { + struct comp_buffer *source_buffer = + container_of(blist, struct comp_buffer, sink_list); + + mod->sources[i] = audio_stream_get_source(&source_buffer->stream); + i++; + } + mod->num_of_sources = i; + + /* Prepare module */ + ret = module_prepare(mod, mod->sources, mod->num_of_sources, mod->sinks, mod->num_of_sinks); + + return ret; +} diff --git a/src/audio/module_adapter/module_adapter_ipc4.c b/src/audio/module_adapter/module_adapter_ipc4.c index def965caacb1..c30e8646c5bf 100644 --- a/src/audio/module_adapter/module_adapter_ipc4.c +++ b/src/audio/module_adapter/module_adapter_ipc4.c @@ -237,3 +237,11 @@ uint64_t module_adapter_get_total_data_processed(struct comp_dev *dev, return mod->total_data_consumed; } +int module_adapter_sink_src_prepare(struct comp_dev *dev) +{ + struct processing_module *mod = comp_get_drvdata(dev); + + /* Prepare module */ + return module_prepare(mod, mod->sources, mod->num_of_sources, + mod->sinks, mod->num_of_sinks); +} diff --git a/src/include/sof/audio/module_adapter/module/generic.h b/src/include/sof/audio/module_adapter/module/generic.h index 1ab2485fe348..52208f70f62d 100644 --- a/src/include/sof/audio/module_adapter/module/generic.h +++ b/src/include/sof/audio/module_adapter/module/generic.h @@ -325,4 +325,5 @@ void module_adapter_check_data(struct processing_module *mod, struct comp_dev *d void module_adapter_set_params(struct processing_module *mod, struct sof_ipc_stream_params *params); int module_adapter_set_state(struct processing_module *mod, struct comp_dev *dev, int cmd); +int module_adapter_sink_src_prepare(struct comp_dev *dev); #endif /* __SOF_AUDIO_MODULE_GENERIC__ */