Commit Graph

12483 Commits

Author SHA1 Message Date
Shriram Shastry b381f55833 Audio: Add comments to crossover_s32_default function
Add Doxygen comments to describe the parameters and functionality of
the crossover_s32_default function. This helps in understanding the
function's flow and the purpose of each section.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-26 11:10:51 -07:00
Shriram Shastry 91aecce862 Audio: Optimize crossover_s32_default function for performance
Optimize the function by pre-initializing active sinks and adjusting loops
for better performance and readability.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-26 11:10:51 -07:00
Curtis Malainey 10bffa799c selector: fix memcpy parameters
We should be using the trusted max size passed in via the framework
rather than the scratch memory we are passing into the host.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-26 08:33:48 -07:00
Curtis Malainey 501b961554 selector: add a minimum size check for get_data
Check to make sure we actually have enough space to copy the config, if
we don't we will assert and crash when we could have handled this
gracefully.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-26 08:33:48 -07:00
Peter Ujfalusi 7b021f6e20 src: host-zephyr: Drop function name from comp_* prints
The comp_* macros will print the function name from where they are called,
there is no need to print them twice.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-08-23 14:12:16 +01:00
Peter Ujfalusi a419509606 src: dai-zephyr: Print out the src/sink frames along with 'nothing to copy'
The 'nothing to copy' without context does not help in debugging, print
out the number of frames on src and sink side to give some context.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-08-23 14:12:16 +01:00
Peter Ujfalusi dedb75368b src: dai-zephyr: Drop function name from comp_* prints
The comp_* macros will print the function name from where they are called,
there is no need to print them twice.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-08-23 14:12:16 +01:00
Curtis Malainey a3b1436b46 zephyr: don't build host targets with xtos headers
Posix is for posix

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-23 13:36:17 +01:00
Curtis Malainey 2f64bdefa1 smart_amp: fix return errors
If 0 is a error then override it so the outer function doesn't think we ran
successfully and then hit a null ptr after we freed everything.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-23 13:35:21 +01:00
Jyri Sarha 67683d5191 performance measurements: Fix SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n build
Without this change turning the performance measurements off, by setting
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n, causes a number of
"undefined reference to" linker errors.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2024-08-23 13:33:26 +01:00
Marc Herbert 577c9ae3e7 fuzz.sh: add new boards/native_sim_libfuzzer.conf
Extract -DCONFIG_* definitions hardcoded inside the script and move them
to a new .conf file where they belong.

This is a first, baby-step towards addressing the more general lack of
.config control described in #9386

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-23 13:28:23 +01:00
Seppo Ingalsuo 371245bb94 Tools: Topology2: Fix cavs-nocodec.conf SSP2 PCM rates
The rate_min and rate_max no more work with IPC4 topologies. The
SSP2 PCM host pipeline contains a sample rate converter so it can
support multiple rates. With attempt to play (or capture) with
other than 48 kHz the error is printed and resulting playback has
wrong pitch:

Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
         please, try the plug plugin

Use of rates with list of all rates in topology fixes the issue.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-22 21:53:35 +03:00
Seppo Ingalsuo 66da07cd6a Audio: MFCC: Fix 64 bit build issue
The comp_err() trace in mfcc_init() causes an error:

sof/src/audio/mfcc/mfcc.c: In function 'mfcc_init':
sof/src/include/sof/audio/component.h:160:20:
  error: format '%u' expects argument of type 'unsigned int',
  but argument 4 has type 'size_t' {aka 'long unsigned int'}
  [-Werror=format=]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-22 21:53:07 +03:00
