Skip to content

Commit

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

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Sep 10, 2024
1 parent 440c9f8 commit 3b69e92
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 20 deletions.
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_SRC_LITE=y
CONFIG_COMP_DRC=m
CONFIG_COMP_CROSSOVER=m
CONFIG_COMP_SEL=m
CONFIG_COMP_MULTIBAND_DRC=y
CONFIG_COMP_MFCC=y

Expand Down
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_COMP_SRC=y
CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_DRC=m
CONFIG_COMP_CROSSOVER=m
CONFIG_COMP_SEL=m

# power settings
CONFIG_PM=y
Expand Down
2 changes: 1 addition & 1 deletion src/audio/selector/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_SEL
bool "Channel selector component"
tristate "Channel selector component"
default y
help
Select for SEL component
7 changes: 7 additions & 0 deletions src/audio/selector/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

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

[module]
count = __COUNTER__
42 changes: 28 additions & 14 deletions src/audio/selector/selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,8 @@ LOG_MODULE_REGISTER(selector, CONFIG_SOF_LOG_LEVEL);
static const struct comp_driver comp_selector;

SOF_DEFINE_REG_UUID(selector);
#define SELECTOR_UUID selector_uuid
#else
SOF_DEFINE_REG_UUID(selector4);
#define SELECTOR_UUID selector4_uuid
#endif
DECLARE_TR_CTX(selector_tr, SOF_UUID(selector_uuid), LOG_LEVEL_INFO);

DECLARE_TR_CTX(selector_tr, SOF_UUID(SELECTOR_UUID), LOG_LEVEL_INFO);

#if CONFIG_IPC_MAJOR_3
static int selector_verify_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
{
Expand Down Expand Up @@ -228,7 +221,6 @@ static int selector_params(struct comp_dev *dev,
return 0;
}

#if CONFIG_IPC_MAJOR_3
/**
* \brief Sets selector control command.
* \param[in,out] dev Selector base component device.
Expand Down Expand Up @@ -339,7 +331,6 @@ static int selector_cmd(struct comp_dev *dev, int cmd, void *data,

return ret;
}
#endif

/**
* \brief Sets component state.
Expand Down Expand Up @@ -520,15 +511,13 @@ static int selector_reset(struct comp_dev *dev)
/** \brief Selector component definition. */
static const struct comp_driver comp_selector = {
.type = SOF_COMP_SELECTOR,
.uid = SOF_RT_UUID(SELECTOR_UUID),
.uid = SOF_RT_UUID(selector_uuid),
.tctx = &selector_tr,
.ops = {
.create = selector_new,
.free = selector_free,
.params = selector_params,
#if CONFIG_IPC_MAJOR_3
.cmd = selector_cmd,
#endif
.trigger = selector_trigger,
.copy = selector_copy,
.prepare = selector_prepare,
Expand All @@ -549,7 +538,12 @@ UT_STATIC void sys_comp_selector_init(void)

DECLARE_MODULE(sys_comp_selector_init);
SOF_MODULE_INIT(selector, sys_comp_selector_init);

#else

SOF_DEFINE_REG_UUID(selector4);
DECLARE_TR_CTX(selector_tr, SOF_UUID(selector4_uuid), LOG_LEVEL_INFO);

static void build_config(struct comp_data *cd, struct module_config *cfg)
{
enum sof_ipc_frame frame_fmt, valid_fmt;
Expand Down Expand Up @@ -929,6 +923,26 @@ static const struct module_interface selector_interface = {
.free = selector_free
};

DECLARE_MODULE_ADAPTER(selector_interface, SELECTOR_UUID, selector_tr);
DECLARE_MODULE_ADAPTER(selector_interface, selector4_uuid, selector_tr);
SOF_MODULE_INIT(selector, sys_comp_module_selector_interface_init);

#if CONFIG_COMP_SEL_MODULE
/* modular: llext dynamic link */

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

#define UUID_SELECTOR 0x32, 0xFE, 0x92, 0xC1, 0x17, 0x1E, 0xC2, 0x4F, 0x58, 0x97, \
0xC7, 0xF3, 0x54, 0x2E, 0x98, 0x0A

SOF_LLEXT_MOD_ENTRY(selector, &selector_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("MICSEL", selector_llext_entry, 1, UUID_SELECTOR, 8);

SOF_LLEXT_BUILDINFO;

#endif

#endif
6 changes: 5 additions & 1 deletion src/audio/selector/selector.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 = "MICSEL"
uuid = "32FE92C1-1E17-4FC2-9758-C7F3542E980A"
affinity_mask = "0x1"
instance_count = "8"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
init_config = "1"
module_type = "0xC"
auto_start = "0"
Expand Down
14 changes: 10 additions & 4 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,16 @@ zephyr_library_sources_ifdef(CONFIG_COMP_DCBLOCK
${SOF_AUDIO_PATH}/dcblock/dcblock_${ipc_suffix}.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_SEL
${SOF_AUDIO_PATH}/selector/selector_generic.c
${SOF_AUDIO_PATH}/selector/selector.c
)
if(CONFIG_COMP_SEL STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/selector/llext
${PROJECT_BINARY_DIR}/selector_llext)
add_dependencies(app selector)
elseif(CONFIG_COMP_SEL)
zephyr_library_sources(
${SOF_AUDIO_PATH}/selector/selector_generic.c
${SOF_AUDIO_PATH}/selector/selector.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_COMP_KPB
${SOF_AUDIO_PATH}/kpb.c
Expand Down

0 comments on commit 3b69e92

Please sign in to comment.