Skip to content

Commit

Permalink
module_adapter: remove redundant sink & source update in prepare for …
Browse files Browse the repository at this point in the history
…ipc4

They are done in bind & unbind(). But we need to keep it for ipc3.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
  • Loading branch information
RanderWang committed Dec 14, 2023
1 parent 293abd0 commit 0e2194d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
33 changes: 33 additions & 0 deletions src/audio/module_adapter/module_adapter_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions src/audio/module_adapter/module_adapter_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions src/include/sof/audio/module_adapter/module/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit 0e2194d

Please sign in to comment.