Curtis Malainey 8090624c56 module_adapter: clean up module_load_config
Now that validate_config has been deleted we can clean up some of the
error handling logic here.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-22 16:27:15 +01:00
Curtis Malainey 5c6af78905 module_adapter: remove validate_config
empty TODO for 4 years, no point in keeping it around. Also if you are
doing validation after trusting the data enough to do a memcpy you have
already lost.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-22 16:27:15 +01:00
Curtis Malainey ae2bcb6862 module_adapter: fix a log string typo
Incorrect function context

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-22 16:27:15 +01:00
Shriram Shastry 5e1e05de13 Audio Format: Add vec_sat_int8x2 function
- Added to pack two 32-bit integers in an 8x2 vector.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 4ebb35c9b0 Audio Format: Improve sat_int8 function
- Added detailed function documentation.
- Changed from if-else checks to bitwise operations for efficiency:
  - Shifted left by 24 bits to prepare for saturation.
  - Shifted right by 24 bits to sign-extend the value.
  - Extracted the 8-bit value using AE_MOVAD32_L.
- No performance degradation observed.

This check-in refines the sat_int8 function by improving its logic
and documentation to ensure a more efficient and accurate 32-bit to
8-bit conversion process.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 7288ed005a Audio Format: Add vec_sat_int16x4 function
- Added to saturate and pack four 32-bit integers into 16x4 vector.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry b4c439051b Audio Format: Improve sat_int16 function
- Added detailed function documentation.
- Changed from AE_SAT16X4(x, x) to a more descriptive process:
  - Moved the 32-bit value to ae_int32x2 type for accurate input
   handling.
  - Used AE_SAT16X4 to saturate and pack values.
  - Extracted the first 16-bit value with AE_MOVAD16_0.
- No performance degradation observed.

This check-in enhances the sat_int16 function by improving its logic
and documentation to ensure more accurate 32-bit to 16-bit conversion.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 63bbcaa68c Audio Format: Add vec_sat_int24x2 function
- Added to saturate and pack two 32-bit integers into a 32x2 vector.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 94412f8116 Audio Format: Improve sat_int24 function
- Added detailed function documentation.
- Changed from AE_SRAI32(AE_SLAI32S(x, 8), 8) to AE_SAT24S for
  more accurate 24-bit saturation.
- Used ae_f32x2 type to ensure correct input handling.
- No performance degradation observed.

This check-in enhances the sat_int24 function by improving its logic
and documentation to ensure more accurate 32-bit to 24-bit conversion.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry c5e73a8402 Audio Format: Add vec_sat_int32x2 function
- Added to saturate and pack two 64-bit integers into 32x2 vector.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 2d38f7ce11 Audio Format: Improve sat_int32 function
- Enhanced function documentation.
- Replaced AE_SLAI64 with AE_SLAI64S for better saturation control.
- Added intermediary shift left by 32 bits with saturation.
- Final shift right by 32 bits for accurate rounding and conversion.
- No performance degradation observed.

This check-in ensures more accurate and reliable results by using more
appropriate intrinsic functions and thorough step-by-step operations.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 02c7b67fe2 Audio Format: Include required libraries
- Reshuffle standard headers order.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Shriram Shastry 53f6bfa9e9 Audio Format: Update SPDX-License and copyright
- Changed year to 2024 and added author information.
- Updated the license identifier to BSD-3-Clause.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2024-08-22 16:22:20 +01:00
Laurentiu Mihalcea 6426967503 ipc: replace enum fields with uint32_t in some IPC structures
Normally, the type of enums is "unsigned int" or "int". GCC has
the "-fshort-enums" option, which instructs the compiler to
use the smallest data type that can hold all the values in
the enum (i.e: char, short, int or their unsigned variants).

According to the GCC documentation, "-fshort-enums" may be
default on some targets. This seems to be the case for
"arm-zephyr-eabi-gcc", which is used to build Zephyr on
ARM platforms.

On Linux, this is not the case (tested with "aarch64-linux-gnu-gcc"),
which means enums such as "enum sof_comp_type" will end up having
different sizes on Linux and SOF. Since "enum sof_comp_type" is used in
IPC-related structures such as "struct sof_ipc_comp", this means
the fields of the structures will end up being placed at different
offsets. This, in turn, leads to SOF not being able to properly
interpret data passed from Linux.

