Commit Graph

8642 Commits

Author SHA1 Message Date
Seppo Ingalsuo 168d1648a6 Math: Add window functions library
This patch adds a library for window functions. The window functions
are used to mitigate artefacts (from nature of FFT) to spectra when
computing FFT for a finite long chunk of audio. The currently provided
window functions are Blackman, Hamming, Povey, and rectangular.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-29 17:07:55 +01:00
Liam Girdwood 7288d52ab6 testbench: cleanup the logging to use printf.
No point in doing a sprintf to a local buffer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 2865cc2bb2 testbench: cmake: parser does not use CONFIG_LIBRARY cmake variable
Not used by parser cmakefile so delete.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 67ae353bfb tplg_parser: support building as static or shared library.
Allow the tplg_parser to built as either static or shared library.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood d9f9340e1a tplg_parser: split out testbench logic and partition features per file.
This is another tplg_parser and testbench update on the road to provide
further flexibility around supporting new modules and IPC versions.
There will more to follow.

Changes are mostly mechanical code movements i.e. moving testbench related code
to the testbench, splitting the files into per module/component files and
making some functions static and public.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood f507d730ae host: panic: only define assert if not defined.
On host based builds we sometimes see that panic.h redefines assert().
Fix this. This will go away in the future as Zephyr will fully take care
of assert() on host.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 03b4f30129 testbench: include stdlib.h
Newer GCC version complain about free() not being defined.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Chao Song 7882b1a93d topology2: add pin binding classes for multiple I/O queue
An IPC4 widget may support multiple I/O queue. Queue ID is
required during widget binding in route setup.

This patch adds sink_pin_binging and src_pin_binding classes
for multiple I/O queue support.

For widget requires special pin(queue) binding, sink_pin_binding
or src_pin_binding should be defined in the widget object. So
that the kernel knows which pin to use during widget binding
by parsing topology.

Note that pin binding should be defined for all sink/source pins
or for none. Even if there is only one sink pin requires special
pin binding, pin binding should be defined for all sink pins, and
for pins that are not used, give the value "NotConnected". This rule
applies to source pins, too.

Example: smart_amp widget has two sink pins and one source pin,
and its feedback sink pin requires special pin binding, so we have to
define sink_pin_binding objects within smart_amp object like this:

Object.Base.sink_pin_binding.1 {
    # the main sink pin is connected to host for playback data
    sink_pin_binding_wname	"copier.host.1.1"
}
Object.Base.src_pin_binding.2 {
    # the feedback sink pin is connected to capture dai for codec feedback.
    sink_pin_binding_wname	"copier.SSP.2.1"
}

In this example, smart_amp is connected to host and DAI directly,
it is also possible to be connected to host and DAI indirectly (with
gain or other widget in the middle).

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-08-29 13:26:49 +01:00
Chao Song 721e58f3d2 topology2: add num_sink/source_pins tokens for widget
These two tokens will be used by the kernel to decide the
supported number of sink/source pins, thus to allocate
correct widget queue id in route setup.

These two tokens are mandatory for IPC4 widgets, because
the default value in Linux kernel is zero, which is invalid
for queue id allocation.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-08-29 13:26:49 +01:00
Marc Herbert 92d828bc37 sof-logger: make inotify optional
Restores ability to compile on Windows with MSYS.

