From c152db791c72bab53138570252982420f8cf3956 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Mon, 1 Mar 2021 16:24:12 -0800 Subject: [PATCH 1/3] codec_adapter: Adjust logging for lib context In order to act as a stand in layer for codecs going forward we need to not log using our comp_driver as that will be removed in the future. Instead we need to log using the context of comp_dev. This commit also reduces the verbosity of a lot of the traces and increases a few. Signed-off-by: Curtis Malainey --- src/audio/codec_adapter/codec_adapter.c | 44 +++++++++++-------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 8d0fca1d7dde..afeae377ada9 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -46,17 +46,17 @@ static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, struct sof_ipc_comp_process *ipc_codec_adapter = (struct sof_ipc_comp_process *)comp; - comp_cl_info(&comp_codec_adapter, "codec_adapter_new() start"); + comp_cl_dbg(drv, "codec_adapter_new() start"); if (!drv || !comp) { - comp_cl_err(&comp_codec_adapter, "codec_adapter_new(), wrong input params! drv = %x comp = %x", + comp_cl_err(drv, "codec_adapter_new(), wrong input params! drv = %x comp = %x", (uint32_t)drv, (uint32_t)comp); return NULL; } dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process)); if (!dev) { - comp_cl_err(&comp_codec_adapter, "codec_adapter_new(), failed to allocate memory for comp_dev"); + comp_cl_err(drv, "codec_adapter_new(), failed to allocate memory for comp_dev"); return NULL; } @@ -68,7 +68,7 @@ static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, cd = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*cd)); if (!cd) { - comp_cl_err(&comp_codec_adapter, "codec_adapter_new(), failed to allocate memory for comp_data"); + comp_err(dev, "codec_adapter_new(), failed to allocate memory for comp_data"); rfree(dev); return NULL; } @@ -92,7 +92,7 @@ static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, dev->state = COMP_STATE_READY; cd->state = PP_STATE_CREATED; - comp_cl_info(&comp_codec_adapter, "codec_adapter_new() done"); + comp_dbg(dev, "codec_adapter_new() done"); return dev; err: rfree(cd); @@ -188,7 +188,7 @@ static int codec_adapter_prepare(struct comp_dev *dev) */ uint32_t buff_size; /* size of local buffer */ - comp_info(dev, "codec_adapter_prepare() start"); + comp_dbg(dev, "codec_adapter_prepare() start"); /* Init sink & source buffers */ cd->ca_sink = list_first_item(&dev->bsink_list, struct comp_buffer, @@ -269,7 +269,7 @@ static int codec_adapter_prepare(struct comp_dev *dev) buffer_reset_pos(cd->local_buff, NULL); cd->state = PP_STATE_PREPARED; - comp_info(dev, "codec_adapter_prepare() done"); + comp_dbg(dev, "codec_adapter_prepare() done"); return 0; } @@ -590,8 +590,7 @@ static int ca_set_binary_data(struct comp_dev *dev, { int ret; - comp_info(dev, "ca_set_binary_data() start, data type %d", - cdata->data->type); + comp_dbg(dev, "ca_set_binary_data() start, data type %d", cdata->data->type); switch (cdata->data->type) { case CODEC_CFG_SETUP: @@ -613,8 +612,8 @@ static int codec_adapter_ctrl_set_data(struct comp_dev *dev, int ret; struct comp_data *cd = comp_get_drvdata(dev); - comp_info(dev, "codec_adapter_ctrl_set_data() start, state %d, cmd %d", - cd->state, cdata->cmd); + comp_dbg(dev, "codec_adapter_ctrl_set_data() start, state %d, cmd %d", + cd->state, cdata->cmd); /* Check version from ABI header */ if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, cdata->data->abi)) { @@ -646,7 +645,7 @@ static int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, int ret; struct sof_ipc_ctrl_data *cdata = data; - comp_info(dev, "codec_adapter_cmd() %d start", cmd); + comp_dbg(dev, "codec_adapter_cmd() %d start", cmd); switch (cmd) { case COMP_CMD_SET_DATA: @@ -662,14 +661,13 @@ static int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, break; } - comp_info(dev, "codec_adapter_cmd() done"); + comp_dbg(dev, "codec_adapter_cmd() done"); return ret; } static int codec_adapter_trigger(struct comp_dev *dev, int cmd) { - comp_cl_info(&comp_codec_adapter, "codec_adapter_trigger(): component got trigger cmd %x", - cmd); + comp_dbg(dev, "codec_adapter_trigger(): component got trigger cmd %x", cmd); return comp_set_state(dev, cmd); } @@ -679,17 +677,17 @@ static int codec_adapter_reset(struct comp_dev *dev) int ret; struct comp_data *cd = comp_get_drvdata(dev); - comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): resetting"); + comp_dbg(dev, "codec_adapter_reset(): resetting"); ret = codec_reset(dev); if (ret) { - comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): error %d, codec reset has failed", - ret); + comp_err(dev, "codec_adapter_reset(): error %d, codec reset has failed", + ret); } buffer_zero(cd->local_buff); cd->state = PP_STATE_CREATED; - comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): done"); + comp_dbg(dev, "codec_adapter_reset(): done"); return comp_set_state(dev, COMP_TRIGGER_RESET); } @@ -699,18 +697,16 @@ static void codec_adapter_free(struct comp_dev *dev) int ret; struct comp_data *cd = comp_get_drvdata(dev); - comp_cl_info(&comp_codec_adapter, "codec_adapter_free(): start"); + comp_dbg(dev, "codec_adapter_free(): start"); ret = codec_free(dev); if (ret) { - comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): error %d, codec reset has failed", - ret); + comp_err(dev, "codec_adapter_free(): error %d, codec reset has failed", + ret); } buffer_free(cd->local_buff); rfree(cd); rfree(dev); - - comp_cl_info(&comp_codec_adapter, "codec_adapter_free(): component memory freed"); } static const struct comp_driver comp_codec_adapter = { From 492f6f245eb913bf0d92e6080db83ff61223a866 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Fri, 2 Apr 2021 19:51:24 +0300 Subject: [PATCH 2/3] codec_adapter: Move to shimmed codec adapter interface This commit strips the codec adapter as it is more of a library/layer for codecs to simplify their interface against rather than a component in and of itself. This gives each codec its own UUID solving the ID problem while opening an opertunity to register codecs directly for future multiplexing capabilities. Old UUID adapter used for codec_adapter is now used for Cadence codecs, and we add new UUIDs for passthrough and Waves codecs. Signed-off-by: Curtis Malainey Signed-off-by: Daniel Baluta --- src/audio/codec_adapter/codec/cadence.c | 18 +++++ src/audio/codec_adapter/codec/generic.c | 14 +--- src/audio/codec_adapter/codec/passthrough.c | 32 ++++++-- src/audio/codec_adapter/codec/waves.c | 17 +++++ src/audio/codec_adapter/codec_adapter.c | 66 +++++------------ .../sof/audio/codec_adapter/codec/generic.h | 50 ++++++++++++- .../sof/audio/codec_adapter/interfaces.h | 74 ------------------- 7 files changed, 126 insertions(+), 145 deletions(-) delete mode 100644 src/include/sof/audio/codec_adapter/interfaces.h diff --git a/src/audio/codec_adapter/codec/cadence.c b/src/audio/codec_adapter/codec/cadence.c index 0f92059a5bc4..a21abf202d81 100644 --- a/src/audio/codec_adapter/codec/cadence.c +++ b/src/audio/codec_adapter/codec/cadence.c @@ -14,6 +14,12 @@ #include #include +/* d8218443-5ff3-4a4c-b388-6cfe07b956aa */ +DECLARE_SOF_RT_UUID("cadence_codec", cadence_uuid, 0xd8218443, 0x5ff3, 0x4a4c, + 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa); + +DECLARE_TR_CTX(cadence_tr, SOF_UUID(cadence_uuid), LOG_LEVEL_INFO); + /*****************************************************************************/ /* Cadence API functions array */ /*****************************************************************************/ @@ -478,3 +484,15 @@ int cadence_codec_free(struct comp_dev *dev) /* Nothing to do */ return 0; } + +static struct codec_interface cadence_interface = { + .init = cadence_codec_init, + .prepare = cadence_codec_prepare, + .init_process = cadence_codec_init_process, + .process = cadence_codec_process, + .apply_config = cadence_codec_apply_config, + .reset = cadence_codec_reset, + .free = cadence_codec_free +}; + +DECLARE_CODEC_ADAPTER(cadence_interface, cadence_uuid, cadence_tr); diff --git a/src/audio/codec_adapter/codec/generic.c b/src/audio/codec_adapter/codec/generic.c index f7ea002bf1e1..10b15c11aea8 100644 --- a/src/audio/codec_adapter/codec/generic.c +++ b/src/audio/codec_adapter/codec/generic.c @@ -12,7 +12,6 @@ */ #include -#include /*****************************************************************************/ /* Local helper functions */ @@ -77,16 +76,12 @@ codec_load_config(struct comp_dev *dev, void *cfg, size_t size, return ret; } -int codec_init(struct comp_dev *dev) +int codec_init(struct comp_dev *dev, struct codec_interface *interface) { int ret; struct comp_data *cd = comp_get_drvdata(dev); uint32_t codec_id = cd->ca_config.codec_id; - uint32_t interface_id = CODEC_GET_INTERFACE_ID(codec_id); struct codec_data *codec = &cd->codec; - struct codec_interface *interface = NULL; - uint32_t i; - uint32_t no_of_interfaces = ARRAY_SIZE(interfaces); comp_info(dev, "codec_init() start"); @@ -97,13 +92,6 @@ int codec_init(struct comp_dev *dev) codec->id = codec_id; - /* Find proper interface */ - for (i = 0; i < no_of_interfaces; i++) { - if (interfaces[i].id == interface_id) { - interface = &interfaces[i]; - break; - } - } if (!interface) { comp_err(dev, "codec_init(): could not find codec interface for codec id %x", codec_id); diff --git a/src/audio/codec_adapter/codec/passthrough.c b/src/audio/codec_adapter/codec/passthrough.c index 1085a763ac79..3bd1ad2c859e 100644 --- a/src/audio/codec_adapter/codec/passthrough.c +++ b/src/audio/codec_adapter/codec/passthrough.c @@ -7,15 +7,19 @@ // Passthrough codec implementation to demonstrate Codec Adapter API #include -#include -int passthrough_codec_init(struct comp_dev *dev) +/* 376b5e44-9c82-4ec2-bc83-10ea101afa8f */ +DECLARE_SOF_RT_UUID("passthrough_codec", passthrough_uuid, 0x376b5e44, 0x9c82, 0x4ec2, + 0xbc, 0x83, 0x10, 0xea, 0x10, 0x1a, 0xf8, 0x8f); +DECLARE_TR_CTX(passthrough_tr, SOF_UUID(passthrough_uuid), LOG_LEVEL_INFO); + +static int passthrough_codec_init(struct comp_dev *dev) { comp_info(dev, "passthrough_codec_init() start"); return 0; } -int passthrough_codec_prepare(struct comp_dev *dev) +static int passthrough_codec_prepare(struct comp_dev *dev) { struct codec_data *codec = comp_get_codec(dev); struct comp_data *cd = comp_get_drvdata(dev); @@ -40,7 +44,7 @@ int passthrough_codec_prepare(struct comp_dev *dev) return 0; } -int passthrough_codec_init_process(struct comp_dev *dev) +static int passthrough_codec_init_process(struct comp_dev *dev) { struct codec_data *codec = comp_get_codec(dev); @@ -53,7 +57,7 @@ int passthrough_codec_init_process(struct comp_dev *dev) return 0; } -int passthrough_codec_process(struct comp_dev *dev) +static int passthrough_codec_process(struct comp_dev *dev) { struct codec_data *codec = comp_get_codec(dev); struct comp_data *cd = comp_get_drvdata(dev); @@ -68,7 +72,7 @@ int passthrough_codec_process(struct comp_dev *dev) return 0; } -int passthrough_codec_apply_config(struct comp_dev *dev) +static int passthrough_codec_apply_config(struct comp_dev *dev) { comp_info(dev, "passthrough_codec_apply_config()"); @@ -76,7 +80,7 @@ int passthrough_codec_apply_config(struct comp_dev *dev) return 0; } -int passthrough_codec_reset(struct comp_dev *dev) +static int passthrough_codec_reset(struct comp_dev *dev) { comp_info(dev, "passthrough_codec_reset()"); @@ -84,7 +88,7 @@ int passthrough_codec_reset(struct comp_dev *dev) return 0; } -int passthrough_codec_free(struct comp_dev *dev) +static int passthrough_codec_free(struct comp_dev *dev) { struct codec_data *codec = comp_get_codec(dev); @@ -95,3 +99,15 @@ int passthrough_codec_free(struct comp_dev *dev) return 0; } + +static struct codec_interface passthrough_interface = { + .init = passthrough_codec_init, + .prepare = passthrough_codec_prepare, + .init_process = passthrough_codec_init_process, + .process = passthrough_codec_process, + .apply_config = passthrough_codec_apply_config, + .reset = passthrough_codec_reset, + .free = passthrough_codec_free +}; + +DECLARE_CODEC_ADAPTER(passthrough_interface, passthrough_uuid, passthrough_tr); diff --git a/src/audio/codec_adapter/codec/waves.c b/src/audio/codec_adapter/codec/waves.c index cb873c2685b6..d61f7c7c73d4 100644 --- a/src/audio/codec_adapter/codec/waves.c +++ b/src/audio/codec_adapter/codec/waves.c @@ -21,6 +21,11 @@ #define MAX_CONFIG_SIZE_BYTES (8192) #define NUM_IO_STREAMS (1) +/* d944281a-afe9-4695-a043-d7f62b89538e*/ +DECLARE_SOF_RT_UUID("waves_codec", waves_uuid, 0xd944281a, 0xafe9, 0x4695, + 0xa0, 0x43, 0xd7, 0xf6, 0x2b, 0x89, 0x53, 0x8e); +DECLARE_TR_CTX(waves_tr, SOF_UUID(waves_uuid), LOG_LEVEL_INFO); + struct waves_codec_data { uint32_t sample_rate; uint32_t buffer_bytes; @@ -758,3 +763,15 @@ int waves_codec_free(struct comp_dev *dev) comp_dbg(dev, "waves_codec_free()"); return 0; } + +static struct codec_interface waves_interface = { + .init = waves_codec_init, + .prepare = waves_codec_prepare, + .init_process = waves_codec_init_process, + .process = waves_codec_process, + .apply_config = waves_codec_apply_config, + .reset = waves_codec_reset, + .free = waves_codec_free +}; + +DECLARE_CODEC_ADAPTER(waves_interface, waves_uuid, waves_tr); diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index afeae377ada9..2fbe3963f69c 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -22,13 +22,8 @@ #include #include -static const struct comp_driver comp_codec_adapter; - -/* d8218443-5ff3-4a4c-b388-6cfe07b956aa */ -DECLARE_SOF_RT_UUID("codec_adapter", ca_uuid, 0xd8218443, 0x5ff3, 0x4a4c, - 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa); - -DECLARE_TR_CTX(ca_tr, SOF_UUID(ca_uuid), LOG_LEVEL_INFO); +int load_setup_config(struct comp_dev *dev, void *cfg, uint32_t size); +int validate_setup_config(struct ca_config *cfg); /** * \brief Create a codec adapter component. @@ -37,8 +32,9 @@ DECLARE_TR_CTX(ca_tr, SOF_UUID(ca_uuid), LOG_LEVEL_INFO); * * \return: a pointer to newly created codec adapter component. */ -static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, - struct sof_ipc_comp *comp) +struct comp_dev *codec_adapter_new(const struct comp_driver *drv, + struct sof_ipc_comp *comp, + struct codec_interface *interface) { int ret; struct comp_dev *dev; @@ -82,7 +78,7 @@ static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, goto err; } /* Init processing codec */ - ret = codec_init(dev); + ret = codec_init(dev, interface); if (ret) { comp_err(dev, "codec_adapter_new() %d: codec initialization failed", ret); @@ -100,7 +96,7 @@ static struct comp_dev *codec_adapter_new(const struct comp_driver *drv, return NULL; } -static inline int validate_setup_config(struct ca_config *cfg) +int validate_setup_config(struct ca_config *cfg) { /* TODO: validate codec_adapter setup parameters */ return 0; @@ -121,7 +117,7 @@ static inline int validate_setup_config(struct ca_config *cfg) * 0 -> success * negative value -> failure. */ -static int load_setup_config(struct comp_dev *dev, void *cfg, uint32_t size) +int load_setup_config(struct comp_dev *dev, void *cfg, uint32_t size) { int ret; void *lib_cfg; @@ -178,7 +174,7 @@ static int load_setup_config(struct comp_dev *dev, void *cfg, uint32_t size) * 0 - success * value < 0 - failure. */ -static int codec_adapter_prepare(struct comp_dev *dev) +int codec_adapter_prepare(struct comp_dev *dev) { int ret; struct comp_data *cd = comp_get_drvdata(dev); @@ -274,8 +270,8 @@ static int codec_adapter_prepare(struct comp_dev *dev) return 0; } -static int codec_adapter_params(struct comp_dev *dev, - struct sof_ipc_stream_params *params) +int codec_adapter_params(struct comp_dev *dev, + struct sof_ipc_stream_params *params) { int ret; struct comp_data *cd = comp_get_drvdata(dev); @@ -363,7 +359,7 @@ static void generate_zeroes(struct comp_buffer *sink, uint32_t bytes) comp_update_buffer_produce(sink, bytes); } -static int codec_adapter_copy(struct comp_dev *dev) +int codec_adapter_copy(struct comp_dev *dev) { int ret = 0; uint32_t bytes_to_process, copy_bytes, processed = 0, produced = 0; @@ -639,8 +635,8 @@ static int codec_adapter_ctrl_set_data(struct comp_dev *dev, } /* Used to pass standard and bespoke commands (with data) to component */ -static int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, - int max_data_size) +int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, + int max_data_size) { int ret; struct sof_ipc_ctrl_data *cdata = data; @@ -665,14 +661,14 @@ static int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, return ret; } -static int codec_adapter_trigger(struct comp_dev *dev, int cmd) +int codec_adapter_trigger(struct comp_dev *dev, int cmd) { comp_dbg(dev, "codec_adapter_trigger(): component got trigger cmd %x", cmd); return comp_set_state(dev, cmd); } -static int codec_adapter_reset(struct comp_dev *dev) +int codec_adapter_reset(struct comp_dev *dev) { int ret; struct comp_data *cd = comp_get_drvdata(dev); @@ -692,7 +688,7 @@ static int codec_adapter_reset(struct comp_dev *dev) return comp_set_state(dev, COMP_TRIGGER_RESET); } -static void codec_adapter_free(struct comp_dev *dev) +void codec_adapter_free(struct comp_dev *dev) { int ret; struct comp_data *cd = comp_get_drvdata(dev); @@ -708,31 +704,3 @@ static void codec_adapter_free(struct comp_dev *dev) rfree(cd); rfree(dev); } - -static const struct comp_driver comp_codec_adapter = { - .type = SOF_COMP_NONE, - .uid = SOF_RT_UUID(ca_uuid), - .tctx = &ca_tr, - .ops = { - .create = codec_adapter_new, - .prepare = codec_adapter_prepare, - .params = codec_adapter_params, - .copy = codec_adapter_copy, - .cmd = codec_adapter_cmd, - .trigger = codec_adapter_trigger, - .reset = codec_adapter_reset, - .free = codec_adapter_free, - }, -}; - -static SHARED_DATA struct comp_driver_info comp_codec_adapter_info = { - .drv = &comp_codec_adapter, -}; - -UT_STATIC void sys_comp_codec_adapter_init(void) -{ - comp_register(platform_shared_get(&comp_codec_adapter_info, - sizeof(comp_codec_adapter_info))); -} - -DECLARE_MODULE(sys_comp_codec_adapter_init); diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index c2b48596c0df..2609445dc33c 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -13,6 +13,8 @@ #define __SOF_AUDIO_CODEC_GENERIC__ #include +#include +#include #define comp_get_codec(d) (&(((struct comp_data *)((d)->priv_data))->codec)) #define CODEC_GET_INTERFACE_ID(id) ((id) >> 0x8) @@ -25,6 +27,41 @@ (value)); \ } while (0) +#define DECLARE_CODEC_ADAPTER(adapter, uuid, tr) \ +static struct comp_dev *adapter_shim_new(const struct comp_driver *drv, \ + struct sof_ipc_comp *comp)\ +{ \ + return codec_adapter_new(drv, comp, &(adapter));\ +} \ +\ +static const struct comp_driver comp_codec_adapter = { \ + .type = SOF_COMP_NONE, \ + .uid = SOF_RT_UUID(uuid), \ + .tctx = &(tr), \ + .ops = { \ + .create = adapter_shim_new, \ + .prepare = codec_adapter_prepare, \ + .params = codec_adapter_params, \ + .copy = codec_adapter_copy, \ + .cmd = codec_adapter_cmd, \ + .trigger = codec_adapter_trigger, \ + .reset = codec_adapter_reset, \ + .free = codec_adapter_free, \ + }, \ +}; \ +\ +static SHARED_DATA struct comp_driver_info comp_codec_adapter_info = { \ + .drv = &comp_codec_adapter, \ +}; \ +\ +UT_STATIC void sys_comp_codec_##adapter_init(void) \ +{ \ + comp_register(platform_shared_get(&comp_codec_adapter_info, \ + sizeof(comp_codec_adapter_info))); \ +} \ +\ +DECLARE_MODULE(sys_comp_codec_##adapter_init) + /*****************************************************************************/ /* Codec generic data types */ /*****************************************************************************/ @@ -205,7 +242,7 @@ struct comp_data { /*****************************************************************************/ int codec_load_config(struct comp_dev *dev, void *cfg, size_t size, enum codec_cfg_type type); -int codec_init(struct comp_dev *dev); +int codec_init(struct comp_dev *dev, struct codec_interface *interface); void *codec_allocate_memory(struct comp_dev *dev, uint32_t size, uint32_t alignment); int codec_free_memory(struct comp_dev *dev, void *ptr); @@ -217,4 +254,15 @@ int codec_apply_runtime_config(struct comp_dev *dev); int codec_reset(struct comp_dev *dev); int codec_free(struct comp_dev *dev); +struct comp_dev *codec_adapter_new(const struct comp_driver *drv, + struct sof_ipc_comp *comp, + struct codec_interface *interface); +int codec_adapter_prepare(struct comp_dev *dev); +int codec_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params); +int codec_adapter_copy(struct comp_dev *dev); +int codec_adapter_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_size); +int codec_adapter_trigger(struct comp_dev *dev, int cmd); +void codec_adapter_free(struct comp_dev *dev); +int codec_adapter_reset(struct comp_dev *dev); + #endif /* __SOF_AUDIO_CODEC_GENERIC__ */ diff --git a/src/include/sof/audio/codec_adapter/interfaces.h b/src/include/sof/audio/codec_adapter/interfaces.h deleted file mode 100644 index dfc4a4ce0d15..000000000000 --- a/src/include/sof/audio/codec_adapter/interfaces.h +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2020 Intel Corporation. All rights reserved. - * - * - * \file interfaces.h - * \brief Description of supported codecs - * \author Marcin Rajwa - * - */ -#ifndef __SOF_AUDIO_CODEC_INTERFACES__ -#define __SOF_AUDIO_CODEC_INTERFACES__ - -#if CONFIG_CADENCE_CODEC -#include -#endif /* CONFIG_CADENCE_CODEC */ - -#if CONFIG_PASSTHROUGH_CODEC -#include -#endif - -#if CONFIG_WAVES_CODEC -#include -#endif - -#define CADENCE_ID 0xCADE01 -#define PASSTHROUGH_ID 0xD03311 -#define WAVES_ID 0x574101 - -/*****************************************************************************/ -/* Linked codecs interfaces */ -/*****************************************************************************/ -static struct codec_interface interfaces[] = { -#if CONFIG_CADENCE_CODEC - { - .id = CADENCE_ID, /**< Cadence interface */ - .init = cadence_codec_init, - .prepare = cadence_codec_prepare, - .init_process = cadence_codec_init_process, - .process = cadence_codec_process, - .apply_config = cadence_codec_apply_config, - .reset = cadence_codec_reset, - .free = cadence_codec_free - }, -#endif /* CONFIG_CADENCE_CODEC */ - -#ifdef CONFIG_PASSTHROUGH_CODEC - { - .id = PASSTHROUGH_ID, /** passthrough interface */ - .init = passthrough_codec_init, - .prepare = passthrough_codec_prepare, - .init_process = passthrough_codec_init_process, - .process = passthrough_codec_process, - .apply_config = passthrough_codec_apply_config, - .reset = passthrough_codec_reset, - .free = passthrough_codec_free - }, -#endif /* CONFIG_PASSTHROUGH_CODEC */ - -#if CONFIG_WAVES_CODEC - { - .id = WAVES_ID, - .init = waves_codec_init, - .prepare = waves_codec_prepare, - .init_process = waves_codec_init_process, - .process = waves_codec_process, - .apply_config = waves_codec_apply_config, - .reset = waves_codec_reset, - .free = waves_codec_free - }, -#endif /* CONFIG_WAVES_CODEC */ -}; - -#endif /* __SOF_AUDIO_CODEC_INTERFACES__ */ From ffd5711a2c5418b73ec07c1b738f568b5dbb877b Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 5 Apr 2021 12:23:11 +0300 Subject: [PATCH 3/3] topology: codec_adapter: Prepare switching to shimmed CA interface Each codec family is now having its own UUID. We keep the old codec_adapter UUID to be used with Cadence family codecs. All other codec families (e.g passthrough, waves) needs to use new uuids. The topology files will just need to define CA_UID macro. e.g for waves codec, topology file should contain: DECLARE_SOF_RT_UUID("Waves codec", waves_codec_uuid, 0xd944281a, 0xafe9, 0x4695, 0xa0, 0x43, 0xd7, 0xf6, 0x2b, 0x89, 0x53, 0x8e); define(`CA_UUID', cadence_codec_uuid) Signed-off-by: Daniel Baluta --- tools/topology/m4/codec_adapter.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/topology/m4/codec_adapter.m4 b/tools/topology/m4/codec_adapter.m4 index c5e932433731..8387867e2ef5 100644 --- a/tools/topology/m4/codec_adapter.m4 +++ b/tools/topology/m4/codec_adapter.m4 @@ -4,6 +4,8 @@ dnl Define macro for CODEC_ADAPTER widget DECLARE_SOF_RT_UUID("codec_adapter", ca_uuid, 0xd8218443, 0x5ff3, 0x4a4c, 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa); +ifdef(`CA_UUID', `', `define(`CA_UUID', ca_uuid)'); + dnl N_CODEC_ADAPTER(name) define(`N_CODEC_ADAPTER', `CODEC_ADAPTER'PIPELINE_ID`.'$1) @@ -12,7 +14,7 @@ define(`W_CODEC_ADAPTER', `SectionVendorTuples."'N_CODEC_ADAPTER($1)`_tuples_uuid" {' ` tokens "sof_comp_tokens"' ` tuples."uuid" {' -` SOF_TKN_COMP_UUID' STR(ca_uuid) +` SOF_TKN_COMP_UUID' STR(CA_UUID) ` }' `}' `SectionData."'N_CODEC_ADAPTER($1)`_data_uuid" {'