Commit Graph

7359 Commits

Author SHA1 Message Date
Tobiasz Dryjanski e88eab88b7 telemetry: Enable Telemetry
Add config for enabling telemetry and enable it

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-04-12 19:21:42 +03:00
Tobiasz Dryjanski 0419b7c5e9 telemetry: Add systick_info part of telemetry
Introduces telemetry structure into debug memory window. Adds
systick_info which counts execution time of LL tasks. DP tasks are not
supported yet.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-04-12 19:21:42 +03:00
Tobiasz Dryjanski de66f38b1c base_fw: add scheduler_info_get ipc
Add ipc to retrieve info about schedulers.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-04-12 19:21:42 +03:00
Tobiasz Dryjanski 6afbebd259 ipc4: Add Vendor Config Get
Add Vendor Config Get, a special case of Large Config Get. Large Config Get
handling now checks for this case and extracts extended param_id from ipc
payload as param_id and handles the rest of the payload as usual. Base_fw
now uses extended param_id.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-04-12 19:21:42 +03:00
barry.jan 355e46f051 waves: verify payload size and initialize memory to zero to the
allocated memory in waves.c

    Enhance payload corruption handling by verifying size
    and make sure to have clean buffer before using it.

Signed-off-by: barry.jan <barry.jan@waves.com>
2024-04-12 16:42:08 +01:00
Adrian Warecki 4ff19b82d5 lib_manager: Rename lib_manager_get_library_module_desc function
The lib_manager_get_library_module_desc function was renamed to
lib_manager_get_library_manifest, which better describes what it do.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-12 16:55:49 +03:00
Adrian Warecki e7a71b9f9a lib_manager: Add lib_manager_get_module_manifest function
Added the lib_manager_get_module_manifest function that returns manifest
of selected module based on its id. It was performed in many places and
moving it into function simplified the code and increased its readability.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-12 16:55:49 +03:00
Adrian Warecki eba6e2a437 ipc4/helper: ipc4_get_comp_drv: Change parameter type to uint32_t
All calls to the ipc4_get_comp_drv function pass the uint32_t value as a
parameter, so the type of functions parameter was changed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-12 16:55:49 +03:00
Seppo Ingalsuo b6aa921e02 Audio: Volume: No update of process function for every ramp value
The volume process function for pass-through can be changed
when all ramps are completed. This change that avoids processing
function lookup in worst case every 128 us is measured to
save in TGL platform about 1 MCPS from CPU_PEAK(MAX).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-04-11 11:55:25 +03:00
Seppo Ingalsuo bc506f12c8 Audio: Volume: Jump volume directly to target when no ramp
This ensures that volume for a channel changes immediately
after receiving the control if ramp duration is zero or if
type is no fade.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-04-11 11:55:25 +03:00
Seppo Ingalsuo e23a663d13 Audio: Volume: Fix condition for identical ramp
The "is_same_volume=true" was returned if target volumes for
all channels are the same. The check omitted the fact that
start volumes for ramp can be different, e.g. one channel is
attenuated while others are 0 dB.

This change fixes the random ignore of volume ramp and smooth
transition when a volume control is changed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-04-11 11:55:25 +03:00
Seppo Ingalsuo eb463a5f2a Audio: Volume: Add linear ramp coefficient function with fixes
The linear slope coefficient calculation is moved to a separate
function. Two functional changes are done.

- The ramp_coef for channel is set to zero if there is no
  transition for the channel. The ensure of non-zero coefficient
  is only needed if there is a transition that is so slow that
  the slope coefficient would round to zero. If this function is
  called for equal volume and tvolume for channel, the ramp_coef
  remains zero, and not smallest non-zero value.
- The handling of ramp disable with zero initial_ramp is changed
  to similar as for windows fade. The set of coefficient to
  volume delta (a large value for large volume jump) is not correct
  even if it appeared to work. It is a remain from old code where
  ramp was not a function of time but a constant step added.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-04-11 11:55:25 +03:00
