Skip to content

Commit

Permalink
tdfb: enable building as an llext module
Browse files Browse the repository at this point in the history
Add support for LLEXT building to tdfb.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Sep 4, 2024
1 parent 077cb70 commit 27edbae
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/overlays/lnl/module_overlay.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_TDFB=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
Expand Down
1 change: 1 addition & 0 deletions app/overlays/mtl/module_overlay.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_TDFB=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
Expand Down
3 changes: 2 additions & 1 deletion src/audio/tdfb/Kconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_TDFB
bool "TDFB component"
tristate "TDFB component"
depends on COMP_MODULE_ADAPTER
select MATH_FIR
select MATH_IIR_DF1
select SQRT_FIXED
select CORDIC_FIXED
select COMP_BLOB
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for time domain fixed beamformer (TDFB) component. The
Expand Down
11 changes: 11 additions & 0 deletions src/audio/tdfb/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("tdfb"
SOURCES ../tdfb.c
../tdfb_direction.c
../tdfb_generic.c
../tdfb_hifiep.c
../tdfb_hifi3.c
../tdfb_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/tdfb/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../tdfb.toml"

[module]
count = __COUNTER__
23 changes: 21 additions & 2 deletions src/audio/tdfb/tdfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static int tdfb_free(struct processing_module *mod)
{
struct tdfb_comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "tdfb_free()");
comp_dbg(mod->dev, "tdfb_free()");

ipc_msg_free(cd->msg);
tdfb_free_delaylines(cd);
Expand Down Expand Up @@ -797,7 +797,7 @@ static int tdfb_reset(struct processing_module *mod)
struct tdfb_comp_data *cd = module_get_private_data(mod);
int i;

comp_info(mod->dev, "tdfb_reset()");
comp_dbg(mod->dev, "tdfb_reset()");

tdfb_free_delaylines(cd);

Expand All @@ -824,3 +824,22 @@ static const struct module_interface tdfb_interface = {

DECLARE_MODULE_ADAPTER(tdfb_interface, tdfb_uuid, tdfb_tr);
SOF_MODULE_INIT(tdfb, sys_comp_module_tdfb_interface_init);

#if CONFIG_COMP_TDFB_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_TDFB 0x49, 0x17, 0x51, 0xdd, 0xfa, 0xd9, 0x5c, 0x45, 0xb3, 0xa7, \
0x13, 0x58, 0x56, 0x93, 0xf1, 0xaf

SOF_LLEXT_MOD_ENTRY(tdfb, &tdfb_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("TDFB", tdfb_llext_entry, 1, UUID_TDFB, 40);

SOF_LLEXT_BUILDINFO;

#endif
6 changes: 5 additions & 1 deletion src/audio/tdfb/tdfb.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # TDFB module config
[[module.entry]]
name = "TDFB"
uuid = "DD511749-D9FA-455C-B3A7-13585693F1AF"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
init_config = "1"
module_type = "9"
auto_start = "0"
Expand Down
22 changes: 14 additions & 8 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -937,14 +937,20 @@ zephyr_library_sources_ifdef(CONFIG_COMP_RTNR_STUB
${SOF_AUDIO_PATH}/rtnr/rtnr_stub.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_TDFB
${SOF_AUDIO_PATH}/tdfb/tdfb.c
${SOF_AUDIO_PATH}/tdfb/tdfb_direction.c
${SOF_AUDIO_PATH}/tdfb/tdfb_generic.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifiep.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifi3.c
${SOF_AUDIO_PATH}/tdfb/tdfb_${ipc_suffix}.c
)
if(CONFIG_COMP_TDFB STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/tdfb/llext
${PROJECT_BINARY_DIR}/tdfb_llext)
add_dependencies(app tdfb)
elseif(CONFIG_COMP_TDFB)
zephyr_library_sources(
${SOF_AUDIO_PATH}/tdfb/tdfb.c
${SOF_AUDIO_PATH}/tdfb/tdfb_direction.c
${SOF_AUDIO_PATH}/tdfb/tdfb_generic.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifiep.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifi3.c
${SOF_AUDIO_PATH}/tdfb/tdfb_${ipc_suffix}.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_SQRT_FIXED
${SOF_MATH_PATH}/sqrt_int16.c
Expand Down

0 comments on commit 27edbae

Please sign in to comment.