Commit Graph

12758 Commits

Author SHA1 Message Date
Kai Vehmanen 0a104814bc schedule: zephyr_domain: make alternate ll stat reporting the default
Make SCHEDULE_LL_STATS_LOG_EVERY_OTHER_WINDOW=y the default.
This in practise filters out the impact of the stat logging
from the results. Another impact is that logging rate is halved
to once per two seconds with the new default settings.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-19 15:33:34 +02:00
Kai Vehmanen 6bae209730 schedule: zephyr_domain: change overrun semantics for LL stats
Change the logic how overrun count is reported out in the
low-latency scheduler statistics reporting. Instead of resetting
the overrun count after every window, keep a cumulative count
of overruns seen. Overruns are in practise a rare occurrence and
this change makes the CONFIG_SCHEDULE_LL_STATS_LOG_EVERY_OTHER_WINDOW
option more useful as one can still track overruns for all
executed iterations, even if reporting is done at a slower pace.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-19 15:33:34 +02:00
Kai Vehmanen 151e137dcf schedule: zephyr_domain: make LL reporting build-time configurable
Add Kconfig options to enable and disable the low-latency
scheduler statistics reporting, and to set the window size.

Also add an option to set reporting to be done only for every other
statistics window. This can be useful to exclude impact of
the logging itself. With most current configurations and logging
backends, printing out the scheduling report at the end of
the window, will show up as an execution time spike on the first
iteration of the subsequent measurement window. This can mask
spikes caused by other components in the system.

Defaults match the earlier settings hardcoded in code, so this commit
has no functional change.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-19 15:33:34 +02:00
Seppo Ingalsuo b826d6c89c Test: Cmocka: Add unit test for function drc_inv_fixed()
This patch adds unit test for the inverse function used in DRC
component. The function is tested with all used Q-formats
for input and output with 500 points in the positive int32_t
range. Negative numbers are not tested since the DRC specific
function inverse function does not need and implement it.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-19 09:57:20 +00:00
Seppo Ingalsuo ba070748c4 Test: Cmocka: Create new platform unit_test_defconfig
This patch adds to unit tests platform unit_test to be able
to add new Kconfig enables without altering configuration of
of other production platforms.

The used platform for the purpose is MTL to be able to unit
test code for HiFi4. Components/features to test can be
freely added to unit_test_defconfig.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-19 09:57:20 +00:00
Bard Liao 672d0e5d55 Topology2: add sof-lnl-rt713-l2-rt1320-l13 support
rt713_vb on SoundWire link 2 and rt1320 on SoundWire link 1 and 3.
Which is another configuration of Realtek Gen6 AIOC.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-19 09:48:05 +00:00
Bard Liao c3fb7b27c4 Topology2: add sof-ptl-rt713-l2-rt1320-l13 support
rt713_vb on SoundWire link 2 and rt1320 on SoundWire link 1 and 3.
Which is another configuration of Realtek Gen6 AIOC.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-19 09:48:05 +00:00
Bard Liao 8ab068a1d6 Topology2: add sof-ptl-rt712-l2-rt1320-l1 support
rt712_vb on SDW link2 and 1 rt1320 on SDW link2.
This is one of the audio configurations on Realtek Gen6 AIOC.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-19 09:48:05 +00:00
Kai Vehmanen eb4d0a9c08 zephyr: rtos: implement wait_delay variants with k_busy_wait
Implement wait_delay*() variants with k_busy_wait(). If some
target requires to customize the busy wait implementation,
this can be done with Zephyr CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT.

