Skip to content

Commit

Permalink
drc: enable building as an llext module
Browse files Browse the repository at this point in the history
Add support for LLEXT building to drc. Since multiband DRC calls
functions from DRC, we cannot so far build it if DRC is configured as
a module. In the future it should be possible to build both as
modules and to export symbols between them.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Jun 18, 2024
1 parent 360a030 commit 52968d0
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/overlays/lnl/module_overlay.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ CONFIG_COMP_IIR=m
CONFIG_COMP_FIR=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_DRC=m
1 change: 1 addition & 0 deletions app/overlays/mtl/module_overlay.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ CONFIG_COMP_IIR=m
CONFIG_COMP_FIR=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_DRC=m
2 changes: 1 addition & 1 deletion src/audio/drc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
rsource "Kconfig.simd"

config COMP_DRC
bool "Dynamic Range Compressor component"
tristate "Dynamic Range Compressor component"
select CORDIC_FIXED
select MATH_LUT_SINE_FIXED
select NUMBERS_NORM
Expand Down
19 changes: 19 additions & 0 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,22 @@ static const struct module_interface drc_interface = {

DECLARE_MODULE_ADAPTER(drc_interface, drc_uuid, drc_tr);
SOF_MODULE_INIT(drc, sys_comp_module_drc_interface_init);

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

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

#define UUID_DRC 0xda, 0xe4, 0x6e, 0xb3, 0x6f, 0x00, 0xf9, 0x47, \
0xa0, 0x6d, 0xfe, 0xcb, 0xe2, 0xd8, 0xb6, 0xce

SOF_LLEXT_MOD_ENTRY(drc, &drc_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("DRC", drc_llext_entry, 1, UUID_DRC, 40);

SOF_LLEXT_BUILDINFO;

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

REM # DRC module config
[[module.entry]]
name = "DRC"
uuid = "B36EE4DA-006F-47F9-A06D-FECBE2D8B6CE"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
11 changes: 11 additions & 0 deletions src/audio/drc/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("drc"
SOURCES ../drc.c
../drc_generic.c
../drc_math_generic.c
../drc_hifi3.c
../drc_hifi4.c
../drc_math_hifi3.c
)
6 changes: 6 additions & 0 deletions src/audio/drc/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 "../drc.toml"

[module]
count = __COUNTER__
2 changes: 1 addition & 1 deletion src/audio/multiband_drc/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_MULTIBAND_DRC
depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC
depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC = y
bool "Multiband Dynamic Range Compressor component"
select CORDIC_FIXED
select COMP_BLOB
Expand Down
22 changes: 14 additions & 8 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -796,14 +796,20 @@ zephyr_library_sources_ifdef(CONFIG_COMP_CROSSOVER
${SOF_AUDIO_PATH}/crossover/crossover_${ipc_suffix}.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_DRC
${SOF_AUDIO_PATH}/drc/drc.c
${SOF_AUDIO_PATH}/drc/drc_generic.c
${SOF_AUDIO_PATH}/drc/drc_math_generic.c
${SOF_AUDIO_PATH}/drc/drc_hifi3.c
${SOF_AUDIO_PATH}/drc/drc_hifi4.c
${SOF_AUDIO_PATH}/drc/drc_math_hifi3.c
)
if(CONFIG_COMP_DRC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/drc/llext
${PROJECT_BINARY_DIR}/drc_llext)
add_dependencies(app drc)
elseif(CONFIG_COMP_DRC)
zephyr_library_sources(
${SOF_AUDIO_PATH}/drc/drc.c
${SOF_AUDIO_PATH}/drc/drc_generic.c
${SOF_AUDIO_PATH}/drc/drc_math_generic.c
${SOF_AUDIO_PATH}/drc/drc_hifi3.c
${SOF_AUDIO_PATH}/drc/drc_hifi4.c
${SOF_AUDIO_PATH}/drc/drc_math_hifi3.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_COMP_MULTIBAND_DRC
${SOF_AUDIO_PATH}/multiband_drc/multiband_drc.c
Expand Down

0 comments on commit 52968d0

Please sign in to comment.