Commit Graph

8931 Commits

Author SHA1 Message Date
Marc Herbert 1e4236be68 tools: make sof_ri_info.py a usable library that can be imported
2 small changes required:

- Stop calling sys.exit(1) in case of error not to exit the importer
- Change EraseVars() to return the checksum value instead of printing
  it. Move the print() to the main() function

This is required by the new sof-bin tests that compare signed with
unsigned binaries; submitted in
https://github.com/thesofproject/sof-bin/pull/105

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-11 13:34:01 +03:00
Guennadi Liakhovetski 72ad230056 ipc4: print incoming IPC messages
Similar to IPC3, seeing all IPC messages in the log is very useful
for debugging, e.g. when matching kernel and firmware logs. Use a
format similar to IPC3.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-10 20:29:36 +03:00
Marc Herbert d155062195 scripts/build-tools.sh: switch to incremental build by default
Faster build and focused and readable logs at last.

Add a warning not to surprise anyone.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert 016b555a06 topology2: generate abi.conf at build time, fix incremental on abi.h
Move abi.conf generation to build time.

Changing abi.h now rebuilds all v2 topologies.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert eee058abcd topology2: concat abi.conf at build time to fix incremental build
It's now possible to rebuild just only one modified topology without
rebuilding all of them from scratch.

Building topologies v2 has two steps:

 1. concatenation of abi.conf with topo.conf
 2. run alsatplg on the concatenation

Concatenation step 1. was wrongly implemented at configuration time, not
at build time. So when the topology source of step 1 (topo.conf) was
modified, the dependency of step 2 (= the concatenation) was not
affected and the topology was not rebuilt.

Fix this by moving the concatenation to build time.