Fixes commit dcf0577a77 ("logger: allow starting before the driver is
loaded")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-29 13:24:40 +01:00
Marc Herbert 277985e687 tools: delete obsolete tools/.gitignore
We moved to CMake and out-of-source builds years ago.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-29 13:24:40 +01:00
Guennadi Liakhovetski bc0f5d8e07 pipeline: let selector terminate the pipeline when stopping
Usually when processing COMP_TRIGGER_PAUSE or COMP_TRIGGER_STOP if a
component returns PPL_STATUS_PATH_STOP it means, that the trigger
propagation should stop and the pipeline should be kept alive.
However, in some cases propagation should be stopped, but the
pipeline should be terminated. This is the case with the selector
component, when used in a keyword detection pipeline. Add a new
PPL_STATUS_PATH_TERMINATE return value for such cases.

BugLink: https://github.com/thesofproject/sof/issues/5398
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-29 13:24:13 +01:00
Andrey Borisovich f8e111eb27 intel: drivers: dmic refactor - move DMIC_HW_IOCLK to Kconfig
Moved hardcoded cycles values for DMIC IO from dmic.h header
to per-platform configuration file (defconfig files for
non-Zephyr builds and app/boards for Zephyr builds).
Added new entry to intel drivers Kconfig - CONFIG_DMIC_HW_IOCLK.
Modification of this clock value may be used for testing purposes
like building firmware for FPGA or simulator.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-08-29 13:22:04 +01:00
Ming Jen Tai e1d2b8d1a3 Fix RTNR library naming
It was a typo while adding libutil.a to CMakeLists.txt. 
This commit unifies the naming with other platforms.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-08-29 13:17:08 +01:00
Jaska Uimonen 130ea515be Revert "copier_hifi: copier logging fix"
This reverts commit a0b832686c.

There was a PR merge "conflict" as the log defines we're in different
place in the file. This same log define was already added in commit:
2c4e403d4d

So remove the duplicate.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-08-26 11:51:22 +01:00
Seppo Ingalsuo ef90ee9a40 Test: cmocka: Always build FFt unit tests
There seems to be no reason to avoid add_subdirectory(fft).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-26 10:46:50 +01:00
Seppo Ingalsuo 213fbf9740 Test: cmocka: Add unit tests for 16 bit FFT and IFFT
This patch adds tests for 16-bit FFT library version. The test SNR
is improved by using sine frequency that matches with length of FFT.
It allows to get highest SNR in transform without need for window
functions in test and attenuation in the signal.

The 32 bit FFT tests are updated to use the same signal generator.
With this criteria the minimum SNRs for 32 bit to pass could be
increased to 95 - 132 dB.

Also tests were added for 512 size FFT in addition to 256 and 1024.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-26 10:46:50 +01:00
Seppo Ingalsuo 20fb082ecb Math: FFT: Add 16 bit FFT and IFFT version
This patch adds lower RAM and lower MCPS consuming FFT
for 16 bit data. The twiddle factors save from .bss
4096 bytes. For e.g. 512 bin FFT the saving for runtime is
additional 4096 bytes.

The previous fft.c has been split to fft_common.c and fft_32.c for
32 bits version. The new 16 bit version is in fft_16.c. The name
of previous fft_execute() is changed to fft_execute_32(). Common
function fft_plan_new() takes FFT word length 16 or 32 as new
last argument.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-26 10:46:50 +01:00
Seppo Ingalsuo 04aa27103e Math: FFT: Switch to script generated twiddle.h
This patch adds script tools/tune/fft/export_twiddle.m. Since
the data in original twiddle.h differs by one LSB in few
items the file is replaced with one generated with the script.

The identifier 32 is added to header name and variables names
as preparation to add 16 bit FFT version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-26 10:46:50 +01:00
Guennadi Liakhovetski 160953e2ae mixin: fix a NULL dereference
In mixout_prepare() mixin->pipeline can be NULL, check it before
dereferencing.

BugLink: https://github.com/thesofproject/sof/issues/6118
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-26 10:09:31 +01:00
Chunxu Li 8d9c5485c4 topology1: remove mt8186 unused topologies
Remove mt8186 unused topologies.

We use sof-mt8186 on our demo board, sof-mt8186-mt6366-rt1019-rt5682s
and sof-mt8186-mt6366-da7219-max98357 will no be used anymore.

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-08-25 16:20:26 +03:00
Rander Wang d40fb8fc99 topology2: add stream token in topology2
Add stream d0i3 token

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-08-25 13:24:25 +01:00
Jaska Uimonen abe0adcd48 zephyr: fix warnings
Fix warnings found in zephyr native drivers build.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-08-25 13:18:53 +01:00
Jaska Uimonen 6d180f48bb overlays: fix tgl ipc4 native drivers overlay
Remove duplicate configs with base IPC4 overlay and add PM related
configs to be able to compile upstream Zephyr SSP changes.

Also enable ALH native driver.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-08-25 13:18:53 +01:00
Jaska Uimonen a0b832686c copier_hifi: copier logging fix
Add logging registration for copier to be able to build and use zephyr
logging.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-08-25 13:18:53 +01:00
Jaska Uimonen 7c5a588d35 zephyr: device tree changes for dai and dma
Upstream zephyr has removed "Label" from xtensa device tree definitions
thus device_get_binding stopped to work for sof. So change the code to
use device tree macros.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-08-25 13:18:53 +01:00
Damian Nikodem c92bb1e23c ipc4: remove report dsp properties to host driver
The ADSP properties are obsolete and not using by host driver so can be
removed.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-08-25 13:17:05 +01:00
Jaroslaw Stelter b570b800df module adapter: pass config size to module for ipc4
IPC4 SOF_IPC4_MOD_INIT_INSTANCE provides size of the configuration
blob for the module. This size should be passed down to module adapter
and forwarded to module.
There are several reasons for using it:
- consistency with IPC3 flow;
- need for passing the size to IADK loadable modules;
- possibility to graceful failure in case of configuration inconsistency.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-08-25 13:16:21 +01:00
Marc Herbert 5135e7e261 .github: testbench: apt get libasound2-dev
Incoming topology re-org PR #6009 adds a new dependency on alsa headers.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-25 13:13:44 +01:00
Marc Herbert 12451fe5b8 .github: testbench: stop using container to build test topologies
Ubuntu 22.04 has ALSA 1.2.6 without ASRC failure #2543

Building in the container is much slower and updating the container is
also very time-consuming. Must be used only when really required.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-25 13:13:44 +01:00
Marc Herbert 5ff35157dd .github: build and run testbench with Ubuntu 22.04
Good bye old bugs, hello new bugs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-25 13:13:44 +01:00
Daniel Baluta 4dbfe15809 platform: imx: Set PLATFORM_DCACHE_ALIGN to 32
Ideally PLATFORM_DCACHE_ALIGN should be equal with DCACHE_LINE_SIZE,
but on i.MX dcache line size is 128 and it is too big for XTOS based
memory allocator.

See commit 8354454b4d ("platform: imx: Fix PLATFORM_DCACHE_ALIGN")

On the other hand the current value which is 4 doesn't work well with
Zephyr.

So, increase the PLATFORM_DCACHE_ALIGN to 32 which works well for XTOS /
Zephyr.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-08-25 12:58:48 +01:00
Rander Wang 141efbd7b0 ipc4: convert selector to use the new module interface
Now both ipc4 and ipc3 path will switch to module interface
with this patch.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-08-24 13:28:02 +01:00
Rander Wang b7345b168d ipc4: add basic ipc4 support in selector
Although this patch doesn't support large_config_set|get and
corresponding per-channel process, it can support simple usage
of selector and support capture applications like voice recoder,
zoom on windows platform. It will be used for WOV development
in recently.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-08-24 13:28:02 +01:00
Ming Jen Tai 0b18ca82ac rtnr: Modify used static libraries for MT8195
With the version released in 20220809, some libraries are removed 
or renamed.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-08-24 12:31:57 +01:00
Laurentiu Mihalcea 52979f35cc imx: edma: Remove CSR_START register set on edma_start
The aim of this patch is to fix the following issue:
after some pause-release operations the sound would play
with higher volume in one earpiece compared to the other one.
This seemed to happen only during a certain part of some song
(the beginning).

By removing the unnecessary set of CSR_START register in
edma_start the problem seemed to have disappeared. Setting
aforementioned register in edma_start is not necessary
because we don't need to explicitly start a channel in the
software. The hardware will take care of it.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Laurentiu Mihalcea 3054174108 imx: sai: Handle COMP_TRIGGER_RELEASE using sai_release
Since we introduced a new function used to handle the release
case (sai_release), we want to handle COMP_TRIGGER_RELEASE
using said function and not use sai_start.

The aim of this and the previous patch is to fix the
following issue: after a sequence of pause-release operations a
static sound would play along with the song. This static sound
would sometimes disappear after another sequence of pause-release
operations and would appear again after another sequence of
those operations.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Laurentiu Mihalcea c70f066210 imx: sai: Add new function to handle sai release case
Since the release and start operations should behave
differently, we need to add a new function which will
be used to handle the release case.

Initially, release would be treated just as start which is not
really correct because:
	1) we don't need to do a software reset of the SAI.
	(according to the documentation, apart from
	resetting the SAI internal logic, it was also
	resetting the FIFO read and write pointers which
	was not required)

	2) we don't need to enable the flags that were
	not disabled by sai_stop.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Laurentiu Mihalcea ad8a8f838d imx: sdma: Change COMP_STATE_SUSPEND into COMP_STATE_PAUSED
