Commit Graph

12267 Commits

Author SHA1 Message Date
Andy Ross 2688f6345a platform/posix: Port fuzzer to upstream "native_sim" board
The older native_posix board is being deprecated, use native_sim,
which is the future-proof API.  Mostly just swap the board target and
change the C API names.

Note the NATIVE_SIMULATOR_IF decoaration on LLVMFuzzerTestOneInput():
that forces the function to be included in the first-stage zephyr.elf
link (otherwise it would be dropped as Zephyr/SOF itself doesn't
reference the entry point) and to be visible as a global symbol to the
libfuzzer instrumentation layer.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-04 10:34:47 +03:00
Grzegorz Bernat b61508fb4d audio: base_fw_intel: Fix problem with send structure ext_system_time_data
There was a problem with test test_102_08_extended_time_check.
The structure ext_system_time_data was sending with wrong size.
Because of this it was not possible to correctly read the value
from the art clock to determine the HH counter.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
2024-07-04 10:32:50 +03:00
Kai Vehmanen d5606434b3 west.ytml: update to Zephyr 650227d8c47f
Update Zephyr baseline to 650227d8c47f

Change affecting SOF build targets:

32d05d360b93 intel_adsp/ace: power: fix firmware panic on MTL
a3835041bd36 intel_adsp/ace: power: Use MMU reinit API on core context restore
a983a5e399fd dts: xtensa: intel: Remove non-existent power domains from ACE30 PTL DTS
a2eada74c663 dts: xtensa: intel: Remove ALH nodes from ACE 3.0 PTL DTS
442e697a8ff7 dts: xtensa: intel: Reorder power domains by bit position in ACE30
d1b5d7092e5a intel_adsp: ace30: Correct power control register bitfield definitions
31c96cf3957b xtensa: check stack boundaries during backtrace
5b84bb4f4a55 xtensa: check stack frame pointer before dumping registers
cb9f8b1019f1 xtensa: separate FATAL EXCEPTION printout into two
e9c23274afa2 Revert "soc: intel_adsp: only implement FW_STATUS boot protocol for cavs"
1198c7ec295b Drivers: DAI: Intel: Move ACE DMIC start reset clear to earlier
78920e839e71 Drivers: DAI: Intel: Reduce traces dai_dmic_start()
9db580357bc6 Drivers: DAI: Intel: Remove trace from dai_dmic_update_bits()
f91700e62968 linker: nxp: adsp: add orphan linker section

Link: https://github.com/thesofproject/sof/issues/9268
Link: https://github.com/thesofproject/sof/issues/9243
Link: https://github.com/thesofproject/sof/issues/9205
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-07-04 10:31:03 +03:00
Marc Herbert 2aaee2e585 .github: add a test for xtensa-build-zephyr.py --all
Add a test to avoid --all breakages like the one in commit
05bfc36dac ("ptl: Add initial PTL configuration"), reported in #9262

See also previous commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 18:40:30 +03:00
Marc Herbert d9e6b7b977 xtensa-build-zephyr.py: move PTL out of "all" and into "extra".
As reported in #9262, this fixes the --all option.

Fixes commit 05bfc36dac ("ptl: Add initial PTL configuration")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 18:40:30 +03:00
Marc Herbert 6c9df3046a Add new file: app/overlays/repro-build.conf
Passing options one by one in .github/workflows/zephyr.yml was becoming
unwieldy. Reduces Windows/Linux duplication. This also makes local
testing easier; less typing and guess work.

This should also help with #9116.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 11:30:19 +03:00
Marc Herbert 6cd34c89a1 xtensa-build-zephyr.py: use EXTRA_CONF_FILE instead of OVERLAY_CONFIG
OVERLAY_CONFIG has been deprecated by EXTRA_CONF_FILE since Zephyr 3.4

Also fix the corresponding --help string.

Zephyr 3.4 is one year old and has just been end-of-lifed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 11:30:19 +03:00
Shriram Shastry 8d1eea225a Audio: Simplify multiband_drc_setup return logic
Replaces intermediate variable and redundant comments with a direct
call to return multiband_drc_init_coef function.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-06-28 08:05:30 -07:00
Seppo Ingalsuo e138709ea8 Audio: SRC: Tune: Prefix top level functions with sof_
This change is done to avoid conflict with possible other
similar scripts.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-26 14:42:11 +01:00
Seppo Ingalsuo 3282f0462d Audio: SRC: Tune: Fix search path for other functions
Add helper function to add and remove the additional search path.
Removing the search path is useful for interactive shell usage.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-26 14:42:11 +01:00
Seppo Ingalsuo f122cea825 Audio: SRC: Tune: Move SRC setup scripts to module directory
The purpose of this change is to consolidate the files those
belong to the SRC module. This commit only moves the files. The
next commits are fixing the issues caused by the move.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-26 14:42:11 +01:00
Shriram Shastry b12b69f4cc Audio: Optimize division by speed of sound using fixed-point reciprocal
This commit optimizes the division by the speed of sound in the
`theoretical_time_differences` function. By precomputing the fixed-point
reciprocal of the speed of sound, we eliminate the need for a costly
division operation in each iteration.