Seppo Ingalsuo 51c686f953 Audio: Volume: Fix ongoing gain ramp stop and wrong final gain
In IPC4 the individual channel gains are passed in separate
messages. One channel may have started to ramp to a new gain
while a new channel gain arrives for other channel. If the
gain is same as the previous control value, the ongoing ramp
is stopped and the gain remains at a transition value.

The incorrect code is not fixed but instead the volume_set_volume()
function is simplified. When a volume control is received, it is
assumed that pass-through mode is disabled and ramp is prepared. If
the control is received but gains are not changed, the ramp mode
is finished and pass-through is restored in ramp function.

The volume_set_switch() function is updated similarly to ensure
similar operation.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-04-11 11:55:25 +03:00
Marc Herbert 2cfc85eda0 Use new '-DREM=#' prefix to preserve comments in pre-processed .toml
Having to find source files to read comments is not convenient.

This depends on https://github.com/zephyrproject-rtos/zephyr/pull/67019
which was merged a while ago.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-04-10 09:37:43 +03:00
Tomasz Leman a43981e472 init: zephyr: Fix memory leak during secondary core init
This patch refines the initialization process for secondary cores in a
multicore environment when using Zephyr as the RTOS. The patch
introduces a `check_restore` function specifically for Zephyr, which
checks if basic core structures (IDC, notifier, schedulers) have been
previously allocated and are still present in memory, indicating that
the system is not undergoing a cold boot.

By adding this check, the system avoids unnecessary re-allocation of
these structures during the power-up sequence of secondary cores,
effectively preventing the memory leak observed during repeated power
cycle tests.

fix #9005

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-04-09 17:04:46 +01:00
Tomasz Leman c159c1fa35 init: Refactor check_restore to return bool
This patch refactors the `check_restore` function to return a `bool`
instead of an `int`. This change enhances code readability and clarifies
the intent of the function, which is to return a true or false value
based on the presence of core structures in memory.

No functional changes are introduced by this patch; it is purely a code
quality improvement.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-04-09 17:04:46 +01:00
Ievgen Ganakov 2126e2896e dai: use ibs/obs for dma buffer size calculation
Use ibs/obs size from ipc4_base_module_cfg to properly calculate
period_count. It is especially important when FW aggregation mode
is enabled and there are multiple DMAs allocated under one copier
instance. That way period count for every DMA will be correctly
evaluated and used for DMA buffer size calculation.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-04-05 19:23:30 +03:00
Tomasz Leman 732f07c296 ipc4: Ensure pipeline component directions are synchronized
This patch addresses an issue where audio output could be silent due to
the direction property of pipeline components not being set. The problem
manifests when the pipeline is initialized in the sequence:

Init -> Reset -> Pause -> Ready

In this scenario, the direction property may remain unset, leading to
incorrect pipeline behavior.

In flow of transitions: Init -> Pause -> Ready, this issue does not occur
because the firmware attempts to set the directions in pipe components
during the transition from Init to Pause. This step is skipped if Pause
is done after Reset, which is the scenario that this patch addresses.

The added code ensures that if the source component's direction is unset
but the sink's direction is set, or vice versa, the direction is copied
from the set component to the unset one. This synchronization of the
direction property guarantees that the pipeline's data flow is correctly
established.

