Commit Graph

8607 Commits

Author SHA1 Message Date
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
Guennadi Liakhovetski 5e43688bb5 dai-zephyr: rename a device pointer to "dev"
Fix a confusion between device and driver.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-18 13:52:30 +01:00
Marc Herbert e1d6b9a08a topology2: build only when alsatplg is v1.2.7 or greater
Fixes: #5323

The v1.2.6 requirement was a lie the whole time because alsatplg v1.2.6
does not have any `-I` option. The truth was: un-released alsa-utils
from git was required. The check for v1.2.6 was an approximation good
enough for many users but not for everyone, see for instance #5323.

Now that alsa-utils v1.2.7 has been released we can stop lying:
 https://github.com/alsa-project/alsa-utils/commit/7d934f3142549

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-18 13:36:49 +01:00
Marc Herbert cd6a0c1977 Disable some invalid doxygen comment blocks
Simply replace `/**` with `/*`. This can be very easily reverted if
someone ever fixes the corresponding comment.

We don't build doxygen for .C files in continuous integration, only for
.H files. We don't build doxygen for .C files in continuous integration
because there are way too many errors and no one has time to fix
them. Because we never build doxygen for .C files, people keep adding
untested and invalid doxygen comments or they change the code while
leaving the doxygen out of sync.

