Skip to content

Commit 818ecfd

Browse files
committed
Volume: Change volume build based on HIFI_VERSION
Previously, volume version selection is based on xtensa toolchain, this change makes volume version select based on preprocessed build environment variable HIFI_VERSION as default, it also can be selected with menuconfig with this patch. Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
1 parent 60870fb commit 818ecfd

File tree

9 files changed

+33
-17
lines changed

9 files changed

+33
-17
lines changed

src/audio/volume/Kconfig

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,29 @@ config COMP_GAIN
7676
This option enables gain to change volume. It works
7777
as peak volume without updating peak vol to host
7878

79-
endif # volume
79+
choice "VOLUME_HIFI_VERSION_SELECT"
80+
prompt "choose which hifi version used for volume module"
81+
default VOLUME_HIFI4 if "$(HIFI_VERSION)" = "4"
82+
default VOLUME_HIFI3 if "$(HIFI_VERSION)" = "3"
83+
default VOLUME_GENERIC if "$(HIFI_VERSION)" = "generic" || "$(HIFI_VERSION)" = ""
84+
85+
config VOLUME_HIFI4
86+
prompt "choose hifi4 instruction set for volume module"
87+
bool
88+
help
89+
This option used to build HIFI4 optimized volume code
90+
91+
config VOLUME_HIFI3
92+
prompt "choose hifi3 instruction set for volume module"
93+
bool
94+
help
95+
This option used to build HIFI3 optimized volume code
96+
97+
config VOLUME_GENERIC
98+
prompt "no hifi version selected for volume module"
99+
bool
100+
help
101+
This option used to build volume generic code.
102+
endchoice
103+
104+
endif # volume

src/audio/volume/volume.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static int volume_process(struct processing_module *mod,
587587
cd->peak_cnt = 0;
588588
peak_vol_update(cd);
589589
memset(cd->peak_regs.peak_meter, 0, sizeof(cd->peak_regs.peak_meter));
590-
#ifdef VOLUME_HIFI4
590+
#if CONFIG_VOLUME_HIFI4
591591
memset(cd->peak_vol, 0, sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4);
592592
#endif
593593
}

src/audio/volume/volume.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ struct sof_ipc_ctrl_value_chan;
3636

3737
#if defined(__XCC__)
3838
# include <xtensa/config/core-isa.h>
39-
# if XCHAL_HAVE_HIFI4
40-
# define VOLUME_HIFI4
41-
# elif XCHAL_HAVE_HIFI3
42-
# define VOLUME_HIFI3
43-
# else
44-
# define VOLUME_GENERIC
45-
# endif
46-
#else
47-
# define VOLUME_GENERIC
4839
#endif
4940

5041
/**

src/audio/volume/volume_generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);
2727

2828
#include "volume.h"
2929

30-
#ifdef VOLUME_GENERIC
30+
#if CONFIG_VOLUME_GENERIC
3131

3232
#if (!CONFIG_COMP_PEAK_VOL)
3333

src/audio/volume/volume_generic_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);
2323

2424
#include "volume.h"
2525

26-
#ifdef VOLUME_GENERIC
26+
#if CONFIG_VOLUME_GENERIC
2727

2828
#if CONFIG_COMP_PEAK_VOL
2929

src/audio/volume/volume_hifi3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI3
24+
#if CONFIG_VOLUME_HIFI3
2525

2626
#if (!CONFIG_COMP_PEAK_VOL)
2727

src/audio/volume/volume_hifi3_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI3
24+
#if CONFIG_VOLUME_HIFI3
2525

2626
#if CONFIG_COMP_PEAK_VOL
2727

src/audio/volume/volume_hifi4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI4
24+
#if CONFIG_VOLUME_HIFI4
2525

2626
#if (!CONFIG_COMP_PEAK_VOL)
2727

src/audio/volume/volume_hifi4_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI4
24+
#if CONFIG_VOLUME_HIFI4
2525

2626
#if CONFIG_COMP_PEAK_VOL
2727
#include <xtensa/tie/xt_hifi4.h>

0 commit comments

Comments
 (0)