Currently, SDMA's edma_start considers that COMP_STATE_SUSPEND
is a state from which you can get to COMP_STATE_ACTIVE which
is not true because the SDMA channel never reaches that state.

According to the device state diagram, we can only reach
the COMP_STATE_ACTIVE state if we are currently in
COMP_STATE_PAUSED or COMP_STATE_PREPARE.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Laurentiu Mihalcea 61752ccf96 imx: edma: Change channel state to COMP_STATE_PREPARE
On COMP_TRIGGER_RELEASE, dai_trigger first calls edma_release and then
calls edma_start. Currently, edma_release changes the state of the
channel to COMP_STATE_ACTIVE which is wrong because that state
should be achieved after calling edma_start.

Since we know that edma_release is followed by edma_start the
correct state for the channel after a edma_release should
be COMP_STATE_PREPARE.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Laurentiu Mihalcea 0d0a1e4b17 imx: edma: Change COMP_STATE_SUSPEND into COMP_STATE_PAUSED
Currently, EDMA's edma_start considers that COMP_STATE_SUSPEND
is a state from which you can get to COMP_STATE_ACTIVE which
is not true because the EDMA channel never reaches that state.

According to the device state diagram, we can only reach
the COMP_STATE_ACTIVE state if we are currently in
COMP_STATE_PAUSED or COMP_STATE_PREPARE.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-24 12:01:22 +01:00
Andrula Song 100144a1d0 Audio: Mixer: Add hifi version processing functions for mixer
Add hifi3 & hifi4 version implementation of mixer processing functions.
The hifi version functions can save at least 47% cycles than C version.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-08-24 12:00:30 +01:00
Jaroslaw Stelter 16e3a6018e Audio: copier: Fix copier params setting
Parameters audio_fmt.depth and audio_fmt.valid_bit_depth are
expressed in bits. Therefore should be divided by 8 when set for params:
params->sample_container_bytes
params->sample_valid_bytes

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-08-24 11:21:48 +01:00
Daniel Baluta fa20935113 lib: alloc: Add missing format specifier
This causes problems when displaying heap traces.

