Commit Graph

5653 Commits

Author SHA1 Message Date
Marc Herbert 35d9034090 build-tools.sh: fix misnamed locals DO_BUILD_topology and _test
Easier to spot once all other shellcheck warnings have been fixed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-08-31 14:43:11 +01:00
Marc Herbert f30d11072a build-tools.sh: fix minor shellcheck warnings
Missing quotes mostly, also some disable=SC2034 because "eval".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-08-31 14:43:11 +01:00
Karol Trzcinski 173206494d dai: host: dma: Check returned value in dma_buffer_copy_* clients
After error in lower layers, this issue should be traced in
proper context.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-31 14:34:27 +01:00
Karol Trzcinski 8720cf203a dma: Return error code from dma_buffer_copy_* function
This function should error code from 'process' to their client.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-31 14:34:27 +01:00
Karol Trzcinski ca73d43076 pcm_converter: Return error code from converting function
It allows to trace error with proper (client) trace context
after hitting some error.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-31 14:34:27 +01:00
Seppo Ingalsuo f430addec7 Tools: Fuzzer: Do not use illegal BUILD_COMMAND in CMakeLists.txt
This patch removes the incorrect usage of BUILD_COMMAND. Having it set
to "cmake" caused the cmake usage help text output to be shown only and
caused the ExternalProject_Add command to believe the
libsof_tplg_parser.so was built. The build for the library happened only
because the next install step performed the compilation. With this fix
the default build command is used instead. There's no need to define
it here.

Fixes #2656

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-08-31 11:30:26 +01:00
Marcin Rajwa 4d48f868fe KWD: performance improvements
This patch improves overall key word detector
pipelines performance by skipping unnecessary
checks & calls.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Marcin Rajwa 31949d0669 detector, kpb: change buffering and draining constants
This fix compensates host wakeup time.
Here we limit max draining request to 2 seconds.
History buffer size if one second bigger than max draining
request allowed.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Marcin Rajwa dcd8d4c79e memory: increase HPSRAM size for buffer on TGL
This patch increases HPSRAM buffer size for TGL platform.
Thanks to this change we can provide KPB more space for
history data.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Marcin Rajwa e697e912aa kpb: refactor
This patch changes the variable name history_depth to drain_req
as it is more understandable.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Marcin Rajwa e027b08d39 KPB: protect update of history buffer
This patch adds critical section during update
of real time stream in draining task. There is a small possibility
that history data may get corrupted when real time stream preempt
draining at wrong moment.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Marcin Rajwa fec09e0b87 topology: schedule two KWD pipelines on 5 ms period
This patch changes the KWD pipelines perriod from 20 ms
to 5 ms to improve performance.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-28 13:48:07 +01:00
Adrian Bonislawski 665bda9c8a kconfig: select CAVS_USE_LPRO_IN_WAITI for TGL
TGL have hardware requirement that DSP should
use LPRO as clock source in waiti.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-08-28 13:42:55 +01:00
Dharageswari R 0a597d57a7 topology: Allow set parameters at runtime in smart_amplifier component
Kcontrol interface is needed to set the smart_amplifier algorithm
parameters at runtime for tuning purpose. This patch allows the
user to set parameters using byte kcontrol.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
2020-08-28 13:42:11 +01:00
Mohana Datta Yelugoti 46578cb103 scripts: Add a new script to rebuild testbench
Currently, the testbench is built using the script named
'host-build-all.sh' under scripts directory. But the name of
the script, it's git history doesn't refer to what the script
is currently doing now.

The newly written script adds option to build the testbench.
This script was written in mind to remove the old script
used to build the testbench (i.e host-build-all.sh).

The script also adds an option to build the testbench with
AFL instrumentation. AFL fuzzer works well when the code
it's trying to fuzz is instrumented properly. The instrumentation
helps the fuzzer in generating unique inputs which cover
different paths in the code graph. When the option is set,
testbench is built using a compiler AFL provides, which does
the instrumentation work.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-28 13:38:04 +01:00
Karol Trzcinski 78202631e7 pcm_converter: Reduce modulo operations
Module is expensive operation, so usage them in processing code
should be reduced.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 16:22:49 +01:00
Liam Girdwood 6d7a17e6f3 schedule: atomic: atomic values must be read during arithmetic
atomic operations must use the value returned by the atomic_add() or
atomic_sub() operation rather than a subsequent (and non atomic) read.

