mirror of https://github.com/thesofproject/sof.git
module_adapter: Extend the module interface
Add the bind/unbind ops that can be optionally implemented by modules to perform module-specific actions when other modules are bound/unbound from them. These are particularly useful for modules such as the mixers, smart_amp, copier that can have multiple input/output pins. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
2d02dd0ed5
commit
5433e371b8
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue