Skip to content

Commit

Permalink
waves: add support for IPC4 compilation, including as LLEXT
Browse files Browse the repository at this point in the history
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 <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Jan 14, 2025
1 parent 90c0f83 commit 2de290d
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/audio/module_adapter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions src/audio/module_adapter/module/waves/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 6 additions & 0 deletions src/audio/module_adapter/module/waves/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../waves.toml"
[module]
count = __COUNTER__
26 changes: 25 additions & 1 deletion src/audio/module_adapter/module/waves/waves.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

/* d944281a-afe9-4695-a043-d7f62b89538e */
#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
24 changes: 24 additions & 0 deletions src/audio/module_adapter/module/waves/waves.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # waves module config
[[module.entry]]
name = "WAVES"
uuid = "D944281A-AFE9-4695-A043-D7F62B89538E"
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__
4 changes: 4 additions & 0 deletions tools/rimage/config/mtl.toml.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
#include <audio/module_adapter/module/cadence.toml>
#endif

#if defined(CONFIG_WAVES_CODEC) || defined(LLEXT_FORCE_ALL_MODULAR)
#include <audio/module_adapter/module/waves/waves.toml>
#endif

#if defined(CONFIG_COMP_RTNR) || defined(LLEXT_FORCE_ALL_MODULAR)
#include <audio/rtnr/rtnr.toml>
#endif
Expand Down
19 changes: 12 additions & 7 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,18 @@ elseif(CONFIG_DTS_CODEC)
endif()
endif()

zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC
${SOF_AUDIO_PATH}/module_adapter/module/waves/waves.c
)

zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC_STUB
${SOF_AUDIO_PATH}/module_adapter/module/waves/maxx_stub.c
)
if(CONFIG_WAVES_CODEC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/module_adapter/module/waves/llext
${PROJECT_BINARY_DIR}/waves_llext)
add_dependencies(app waves)
elseif(CONFIG_WAVES_CODEC)
zephyr_library_sources(
${SOF_AUDIO_PATH}/module_adapter/module/waves/waves.c
)
zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC_STUB
${SOF_AUDIO_PATH}/module_adapter/module/waves/maxx_stub.c
)
endif()

if(CONFIG_PROBE STREQUAL "m")
add_subdirectory(${SOF_SRC_PATH}/probe/llext
Expand Down

0 comments on commit 2de290d

Please sign in to comment.