Fix this by using values returned by atomic add() or sub()

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-27 16:21:48 +01:00
Karol Trzcinski 31a3aacc1a logger: Terminate parsed log levels with new line
Text saved to FILTER_KERNEL_PATH should be terminated with
new line, to indicate end of input and mark it redy to send
to FW in IPC message.

Fixes: 126060ae (logger: Send parsed runtime log levels to FW via debugFS)

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 14:25:14 +01:00
Karol Trzcinski 60141f2074 logger: Fix log level parsing
Usage of strstr for short version of logs level definitions
(for example 'e') leads to invalid level parsing, because first
log level with defined string (or letter) will be returned
(in this example 'verbose').
After change, log level will be returned only when name is
exactly as given one.

Fixes: b1fc9220 (logger: Parse runtime filter levels)

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 14:25:14 +01:00
Guennadi Liakhovetski 692cfa9305 scheduler: fix deregistering domain owner
When a DMA scheduling domain owner is deregistered, if there's still
another DMA channel active in the same domain, the ownership has to
be transferred. In this case even briefly disabling and re-enabling
DMA can cause over- or underruns. Avoid this by transferring domain
ownership transparently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-27 14:24:06 +01:00
Karol Trzcinski 67a0a6937c trace: Trace initial message as error logs
Use tr_err to have this initial message also in error logs and assert
traces works well.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 13:49:20 +01:00
Karol Trzcinski 837ad4b9e0 trace: Print source hash as zero padded 8 char width value
Then src hash and ldc hash should have the same format.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 13:49:20 +01:00
Karol Trzcinski 61f9d3de34 trace: Move FW description log location
This log should be added just after buffer initialization,
to make it the first one in the output file - for easy identyfication.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 13:49:20 +01:00
Seppo Ingalsuo 40fd801c29 Tools: Testbench: Add system agent initialization
This patch fixes a segfault with null sof->sa pointer in
pipeline_schedule_copy() function. The bug has not been observed
with test topologies for processing pipelines but with other
topologies with fuzzer varied parameters.

The sa_init() is added to tb_pipeline_setup(). The scheduler_init_edf()
is a dependency. The two dummy functions platform_timer_get() and
clock_ms_to_ticks() are also added as dependency. The CMakelist for
library is edited to include agent.c build for testbench.

Fixes #3247

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-27 11:59:04 +01:00
Guennadi Liakhovetski d697516c32 topology: apl: use the generic DMIC topology template
Use a generic DMIC topology template instead of defining a private
one.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-27 11:48:00 +01:00
Guennadi Liakhovetski 2db42dda5c topology: dmic: support non-standard DAI link IDs
Some platforms, e.g. UP2 (APL+PCM512x) use non-standard DAI link
IDs. Let those platforms specify their IDs and still use the
generic DMIC topology template.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-27 11:48:00 +01:00
Dharageswari R 49d432dded sof-ctl: Add support for read-only, write-only and read-write kcontrol
This patch checks for the access type of kcontrol and returns error
only when the access type is not read or write.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
2020-08-27 11:19:28 +01:00
Dharageswari R d77655059e topology: Add Smart-amp get parameter byte kcontrol
This patch adds the smart amplifier get parameter byte kcontrol
to read the actual algorithm parameters from DSP during runtime.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
2020-08-27 11:19:28 +01:00
Dharageswari R 333036f097 topology: Add support for RO_volatile, WO and RW_volatile byte kcontrol
This patch adds the support for read-only volatile byte kcontrol with
access type as read and volatile to read the actual values from DSP,
write-only byte kcontrol with access type as just write and read-write
volatile byte control with access type as read, write and volatile.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
2020-08-27 11:19:28 +01:00
Ryan Lee 420ef1b6d2 Topology: modified initial config for the smart amp
Modified initial configuration param for the smart amp.
Total number of feedback channels was changed from 8 to 4.
Assigned 4ch feedback to 0 ~ 3 slots.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-08-26 22:02:34 +01:00
Adrian Bonislawski b26dc63919 tgl: iccmax use pm_runtime_en_dsp_pg power up instead of full core init
This patch will introduce additional client override flag to pm_runtime_get
Extra flag is not necessary but if used it will prevent from powering down
a core without the same flag