This synchronization of the direction property guarantees that the
pipeline's data flow is correctly established, allowing the
`pipeline_for_each_comp` function to traverse and process all components
as intended, thus resolving the silent audio output problem.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-04-04 13:38:23 +03:00
Guennadi Liakhovetski f77bdfbf74 math: avoid re-initialising variables every loop iteration
In psy_get_mel_filterbank() if fb->slaney_normalize isn't set, 3
variables are reset to the same values needless every loop iteration.
Move initialisations outside the loop instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-04-03 15:32:23 +03:00
Adrian Warecki 1ce9e4536c modules: Remove unused module_entry_point from module_data
The value assigned to the module_entry_point field in the module_data
structure wasn't used anywhere. This field has been removed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-03 15:31:42 +03:00
Adrian Warecki 49bd8def85 module_adapter: modules: Remove unused sys_service pointer
The unused sys_service field has been removed from the processing_module
structure. It was never initialized anywhere, and its value was passed as
a parameter to the native_system_agent_start function which did not use it.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-03 15:31:42 +03:00
Adrian Warecki 31207e50f2 module/base: modules: Remove module_adapter from module_data
The value stored by the Processing Module Adapter in the module_adapter
field of module_data structure has been moved to an unused private field.
This change allowed the module_adapter field to be removed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-03 15:31:42 +03:00
Adrian Warecki 99f06ca681 modules: Remove unused buffers
The code allocating/freeing in_buff and out_buff buffers, which were not
used, was removed from the processing module adapter.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-03 15:31:42 +03:00
Adrian Warecki dc19c871c7 modules: Remove unnecessary functions from Processing Module Adapter
To ensure proper operation of native loadable modules it is necessary to
bypass Processing Module Adapter used by IADK modules. This is currently
done by overriding the pointer to module_interface used by the Module
Adapter. Thanks to this, the Module Adapter directly calls functions
provided by native module. As in this case the Processing Module Adapter
functions are omitted, support for native libraries are removed from it as
it is no longer needed. This leads to remove modules_process_raw and
modules_process_audio_stream functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-04-03 15:31:42 +03:00
Peter Ujfalusi baca261531 audio: dai-zephyr: Do not reset the DMA buffer cursor for HD-DMA on TRIGGER_RELEASE
During DMA stop/config/start the read/write pointer of HD-DMA is not
reset unlike other DMAs (GPDMA, DMAC).

Only call the audio_stream_reset() if the link is not serviced by HD-DMA.

Link: https://github.com/thesofproject/sof/issues/8986
Fixes: 9831a9ded7 ("audio: dai-zephyr: reset DMA buffer cursors on TRIGGER_RELEASE")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-04-03 15:26:44 +03:00
Peter Ujfalusi 41bdc0c152 copier: Use correct multiplier for latency to bytes calculation
The latency value is in number of periods (1ms) while the buffer allocated
for the DAI copier is at least 2 periods.
This can shoot up the calculated  stream_start_offset resulting invalid
delay reporting.
Use the period size of the DAI copier to correct this error.

The kernel reported delay currently (on normal non DeepBuffer PCM):
at start: ~302 frames
after 20x pause/resume: ~6530 frames

With this patch:
at start: ~254 frames
after 20x pause/resume: ~3600 frames

The drift rate is about the same with DeepBuffer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-03-26 17:59:28 +02:00
Laurentiu Mihalcea aaf2f11eb9 nxp: imx93: Switch to native Zephyr drivers and timer domain
Starting with this commit, i.MX93 now uses the timer domain
in conjunction with the Zephyr native drivers.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-25 15:12:00 +02:00
Adrian Bonislawski edd489aa19 dp: do not block ppl because of sink/source limits
Module adapter DP copy checks shouldn't block pipeline,
similarly to  LL-only scenario

Add sink free size check to calculate copy size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2024-03-25 09:34:50 +02:00
Serhiy Katsyuba 6f33aee270 kpb: Fix draining task and LL conflict
KPB draining task is executed by low priority preemptible EDF thread.
The task accesses KPB sink buffer and calls comp_copy() for component
connected to sink. If LL thread preempts draining task that could result
in broken state of sink buffer or component connected to sink. This fix
prevents LL from preempting draining task in bad moment.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2024-03-22 10:31:33 +02:00
Kai Vehmanen 6f7aee832c idc: zephyr: remove unnecessary cache invd/flush calls
The IDC message objects are stored to static "idc_work", so
the cache operations are unnecessary when pointers to these
messages are passed around.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-22 10:27:49 +02:00
Adrian Bonislawski 9950b39c7d ipc4: helper: fix checks in comp dir update
- list_is_empty is required to properly check source list
- at this stage empty list is allowed since source bind might not
happen yet

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2024-03-21 21:20:26 +02:00
Guennadi Liakhovetski 480a32857d LLEXT: update for new Zephyr paths
Update LLEXT include directories.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-19 18:00:25 +02:00
Laurentiu Mihalcea fc48fbd1b3 audio: dai-zephyr: convert DMA src/dst addresses to host-relative addresses
The DMAC has the same view of the address space as the HOST.
As such, the source and destination addresses need to be converted
to HOST-relative addresses before attempting to perform a DMA
transfer. This is only relevant for platforms for which the DSP
and HOST have different views of the address space (e.g: i.MX8ULP).

