Skip to content

Commit 8fd3cc3

Browse files
committed
asrc: enable building as an llext module
Add support for LLEXT building to asrc. Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent ac5b9d5 commit 8fd3cc3

File tree

12 files changed

+86
-24
lines changed

12 files changed

+86
-24
lines changed

app/overlays/lnl/module_overlay.conf

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

app/overlays/mtl/module_overlay.conf

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

src/audio/asrc/CMakeLists.txt

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

33
add_local_sources(sof asrc.c asrc_farrow.c asrc_farrow_generic.c
4-
asrc_farrow_hifi3.c)
4+
asrc_farrow_hifi3.c asrc_log.c)
55

66
if(CONFIG_IPC_MAJOR_3)
77
add_local_sources(sof asrc_ipc3.c)

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: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <stdint.h>
3333
#include "asrc.h"
3434

35-
LOG_MODULE_REGISTER(asrc, CONFIG_SOF_LOG_LEVEL);
35+
LOG_MODULE_DECLARE(asrc, CONFIG_SOF_LOG_LEVEL);
3636

3737
/* In-line functions */
3838

@@ -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]

src/audio/asrc/asrc_ipc3.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include <errno.h>
1717
#include "asrc.h"
1818

19-
SOF_DEFINE_REG_UUID(asrc);
20-
21-
DECLARE_TR_CTX(asrc_tr, SOF_UUID(asrc_uuid), LOG_LEVEL_INFO);
22-
2319
int asrc_dai_configure_timestamp(struct comp_data *cd)
2420
{
2521
if (cd->dai_dev)

src/audio/asrc/asrc_ipc4.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include <errno.h>
1717
#include "asrc.h"
1818

19-
SOF_DEFINE_REG_UUID(asrc4);
20-
21-
DECLARE_TR_CTX(asrc_tr, SOF_UUID(asrc4_uuid), LOG_LEVEL_INFO);
22-
2319
int asrc_dai_configure_timestamp(struct comp_data *cd)
2420
{
2521
if (!cd->dai_dev)

src/audio/asrc/asrc_log.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
//
3+
// Copyright(c) 2024 Intel Corporation.
4+
5+
#include <rtos/symbol.h>
6+
#include <sof/lib/uuid.h>
7+
#include <sof/trace/trace.h>
8+
#include <user/trace.h>
9+
10+
LOG_MODULE_REGISTER(asrc, CONFIG_SOF_LOG_LEVEL);
11+
#if CONFIG_IPC_MAJOR_4
12+
SOF_DEFINE_REG_UUID(asrc4);
13+
DECLARE_TR_CTX(asrc_tr, SOF_UUID(asrc4_uuid), LOG_LEVEL_INFO);
14+
EXPORT_SYMBOL(asrc4_uuid);
15+
#elif CONFIG_IPC_MAJOR_3
16+
SOF_DEFINE_REG_UUID(asrc);
17+
DECLARE_TR_CTX(asrc_tr, SOF_UUID(asrc_uuid), LOG_LEVEL_INFO);
18+
EXPORT_SYMBOL(asrc_uuid);
19+
#endif
20+
EXPORT_SYMBOL(asrc_tr);
21+
EXPORT_SYMBOL(log_const_asrc);
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+
)

0 commit comments

Comments
 (0)