Skip to content

Commit

Permalink
audio: dsm: add stub for maxim dsm
Browse files Browse the repository at this point in the history
Add a stub for the library so fuzzers and CI can compile the adapter

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
  • Loading branch information
cujomalainey authored and lgirdwood committed Jul 26, 2023
1 parent 266a8f8 commit c5f00bf
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/audio/smart_amp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ add_local_sources(sof smart_amp.c smart_amp_generic.c)

if(CONFIG_MAXIM_DSM)
add_local_sources(sof smart_amp_maxim_dsm.c)
if(CONFIG_MAXIM_DSM_STUB)
add_local_sources(sof maxim_dsm_stub.c)
else()
sof_add_static_library(dsm ${CMAKE_CURRENT_LIST_DIR}/lib/release/dsm_lib/libdsm.a)
endif()
target_include_directories(sof PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/dsm_api/inc)
endif()
9 changes: 9 additions & 0 deletions src/audio/smart_amp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ menu "Smart amplifier solutions"

config MAXIM_DSM
bool "Maxim DSM solution"
select MAXIM_DSM_STUB if COMP_STUBS
default n
help
Select to apply Maxim DSM(Dynamic Speaker Management) solution
Expand All @@ -13,5 +14,13 @@ menu "Smart amplifier solutions"
building the FW binary with this option enabled. The library
itself should be statically linked with the SoF FW binary image.

config MAXIM_DSM_STUB
bool "Maxim DSM solution"
depends on MAXIM_DSM
default n
help
Select to build the Maxim DSM adapter with a stub library. This
should only be used for CI and testing.

endmenu

52 changes: 52 additions & 0 deletions src/audio/smart_amp/maxim_dsm_stub.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2023 Google LLC. All rights reserved.
//
// Author: Curtis Malainey <cujomalainey@chromium.org>
//

#include "dsm_api_public.h"

enum DSM_API_MESSAGE dsm_api_get_mem(struct dsm_api_memory_size_ext_t *iopmmemparam,
int iparamsize)
{
return DSM_API_OK;
}

enum DSM_API_MESSAGE dsm_api_init(void *ipmodulehandler,
struct dsm_api_init_ext_t *iopparamstruct,
int iparamsize)
{
return DSM_API_OK;
}

enum DSM_API_MESSAGE dsm_api_ff_process(void *ipmodulehandler,
int channelmask,
short *ibufferorg,
int *ipnrsamples,
short *obufferorg,
int *opnrsamples)
{
return DSM_API_OK;
}

enum DSM_API_MESSAGE dsm_api_fb_process(void *ipmodulehandler,
int ichannelmask,
short *icurrbuffer,
short *ivoltbuffer,
int *iopnrsamples)
{
return DSM_API_OK;
}

enum DSM_API_MESSAGE dsm_api_set_params(void *ipmodulehandler,
int icommandnumber, void *ipparamsbuffer)
{
return DSM_API_OK;
}

enum DSM_API_MESSAGE dsm_api_get_params(void *ipmodulehandler,
int icommandnumber, void *opparams)
{
return DSM_API_OK;
}
4 changes: 4 additions & 0 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ zephyr_include_directories_ifdef(CONFIG_MAXIM_DSM
${SOF_AUDIO_PATH}/smart_amp/include/dsm_api/inc/
)

zephyr_library_sources_ifdef(CONFIG_MAXIM_DSM_STUB
${SOF_AUDIO_PATH}/smart_amp/maxim_dsm_stub.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_ARIA
${SOF_AUDIO_PATH}/aria/aria.c
${SOF_AUDIO_PATH}/aria/aria_hifi3.c
Expand Down

0 comments on commit c5f00bf

Please sign in to comment.