Commit Graph

5758 Commits

Author SHA1 Message Date
Karol Trzcinski fb838de413 buffer: Move buffer_params_match() implementation to buffer.c file
Assertions don't show proper location for functions implemented
in header file.
Before changes, example location of this assert was:
   Location: src/audio/pipeline.c:303

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-11-03 16:47:02 +00:00
Karol Trzcinski b72c7ec2df rimage: Update to commit 0d2af68a9e
Included changes:

0d2af68a9e gitignore: Add checkpatch temporary file to gitignore
8249abfa11 toml: Keep available manifest parsers in list
c98a29da14 toml: Extract version parsing to separate function
b9cf1aeb3b pkcs1_5.c: don't pretend everything is fine when failing to sign
e87db0f080 pkcs1_5.c: intermediate named constants in ri_manifest_sign_v1_x()
86754c1389 hash: Assert memory overflow during hash calculation
37323face2 Merge pull request #28 from marc-hb/copy-sram-overflow
7322c02349 manifest.c: assert buffer overflow in man_copy_sram()

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-30 14:15:32 +00:00
Daniel Baluta 12fdd638de drivers: imx: sdma: Fix SDMA watermark
After experiments I found that current SDMA watermark
causes SDMA to miss SAI DMA requests.

The empirical value was chosen so that watermark is a
divisor of min(bd_count, fifo watermark).

Of course this needs to be revisited, but for now "it just works" (tm).

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 1baececbad drivers: imx: sdma: Cleanup event handling
For handling events we only needs an enable/disable functionalities.
Setting up an event (that means reading the event number and saving
it in dma_pdata is already done at config time).

So, this patch just introduces:
	* smda_enable_event
	* sdma_disable_event

and removes existing sdma_clear_event and sdma_set_event.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 04d14eeaca drivers: imx: sdma: Cleanup sdma_set_event
Do not touch overrides values in sdma_set_event as they are properly
set at config time.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 39ff32336c drivers: imx: sdma: Do not override events
A channel will be scheduled when both an event has occurred
and the users have enabled the channel.

This allows us to strictly control channel scheduling.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 1d19cf43ea drivers: imx: sdma: Set dma channel index
Without this index will always be 0 and we cannot differentiate
between channels for various function calls.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta bae469d8cb drivers: imx: sdma: Enable channel after a BD was processed
Host platform sets HSTART_HE bit to activate the corresponding channel
and the DSP will clear the HE bit when done.

In order, for the channel to be rescheduled we need to start again the
HSTART_HE after we got an interrupt that a BD was processed.

This is done in sdma_copy using sdma_enable_channel.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 2346622d1a drivers: imx: sdma: Initialize next_bd with zero at config time
During several runs next_bd might not be zero, this means that
when an interrupt arrives we will mark the wrong BD as being ready
to be processed by the DSP.

This causes the DSP to block waiting forever for an available BD.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 5f022993f6 drivers: imx: sdma: Stop a channel in sdma_stop
We no longer care about setting overrides values at stop
because they are correctly set at config time.

What we need to do instead, is to clear HE bit (SDMA_STOP_STAT).

This patch also introduces sdma_disable_channel function to simmetry
with sdma_enable_channel.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 30c9eed3cb drivers: imx: sdma: Always manually start a channel
A channel is scheduled when the following condition is true:

(HE[i] or HO[i]) and (EP[i] or EO[i])

In order to strictly control a channel's behavior we allow it to run
only after the users has started the channel in sdma_start and an
event arrives.

For this reason we need to set host override and event override to 0.
This is already done at config time.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Daniel Baluta 300e4531aa drivers: imx: sdma: Do not set channel priority at start
Channel priority is set during config time.

Also, notice that only channels will index != 0 will call
sdma_start so it is correct to not check for index != 0 in
sdma_start. This makes code easier to read.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-30 13:49:37 +00:00
Karol Trzcinski 3c9657789d trace: ipc: pipeline: Add logs about ipc_pipeline_complete() errors
A few error paths through ipc_pipeline_complete() didn't send
any error log. Each silent error path is some kind of firmware
malfunction.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-30 13:48:31 +00:00
Curtis Malainey 5d871373cb host: don't alloc notifier
Both the fuzzer and the testbench call init_system_notifier which
initializes the struct so there is no need for this check (which causes
a double alloc) in the get function.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-30 13:46:52 +00:00
Seppo Ingalsuo 0963d88ba3 Tools: Tune: TDFB: Simplify typical usage of bf_design(), bf_export()
The bf_defaults() now sets the default directory locations for
for bf_export() so it does not need to be set in every script.

Also the defaults for input channels and output mixing are set to
that in typical design they do not need to be set.

The default distance for look direction is set to 5.0m so it is better
guaranteed in far field for even relatively large arrays. The far field
assumes planar sound waves. The design equations do not fully support
near field with spherical waves.

The FFT length is changed to 1024 to enable design of longer filter bank
filters. There's no compromise in performance for for e.g. length 64.

