This commit removes all direct calls to ring_buffer (formerly dp_queue)
from the code, replacing with a generic sof_audio_buffer API
Only direct call that stays is creation of ring_buffer, yet it will
soon be replaced also by a buffer factory
Legacy API from ring buffer is also removed, as it should not be used
anymore
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
in pipeline2.0 there's more than one buffer type
to be used for passing audio data from one module
to another. However, each single buffer must provide
same API.
This commit introduces a common API for buffers and
at the same time connects it to ring_buffer.
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
as a follow-up of a prev commit, internal structures
should also be changed accordingly
The commit, however, does not change names of variables
in the code that use struct ring_buffer.
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
dp_queue was created as a buffer to handle
special needs for DP modules.
However, in pipeline2.0 there will be more usecases
for it - as in fact it is a lockless cross-core
cached ring buffer.
This commit does rename dp_queue to more adequate name
It also moves the file to "buffers" directory, a place
for all implementations of buffers in pipeline 2.0
The commit, however, does not change names of structures
because git/github does not handle complex changes like
rename and modification correctly
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
The DRC component was not included to build. This component is used in
upstream HDA generic topology, so must be enabled. See commit
727ad82997 ("Tools: Topology2: Add IIR, FIR, DRC to HDA analog
playback").
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This is effectively a no-op, but does not look good. It runs the risk of
a type divergence when a major ABI update comes. So lets just use the
right type in the right place.
This change improves and standardizes the naming convention of the
cadence module during its creation.
Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
Include the possible domain block time when measuring the time it takes
to complete one iteration of the low-latency scheduler thread loop. The
ll timer metrics are typically used for initial system debug and it can
be misleading when domain block events are not counted in reported
average/max numbers.
Change the timing code to start measurement immediately after
domain thread semaphore is taken.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Strip out all the literall UUID management from existing C code (the
API itself still works for any out-of-tree or test code users) and
exclusively use the new, much simpler, SOF_DEFINE_REG_UUID() macro
which sources IDs from the registry by name.
Signed-off-by: Andy Ross <andyross@google.com>
Add a very simple uuid-registry.txt file containing all known UUIDs in
the tree, use it to generate a C header (the script validates it in
the process) that can then be used for a simplified
SOF_DEFINE_REG_UUID() mechanism that avoids the risk and temptation
temptation of components incorrectly implementing UUIDs.
The intent is that in the longer term, this file can be used by other
downstream tooling (manifest and topology generation) to more easily
reference known IDs by name in a way that avoids duplication and
error.
Signed-off-by: Andy Ross <andyross@google.com>
These two drivers both got cloned UUIDs from the acp_hs component,
which is illegal.
Renumber them. This is relatively safe, as clock and DMA drivers are
specific to a platform and not referenced via external files like
topology.
Signed-off-by: Andy Ross <andyross@google.com>
This DAI driver got labelled with the same UUID as the "hsdai"
component, which is illegal. Generate a new UUID.
This is relatively safe, as DAIs are fixed with hardware and don't get
referenced by ID in external topology. Still frustrating to have to
do.
Signed-off-by: Andy Ross <andyross@google.com>
The library code edf_sched and ll_sched_lib components were generated
with UUIDs that collide with the core EDF scheduler component, which
is illegal. This is test code though and doesn't need to match
external artifacts, so just renumber.
Signed-off-by: Andy Ross <andyross@google.com>
In a few cases we have multiple component code trying to reuse the
same UUID value for differing purposes and with different names. But
we can resolve that by sharing names rather than changing a permanent
UUID assignment:
* Post-name-normalization, the "dai-legacy" and "dai-zephyr"
components share a single UUID with different names (they both used
to be "dai"), AND with the trace context of another "dai" that has a
different (!) ID value in src/lib. Fix this by using a single UUID
for the former two that collide, and renaming the latter "dai_lib".
* A single UUID got cut/pasted between the irq drivers of mt8195, imx
"irqsteer" and imx "generic". Since these will never be used in a
single image, give them all the single name "interrupt" and let them
share the UUID value.
Signed-off-by: Andy Ross <andyross@google.com>
If UUIDs are by definition unique, then the stored names that refer to
them must also be unique (otherwise there's no value in trying to
assign unique identifiers to them in the first place). Fix this up by
changing names (not IDs) where needed.
The common antipatterns here are:
1. Cut-and-paste copies of drivers where the UUID values themselves
were changed for the new driver but the code around them was not.
These are resolved by including the platform/variant name in the
UUID name.
2. Variant UUIDs for IPC3/IPC4 builds. The reason isn't clear to me,
but some drivers build with different UUID values depending on the
build-time protocol configuration. But these then name themselves
identically, producing a collision. Resolved by putting a "4"
suffix on the IPC4 symbol name.
Signed-off-by: Andy Ross <andyross@google.com>
UUIDs are defined with both a string name (used mostly just for trace
output on legacy xtos builds) and a symbol name used as a global
variable to tie the struct to e.g. component driver definitions. And
because human beings are allowed to type them in, they have been
somewhat inconsistently defined. Normalize them so the string name
and the symbol name match (the symbol has a "_uuid" suffix).
Some of these rules are fairly regular:
* Some of the component drivers added a "_comp" to the global symbol
name and some didn't. Strip the ones that included it.
* Some naming liked dashes where underscores would be present in a
symbol name (e.g. "dw-dma" for dw_dma_uuid). Unify the conventions
so all name strings are valid C symbols.
* Applying those rules produces a collision between "dai" UUIDs
defined in dai.c, dai_legacy.c and dai_zephyr.c, so the latter two
have been renamed to "dai_legacy" and "dai_zephyr".
And in a handful of spots the code just wasn't consistent. These
UUIDs have been manually renamed, generally trying to pick a name the
corresponds to the original string name, or to the C file that defines
them if that seems impractical:
Orig. String Name Orig. Symbol New Unified Name
================= ============ ================
Maxim DSM smart_amp maxim_dsm
Passthru Amp smart_amp passthru_smart_amp
agent_work agent_work_task agent_work
cadence_codec cadence cadence_codec
channel_map chmap chmap
comp_task idc_comp_task idc_comp
component comp component
dp_schedule dp_sched dp_sched
dts_codec dts dts
edf_schedule edf_sched edf_sched
google_hotword_detect ghd google_hotword
ipcgw ipcgtw ipcgw
irq_818x irq_mt818x irq_mt818x
kd_test keyword keyword
ll_schedule ll_sched ll_sched
memory mem mem
micfil_dai micfil micfil
mix_in mixin mixin
mix_out mixout mixout
modules intel modules
passthrough_codec passthrough passthrough
pga volume volume
posix_ipc_task ipc_task ipc_task
schedule sch schedule
spi_completion spi_compl_task spi_completion
waves_codec waves waves
zll_schedule zll_sched zll_sched
Signed-off-by: Andy Ross <andyross@google.com>
Zephyr has a similar trick to the .static_uuids trick SOF had been
playing that works in a (mostly) portable way and has some nice
features like runtime FOREACH iteration.
Use that for the UUID table, allowing it to be linked in globally in
Zephyr builds in a uniform way.
Also includes some general cleanup to try to reduce the amount of
backslashery required to express the various macros.
Signed-off-by: Andy Ross <andyross@google.com>
Complete the unification of the diverged UUID APIs with a big rename.
Call it "DEFINE" instead of "DECLARE" since this is in fact a C struct
definition and not just a declaration of a type or extern symbol.
Signed-off-by: Andy Ross <andyross@google.com>
DECLARE_SOF_UUID() and the newer DECLARE_SOF_RT_UUID() were doing
exactly the same thing. They create a sof_uuid_entry struct to link
into the ".static_uuids" section, which is treated specially by the
linker and not included in the firmware binary.
The only difference is the "_RT_" function also create a duplicate of
that struct that lives in .rodata to which it assigns the same symbol
name as DECLARE_SOF_UUID() uses (and creates an internal "_ldc" symbol
for the hidden struct) that is usable at runtime (hence the name).
But SOF is linked with -fdata-sections, so the extra struct will be
dropped at link time anyway if unused. And the symbol name is
identical and visible in both variants even though it's only legally
used in one.
There's no reason to carry two different APIs around, unify.
Signed-off-by: Andy Ross <andyross@google.com>
Stumbled on this. Too hard to fix with the existing macros and very
low priority given existing DSP architectures, but IMHO important to
note.
Also remove the spurious extra zero byte from the entity_name
initializer. String literals are already null-terminated and string
initializers are already defined to zero-fill the trailing bytes.
This is a noop, except that it will cause the compiler to emit a
string length overflow warning one byte earlier than necessary.
Signed-off-by: Andy Ross <andyross@google.com>
The sof-logger/smex tools and the .ldc formats are all dead code in
Zephyr builds. The logging/trace macros don't emit the correct
metadata anymore, using Zephry logging instead (and I don't think they
ever did?), and the resulting .ldc files are degenerate containing
just the header and the records for component UUIDs, which nothing
uses.
Save a few milliseconds of build time and a few bytes of output, and
free up the evolution path by not having to support legacy tools.
Signed-off-by: Andy Ross <andyross@google.com>
removing NUM_HDMIS=0 was not enough, the offsets need to be modified
as well.
While we're at it, make sure all RT711-based RVPs use the same
formatting, ADL had the setting buried in the middle of the chain of
macros.
Closes: https://github.com/thesofproject/linux/issues/5094
Fixes: 75ed6960b8 ("topology2: enable HDMI for all SoundWire production topologies")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
One of the benefits and common ways to use the Zephyr shell
subsystem is definition of application specific commands.
This commit adds the initial SOF custom command,
"sof test_inject_sched_gap". This new command allows to inject
scheduling gaps into low-latency timer scheduler execution,
using the domain_block() SOF interface. Optional argument
can be used to specify duration of the block in micro seconds.
The intent is to stress test a SOF configuration and test how
the system behaves when audio pipeline is briefly starved.
Example log of what is observed when test_inkect_sched_gap is
run:
[ 0.052431] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3674, max 4326, overruns 0
[ 0.052831] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3673, max 4318, overruns 0
~$
~$ sof test_inject_sched_gap 12000
[ 0.052968] <inf> ll_schedule: zephyr_domain_block: Blocking LL scheduler
[ 0.052973] <inf> ll_schedule: zephyr_domain_unblock: Unblocking LL scheduler
[ 0.052973] <inf> host_comp: host_get_copy_bytes_normal: comp:1 0x10004 no bytes to copy, available samples: 0, free_samples: 384
[ 0.053231] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 4074, max 437230, overruns 1
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Symbols like __udivdi3 aren't available in 64-bit builds, use
CONFIG_64BIT to hide them.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This patch adds checks and errors for fopen() failures. The check
is useful with setup scripts paths changes. Aborting the script
avoids the errors in blob exports to be missed.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The purpose of this patch is to consolidate all the files
those belong to the DRC module. The top level function names
are changed to have sof_ prefix to avoid conflict with possible
other similar files.
Note: A small fix is needed after similar patch for EQ
is merged since some functions for DRC blob are used from
there.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Enable the system-managed device power management feature for the ACE30
PTL board configuration. This feature allows the power management
subsystem to automatically suspend devices before entering a low power
state and resume them after waking up.
The following configuration option has been added:
- `CONFIG_PM_DEVICE_SYSTEM_MANAGED=y`: This option is set to enable
system-managed device power management, ensuring that the power
management subsystem takes care of suspending and resuming devices as
part of the power state transitions.
This change is in line with the power management strategy to minimize
power consumption and manage device states more efficiently without the
need for explicit device power state management in the application code.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
For some reason we still have NUM_HDMIS=0 in production topologies,
that's a miss. We have no reason to keep those initial developer
settings.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
PM_DEVICE_RUNTIME_EXCLUSIVE was deprecated and the new symbol
PM_DEVICE_SYSTEM_MANAGED shall be used when the applications wants
the subsystem to trigger device power management when the system sleeps.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Commit 0eb34dbb92 ("google_aec: Don't allocate giant blobs on the
heap") dropped some sparse annotations and exposed warnings with
dealing with the cached temporary buffers handed to the AEC code.
Unfortunately the underlying API isn't sparse-aware, so rather than go
through the trouble to keep the tags consistent through the new
conversion API (which is a little non-trivial syntactically) just to
throw it away on entry to the library, force it off at conversion time
for simplicity. Essentially now it's checking that all computation in
this module is "uncached", which is fine as long as we don't try to
mix conventions.
Signed-off-by: Andy Ross <andyross@google.com>
The older native_posix board is being deprecated, use native_sim,
which is the future-proof API. Mostly just swap the board target and
change the C API names.
Note the NATIVE_SIMULATOR_IF decoaration on LLVMFuzzerTestOneInput():
that forces the function to be included in the first-stage zephyr.elf
link (otherwise it would be dropped as Zephyr/SOF itself doesn't
reference the entry point) and to be visible as a global symbol to the
libfuzzer instrumentation layer.
Signed-off-by: Andy Ross <andyross@google.com>
There was a problem with test test_102_08_extended_time_check.
The structure ext_system_time_data was sending with wrong size.
Because of this it was not possible to correctly read the value
from the art clock to determine the HH counter.
Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
Add a test to avoid --all breakages like the one in commit
05bfc36dac ("ptl: Add initial PTL configuration"), reported in #9262
See also previous commit.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As reported in #9262, this fixes the --all option.
Fixes commit 05bfc36dac ("ptl: Add initial PTL configuration")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Passing options one by one in .github/workflows/zephyr.yml was becoming
unwieldy. Reduces Windows/Linux duplication. This also makes local
testing easier; less typing and guess work.
This should also help with #9116.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
OVERLAY_CONFIG has been deprecated by EXTRA_CONF_FILE since Zephyr 3.4
Also fix the corresponding --help string.
Zephyr 3.4 is one year old and has just been end-of-lifed.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Replaces intermediate variable and redundant comments with a direct
call to return multiband_drc_init_coef function.
Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
Add helper function to add and remove the additional search path.
Removing the search path is useful for interactive shell usage.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The purpose of this change is to consolidate the files those
belong to the SRC module. This commit only moves the files. The
next commits are fixing the issues caused by the move.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit optimizes the division by the speed of sound in the
`theoretical_time_differences` function. By precomputing the fixed-point
reciprocal of the speed of sound, we eliminate the need for a costly
division operation in each iteration.
Additionally, a redundant 'if' statement is removed from the
'tdfb_direction_copy_emphasis' function, simplifying the code.
Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
Keep context save still disabled for Intel Meteor Lake. This
setting has been used in SOF2.8 and SOF2.9 releases and is used
in Chromebook SOF builds for these platforms. Make the SOF main
default match the releases.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Combinatorics get hard with all the features, but it's really useful
to be able to test features in isolation.
Signed-off-by: Andy Ross <andyross@google.com>
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Change buffer allocation functions to buffer_alloc_range and
buffer_set_size_range. This makes it possible to allocate the buffer even
if the suggested size given in ipc cannot be met.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add two new buffer allocation functions buffer_set_size_range and
buffer_alloc_range dedicated to deep buffering. They try to allocate
the largest possible buffer according to the suggested size. If this size
cannot be obtained, it will be reduced step by step until it reaches
the minimum size.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Move part of the code responsible for initializing the buffer structure
to the new function buffer_alloc_struct, which will also be used
by a new buffer allocation function.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>