From 69208a20c1ad40010f6713bc93f09e12ad78515b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 4 Jul 2024 12:48:07 +0200 Subject: [PATCH] multiband_drc: enable building as an llext module Add support for LLEXT building to multiband_drc. Signed-off-by: Guennadi Liakhovetski --- src/audio/multiband_drc/Kconfig | 4 ++-- src/audio/multiband_drc/llext/CMakeLists.txt | 8 ++++++++ src/audio/multiband_drc/llext/llext.toml.h | 6 ++++++ src/audio/multiband_drc/multiband_drc.c | 19 +++++++++++++++++++ src/audio/multiband_drc/multiband_drc.toml | 6 +++++- zephyr/CMakeLists.txt | 16 +++++++++++----- 6 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 src/audio/multiband_drc/llext/CMakeLists.txt create mode 100644 src/audio/multiband_drc/llext/llext.toml.h diff --git a/src/audio/multiband_drc/Kconfig b/src/audio/multiband_drc/Kconfig index d9e61c915ccd..5adb668497a4 100644 --- a/src/audio/multiband_drc/Kconfig +++ b/src/audio/multiband_drc/Kconfig @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_MULTIBAND_DRC - depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC = y - bool "Multiband Dynamic Range Compressor component" + depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC + tristate "Multiband Dynamic Range Compressor component" select CORDIC_FIXED select COMP_BLOB default n diff --git a/src/audio/multiband_drc/llext/CMakeLists.txt b/src/audio/multiband_drc/llext/CMakeLists.txt new file mode 100644 index 000000000000..73c0c4136c30 --- /dev/null +++ b/src/audio/multiband_drc/llext/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +sof_llext_build("multiband_drc" + SOURCES ../multiband_drc.c + ../multiband_drc_generic.c + ../multiband_drc_ipc4.c +) diff --git a/src/audio/multiband_drc/llext/llext.toml.h b/src/audio/multiband_drc/llext/llext.toml.h new file mode 100644 index 000000000000..7d5ce873eeb0 --- /dev/null +++ b/src/audio/multiband_drc/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../multiband_drc.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/multiband_drc/multiband_drc.c b/src/audio/multiband_drc/multiband_drc.c index 47c2343912c6..c6cb75bd7cb8 100644 --- a/src/audio/multiband_drc/multiband_drc.c +++ b/src/audio/multiband_drc/multiband_drc.c @@ -419,3 +419,22 @@ static const struct module_interface multiband_drc_interface = { DECLARE_MODULE_ADAPTER(multiband_drc_interface, multiband_drc_uuid, multiband_drc_tr); SOF_MODULE_INIT(multiband_drc, sys_comp_module_multiband_drc_interface_init); + +#if CONFIG_COMP_MULTIBAND_DRC_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_MULTIBAND_DRC 0x56, 0x22, 0x9F, 0x0D, 0x4F, 0x8E, 0xB3, 0x47, 0x48, 0x84, \ + 0x23, 0x9A, 0x33, 0x4F, 0x11, 0x91 + +SOF_LLEXT_MOD_ENTRY(multiband_drc, &multiband_drc_interface); + +static const struct sof_man_module_manifest mod_manifest __section(".module") __used = + SOF_LLEXT_MODULE_MANIFEST("MB_DRC", multiband_drc_llext_entry, 1, UUID_MULTIBAND_DRC, 40); + +SOF_LLEXT_BUILDINFO; + +#endif diff --git a/src/audio/multiband_drc/multiband_drc.toml b/src/audio/multiband_drc/multiband_drc.toml index a60bedd91287..008da93dcef0 100644 --- a/src/audio/multiband_drc/multiband_drc.toml +++ b/src/audio/multiband_drc/multiband_drc.toml @@ -1,3 +1,7 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + REM # Multiband-DRC module config [[module.entry]] name = "MB_DRC" @@ -5,7 +9,7 @@ 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] diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 5cdd825deb21..86248a48c947 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -869,11 +869,17 @@ if(NOT CONFIG_COMP_DRC STREQUAL "n") ) endif() -zephyr_library_sources_ifdef(CONFIG_COMP_MULTIBAND_DRC - ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc.c - ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc_generic.c - ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc_${ipc_suffix}.c -) +if(CONFIG_COMP_MULTIBAND_DRC STREQUAL "m") + add_subdirectory(${SOF_AUDIO_PATH}/multiband_drc/llext + ${PROJECT_BINARY_DIR}/multiband_drc_llext) + add_dependencies(app multiband_drc) +elseif(CONFIG_COMP_MULTIBAND_DRC) + zephyr_library_sources_ifdef(CONFIG_COMP_MULTIBAND_DRC + ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc.c + ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc_generic.c + ${SOF_AUDIO_PATH}/multiband_drc/multiband_drc_${ipc_suffix}.c + ) +endif() zephyr_library_sources_ifdef(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING ${SOF_AUDIO_PATH}/google/google_rtc_audio_processing.c