Commit Graph

7912 Commits

Author SHA1 Message Date
Marc Herbert 78667c028d xtensa-build-zephyr.py: do not modify submodules after building!
The older shell script had a deprecated convenience hack to clone
submodules before building rimage but _only if submodules were missing_!

While trying to preserve that, the new script changed that to an
unconditional git submodule update that can be destructive when
submodules are already present.

Generally speaking, using git and building must always be two very
distinct activities. No one wants the source code to change quietly from
one build to the next.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-11 12:52:41 +00:00
Marc Herbert 7a847a5bd8 xtensa-build-zephyr.py: de-duplicate common code
De-duplicate this code:

	if args.platforms:
		build_platforms()
		show_installed_files()

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-10 13:15:11 +00:00
Marc Herbert fc3bc3c805 xtensa-build-zephyr.py: don't git_submodules_update() twice
A second git_submodules_update() immediately after the first one does
not make sense. This looks like something leftover from a past
experiment.

Fixes initial commit 1de3ef3675 ("Rewritten xtensa-build-zephyr.sh to
python")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-10 13:15:11 +00:00
Daniel Baluta b18f08d095 zephyr/cmake: Add support for linking with cadence libs
We add support for linking with Cadence AAC/MP3 libs.

Cadence lib MP3 support is enabled via CONFIG_CADENCE_CODEC_MP3_DEC config
symbol. Path to library file needs to be set via CONFIG_CADENCE_CODEC_MP3_DEC_LIB

Similar for AAC.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-03-10 09:57:11 +02:00
Adrian Warecki b9d971920e xtensa-build-all.sh: Use appropriate defconfig for tgl-h platform
Recent combination of tgl and tgl-h building resulted in use of an invalid
defconfig file for tgl-h platform. This commit reverts that change.

Fixes: f1e6e1fdd3

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-09 11:38:29 -08:00
Seppo Ingalsuo c9d603bb11 Tools: Test: Fix mistake in script test_run.m
Remove the extra argument for fprintf(). For some reason there was
no harm seen but this should trigger an error when run in Octave or
Matlab.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-09 15:44:06 +00:00
Andrula Song 39205fb5a6 Audio: volume: Optimize source and sink buffers usage
This patch replaces the audio stream read/write frag based
access to source and sink by block processing based on
audio_stream_bytes_without_wrap() bytes count. In this way,
the copy and scale volume function can reduce about 25%
cycles for S16, 34% for S24 and 30% for S32.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-03-09 11:52:31 +00:00
Lionel Koenig 980a5b25b3 topology1: Fix m4 issue in conditional definition
Due to m4 peculiarities it is require to escape the content of an
ifdef. I forgot to add those escaping for around the `SPK_MIC_PERIOD_US`
definition leading to erroneous value if GOOGLE_RTC_AUDIO_PROCESSING was
defined.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-03-08 22:05:15 +00:00
Marc Herbert 2ac78a0603 version.cmake: make XTOS and Zephyr .ldc file different from each other
This is especially important considering some sof-bin releases are now
"hybrid": with a mix of XTOS and Zephyr.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert f052cbffaa zephyr/cmake: fix SOF_ROOT_SOURCE_DIR to fix the .ldc checksum
Fixes copy/paste of commit de41202f8f ("zephyr: build: Add initial
build support for SOF application.")

This fixes the dictionary hash when using Zephyr; no more fallback on
the git SHA1.

When using Zephyr, SOF_ROOT_SOURCE_DIR (and SOF_ROOT_BINARY_DIR) are used
only by version.cmake

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert 302ebe3b03 version.cmake: fix git -C sof/ log command when building Zephyr
When building Zephyr, CMAKE_CURRENT_SOURCE_DIR does not point at
SOF. Use SOF_ROOT_SOURCE_DIRECTORY instead.

No impact besides the logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert d722ee15b1 version.cmake: --no-abbrev-commit cause github has allowAnySHA1InWant
Some git servers like Github allow fetching by full length SHA so this
useful information to share.

(Others forbid this entirely, see last page of `git help fetch-pack`)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert 23d2a01777 version.cmake: add comments and fix logs to clarify recursive invocation
version.cmake has a not very intuitive logic to make sure sof_versions.h
is always up to date without triggering a full rebuild. Add comments and
rephrase some logs to make it less hard to follow.

Absolutely zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Guennadi Liakhovetski 49f019fe1a dma: make DMA platform data static
Each platform defines a list of DMA controllers and related objects
in their lib/dma.c files. All of them are needlessly defined as
global. Make them all static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-03-08 16:43:30 +00:00
Pierre-Louis Bossart 83ada5ac08 topology: disable SSP0 and SSP1 on APL/GLK to enable Zephyr tests
This is a temporary work-around to enable CI tests while performance
is being optimized.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-03-08 15:17:29 +00:00
Lionel Koenig 21a1ee1d16 topology1: Simplify the DMICPROC selection
This should make sure to surface pipeline period and microphone
processing in the top topology file so incoherence are easier to spot
and correct.

I compared topology1/production/*.conf outputs prior and after the
change: except some new line and comment change introduced by the
simplification, there are no changes.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-03-08 14:58:44 +00:00
Adrian Warecki f1e6e1fdd3 xtensa-build-all.sh: Code style correction
Combined case label tgl and tgl-h similarly as in xtensa-build-zephyr.sh
Corrected code formatting.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-08 09:25:28 +00:00
Adrian Warecki 95d887251e xtensa-build-all.sh: Don't override user private key path
If the user doesn't set the path to own private key, the default path is
placed in the variable containing the user's key. This causes a leak of the
default key of one platform to the others platforms, which will treat it as
a key supplied from the user.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-08 09:25:28 +00:00
Ranjani Sridharan 8355f6047a codec_adapter: Move input/output buffer allocation to prepare
Add 3 fields for input_buffers, output_buffers and output_buffer_size
to struct processing_module. Move the memory allocation for input/output
buffers for the module to the prepare op from the copy op.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-03-07 12:55:19 -08:00
YC Hung ecec8d11d1 topology1: mt8195: support 2ms pipeline capture period
When host is more heavy loading(e.g. camera recoding case),
the size of dai buffer is 4ms and not enough. Increase 2ms
period capture pipeline to buffer more data to avoid overrun.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-07 14:21:12 +02:00
Chao Song f645b36cc8 xtensa-build-zephyr.py: use string path for rimage_desc
PosixPath doesn't convert to string automatically, and
it is not acceptable in sign_cmd, convert it to string
explicitly.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-03-07 12:02:33 +00:00
Chao Song de7016edd4 platforms: tgl: renamme tgl_ipc4_overlay.conf
Rename tgl_ipc4_overlay.conf to ipc4_overlay.conf,
because it is under tgl folder.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-03-07 12:02:33 +00:00
Pierre-Louis Bossart 9709ef81dc topology1: sof-glk-es8336: use mclk ID0
It's not clear why the initial contribution used mclk ID1, mclk ID0 is
used by 99% of devices - and a manual inspection of NHLT supports that
claim. We will have to deal with the MCLK ID1 case with quirks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-03-03 16:46:39 +00:00
YC Hung ba29bdcda4 ipc: ipc3: reset host position in ipc_stream_pcm_params before reply
Reset host position in ipc_stream_pcm_params before reply. It could avoid
that linux side get invalid value before host position updating. This
invalid value happens when running alsa conformance test and use pcm
pointer function to get host position value but see invalid value at
the beginning. After providing this patch, the invalid value will be
replaced with zero.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-03 16:44:57 +00:00
YC Hung 6a18e5a8c9 audio: host: update position every period to improve precision
The position is currently updated by the host component when a
period was consumed. The granularity of this position is too large,
applications relying on timer-based scheduling may query the
position at any time and conformance test suites fail.

This patch introduce another field "cont_update_posn" in
sof_ipc_stream_params which suggests a more precise position
reporting, by storing the latest position in a memory window
when the host component completes a transfer. This will increase
the traffic to memory windows, but allow for a much smaller
granularity in position updates.

In hindsight, this solution should have been the default behavior
but to avoid backwards compatibility issues is added as a new
capability controlled by an ABI check. Only with a recent-enough
Linux kernel will this behavior be enabled.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-03 16:44:57 +00:00
Malik_Hsu c42ede6a97 topology: sof-adl-max98360a-rt5682-waves: add new topology
Add support for max98360a speaker amplifiers with waves function.

Signed-off-by: Malik_Hsu <malik_hsu@wistron.corp-partner.google.com>
2022-03-02 14:00:40 +00:00
Ranjani Sridharan 07d5432d5c codec_adapter: Modify the process API signature
Modify the signature of the process API in the module interface to pass
the input/output buffers along with the counts of the number of input
and output buffers.

Please note that the pass input/output buffers are not used at this
point. The codec implementations will be modified in the follow-up
patches to use them.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-03-02 13:50:52 +00:00
Ranjani Sridharan 8bcfd6fa20 module_interface: Introduce 2 new structures
Introduce 2 new structures to represent the input and output stream
buffers. These will be passed as inputs to the process API.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-03-02 13:50:52 +00:00
Rander Wang 0b537cba4d ipc4: init gain & mixin components for zephyr
Fix issue of ipc4 pipeline initialization with zephyr enabled.
Need to initialize these two components. Gain module is another
type of volume without peak volume support and mixin has subset
function of mixer.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-01 22:50:17 +00:00
Kai Vehmanen 26e08d4d55 xtensa-build-zephyr: use separate Zephyr config for TGPH builds
Zephyr recently added support for separate configs for 2-core and 4-core
variants of cAVS2.5. Use the new "tgph" configuration for when building
SOF for TigerLake-H variant.

BugLink: https://github.com/thesofproject/sof/issues/5018
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:49:36 +00:00
Kai Vehmanen f1e3c934f0 zephyr: use z_init_cpu() if Zephyr 3.0.99 or newer
Use the new interface to initialize non-primary cores before
enabling them with arch_start_cpu(). This interface is not
available in Zephyr 3.0.0, but is mandatory in later release.

Depends on Zephyr commit 2b210cb3db05 ("kernel: Refactor SMP cpu
initialization a bit").

BugLink: https://github.com/thesofproject/sof/issues/5456
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Kai Vehmanen 760f5ddea2 zephyr: fix race in secondary core power-up
z_wrapper_cpu_enable_secondary_core() may be called
repeatedly on a core that is already running. Add a check
to ensure we do not try to restart a core that is already
running.

Also add a check for ready_flag as done in upstream Zephyr
kernel/smp.c to ensure z_wrapper_cpu_enable_secondary_core()
does not return until the target core has finished its
startup and arch_cpu_active() returns true.

BugLink: https://github.com/thesofproject/sof/issues/5446
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Tomasz Leman 82240250c0 dmic: allow to set IPM_SOURCE_MODE from config blob
This bit determines operation mode for all source decimator.
0 = MONO
1 = STEREO

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 14:36:19 +00:00
Marc Herbert e3e038d6d4 Revert "dma-trace: Preserve logs while dtrace is disabled"
This reverts commit 58ce6e6860.

This commit has caused the DMA trace to be frequently empty on a number
of ADL and TGL in daily runs for two days in a row (test runs 10429 and
10459).

The DMA trace could be completely empty in the past but that was on
different platforms and a very long time ago, this had been fixed in
bug #4333 and had not happened for many months.

The _only_ commit difference between the last successful test
run (10402) and the first failing one (10459) is this commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-01 14:35:48 +00:00
YC Hung f551fdb9fb platform: mt8195: suspend switch clock back to 26M
When DSP enter suspend:
1.Define CLK_SUSPEND_CPU_HZ 26M for DSP suspend frequency and turn
  off adsp pll clock to avoid unexpected behavior after resume.
2.Increase wait for interrupt level to 15 to avoid unexpected interrupts.
3.Remove XT_WAITI_DELAY for LX7.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-01 14:02:31 +00:00
Rander Wang 8f78c7ecd6 ipc4: invalidate dcache for host mailbox
Fix a regression issue on windows. Need to invalidate dcache
for host message or FW will get garbage data.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-01 14:01:52 +00:00
Seppo Ingalsuo 5cf5e32a40 Audio: TDFB: Switch to fir_32x16_2x() function in generic C
This patch replaces the two calls for FIR filter with the dual
FIR function call.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo 5eb7304f61 Math: FIR: Add more efficient generic C function fir_32x16_2x()
This patch adds FIR function that computes two samples per call
it reduces the coefficients and PCM data accesses. Saving from
original FIR is 34 MCPS from 134 MCPS to 100 MCPS.

The samples include constrain of FIR coefficients length to
be multiple of four and add two into delay line length to have
room for two input samples while keeping the length even.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo fc30b4b870 Math: FIR: Simplify and optimize generic C FIR filter
This change saves 18 MCPS as gcc build build for xtensa on TGL-H
from 134 MCPS to 115 MCPS in a stereo 48 kHz 64 tap filter case.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo da8ee993a7 Audio: TDFB: Optimize read/write frag in HiFiEP copy() function
The change similar as in generic C version patch but with
different core function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo eee82cb10a Audio: TDFB: Optimize read/write frag based generic C copy() function
The new samples processing loop uses audio_stream_without_wrap()
function to loop maximum amount of frames without source and
sink buffer pointers wrap check.

In a test with TGL-H and gcc build the performance was improved by
this patch 9.2 MCPS from 140 MCPS to 130 MCPS.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Tomasz Leman edf5866da7 ipc4: setdx: prevent d0 when ppl are active
This patch prevent driver from requesting FW to enter D0 state when
there are still active pipelines.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Tomasz Leman 00fce8bd20 fix: ipc4: setdx: infinity loop
This patch refactors the SetDX handler to avoid entering infinity loop.

Secondary cores are enabled/disabled in loop iterating from 1 to
CONFIG_CORE_COUNT. Primary core is disabled at the end, because it's
required that all secondary cores to be already disabled. If all
conditions are met, FW can enter the D3 state.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Tomasz Leman 4ea628e118 ipc4: setdx: update comment
This patch updates the comment for SetDX handler to be more accurate.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Daniel Baluta ab715d8e34 zephyr: spinlock: Fix compile time warnings
With Zephyr, spinlock.h needs to know `struct k_spinlock`
definition.

Include, Zephyr's <kernel.h> header.

This fixes compile time warnings like this:

z/modules/audio/sof/zephyr/../src/include/sof/schedule/ll_schedule_domain.h:
In function 'domain_init'"
z/modules/audio/sof/zephyr/../src/include/sof/schedule/ll_schedule_domain.h:93:18:
warning: passing argument 1 of 'k_spinlock_init' from incompatible
pointer type [-Wincompatible-pointer-types]

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-28 16:39:06 +00:00
Curtis Malainey 57e0e149aa topology1: add build with no hotword or 16k dmic
Some builds require more memory, hotword can be handled by CRAS so lets
add the ability to drop it. The 16kHz dmic is not needed either so lets
drop that too.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-28 13:19:19 +00:00
Daniel Baluta 2055068104 audio_buffer: Allow NULL to be passed to buffer_free
This will allow users to pass NULL to buffer_free.

This fixes codec_adapter_free crash, where mod->local_buff is only
allocated when the module is prepared.

With dynamic pipelines we could have the situation where the pipeline
is created then SOF device enters suspend and pipeline is destroyed.

Thus we try to free unallocated mod->local_buf. Fix this by allowing
buffer_free to live free when receiving a NULL pointer.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-28 11:49:58 +00:00
Chao Song 6f71808e3e xtensa-build-zephyr.py: add ipc4 build support for tgl
Add ipc4 build support for tgl with OVERLAY_CONFIG.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-26 11:06:59 +00:00
Ranjani Sridharan ce050aa25b topology2: cavs-nocodec: split pipelines into host and dai pipelines
Split pipelines into host and DAI pipelines and fix some SSP params

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
Ranjani Sridharan 3629141cbb topology2: cavs-nocodec: include dmic-generic.conf if needed
Include dmic-generic conditionally based on NUM_DMIC's and add nhlt
build support in CMake variables.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00