Fixes: b67c2bf0d9 ("alloc: Making heap trace dump more readable")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-08-24 11:20:03 +01:00
Pin-chih Lin b3106c396e module_adapter: get the actual period_bytes
At present module_adapter, period_bytes is calculated assuming the schedule
period is 1ms, which could be arbitrary in practice determined by the
topology.

This commit replaces the calculation code by audio_stream_period_bytes().
In addition, the timing for getting period_bytes is moved to the beginning
of prepare() (prior to the module prepare). At that moment it is guaranteed
that all parameters in components/buffers are settled through the pipeline.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-08-24 11:01:54 +01:00
Kai Vehmanen 2c4e403d4d copier_hifi: fix Zephyr logging
Add log definition for Zephyr allowing to build this module
for Zephyr when logging is enabled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-24 10:53:08 +01:00
Marc Herbert 44a5200c87 xtensa-build-zephyr: fix pylint "Redefine 'platform' from outer scope"
Fixes pylint warning `scripts/xtensa-build-zephyr.py:426:5: W0621:
Redefining name 'platform' from outer scope (line 14)
(redefined-outer-name)` and reduce "grep confusion": the script uses
`platform` A LOT.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-19 09:45:14 +01:00
Marc Herbert 730e861505 xtensa-build-zephyr.py: pylint:disable=bad-indentation W0311
There's just too many of them and fixing them would cause a lot of churn
at a wrong time (big migration to west happening now)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-19 09:45:14 +01:00
Marc Herbert b94a5fbc54 xtensa-build-zephyr.py: fix two minor pylint f-string warnings
Fix two W1309 f-string-without-interpolation warnings

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-19 09:45:14 +01:00
Marc Herbert 3c6dcdb574 xtensa-build-zephyr.py: abort when python version < 3.8
shlex.join() requires 3.8, maybe others too. 3.8 is 3 years old and it's
the default Python version in Ubuntu 20.04

Fixes #6121

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-19 09:45:14 +01:00