Commit Graph

6156 Commits

Author SHA1 Message Date
Curtis Malainey f9ffa8d3e8 passthrough: fix interface
oops, forgot to update interface so build was silently not linking the
passthrough interface to the adapter

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 11:59:36 +01:00
Liam Girdwood 7b334d3ee7 memcpy: remove duplicate memcpy and memset definitions in local string.h
Local string.h already includes C library string.h.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 11:58:57 +01:00
Marc Herbert eb459078f3 checkpatch: --ignore C99_COMMENT_TOLERANCE
Let's not waste considerable time in code reviews with silly problems
computers can solve.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 16:26:03 +01:00
Marc Herbert fa38c34a7a docker: apt-get install python3-elftools
Required by #3459 / #3975 "elfsize" proof of concept and probably by
other things too in the future - we use both ELF and Python
everywhere; it's surprising they haven't met each other yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 15:19:14 +01:00
Keyon Jie 65400959ca ll_schedule: add logs about the scheduling point
Add some useful information logs about the task scheduling point with
ll_scheduler, which will help to capture logs once we hit scheduling
issue on some specific task.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-31 09:21:33 +08:00
Marc Herbert d7c8ccc625 .github/pull-request.yml: watch "main" branch instead of master
Will hopefully fix mysterious CI hangs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-30 11:35:27 -07:00
Curtis Malainey 15bd472a81 owners: add cujomalainey as owner of codec adapter
Request for owner has gone unacknowledged, ToT adapter is broken
suggesting we likely need additional reviewers given we have no existing
code owner.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-03-30 11:15:52 +01:00
Marc Herbert 7c08aabbe7 topology/cmake: add missing .m4 dependency, fixes incremental build
There was no [MAIN_]DEPENDS on the .m4 source file, so changes were not
triggering any rebuild.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-26 14:51:33 +00:00
Keyon Jie aee22b07c1 topology: pipe-codec-adapter-playback: fix the blob size
The size of the fallback CA_SETUP_CONTROLBYTES is 20 (0x14), not 0x20,
here correct it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-26 10:25:53 +08:00
Keyon Jie b3e4a71ba5 codec_adapter: accept 0 size library config
There could be some codecs which require 0 byte library configure, e.g.
the passthrough one, change to make this possible.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-26 10:25:53 +08:00
Marc Herbert 041c2ef6de version.cmake: add --dirty to git describe command
For at least two reasons:
  - exposes sneaky change(s) performed by automation if/when any
  - solves the mystery of the Source content hash (printed on the next
    line) changing while the git version does not.

Example, at https://sof-ci.01.org/sofpr/PR3941/build8429/build/bdw_gcc.txt

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 91f261ea

whereas at https://github.com/thesofproject/sof/runs/2166298087,
  xtensa-build-all:

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 67f31697

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-23 12:17:22 +00:00
Marc Herbert 7e19c42404 .github: replace HAVE_CONFIG KConfig hack with an override
Should make git describe --dirty clean.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-23 12:17:22 +00:00
Iuliana Prodan 0a9262ae4b drivers: imx: esai: set private data after allocation
ESAI allocates private data and retrieves this data using
dai_get_drvdata().
But this is never set using dai_set_drvdata() and sometimes
dai_get_drvdata() returns NULL.
So, after private data is allocated, set it using dai_set_drvdata().

Without this fix, on i.MX8QM, on playback we get:
root@imx8qmmek:~# aplay -Dhw:1,0 -f S16_LE -c 2 -r 48000 -d 5 -t raw /dev/urandom
Playing raw data '/dev/urandom' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
[  197.478128] sof-audio-of 556e8000.dsp: error : DSP panic!
[  197.483547] sof-audio-of 556e8000.dsp: error: runtime exception
[  197.489473] sof-audio-of 556e8000.dsp: error: trace point 0dead006
[  197.495658] sof-audio-of 556e8000.dsp: error: panic at :0
[  197.501064] sof-audio-of 556e8000.dsp: error: DSP Firmware Oops
[...]

Fixes: f40222a1ea ("drivers: imx: esai: use rate from topology")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-23 09:45:23 +02:00
Marc Herbert 69985365c6 buffer.h: silences warning "flags may be used uninitialized"
buffer_unlock() does not use flags.

Silences this gcc 8.1.0 (and valid) warning in
src/audio/pipeline.c#pipeline_for_each_comp(). For some strange reason
it shows up only with CONFIG_OPTIMIZE_FOR_DEBUG=y. Heuristics?

