Commit Graph

7002 Commits

Author SHA1 Message Date
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
Ming Jen Tai bbc5209c4f Support RTNR on Tigerlake platform
This PR adds RTNR Noise Reduction/Suppression(NR/NS) component by
Realtek Semiconductor Corp. This feature links to proprietary libraries.
Please contact antz0525@realtek.com for any question about the library.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2021-08-17 16:18:21 +01:00
balapati 8703937c11 Add AMD platform specific changes
Update hd->local_pos instead of wrapping it to zero
for amd/renoir platform.
Update trace dma channel number specific to platform
instead of default channel 0.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 8dee4e4262 platform: amd: renoir: Add BT mode based on flags
By default SP mode was enable. BT mode will be
enable based on CONFIG_AMD_BT flag.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 83cd8d8c5c dai: support for amd specific dai id's
Add AMD supported dai's for usecases.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 7453e3d571 scripts: add renoir support
Add renoir build support.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 92b04717e9 renoir: Add support for AMD renoir platform
Add renoir platform support to build fw image.
Add renoir_defconfig for renoir platform.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati b444c336f6 drivers: amd: renoir: Add dmic driver support
Add drivers for:
	* DMIC DAI, for Audio interface
	* DMIC DMA, controller
Dai changes for dmic to register to platform.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati fa93c111de drivers: amd: renoir: Add SP driver support
Add drivers for:
	* SP DAI, for Audio interface
	* SP I2S DMA, controller
Dai changes for sp mode to register to platform.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 1019bd6a0b platform: Add build support for amd renoir platform
Add CMakefile and Kconfig for amd renoir platform
to build.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati aeeba76651 platform: renoir : Add xtensa headers
Add xtensa headers for renoir based amd platform.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati 452a699042 platform: Add support for amd renoir platform
This adds support for platform drivers (dai, dma, clk)
and general platform initialization.

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
balapati ad7a4b2d7b drivers: amd: renoir: Add drivers for amd/renoir
Add drivers for:
	* timer, ipc, interrupt - amd specific implementation
	* DMA, for copying data between HOST and DSP
	* BT DAI, for Audio interface
	* BT I2S DMA, Controller

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-08-17 16:12:59 +01:00
Kai Vehmanen 997972c558 xtensa-build-zephyr: clean up XTENSA_TOOLS_ROOT parsing
Remove the unnecessary assumption that Xtensa tools are installed under
'XtDevTools'.

