Skip to content

Commit

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

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Jun 18, 2024
1 parent 381e812 commit 8e0770b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 10 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 @@ -2,5 +2,6 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_IIR=m
CONFIG_COMP_FIR=m
CONFIG_COMP_SRC=m
CONFIG_COMP_VOLUME=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 @@ -2,5 +2,6 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000
CONFIG_SAMPLE_SMART_AMP=m
CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_IIR=m
CONFIG_COMP_FIR=m
CONFIG_COMP_SRC=m
CONFIG_COMP_VOLUME=m
3 changes: 2 additions & 1 deletion src/audio/eq_fir/Kconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_FIR
bool "FIR component"
tristate "FIR component"
select MATH_FIR
select COMP_BLOB
depends on COMP_MODULE_ADAPTER
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for FIR component. FIR performance can differ between DSP
Expand Down
19 changes: 19 additions & 0 deletions src/audio/eq_fir/eq_fir.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,22 @@ static const struct module_interface eq_fir_interface = {

DECLARE_MODULE_ADAPTER(eq_fir_interface, eq_fir_uuid, eq_fir_tr);
SOF_MODULE_INIT(eq_fir, sys_comp_module_eq_fir_interface_init);

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

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

#define UUID_EQFIR 0xe7, 0x0c, 0xa9, 0x43, 0xa5, 0xf3, 0xdf, 0x41, \
0xac, 0x06, 0xba, 0x98, 0x65, 0x1a, 0xe6, 0xa3

SOF_LLEXT_MOD_ENTRY(eq_fir, &eq_fir_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("EQFIR", eq_fir_llext_entry, 1, UUID_EQFIR, 40);

SOF_LLEXT_BUILDINFO;

#endif
9 changes: 7 additions & 2 deletions src/audio/eq_fir/eq_fir.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # eq fir module config
[[module.entry]]
name = "EQFIR"
uuid = "43A90CE7-f3A5-41Df-AC06-BA98651AE6A3"
uuid = "43A90CE7-F3A5-41DF-AC06-BA98651AE6A3"
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 All @@ -15,6 +19,7 @@
1, 0, 0xfeef, 0xf, 0xf, 0x1ff]

REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
REM # identical for MTL and LNL
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]

index = __COUNTER__
10 changes: 10 additions & 0 deletions src/audio/eq_fir/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("eq_fir"
SOURCES ../eq_fir_hifi3.c
../eq_fir_hifi2ep.c
../eq_fir_generic.c
../eq_fir.c
../eq_fir_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/eq_fir/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 "../eq_fir.toml"

[module]
count = __COUNTER__
20 changes: 13 additions & 7 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,19 @@ elseif(CONFIG_IPC_MAJOR_4)
set(ipc_suffix ipc4)
endif()

zephyr_library_sources_ifdef(CONFIG_COMP_FIR
${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi3.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi2ep.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_generic.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_${ipc_suffix}.c
)
if(CONFIG_COMP_FIR STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/eq_fir/llext
${PROJECT_BINARY_DIR}/eq_fir_llext)
add_dependencies(app eq_iir)
elseif(CONFIG_COMP_FIR)
zephyr_library_sources(
${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi3.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi2ep.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_generic.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir.c
${SOF_AUDIO_PATH}/eq_fir/eq_fir_${ipc_suffix}.c
)
endif()

if(CONFIG_COMP_IIR STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/eq_iir/llext
Expand Down

0 comments on commit 8e0770b

Please sign in to comment.