Additionally, a redundant 'if' statement is removed from the
'tdfb_direction_copy_emphasis' function, simplifying the code.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-06-26 14:38:12 +01:00
Damian Nikodem 75778fc981 boards: config: add U8 bit format support for PTL
Add defines in PTL config files to support U8 bit format.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-06-26 14:34:51 +01:00
Kai Vehmanen 69ad96abbf app: boards: intel_adsp_ace15_mtpm: disable IMR context-save
Keep context save still disabled for Intel Meteor Lake. This
setting has been used in SOF2.8 and SOF2.9 releases and is used
in Chromebook SOF builds for these platforms. Make the SOF main
default match the releases.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-25 17:21:47 +01:00
Andy Ross bbd25c4a59 topology2: mtl-rt5650: Add configuration for AEC w/o DTS
Combinatorics get hard with all the features, but it's really useful
to be able to test features in isolation.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-25 17:05:14 +01:00
Ievgen Ganakov b6fd1a17bb copier: dai: fix sndw init flow
Use HDA DMA with SoundWire interface for ACE_VERSION > ACE_VERSION_1_5

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-06-25 16:40:11 +01:00
Adrian Warecki 9a322a24b9 zephyr: host: Use the buffer_alloc_range function to allocate a buffer
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-06-25 16:04:25 +03:00
Adrian Warecki 07471b971c zephyr: dai: Use the buffer_alloc_range function to allocate a buffer
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-06-25 16:04:25 +03:00
Adrian Warecki 7d235d23ad buffer: Add buffer range allocation functions
Add two new buffer allocation functions buffer_set_size_range and
buffer_alloc_range dedicated to deep buffering. They try to allocate
the largest possible buffer according to the suggested size. If this size
cannot be obtained, it will be reduced step by step until it reaches
the minimum size.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-06-25 16:04:25 +03:00
Adrian Warecki 8032abae17 buffer: Extract buffer structure initialization from buffer_alloc
Move part of the code responsible for initializing the buffer structure
to the new function buffer_alloc_struct, which will also be used
by a new buffer allocation function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-06-25 16:04:25 +03:00
Adrian Warecki b37593d483 buffer: Rename buffer_init to buffer_init_stream
Change name of the buffer_init to buffer_init_stream because it is only
responsible for initiating a stream. Omit the caps parameter because it is
only assigned to a structure field. Assign this field in the function
caller.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-06-25 16:04:25 +03:00
Jaroslaw Stelter df39f0147e tools: rimage: config: add PTL config
Add base PTL config derived from MTL.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter 30d094ba8f ptl: lnl: memory: expand HEAPMEM_SIZE
FW infrastructure shall support buffering of historic data
from 1ch up to 6 channels 24bit samples in 24bit container.
For this reason, the heap should be extended.Increase HEAPMEM_SIZE
by 0x90000 because for audio format 16000Hz/6ch/24bit
history_buffer_size = 16 * 6 * 3 * 2100s = 604800 bytes (0x93A80)

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter 0f25a31089 ptl: Add FPGA overlay configuration
Add PTL configuration changes required to build FW
for FPGA. After next SOF rebase default target will be
build for RVP, so for FPGA we will use configuration
overlay.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter b235797fc0 intel_adsp: ptl: Enable D3 flow on PTL
This PR enabled D3 flow on PTL platform.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter 9303f6d49d intel_adsp: ptl: Enable LE HEAP on ptl
Enable L3 HEAP to support D3 scenarios on PTL

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-06-24 16:15:41 +02:00
Piotr Makaruk 297badca87 intel_adsp: ptl: Enable chain-dma on PTL platform
Enable chain-dma hw support on PTL platform

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter 05bfc36dac ptl: Add initial PTL configuration
Patch adds PTL configuration basing on MTL

