Skip to content

Commit

Permalink
dts: enable building as an llext module
Browse files Browse the repository at this point in the history
Add support for LLEXT building to dts. Only building in a stub
configuration is supported, linking with a prebuilt library should be
implemented separately.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Sep 10, 2024
1 parent 70c047f commit 0e06c99
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 6 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 @@ -94,6 +94,7 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000

# Modular by default components. Compile-tested but usually not needed at run-time
CONFIG_COMP_RTNR=m
CONFIG_DTS_CODEC=m
CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m
# This mock is part of official sof-bin releases because the CI that
# tests it can't use extra CONFIGs. See #9410, #8722 and #9386
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 @@ -99,3 +99,4 @@ CONFIG_COMP_STUBS=y
CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=m
CONFIG_COMP_RTNR=m
CONFIG_DTS_CODEC=m
2 changes: 1 addition & 1 deletion src/audio/codec/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause

config DTS_CODEC
bool "DTS codec"
tristate "DTS codec"
default n
select DTS_CODEC_STUB if COMP_STUBS
help
Expand Down
21 changes: 21 additions & 0 deletions src/audio/codec/dts/dts.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ dts_codec_set_configuration(struct processing_module *mod, uint32_t config_id,
const uint8_t *fragment, size_t fragment_size, uint8_t *response,
size_t response_size)
{
#if CONFIG_IPC_MAJOR_3
struct module_data *md = &mod->priv;
#endif
struct comp_dev *dev = mod->dev;
int ret;

Expand Down Expand Up @@ -469,3 +471,22 @@ static const struct module_interface dts_interface = {

DECLARE_MODULE_ADAPTER(dts_interface, dts_uuid, dts_tr);
SOF_MODULE_INIT(dts, sys_comp_module_dts_interface_init);

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

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

#define UUID_DTS 0x4F, 0xC3, 0x5F, 0xD9, 0x0F, 0x37, 0xC7, 0x4A, 0x86, 0xBC, \
0xBF, 0xDC, 0x5B, 0xE2, 0x41, 0xE6

SOF_LLEXT_MOD_ENTRY(dts, &dts_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("DTS", dts_llext_entry, 1, UUID_DTS, 40);

SOF_LLEXT_BUILDINFO;

#endif
6 changes: 5 additions & 1 deletion src/audio/codec/dts/dts.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # dts codec module config
[[module.entry]]
name = "DTS"
uuid = "D95FC34F-370F-4AC7-BC86-BFDC5BE241E6"
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]
Expand Down
14 changes: 14 additions & 0 deletions src/audio/codec/dts/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_DTS_CODEC_STUB)
sof_llext_build("dts"
SOURCES ../dts.c
../dts_stub.c
)
target_include_directories(dts_llext_lib PRIVATE
"../../../../../third_party/include"
)
else()
message(FATAL_ERROR "Add library linking support in src/audio/codec/dts/llext/CMakeLists.txt")
endif()
6 changes: 6 additions & 0 deletions src/audio/codec/dts/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 "../dts.toml"

[module]
count = __COUNTER__
12 changes: 8 additions & 4 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,14 @@ zephyr_library_sources_ifdef(CONFIG_COMP_GOOGLE_HOTWORD_DETECT
${SOF_AUDIO_PATH}/google/google_hotword_detect.c
)

zephyr_library_sources_ifdef(CONFIG_DTS_CODEC
${SOF_AUDIO_PATH}/codec/dts/dts.c
)
if (CONFIG_DTS_CODEC)
if(CONFIG_DTS_CODEC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/codec/dts/llext
${PROJECT_BINARY_DIR}/dts_llext)
add_dependencies(app dts)
elseif(CONFIG_DTS_CODEC)
zephyr_library_sources(
${SOF_AUDIO_PATH}/codec/dts/dts.c
)
if (CONFIG_DTS_CODEC_STUB)
zephyr_library_sources(
${SOF_AUDIO_PATH}/codec/dts/dts_stub.c
Expand Down

0 comments on commit 0e06c99

Please sign in to comment.