From 886e5a913903d240126f1251c0d2af6c2513d7f4 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 14 Jan 2025 08:08:32 +0100 Subject: [PATCH] waves: add support for IPC4 compilation, including as LLEXT With this waves can be built as a part of IPC4 configuration - either linked into the base image or as a LLEXT module. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/Kconfig | 3 ++- .../module/waves/llext/CMakeLists.txt | 11 ++++++++ .../module/waves/llext/llext.toml.h | 6 +++++ src/audio/module_adapter/module/waves/waves.c | 26 ++++++++++++++++++- .../module_adapter/module/waves/waves.toml | 24 +++++++++++++++++ tools/rimage/config/mtl.toml.h | 4 +++ zephyr/CMakeLists.txt | 19 +++++++++----- 7 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 src/audio/module_adapter/module/waves/llext/CMakeLists.txt create mode 100644 src/audio/module_adapter/module/waves/llext/llext.toml.h create mode 100644 src/audio/module_adapter/module/waves/waves.toml diff --git a/src/audio/module_adapter/Kconfig b/src/audio/module_adapter/Kconfig index fb646a7f47e6..36c87aa69090 100644 --- a/src/audio/module_adapter/Kconfig +++ b/src/audio/module_adapter/Kconfig @@ -174,8 +174,9 @@ endif # Cadence files specific to PASSTHROUGH base codecs. config WAVES_CODEC - bool "Waves codec" + tristate "Waves codec" select WAVES_CODEC_STUB if COMP_STUBS + default m if LIBRARY_DEFAULT_MODULAR default n help Select to include Waves codec. Waves codec implements MaxxEffect API. diff --git a/src/audio/module_adapter/module/waves/llext/CMakeLists.txt b/src/audio/module_adapter/module/waves/llext/CMakeLists.txt new file mode 100644 index 000000000000..63104b8d71a0 --- /dev/null +++ b/src/audio/module_adapter/module/waves/llext/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2025 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_WAVES_CODEC_STUB) +sof_llext_build("waves" + SOURCES ../waves.c + ../maxx_stub.c +) +else() +message(FATAL_ERROR "Add library linking support in src/audio/module_adapter/module/waves/llext/CMakeLists.txt") +endif() diff --git a/src/audio/module_adapter/module/waves/llext/llext.toml.h b/src/audio/module_adapter/module/waves/llext/llext.toml.h new file mode 100644 index 000000000000..af98b94af57d --- /dev/null +++ b/src/audio/module_adapter/module/waves/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../waves.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/module_adapter/module/waves/waves.c b/src/audio/module_adapter/module/waves/waves.c index 8ea54c8e21ed..eded0fe59e35 100644 --- a/src/audio/module_adapter/module/waves/waves.c +++ b/src/audio/module_adapter/module/waves/waves.c @@ -19,7 +19,9 @@ #define NUM_IO_STREAMS (1) SOF_DEFINE_REG_UUID(waves); + DECLARE_TR_CTX(waves_tr, SOF_UUID(waves_uuid), LOG_LEVEL_INFO); +LOG_MODULE_REGISTER(waves, CONFIG_SOF_LOG_LEVEL); struct waves_codec_data { uint32_t sample_rate; @@ -248,7 +250,8 @@ static int waves_effect_check(struct comp_dev *dev) /* different interleaving is not supported */ if (audio_stream_get_buffer_fmt(src_fmt) != audio_stream_get_buffer_fmt(snk_fmt)) { - comp_err(dev, "waves_effect_check() source %d sink %d buffer format mismatch"); + comp_err(dev, "waves_effect_check() source %d sink %d buffer format mismatch", + audio_stream_get_buffer_fmt(src_fmt), audio_stream_get_buffer_fmt(snk_fmt)); return -EINVAL; } @@ -896,3 +899,24 @@ static const struct module_interface waves_interface = { DECLARE_MODULE_ADAPTER(waves_interface, waves_uuid, waves_tr); SOF_MODULE_INIT(waves, sys_comp_module_waves_interface_init); + +#if CONFIG_WAVES_CODEC_MODULE && CONFIG_WAVES_CODEC_STUB +/* modular: llext dynamic link */ + +#include +#include +#include + +/* d944281a-afe9-4695-a043d7f62b89538e */ +#define UUID_WAVES_CODEC 0x1A, 0x28, 0x44, 0xD9, 0xE9, 0xAF, 0x95, 0x46, \ + 0xA0, 0x43, 0xD7, 0xF6, 0x2B, 0x89, 0x53, 0x8E + +SOF_LLEXT_MOD_ENTRY(waves, &waves_interface); + +static const struct sof_man_module_manifest mod_manifest __section(".module") __used = + SOF_LLEXT_MODULE_MANIFEST("WAVES", waves_llext_entry, + 7, UUID_WAVES_CODEC, 8); + +SOF_LLEXT_BUILDINFO; + +#endif diff --git a/src/audio/module_adapter/module/waves/waves.toml b/src/audio/module_adapter/module/waves/waves.toml new file mode 100644 index 000000000000..34199cca9a34 --- /dev/null +++ b/src/audio/module_adapter/module/waves/waves.toml @@ -0,0 +1,24 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + + REM # waves module config + [[module.entry]] + name = "WAVES" + uuid = "EE6A51DE-B094-42A5-BE6A-93E20B2E8CED" + affinity_mask = "0x1" + instance_count = "4" + domain_types = "0" + load_type = LOAD_TYPE + module_type = "13" + auto_start = "0" + sched_caps = [1, 0x00008000] + + REM # pin = [dir, type, sample rate, size, container, channel-cfg] + pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, + 1, 0, 0xfeef, 0xf, 0xf, 0x1ff] + + REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] + mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0] + + index = __COUNTER__ diff --git a/tools/rimage/config/mtl.toml.h b/tools/rimage/config/mtl.toml.h index eb61190b96fc..90b468efba18 100644 --- a/tools/rimage/config/mtl.toml.h +++ b/tools/rimage/config/mtl.toml.h @@ -134,6 +134,10 @@ #include