Remove idelay() as this is no longer used in generic SOF code.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:09:04 +00:00
Kai Vehmanen 85e876c7ae zephyr: lib/cpu: use k_busy_wait instead of idelay
Prepare to remove idelay() use from generic code, so it can be removed
from the SOF rtos abstraction layer. This is Zephyr specific code,
so k_busy_wait() can be used directly.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:09:04 +00:00
Kai Vehmanen c867348ce2 samples: audio: detect_test: use wait_delay instead of idelay
Prepare to remove idelay() use from generic code, so it can be removed
from the SOF rtos abstraction layer.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:09:04 +00:00
Kai Vehmanen d56153635f idc: use wait_delay instead of idelay
Prepare to remove idelay() use from generic code, so it can be removed
from the SOF rtos abstraction layer.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:09:04 +00:00
Seppo Ingalsuo 4633f15d23 Audio: DRC: Fix DRC enable control switch handling for HiFi4
The HiFi4 build is looking for enable only from the
configuration blob and the ALSA switch control has no impact.
This change unifies the operation with generic and HiFi3
builds.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-18 17:02:34 +00:00
Kai Vehmanen c219219b5d platform: imx95: remove platform lib/dai.h
No longer needed for Zephyr builds, can be removed as unused.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen a048a6437d platform: intel: remove lib/dai.h for all Intel platforms
No longer needed for Zephyr builds, can be removed as unused.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen 94aec202f0 lib: dai: remove platform include from dai-zephyr.h
Use of native Zephyr DAIs has no dependency to SOF platform
definitions anymore, so this include can be removed.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen 1d4b5caccd audio: chain_dma: use devicetree definitions directly
Stop using the SOF platform layer and directly pull the hardware
properties from devicetree.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen 6c0efc6d98 audio: base_fw_intel: use alh.h instead of platform dai.h
To calculate the gateway count in hardware config IPC response,
ALH bidirection link count is needed.

Instead of pulling this from the SOF platform layer, use
the ipc4/alh.h directly as it now has this information.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen fdf139ca44 audio: base_fw_intel: use DT for SSP/HDA properties
Stop using platform layer to query number of SSP instances
and number of HDA in/out DMA channels. The hardware specific
information is already defined in device tree data, so no need
to have same information duplicated in SOF platform layer.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Kai Vehmanen d0d0702f98 ipc4: alh.h: handle hw variants directly in alh.h
The alh.h headers have used SOF platform layer to handle
differences between different Intel ALH generations. In the end
the only difference is the encoding used for DAI index.

Move the variation to ipc4/alh.h directly as this only affects
Intel builds with ALH support.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 17:01:24 +00:00
Seppo Ingalsuo d2a231f216 Math: Optimize sofm_exp_fixed() HiFi version
The unnecessary shift and multiply functions can be removed
with use of normal C shift left and with use xtensa multiply,
shift, and round intrinsics directly in the function.

This change saves in TGL HiFi3 platform 1.3 MCPS in DRC
processing mode.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-18 11:20:07 +02:00
Seppo Ingalsuo 368b03ec03 Test: Cmocka: Add unit test for sofm_exp_fixed() function
There was no unit test for the function, so it is added. The
pass criteria is tuned for current implementation to just
pass in the three defined regions. It is useful to verify
the next changes to optimize the function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-18 11:20:07 +02:00
Kai Vehmanen 148aad69d0 platform: intel: drop PLATFORM_DEFAULT_DELAY from platform.h
PLATFORM_DEFAULT_DELAY is not needed in Zephyr builds, so it
can be dropped from platform.h for all Intel platforms.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-18 11:00:01 +02:00
Grzegorz Bernat 054e6ca918 app: intel_adsp_ace30_ptl.conf: enable CONFIG_COUNTER
A new definition has been added, which is crucial for the proper
execution of the test test_102_08_extended_time_check.
This definition ensures the correct operation of the
basefw_get_ext_system_time() function.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
2024-11-15 09:52:51 +02:00
Kai Vehmanen b86f19a480 audio: chain_dma: update build time dependencies
Add explicit dependency to CONFIG_DMA_INTEL_ADSP_HDA as the current
chain DMA uses HDA definitions in its implementation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-14 20:03:42 +02:00
Kai Vehmanen 429fa14b93 platform: imx93_a55/imx95: remove lib/cpu.h
Platform cpu.h no longer needed in Zephyr builds, so remove
these files as obsolete.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-13 15:44:32 +02:00
Kai Vehmanen f1cac03e03 platform: Intel: remove lib/cpu.h
cpu.h definition is no longer needed in platform definitions for
SOF Zephyr builds. Remove for all Intel targets.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-13 15:44:32 +02:00
Kai Vehmanen 5ced8a4f62 zephyr: lib/cpu.h: remove dependency to platform layer
Remove dependency to platform cpu.h layer for Zephyr targets. The lib/cpu.h
is now common to all SOF targets when building for Zephyr.