The incorrect use of mic_n (number of microphones) is replaced by
num_filters. It's possible define beamformer that ignores some mic
channels so these are not the same.

The automatic systematic design file names are now created for all array
types, not just line.

The script is made more flexible to run without need to export data and
clutter just to quickly interactively check from plots what kind of
beam pattern and other characteristic some array, e.g. circular with
some radius and mic count gives.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-10-30 13:45:29 +00:00
Seppo Ingalsuo db47e28154 Tools: Test: Audio: Cleanup for TDFB component test script
The common array identifier string is brought up for easier edit to
test other array geometries than this default. A typo about 16 kHz
is fixed, the test runs at 48 kHz testbench default rate.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-10-30 13:45:29 +00:00
Seppo Ingalsuo d88e36987b Tools: Tune: TDFB: Fix typo in copyright text year
This patch fixes the small mistake.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-10-30 13:45:29 +00:00
Seppo Ingalsuo bede56972c Tools: Tune: TDFB: Updates for array geometry helpers and add 3D array
This patch adds the missing XYZ 3D array helper and does minor fixes
for two others. The L-shape microphones orientation is made similar as
in rectangular array by inverting the y-axis. The missing centering
of rectangular array is added.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-10-30 13:45:29 +00:00
Curtis Malainey aea7da470c oss-fuzz: add code owner
Add myself as the code owner for the fuzzer

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-29 15:56:42 +00:00
Curtis Malainey 1d028ab9c1 fuzz_ipc: use calloc instead of malloc for ipc region
The memory sanitzer catches uninitialized value errors on the size check
for small data sizes. Therefore lets us calloc so we can assume the
whole region exists without having the sanitizer get upset.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-29 15:55:41 +00:00
Slawomir Blauciak cb6420853d compile: check for __XCC__ flag when defining FW build info
Previously, the __GNUC__ flag was used to differentiate between GCC and XCC.
However, that flag is defined by XCC as well,
as a result, __XCC__ flag should be checked instead.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2020-10-29 13:58:21 +00:00
Curtis Malainey 28e5047f03 cmake: fix indentation
Replace spaces with tabs

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-29 12:11:12 +00:00
Curtis Malainey db09bb8058 dcblock: fix reset handler
Reset state when reset trigger happens and use memset to do it

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-23 10:44:10 +01:00
Guennadi Liakhovetski b672923809 zephyr: adjust for new location of audio component samples
Audio component samples have been moved to a new location, fix Zephyr
builds to account for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-10-23 10:16:55 +01:00
Guennadi Liakhovetski 9a02ffdeb7 zephyr: fix compiler warnings due to recent Zephyr changes
Fix two compiler warnings, introduced by recent Zephyr changes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-10-23 10:16:55 +01:00
Guennadi Liakhovetski f215d5e052 cavs: explicitly include <cavs/version.h> where needed
To use CAVS_VERSION* macros the <cavs/version.h> header has to be
included. Also remove superfluous empty lines from that header.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-10-23 10:16:55 +01:00
Curtis Malainey 6cd9f6a251 abi: fix macro size overflow
ubsan found the following bug via oss-fuzz

/src/sof/src/ipc/handler.c:1385:9: runtime error: left shift of 15 by 28 places cannot be represented in type 'int'

This is caused by SOF_GLB_TYPE_MASK which has an implicit length of 15
(int16_t)

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-23 10:15:10 +01:00
Karol Trzcinski ed21921878 gitignore: Add checkpatch temporary file to gitignore
Any generated file should be tracked by git to keep repositiry clean.
Such an file should be added to .gitignore to reduce possibility of
accidentally pushig this file to remote branches, eg. after typing
`git add *` before pushing changes.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-22 13:05:23 +01:00
Karol Trzcinski 15092530ba sof: Remove temporary .checkpatch-camelcase.git. file from git
This file is generate by checkpatch run, any temporary file shouldn't
be tracked by git. It was added to git by:
538eb6a: ("host: stub about required functions")