In file included from sof/src/include/sof/audio/pipeline.h:16,
                 from sof/src/include/sof/audio/buffer.h:12,
                 from sof/src/audio/pipeline.c:8:
src/audio/pipeline.c: In function 'pipeline_for_each_comp':
src/include/sof/spinlock.h:200:38: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/audio/pipeline.c:182:11: note: 'flags' was declared here
  uint32_t flags;
           ^~~~~

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-22 21:26:51 +00:00
Marc Herbert 1f9c91d174 spinlock.h: add # else /* CONFIG_... */ comments
Minor readability fix.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-22 21:26:51 +00:00
Paul Olaru 5ed64a7fe4 scripts: xtensa_build_all: Fix configuration names for i.MX
The configuration names with _2017 are a consequence of the way I did
the internal configuration update. To keep it simple I update these
build scripts.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2021-03-22 20:24:49 +02:00
Cristina Feies (ilie) 6b8ee5c5c7 kwd demo: imx8m: extend kwd functionality by using a neural network for detection
Implement a kwd function based on small
neural network able to detect yes/no
keywords. This represents an alternative
to the default kwd function and is
implemented in a separate file. Enabling
the usage of this kwd nn functionality is
done by enabling KWD_NN_SAMPLE_KEYPHRASE.
The inference function of the neural network
operates on 990 ms which are gathered in the
acquisition input buffer exposed by the detection
component.

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-22 12:31:18 +01:00
Cristina Feies (ilie) fddd1bad46 kwd demo: define & allocate acquisition buffer to gather once more frames necessary to detection algorithms
Define & allocate acquisition buffer where
collecting the necessary amount of input data
required by the detection algorithm. In our
case the kwd_nn detection algorithm requires
~1s of data once which is more than what
the current configuration of  the pipeline
offers once: 20ms of data.

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-22 12:31:18 +01:00
Cristina Feies (ilie) 96496f7f7d kwd demo: implement getters & setters in detection_test to expose variables necessary to other modules
Expose sample_valid_bytes, detected & drain_req
variables from detect_test component necessary
to other detection modules

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-22 12:31:18 +01:00
Cristina Feies (ilie) bcba81611b kwd demo: expose detect_test_notify function for other modules
Expose detect_test_notify function for
other modules which would implement
an alternative of default kwd detection

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-22 12:31:18 +01:00
Liam Girdwood 7f70d99e4a compiler: use libc versions of memset, memcpy for GCC10 onwards
GCC configuration for ct-NG uses newlibc libc versions of common
memcpy() and memset(). Check this in makefile and lib.c so we can use
the correct versions.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-03-20 15:20:57 +00:00
Curtis Malainey f6e6ac5bb1 codec_adapter: remove term "dummy" from adapters
Following move of open source to remove oppressive language from open
source, dummy is one of the terms to avoid. Also the term does a poor
job of describing what the adapter actually does.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-03-19 14:14:13 +00:00
Marc Herbert 5e971a2f06 CODEOWNERS -= xiulipan
Let's stop spamming Xiuli.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-19 13:41:03 +00:00
Daniel Baluta e50ae6be8c codec_adapter: Initialize processing
During the initialization of a decoder, the initialization task reads the
input stream to discover the parameters of the encoding.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta b59e53034b codec_adapter: Introduce codec_init_process api
This function should be called before processing. It searches
for a valid header, does header decoding to get the parameters
and initializes state and configuration structures.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta 90831338ad codec_adapter: cadence: Save initialization status to codec_processing_data
We need to save initialization status to a persistent (between calls)
variable in order to check it each time we want to do processing.

Initialization only takes place once before first frames are decoded.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta c3b4382c4b codec_adapter: cadence: Fix init process function
Init process function searches for valid header, does header
decoding to get the parameters and initializes state and configuration
structures.

In order for this to work we need to set the input bytes and also
update consumed bytes.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta 09ac7f1b72 codec_adapter: cadence: Factor out init process code
Initialization of the processing shouldn't be done in the prepare
function as the decoder needs some input frames in order to figure
out decoding parameters.

First step is to just factour out the init process code into
a function and move it to the proper place later.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta ed027d045b codec_adapter: Differentiate between consumed/produced bytes
With decoders, usually, consumed bytes is not equal
with produced bytes. We need to take this into account
in order to copy the entire produced bytes by the processing algorithm.