This will save a lot of time if quick changes are needed
eg. in dynamic hpro-lpro switching which on TGL will also require to
power up core 3

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-08-26 22:01:02 +01:00
Seppo Ingalsuo 009714bd6d Audio: Volume: Avoid possible divide by zero trap
If in a topology the volume component ramp length (milliseconds) and
from it derived ramp update period is longer than pipeline copy()
schedule period the dev->frames (frames to process per per period) is
divided by zero. This error is not triggered by any of current
topologies.

The fix is to use dev->frames count as gain ramp update rate for
situations where the integer divider would round to zero. There is no
harm to update the gain at higher rate than suggested by topology.

Returning an error for such topologies also is not necessary since the
service is in such case done at better quality than requested. Finer
update grid results to less zipper noise.

Fixes commit 1b57609a1e ("volume: do not schedule ramping as separate task")
Fixes #3334

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-26 21:46:49 +01:00
Pierre-Louis Bossart 3286bfa7bf topology: sof-cht-max98090: temporarily remove S24/S32_LE support
The mixer doesn't seem to work with these two formats, limit support
to S16_LE until the mixed is fixed.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-08-26 21:45:17 +01:00
Pierre-Louis Bossart 7e33c8f9ce mixer: align and use audio_stream_period_bytes
Not sure why this was different from other processing.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-08-26 21:45:17 +01:00
Pierre-Louis Bossart 4b88635cfd audio: align error messages when sink buffer is insufficient
Align to provide same information for all audio processing, no reason
to be creative here.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-08-26 21:45:17 +01:00
Keyon Jie ea4ba64bd0 topology: pipe: fix and export supported formats correctly
Switch to use CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT) for all pipelines,
no matter there is PGA in it or not, the dai format is not important
here, as the pcm_converter will help.

