Commit Graph

7026 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 82857a78ba ipc: fix a IPC completion race
A race currently exists in IPC completion code. When processing the
pipeline TRIG_START command on timer-domain pipelines, processing is
postponed to the pipeline task. Usually the IPC task continues and
completes before the pipeline task. The IPC task notes, that the
command is processed in the pipeline context and doesn't send a
reply to the host. Then the pipeline task executes the command and
notifies the host.

However, occasionally the timer interrupt occurs while the IPC task
is still active. It will start processing the IPC command in the
pipeline context and reply to the host. The host then can send the
next IPC command before the IPC task in the firmware has completed.
This then produces an error trace:

ERROR schedule_edf_task(), task already queued or running 3

and the IPC is dropped.

This commit fixes the race by making sure in asynchronous cases the
last of the two contexts notifies the host.

BugLink: https://github.com/thesofproject/sof/issues/4706
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 10:52:46 +01:00
Kai Vehmanen e963aa0e4a xtensa-build-zephyr: disable XCC build for Intel cAVS hw
Recently merged rework of multicore support in Zephyr has
broken builds with XCC. Disable XCC based builds in CI until
issue is resolved in Zephyr mainline. Issue tracked as:
https://github.com/zephyrproject-rtos/zephyr/issues/38349

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-09-06 22:55:12 +01:00
Brent Lu 287a5f9a2b ssp: mclk/bclk turned off unexpectedly
The implementation does not take the state of both directions into
consideration. If host opens both TX/RX PCM devices then close one PCM
device, the ssp driver will close the mclk/bclk immediately regardless
the state of the other PCM device.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-09-06 15:25:07 +01:00
Brent Lu ad402bc5bf ssp: bclk/mclk control is ignored
The code to control bclk/mclk is skipped after the SSP is configured
once. The clock control code should be executed always.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-09-06 15:25:07 +01:00
Marc Herbert c5ac4a44b9 xtensa-build-zephyr: add tgl
Almost no difference with tgl-h for now but will grow later.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-03 11:25:53 +03:00
Marc Herbert d910206bcf xtensa-build-zephyr: split SUPPORTED_PLATFORMS on multiple lines
... to minimize future conflicts.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-03 11:25:53 +03:00
Marcin Rajwa 94db5c7b2f toolschain: update header files to support newer toolschain
This patch updates XTENSA toolschain from version RG-2017.7
to RI-2020.5.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-09-02 12:44:31 +01:00
Adrian Bonislawski 6c17eba7e2 buffer: alloc main buffer struct in the runtime shared zone
Buffers can be shared between cores and it is crucial to have access
to not only proper buffer data but also description data of this buffer

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2021-09-02 09:12:26 +02:00
Guennadi Liakhovetski 8fa5ff5793 ssp: only delay start for the first stream
The initialisation delay in SSP start-up sequence is only needed when
the first stream initialises the SSP. If an SSP port is used for both
playback and capture, the second stream doesn't need to delay start
up again.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 4095fefd6c dai: (cosmetic) fix function name in trace strings
Trace prints often contain open-coded function names in them. When
functions get renamed or trace prints are moved to other functions,
those strings sometimes are forgotten. Fix two such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski d8ed34b1d1 component: (cosmetic) simplify a function by consolidating code
comp_set_state() always sets the component state to requested
state, which is calculated at the top of the function. Re-use the
variable instead of hard-coding each value again. Also return
immediately in case of errors, which eliminates the need for the
return code variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski f5760a648d pipeline: trigger START from the task context
When the firmware receives a START or RELEASE IPC message, it
immediately triggers all involved components, which starts DMA.
Then it schedules the pipeline task, but since the scheduler can be
already running at that time, the task might be scheduled when DMA
data isn't available yet or has already overflowed. To fix this
change the control flow to also trigger all components from the task
during its first run. Actual data processing then begins with the
next period. Note, that this is currently only possible with
pipelines, using timer-based scheduling. Pipelines, using DMA
interrupts for scheduling are unaffected.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 6578f5264c ssp: move initialisation delay to .get_init_delay()
Implement BCLK initialisation delay using the .get_init_delay()
operation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski e7dc749abb dai: add support for initialisation delay
Some DAI devices need a delay between their PRE_START and START
trigger commands, and similarly between PRE_RELEASE and RELEASE.
Add a DAI driver operation to get that delay time and use it between
the two commands.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 7184a4a5ff ssp: split the trigger handler into early and late parts
The SSP trigger handler has a potentially long delay when processing
START and RELEASE triggers. Split off an early start trigger to
extract that delay out of the SSP driver into the trigger state
machine.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 499cb7dbc1 dai: pass PRE_START and PRE_RELEASE down to DAI drivers
Some DAI drivers have to perform additional preparatory operations
before START and RELEASE triggers, pass PRE_* triggers down to
them for that purpose.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 1103860a8d pipeline: add two new trigger commands and a new state
We need to split the START trigger command into two commands because
some components have a long delay inside their START handling. This
patch introduces two new trigger commands: PRE_START and
PRE_RELEASE and a new state PRE_ACTIVE to prepare for that split.
For simmetry POST_STOP and POST_PAUSE are also added, however they
aren't used yet.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Iuliana Prodan 6b650bd95f xtensa-build-zephyr: add imx8 as supported platform
Add imx8 platform to be tested with Zephyr.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-30 13:22:33 +01:00
Curtis Malainey b2ee094436 audio: ghd: remove superfluous initializations
Unused values, save a bit of text and data space by cleaning this up.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-08-30 11:06:22 +01:00
ShriramShastry 3d674bca57 TDFB Improve directivity index and WNG
Added singular value decomposition algorithm
	for diagonal matrix calculation. Added filters for side
	lobe artifacts.

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-08-30 11:00:52 +01:00
Brent Lu d9bcdfbbbd ssp: mn: mdivctrl corruption in mn_release_mclk()
The mdivctrl register is corrupted when disabling MCLK divider in
mn_release_mclk() function. It could overwrite bclk's source clock and
stop the clock running.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-08-30 10:05:39 +08:00
Rander Wang 76feb11d1b ipc4: mixer: add mixin & mixout modules support
mixin & mixout work together to achieve the function of
mixer in current sof. This patch convert mixin & mixout
messages to mixer messages and let's mixer do their
task.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-08-27 14:02:11 +01:00
Iuliana Prodan 0065719234 zephyr: add cache_attr.c in zephyr_library_sources
COMPILER_WORKAROUND_CACHE_ATTR is also enabled on Zephyr,
but the cache_attr.c file is not compiled since is not added in
zephyr_library_sources.

