This patch checks in prepare() buffers for nominal frames count
(sample rate times schedule period) plus internal input and output
block size constraint. With this size check passed the SRC is able to
process a single block of data per copy() if upstream and downstream
components operate with reasonably small block constraints.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The too small size of this buffer caused a new 11025 to 8000 Hz
conversion pipeline to freeze due to impossible condition in
source/internal/sink buffers.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The zero consumed and produced is not an error for SRC
it can happen with some low sample rates those have
a larger internal block size than source or sink period.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
If the SRC rates matrix is non-symmetric, the indexes to
in and out sample rates matrix can't be compared. Compare
instead the rates.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The order of BE DAI Link in topology must match the order in machine
driver. Create this include file to organize the definition of BE DAI
Link ID.
Signed-off-by: Brent Lu <brent.lu@intel.com>
Add a topology sof-adl-cs35l41 which supports four Cirrus Logic
CS35L41/CS35L53 speaker amplifiers running in TDM mode without
headphone codec on ADL platform.
Two compile options are added to support the board configuration:
'NO_HEADPHONE' removes headphone pipelines from the topology while
'SSP_AMP_LINK_ORDER' uses the DAI Link order in sof_ssp_amp.c machine
driver instead of sof_rt5682.c.
Signed-off-by: Brent Lu <brent.lu@intel.com>
The log context in zephyr is per file or module.
To use zephyr logging api, LOG_MODULE_REGISTER is used
to register a log context, LOG_MODULE_DECLARE is used
to refer to the registered context.
For function in header file, LOG_MODULE_DECLARE should
be used within that function to avoid context collapse,
a condition one source file have multiple context
registered or declared.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Linux host will send codec_id at runtime via sof_ipc_stream_params
as part of extended data appended at the end.
When ext_data_length is non-zero this means that the kernel wants us
the use dynamic codec id. When ext_data_length is zero, use backward
use default codec id which means we keep compatibility with older
kernels.
The codec_id is sent using compress API interface. We need to convert
that to internal cadence numbering scheme.
And final step, in order to use the dynamic id we need to move
cadence_codec_post_init() from init() function to prepare() in order
to be sure that the kernel already sent us the parameters.
We need to this operation atomically in one patch in order to avoid
breaking the functionality between patches.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
api_id parameter will be dynamically updated at runtime. Remove api_id
parameter id and use the default value in order to make code easier
to update for dynamic id change.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
When the build fails we don't want to waste time wondering whether TGL
is affected or not. Other, unsupported platforms are only providing some
nice to have "randconfig" coverage (#5364), they're not important.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
These are Github Actions, so let's use the Github server to increase
performance and reduce external dependencies.
According to https://github.com/zephyrproject-rtos/docker-image there is
no primary or secondary server for that image, they're both equivalent.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch adds load possibility of mux, demux, and
google-rtc-audio-processing to testbench.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes testbench to retrieve pipeline direction
from pipeline host direction. Earlier all pipelines were forced
to playback.
The topology parsing filters the parsed pipelines to command line
specified pipeline IDs. All the pipeline operations are done
looped to these pipelines to be able to simulate multiple simultaneous
pipelines.
The pipeline context struct remains single. So the simulation works
only for pipelines with identical PCM format and rate.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This fixes SOF version.cmake which was just broken by a recent git
security update and started to fail like this:
```
-- SOF version.cmake starting at 2022-04-25T18:14:56Z UTC
-- /workdir/zephyr/.. is at git commit with parent(s):
fatal: unsafe repository ('/workdir' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /workdir
```
(example at https://github.com/thesofproject/sof/runs/6162885265)
chgrp -R was always an ugly hack because it was messing with
(persistent) file permissions on the host, outside the container. This
new adduser solution is unfortunately much more code but it does not
leak any side effect outside the container.
Do not fix scripts/docker-run.sh yet because there is still no UID
mismatch between Github Actions and the SOF container (they're both
1001) but add a warning + TODO.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch changes function ipc4_create_chain_dma() to check return
value against IPC_SUCCESS. If not successful return the return
value.
The function ipc4_add_comp_dev() is changed to return value
IPC4_SUCCESS instead of zero since the other return value
in function is IPC4 style.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch fixes errors:
src/ipc/ipc4/handler.c: In function 'ipc_cmd':
src/ipc/ipc4/handler.c:204:23: error: 'host' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
struct ipc_comp_dev *host;
^~~~
src/ipc/ipc4/helper.c: In function 'ipc4_trigger_chain_dma':
src/ipc/ipc4/helper.c:667:6: error: 'ret' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
int ret;
^~~
src/ipc/ipc4/helper.c: In function 'ipc4_create_chain_dma':
src/ipc/ipc4/helper.c:507:13: error: 'frame_size' may be
used uninitialized in this function [-Werror=maybe-uninitialized]
frame_size >>= 1;
~~~~~~~~~~~^~~~~
src/ipc/ipc4/helper.c:482:11: note: 'frame_size' was declared here
uint32_t frame_size;
^~~~~~~~~~
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Fix src issue on windows. Need to update sink format before
src_verify_params which uses it to generate dev->frame.
Signed-off-by: Rander Wang <rander.wang@intel.com>
So far we only support 48000Hz as default sample rate.
Now introduce acp_params structure to pass configuration
from topology via AP to DSP.
Only Sample rate param for now to configure dmic clk.
While here, align sof_ipc_dai_acp_params struct
with the one from kernel.
Increment only ABI MINOR version which makes the
SOF FW backward compatible with older kernel versions
Signed-off-by: Balakishorepati <balaKishore.pati@amd.com>
Now that sof_ipc_pcm_params struct has some extended data at the end
the hdr.size will also account for this data.
Change sanity condition to see if hdr.size is updated to keep track of
extended data.
Also check that ext_data will not go beyond SOF_IPC_MAX_SIZE.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
When ext_data_length is not zero this means that sof_ipc_stream_params
will contain additional data appended at the end.
Copy this data in mod->stream_params so that we can use it later.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
In order to support sending the compress parameters (and maybe other
parameters) we introduce `ext_data_length` field inside
sof_ipc_stream_params.
We use 2 bytes from the reserved pool. This will represent
the size of extended data that will be placed at the end
sof_ipc_stream_params struct.
existing value for this reserved bytes is `0`. This will mean
that we can keep backward compatibility. 0 means no extended data.
Add also VLA data[] in order to easily access extended data.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This prepares sof_ipc_stream_params structure to have some
extended data appended at the end.
For this reason we no longer can use the sof_ipc_stream_params
object inside processing_module, but we need a pointer.
stream_params is allocated at codec_adapter_params().
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Remove assert and report the error condition to the upper layers.
It does not make sense to stop the FW if config parameters fails.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Fix bugs in playback mode and supports more frequencies.
This patch generates dma setting from dma blob data.
Signed-off-by: Rander Wang <rander.wang@intel.com>
Fixed playback issue with chain dma. Pipeline
is always triggered with direction of host to dai,
so host is used for trigger.
Signed-off-by: Rander Wang <rander.wang@intel.com>
Add all platforms that can currently be built with IPC4:
cnl icl jsl tgl tgl-h
Can be adjusted any time later with a one-line change.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
There was no actual "IPC3" value, it was ignored. The platform default
was used instead.
Stop ignoring invalid arguments, fail and report them.
Allow empty string as a no-op for scripting convenience.
Don't restrict IPC4 to tigerlake, it's not the job of
xtensa-build-all.sh to filter what's supported versus not.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Add a static variable w_core_enable_mask in Zephyr wrapper.c to
track requests to enable and disable cores, and use this to
implement arch_cpu_enabled_cores().
We don't yet have a implementation to power off secondary cores.
This creates issues to SOF application code that may rely on
disabling of cores to be reflected in cpu_enabled_cores(). Instead
of adding ifdefs in application code, manage this within wrapper.c.
Once the secondary core power-off is implemented, this static
variable can be removed.
BugLink: https://github.com/thesofproject/sof/issues/5701
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This patch duplicates the configuration at the higher level and adds
the "HEADSET_DEEP_BUFFER" definition.
This is not very elegant and will require changes in two places, but I
don't see a better solution with M4.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
We don't want to release these topologies to world+dog due to
dependencies on kernel version, so let's make the deep-buffer
optional. The next patch will enable these topologies in the
development/ directory.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Before we enable the headset deep-buffer solution, we want to extract
the NOJACK topologies where the headset deep-buffer would be an
oxymoron.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
For some reason the topologies are in separate blocks, regroup them.
No functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This patch duplicates the configuration at the higher level and adds
the "DEEP_BUFFER" definition. The topologies are generated in the
kernel_dependent/v5.19 directory and shall only be used by
distro/users when their kernel is based on 5.19-rc1 or later. If these
topologies are used with an older kernel, the ASoC DPCM state machine
issues will result in broken audio. We have no ability to detect a
dependency on kernel to load a topology.
This is not very elegant and will require changes in two places, but I
don't see a better solution with M4.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
We don't want to release these topologies to world+dog due to
dependencies on kernel version, so let's make the deep-buffer
optional. The next patch will enable these topologies in the
development/ directory.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
We don't support this topology in production and it's not clear if
it's even maintained, move to development.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This patch enables testing of DRC in HDA generic devices by adding
it to headset/speaker pipeline after mixer.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch replaces the audio_stream_read/write_frag_s16/s32
functions based source buffer read and sink buffer write with
audio_stream_bytes_without_wrap() based blocks access.
The drc_s16/s24/s32_default processing functions are simplified
by move of common delay input sample operation to separate
function. The same function is used in DRC disabled and enabled
part of processing functions.
The pass-through mode is optimized with generic audio_stream_copy()
that is a common function for all s16/s24/s32 formats.
The MCPS savings are in TGL-H for stereo 48 kHz stream
- Normal operation 68 to 50 MCPS, saving 18 MCPS
- Pass-through without delay 22 to 6 MCPS, saving 16 MCPS
- Pass-through with delay 21 to 7 MCPS, saving is 14 MCPS
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Two variables i and n in pcm_convert_s24_c32_to_s24_c24_link_gtw()
can be used uninitialised, which breaks compilation. Initialise them
to 0 which guarantees, that we don't perform any changes in the
invalid case of processed >= samples.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>