- consumed bytes -> number of bytes consumed from the input buffer.
- produced bytes -> number of bytes produced into the output buffer.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-18 15:05:52 +02:00
Daniel Baluta f305790e51 platform: imx8: Fix clock frequency for i.MX8X
Looking at the timestamps from sof-logger it looks like
the DSP core frequency on i.MX8X is wrong.

Documentation confirms this. It should be 640Mhz.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-03-16 12:09:00 +00:00
Cristina Feies (ilie) 25ed49f461 kwd sample: Add IMX platform as a dependency for SAMPLE_KEYPHRASE
This allows i.MX based platforms to use the
samples for the keyphrase detector

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-16 13:47:12 +02:00
Cristina Feies (ilie) 9c499bc1d6 topology: imx8m: add kwd component with wm8960 codec
Adapt the apl KWD topology to imx8m by switching to
SCHEDULE_TIME_DOMAIN_DMA on capture pipeline and
creating a no LP capture file for KFBM component.

Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
2021-03-16 13:47:12 +02:00
Yong Zhi 1c09ccf0e2 config: disable alh in jasperlake_defconfig
Since soundwire is not enabled on any jsl+ product,
it's safe to turn it off by default.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-03-15 21:28:38 +00:00
Marc Herbert e995bbb575 Dockerfile: apt-get install tree
Required to remove the copy hack introduced in
commit eb4373cb61 (".github: new installer.yml")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-15 21:23:32 +00:00
Iuliana Prodan 5f93ad4729 drivers: imx: sai: W1C for a clean start
On start W1C the Work Start Flag, Sync Error Flag and
FIFO Error Flag.

Write a logic 1 to this field to clear each of this
flags and have a clean start for SAI.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-15 20:02:17 +02:00
Iuliana Prodan f60adbbbda drivers: imx: sai: update start/stop operations
For SAI, we have the synchronous mode enabled: the transmitter is
configured for asynchronous operation and the receiver for
synchronous operation.
In this case, transmitter bit clock and frame sync are used by both
the transmitter and receiver. So, when enabling RX we need to enable TX
(if not already enabled).

Therefore, for a clear start, we first do a software reset for the current
direction, but checking the state of RX and TX.
This will reset the internal transmitter/receiver logic including the FIFO
pointers.

For capture we can disable the receiver data channel, but on playback,
we can disable the transmitter only if the RX has the DMA requests
disabled.
Also, for capture, there's no need to enable the transmit data channel.
It's sufficient to enable only the transmitter, which enables the bit
clock (shared with RX).

On stop, we just need to disable the DMA request, the transmit/receive data
channel, the interrupts and the receiver and/or the transmitter.

Fixes: #3809

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-15 20:02:17 +02:00
Iuliana Prodan 0d20c6c7a7 drivers: imx: sai: set SAI watermark only once
Set SAI watermark only once, on sai_set_config().
There is no need to set it each time, on start().

SAI watermark is kept on half FIFO size.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-15 20:02:17 +02:00
Iuliana Prodan 1fa1001e24 dai: correct the order for DAI and DMA start/stop
To stop/suspend an active DMA channel:
1. Stop the DMA service request at the peripheral first (stop the DAI);
2. Disable the hardware service request on the appropriate DMA channel.

For start/resume:
1. Enable the DMA service request on the appropriate channel;
2. Enable the DMA service request at the peripheral (enable DAI).

When the start/stop order for DMA and DAI is different, on multiple
start/stop runs for playback or record or combined, we get an
underrun/overflow.
That's because the DAI makes a DMA request, before the DMA channel is
enabled.

Some platforms cannot just simple disable DMA channel during
the transfer, because it will hang the whole DMA controller.
Therefore, for DMA_SUSPEND_DRAIN, stop the DMA first
and let the DAI drain the FIFO in order to stop the channel
as soon as possible.

Fixes: #3809

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-15 20:02:17 +02:00
Iuliana Prodan fa35ee00f2 kpb: fix type for force_copy_type
In kpb force_copy_type is declared as enum comp_copy_type,
but later on is initialized and compared with an integer
constant.

We should use everywhere only enum comp_copy_type.
Therefore add an invalid copy_type, COMP_COPY_INVALID in
enum comp_copy_type.
Use this one to initialize and compare force_copy_type.