Add a note to PLATFORM_PRIMARY_CORE_ID documentation that "primary core"
is a SOF/application convention and not visible in Zephyr OS interfaces.

Core 0 is the boot core in Zephyr, so use this definition as
PLATFORM_PRIMARY_CORE_ID for all SOF targets. This was already the case
in all platform definitions, so no functional change.

In SOF, the primary/secondary distinction is primarily used
in IPC code, together with Zephyr CONFIG_SMP_BOOT_DELAY=y.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-13 15:44:32 +02:00
Kai Vehmanen afaa9e8fec west.yml: update Zephyr to c50777a84311
Includes the following changes potentially relevant to SOF:

ac162b041abf intel_adsp: set exec for simulator targets
475878428c11 soc: intel_adsp: tools: cavstool.py: add RPL and ADL-N support
7ad012d3bbd1 soc: intel_adsp: tools: sort cAVS2.5 PCI DIDs in cavstool.py
2c79024b2f71 soc: intel_adsp: tools: cavstool.py: add PCI DIDs for Intel Arrow Lake
8795a17fa210 soc: intel_adsp: tools: reword cavstool.py startup log message
52bd2ff9a6ca soc: intel_adsp: tools: continue cavstool.py legacy cleanup
cdd563500292 nxp: imx8m: adsp: enable the irqstr interrupt controller
18419b618f20 llext: xtensa: fix relocations with multiple SLOT0_OP
d3aa1709631b drivers: dai: sai: support pm runtime operations
52efa3bb9b8a soc: intel_adsp: tools: fix ace15 ROM status check in cavstool.py
256ab0c9191c ace: mm: tlb: Check tlb translation enabled before flushing cache
0e9b9b0cf304 ace: mm: tlb: Ignore unmappig error in driver initalization
e8d28bfdfd15 drivers: dai: sai: disable IRQs when not needed
48b98a9284c3 drivers: dma: dma_nxp_edma: disable IRQs when not needed
c7be48aae42b drivers: intc: irqstr: manage dispatchers dynamically
d274cabf839c drivers: intc: irqstr: add reference count for IRQs
b43e7387db4d tests: mem_map: no exec test for intel_adsp/ace30/ptl
3d65839dbc58 tests: rename intel_adsp_ace30.conf to intel_adsp_ace30_ptl.conf
32f9ecacc429 soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset_by_type()
80e629cd974a soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset()
9563960bde37 soc: intel_adsp: tools: cavstool: Fix fw_is_alive() and wait_fw_entered()
91495812bdb5 soc: intel_adsp: tools: cavstool.py: Make map_regs() shareable
c2126cb90686 soc: intel_adsp: tools: cavstool.py: argsparse code to separate function

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-11-12 20:02:25 +02:00
Bard Liao 4f194aa91b Topology2: rename sof-lnl-rt712-rt1320x1
The rt1320 could use the same SoundWire link as rt712. In that case
there is still one rt1320, but  the NUM_SDW_AMP_LINKS should be 1.
Name the tplg with the exact link number to avoid confusing.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-12 20:01:52 +02:00
Uday M Bhat 7303db20f8 topology2: Update I2S MAX98260a, RT5682, 2 DMICs topology for PTL platform
PTL blobs are different for I2S. This entry will create a
topology for I2S MAX98360a(SSP1), RT5682(SSP0) codecs, BT
at SSP2 and PDM0, PDM1 DMIC.

