asrc: enable building as an llext module

Add support for LLEXT building to asrc.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2024-06-03 11:50:42 +02:00 committed by Kai Vehmanen
parent ed65e22943
commit 5c025b0d9d
8 changed files with 58 additions and 15 deletions

View File

@ -4,4 +4,5 @@ CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_VOLUME=m

View File

@ -4,4 +4,5 @@ CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ASRC=m
CONFIG_COMP_VOLUME=m

View File

@ -1,7 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause
config COMP_ASRC
bool "ASRC component"
tristate "ASRC component"
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for Asynchronous sample rate conversion (ASRC)
@ -14,7 +15,7 @@ config COMP_ASRC
not have pre-computed filter coefficients for every
conversion fraction that SRC does.
if COMP_ASRC
if COMP_ASRC != n
rsource "Kconfig.simd"

View File

@ -318,7 +318,7 @@ static int asrc_free(struct processing_module *mod)
struct comp_data *cd = module_get_private_data(mod);
struct comp_dev *dev = mod->dev;
comp_info(dev, "asrc_free()");
comp_dbg(dev, "asrc_free()");
rfree(cd->buf);
asrc_release_buffers(cd->asrc_obj);
@ -850,8 +850,7 @@ static int asrc_reset(struct processing_module *mod)
struct comp_dev *dev = mod->dev;
struct comp_data *cd = module_get_private_data(mod);
comp_info(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);
comp_dbg(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max);
/* If any resources feasible to stop */
if (cd->track_drift)
@ -879,3 +878,21 @@ static const struct module_interface asrc_interface = {
DECLARE_MODULE_ADAPTER(asrc_interface, ASRC_UUID, asrc_tr);
SOF_MODULE_INIT(asrc, sys_comp_module_asrc_interface_init);
#if CONFIG_COMP_ASRC_MODULE
/* modular: llext dynamic link */
#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>
#define UUID_ASRC 0x2d, 0x40, 0xb4, 0x66, 0x68, 0xb4, 0xf2, 0x42, \
0x81, 0xa7, 0xb3, 0x71, 0x21, 0x86, 0x3d, 0xd4
SOF_LLEXT_MOD_ENTRY(asrc, &asrc_interface);
static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_MODULE_MANIFEST("ASRC", asrc_llext_entry, 1, UUID_ASRC, 2),
};
SOF_LLEXT_BUILDINFO;
#endif

View File

@ -1,3 +1,7 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif
[[module.entry]]
name = "ASRC"
uuid = "66B4402D-B468-42F2-81A7-B37121863DD4"
@ -5,7 +9,7 @@
instance_count = "2"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]

View File

@ -0,0 +1,10 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0
sof_llext_build("asrc"
SOURCES ../asrc.c
../asrc_farrow_hifi3.c
../asrc_farrow.c
../asrc_farrow_generic.c
../asrc_ipc4.c
)

View File

@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../asrc.toml"
[module]
count = __COUNTER__

View File

@ -612,15 +612,18 @@ zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T
${SOF_MATH_PATH}/iir_df2t.c
)
zephyr_library_sources_ifdef(CONFIG_COMP_ASRC
${SOF_AUDIO_PATH}/asrc/asrc.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c
)
if(CONFIG_COMP_ASRC)
zephyr_library_sources(${SOF_AUDIO_PATH}/asrc/asrc_${ipc_suffix}.c)
if(CONFIG_COMP_ASRC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext
${PROJECT_BINARY_DIR}/asrc_llext)
add_dependencies(app asrc)
elseif(CONFIG_COMP_ASRC)
zephyr_library_sources(
${SOF_AUDIO_PATH}/asrc/asrc.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow.c
${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c
${SOF_AUDIO_PATH}/asrc/asrc_${ipc_suffix}.c
)
endif()
zephyr_library_sources_ifdef(CONFIG_COMP_DCBLOCK