Also, if a platform doesn't define the `local_to_host` macro
(used for converting DSP local address to HOST-relative address)
we assume that the HOST and the DSP have the same view of the
address space. As such, we also add a definition of `local_to_host`
which will just return the passed address.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-18 14:56:32 +02:00
Adrian Warecki 2df6d1b048 modules: lib_manager: Move declare_dynamic_module_adapter to lib_manager
The declare_dynamic_module_adapter function has been moved from
module_adapter/module/modules.h to lib_manager and renamed to
lib_manager_prepare_module_adapter. It was and still is only used in
lib_manager.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-18 14:43:58 +02:00
Adrian Warecki e0aba2b67a component: module_adapter: Move module_interface pointer to comp_driver
Moved pointer to module_interface from struct module_data to comp_driver
structure. The change is aimed at clearing the module_data structure of
fields intended for exclusive use by sof. All modules are eventually use
module interface so this pointer will be in comp_driver anyway.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-18 14:43:58 +02:00
Adrian Warecki dff7332326 lib_manager: Set target memory flags after data loading from storage
Memory region must first be mapped as writable to allow data to be placed
there. Then the target access flags are set, e.g. read-only and executable.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-15 22:31:12 +02:00
Adrian Warecki 9ffff145fe llext_manager: Remove unused desc parameter
Removed unused desc parameter from llext_manager_load_module and
llext_manager_unload_module functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki 73ab99e554 lib_manager: llext_manager: Add const to module allocate functions
Added a const modifier to the ipc_config parameter passed to functions
lib_manager_allocate_module and llext_manager_allocate_module.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki a11dd14c0c lib_manager: llext_manager: Add const modifier to module manifest pointers
To prevent unintentional modification of a loadable library manifest,
a const modifier has been added to all variables pointing to it.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki 3c114b5595 lib_manager: llext_manager: Simplifying parameter list for free module
Instead of a pointer to a component driver and ipc config, the
lib_manager_free_module and llext_manager_free_module functions now gets
component id.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki e0b6f5a94c lib_manager: Simplifying parameter list for lib_manager_register_module
Removed pointer to a library manifest from the parameters list of the
lib_manager_register_module function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki 9ec3a51352 lib_manager: Verify preload_page_count from module manifest
The preload_page_count value from the loadable library manifest is used to
determine size of allocated memory buffer. If this value is smaller than
the manifest size, it will lead to memory corruption.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Adrian Warecki 7f2c789efd lib_manager: Add const to library manifest variable
Added a const modifier to the module manifest variable in the
lib_manager_store_library function to prevent it from being accidentally
modified.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-03-13 10:19:57 +02:00
Kai Vehmanen b97f81a36a idc: zephyr: add a timeout to blocking IDC send
Replace infinite wait with a time-limited wait. In case a blocking
IDC message is not handled within IDC_TIMEOUT, return an error
instead of waiting. This allows to debug stuck core-to-core communication
easier.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-11 14:24:24 +02:00
Andy Ross 83f69f144f mt8195: Disable GOOGLE AEC MOCK by default
The mocking layer is an important debugging tool.  It shouldn't be on
by default lest we accidentally build without the real feature.

