Skip to content

Commit

Permalink
mux: enable building as an llext module
Browse files Browse the repository at this point in the history
Add support for LLEXT building to mux.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh authored and kv2019i committed Sep 18, 2024
1 parent 99a35a1 commit 3659b69
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 15 deletions.
1 change: 1 addition & 0 deletions app/configs/lnl/modules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_MUX=m
CONFIG_COMP_SEL=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ARIA=m
Expand Down
1 change: 1 addition & 0 deletions app/configs/mtl/modules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CONFIG_COMP_MIXIN_MIXOUT=m
CONFIG_COMP_FIR=m
CONFIG_COMP_IIR=m
CONFIG_COMP_DRC=m
CONFIG_COMP_MUX=m
CONFIG_COMP_SEL=m
CONFIG_COMP_SRC=m
CONFIG_COMP_ARIA=m
Expand Down
2 changes: 1 addition & 1 deletion src/audio/mux/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_MUX
bool "MUX component"
tristate "MUX component"
select COMP_BLOB
depends on COMP_MODULE_ADAPTER
default y
Expand Down
8 changes: 8 additions & 0 deletions src/audio/mux/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("mux"
SOURCES ../mux.c
../mux_generic.c
../mux_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/mux/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 "../mux.toml"

[module]
count = __COUNTER__
25 changes: 22 additions & 3 deletions src/audio/mux/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
// Artur Kloniecki <arturx.kloniecki@linux.intel.com>

#if CONFIG_COMP_MUX

#include <sof/audio/module_adapter/module/generic.h>
#include <sof/audio/component.h>
#include <sof/audio/data_blob.h>
Expand Down Expand Up @@ -486,4 +484,25 @@ static const struct module_interface demux_interface = {
DECLARE_MODULE_ADAPTER(demux_interface, demux_uuid, demux_tr);
SOF_MODULE_INIT(demux, sys_comp_module_demux_interface_init);

#endif /* CONFIG_COMP_MUX */
#if CONFIG_COMP_VOLUME_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_MUX 0x35, 0x6E, 0xCE, 0x64, 0x7A, 0x85, 0x78, 0x48, 0xE8, 0xAC, \
0xE2, 0xA2, 0xF4, 0x2E, 0x30, 0x69
SOF_LLEXT_MOD_ENTRY(mux, &mux_interface);

#define UUID_DEMUX 0x68, 0x68, 0xB2, 0xC4, 0x30, 0x14, 0x0E, 0x47, 0x89, 0xA0, \
0x15, 0xD1, 0xC7, 0x7F, 0x85, 0x1A
SOF_LLEXT_MOD_ENTRY(demux, &demux_interface);

static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_MODULE_MANIFEST("MUX", mux_llext_entry, 1, UUID_MUX, 15),
SOF_LLEXT_MODULE_MANIFEST("DEMUX", demux_llext_entry, 1, UUID_DEMUX, 15),
};

SOF_LLEXT_BUILDINFO;
#endif
4 changes: 0 additions & 4 deletions src/audio/mux/mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#ifndef __SOF_AUDIO_MUX_H__
#define __SOF_AUDIO_MUX_H__

#if CONFIG_COMP_MUX

#include <sof/audio/module_adapter/module/generic.h>
#include <sof/common.h>
#include <sof/platform.h>
Expand Down Expand Up @@ -230,6 +228,4 @@ int mux_params(struct processing_module *mod);
#endif
extern const struct sof_uuid MUX_UUID;

#endif /* CONFIG_COMP_MUX */

#endif /* __SOF_AUDIO_MUX_H__ */
8 changes: 6 additions & 2 deletions src/audio/mux/mux.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "MUX"
uuid = "64ce6e35-857a-4878-ace8-e2a2f42e3069"
uuid = "64CE6E35-857A-4878-ACE8-E2A2F42E3069"
affinity_mask = "0x1"
instance_count = "15"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "6"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
16 changes: 11 additions & 5 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1005,11 +1005,17 @@ zephyr_library_sources_ifdef(CONFIG_COMP_UP_DOWN_MIXER
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer_hifi3.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_MUX
${SOF_AUDIO_PATH}/mux/mux.c
${SOF_AUDIO_PATH}/mux/mux_generic.c
${SOF_AUDIO_PATH}/mux/mux_${ipc_suffix}.c
)
if(CONFIG_COMP_MUX STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/mux/llext
${PROJECT_BINARY_DIR}/mux_llext)
add_dependencies(app mux)
elseif(CONFIG_COMP_MUX)
zephyr_library_sources_ifdef(CONFIG_COMP_MUX
${SOF_AUDIO_PATH}/mux/mux.c
${SOF_AUDIO_PATH}/mux/mux_generic.c
${SOF_AUDIO_PATH}/mux/mux_${ipc_suffix}.c
)
endif()

if(CONFIG_COMP_MFCC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/mfcc/llext
Expand Down

0 comments on commit 3659b69

Please sign in to comment.