Skip to content

Commit 5c025b0

Browse files
lyakhkv2019i
authored andcommitted
asrc: enable building as an llext module
Add support for LLEXT building to asrc. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent ed65e22 commit 5c025b0

8 files changed

Lines changed: 58 additions & 15 deletions

File tree

app/configs/lnl/modules.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ CONFIG_COMP_FIR=m
44
CONFIG_COMP_IIR=m
55
CONFIG_COMP_DRC=m
66
CONFIG_COMP_SRC=m
7+
CONFIG_COMP_ASRC=m
78
CONFIG_COMP_VOLUME=m

app/configs/mtl/modules.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ CONFIG_COMP_FIR=m
44
CONFIG_COMP_IIR=m
55
CONFIG_COMP_DRC=m
66
CONFIG_COMP_SRC=m
7+
CONFIG_COMP_ASRC=m
78
CONFIG_COMP_VOLUME=m

src/audio/asrc/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22

33
config COMP_ASRC
4-
bool "ASRC component"
4+
tristate "ASRC component"
5+
default m if LIBRARY_DEFAULT_MODULAR
56
default y
67
help
78
Select for Asynchronous sample rate conversion (ASRC)
@@ -14,7 +15,7 @@ config COMP_ASRC
1415
not have pre-computed filter coefficients for every
1516
conversion fraction that SRC does.
1617

17-
if COMP_ASRC
18+
if COMP_ASRC != n
1819

1920
rsource "Kconfig.simd"
2021

src/audio/asrc/asrc.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static int asrc_free(struct processing_module *mod)
318318
struct comp_data *cd = module_get_private_data(mod);
319319
struct comp_dev *dev = mod->dev;
320320

321-
comp_info(dev, "asrc_free()");
321+
comp_dbg(dev, "asrc_free()");
322322

323323
rfree(cd->buf);
324324
asrc_release_buffers(cd->asrc_obj);
@@ -850,8 +850,7 @@ static int asrc_reset(struct processing_module *mod)
850850
struct comp_dev *dev = mod->dev;
851851
struct comp_data *cd = module_get_private_data(mod);
852852

853-
comp_info(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);
854-
853+
comp_dbg(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);
855854

856855
/* If any resources feasible to stop */
857856
if (cd->track_drift)
@@ -879,3 +878,21 @@ static const struct module_interface asrc_interface = {
879878

880879
DECLARE_MODULE_ADAPTER(asrc_interface, ASRC_UUID, asrc_tr);
881880
SOF_MODULE_INIT(asrc, sys_comp_module_asrc_interface_init);
881+
882+
#if CONFIG_COMP_ASRC_MODULE
883+
/* modular: llext dynamic link */
884+
885+
#include <module/module/api_ver.h>
886+
#include <module/module/llext.h>
887+
#include <rimage/sof/user/manifest.h>
888+
889+
#define UUID_ASRC 0x2d, 0x40, 0xb4, 0x66, 0x68, 0xb4, 0xf2, 0x42, \
890+
0x81, 0xa7, 0xb3, 0x71, 0x21, 0x86, 0x3d, 0xd4
891+
SOF_LLEXT_MOD_ENTRY(asrc, &asrc_interface);
892+
893+
static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
894+
SOF_LLEXT_MODULE_MANIFEST("ASRC", asrc_llext_entry, 1, UUID_ASRC, 2),
895+
};
896+
897+
SOF_LLEXT_BUILDINFO;
898+
#endif

src/audio/asrc/asrc.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
#ifndef LOAD_TYPE
2+
#define LOAD_TYPE "0"
3+
#endif
4+
15
[[module.entry]]
26
name = "ASRC"
37
uuid = "66B4402D-B468-42F2-81A7-B37121863DD4"
48
affinity_mask = "0x3"
59
instance_count = "2"
610
domain_types = "0"
711

8-
load_type = "0"
12+
load_type = LOAD_TYPE
913
module_type = "9"
1014
auto_start = "0"
1115
sched_caps = [1, 0x00008000]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Intel Corporation.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
sof_llext_build("asrc"
5+
SOURCES ../asrc.c
6+
../asrc_farrow_hifi3.c
7+
../asrc_farrow.c
8+
../asrc_farrow_generic.c
9+
../asrc_ipc4.c
10+
)

src/audio/asrc/llext/llext.toml.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <tools/rimage/config/platform.toml>
2+
#define LOAD_TYPE "2"
3+
#include "../asrc.toml"
4+
5+
[module]
6+
count = __COUNTER__

zephyr/CMakeLists.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,18 @@ zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T
612612
${SOF_MATH_PATH}/iir_df2t.c
613613
)
614614

615-
zephyr_library_sources_ifdef(CONFIG_COMP_ASRC
616-
${SOF_AUDIO_PATH}/asrc/asrc.c
617-
${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c
618-
${SOF_AUDIO_PATH}/asrc/asrc_farrow.c
619-
${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c
620-
)
621-
622-
if(CONFIG_COMP_ASRC)
623-
zephyr_library_sources(${SOF_AUDIO_PATH}/asrc/asrc_${ipc_suffix}.c)
615+
if(CONFIG_COMP_ASRC STREQUAL "m")
616+
add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext
617+
${PROJECT_BINARY_DIR}/asrc_llext)
618+
add_dependencies(app asrc)
619+
elseif(CONFIG_COMP_ASRC)
620+
zephyr_library_sources(
621+
${SOF_AUDIO_PATH}/asrc/asrc.c
622+
${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c
623+
${SOF_AUDIO_PATH}/asrc/asrc_farrow.c
624+
${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c
625+
${SOF_AUDIO_PATH}/asrc/asrc_${ipc_suffix}.c
626+
)
624627
endif()
625628

626629
zephyr_library_sources_ifdef(CONFIG_COMP_DCBLOCK

0 commit comments

Comments
 (0)