Signed-off-by: Andy Ross <andyross@google.com>
2024-03-11 11:43:08 +02:00
Andy Ross 8ab49bbf24 mt8195: Bump task stack size for Google AEC
AEC initialization is stack-hungry, needing ~6kb during
initialization.  That happens under the IPC task, not a
component-local stack.  So bump the default for all tasks as that's
the only way to make sure IPC gets it.

(Really this shouldn't be a platform choice, but that's where the
symbol exists)

Signed-off-by: Andy Ross <andyross@google.com>
2024-03-11 11:43:08 +02:00
Andrula Song 02e88372d0 Audio: Component: Add HiFi5 implementation of cir_buf_copy.
Add HiFi3 & HiFi5 implementation of function cir_buf_copy.
Compared with generic C version, the HiFi3 version can save
about 3% cycles and HiFi5 version can save about 40% cycles.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 17:01:03 +02:00
Andrula Song 40c8e477f0 Audio: Component: Fix the potential risks of HiFi3 audio_stream_copy
Use while (shorts > 0) instead of while (short) to reduce the forever
loop risk.

Use general instruction AE_MIN32 replace AE_MIN_32_signed which is an
internal proto intended for Xtensa compiler.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 17:01:03 +02:00
Andrula Song 50c8aeb710 Audio: Component: Add HiFi5 implementation of audio_stream_copy
Add HiFi5 implementation if function audio_stream_copy, compared
with HiFi3 version, the HiFi5 method can save about 29% cycles.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 17:01:03 +02:00
Laurentiu Mihalcea 1f87ffcea0 ipc3: dai: change channel decoding function for native SAI and ESAI
The native SAI and ESAI drivers use a different handshake
encoding. As such, when using native Zephyr drivers use a
different function for decoding the channel from the handshake.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea ef06790b94 audio: dai-zephyr: add function for computing DMA slot
In the case of some DAIs, the DMA slot may be encoded
differently in the DAI configuration handshake. As such,
we can't count on the fact that the handshake itself can
be used as the DMA slot. To fix this, add a function which
parses the handshake and allows each DAI to use its own
encoding of the DMA slot inside the handshake.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 76c0595938 audio: dai-zephyr: Add state change on DAI trigger
Currently, the DAI component's state is not updated on
dai_trigger() operation, which leads to pipeline_comp_copy()
skipping the dai_copy() operation (since the DAI component
never transitions to the ACTIVE state). To fix this, add
a state transition in dai_comp_trigger_internal(). Also,
make sure not to trigger the DAI component if already in
the requested state.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 87558f8260 audio: dai-zephyr: Set source/destination address adjustment
Some DMACs (e.g: NXP's EDMA) can automatically adjust the source and
destination addresses upon transfer completion. As such, we need to
indicate how the adjustment should be performed. In the case of playback,
the source address should be decremented, while in the case of capture,
the destination address should be decremented.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 2c56be62ab audio: dai-zephyr: Allow dai_set_config() to work for NXP's SAI
Since now there's a Zephyr driver for NXP's SAI, the dai_set_config()
should be modified to also allow the configuration of the SAI.
As such, this commit introduces a new case for NXP's SAI that does
exactly that.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 237a2faca4 lib: dai: Add entry for NXP's SAI
Since the Zephyr SAI driver is now enabled, add an entry in
the zephyr_dev array, which will resolve to multiple
"struct device *", one for each SAI node specified in the DTS.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea c375a95245 audio: host-zephyr: Set SRC/DEST addresses during host_common_params()
Source and destination addresses cannot be NULL. As such,
set them to the values found in the first element of
hd->config's elem_array. This is fine to do because the host
component uses only 1 block.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea b0de76420e audio: host-zephyr: Update DMA block configuration when re-configuring
With every copy() operation, the source and destination addresses
keep getting modified. As such, for each re-configuration performed
during host_copy_one_shot(), the HOST DMAC needs to be made
aware of these changes.

This commit changes host_copy_one_shot() such that on each
dma_config() call the DMAC driver receives the updated
addresses and size.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 886026ea85 ipc3: host-page-table: Add native version for ipc_get_page_descriptors()
Since the DMAC is configured in a somewhat different way in the
native case vs the non-native case, add a native version of the
ipc_get_page_descriptors() function and remove the Zephyr-specific
functions from the non-native version of said function.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Guennadi Liakhovetski 980b1c64f2 smart-amp-test: make a loadable module
Convert the smart-amp-test in its IPC4 version to a loadable LLEXT
module. Use an overlay configuration to select between monolithic and
modular builds.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 6b9b4c24d2 modules: don't re-load on each restart
While modules are in use, no need to unload and re-load them,
re-initialising audio interfaces is enough. With llext modules this
uses the LLEXT reference counting to identify when a module should be
unloaded.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 5d202ba726 modules: split modules_init() into two parts
The first part modules_new() is only needed when a new module is
registered, the rest is needed every time a module is instantiated.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 1481770a0e lib-manager: use an appropriate type for a pointer integer
lib_manager_allocate_module() returns a pointer as an integer, use
uintptr_t for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski ca29bfb895 module: (cosmetic) regroup some declarations and assignments
Regroup code in modules_init() to move declarations and assignments
closer to where they're needed.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 9db256806c lib-manager: fix a wrongly named .desc pointer
Pointers that we store in a global array for each loaded library,
aren't really firmware manifest descriptor pointers, they're pointers
to storage buffers, where entire libraries are stored. A
SOF_MAN_ELF_TEXT_OFFSET offset has to be added to that address to get
to the manifest descriptor.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski bf1dfb40fb module-adapter: add Zephyr extension context
Module adapter drivers can be loaded and unloaded, using the Zephyr
loadable extension API. Add its context to struct struct module_data.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 6de605d737 lib-manager: migrate to module adapter context
lib-manager is module-adapter specific, it doesn't need the component
API and shouldn't use struct comp_driver in function arguments.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 4d3c2ee51f lib-manager: add support for llext
Add support for loadable modules, built for dynamic linking with
Zephyr's LLEXT API.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Andrula Song e48a171837 Audio: DRC: DRC math function optimization.
Use the xtense intrinsic instrunctions directly can save
at least 10% cycles for those functions, and save about
0.9mcps for DRC component.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 14:24:40 +00:00
Kai Vehmanen 22b3518601 west.yml: update Zephyr to f9f44b6dcdd
Switch back to main Zephyr repository and commit f9f44b6dcdd.

This includes following squashed SOF commits that are
needed to adapt to HWMv2 changes in Zephyr:

zephyr: app: scripts: intel_adsp: change board names to HWMv2
zephyr: sof: update board name for HWMv2
zephyr: intel_adsp: Change ACE SoC name to HWMv2
app: boards: imx93: updates for zephyr hwmv2

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-08 13:16:58 +02:00
Yong Zhi 6ec15f6d88 audio: google: use system directories for mock header include
No function change, builds fine.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2024-03-06 10:13:45 +02:00
Marc Herbert 4f59ee80b4 ipc-helper.c: reject invalid SOF_MEM_CAPS_* bits
Fixes lack of SOF_MEM_CAPS_* input validation found in #8832

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-05 13:09:35 +02:00
Jakub Dabek f5a11dc454 boot_test: change call of boot tests
Boot tests were dependent on ipc. Change to run theme as part of
zephyr boot process.
Calls to zephyr api were deprecated and would not build with current
zephyr version. Update the call.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-03-05 11:11:20 +01:00
Marc Herbert 60f517cd09 config L3_HEAP: add missing "ACE" dependency
In Zephyr, L3_HEAP is available in `intel_ace15_mtpm/adsp_memory.h` and
`intel_ace20_lnl/adsp_memory.h` but not in `intel_tgl_adsp/adsp_memory.h`

Don't allow configuration that can't possible compile.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-05 11:49:39 +02:00
Guennadi Liakhovetski 44376d86db module: (cosmetic) use an existing local variable
modules_init() already has a "dev" variable, no need to re-calculate
it repeatedly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-01 16:50:13 +00:00
Andrula Song 0b3b5740aa Audio: Mixin_mixout: Add HiFi5 implementation.
Add HiFi5 implementation of mix functions, compared with
HiFi3 version, can reduce about 27% cycles.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-02-27 10:57:02 +00:00
Baofeng Tian ab87904698 Math: add build option to math filter
EQFIR EQIIR and TDFB are all refered from math filter, so
define option in math filter, use unified SIMD selection for
EQFIR EQIIR and TDFB.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-02-26 16:43:07 +00:00
Baofeng Tian 80dd84c333 DRC: add simd build option to DRC
Add HIFI build option to DRC module, with this, developer
are able to select HIFI version for SOF build.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-02-26 16:43:07 +00:00
Baofeng Tian 7e3f4a2f21 copier: Add copier simd option
Add copier simd HIFI option, with this adding, developer
can select which HIFI version used for copier.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-02-26 16:43:07 +00:00
Baofeng Tian 1cb8d8fb19 ASRC: add simd config for ASRC module
With simd config adding, user are able to choose simd
version for ASRC build.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-02-26 16:43:07 +00:00
Guennadi Liakhovetski 6795011794 ipc4: don't keep stale pointers, avoid double freeing
When freeing memory it's also good to clear the pointer to avoid
use-after-free or double-free bugs.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-02-26 12:21:39 +00:00
Guennadi Liakhovetski 081bcab6ef ipc: (cosmetic) use an existing variable
Use a local variable instead of calling ipc_get() again in
ipc_send_queued_msg().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-02-26 12:21:39 +00:00
Andrula Song 97a50e3243 Audio: Fix the kconfig error of mixin_mixout.
Fixes the commit f4d043724d ("Audio: Move components related config
to subfolder").

Due to a copy/paste error, the content of mixin_mixout/Kconfig has
been a copy of aria/Kconfig. This patch fixes the copy/paste error,
and adds IPC version dependence for COMP_MIXER and COMP_MIXIN_MIXOUT.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-02-23 11:46:15 +00:00
Laurentiu Mihalcea 9831a9ded7 audio: dai-zephyr: reset DMA buffer cursors on TRIGGER_RELEASE
On NXP platforms, stopping the DMAC and then re-configuring it
leads to the internal DMA buffer cursors being reset. Leaving the
SOF DMA buffer cursors in the same state means the DMA driver
and SOF may potentially end up with two different views of the
same buffer (from the cursors' point of view). This in, turn,
may lead to the DAI consuming stale data because of the values of
"free" and "pending" queried from dma_reload() stopping
dai_common_copy() from copying new data. To fix this, reset the
read and write cursors of the DMA buffer from SOF side. This
way, both SOF and the DMA driver will have the same initial
view of the DMA buffer cursors.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-23 11:29:51 +02:00
Laurentiu Mihalcea 3681e099de audio: host-zephyr: Allocate DMA block configuration on heap
Currently, the DMA block configuration (struct dma_block_config)
is placed on the stack during host_common_params(). Later on,
host_copy_one_shot() tries to re-configure the DMAC driver
using the same block configuration that's located in a stack
frame that's no longer valid. As such, allocate a DMA
block configuration on the heap during host_common_params()
which can be used later on (e.g: during host_copy_one_shot())
to reconfigure the DMAC.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-20 09:52:44 +02:00
Adrian Warecki f991b7d957 module: Extend module error code definitions
Ported additional error code definitions from iadk module API.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-02-19 14:31:09 +00:00
Ranjani Sridharan 06b3e329da tools: plugin: modules: Introduce the OpenVino noise suppression module
Introduce a new module that performs noise suppression. The module loads
the noise suppression model using the OpenVino Runtime plugin, processes
the input samples to produce output samples with clean speech.
CUrrently, the module is hard-coded to compile the model to be run on
the CPU only and will be extended for other devices like the NPU in the
future.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 3540548b95 src: panic: Modify the signature of __panic()
Make the filename argument be a const char * to avoid the following
warning with c++ compliation:
warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan dfd8ffa069 audio: audio_stream: Explicitly cast to enum
To prevent the following with C++ compilation.
error: invalid conversion from ‘uint32_t’ {aka ‘unsigned int’} to ‘sof_ipc_frame’ [-fpermissive]

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Marcin Szkudlinski 7c0c8a400c dp: delayed start should apply to the first DP cycle only
When DP start, copy from DP to LL should be delayed till first
DP deadline time.

In current implementation the cycle counter is set at every
DP scheduler trigger. If DP is - for any reason - scheduled
again before its deadline passes, the counter will be set again
and copying delay time will be too long. In extreme situation
(i.e. if OBS is set to long value when IBS is short - in this case
DP will proceed a short data chunks with a long deadline), it may
lead to permanent stuck in processing.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-02-12 18:09:48 +02:00
Marcin Szkudlinski 8b99003733 dp: add an error message in DP/LL copying
In case of theoretically impossible event of LL-DP
copy failure, an error message should be issued

Message is better than assert - as stated this should
never happen, but if it happens its better to have a
glitch + message than a crash

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-02-12 18:09:48 +02:00
Peter Ujfalusi bdf2143d88 audio: dai-zephyr: Fix config option string for reversed trigger
The correct config to use for ifdef for reversing the stop trigger order
is CONFIG_COMP_DAI_STOP_TRIGGER_ORDER_REVERSE

Fixes: a6a80ec97a ("dai-zephyr: Fix the ordering of DAI and DMA triggers")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-09 19:25:40 +02:00
Brent Lu f9bcf61b9a audio: volume: support switch control
Implement function to support SOF_IPC4_SWITCH_CONTROL_PARAM_ID in
set_configuration callback. Linux side could use this switch control
to mute/unmute a gain widget.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2024-02-08 16:58:21 +00:00
Kalva, DineshKumar a25c70e183 amd: enable probe functionality config for AMD/Renoir platform.
Enable probe functionality config for AMD/Renoir platform.

Signed-off-by: Kalva, DineshKumar <dineshkumar.kalva@amd.com>
2024-02-08 16:04:18 +00:00
Kalva, DineshKumar cdd9863718 amd: initialization of dma descriptors for probe functionality for AMD/Renoir platform.
Initialization of dma descriptors for probe functionality
for AMD/Renoir platform.

Signed-off-by: Kalva, DineshKumar <dineshkumar.kalva@amd.com>
2024-02-08 16:04:18 +00:00
Marcin Szkudlinski b3d569a523 AEC: convert aec to use sink/src interface
This commit changes AEC to use sink/src interface
and makes it to be a DP module

it also enables optional usage of 32bit AEC API

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-02-08 11:48:20 +00:00
Guennadi Liakhovetski 7f4e6aed74 src: make coefficients constant
Make coefficients and their tables constant.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-02-07 12:37:23 +00:00
Guennadi Liakhovetski 45dc968cb2 lmdk: fix building system-service modules
System-service modules cannot include Zephyr headers and don't use
exported symbols, they link sink_api.c and source_api.c into their
images. Disable symbol exporting for them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-02-06 09:50:31 +02:00
Jaroslaw Stelter 8cad5bea57 lib: alloc: Use aligned allocation for L3_HEAP usage.
L3_HEAP is used in library manager for library storage buffer allocation
and in D3 enter/exit flows to allocate IMR context storage buffer.
Both buffers should be aligned so use rballoc_align() routine to get
correctly aligned buffers.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-02-01 12:15:30 +02:00
Andrula Song d9bd3d29ce Audio: Aria: Use new ARIA HiFi config style
Use the new CONFIG_ARIA_HIFI style to choose right processing
file.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-01-31 23:41:21 +02:00
Andrula Song d46d7831cb Audio: Aria: Add HiFi5 SIMD align limit set.
Since the HiFi5 implementation of aria uses 32x4 load
and store instructions, so add the HiFi5 version alignment
set for aria.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-01-31 23:41:21 +02:00