Fixes: 7e46996c96 ("kpb: Introduce force_copy_type")

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-11 21:31:59 +02:00
Marc Herbert 21f4e74dd7 installer: fix incremental builds
Building "sof" does not rebuild the .ri firmware file. Switch to the
"bin" target which is what ./scripts/xtensa-build-all.sh builds.

Fixes: 479809663e ("installer: (re)build firmware, topologies and user
space tools)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 16:52:29 +00:00
Marc Herbert b809caeb5d installer: --no-print-directory
Gets the length of a no-op "make topologies" from 380 down to 140
lines. From 300 to 200 for one "make signed" platform.

Ninja is more quiet by default.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 16:52:29 +00:00
Marc Herbert 732c75259d scripts: remove XTOBJDUMP and XTOBJCOPY unused since CMake / Jan 2019
XTOBJCOPY and XTOBJDUMP were added in June 2018 by
commit 27795ece0f ("scripts: fix xt-xcc build with wrong config") for
`./configure CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP ...` that was
used at the time.

The build system was switched to CMake in January 2019, notably with
commit 9840ecbbfe ("cmake: update xtensa-build-all.sh") and
commit 0fd97adfb0 ("cmake: add utility scripts") that defined
CMAKE_OBJCOPY and CMAKE_OBJDUMP)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 13:15:31 +02:00
Marc Herbert e6c3dda61a xtensa-build-all.sh: remove $ARCH unused since CMake / January 2019
$ARCH was introduced in 2018 by commit b5af84deaa ("scripts: add smp
builds to xtensa-build-all.sh"). At the time used autotools and
`./configure --with-arch=$ARCH` were used.

In January 2019 the build system was migrated to CMake over several
commits, notably commit 9840ecbbfe ("cmake: update
xtensa-build-all.sh") that switched xtensa-build-all.sh to CMake and
removed its only use of ARCH. Also note commit 82b4da291b ("cmake:
defconfigs support") which added a few CONFIG_SMP defconfigs and
commit 905bad4252 ("scripts: xtensa-build-all: Add support to force
build UP Arch") using override.config.

Much more recently in June 2020: commit fd506970cc ("zephyr: kconfig:
rename CONFIG_SMP -> CONFIG_MULTICORE")

Zawinski's Law of Software Envelopment: adding lines of code is much
easier than removing the same amount and would be very impractical
without git. This one was easy enough.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 13:15:31 +02:00
Marc Herbert 6541a86101 check patch: ignore UNKNOWN_COMMIT_ID in shallow clone
Cause it's obviously missing from a shallow clone most of the time.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 13:15:31 +02:00
Marc Herbert 716efc00bc xtensa-build-all.sh: 3 times more xcc threads than gcc threads
As CMake forks one compiler process for each source file, the XTensa
compiler spends much more time idle waiting for the license server over
the network than actually using CPU or disk.

On my VM with 16 virtual cores, rebuilding one platform from scratch
with this commit goes down from 12s to less than 9s: more than 25%
faster. With Ninja it goes down from 11s to less than 8s. My license
server is 25ms away: a closer server does not need as many threads while
a more distant server would obviously benefit for even more
threads... while already getting an even better improvement than 25%
from just 3 times more threads! It's complicated and we probably don't
want to start the build by measuring latency to the license server.

The entire, purely local _gcc_ build is so fast (~ 1s) that observing any
the difference between -j nproc and -j nproc*N is practically impossible
so let's not waste RAM when building with gcc.

Also: log the $XTENSA_SYSTEM variable as it is required for incremental
builds; remove one apostrophe in the here-doc usage as it breaks the
parser of some editor (jed).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 10:24:09 +02:00
Marc Herbert 4c1f41a91b cmake: add some MEU-related comments
Notably:
- Log error and default MEU_OFFSET when meu -ver is not found.
- Explain rimage -s option

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:14:09 +00:00
Marc Herbert 30212950a8 .github: yamllint installer.yml
Just like the others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:12:58 +00:00
Marc Herbert 7baa878610 .github/check patch: do not stop on the first failure
Add new script to reduce duplication and ease local testing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:12:58 +00:00
Marc Herbert 3bb33ded0a .github: http://github.com -> https://
Avoids the following redirection and warning:

 warning: redirecting to https://github.com/thesofproject/sof/

Fixes: f59bb62e31 (".github: add shallow checkpatch to Github
Actions")

Also try to fix the display of one step name in the web UI.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:12:58 +00:00
Marc Herbert 1371d479ab installer: add tgl-h
add tgl-h

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 19:55:45 +00:00