This also enables deep buffer for speaker and headset

Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
2024-11-11 16:33:56 +00:00
Bard Liao b372425d70 Topology2: add more rates support for SDW jack
Add 96KHz/192KHz rates support for SoundWire jack device.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-07 12:39:26 +00:00
Tomasz Leman 79ca991e8d ipc: add cache flushing and invalidation for IPC data
This patch addresses an issue with incorrect IPC responses due to the
lack of cache flushing and invalidation on secondary cores.

The following changes have been made:

1. Added cache writeback for IPC message data in `ipc_msg_send` when the
   current core is not the primary core.
2. Added cache invalidation for IPC message data in
   `ipc_prepare_to_send` before writing to the mailbox.

These changes ensure that the IPC data is correctly synchronized between
cores.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-11-05 17:09:07 +00:00
Ievgen Ganakov c0195761ac ipc4: helper: fix stream params frame format update
During assignment of ipc4_base_module_cfg, received in
Init Instance IPC, to sof_ipc_stream_params valid_bit_depth is used
to set frame_fmt instead of container size. It is then applied to
buffer format in params/prepare stage. Thus, leads to inconsistency
between buffer format and audio stream params provided in IPC.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-11-05 17:07:46 +00:00
Bard Liao 72d03ef718 topology2: rename sof-arl-rt722-l0-rt1320-l2
The file name defined in the Linux kernel is
sof-arl-rt722-l0_rt1320-l2.tplg.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-05 14:54:52 +02:00
Marcin Szkudlinski 06c9d7e40a buf: remove unnecessary cache operation
All control structures of buffers shared between cores
are now stored in a non-cached memory alias.
Cache writeback is no longer needed here

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-11-05 10:49:48 +00:00
Marcin Szkudlinski 59d1fae5ec buf: ring_buffer and comp_buffer use default methods
This commit modifies both existing buffers implementations
to use simplified API for sink/source/audio_buffer

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-11-05 10:49:48 +00:00
Marcin Szkudlinski d345f29de5 buf: extend audio_buf api and add default sink/src handlers
There are 3 APIs each buffer must implement (Sink/src/audio_buffer)
for data producers/consumers/maintenance
each of them need to have methods doing same operations - like settings
stream parameters

this commit provides simplification for buffer implementation -
it is enough to implement those methods for audio_buffer API, default
handlers for sink/src will propagate calls accordingly

Specific handlers for sink and source may still be provided
i.e. in case when sink or source API is not provided by a buffer
but some other data producer (i.e. DAI)

Also a default implementation of .audio_set_ipc_params is provided,
that probably will fit needs of all buffers' implementation,
except of currently used legacy comp_buffer

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-11-05 10:49:48 +00:00
Marcin Szkudlinski 310cd361f5 buf: add .clean method to audio_buffer API
clean method does clean all buffer data
leaving config as is
Need to be implemented as virtual method
as is implemented difrently in each buffer type

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-11-05 10:49:48 +00:00
Marcin Szkudlinski b9c269cdb1 audio: spelling correction: audo to audio
sof_audo_buffer_from_* => sof_audio_buffer_from_*

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-11-05 10:49:48 +00:00
Jyri Sarha 53f2d9692a probe: Convert to module API
This commit converts probe debug feature from component to module API.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2024-11-04 19:35:29 +02:00
Seppo Ingalsuo 200efc3616 Tools: testbench: Update README.md text after IPC4 switch
The document is updated after changing build default to IPC4
and to show usage of added helper scripts.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-04 12:21:00 +00:00
Seppo Ingalsuo 5dff3d15cb Tools: Testbench: Add useful script for run and profile
This patch adds scripts sof-testbench-helper.sh and
sof-testbench-build-profile.sh to ease audio module
developer's frequent tasks.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-04 12:21:00 +00:00
Seppo Ingalsuo c0419663a5 Audio: DRC: Use audio_stream_copy() with pass-through configuration
The configuration blob is checked in drc_prepare(). If
the blob does not have params.enable set, then it is safe
to switch to a more efficient buffer copy function that
bypasses the internal DRC lookup delay with channels
de-interleave and interleave operations. The enable in the
blob is a master switch for DRC. With such configuration in
the blob the switch control from user space can't switch the
processing on. Therefore it is safe to change the processing
function. This change minimizes the MCPS overhead of unused
DRC and reduces audio latency.