This will help fix issue where we are claiming the wrong supported
formats in the PCM capability, e.g. our host buffer is allocated as
S16_LE so we can support S16_LE only, but with today's code it is
`S32_LE,S24_LE,S16_LE' in the pcm capability, so end user can run with
S24_LE or S32_LE and eventually end up to FW internal errors.

BugLink: https://github.com/thesofproject/sof/issues/3318
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-26 17:57:45 +01:00
Keyon Jie e4fa878606 topology: utils: add helper to generate PCM capability
Add a helper to generate supported formats of the PCM capability, it is
up to the pipeline format:

for s16_le pipeline, only S16_LE is supported.
for s24_le pipeline, both S16_LE and S24_LE are supported.
for s32_le pipeline, all S16_LE, S24_LE and S32_LE are supported.

For each pipeline, we should use CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT)
in the PCM_CAPABILITIES definition.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-26 17:57:45 +01:00
Guennadi Liakhovetski 84298db608 byt: use an internal timer for "cpu_timer"
Using the same hardware timer for both "cpu_timer" and
"platform_timer" doesn't work, switch the "cpu_timer" to use
TIMER1 on Baytrail. This also fixes performance counters on
the platform.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-26 17:49:05 +01:00
Mohana Datta Yelugoti c0b969d784 tools: testbench: initialize local variable before accessing it
If user fails to provide a topology file, the tplg_file member
of structure tp is left uninitialized. This member is used to
check again if the file was provided, which won't be possible
unless this has been initialized to NULL and checked for NULL
after parsing arguments.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-25 13:13:30 +01:00
Karol Trzcinski 126060ae63 logger: Send parsed runtime log levels to FW via debugFS
"/sys/kernel/debug/sof/filter" file is responsible for updating
trace log levels. IPC message contain list of new trace threshold,
it is represented as single line in file where entries are separated
with ";". Single entry has form of:
"<uuid_id> <pipe_id> <comp_id> <log_level>"

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski b1fc922079 logger: Parse runtime filter levels
Parse arguments given in -F flag, in form where each -F argument
is given as separate line. Format of single -F entry is
`<log_level>=<component_list>`. <log_level> must corresponds with
.name field from log_level_dict. List of component are build from
elements separated with `,` and single element may have one of the
following forms:
"<name> <pipe_id>.<comp_id>" - single component instance
"<name> <pipe_id>.*" - components with given name on piepeline with pipe_id
"<name>*" - each component instance with given name or global component
"<name>" - as above
"* <pipe_id>.<comp_id>" - component on selected pipe_id with given comp_id
"* <pipe_id>.*" - each component on pipeline with pipe_id
"*" - each component in firmware
<name> must correspond values of uuid entries from ldc file.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski 97a8c685f8 logger: Implement whitespace trimming functions
They will be needed during trace filering command parsing,
to skip whitespaces. As generic functions, their are placed
in misc file instead of any feature-related file.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski bd0e10d133 logger: Store filter config given in command line
To parse filter configuration given by user, uuid dictionary
must be readed first from ldc file. Otherwise it's impossible
to validate given components names. This is reason why filter
configuration must be buffered and parsed in later steps.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski 4db4d0d86f logger: Exclude misc functions from convert file
A few, general usage functions where implemented in converter file.
They should be moved to separate file, to make it easily accessible
form any source file. Moreover removing it from converter file, is a
part of this file cleanup.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski 7e7829d26f logger: Extract function for conversion between UUID value and UUID key
This conversion should be done in function, because of future usage
in different places, outside converter.c file.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Guennadi Liakhovetski 647390f75e schedule: dma_multi_chan: fix a DMA channel interrupt race
When streaming audio data on multiple DMA channels simultaneously cases
with 3 tasks (A, B, and C), scheduled on 2 DMA channels (X and Y), have
been observed, when one of the tasks wasn't scheduled. Usually when
scanning tasks in schedule_ll_is_pending() the following sequence would
take place:
    channel    task    interrupt status
    X          A       1
    X          B       1
    Y          C       1
where the interrupt would be cleared in lines 2 and 3 above. However,
sometimes the following sequence takes place:
    channel    task    interrupt status
    X          A       0
    X          B       1
    Y          C       1
which then leaves task A not scheduled, because similar to the first case,
the interrupt on channel X will be cleared in line 2. To fix this modify
schedule_ll_is_pending() to handle DMA channels / scheduling components
one after another.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-08-25 12:53:45 +01:00
Liam Girdwood 87c23eb3ce zephyr: fix build for new sof git hashes.
Git hashes need exported for Zephyr build.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-25 09:47:10 +01:00
Liam Girdwood 7a10da097c cmake: set git hash to 8 digit
GIT_LOG_HASH can be more than 8 digits. Limit hash value up to
first 8 digits.

fixes: #3322

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2020-08-24 09:37:46 +01:00
Mohana Datta Yelugoti 2e07bb9d89 tools: testbench: send valid pointer to free system call
free() system call frees the memory space pointed to by
ptr, which must have been returned by previous call to
malloc(), calloc() or realloc().

Now, when incrementing the array pointer, we may have
exceeded the actual allocated size. If we do pointer arithmetic
and subtract size from the array pointer, we may not point to
the actual location returned by malloc().

This patch makes sure that when we do pointer arithmetic on array,
the array's value at the end would be same as the one returned
by malloc.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-21 10:50:23 +01:00
Daniel Baluta 87e4f5aad8 host: Fix first period not being copied to/from host
After commit 048145fe60 ("pipeline: remove code related to preload")
buffers are no longer preloaded so we don't need to manually
update first period transfer.

Taking playback as an example, without this patch first period bytes
weren't copied downstream to DAIs removing typically first 0.1 seconds
from the input file.

With PCM streams this is not really noticeable. Anyhow, this becomes
a problem with compressed streams where we need every byte for
decompression.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-08-20 11:23:25 +01:00