Multiple use of static inline functions that call Zephyr logging
API across different C files will result in same symbol names
defined in all of the corresponding object files with XCC,
because XCC compiler emits the same symbol names based on the
source file for those static variables inside functions.
If Zephyr logging is used in SOF, we will have log context
redefinition issue with XCC due to above reason.
This patch workarounds the issue by removing the log calls
in static inline functions that are used across multiple C
files if Zephyr is used.
BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786
Signed-off-by: Chao Song <chao.song@linux.intel.com>
When pipeline reset was called from paused state, it was not stopped
beforehand. This resulted in improper device turn-off sequence.
Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
Add AFE driver for memif/sinegen
Add afe-dai.c/afe-drv.c/afe-memif.c for AFE common driver
AFE: Audio Front End
The audio front-end essentially consists of voice and audio data paths.
frontend (memory interface):
UL (uplink for capture)
DL (downlink for playback)
backend:
I2S In/Out etc
interconn:
inter-connection, connect frontends and backends as DSP path
Note:
TEST_SGEN macro define is just for test
Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
Add memif data for AFE
Add common and regs header for AFE
Add AFE platform for mt8186 audio/dsp
AFE: the abbreviation for Audio Front End
Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
The single blob mode keeps only one configuration blob available at
one time and saves the memory otherwise consumed by the second
blob. The down side of this behaviour is that the audio pipeline must
be stopped for the configuration to be updated.
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
The data blob handler functionality is quite independent from the rest
of the generic component code. The component.c and component.h are
already too big so it is better to split the data blob handler
functionality out before adding more features to it.
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings.
To show what actually fails, try to build again with a single thread.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings, see
examples below. For test topologies the problem is even worse: its
XARGS parallel build provides no log at all.
To find what actually fails, it is required to fall back on a single
threaded and verbose build and this is achieved with the variables
USE_XARGS, NO_PROCESSORS and VERBOSE. Pass these through docker-run.sh
and CMake.
Examples from #5608https://github.com/thesofproject/sof/runs/5717553555?check_suite_focus=truehttps://sof-ci.01.org/sofpr/PR5608/build12556/build/tools.txt
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The major/minor/patch values are represented with u16 in the FW. So,
change the numbers of bytes to match that of the FW when adding the
ABI to the topology manifest for IPC4. For IPC3, we still only use 3
bytes as there's no clean way to increase the number of bytes without
breaking backwards compatibility with the older kernel. There are no
topologies using topology2 for IPC3 today but it is possible in the
future.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
BUFFER_FREE IPC returns an error if buffer is connected to
two active components.
However it is allowed to free a buffer in the case where either the sink
or the source is no longer active. This happens for example with buffers
that connect two pipelines. If one pipeline is stopped and freed,
the connecting buffer will be also freed.
This does mean pipeline_disconnect() may be run in context
of a pipeline that is running on a different core. This is
fundamentally unsafe and can lead to undefined behaviour
when two cores access the pipeline bsource_list/bsink_list
at the same time on two different cores.
Fix this issue by checking for this case, and running
the BUFFER_FREE on the active core.
The change is not sufficient on its own, but is part of the fixes
to address: https://github.com/thesofproject/sof/issues/5469
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
When processing a trigger action in pipeline_task_cmd(), do
not return SOF_TASK_STATE_RESCHEDULE if the pipeline is already
in requested ACTIVE state.
The unnecessary reschedule can cause scheduling bubbles in
topologies with mixer fed by multiple source pipelines. When
the frontend pipelines are released from pause or started,
the connected pipelines that are already running, need to keep
running. A reschedule will cause a gap in scheduling in
of the downstream pipeline(s) mixer feeds.
This fix is not sufficient on its own, but is part of the fixes
to address: https://github.com/thesofproject/sof/issues/5469
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Run the platform_context_save() before we shut down the primary core.
As an implementation detail: the context save implements the code to
prepare for IMR boot on platforms where it is supported.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This removes two layers of indirection when trying to find what fails.
The lack of this proved especially painful when working on #5632 and
similar backports.
Also move outputs to a subdirectory by default. No change when invoked
from CMake which does not use the default output directory.
Also show the exact m4 and alsatplg commands run when not using XARGS
parallelization. Again this is critical when something fails.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
gcc fails with the following warning (treated as error):
sof/src/ipc/ipc4/handler.c: In function 'ipc_cmd':
sof/src/ipc/ipc4/handler.c:471:5: error: 'status' may be used uninitialized in this function [-Werror=maybe-uninitialized]
471 | if (status == COMP_STATE_READY)
| ^
sof/src/ipc/ipc4/handler.c:439:11: note: 'status' was declared here
439 | uint32_t status;
| ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:380: CMakeFiles/sof.dir/src/ipc/ipc4/handler.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Based on the code, this is a false warning since ppl_count should never be
0 (unless ppl_data->pipelines_count is 0), but never the less, the firmware
does not compile with gcc.
Fixes: 72394a62de ("ipc4: update component direction when pipeline is complete")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The correct frame length should be calculated by
FRAME_LEN = SAMPLING_RATE * PERIODS / 1000000
The macro COMP_PERIOD_FRAMES does the thing.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
Use the sizeof on the fw_version array to remove the magic number for the
size calculation and drop the address modifier for the data pointer.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Userspace may write the config control repeatedly in quick succession.
Accept the new config in cmd callback to avoid -EBUSY error and ensure
the last successful control write before prepare/copy is applied.
This patch also fixes an edge case during init where the first non-empty
control write happens after prepare. This patch ensures the config is
applied during copy.
Tested:
1) Writes in quick succession
for i in $(seq 1 100); do
./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob0.txt &
./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob1.txt &
done
2) Large config requiring multiple ipcs
for i in $(seq 1 1000); do
./sof-ctl -n 92 -t 0 -b -r -s /root/large_blob.txt
./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob1.txt
done
3) Reboot, write before and after arecord starts
4) Suspend/resume
Signed-off-by: Ben Zhang <benzh@chromium.org>
Fix a error found by ipc4 Linux driver. Some component
pipeline may be incomplete, so the pipeline is not
updated to the component. Skip this pipeline and
return dai of null.
Signed-off-by: Rander Wang <rander.wang@intel.com>
In ipc4 pipeline can't be reset when the source
and current component is in the same pipeline
and it is active. This is different with ipc3.
Signed-off-by: Rander Wang <rander.wang@intel.com>
Currently error is reported for both active and paused state when
pipeline is set to reset. For ipc4 case, it is good to switch from
pause to reset. The switch from active to reset is not permitted for
both ipc3 and ipc4. This patch uses different log for active and paused
state.
Signed-off-by: Rander Wang <rander.wang@intel.com>
For alh, link dma and host gateway, the conversion function is
based on direction. For example to convert s24c32 to s32c32 with
alh, it should be function of convert_s24_to_s32 for playback,
but it is a simple copy function for capture since the valid
sample bits are set in msb 24bits like 0xdddddd00 for alh gateway.
The combination of all conditions is very huge but only part
of them are used in real case. This patch only supports some
patterns in our test case and is not complete. It will be enhanced
in future.
Signed-off-by: Rander Wang <rander.wang@intel.com>
In ipc3 path, host driver sends pcm_hw_param message to fw and
direction is included. The direction is set to each component
after pipeline is complete. There is no such ipc message for
ipc4 path and direction can only be figured out from dai gateway
type if there is one. Ipc4 path gets direction from dai component
and set it to each component after connected pipeline are complete.
We skip the host copier to host copier case.
Signed-off-by: Rander Wang <rander.wang@intel.com>
Fixes the following compilation failure with gcc:
In file included from src/include/sof/audio/buffer.h:18,
from src/include/sof/audio/component.h:19,
from src/include/sof/audio/component_ext.h:19,
from src/audio/volume/volume.c:18:
src/audio/volume/volume.c:60:29: error: 'gain_uuid_ldc' defined but not used [-Werror=unused-const-variable=]
60 | DECLARE_SOF_RT_UUID("gain", gain_uuid, 0x61bca9a8, 0x18d0, 0x4a18,
| ^~~~~~~~~
src/include/sof/lib/uuid.h:94:37: note: in definition of macro 'DECLARE_SOF_UUID'
94 | static const struct sof_uuid_entry uuid_name ## _ldc = { \
| ^~~~~~~~~
src/audio/volume/volume.c:60:1: note: in expansion of macro 'DECLARE_SOF_RT_UUID'
60 | DECLARE_SOF_RT_UUID("gain", gain_uuid, 0x61bca9a8, 0x18d0, 0x4a18,
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:534: CMakeFiles/sof.dir/src/audio/volume/volume.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Compilation fails with gcc:
src/ipc/ipc4/helper.c: In function 'ipc4_create_buffer':
src/ipc/ipc4/helper.c:210:41: error: variable 'sink_cfg' set but not used [-Werror=unused-but-set-variable]
210 | struct ipc4_base_module_cfg *src_cfg, *sink_cfg;
| ^~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:394: CMakeFiles/sof.dir/src/ipc/ipc4/helper.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The DTS Codec can be conditionally added to the sof-adl-nau8825 topology
on those pipelines intended for headphone and speaker output.
Signed-off-by: Joe.Cheng <joe.cheng@xperi.com>
Allocate "struct zephyr_ll_pdata" in shared/coherent memory as it embeds
a "struct k_sem" object. Zephyr kernel code assumes the object to be in
cache coherent memory, so incorrect operation may result if condition is
not met.
Long test runs of all-core capture stress test on Intel cAVS2.5
platform show failures that are fixed with this change.
Discovered via runtime assert in zephyr/kernel/sched.c:pend() that
is hit without this patch.
BugLink: https://github.com/thesofproject/sof/issues/5556
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
For builds with no Hotword on DSP, generic dmic m4 is used.
RTNR is running on DMIC CORE ID 1. Hence adding the flag.
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
No functional change.
Move some common testbench code into the topology parser and group
feature parsing by file name.
Add a tplg_ prefix to external APIs without a prefix, others with an
existing prefix to follow this change.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Calculates average and records the maximum execution cycles taken by
each execution round and prints the results out once every 1024 round,
e.g. roughly once per second with a typical 1ms tick configuration. The
output is mimicked from the Zephyr side scheduler output. There is a
Kconfig menu option under debug menu to disable this feature. Currently
the default is on.
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Return is copy_bytes is 0 before calling copy/writeback which will do
nothing anyway.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Remove the static variable that holds the total config size and use
the new field, new_cfg_size in struct module_data to store the size of
the config data.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Modify IDC payload size to be cache aligned and have size of 2 cache
lines.
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
For zephyr case remove the dynamic allocation of per-core
idc elements since these are already statically allocated
in a form of idc array in zephyr/wrapper.c.
The payload pointer initialization need to use idc entries
which are returned by the get_idc() call.
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>