Moreover file is problematic for developers working on Windows,
now try to pull changes from remote repository ends up with:
  $ git pull
  error: invalid path '.checkpatch-camelcase.git.'
  Updating 6e85152..7709924`

cloning repository ends up with:
   $ git clone https://github.com/thesofproject/sof.git
   Cloning into 'sof'...
   remote: Enumerating objects: 97, done.
   remote: Counting objects: 100% (97/97), done.
   remote: Compressing objects: 100% (96/96), done.
   remote: Total 67251 (delta 49), reused 4 (delta 1), pack-reused 67154
   Receiving objects: 100% (67251/67251), 13.41 MiB | 2.62 MiB/s, done.
   Resolving deltas: 100% (49768/49768), done.
   error: invalid path '.checkpatch-camelcase.git.'
   fatal: unable to checkout working tree
   You can inspect what was checked out with 'git status'
   and retry with 'git restore --source=HEAD :/'

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-22 13:05:23 +01:00
Karol Trzcinski e04610b197 alloc: Print information about runtime shared zone in heap_trace_all()
Runtime shared zone should share this functionality with others
runtime zones.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Karol Trzcinski 1f596beb3e alloc: Remove SOF_MEM_FLAG_SHARED
It should be replaced with new SOF_MEM_ZONE_RUNTIME_SHARED
for memory which will need free and SOF_MEM_ZONE_SYS_SHARED
elsewhere.
This commit removes old way of defining allocating shared
memory region and in new way, platform_rfree_prepare()
doesn't need to translate address for cavs platform,
because runtime shared heap is defined on uncashed memory
region internally.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Karol Trzcinski 489bff14e1 alloc: Handle operations on shared heap
New memory zone needs dedicated heap routines.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Karol Trzcinski 43124daf39 alloc: Define new memory zone, shared
Shared memory shouldn't be connected with any cpu core,
because in general such an resource may be shared between
any number of arbitrary chosen cores.

Connecting it with with core 0 heap, leads to unbalanced
heap usage between core 0 and secondary cores.

Moreover operations like alloc and free may be called from
two different cores, what's not possible in current implementation.
Such an situation is especially possibly during handling resources
describing hardware components, eg. DAI or DMA, from two different
cores.

Moving shared memory management to dedicated heap, allows to easily
use another memory region, what may be needed to fulfill platform
specific demands.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Karol Trzcinski 901e7b4945 alloc: Refactor get_heap_from_ptr()
Extract common part to internal function, to allow easily add
new heap in future and remove code duplication.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Karol Trzcinski 760f504eef alloc: Refactor rmalloc_sys, use mm_heap* instead core id as input
This allows to reuse this functions for another heaps.
Moreover it helps to omit double memmap committing,
because each client of this function already use memmap,
so is oblidged to call platform_shared_commit().

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 14:57:09 +01:00
Ryan Lee 7270988c71 smart amp:fix for the volatile parameter range
DSM_API_ADAPTIVE_PARAM_END was not included.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee ec536c8cea smart amp:allow set parameters at runtime
This modification allows parameter write at runtime.
Same modificatino was added to smart_amp_test.c

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee 3e849c59c6 smart amp:apply fix for handling buffer data invalidation and writeback
Propley handle buffer data invalidation and writeback.
This is importnat to keep data synchronized.
Took modification from smart_amp_test.c

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee 7f315a7185 smart amp: set rate in feedback channel
Update sampling rate for feedback channel

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee 75dfdb53dd smart amp:removed hardcoded frame_fmt value
frame_fmt for feedback was hardcoded to S32_LE format.
This workarround code is no longer needed.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee 95ee7a8df4 smart amp:use comp_get_state
Use 'comp_get_state' function to read state instead of
doing directly access to state member viariable.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Ryan Lee 4f1bb0c1ae smart amp:removed references to .avail members of audio_stream
Use 'audio_stream_get_avail_frames' instead of directly accessing .avail

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-10-21 12:21:17 +01:00
Karol Trzcinski 9e131360fc logger: Check for unused arguments
There is no place for unused arguments, their are consequence of invalid
argument list as usual.
Such an situation is highly possible especially during defining trace
filters, eg `-Fv=mux 4.1` instead `-F"v=mux 4.1"` or `-Fv=mux4.1`.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-21 11:48:19 +01:00
Daniel Baluta 7709924f16 drivers: imx: sai: Make sure Tx/Rx is disabled at stop
TE/RE bit will remain set until the end of current frame. So,
for example, even if we set TE to 0 the transmitter will still be
enabled until the end of current frame.

This can have unexpected results when quickly restarting a channel.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-10-20 15:57:49 +01:00
Pan Xiuli 2fe7c89489 logger: change the usage string for filter
Change the misleading usage info for filter.
Add format as tips for filter string.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-10-20 11:08:20 +01:00
Pan Xiuli b804e1df7e logger: fix opt for filter parameter
The -F filter option has argument, we should use
F: instead of F in the optstring.

Fixes: #3530

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-10-20 11:08:20 +01:00
Karol Trzcinski 1ad0269f5d logger: Fix log_err usage at early stages of sof-logger run
This function could fail when called before convert()

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-10-20 10:41:17 +01:00
Yong Zhi 2de506025f topology: sdw: Update echo ref channel number on max98373
The topology has two speaker amp configured, with voltage info
feedback-ed to host for each channel in the EchoRef, so update
SMART_REF_CH_NUM accordingly.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2020-10-20 10:38:06 +01:00
Curtis Malainey 955201897d oss-fuzz: add ipc fuzzer
Add shim to fuzz the full ipc space with

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-20 09:28:28 +01:00
Curtis Malainey 8b680d5338 host: enable ipc handler module
The handler is the primary entry point for the fuzzer and therefore
needs to be added to the build.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-20 09:28:28 +01:00