I build doxygen for .C files locally. The call graphs are especially
useful (they don't need doxygen comments). I have local hacks to filter
out the most common doxygen errors. The broken doxygen comments disabled
by this commit escaped my local filters.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-18 13:33:58 +01:00
Marc Herbert 9996338236 Remove duplicate doxygen of duplicate comp_verify_params() declaration
comp_verify_params() is declared in two different .h files. This is
probably wrong but this very small and quick fix is only about
removing the doxygen duplication and removing this super confusing
error message that does NOT point at the duplication:

```
src/include/sof/ipc/topology.h:209: warning: argument 'dev' from the
argument list of comp_verify_params has multiple @param documentation
sections
src/include/sof/ipc/topology.h:209: warning: argument 'flag' from the
argument list of comp_verify_params has multiple @param documentation
sections
src/include/sof/ipc/topology.h:209: warning: argument 'params' from
the argument list of comp_verify_params has multiple @param
documentation sections
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-18 13:33:58 +01:00
Arsen Eloglian 46be52128d UpDwMix: update reset function
up_down_mixer: update reset function.
Set requested state if the state is still active.

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-08-18 13:31:54 +01:00
Guennadi Liakhovetski e521a25d06 coherent: make coherent_release*() functions return void
coherent_release() doesn't need to return the uncached address, that
was originally used to acquire the object, that address is available
to the caller already.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-17 14:50:30 +01:00
Guennadi Liakhovetski 4c7b97e95d buffer: make buffer_release() return void
buffer_release() currently returns the original pointer that was used
for buffer acquisition, which is never used and shouldn't be needed
either. Remove it and make the function return void instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-17 14:50:30 +01:00
Ming Jen Tai 5c3594afe8 rtnr: Set process_enabled by default and keep its value in rtnr_reset()
Since rtnr_reset() will be called once recording is finished, 
the value of process_enabled should not be changed in this function.
Otherwise every new recording will start with the value set in 
rtnr_reset(), and it should be an incorrect behavior.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-08-17 14:36:20 +01:00
Laurentiu Mihalcea 3590936101 topology1: Add new i.MX topology for PCM capture using compress API
We add a new i.MX8MP topology which will use the compress API for PCM
capture. This topology is mainly used for testing.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
Laurentiu Mihalcea b99bf48195 topology1: Add new i.MX topology for PCM playback using compress API
We add a new i.MX8MP topology which will use the compress API for PCM
playback. This topology is mainly used for testing.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
Laurentiu Mihalcea cb38eec76e topology1: Add new i.MX topology for PCM capture using compress API
We add a new i.MX8Q(M/XP) topology which will use the compress API for
PCM capture. This topology is mainly used for testing.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
Laurentiu Mihalcea 476b31ecdb topology1: Add new i.MX topology for PCM playback using compress API
We add a new i.MX8Q(M/XP) topology which will use the compress API for
PCM playback. This topology is mainly used for testing.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
Laurentiu Mihalcea def03928d5 topology1: pcm: Add new macro for compress capture
We want to be able to create topologies for the case of
compress capture. This change will enable us to do so.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
Laurentiu Mihalcea 9d54236675 topology1: pcm: Introduce compress parameter for pcm_capture_add_common
This change will allow us to prepare for adding a new macro
for the case of compress capture.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-17 15:01:59 +03:00
barry.jan 6bea410481 Waves: fix buffer acquisition
In module adapter, Waves will receive bin file from user space
before .prepare method be called. To support this change, move buffer
acquisition in .ini method instead.

Signed-off-by: barry.jan <barry.jan@waves.com>
2022-08-16 21:53:12 +01:00
barry.jan 8efd627964 topology: add Waves for sof-mt8186-mt6366-rt1019-rt5682s tplg
Signed-off-by: barry.jan <barry.jan@waves.com>
2022-08-16 21:53:12 +01:00
CY Kuei 285df36f1b module_adapter: correct the way to get the scheduling period
Scheduling period should be acquired from dev->pipeline->period

Signed-off-by: CY Kuei <cyk@waves.com>
2022-08-16 21:52:01 +01:00
Kai Vehmanen c3d1228fb0 probe: add backend for logging via probes
Implement a Zephyr logging backend which routes the logs via SOF
probes interface.

Tested with Linux SOF driver, crecord and sof/tools/probes for decoding.

The patch modifies the probes IPC3 interface, adding a new probe purpose
field (PROBE_PURPOSE_LOGGING, 0x3) to specify probe extraction for
logging. A field for system trace (as is also reserved (PROBE_PURPOSE_TRACING).

Example usage in Linux:

 term1# crecord -c3 -d0 -b8192 -f4 -FS32_LE -R48000 -C4 /tmp/extract.dat
 term2# echo 0,3,0 > /sys/kernel/debug/sof/probe_points
 term1# <terminate crecord>
 term1# sof-probes -p /tmp/extract.dat
 term1# cat buffer_0.bin

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:36:42 +01:00
Kai Vehmanen 8ab2e71570 probe: fix probe_task to handle non-aligned amount of data
Modify probe task to support cases where the amount of available data is
not multiple of the DMA copy size, or wraps around in the DMA
buffer.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:36:42 +01:00
Kai Vehmanen 87425baf22 probe-app: add support for non-audio probe buffers
Identify non-audio probe streams and write them out with ".bin"
extension and without the RIFF WAVE header.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:35:03 +01:00
Kai Vehmanen bd9168f676 probe-app: support non-word aligned probe data streams
Modify code to correctly handle probe streams where sync word
can occur at any byte boundary, and where probe packet size may
not be aligned to 32bit word size.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:35:03 +01:00
Kai Vehmanen e2a5d925ba probe-app: bail out if opening file fails
Do not blindly call fwrite without checking whether file open
succeeded or not.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:35:03 +01:00
Kai Vehmanen 89039c6bff probe-app: fix handling of buffer-id of zero
Don't assume buffer-id of zero is an invalid value.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:35:03 +01:00
Guennadi Liakhovetski 8e3654485a mixin: (cosmetic) simplify a conditional
No need to check the same condition twice in a row, once is enough.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-15 15:14:59 +01:00
Guennadi Liakhovetski e84e9c37ea mixin: don't overwrite valid configuration
The component .bind() method is called twice - for the upstream and
for the downstream links. When mixout's .bind() is first called for
the upstream link, it correctly sets up its connection to the mixin
component. However, if after that .bind() is called for the
downstream link, that configuration is overwritten with 0. Remove
that overwrite.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-15 15:14:59 +01:00
Guennadi Liakhovetski 95485f05b5 buffer: pass locked buffers to notification recipients
SOF probes use notifiers to be informed when buffer fill state
changes. These notifiers are always called synchronously on the same
core. We use that fact to pass locked buffers to probes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-15 13:14:03 +01:00
Kai Vehmanen 488cc4a0a6 probe: decouple probe_gen_header() from comp_buffer definition
probe_gen_header() only needs a single field from comp_buffer,
so simplify the function interface.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-15 13:14:03 +01:00
Daniel Baluta 8a1b051940 topology1: codec_adapter: Remove ca_config bytes
After commit:
5763c74bf4 ("codec_adapter: Remove setup config from module data")
we no longer setup config bytes in codec adapter control bytes.

So, we need to remove ca_config bytes and fix payload size. This
didn't introduce any bug because this is the default
CA_SETUP_CONTROLBYTES. Each topology uses a custom control bytes
which overrides this default values.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-08-15 12:53:29 +01:00
Andrey Borisovich ecbbd1b5d1 scripts: xtensa-build-zephyr.py fix for windows
West tool returns on windows OS different white characters
than on Linux OS. Paths outputted from west tool had been
stripped for any trailing whitespaces.
Fixes "xtensa-build-zephyr.py: use west manifest"
(608833cf27)

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-08-12 15:02:18 +01:00
Guennadi Liakhovetski 167e62df0d mixin-mixout: fix a firmware exception
find_mixout_source_info() can return NULL, always check return value
before dereferencing.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-12 15:01:37 +01:00
Guennadi Liakhovetski b48710c8a5 ipc: find components on other cores too
No reason for ipc_get_ppl_comp() to only look for components on the
same core as where it is running, same pipeline components can run
on different cores too.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-11 13:14:00 +01:00
Fred Oh 63b0d80562 .github: add rmb to gcc build only platform
SOF Docker image supports AMD/Rembrandt gcc toolchain from tag 20220809,
which is latest as of now.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-08-10 21:26:07 +01:00
Fred Oh 4e85dfc95f docker: add AMD/Rembrandt gcc toolchain
Add AMD/Rembrandt (rmb) gcc toolchain to thesofproject/sof docker image.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-08-10 21:25:50 +01:00
Seppo Ingalsuo a10e118a4d Audio: SRC: Cleanup traces in src_params()
The stream format info is useful for debugging SRC issues so it
is added to comp_info() trace print.

The blk_in and blk_out are at this code location always zeros so
the comp_info() to trace them is unnecessary.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-10 08:14:47 +01:00
Seppo Ingalsuo a328223ba5 Topology1: Allow S24_4LE and S32_LE playback with PCM4
This patch allows to test SRC with all 16/24/32 bit formats
in UP-squared device. Without this patch only 16 bit is
supported.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-10 07:54:39 +01:00