Commit Graph

12141 Commits

Author SHA1 Message Date
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
Jaroslaw Stelter 6102aaca5e intel_adsp: ptl: Fix SOF compilation without PM
PTL has CONFIG_PM disabled. SOF should still build without
this configuration flag. This patch fixes the compilation issue.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-14 15:14:36 +03:00
Grzegorz Bernat 87571f337c audio: volume: disable HIFI4 optimizations
HIFI4 has been disabled. HIFI3 is being used for
the volume component with peakVol.

There was a problem with test
test_01_09_peakvol_quality[44100Hz_16in16bit_1ch-0].
The main problem was with frequencies: 11025,
22050, 44100, 88200, 176400 Hz.
Because frame is different for these frequencies. For f=44100Hz
frame is equal 44 or 45. Some of the samples were simply not processed.

Changes to HIFI4 are not-trivial and failed to fix the problem.
However, HIFI3 is fully compatible and works properly.
Performance is worse by 1-2,5% in CPU cycle usage
but no glitches appear and all samples are processed correctly.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
2024-06-14 14:46:08 +03:00
Peter Ujfalusi e137e9bcb8 topology2: common: pcm_caps: Change the periods_max from 1024 to 256
HDA host DMA has limitation on the number of BDL entries which translates
to number of periods, this limit is 256.

The Chrome ALSA compliance test is eagerly try to use as many periods as
it can which exceeds the BDL limit and the stream cannot be started.

Fixes: b3a6d1c570 ("topology2: common: pcm_caps: Increase periods_max from 16 to 1024")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-06-14 11:03:12 +03:00
Seppo Ingalsuo 1470e6c585 Tools: Topology2: Use rates instead of rate_min/max in benchmark
The rate_min/rate_max is obsolete, should use rates with
list of rates to support. Without this change the playback
of non-48 kHz content happens with 48 kHz rate with pitch
shift effect. Aplay shows only a warning.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-13 10:37:19 +03:00
Guennadi Liakhovetski 7ee322f70a src: fix src_lite
src_lite is currently broken: its definition of the SRC_LITE macro at
the top of the file has no effect and its coefficients are never
used. Fix it by moving coefficient evaluation into a separate
function and calling it from both src.c and src_lite.c.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-13 10:36:15 +03:00
Guennadi Liakhovetski 8795e0f0ad src: src_lite depends on src, make this explicit
src_lite uses all the code as src only with a different set of
coefficients. Make this obvious in Kconfig and in TOML.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-13 10:36:15 +03:00
Guennadi Liakhovetski 73458ce214 src: make data and functions static
All the coefficient data and many functions in src don't need to be
global, make them static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-13 10:36:15 +03:00
Guennadi Liakhovetski ae4f3143c1 llext: only enable on ACE platforms
cAVS platforms don't use LLEXT because memory mapping isn't supported
on them. Select LLEXT per platform, so far only for ACE 1.5 and 2.0.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-12 11:07:35 +01:00
Guennadi Liakhovetski c79628308f llext: don't build if CONFIG_LLEXT=n
Not all configurations need LLEXT, don't include LLEXT support in
such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-12 11:07:35 +01:00
Guennadi Liakhovetski 1673b1097e west: update to Zephyr "main", fixing disabled LLEXT builds
Fixes, needed for a recent Zephyr head plus a PR to fix
CONFIG_LLEXT=n builds.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-12 11:07:35 +01:00
Seppo Ingalsuo 65bad5c0c1 Tools: Testbench: Fix load of MFCC component
The load of MFCC fails with testbench due to missing call of
sys_comp_module_mfcc_interface_init() in common_test.c
testbench initialize.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-10 17:20:59 +01:00
Andy Ross 5df28c4ae7 module_adapter: Correct C99ism
Compiler flags used with older xcc compilers still disallow
declarations in for() expressions.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-10 17:19:38 +01:00
Andy Ross 57948614c1 platform/mt8195: Bump AEC stack size again
This was OK a few months ago, but something in recent SOF has expanded
stack requirements and we now get overflows.  Move to 12k stacks when
AEC is enabled.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-10 17:19:38 +01:00
Andy Ross 0c30440c6c rtnr: Fix logging crash
Commit 296af86f4c ("Audio: RTNR: Convert to module API") missed a
spot: the "rtnr_printf()" function, which is a logging callback from
the vendor library, was still using the comp_rtnr driver struct even
though it was no longer initialized.  This contained a NULL trace
context, which would panic on use.

