Skip to content

Commit f86ad4f

Browse files
lyakhlgirdwood
authored andcommitted
eq-iir: convert to a loadable module
Build eq-iir as a loadable llext module. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 753e363 commit f86ad4f

10 files changed

Lines changed: 66 additions & 7 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONFIG_SAMPLE_SMART_AMP=m
22
CONFIG_COMP_MIXIN_MIXOUT=m
3+
CONFIG_COMP_IIR=m

src/audio/eq_iir/Kconfig

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
config COMP_IIR
4-
bool "IIR component"
4+
tristate "IIR component"
55
select COMP_BLOB
66
default y
77
depends on COMP_MODULE_ADAPTER

src/audio/eq_iir/eq_iir.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,23 @@ static const struct module_interface eq_iir_interface = {
257257

258258
DECLARE_MODULE_ADAPTER(eq_iir_interface, eq_iir_uuid, eq_iir_tr);
259259
SOF_MODULE_INIT(eq_iir, sys_comp_module_eq_iir_interface_init);
260+
261+
#if CONFIG_COMP_IIR_MODULE
262+
/* modular: llext dynamic link */
263+
264+
#include <module/module/api_ver.h>
265+
#include <rimage/sof/user/manifest.h>
266+
267+
#include <module/module/llext.h>
268+
269+
#define UUID_EQIIR 0xE6, 0xC0, 0x50, 0x51, 0xF9, 0x27, 0xC8, 0x4E, \
270+
0x83, 0x51, 0xC7, 0x05, 0xB6, 0x42, 0xD1, 0x2F
271+
272+
SOF_LLEXT_MOD_ENTRY(eq_iir, &eq_iir_interface);
273+
274+
static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
275+
SOF_LLEXT_MODULE_MANIFEST("EQIIR", eq_iir_llext_entry, 1, UUID_EQIIR);
276+
277+
SOF_LLEXT_BUILDINFO;
278+
279+
#endif

src/audio/eq_iir/eq_iir.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
REM # eq iir module config
26
[[module.entry]]
37
name = "EQIIR"
48
uuid = "5150C0E6-27F9-4EC8-8351-C705B642D12F"
59
affinity_mask = "0x1"
610
instance_count = "40"
711
domain_types = "0"
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+
# Hard-coded .text address to be moved to a common place
5+
sof_llext_build("eq_iir"
6+
SOURCES ../eq_iir.c
7+
../eq_iir_ipc4.c
8+
../eq_iir_generic.c
9+
TEXT_ADDR 0xa06ea000
10+
)
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 "../eq_iir.toml"
4+
5+
[module]
6+
count = __COUNTER__

src/math/iir_df1.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <stddef.h>
1313
#include <stdint.h>
1414

15+
#include <rtos/symbol.h>
16+
1517
int iir_delay_size_df1(struct sof_eq_iir_header *config)
1618
{
1719
int n = config->num_sections; /* One section uses two unit delays */
@@ -21,6 +23,7 @@ int iir_delay_size_df1(struct sof_eq_iir_header *config)
2123

2224
return 4 * n * sizeof(int32_t);
2325
}
26+
EXPORT_SYMBOL(iir_delay_size_df1);
2427

2528
int iir_init_coef_df1(struct iir_state_df1 *iir,
2629
struct sof_eq_iir_header *config)
@@ -31,6 +34,7 @@ int iir_init_coef_df1(struct iir_state_df1 *iir,
3134

3235
return 0;
3336
}
37+
EXPORT_SYMBOL(iir_init_coef_df1);
3438

3539
void iir_init_delay_df1(struct iir_state_df1 *iir, int32_t **delay)
3640
{
@@ -40,6 +44,7 @@ void iir_init_delay_df1(struct iir_state_df1 *iir, int32_t **delay)
4044
/* Point to next IIR delay line start. */
4145
*delay += 4 * iir->biquads;
4246
}
47+
EXPORT_SYMBOL(iir_init_delay_df1);
4348

4449
void iir_reset_df1(struct iir_state_df1 *iir)
4550
{
@@ -50,3 +55,4 @@ void iir_reset_df1(struct iir_state_df1 *iir)
5055
* omitting setting iir->delay to NULL.
5156
*/
5257
}
58+
EXPORT_SYMBOL(iir_reset_df1);

src/math/iir_df1_generic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <sof/math/iir_df1.h>
1212
#include <user/eq.h>
1313

14+
#include <rtos/symbol.h>
15+
1416
#if SOF_USE_HIFI(NONE, FILTER)
1517

1618
/*
@@ -105,5 +107,6 @@ int32_t iir_df1(struct iir_state_df1 *iir, int32_t x)
105107
}
106108
return sat_int32(out);
107109
}
110+
EXPORT_SYMBOL(iir_df1);
108111

109112
#endif

src/math/iir_df1_hifi3.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <user/eq.h>
1313
#include <sof/common.h>
1414

15+
#include <rtos/symbol.h>
16+
1517
#if SOF_USE_HIFI(3, FILTER) || SOF_USE_HIFI(4, FILTER)
1618

1719
/*
@@ -122,5 +124,6 @@ int32_t iir_df1(struct iir_state_df1 *iir, int32_t x)
122124
}
123125
return out;
124126
}
127+
EXPORT_SYMBOL(iir_df1);
125128

126129
#endif

zephyr/CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,17 @@ elseif(CONFIG_IPC_MAJOR_4)
530530
${SOF_AUDIO_PATH}/eq_fir/eq_fir_ipc4.c
531531
)
532532

533-
zephyr_library_sources_ifdef(CONFIG_COMP_IIR
534-
${SOF_AUDIO_PATH}/eq_iir/eq_iir.c
535-
${SOF_AUDIO_PATH}/eq_iir/eq_iir_ipc4.c
536-
${SOF_AUDIO_PATH}/eq_iir/eq_iir_generic.c
537-
)
533+
if(CONFIG_COMP_IIR STREQUAL "m")
534+
add_subdirectory(${SOF_AUDIO_PATH}/eq_iir/llext
535+
${PROJECT_BINARY_DIR}/eq_iir_llext)
536+
add_dependencies(app eq_iir)
537+
elseif(CONFIG_COMP_IIR)
538+
zephyr_library_sources(
539+
${SOF_AUDIO_PATH}/eq_iir/eq_iir.c
540+
${SOF_AUDIO_PATH}/eq_iir/eq_iir_ipc4.c
541+
${SOF_AUDIO_PATH}/eq_iir/eq_iir_generic.c
542+
)
543+
endif()
538544
endif()
539545

540546
zephyr_library_sources_ifdef(CONFIG_MATH_FIR

0 commit comments

Comments
 (0)