Without this fix, we get:
cache.h:110: undefined reference to `glb_is_cached'

I've added the file for all platforms since cache_attr.c is generic.


Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-27 14:00:10 +01:00
Iuliana Prodan b531898f6d zephyr: wrapper: make sof_heap global again
sof_heap variable is used by all platform, with or
without ENABLE_CACHED_HEAP.

Without this fix, on i.MX with Zephyr we get:
error: 'sof_heap' undeclared (first use in this function);

Fixes: fed69b6a34 ("zephyr: wrapper: disable cached heap on Intel platforms")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-27 14:00:10 +01:00
Seppo Ingalsuo 23c7e4739c Topology: Add development example of demux and EQ band-split pipeline
This patch adds topologies sof-apl-nocodec-demux-eq-2ch4ch.tplg and
sof-apl-nocodec-demux-eq-4ch4ch.tplg. Playback of 2ch creates 4ch
output in format L_lo, L_hi, R_lo, and R_hi. An example band-split
at 2 kHz is configured for EQ processing. The low band contains
an additional 80 Hz high-pass.

The pipeline was tested in UP2 device. The nocodec topology enables
an useful SPP loopback mode. The capture PCM is connected to DAI
loopback so this pipeline can be tested with simultaneous 2ch aplay
and 4ch arecord.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-08-26 09:57:35 +01:00
Rander Wang 0fefcc8bdf topology2: ipc4: add mixin & mixout support
Also add a simple pipeline used by windows. A normal
playback pipeline is : copier -> mixin -> mixout -> gain -> copier

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-08-26 09:49:43 +01:00
Marc Herbert 4d4fd8c426 xtensa-build-zephyr.sh: build rimage later, just before it's needed.
We care about other build errors more.

This also makes it easier to test locally that "west build" does not
depend on rimage to create zephyr.elf

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-26 09:46:28 +03:00
Marc Herbert 177d9bd073 cmake: defer the rimage build until it's actually needed.
This is motivated by the zephyr.elf build that does not need rimage at
all.

Also build smex later, only when it's needed.

After building and deleting the rimage/ clone, a plain SOF clean +
RE-build now fails much later: it now fails AFTER successfully building
the sof binary, only when it tries to build either bootloader,
boot_module or base_module that actually need rimage:

[ 87%] Performing configure step for 'rimage_ep'
CMake Error: The source directory "/home/SOF/sof/rimage" does not appear
to contain CMakeLists.txt.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-26 09:46:28 +03:00
Marc Herbert 39d5365fc7 ext_manifest.h: inline rimage/ext_manifest.sh and reduce rimage dependency
Inline rimage/src/include/rimage/sof/kernel/ext_manifest.h version
9716e10a3e into sof/src/include/kernel/ext_manifest.h instead
of #including it.

This makes it possible to build zephyr.elf without rimage and unblocks
SOF uprev https://github.com/zephyrproject-rtos/zephyr/pull/37250

See also similar copy in https://github.com/zephyrproject-rtos/sof/pull/7

The duplication is OK because it is part of a versioned ABI and is
already duplicated in the Linux kernel tree anyway.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-26 09:46:28 +03:00
Jaska Uimonen 73803adec9 topology2: add dmic to nocodec topology
Add dmic definition to nocodec topology.

Suggested-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-08-25 15:39:43 +01:00
Jaska Uimonen c4880ff50a topology2: add dmic and pdm classes
Add classes for dmic and pdm config.

Suggested-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-08-25 15:39:43 +01:00
Keyon Jie 89ec377cb5 dma-trace: add check to avoid dereference from NULL
The DMA trace is not necessary enabled so the trace_data could be NULL,
add check to avoid dereference from NULL pointer and panics.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-08-25 15:21:20 +01:00
Ming Jen Tai a226f0b012 Reset sink_format at rtnr_reset()
Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2021-08-25 15:19:43 +01:00
Keyon Jie 7df367451d trace: enable trace after it is ready
If the log tracing (e.g. tr_err()) is called before the trace itself is
available, the FW will crash and FW boot fail happen.

Enable the trace after it is ready, and don't try to perform tracing
when it is unavailable.

We have the empty version of trace_init/on(), so the extra "#ifdef" in
primary_core_init() is superfluous.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-08-24 20:46:50 +01:00
Kai Vehmanen fed69b6a34 zephyr: wrapper: disable cached heap on Intel platforms
Tests with dynamic-pipeline topologies increase the complexity
of alloc/free patterns for heap and these tests have uncovered
new issues with heap corruption. Tests are reporting failed
allocs although heap still has free space. Running same test
with cached heap disabled shows no failures.

The cached heap is already disabled for IMX targets, so build on
this code and add a local ENABLE_CACHED_HEAP define to toggle
the cached heap.

BugLink: https://github.com/thesofproject/sof/issues/4494
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-24 20:31:10 +01:00
Pin-chih Lin 7cad813750 drc: Optimize with cordic sine function
This patch optimizes for speed of DRC with cordic sine function
usage in both HiFi3 and generic manners.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-08-24 17:48:27 +01:00
Pin-chih Lin 541e070eec multiband_drc: Add switch control for enabling DRC
Add mixer type control switch for enabling/disabling DRC.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-08-24 17:46:09 +01:00
Ming Jen Tai d3381eaa13 Integrate RTNR into sof-tgl-max98357a-rt5682.m4
Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2021-08-24 17:41:38 +01:00
Seppo Ingalsuo 492f947083 Audio: Fix sink buffer size check in several processing components
This patch fixes the check in crossover, dcblock, drc, eq, mixer,
multiband drc, selector, and volume components. The check should
be for 1 period of data.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-08-24 17:32:52 +01:00
Marc Herbert 1d8f68140e tools: remove spurious dependency on rimage
This reverts May 2020 commit a2de860f42 ("cmake: fix tools build
with submodules") that added a dependency on rimage for the entire
`tools/` subdirectory, probably because `smex/ldc.h` included
`rimage/fw.h` (removed in previous commit).

Looking at the code review I can see no apparent attempt to understand
anything, not even a quote of a build error message.

This will hopefully unblock
https://github.com/zephyrproject-rtos/zephyr/pull/37250

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-24 13:22:47 +03:00
Marc Herbert 16817f413e smex/ldc.h: stop including rimage/sof/kernel/fw.h
If the -Werr build does not fail then it's not needed.

The very first `#include fw.h` in `smex/ldc.h` was added in April 2020
in giant commit 36929ae1b7 ("smex: Create new tool to build ldc
file") so there is no trace of why that `fw.h` dependency was ever
needed.

Because `fw.h` was then moved to rimage, this is indirectly making the
entire `tools/` directory depending on `rimage` - fixed in the next
commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-24 13:22:47 +03:00
Curtis Malainey 804d302b3c ipcv3: fix memory access bug
Fuzzer found a way to try and access a buffer as a component which
results in a UAF crash.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-08-23 13:08:13 -07:00
Yong Zhi 0570315cd9 topology: pipe-volume-demux-playback: fix pipeline comments
Update the comments to match the P_GRAPH definition.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-08-23 13:25:37 +01:00
Chao Song a12145431d .github/zephyr.yml: update docker for cmake requirement
The latest zephyr requires CMake version >= 3.20,
we have to update the docker image to meet the
requirement.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2021-08-23 10:04:56 +01:00
Seppo Ingalsuo db8ee55b52 Drivers: Intel: DMIC: Add blob support for Sue Creek and add checks
This patch adds the missing NHLT blob support for Sue Creek type
of DMIC HW (v2). Previously the HW v1 type decoding of the blob
would have returned wrong DAI parameters and streaming fail.

Checks are added to verify correct usage of bitfields in OUTCONTROL,
CIC_CONTROL, and FIR_CONTROL. These registers are different in HW v1
and v2.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-08-18 15:38:21 +01:00
Seppo Ingalsuo d93f3eeb46 Drivers: Intel: DMIC: Fix mistake in OUTCONTROL bitfield macro usage
This patch replaces the TIE bitfield get by SIP bitfield get. The
mistake impacted DAI debug trace print.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-08-18 15:38:21 +01:00
Kai Vehmanen 0d9a0c112c xtensa-build-zephyr: disable XCC build for Intel APL
The BSS usage exceeds available memory when building for
APL/cavs15 hardware with XCC, so disable it for now. Issue
tracked as https://github.com/thesofproject/sof/issues/4645

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-18 13:54:17 +01:00
Fred Oh ce97fc7128 topology1: sof-tgl-sdw-max98373-rt5682: use a mockup of the smart amp
Remove 3rd party library dependency.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-08-18 13:10:45 +01:00
ShriramShastry 14e7993979 WIP: Add cmocka tests for trigonometry function
Added cmocka tests for trigonometry asin,acos and
     complex exponential functions . cmocka tests verifies
     32 and 16 bit accuracy.

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-08-18 13:08:32 +01:00
Keyon Jie aeda0158b0 dw-dma: set LLI alignment to platform specific
It is observed that on different platforms, the LLI need to be aligned
different, e.g. it is 128 Bytes on TGL, otherwise, the LLI struct might
be clobbered and the DMA channel might get unexpected stopped, which
will eventually lead to Xrun.

Here make the LLI alignment to platform specific and use 128 Bytes for
TGL.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-08-17 16:28:45 +01:00