Skip to content

Commit a26f83c

Browse files
joechengxperilgirdwood
authored andcommitted
module_adapter:dts: support module life cycle change
1. Add a free memory function to support PR#6230 and PR#6331, the latest prepare/reset API flow update of module_adapter. 2. This requires DTS library v1.0.7 to support this change. Signed-off-by: Joe.Cheng <joe.cheng@xperi.com>
1 parent 76c8509 commit a26f83c

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/audio/module_adapter/module/dts.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ static void *dts_effect_allocate_codec_memory(void *mod_void, unsigned int lengt
3434
return pMem;
3535
}
3636

37+
static void dts_effect_free_codec_memory(void *mod_void, void *pMem)
38+
{
39+
struct processing_module *mod = mod_void;
40+
struct comp_dev *dev = mod->dev;
41+
42+
comp_dbg(dev, "dts_effect_free_codec_memory() start");
43+
44+
int ret = module_free_memory(mod, pMem);
45+
46+
if (ret)
47+
comp_err(dev, "dts_effect_free_codec_memory() module_free_memory failed %d", ret);
48+
49+
comp_dbg(dev, "dts_effect_free_codec_memory() done");
50+
}
51+
3752
static int dts_effect_convert_sof_interface_result(struct comp_dev *dev,
3853
DtsSofInterfaceResult dts_result)
3954
{
@@ -136,7 +151,7 @@ static int dts_codec_init(struct processing_module *mod)
136151
comp_dbg(dev, "dts_codec_init() start");
137152

138153
dts_result = dtsSofInterfaceInit((DtsSofInterfaceInst **)&(codec->private),
139-
dts_effect_allocate_codec_memory, mod);
154+
dts_effect_allocate_codec_memory, dts_effect_free_codec_memory, mod);
140155
ret = dts_effect_convert_sof_interface_result(dev, dts_result);
141156

142157
if (ret)

src/include/sof/audio/dts/DtsSofInterface.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ typedef struct DtsSofInterfaceBufferConfiguration
5858
} DtsSofInterfaceBufferConfiguration;
5959

6060
typedef void* (*DtsSofInterfaceAllocateMemory)(
61-
void* pMemoryAllocationContext,
62-
unsigned int length,
63-
unsigned int alignment);
61+
void *pMemoryAllocationContext,
62+
unsigned int length,
63+
unsigned int alignment);
64+
65+
typedef void (*DtsSofInterfaceFreeMemory)(void *pMemoryAllocationContext, void *pMemory);
6466

6567
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceInit(
66-
DtsSofInterfaceInst** ppInst,
67-
DtsSofInterfaceAllocateMemory pMemoryAllocationFn,
68-
void* MemoryAllocationContext) DTS_SOF_INTERFACE_NOEXCEPT;
68+
DtsSofInterfaceInst **ppInst,
69+
DtsSofInterfaceAllocateMemory pMemoryAllocationFn,
70+
DtsSofInterfaceFreeMemory pMemoryFreeFn,
71+
void *MemoryAllocationContext) DTS_SOF_INTERFACE_NOEXCEPT;
6972

7073
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfacePrepare(
7174
DtsSofInterfaceInst* pInst,

src/include/sof/audio/dts/DtsSofInterfaceVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define DTS_SOF_INTERFACE_PRODUCT_NAME "DtsSofInterface"
1010
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_MAJOR 1
1111
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_MINOR 0
12-
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_PATCH 1
12+
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_PATCH 7
1313
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_BUILD 0
1414
#define DTS_SOF_INTERFACE_PRODUCT_VERSION_EXTRA "Dev"
1515

0 commit comments

Comments
 (0)