Commit Graph

6882 Commits

Author SHA1 Message Date
Marc Herbert 0def905630 trace: move CONFIG_TRACEM implementation up a couple levels
From deep down trace.c:va_tracelog() up to the _log_message() level.

Also rename va_tracelog() to the more specific dma_tracelog()

Preparation to support the DMA trace in Zephyr.

The only functional change in this commit is that DMA messages copied to
the shared memory are not de-duplicated any more (a.k.a "adaptive rate
limiting" or CONFIG_TRACE_FILTERING_ADAPTIVE). These are generally
supposed to be high level hence rare enough; otherwise there is probably
a "bigger problem".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 19:41:55 +01:00
Marc Herbert e1aa806d5c trace: add 'atomic' argument to mtrace_dict_entry()
Preparation to use mtrace_dict_entry() also the _log_message() level too
and not just for very early mtrace_printf() tracing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 19:41:55 +01:00
Marc Herbert b18ec17fc3 ipc3/handler.c: re-enable DMA trace for Zephyr
Reverts commit 74cacc3138 ("zephyr: ipc: dont enable DMA trace
transport.") modified by commit d7282762bc ("ipc3: don't declare unused
variables")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 19:41:55 +01:00
Marc Herbert a7abc03523 cavs/platform.c: don't guard trace initialization with #ifdef ZEPHYR
Because it's mostly working now and avoids macro nesting complexity;
there is already #ifdef CONFIG_DW_SPI #elif CONFIG_TRACE

Just for the record this is reverting a very tiny part of
commit cf8e35f860 ("zephyr: init: create a zephyr entry point in SOF.")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 19:41:55 +01:00
Marc Herbert b1c9e85896 zephyr_ll.c: declare missing ll_tr trace context
Commit a439ea93f6 ("zephyr: ll-schedule: switch over to a simplified
implementation") replaced ll_schedule.c with zephyr_ll.c when compiling
with Zephyr. So the struct tr_ctx named "ll_tr" is now missing. Declare
it in ll_schedule.c too.

No one noticed that ll_tr was missing because the DMA trace does not
work in Zephyr and the main branch yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 19:41:55 +01:00
Guennadi Liakhovetski 98e8016de0 ipc: let secondary cores acknowledge IPC messages
Currently when an IPC message arrives, the primary core receives the
interrupt, schedules a task and begins processing the message. If it
identifies, that the message is for another core, it sends an IDC
message to it and waits in a busy loop until the other core completes
processing the message and writes a response into the mailbox. After
that the primary core notifies the host about completing the
processing. This patch lets the processing secondary core notify the
host directly, which also frees the primary core to handle other
tasks instead of waiting in a busy loop.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-26 19:13:48 +01:00
Pin-chih Lin 6af9fc5cfe multiband_drc: Clean up source_format on component reset
Clean up all contents in component data on reset().

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-07-26 11:03:13 +01:00
Pin-chih Lin c9bed91e6d drc: Clean up source_format on component reset
Clean up all contents in component data on reset().

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-07-26 11:03:13 +01:00
Marc Herbert b63b8e992b .github: run unit tests with -DBUILD_UNIT_TESTS_HOST=ON
Because we can.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert 3ac8906097 unit tests: skip 'alloc' test when compiled on host
It is failing and skipped only when compiled on the host, runs fine with
xt-run.

This is temporarily needed to add host-based unit tests to CI now and
catch any regression in any other test now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert a7c1c52420 scripts/run-mocks.sh: major refactor
Adds --error-exitcode=1 to valgrind options (otherwise what's the point
of using valgrind?)

Skip alloc test that does not pass on HOST (passes with xt-run)

Add help message.

Runnable from anywhere.

Use shell functions
https://github.com/thesofproject/sof-test/issues/740

Fix all quoting issues and other shellcheck warnings.

Add comments.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert c8b226b86f cmocka/cmake: add $SIMULATOR to fix "make test" on host
Before this it was required to find and run the executables one by one

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert f51a95b90d xtensa-build-all.sh: link to cmake docs on sof-docs
Link to the CMake section in sof-docs which documents a lot of what this
script does and is probably out of date now. It would be less out of
date if this link had been there and more people had been aware that
this documentation even existed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert c14a01e26d suecreek_gcc_defconfig: CONFIG_TRACE=n
This has been finding several pre-processing bugs already. Short of
randconfig some variety is the best we have.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert 589f035ad4 common_mocks.c: fix !CONFIG_TRACE build
Fixes 'no previous prototype for trace_log_filtered' -Werr and
redefinition of ‘trace_flush_dma_to_mbox’ error.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:19:50 +01:00
Marc Herbert 0ea32291ae qemu-check: document magic values, better logging and err. handling
Thanks Ranjani for finding most of these magic values.

Also move READY_MSG closer to the only place where it's used so it does
not look like a "global" anymore.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-26 09:17:46 +01:00
Keyon Jie 9648fb65a5 alloc: fix heap_trace() block start index
Fix and log the information of block 0 also.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-24 11:13:46 +03:00
Keyon Jie 3b81d513c4 pipeline-params: add heap debug support.
Show heap status update with every pipeline going to be run, when
CONFIG_DEBUG_HEAP is enabled. This will help to monitor the heap memory
usage status.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-24 11:13:46 +03:00
Kai Vehmanen 6328ec5000 zephyr: add tracing of ll-scheduler execution time
Add tracing of ll-scheduler execution time. Use k_cycle_get_32()
timestamps for minimal overhead. A trace is printed with a period size
of 2^10 scheduler executions (roughly once per second in typical
configuration with 1ms timer tick). Average and maximum observed
execution time is printed out for each task.

Additionally k_timer_status_get() is used to observe instances of
overruns. If the timer irq is fired before previous timer thread
invocation completes, overrun of the ll scheduling slice has occurred
and this is recorded. Number of overruns is printed for each measurement
window.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-07-23 16:33:04 +01:00
Seppo Ingalsuo e82392e246 Audio: Volume: Add state clear to reset() operation
This patch adds clear of all component data in reset() component
operation except state variables those are set by control
commands.

Note: If a new stream starts after reset() without free() and
new(), the clear of all component data would result to wrong
gain and wrong mute state. The driver commands are not re-sent
in such case.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-23 11:22:28 +01:00
Kai Vehmanen 93ea223a89 zephyr: add per-ll-task tracking of execution time
Add a lightweight layer to track execution time of ll tasks to the
zephyr-ll scheduler. Use k_cycle_get_32() timestamps for minimal
overhead. A trace is printed with a period size of 2^10 task executions
(roughly once per second in typical configuration with 1ms timer tick).
Average and maximum observed execution time is printed out for each
task.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-07-23 08:38:04 +01:00
Ranjani Sridharan 764a065193 topology1: sof-cavs-nocodec: Add deep buffer playback pipeline
on SSP5 for BXT and SSP0 for all others.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-23 08:34:36 +01:00
Ranjani Sridharan 56d1fe652c topology1: sof-cavs-nocodec: convert all playback pipelines to mixer-based pipelines
Convert all playback pipelines to have a mixer so adding a deep-buffer
pipeline will be simpler.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-23 08:34:36 +01:00
Ranjani Sridharan 808c4512c5 Revert "topology: cavs-nocodec: Add deepbuffer pipeline to SSP0 and SSP2"
This reverts commit a10b5dcf85.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-23 08:34:36 +01:00
Ranjani Sridharan 463c4afd10 Revert "topology1: sof-cavs-nocodec: Add the deep buffer PCMs"
This reverts commit 6516a8c89b.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-23 08:34:36 +01:00
Rander Wang 8ccfe50ab3 pcm_converter: add ipc4 converter support
Ipc4 pcm converter will check container size and valid sample
size to do format conversion. This patch add general support for
valid sample / container size s16c16 <-> s16c32, s32c32 <-> s16c32
s16c32 <-> s24c32 s24c32 <->s16c32, which are not supported
by sof now.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-23 08:26:11 +01:00
Daniel Baluta 52bc39fe73 topology: i.MX: Add topology to demonstrate EQ component
This enables EQ component with IIR filter for i.MX8QM/i.MX8QXP/i.MX8MP
with wm8960 codec.

Users can try various configurations for EQ parameters using sof-ctl tool:

$  amixer -Dhw:1 controls | grep EQ
numid=44,iface=MIXER,name='EQIIR1.0 eqiir_coef_1'

$ ./sof-ctl -Dhw:1 -n 44 -s sof/tools/ctl/eq_iir_bassboost.txt

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-07-22 17:07:23 +01:00
Daniel Baluta 1203a46633 tools: ctl: Fix getopt() stop condition
getopt() returns an int, which in our implementation is assigned to a
char type var.

On some platforms char is unsigned thus making getopt() return value
always > 0.

Use int instead of char here to fix the stop condition for parameter
parsing.

This makes sof-ctl work on ARM platforms.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-07-22 17:06:52 +01:00
Bard Liao bb18f62b54 topology2: copier: add ALH type
ALH is a valid type of copier.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2021-07-22 17:03:08 +01:00
Seppo Ingalsuo 83897cc92a Audio: TDFB: Clear input and output buffers in reset()
The component should reset to default state so these
buffers need to be cleared.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-22 17:02:39 +01:00
Seppo Ingalsuo d30f47dd13 Audio: SRC: Cleanup not needed state variables
The source_format and sink_format variables are not needed in
component data. They can be local in prepare().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-22 17:02:39 +01:00
Seppo Ingalsuo 9d0d818d8c Audio: EQ-IIR: Change source and sink format component data to local
The source_format and sink_format variables do not need to be in
component data. Local variables in prepare() are sufficient.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-22 17:02:39 +01:00
Seppo Ingalsuo 4dd766a0b5 Audio: EQ-FIR: Cleanup not used state variables
The processing function selection no more uses these
component struct fields.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-22 17:02:39 +01:00
Marc Herbert 8059b8f9fd xtensa-build-zephyr: better help and error message when -p is required
-p is required when the real (not symbolic) directories are not nested
in one another.

The documentation gap was clearly demonstrated by me getting confused
even though _I_ implemented this logic some time back.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-22 17:01:19 +01:00
Rander Wang 33af554ed3 ipc4: add fw_reg definition
fw_reg is located in memory windows 0 for host to
query fw status

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
Rander Wang 60bd8d78d8 ipc4: add missed attribute for large_config
Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
Rander Wang 743e6294df ipc4: add ipc4 message for deleting module instance
Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
Rander Wang f6e12130f5 ipc4: add header file for notification definition of ipc4
Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
Rander Wang 8367bd8bb4 ipc4: add header file for error code definition of ipc4
Ipc4 error code will be used in ipc4 interface layer and
current sof error code in framework or components will be
translated to ipc4 error code in this layer.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
Rander Wang 1c73215bc3 ipc4: add header file for base config
Base config defines input & output information of each ipc4
modules. The information includes audio stream format, input
& output buffer size.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-22 14:00:57 +01:00
ShriramShastry 1f4395f805 Math: Trignometry: Add arc sine, cosine, cexp fun
Added cordic based approximation of arcsine,arc cosine and
complex exponential function to math trigonometry.

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-07-21 14:18:51 +01:00
Seppo Ingalsuo 4c376680f5 Tools: Fix topology1 path in Matlab language scripts
The change for topology1 was missing from various tuning
and testing scripts those access binary blob data from
topology m4 directories.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-21 12:13:36 +01:00
Rander Wang 8d68de8db5 ipc4: add ipc4 dai configuration support
Dai configuration is generated based on gateway config in copier module

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-21 10:31:28 +01:00
Rander Wang c52e8dbba2 ipc4: alh: add alh support for ipc4
Stream id is included in ipc4 config and fw constructs
hw_params for alh based on this information.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
2021-07-21 10:31:28 +01:00
Rander Wang 457465fa15 ipc4: ssp: add ssp blob support
Ssp setting can be generated offline by tools and sent
to fw by driver in memory blob. Fw decodes this blob and
set hw registers accordring to blob configuration. This
patch add support to this type of ssp configuration.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-21 10:31:28 +01:00
Ranjani Sridharan 6516a8c89b topology1: sof-cavs-nocodec: Add the deep buffer PCMs
We weren't really testing these yet without the PCM devices.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-21 10:23:10 +01:00
Rander Wang 3d90a4548e ipc4: add bind & unbind ops for ipc4 module
In ipc4 each module will be bound to its sink module by pipeline.
This patch add new ops bind & unbind to dispatch these events to
related modules.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-21 10:21:58 +01:00
Ranjani Sridharan 4beb748c23 mixer: use separate flags for source/sink buffer locking
Fix xruns caused because of using the same flags for locking
both the sink and source buffer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-21 12:05:51 +03:00
Marc Herbert 3f4da1f1bb sof.doxygen.in: add CONFIG_TRACE=1
Stop ignoring most comments in the trace.h file.

Confusingly, only comments in trace.c were considered because unlike
trace.h, trace.c is not turned off by the preprocessor but by CMake
instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-21 09:17:05 +01:00
Marc Herbert 15330bc27d doxygen: fix or delete a large number of broken comments
At first I assumed some refactorings forgot to update the comments to
match. Then I saw some of these could never had made sense ever.

This does not fix _all_ doxygen warnings, it only makes the remaining
warnings easy to grep -v. This is just good enough for me to test other
doxygen changes without being drown into warning noise.

C files are not parsed by the default doxygen configuration - "if it's
not tested then it does not work".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-21 09:17:05 +01:00