Align indentation to use tabs as is used elsewhere in this file.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-17 08:57:43 +01:00
Kai Vehmanen 4b86f2429b xtensa-build-zephyr: add support to build with xtensa XCC
Add support to build with XCC compiler by setting XTENSA_TOOLS_ROOT
env variable. The interface follows xtensa-build-all.sh, so existing
CI scripts for SOF builds can easily update to build with XCC.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-16 09:25:32 +01:00
Yong Zhi 93e572050c topology1: tgl-max98357a-rt5682 fix ENDPOINT_NAME macro side effect
Without enclosing ENDPOINT_NAME with `', the generated tplg has
pcm id 0 named to "Headphones" instead of "Speakers".

$ ./tplgtool.py ~/work/sof/tools/build_tools/topology/sof-tgl-max98357a-rt5682.tplg
pcm=Headphones;id=0;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=Headset;id=1;type=both;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=HDMI1;id=2;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=HDMI2;id=3;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=HDMI3;id=4;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=HDMI4;id=5;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=EchoRef;id=6;type=capture;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=DMIC;id=99;type=capture;fmt=S32_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;
pcm=DMIC16kHz;id=100;type=capture;fmt=S16_LE;rate_min=16000;rate_max=16000;ch_min=2;ch_max=2;

$ grep Headphones topology/sof-tgl-max98357a-rt5682.conf -n -B5

7071-# PCM Low Latency, id 0
7072:SectionPCM."Headphones" {
7073-
7074-	# used for binding to the PCM
7075-	id "0"
7076-
7077:	dai."Headphones 0" {
7078-		id "0"
7079-	}

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-08-16 09:05:01 +01:00
Vamshi Krishna Gopal 6713cace35 topology: sof-tgl-max9357a-rt5682: add support for ADL
For speakers SSP2 link is used.
For Headset SSP0 link is used.
Adding required macros to select SSP and Platform.

Signed-off-by: Vamshi Krishna Gopal <vamshi.krishna.gopal@intel.com>
2021-08-13 17:45:41 +01:00
Rander Wang e809243112 component: enhance macro definition of module initialization
Currently we can only define one moudule in a file. But
for IPC4 case, some modules share a large part of code,
so they will be defined in one file. to support this
case, add module name to differentiate local staic module
declaration.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-08-13 14:25:21 +01:00
Rander Wang 7f87398375 mailbox: add support for batch-data writing for SW REG
In IPC4 case, we need to write a batch of register data to SW REG
box, not just one 32bit data.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-08-13 14:25:21 +01:00
Kai Vehmanen 63eda919d3 zephyr: unify CTX_SAVE handling for Zephyr
Clean up the ifdefs for ipc_pm_context_save(). By implementing
platform_timer_stop() in the Zephyr wrapper, the original context
save sequence can be used also for Zephyr builds.

By doing this, we can fix issues with IPC timeout on CTX_SAVE.
Disabling all interrupts before the IPC reply is needed also on
Zephyr.

BugLink: https://github.com/thesofproject/sof/issues/4507
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-12 19:48:09 +01:00
Ranjani Sridharan dd14583c92 drivers: Intel: IDC: make core power down IDC blocking
make the core power down IDC blocking to ensure the core is
actually idle before notifying the host.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-08-12 17:21:26 +01:00
Iuliana Prodan 2ac6e7af28 imx: select COMPILER_WORKAROUND_CACHE_ATTR
To avoid buggy compiler optimization,
select COMPILER_WORKAROUND_CACHE_ATTR for all i.MX
platforms.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-12 15:04:41 +01:00
Iuliana Prodan b4165baeb3 refactor is_cached() to avoid buggy compiler optimization
For imx, is_cached() is implemented based on _memmap_cacheattr_reset.
This keeps the attributes for a 512MB region, therefore
we have the following address ranges:
 Address range       - hex digit
 0        - 1FFFFFFF - 0
 20000000 - 3FFFFFFF - 1
 40000000 - 5FFFFFFF - 2
 60000000 - 7FFFFFFF - 3
 80000000 - 9FFFFFFF - 4
 A0000000 - BFFFFFFF - 5
 C0000000 - DFFFFFFF - 6
 E0000000 - FFFFFFFF - 7

While testing on i.MX8ULP we discovered that addresses from
(0 – 1FFFFFFF) range where not correctly marked as cacheable,
because the compiler is optimizing the code incorrectly.

With macros, is_cached(address) expands to
(((((uint32_t)(&_memmap_cacheattr_reset_8ulp)) >> \
 ((((((uintptr_t)((void *)address) >> 29) & 0x7)) << 2))) \
 & 0xF) == 1)
When using _memmap_cacheattr_reset_8ulp = 0x22222221
and address = 0x1A801000 is_cached(0x1A801000)
should be true, but instead is false.

We want to avoid this buggy compiler optimization.
So we replaced the macros from cache.h with functions.

To make this generic, I created a cache_attr.c file in
src/arch/xtensa/drivers/ and a config option
- COMPILER_WORKAROUND_CACHE_ATTR, which must be selected
if the workaround is needed.

Also, we replaced the call to glb_addr_attr() from glb_is_cached()
with a function pointer that is initialized in
src/arch/xtensa/drivers/cache_attr.c.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-12 15:04:41 +01:00
Rander Wang e1dbb5b4fc ipc4: add copier module support for ipc4
Copier module can work as a host, a dai or just a converter module
to convert format. For host or dai cases, Copier will create a
corresponding component and dispatch module message to it. The key issue
is buffer connection. In the view of pipeline, a component is
connected to a buffer and pipeline message is dispatched when visiting
this connection. So buffer is relinked to host or dai component when
copier dispatches message to these two components and restored to
copier module when control flow returns to copier from host or dai.

Copier will convert format based on input & output format if it is a
converter module.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-08-12 15:01:06 +01:00
Oleh Titov 691c4e0587 topology: Add Waves codec to JSL topology
Modify sof-jsl-rt5682 topology so Waves codec can be added
to playback in case 'WAVES' is defined.
Small refactoring

Signed-off-by: Oleh Titov <Otitov@waves.com>
2021-08-12 14:51:38 +01:00