module_adapter: Adapt the create op for different comp types

Module adapter can be used by components with types other than
SOF_COMP_MODULE_ADAPTER. So modify the create op to handle components
by type.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2022-04-28 09:10:21 -07:00 committed by Liam Girdwood
parent bb842d36ad
commit 1e9d9c6f31
1 changed files with 17 additions and 3 deletions

View File

@ -35,7 +35,21 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv,
int ret;
struct comp_dev *dev;
struct processing_module *mod;
struct ipc_config_process *ipc_module_adapter = spec;
unsigned char *data;
uint32_t size;
switch (config->type) {
case SOF_COMP_MODULE_ADAPTER:
{
struct ipc_config_process *ipc_module_adapter = spec;
size = ipc_module_adapter->size;
data = ipc_module_adapter->data;
break;
}
default:
return NULL;
}
comp_cl_dbg(drv, "module_adapter_new() start");
@ -66,8 +80,8 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv,
list_init(&mod->sink_buffer_list);
/* Copy initial config */
if (ipc_module_adapter->size) {
ret = module_load_config(dev, ipc_module_adapter->data, ipc_module_adapter->size);
if (size) {
ret = module_load_config(dev, data, size);
if (ret) {
comp_err(dev, "module_adapter_new() error %d: config loading has failed.",
ret);