DMIC depends on PM_DEVICE_RUNTIME and PM_DEVICE_POWER_DOMIAN settings.
To effectively enable DMIC these flags must be set.
Additionally DMIC Ownership bit is not supported on ACE 2.0 and ACE 3.0.
Therefore CONFIG_DAI_DMIC_HAS_OWNERSHIP is switched off.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-06-24 16:15:41 +02:00
Dobrowolski, PawelX bfa9580f73 platform: version: add hardware configuration version
Due to introducing new platform to sof we need to recognize which
iteration of ace board we are dealing with.

Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2024-06-24 16:15:41 +02:00
Dobrowolski, PawelX 1704870309 cmake/zephyr: change if condition to zephyr metod
For syntax clearity changed if conditional to zephyr method

Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2024-06-24 16:15:41 +02:00
Andy Ross 28a5265568 google_aec: Rework prepare/process() to support dynamic formats
Big rewrite of the core processing code of AEC:

Support both S32 and S16 input and output formats, dynamically
selected at prepare() time based on stream configuration.

Copy/convert data in maximally inlined/unrolled loops, using
cleanly-generated (no duplication!) custom conversion utilities for
each format variant.

Orthogonalize and elaborate the validation code in prepare().  Check
all state for all input/output streams.

Decouple AEC operation from the input stream, filling zeros on
underflow and allowing AEC to run in circumstances where no playback
data exists and to recover when it starts/stops.  IPC3 setups can
exploit this now, unfortunately IPC4 always starts connected pipelines
from the host kernel so sees no benefit.

Fix a latency bug with the original code where it would copy the
processed results to the output stream before the call to
ProcessCapture() instead of after, leading to a needless delay.  Copy
the results as soon as they are available, if the output buffer backs
up, we'll continue at the next call to process()

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross 65de405b30 google_aec: Clean up kconfig handling
Put the AEC tunables inside an if COMP_GOOGLE_RTC_AUDIO_PROCESSING for
hygine.  This prevents them from appearing in .config files of SOF
builds where AEC was never enabled at all.

Set MOCK via a default instead of select.  Select is unoverridable, it
forces the MOCK to be used whenever COMP_STUBS=y, but it's more
flexible to allow the app to pick and choose which components get
stubbed (STUBS is often set at the platform layer).

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross a8efedff12 google_aec: Intercept cross-pipeline trigger propagation
On IPC3 pipelines, triggers can arrive at this component due to
changes in the reference pipeline.  Those aren't for us, and have the
effect of incorrectly resetting the capture stream if someone stops
playback.  Earlier product branches handled this logic in the pipeline
layer, but that never reached SOF main, and it's easier to do here by
just ignoring the event.

On IPC4, triggers never propagate across pipelines (and in any case
dependent pipeline state management happens in the host kernel), so
this becomes a benign noop.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross 0dd6733cca google_aec: Remove broken/unmaintained "IPC3" process code paths
In point of fact the AEC code has never worked on SOF main, and this
code doesn't either.  It got left here as new code got added to
support for MTL, and it's just a wart.

Really there's nothing "IPC4ish" at all about the new code at all,
there's no reason a single code path can't be used for both, the
process/source/sink APIs are identical.  The new code doesn't work
with legacy builds, mind you.  But it will.  Remove the stuff that
will never be used.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross b3eed69795 google_aec: Remove FLOAT_API configurability
The internals of the AEC library are floating point already.  If we're
going to support using the float variant of the API, we should use it
always to avoid all the complexity.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross f9d3a7ffa1 google_aec: Fix input stream identification
This technique doesn't work.  The ID returned by get_source_id() is
not fixed by topology.  Those numbers are derived from a component ID
allocated in the Linux kernel via ida_alloc().  The specific values
will depend on the state and history of the allocator, we can't
compare them via numerical identity here in the firmware even if they
happen to work right now due to topology ordering.

Fall back to the older technique of checking whether the input source
is on the same pipeline as the AEC component to determine if it's the
microphone input.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Andy Ross 0eb34dbb92 google_aec: Don't allocate giant blobs on the heap
The operation of the AEC component uses a single buffer as an internal
heap.  This is very large, over half the available SRAM at component
creation time on MTL.  That's just a poor fit for the heap.  It would
be trivial to create a fragmentation scenario by creating/destroying
components (which happens under user control all the way out in Linux
userspace!) where AEC can't initialize and microphone input breaks.

Longer term we can look at moving this usage back to the heap by
integrating the component's internal allocations with the SOF/Zephyr
heap (which is quite performant), allowing it to make fine-grained
allocations which will work more robustly.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-21 10:22:33 -07:00
Kai Vehmanen 41a4892b45 app: add new shell_overlay.conf
Add overlay to build SOF with Zephyr shell enabled in the build.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-20 14:58:27 +03:00
Marcin Szkudlinski 34957e7234 dp: wait till dp thread stops in thread cancel
There's a race posiibility in DP when stopping a pipeline:
 - dp starts processing
 - incoming IPC - pause the pipeline. IPC has higher priority
