Commit Graph

7758 Commits

Author SHA1 Message Date
Andrula Song 3eaf974081 audio: volume: optimize volume component with HIFI3
Processing continuous data. Asking a 8-byte aligned memory
to store volume gain 4 times, using 2-way or 4-way pipeline
operations of xtensa intrinsics. This method can reduce about
40% MCPS than the original one.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-01-27 12:01:27 +00:00
Rander Wang f0fd4e1a45 ipc4: fix index issue for alh on windows
The node id in copier config is built with group id
and codec id, we need to convert it to sof dai id.

Validated on windows

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-27 09:58:39 +00:00
Marc Herbert 0bf7b73dc8 cmake: move ALSA_CONFIG_DIR from .sh file to topology/CMakeLists.txt
Fixes incremental builds of topology2 that were missing ALSA_CONFIG_DIR.

This was making it impossible to troubleshoot alsatplg issues like #5249.
Now incremental builds fail or pass the same as builds from scratch.

Fixes commit 308a24a92b ("topology2: Add build support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-26 10:14:15 -08:00
Marc Herbert a351d02b6d cmake: simplify add_alsatplg2_command() macro
alsatplg accepts empty definitions -D "" so let's simplify
commit cb80023b22 ("topology2: fix build issues with no command line
definitions"); 10 lines shorter. The less CMake code the better.

Zero change, the build directory is bit for bit identical after this
commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-26 10:14:15 -08:00
Marc Herbert 361fbf4504 zephyr/cmake: remove obsolete cmake 3.12 version test
Zephyr requires CMake 3.21 and SOF requires 3.13, see
commit a0acad3414 ("CMake: require version 3.13")

Fixes commit 4b2edf8eed ("zephyr: wrapper: complete zephyr support for
working audio")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-26 10:14:15 -08:00
Seppo Ingalsuo d155401343 Tools: Testbench: Fix long line
The line with multiband_drc library was too long for
checkpatch.pl check.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo cd3795d694 Tools: Testbench: Add more errors handling code
This patch adds to defaults of switch statements error prints
and error values returns to properly error non-supported
things.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo 4869b09717 Tools: Testbench: Copy in file max dev->frames amount of frames
This patch limits file read from reading more than e.g. 48 frames
at time when scheduled every 1 ms for 48 kHz audio. It helps
the testbench to execute copy() operations similarly as in real
firmware and not process multiple periods of data in the same
pipeline copy. Some components contain internal limiting for data
processing amount but most do not.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo 594853d389 Tools: Testbench: Use in prepare() frame_fmt from stream
The file component new() sets function to s32. It's better to
initialize to default function that just errors if called.

The stream pointer is retrieved from buffer. There is no need to
apply twice list_first_item() function. The sample width is set
with get_sample_bytes(). The switch case for frame_fmt is changed
to use stream. It avoids an error to use 16 bit file write to
consume data from 32 bit buffer. This happens because ipc value is
from topology while stream format is from command line override. Only
the text file output becomes incorrect.

The comp_data struct contained unnecessary fields such as period_bytes,
frame_bytes, and frame_fmt.

The patch also contains some switch-case code cleanup for more compact
code and look.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo b502424819 Tools: Testbench: Improve binary file read and write performance
This patch replaces the sample by sample fread() and fwrite()
operations with max length block reads and writes without
circular wrap. Both binary and text format read and write
functions are replaced with more compact versions.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Li-Yu Yu 46da7bd9d1 topology1: mt8195: Add topology with DTS
Add CMake build definition for
sof-mt8195-mt6359-rt1019-rt5682-dts.tplg.

Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2022-01-26 14:12:53 +00:00
Adrian Warecki e79dd6ffd9 asrc: Changed buffers allocation method.
Each buffer is allocated separately instead of one big blok,
exceeding the maximum block size for the memory allocation.
This allows to use a ASRC module with more than 2 channels.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-01-26 14:12:20 +00:00
Adrian Warecki 985b8a0056 asrc: Enable ipc4 in ASRC module
Add support for IPC4 in ASRC module initialization.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-01-26 14:12:20 +00:00
Seppo Ingalsuo 3faaf4c145 Tools: Audio: Test: In Matlab tests by default put trace to /dev/null
The trace print slows down the test a lot while the testbench
trace output is not needed usually in these audio quality
tests. The test script can set .trace to redirect trace to a file
that is also a lot faster than scrolling the trace in Matlab
or Octave shell.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Seppo Ingalsuo 0b4a796f72 Tools: Test: Audio: Delete only regular files in test begin
This patch adds test for to-be-deleted trace output file or
simulation output PCM data file. Doing delete only for regular
files allows to use e.g. /dev/null to redirect trace to
be not shown when not needed. Or run test in debugger without
need for output file.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Seppo Ingalsuo 15bf883ead Tools: Test: Audio: Fix incorrect valgrind run control in audio test
The value for VALGRIND in the run command parameters needs to
be true or false. The value "no" causes an error in comp_run.sh
script run.

Fixes 30012d1454

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Guennadi Liakhovetski 182f6eedf7 pipeline: silence timestamp failure complains
pipeline_get_timestamp() can fail to obtain a valid timestamp when
called during data copying on the same pipeline, because the
.walking flag will be set for some of the buffers in the pipeline.
That issue should be fixed, because in fact there's no reason to fail
there, but for now at least remove the excessively verbose warning.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-26 14:09:03 +00:00
Bard Liao 49d4bf3437 topology2: cavs-sdw: cavs-nocodec: add S32 format
We do support 32 bit format. So add S32 to pcm_caps.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2022-01-26 13:48:54 +00:00
Lionel Koenig c48a5281a0 topology1: google-aec topology
Add topology to include google-rtc-audio-processing to a main topology.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-01-26 13:48:00 +00:00
Xiaoyun Wu(Iris) 12675d51ff configs: Configure converter in tglIPC4 config
When build tgl firmware with IPC4
configuration, disable HIFI3 conv-
erter and enable format converters.

Signed-off-by: Xiaoyun Wu(Iris) <xiaoyun.wu@intel.com>
2022-01-26 13:47:38 +00:00
Seppo Ingalsuo 9ca2f7655e Audio: Buffer: Remove too verbose buffer debug traces for CONFIG_LIBRARY
This patch leaves out low value debug traces with CONFIG_LIBRARY for
comp_update_buffer_produce() and comp_update_buffer_consume(). They
are too far too verbose and slow down testbench runs, and cause
massive size data files if traces are captured to files.

The change is done by defining bug_dbg() macro as empty. The variable
addr needed to be eliminated because it is used only for trace.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 13:37:49 +00:00
Rander Wang 8ed3bce0ea ipc4: add general S24_3LE support
S24_3LE is not a native supported format for hda dma. Driver
treats it as 16bit stream or 8bit stream, .e.g. 24bit 3LE
2ch stream will be set as 16bit 3ch stream. In FW side,
24bit stream will be converted to S24LE.

Currently HIFI3 optimization is not supported now and also
S24_LE unit test is not implemented. These will be supported
later.

Tested on windows platform.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Rander Wang 46d718e6c8 ipc4: add pcm conversion support for link dma & alh
For HDA gateway, 24bits sample will be in high 24bits with
32 bits container case. Alh requires 32 bits container and
all sample bits starting from bit 31 to bit 0.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Rander Wang 10a5bdb829 ipc4: change frame_fmt and valid_sample_fmt for gateway
First we reused ipc3 pcm conversion function by by setting
frame_fmt to S24_4LE, but later found that we need different
conversion for copier with gateways support.

Now frame_fmt will be set by default config.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Rander Wang 458bda34b4 ipc4: adjust pcm conversion function for gateway
Compared to non-copier module, copier module uses
different conversion algorithoms for different
gateways, .e.g HDA dma requires sample bit starting
from MSB bits and also alh engine. These hw features
make pcm conversion algorithom different for different
modules.

This patch add gateway type to select conversion function.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Rander Wang c7b9df0106 ipc4: fix compiling issue for ipc4
Move endif to include general ipc4 conversion.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Rander Wang ffffa4b0bd ipc4: remove redundant calculation for copy info
The src & sink info can be gotten from struct comp_copy_limits,
no need to calculate it again.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-01-26 13:28:31 +00:00
Tinghan Shen 59a32d5bbe platform: Add mt8186 to Kconfig
Add mt8186 to Kconfig

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen 7c8e272a2a platform: Add build support for mtk mt8186 platform
Add CMakefile for mtk mt8186 platform to build.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen eff005f8b0 config: Add default config for mt8186
Add default config for mt8186 platform.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen c46186be23 platform: mtk: Add support for mt8186 platform
mt8186 platform integrates a single-core HIFI5 DSP.

The DSP operates at different highest clock frequencies with corresponding
voltage, 800MHz(0.8v)/400MHz(0.7v)/300MHz(0.65v)/26MHz(0.6v).

The DSP core and DMA in DSP subsys both can access DRAM directly.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen d4df1f647b drivers: mtk: Add drivers for mt8186
Add interrupt, timer, and ipc drivers for mt8186

mt8186 DSP has 32 interrupts.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen 24e1b7f6ca platform: mtk: add mt8186 memory layout and register definitions
Add memory layout and register address for mtk mt8186

Cache
  I-Cache: 64KB, 4-way Associativity
  D-Cache: 128KB, 4-way Associativity

External Memory
  DRAM: DSP can access DRAM shared with CPU
  L2TCM: 512KB DSP SRAM POOL

Currently, use
phy addr:0x60000000, size:0x1000000
dma phy addr: 0x61000000, size: 0x0100000

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Tinghan Shen c6ea9b9c20 platform: mtk: add xtensa headers for mt8186
Add xtensa headers for mtk mt8186 platform.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Seppo Ingalsuo 7d05389b63 Tools: Tune: EQ: Add legend to frequency response plot
This patch adds legend to plot since it was difficult to see to
which play/capture channel which curve corresponded to. In script
selftest case a label called Reference is added to the legend.

Also an indentation issue is fixed in the script.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-25 15:53:09 +00:00
Seppo Ingalsuo 6e2084ee8e Tools: Tune: EQ: In mls_freq_resp wait longer for capture to end
The 3s wait was not enough long time to wait for recording to complete
before copy for analysis so the wait is increased to 5s. The total
recording lengths were variable and not same 7s for a completed
recording.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-25 15:53:09 +00:00
Seppo Ingalsuo a9fb42836f Tools: Tune: EQ: Improve robustness of mls_freq_resp script
This patch increases end marker seek length from 3s to 5s to
allow more drift for arecord and aplay timing for test signal.
The captured waveform is now always plotted and when start
and end markers are found the test signal is plotted with green
color.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-25 15:53:09 +00:00
Seppo Ingalsuo 387d74ea6d Tools: Tune: EQ: Fix script compatibility with Matlab
The script mls_freq_resp.m has worked previously with Octave
while failed with Matlab because it does not have source
command. This patch ads function get_config() that reads
the configuration file, evaluates it, and returns the
needed variable.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-25 15:53:09 +00:00
Seppo Ingalsuo f976333a81 Tools: Tune: TDFB: Updates to design scripts for sound direction estimate
This patch contains improvements to TDFB setup scripts and examples
those are related to sound direction estimation. The changes are add
of 15 degree angle spacing to enum control, add of rotated noise sound
create for sound direction testing in simulated acoustics.

The example line, circular, and xyz array scripts are updated for single
dual mono beam that is controllable in 15 degree or 30 degree steps. All
the two beam design examples are moved into example_two_beams.m.

The patch also contains noise field covariance matrix diagonal load
increase to -40 dB. I noticed uneven frequency response in some
designs due to numerical instability. The increased diagonal load makes
the automatic design procedure more robust at minimal hit in noise
suppression performance.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-25 15:50:54 +00:00
Guennadi Liakhovetski 6ab8c11136 ipc4: fix trace format mismatches
Two tr_err() calls in src/ipc/ipc4/handler.c have mismatching formats
and arguments. When built with Zephyr, tr_err() translates to
printk() which then checks arguments. This allows an easy detection
of such errors.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-25 11:44:16 +00:00
Guennadi Liakhovetski 2097ba2d27 ipc4: fix uninitialised variable warnings
The ret variable in ipc4_trigger_chain_dma() can be used
uninitialised. Fix it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-25 11:44:16 +00:00
Liam Girdwood 8a24a326ac ipc4: eliminate a superfluous initialization
The err variable in ipc_cmd() doesn't have to be initialized, it is
always assigned a value.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-25 11:44:16 +00:00
Guennadi Liakhovetski 6f50f85633 mixer: prevent NULL dereference
User IPC can provide an invalid component ID, this shouldn't lead to
a NULL dereference.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-25 11:44:16 +00:00
Liam Girdwood cc5d6efe53 ipc4: build: fix GCC11 build warning in mixer.
In file included from /home/lrg/work/sof/sof/src/include/sof/audio/buffer.h:18,
                 from /home/lrg/work/sof/sof/src/audio/mixer.c:8:
/home/lrg/work/sof/sof/src/audio/mixer.c:45:31: error: 'mixin_uuid_ldc' defined but not used [-Werror=unused-const-variable=]
   45 | DECLARE_SOF_RT_UUID("mix_in", mixin_uuid, 0x39656eb2, 0x3b71, 0x4049,
      |                               ^~~~~~~~~~
/home/lrg/work/sof/sof/src/include/sof/lib/uuid.h:94:44: note: in definition of macro 'DECLARE_SOF_UUID'
   94 |         static const struct sof_uuid_entry uuid_name ## _ldc = {        \
      |                                            ^~~~~~~~~
/home/lrg/work/sof/sof/src/audio/mixer.c:45:1: note: in expansion of macro 'DECLARE_SOF_RT_UUID'
   45 | DECLARE_SOF_RT_UUID("mix_in", mixin_uuid, 0x39656eb2, 0x3b71, 0x4049,
      | ^~~~~~~~~~~~~~~~~~~
/home/lrg/work/sof/sof/src/audio/mixer.c: In function 'mixin_bind':
/home/lrg/work/sof/sof/src/audio/mixer.c:743:17: error: 'sink_buf' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  743 |                 pipeline_connect(dev, sink_buf, PPL_CONN_DIR_BUFFER_TO_COMP);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:786: CMakeFiles/sof.dir/src/audio/mixer.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1970: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
"make all" terminated with exit cod

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
[guennadi.liakhovetski@linux.intel.com: mixin_tr only for IPC4]
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-25 11:44:16 +00:00
Liam Girdwood 30aeff5493 ipc4: build: fix GCC11 build warning in copier
/home/lrg/work/sof/sof/src/audio/copier.c: In function 'copier_reset':
/home/lrg/work/sof/sof/src/audio/copier.c:519:29: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
  519 |         memset(cd, 0, sizeof(cd));
      |                             ^
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:996: CMakeFiles/sof.dir/src/audio/copier.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1970: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
"make all" terminated with exit code 2. Build might be incomplete.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-25 11:44:16 +00:00
Ranjani Sridharan cb80023b22 topology2: fix build issues with no command line definitions
If there are no command line definitions, the build fails because the
4th argument to the add_alsatplg2_command macro is NULL.

Fix this by using named arguments for the macro and checking for the
optional argument for command line definitions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-01-24 12:51:11 +00:00
Seppo Ingalsuo 95d8e941cf Testbench: Enable verbose traces
Some useful algorithms internal traces are output with debug traces.
This patch enables the verbose trace (CONFIG_TRACEV) for library build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Seppo Ingalsuo e0ec195bcd Test: Audio: Fix stdnotch_get() function issue in Matlab
The path append of current directory (.) is not correct for
the signal processing package function iirnotch. The issue does
not happen with Octave since it has pei_tseng_notch().

The standard notch function is used in all THD+N tests so this
issue has caused fail of nearly all tests with Matlab.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Seppo Ingalsuo 30012d1454 Tools: Testbench: Support for different in/out channels count and other
This patch adds to command line switch -n for output channels count.
Existing -c is for in channels, new -n is for out channels count. Out
channels count is same as input if -n is not present. Switch -q is
added to quiet the trace output if it is not needed.

The Matlab language test scripts for components are updated to use
the -t config.sh interface of comp_run.sh. It allows more flexible
control of input and output streams.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Marc Herbert 0031664403 xtensa-build-all.sh: distinguish default/working platform and WIP
The -a option was recently broken by the addition of platform(s) that
don't have a toolchain available in the Docker image. Every platform can
be built by someone but no one can built -a(ll) platforms right now.

Add a new platform array to make the distinction between default
platforms built by the -a option versus work in progress.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-21 17:17:09 +00:00