Commit Graph

12446 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 3db820d9d4 clock: only update clock frequency if actually changing it
No need to set clock frequency if the new one is equal to the current
one.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Guennadi Liakhovetski cada215ee5 lib_manager: disable on TGL
The library manager isn't supported on TGL, disable it there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Guennadi Liakhovetski f2a0bf8acb pipeline: rebalance KCPS instead of adding or subtracting
Adding or subtracting module CPC when starting and stopping pipelines
is brittle. Particularly it's prone to mistakes with modules, not
specifying their CPC explicitly. Instead recalculate CPC every time
a pipeline is started or stopped.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Guennadi Liakhovetski b1df683c91 lib-manager: add a function to identify component type
Extract the module_is_llext() macro into a header and add a function
to identify a loadable module type of a component.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Guennadi Liakhovetski 86b5c322a3 pipeline: (cosmetic) extract code fragment into a function
Extract code to obtain a pointer to the module base configuration,
depending on its type, into a separate function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Marc Herbert 945af87124 CODEOWNERS: remove invalid libinyang and makarukp
Both are reported by Github as "Unknown owner on line 31: make sure
@makarukp exists and has write access to the repository"

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-29 20:05:31 +01:00
Marc Herbert 077187d500 CODEOWNERS: remove marc-hb
New assignment.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-29 20:05:31 +01:00
Curtis Malainey 0f4a246df1 module_adapter: fix switch case for spec parsing
This switch case is non exhaustive and has not guards on config types
which means assuming all types that are default are process types is
false. The fuzzer found a way to utilize a DAI to bypass IPC layer
checks but break the module adapter.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-29 15:39:46 +03:00
Curtis Malainey 94b3d2c9bd ipc3: fix subsize check
The ext size is counted as part of the ipc header size. The process size
and header size need to be less than the ipc max size.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-28 16:46:55 +03:00
Pierre-Louis Bossart 8b8c842c78 topology2: add simple passthrough for HDA tests
Long overdue, I don't know why we keep adding complicated stuff
without having a simpler baseline.

Two configurations are provided, one with default copiers and another
with CHAIN_DMA.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2024-08-27 14:35:32 +03:00
Seppo Ingalsuo ad85184af0 Tools: Test: Audio: Mitigate trace flood in process_test.m
The verbose test trace flood slows down the test to near
unusable test times due to a lot of text printed to Octave
console. As result also the SOF CI logs become large.

This patch adds redirect of testbench trace into a temporary
file instead of standard output in process_test.m. The trace
content is printed in comp_run.sh to console only if there has
been an error. To prevent growing /tmp the trace file is
deleted after test run and possible print to console.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-27 13:39:53 +03:00
Curtis Malainey 876a371ba9 audio: mfcc: fix signed 1-bit field
Sparse complained about this since signed fields should be >=2 bits
minimum.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-27 13:37:17 +03:00
Seppo Ingalsuo 6f61e8ab32 IPC: Increase SOF_IPC_MSG_MAX_SIZE for testbench and unit test
The testbench and unit tests use a simplified simulated IPC that
currently doesn't support messages split to multiple parts. As
workaround to unblock other SOF development the size is increased
from 384 bytes to 8192 bytes.

This allows run of current test set with scripts/host-testbench.sh
that is also used in SOF CI. The change can be reverted after the
capability is added to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-27 13:30:22 +03:00
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