If a new blob is received during streaming, the params.enable
is checked again and the processing function is set again
if the pass-through copy mode was in use. If the new blob
has enable false, then the processing is changed to pass-through
mode.

The pass-through blob configuration is useful when the same
pipeline is used for both headphone and speaker, where DRC
is usually disabled for headphone mode.

This change saves in hda-generic topologies with the default
blob about 1.2 MCPS in TGL platform.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-11-01 12:12:01 +00:00
Bard Liao aa72477fc2 Topology2: add sof-lnl-rt712-rt1320x1 support
rt712_vb on SDW link2 and 1 rt1320 on SDW link2.
This is one of the audio configurations on Realtek Gen6 AIOC.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2024-11-01 12:11:17 +00:00
Seppo Ingalsuo 2f4efa5254 Audio: Volume: Fix some typos in comment texts
Changed adsress -> address, also the comments are edited to avoid
to be mistaken as Doxygen.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-31 10:34:13 +02:00
Andrula Song 3788f6e9de Audio: Volume: Add HiFi5 implementation.
Add HiFi5 implementation of volume functions, compared with
HiFi3 version, can reduce about 28% cycles.

Signed-off-by: Andrula Song <andrula.song@intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-31 10:34:13 +02:00
Kai Vehmanen 4740e89648 zephyr: move to strict headers builds for all targets
Remove CONFIG_SOF_ZEPHYR_STRICT_HEADERS and make strict headers mode the
only supported way to build SOF with Zephyr. This means SOF Zephyr
builds do not use any headers from sof/xtos/include anymore.

This change simplifies the SOF build as full RTOS adaptation is
in sof/zephyr/include for Zephyr builds.

Link: https://github.com/thesofproject/sof/issues/9015
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-10-30 17:34:31 +00:00
Richard Fitzgerald 808eacdc0f topology2: sdw-amp-generic: Add 6 and 8 channel feedback
Add support for 6 channel and 8 channel amp feedback.

The host-copier defaults provide 2 channel stereo and 4 channel 3.1.
Use the value of AMP_FEEDBACK_CH to set special case input and output
formats for 6 channels and 8 channels.

The alh-copier also needs special cases for 6 and 8 channels.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
2024-10-30 17:32:19 +00:00
Richard Fitzgerald 328e6151de topology2: sdw-amp-generic: Remove hardcoded number of feedback channels
Replace the hardcoded assumption of 2 feedback channels per link

A new constant AMP_FEEDBACK_CH_PER_LINK is added to set the number of
channels for the link BE DAI, replacing the original hardcoded value
of 2.

The default values are:
  For NUM_SDW_AMP_LINKS=1:
    AMP_FEEDBACK_CH=2, AMP_FEEDBACK_CH_PER_LINK=2

  For NUM_SDW_AMP_LINKS=2:
    AMP_FEEDBACK_CH=4, AMP_FEEDBACK_CH_PER_LINK=2

The alh-copier definition has been rewritten so that it is based only on
AMP_FEEDBACK_CH, instead of making assumptions from NUM_SDW_AMP_LINKS.
It supports 2 or 4 total feedback channels. Support for 1 and 3 feedback
channels has not been included because these are unusual and the code is
smaller without them. They can be added later if they are needed.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
2024-10-30 17:32:19 +00:00