With this in mind, replace "enum sof_comp_type" from
"struct sof_ipc_comp" and "enum ipc4_stream_type" from
"struct ipc4_pin_props" with "uint32_t".

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-22 16:20:56 +01:00
Adrian Warecki 562c4807a8 module: Move system_service header to module directory
Move definitions of functions exposed by system_service to the modules
directory so that loadable modules can use them.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-08-22 16:05:19 +01:00
Adrian Warecki e3206f1ceb module: Move module log priority definition to module directory
Move logging priority definitions used by iadk modules to the modules
directory so other types of loadable modules can use them. Propose
a function to convert log priority used by loadable modules to log level
used by sof.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-08-22 16:05:19 +01:00
Seppo Ingalsuo 1009ba774b App: Boards: Temporarily always set MFCC kconfig to yes
To see draft CI build results, will be removed later for
proposal.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo b1c996b21b Tools: Tune: MFCC: Fix channels handling in audio feature plotter
In test topologies the MFCC data can be packed to 1, 2, or 4
channels stream. This change fixes the shown time scale for
audio features 3D plot.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo 5c84e5bbd4 Tools: Tune: MFCC: Add export of default blob for tplg2
This patch updates the setup_mfcc.m Octave script to produce
configuration blob for topology version 2 builds.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo 75c53fb990 Tools: Topology2: Add MFCC component and topologies for hda-generic
This patch adds build of topologies
- sof-hda-generic-cavs25-2ch-mfcc.tplg
- sof-hda-generic-cavs25-4ch-mfcc.tplg
- sof-hda-generic-ace1-2ch-mfcc.tplg
- sof-hda-generic-ace1-4ch-mfcc.tplg

The MFCC is connected to 16 kHz DMIC1 DAI. The MFCC bitstream
is passed to capture PCM. The DMIC1 pipeline style is copied
from DMIC0:

DAI copier -> IIR -> gain -> module_copier -> MFCC -> host copier

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo fd70236924 Tools: Topology2: Move IIR blob define to upper level from pipeline
The same dai-copier-eqiir-gain-module-copier-capture pipeline can
be used for both DMIC0 and DMIC1, with different IIR setting,
so the blob definition is moved to dmic-generic.conf where the
pipeline is instantiated.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo f7715b814b Audio: MFCC: Fix build of component for current SOF
It has not been possible to build the component earlier for Zephyr
IPC4 systems. This patch makes the next fixes:

- Add SOF_MODULE_INIT() and include of rtos/init.h
- For unit test fix the init function to
  sys_comp_module_mfcc_interface_init()
- To Zephyr/CMakeLists.txt add the needed math library sources
- Add .toml files for rimage for IPC4 systems

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Seppo Ingalsuo 94e1bd2e6e Tools: test: Audio: Fix src_test.m run error
The SRC module tools have moved, so the path to retrieve SRC
filter spec has changed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:29:17 +01:00
Marc Herbert cda94e1688 fuzz.sh: replace deprecated OVERLAY_CONFIG with newer EXTRA_CONF_FILE
OVERLAY_CONFIG was deprecated in Zephyr 3.4 commit
https://github.com/zephyrproject-rtos/zephyr/commits/3a345682ba81

Also enhance example and demonstrate the syntax to pass multiple files.