(That would then lead to a fun glitch where the reentrantly-confused
trace code would then panic inside the tracing done by the panic
handler, clobbering the original trace info and reporting to the kenel
that the fault was in panic_dump()).

This would have been fine with the stub, which does not call
rtnr_print(), only the real library would blow up.

Fix is to use the trace context directly, as we don't have a component
pointer here.

Signed-off-by: Andy Ross <andyross@google.com>
2024-06-10 17:19:38 +01:00
Kai Vehmanen 3c70609c96 versions.json: set version to 2.10.99
Open tree for 2.11 development now that stable-v2.10 is branched out.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-07 17:08:21 +01:00
Guennadi Liakhovetski 01c0f182ec llext: add support for .bss directly adjacent to .data
Zephyr places .bss into a separate section element, still if it's
immediately adjacent to writable data we can merge and allocate them
together.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Guennadi Liakhovetski b5a53e836b llext: split read-only and writable data properly
We map memory pages for loaded modules dynamically and we're able to
set memory flags for write access or for code execution. This commit
takes advantage of the recently added section grouping and maps the
three module parts separately: executable code, read-only data and
writable data, including zero-initialised .bss. This also cleans up
references, pointing into module storage in IMR instead of the mapped
addresses.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Guennadi Liakhovetski 4a8670304b llext: fix error checking
llext_find_section() returns a negative error code when it cannot
find the requested section, not 0. Fix error checking.

Reported-by: Luca Burelli <l.burelli@arduino.cc>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Guennadi Liakhovetski 59916ffd6d llext: use the first module for ELF information
When an LLEXT module contains multiple Module Adapter instances,
their manifests are stored in an array in the .module section. Those
array entries contain per-instance information like module entry
points, names, UUIDs, but ELF information is common for all
instances. Store it in the first array entry to avoid confusion.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Guennadi Liakhovetski 69626d68d7 llext: update memory access flags when mapping
When dynamically mapping memory, we need to update access flags
according to the type of the mapping.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Guennadi Liakhovetski 7658b48834 llext: (cosmetic) group headers
Re-group headers more logically in eq_iir.c and mixin_mixout.c.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-07 17:02:13 +01:00
Peter Ujfalusi c1ad36d592 topology2: Add new tokens 'playback/capture_pause_supported' as false by default
We need to face with reality that the pause/resume is a feature that is not
well tested (end users are using audio via audio servers and they don't
use pause/resume) causing constant issues with no real life benefit:
With IPC4 multiple pause/resume will make the delay reporting to be
exponentially shoot out, making the reported delay to be unusable.

Looks like suspend/resume with paused stream has been broken for a long
time and just got noticed (since it was not tested).

Add a new token to allow selected PCMs to advertise pause support and
keep it false by default.

The kernel side will allow ignoring the flag to keep the pause advertised
for continued testing while protecting accidental use of it by users.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://github.com/thesofproject/linux/issues/5035
2024-06-07 16:39:39 +01:00
Guennadi Liakhovetski 0bda13d0bd llext: check a Kconfig option to select ld flags
When using xt-clang we cannot build shared objects, so we use '-r' to
link relocatable objects. But the decision shouldn't be made based on
the name of the compiler, but based on the selected LLEXT_BINARY_TYPE
option.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Guennadi Liakhovetski 908d69ceac llext: remove hard-coded section names
It was clear that hard-coded section names aren't reliable enough but
they broke down way earlier than has been expected.

This patch replaces hard-coded sections with a loop, scanning all
sections and selecting them based on their flags and types.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Guennadi Liakhovetski 799f8279f7 llext: automatically select LLEXT type
When using a clang Cadence toolchain to build SOF and LLEXT modules
we need to select a different LLEXT type than when using a Zephyr gcc
toolchain.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Kai Vehmanen 013e210209 west.ytml: update to Zephyr 53ddff639562
Update Zephyr baseline to 53ddff639562 . The location of generated
headers has changed, so modify the SOF build scripts to use the new
location.

Change affecting SOF build targets:

6509b8199b02 shell: add shell backend for audio DSP using shared memory window
5a7600bec60b soc: intel_adsp: tools: add shell support to cavstool.py
db00b813f043 soc: intel_adsp: tools: align code style in maps_regs()
44dd5a4da9c0 soc: intel_adsp: tools: fix ace20 fw load flow
fa798ce2d5be soc: intel_adsp: only implement FW_STATUS boot protocol for cavs
8fc76f1b6d16 soc: intel_adsp: tools: improve FW boot handling on ace1.x
024bd41efb65 llext: xtensa: add support for the xt-clang toolchain

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-04 11:04:04 +03:00