than DP, so DP is preempted
 - pipeline is stopping, module "reset" is called. Some of resources
may be freed here
 - when IPC finishes, DP thread continues processing

Sollution: wait for DP to finish processing and terminate DP thread
before calling "reset" method in module

To do this:
1) call "thread cancel" before calling "reset"reset
2) modify "thread cancel" to mark the thread to terminate and
execute k_thread_join()
3) terminated thread cannot be restarted, so thread creation must be
moved from "init" to "schedule". There's no need to reallocate memory
zephyr guarantees that resources may be re-used when a thread
is terminated.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-06-20 13:10:13 +03:00
Dobrowolski, PawelX a209d8f3ab west.yml: update Zephyr to 97a97c744a29
Update zephyr main to support PTL target for dai/ssp

e452bc36a6d9 dai: ssp/ptl: Add missing definition in PTL

Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2024-06-20 11:30:01 +03:00
Ranjani Sridharan 9b7fffd0d5 tools: plugin: tplg: Fix a couple of memory leaks
Free the memory allocated for tplg base and available input/output
formats when the topology is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-06-19 21:16:52 +03:00
Seppo Ingalsuo 3da8e64745 Tools: Topology2: Update sof-hda-efx-generic controls names
The controls names for IIR, FIR need to be same as in
sof-hda-generic for UCM to find the controls and set up
the components for processing.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-19 14:16:09 +03:00
Damian Nikodem 630f8758ea src: copier: update virtual index value for ssp
Virtual index value for I2S on PTL contains two information:
- time slot group index : 4
- i2s instance          : 4

In order to correctly configure the dai api, both of the above
values should be retained.

Update zephyr branch to commit:
a2386efbce1 drivers: ssp: update SSP driver to support Intel ACE30 PTL

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-06-19 14:00:34 +03:00
Damian Nikodem 45e33bb357 src: base_fw: add I2S IPC4 blob version for PTL
This commit introduces a new constant 'I2S_VER_30_PTL' that describes
specific I2S blob configurations for Intel ACE30 PTL.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-06-19 14:00:34 +03:00
Yong Zhi 9c334976c4 tools: plugin: README: remove reference to tgl-nocodec
Fix the tplg name to match the actual name used in example.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2024-06-18 14:29:11 +01:00
Marcin Szkudlinski 5f5fdb6cf9 fix: some code does not care for non-module adapter components
Legacy API that is not using module_adapter is now depreciated,
but there are still some modules that use it. So all common code
must work properly with both types of modules.
This commit is fixing crash in bind operation when binding
a legacy module. There also some comments added in potentially
similar places, but where legacy modules cannot be used.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-06-18 14:25:20 +03:00
Andy Ross 79c7db16d8 sink/source: Add pipeline_id accessor API
Expose the new pipeline_id field in sof_audio_stream_params to a
cleaner sink/source API for use by module code.  Longer term this may
want to be indirected by newer backends.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-18 14:25:20 +03:00
Andy Ross d0c220d15c buffer: Move pipeline_id down into stream params
The pipeline_id has historically been part of the comp_buffer struct,
but that is being deprecated as a public API.  So move it down into
the contained sof_audio_stream_params struct where it can be found by
new style sink/source code.

Note that the actual value of the pipeline ID is a little ambiguous:
on IPC3, the buffer is defined by the user in the .tplg file as part
of a specific pipeline with a known ID.  With IPC4 topology, the
buffers are implicitly created and will be assigned the ID of their
source (!)  component.  It is legal to define a connection across two
pipelines, and there's no ability here to recover both pipeline IDs.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-18 14:25:20 +03:00
Andy Ross b08effa8e9 comp_dev: Eliminate use of drvdata for module backpointer
The current SOF architecture splits a "module" across two structs, the
legacy comp_dev and a newer struct processing_module.  The latter
contains a pointer to the former, but in many places existing code has
needed a backpointer to recover the module from a component.

So far this has abused the drvdata mechanism to store this as a void*,
but that's fragile as many components are already (!) using drvdata
for other purposes and will clobber the setting.  The fact that it
worked is seeming just by luck.  That pointer is for the exclusive use
of the comp_driver code associated with a component to store its own
data.  We can't be touching it from the global module code.

Just give the pointer a properly-typed field of its own and make sure
the two are initialized in tandem.  Longer term, SOF really needs to
fix this bifurcation and unify the two structs.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-18 14:25:20 +03:00
Andy Ross 36fd9b5e91 module_adapter: Remove modules_shim_new()
This is dead code: just a wrapper around module_adapter_new(), which
is a public API already in use.  Presumably a forgotten relic.
Remove.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-18 14:25:20 +03:00