This finishes the work started by commit 6cd34c89a1
("xtensa-build-zephyr.py: use EXTRA_CONF_FILE instead of OVERLAY_CONFIG")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-21 14:25:56 +01:00
Laurentiu Mihalcea c6d59184f9 drivers: imx: ipc: make wait_for_interrupt snippet xtensa-specific
To prepare for the introduction of another ARM imx platform,
make the code snippet invoking `wait_for_interrupt` xtensa-specific.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-21 13:23:03 +01:00
Ranjani Sridharan b5c91d428c topology2: pipelines: Use SubTreeCopy where possible
Modify the class definitions for the mixout-gain-efx-dai-copier-playback
and the mixout-gain-efx-mbdrc-dai-copier-playback pipelines to use the
SubreeCopy feature to extend the mixout-gain-eqiir-eqfir pipeline class
definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-08-21 13:03:00 +01:00
Ranjani Sridharan b32de25fc1 topology2: pipelines: Add a new pipeline
Add a new pipeline, mixout-gain-eqiir-eqfir, that uses the new alsa-utils
topology feature to allow extending existing pipeline definitions. This
new class extends the base class mixout-gain-dai-copier-playback class
by adding the eqiir & eqfir widgets along with the new routes.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-08-21 13:03:00 +01:00
Ranjani Sridharan 10fe84b95b topology2: mixout-gain-dai-copier-playback: Modify route definition
Modify the route description to an array in preparation for allowing
class extensions to define new classes where existing routes will be
merged with the new routes in the sub classes.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-08-21 13:03:00 +01:00
Tobiasz Dryjanski 3a4c9db40d src: create separate file for normal src
Defines for normal src and src_lite were not separated correctly. Added new
variables so those values can be different depending on the type of src
being used. Those are assigned in prepare function in a new src.c file,
similarly to src_lite.c

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Tobiasz Dryjanski 285ec51914 src: rename src.c to src_common.c
Renaming src.c, as this filename will have a different purpose. File
src_common.c will contain common functions for all src types.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Tobiasz Dryjanski c4c37e040f src_lite: add new generated src_lite coeffs
Add new src_lite coef files generated by the new .m generator.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Tobiasz Dryjanski 74bb0acdbe tune: add new .m generator for src_lite coefs
Add a coef generator for src_lite.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Tobiasz Dryjanski 25c084d249 src_lite: fix 32kHz to 16kHz conversion issue
Fix issue where 32kHz to 16kHz conversion would give incorrect frequency
signal. src_polyphase_init function was using wrong coefficient matrix
while checking for equal frequencies resulting in no conversion.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Laurentiu Mihalcea 2e39952d4b include: rtos: interrupt.h: simplify `interrupt_get_irq` macro logic
The imx-related macro logic from `interrupt_get_irq` can be
simplified. Now that `CONFIG_IMX93_A55` selects `CONFIG_IMX`,
`interrupt_get_irq` should return the INTID for all imx platforms
except for imx8m, which is yet to be transitioned to zephyr
native drivers.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00
Laurentiu Mihalcea 9e9e67c5bd platform: imx93_a55: select `CONFIG_IMX`
i.MX93 is an IMX platform so its config (i.e: `CONFIG_IMX93_A55`)
should also select `CONFIG_IMX`.

Additionally, xtensa-based imx platforms have the heap
placed in the ".heap_mem" section, while arm-based imx
platforms have the heap placed inside the .bss section.
As such, fix the macro-based logic inside `zephyr/lib/alloc.c`
to account for this.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00
Laurentiu Mihalcea e7a4d01267 audio: detect_test: use %zu for printing size_t variables
On 64-bit platforms, size_t may be 64-bit. As such, change
the "%u" format to "%zu" as done in commit faf725aba0
("Use %zu format for printing size_t variables").

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00
Laurentiu Mihalcea aa42205027 Kconfig: make `COMPILER_WORKAROUND_CACHE_ATTR` depend on xtensa
`CONFIG_COMPILER_WORKAROUND_CACHE_ATTR` is only applicable to
xtensa-based platforms. As such, add dependency on `CONFIG_XTENSA`.

Additionally, `CONFIG_IMX` should be selected by all imx platforms.
Since not all imx platforms are xtensa-based, make sure
`COMPILER_WORKAROUND_CACHE_ATTR` is selected only for those platforms.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00