diff --git a/src/audio/module_adapter/module/generic.c b/src/audio/module_adapter/module/generic.c index ef29ec7c4..f3676521a 100644 --- a/src/audio/module_adapter/module/generic.c +++ b/src/audio/module_adapter/module/generic.c @@ -486,3 +486,21 @@ int module_set_configuration(struct processing_module *mod, return ret; } + +int module_bind(struct processing_module *mod, void *data) +{ + struct module_data *md = &mod->priv; + + if (md->ops->bind) + return md->ops->bind(mod, data); + return 0; +} + +int module_unbind(struct processing_module *mod, void *data) +{ + struct module_data *md = &mod->priv; + + if (md->ops->unbind) + return md->ops->unbind(mod, data); + return 0; +} diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index 4b2e475e4..750c146e0 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -1552,6 +1552,11 @@ int module_adapter_bind(struct comp_dev *dev, void *data) struct comp_dev *source_dev; int source_index; int src_id; + int ret; + + ret = module_bind(mod, data); + if (ret < 0) + return ret; bu = (struct ipc4_module_bind_unbind *)data; src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id); @@ -1603,6 +1608,11 @@ int module_adapter_unbind(struct comp_dev *dev, void *data) struct comp_dev *source_dev; int source_index; int src_id; + int ret; + + ret = module_unbind(mod, data); + if (ret < 0) + return ret; bu = (struct ipc4_module_bind_unbind *)data; src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id); diff --git a/src/include/sof/audio/module_adapter/module/generic.h b/src/include/sof/audio/module_adapter/module/generic.h index 275edb25c..ef9552d78 100644 --- a/src/include/sof/audio/module_adapter/module/generic.h +++ b/src/include/sof/audio/module_adapter/module/generic.h @@ -255,6 +255,8 @@ int module_set_configuration(struct processing_module *mod, enum module_cfg_fragment_position pos, size_t data_offset_size, const uint8_t *fragment, size_t fragment_size, uint8_t *response, size_t response_size); +int module_bind(struct processing_module *mod, void *data); +int module_unbind(struct processing_module *mod, void *data); struct comp_dev *module_adapter_new(const struct comp_driver *drv, const struct comp_ipc_config *config, diff --git a/src/include/sof/audio/module_adapter/module/module_interface.h b/src/include/sof/audio/module_adapter/module/module_interface.h index dec02f3cf..f3d918d61 100644 --- a/src/include/sof/audio/module_adapter/module/module_interface.h +++ b/src/include/sof/audio/module_adapter/module/module_interface.h @@ -189,6 +189,14 @@ struct module_interface { * free in .free(). This should free all memory allocated during module initialization. */ int (*free)(struct processing_module *mod); + /** + * Module specific bind procedure, called when modules are bound with each other + */ + int (*bind)(struct processing_module *mod, void *data); + /** + * Module specific unbind procedure, called when modules are disconnected from one another + */ + int (*unbind)(struct processing_module *mod, void *data); }; /* Convert first_block/last_block indicator to fragment position */