Fixes commit 308a24a92b ("topology2: Add build support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert a29d522059 topology1: fix incremental build dependency on abi.h
Modifying abi.h now rebuilds topologies v1

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert d56d8ab01c scripts/build-tools.sh: switch to Ninja because make is too verbose
Make prints a line for every topology that is already up to date and not
rebuilt. It's impossible to see what was done.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert 567ad2122e topology1: prefix custom targets with their subdirectory name
This makes it possible to find stuff in the output of `ninja help`.

Zero effect on the build artefacts.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:34:11 +01:00
Marc Herbert 36b3ff4025 zephyr/docker-run.sh: log all '*zephyr*' images and align columns
`docker images` has no globbing option so just use `grep zephyr`

This fixes two different issues:
- Fixes tabulation images with names of a different length
- Displays any internal local cache some users may have

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:29:05 +01:00
Marc Herbert 77bb169887 .github: de-hardcode zephyr SDK version in sparse build
Also add references documenting sparse's REAL_CC pain.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:29:05 +01:00
Marc Herbert c28400baaa scripts/docker-run.sh: fix wrong uid in warning 1001 -> 1000
Fixes commit d09844ab98 ("zephyr/docker-build.sh: match UID with
'adduser' instead of 'chgrp -R'")

Also clarify comment and add reference to new sudo-cwd.sh script.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:29:05 +01:00
Marc Herbert 0a4b1d62d5 sudo-cwd.sh: drop the all 'sof_' prefixes and references
This script is now generic. This was not done earlier to be gentle on
git blame.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:29:05 +01:00
Marc Herbert 027be98371 zephyr/docker: move exec_as_sof_uid() to new sudo-cwd.sh
Besides making things more obvious, the important functional change is
that the user switch is now performed for _every_ invoked, command, not
just for the build command.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-10 11:29:05 +01:00
Kai Vehmanen 76e35fbec2 ipc4: use atomic primitives to maintain delayed_reply state
In tests with repeated IPCs that require handling in
the pipeline context (such as SET_PIPELINE_STATE), the delayed_reply
state sometimes goes out of sync.

When this happens, pipeline has processed the message and called
ipc_compound_msg_done(), but the next call to ipc_wait_for_compound_msg()
does not see the correct value, leading to a timeout.

Fix the problem by using atomic primitives to maintain the state.

Also make it explicit that the delayed_reply is a boolean
condition and in current code, having multiple IPC messages in
flight concurrently should never happen.

BugLink: https://github.com/thesofproject/sof/issues/6220
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-10-07 18:42:48 +03:00
Kai Vehmanen 0654a66664 zephyr: app: increase log thread stack size to 4096
Set the logging thread stack size explicitly for SOF builds
and use a safe default of 4096 bytes. Individual board overlays
can override this default to save stack space.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-10-07 15:01:11 +03:00
Kai Vehmanen 529d593454 zephyr: app: increase log size to 4096 bytes
Set CONFIG_LOG_BUFFER_SIZE=4096 for all SOF builds.

As SOF uses DEFERRED mode for logging, the frontend buffer for
logs must be large enough to cover all typical burts of messages.

Tests using CONFIG_LOG_MEM_UTILIZATION debugging infrastructure,
show that maximum buffer usage is over 2048 bytes in typical
sof-test run on a SOF nocodec topology, tested on Intel TGL
hardware.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-10-07 15:01:11 +03:00
Kai Vehmanen 576373594b zephyr: app: tune logging thread sleep and trigger threshold values
Logging output of SOF is sporadic in nature (unless debug configuration
is used) and it cannot be assumed that a steady flow of log messages
is output at all times. During stable state, there are either no or very
few messages output. When the DSP pipeline state is modified, there is
a flurry of event. Similarly upon errors, a burst of log messages is
output.

For better balance between delay in writing logs, and limiting overhead
of the logging thread, set new defaults to:
  CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=5
  CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100

The SLEEP_MS sets an upper bound how long a single log message can
stay in the log frontend buffer.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-10-07 15:01:11 +03:00
Kai Vehmanen 19970d51d5 zephyr: app: explicitly use DEFERRED log mode
Calls to log messages are done in many places in SOF code,
including latency sensitive low-latency code paths. To minimize
the cost to low-latency path, use CONFIG_LOG_MODE_DEFERRED=y
by default for all SOF Zephyr builds. This will offload log
processing and output to a separate low priority thread.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-10-07 15:01:11 +03:00
Ming Jen Tai 21d8948e73 rtnr: Support setting data blob
This commit lets user to set  data blob from host.

For example:
$ amixer -Dhw:0 controls | grep RTNR
numid=47,iface=MIXER,name='RTNR10.0 rtnr_bytes_10'
numid=48,iface=MIXER,name='RTNR10.0 rtnr_data_10'
numid=49,iface=MIXER,name='RTNR10.0 rtnr_enable_10'

$ sof-ctl -Dhw:0 -n 48 -b -s ./preset.bin

A new empty data control added to the topology will be used to send the
blob.
Model handler is now used for transferring the blob data.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>

Code Refine
2022-10-05 13:25:44 +01:00
Guennadi Liakhovetski 770e81c6cc pipeline: (cosmetic) simplify pipeline_comp_reset()
Use switch-case instead of if-else, add a local variable for a
repeating pointer dereference and remove a resundant local variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-05 13:08:45 +01:00
Guennadi Liakhovetski de129609ab ipc4: don't propagate commands across pipelines
With IPC4 commands are sent to each pipeline individually, therefore
there is no need to propagate them to connected pipelines in the
firmware. We use IPC4_MOD_ID() to detect the IPC4 mode: it returns a
non-zero module ID under IPC4 and 0 under IPC3.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-05 13:08:45 +01:00
Guennadi Liakhovetski 89ca17b0f0 zephyr: ll-schedule: fix a race when unregistering the domain
The following race has been observed:

core 0				core 3

				timer IRQ
				spin_lock(&timeout_lock)
IPC IRQ
task remove
zephyr_domain_unregister()
spin_lock(&timeout_lock)
				timer remove
				spin_unlock(&timeout_lock)
k_timer_stop()
z_abort_timeout()
				z_timer_expiration_handler()
				z_add_timeout()

which leads to the LL domain timer being added needlessly and to a
later lock up and an IPC timeout on the host. Fix this by removing
the timer in such cases.

BugLink: https://github.com/thesofproject/sof/issues/6173
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-05 13:08:22 +01:00
Seppo Ingalsuo 025c64e062 Audio: Add audio feature extractor component MFCC
This patch adds the SOF component for Mel Frequency Cepstral
Coefficients (MFCC) streaming to sink from source PCM stream.
The MFCC audio features are commonly used for neural network
based speech recognition services.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Seppo Ingalsuo d526f7372c Tools: Tune: Prevent topology1 blob export to increase blob size
The increase of non-32bit aligned blob sizes needs to be removed
because it can cause mismatch of blob binary header vs. actual
size. Instead error if blob size is not multiple of four bytes.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Seppo Ingalsuo e235fbf9be Tools: Tune: Matlab tool for creating configuration blob for MFCC
This patch adds initial version of MFCC setup tool setup_mfcc.m. It
outputs a configuration topology macro file that matches the current
Matlab concept code. The configuration can be tested in testbench
with the supplied scripts run_mfcc.sh and decode_ceps.m.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Seppo Ingalsuo f24670b986 Tools: Testbench: Add MFCC component
This patch adds load of MFCC component to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Seppo Ingalsuo e2d73e236a Tools: Topology1: Add MFCC component
This patch adds basic macros needed for MFCC in testbench and in
developmemnt topologies for hda-generic-2ch and up2. The
configuration blob in this matches the reference Matlab code
as configured to match Pytorch default MFCC.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Daniel Baluta 5b63f446d2 topology1: Add topology with wm8960/cs42888 for imx8qxp/imx8qm
This topology is used for i.MX8QXP/i.MX8QM with baseboard
to enable both cs42888 and wm8960 codecs.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-10-05 13:05:48 +01:00
Marc Herbert a0dc1c5aa7 Revert "topology2: nocodec: add volume and mixer support"
This reverts commit e31c7abeeb.

This caused most tests to fail on sh-tglu-rvp-nocodec-ci-02
in daily run 15919, see some more errors in logs shared in
initial PR #6318 and new issue #6367

  FW reported error: 113 - Invalid destination queue (pin) ID provided
  ipc error for msg 0x45000004|0x6
  sof_ipc4_route_setup: failed to bind modules copier.SSP.8.1 -> gain.7.1

I don't know why this failed and I did NOT test this revert, however:
- This topology change is apparently the only thing that changed
  compared to the day before.
- The error message seems very much related.
- Other people seem to agree.
- According to Ranjani, this feature is not urgent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-10-04 14:08:42 -07:00
Rander Wang e31c7abeeb topology2: nocodec: add volume and mixer support
Mixer and volume (gain) are used in nocodec topology.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-10-03 15:10:49 +01:00
Jyri Sarha ab8849581c tools/probe: Add routing FW logs to stdout and dma data from stdin
To get dma data from std in, just leav out the -p flag, and to get
logs from stdout, use -l flag.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-10-03 15:00:39 +01:00
Jyri Sarha 7438070eec tools/probe: Split the demuxer and offline command to separate files
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-10-03 15:00:39 +01:00
Jyri Sarha ceced0e641 tools/probe: Drop undeeded include files
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-10-03 15:00:39 +01:00
Jyri Sarha 43bc85f570 tools/probe: Another restructure of dma stream demux code
This time the target is to make the demuxer more modular so that it is
not coupled with file reading operations and it is easy to use
alsa-lib directly.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-10-03 15:00:39 +01:00
Damian Nikodem a3159ead0c init: update abi version in memory windows
Driver expects correct IPC4 layout version in memory windows.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-03 14:57:32 +01:00
Damian Nikodem 0f0e66e7e7 kernel/mailbox: update mailbox macros definition
Update macro definition in mailbox.h according to changes in IPC4 layout.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-03 14:57:32 +01:00
Damian Nikodem a0dcaeba35 platform/cavs: remove platform_trace_point functionality for IPC4
The platform_trace_point is not supported with IPC4 fw_reg layout.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-03 14:57:32 +01:00
Damian Nikodem 80aec89d55 include/ipc4: clean up fw_regs includes
There is no need to include dma.h to fw_regs header.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-03 14:57:32 +01:00
Rander Wang 72300fe090 eq_fir: use module interface
Adopt module interface for eq_fir component.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-10-03 13:26:31 +01:00
Rander Wang 192030b3b3 module_adpter: add get_data support
Get_data returns binary data to host.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-10-03 13:26:31 +01:00
Rander Wang fbd4264b55 module: add module position update helper function
It will update position based on frame and format

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-10-03 13:26:31 +01:00
Andrula Song 894796e025 Audio: EQ-IIR: Fix the bug of parallel EQ calculation
As for our previous design, if we have parallel EQs like
filters bank, they get the same input and outputs are summed.
There is a mistake of the input assignment in our current code,
this commit will fix it.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-10-03 12:53:40 +01:00
Guennadi Liakhovetski 1d6fae0f65 zephyr: edf-schedule: (cosmetic) make two variables static
EDF work queue related variables can be static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-03 12:23:39 +03:00
Guennadi Liakhovetski f5e2d56018 ipc4: (cosmetic) clean up handler.c
1. make two global variables static
2. rename a function to avoid a name conflict
3. fix a return code from ipc_wait_for_compound_msg()
4. add a comment

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-03 12:23:39 +03:00
Daniel Baluta 6853616cfc Revert "xtensa: configs: Enable comp legacy on i.MX platforms"
This reverts commit 1044e004e4.

On i.MX platforms we noticed a bug were playback followed by
capture would cause capture to fail.

This issue was later fixed by:
commit b9889d52d0 ("module_adapter: Modify reset API")

so we can get rid of CONFIG_LEGACY_INTERFACE.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-09-30 15:46:05 +01:00
Daniel Baluta 19661fe74a topology1: Merge i.MX AAC/MP3 compr topology
Because now we can support multiple codecs with same topology
lets merge i.MX aac/mp3 topologies.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-09-30 11:00:57 +03:00
Daniel Baluta e60caa0c0c topology1: Update documentation to reflect multicodec support
This updates documentation to reflect that now param id is only 2 bytes
followed by 2 bytes codec id.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-09-30 11:00:57 +03:00
Daniel Baluta 376d0520f8 module: cadence: Support params for more than 1 codec
We want to be able to play different compress stream types
using the same topology:

e.g

$ cplay -I MP3 -d 0 -c 0 sample.mp3
[ end of playback ]
$ cplay -I AAC -d 0 -c 0 sample.aac

Some static parameters for compress streams are set up in
topology bytes in the form:

[0:3]: param ID
[4:7]: size in bytes
[8:n-1]: data[]

We need now a way to specify codec ID, so we borrow 2 bytes from param
ID, like this:

[0:3]: (param ID, codec ID)
[4:7]: size in bytes
[8:n-1]: data[]

Using 0 for codec ID means 'dont care'. Topologies supporting just 1
codec are not affected and need not to be changed.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-09-30 11:00:57 +03:00
Jyri Sarha 29af2df766 tools/probe: Fix realloc condition
The allocated packet should accommodate the header, the data, and the
checksum. The header size was missing from the condition from the
beginning, even if its there in realloc parameter. The bug should be
harmless waste of cycles thou.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-09-28 14:04:39 +01:00
Jyri Sarha 548de64551 tools/probe: Move data_to_copy variable down in scope
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-09-28 14:04:39 +01:00