Commit Graph

3387 Commits

Author SHA1 Message Date
Marcin Rajwa d465e93a70 kpb: replace draining and copy *memcpy* use with safer method
memcpy function doesn't care about "wrap-ups"
and sample sizes which are crucial in copy
of audio signals.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa e174fbddb8 detector: set default preamble time to 0
With this patch default preamble is set to zero
meaning KWD is activated from start, no delay.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa b6cea3369f detector: remove unnecessary preamble time verification
Remove unnecessary check of preamble time. Previously
it was allowing preamble time smaller than kpb buffering
time. There is no reason for such a constrain.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa 6e29114a5f kpb: add additional log message into draining task
This patch adds two new trace messages into draining
task - the amount of drained data and time needed to
drain them in milliseconds.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa 693377438c detector: remove unused notification data
Remove history_begin and history_end members from
kpb as they are not used anywhere.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa e2122e79ff topology: provide default config for new detector params
This patch provides default parameters for newly added
detect_preamble and history_depth. Both by default are
set to max buffering time of KPB.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa d83912ff24 detector: add history depth as config option
Detector was using keyphrase_length to:
1. delay detection
2. to calculate the amount of data that shall be
drained from history buffer.

This was confusing people, therefore we use two
separate variables name with better naming.

1. history_depth -> to define default draining
request. (in bytes)
2. preamble_time -> to define delay after which
detection should be active.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa 331ae7ecc1 kpb: add new, more clear states
This patch adds new state KPB_STATE_DRAINING. In this
state kpb drains data from internal history buffer to
host sink bypassig any other component. In the same
time internal buffering is turned off.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
WojciechX Wittbrodt b451b314d7 include: user: kpb: Move kpb configuration structure
Move kpb configuration structure to user header folder to expose it to users such as applications/tools.
The configuration structure is needed to create a binary blob that allows to control the component.

Signed-off-by: WojciechX Wittbrodt <wojciechx.wittbrodt@linux.intel.com>
2019-06-11 11:54:57 +01:00
WojciechX Wittbrodt 37bd20a279 include: user: selector: Move selector configuration structure
Move selector configuration structure to user header folder to expose it to users such as applications/tools.
The configuration structure is needed to create a binary blob that allows to control the component.

Signed-off-by: WojciechX Wittbrodt <wojciechx.wittbrodt@linux.intel.com>
2019-06-11 11:54:57 +01:00
Jaska Uimonen 4d956d5eee memory: implement realloc for rmalloc and rballoc
Currently we don't have atomic reallocation implemented. So make
unlocked versions of malloc and balloc, so they can be used in
single locking context with brealloc and realloc.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-06-11 11:53:01 +01:00
Janusz Jankowski 1dd7a0724b rimage: ignore sections not used by bootloader
In case of multiple modules, rimage should not expect these sections
in bootloader module: .bss, .static_log_entries .fw_ready.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 09:05:26 +02:00
Janusz Jankowski c0c858c26a cmake: install: fix new headers paths
This commit updates paths of installed headers to match
new headers folders structure.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-10 14:50:13 +02:00
Marcin Rajwa 9b70458beb pipeline: update pipeline idle task
The idle tasks scheduler new feature enable idle
tasks to reenter themselves at some later time.
Therefore pipeline tasks needs to be updated
accordingly.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-10 14:40:21 +02:00
Marcin Rajwa c44a4549d4 scheduler: enable idle task to be executed more than once
Some idle task like for example KWD draining needs
significant amount of time to finish their job.
For example, to drain whole history buffer 6 miliseconds
are needed in non-synchronied mode and as much as 2100
miliseconds in synchronized mode with period 400 frames.
Therefore it is vital to exit idle task when it itself
is in *idle* state and allow other tasks to do their
job.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-10 14:40:21 +02:00
Guennadi Liakhovetski 7347f8754a DMA: make the "channel" parameter unsigned
The DMA "channel" parameter, used in many DMA API functions, is
currently only checked for "< HDA_DMA_MAX_CHANS" except for one case,
where it's also checked for ">= 0." But if a configuration step is
missed, the channel can stay at its initial value of DMA_CHAN_INVALID
which is equal to (32-bit) -1, or it can contain a negative error
code, returned by dma_channel_get(). Therefore a comparison to
HDA_DMA_MAX_CHANS doesn't catch such cases. This leads to a panic
like in issue https://github.com/thesofproject/sof/issues/1485 To
avoid such crashes make "channel" unsigned everywhere and make checks
more consistent.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-06-10 10:29:45 +02:00
Guennadi Liakhovetski d3038f5af6 HDA: (cosmetic) fix indentation
Fix indentation in hda_link_dma_ops and hda_host_dma_ops.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-06-10 10:29:45 +02:00
Janusz Jankowski 0eb68c6d5d logger: add debugfs entries for apl and cnl
Logger was aware only of debugfs entries for BYT/HSW platforms.
This commit adds debugfs entries for APL/CNL.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-07 22:36:50 +02:00
Tomasz Lauda 71f35296cb pipeline: set preload only for playback streams
Sets preload flag only for playback streams.
Capture streams scheduled on timer no longer need
this, because new xrun handling in dai allows
for valid ppl path stop, when data is not yet
available on first timer tick.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-07 13:34:14 +01:00
Tomasz Lauda 95372a0bb0 dai: fix xrun handling
Fixes xrun handling by moving check from callback
to copy. Check in callback wasn't making any sense,
because bytes passed there have been already calculated
based on avail/free.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-07 13:34:14 +01:00
Tomasz Lauda 7546c0fdeb hda-dma: add more granular functions for status checking
Extracts more granular functions for buffer full and
buffer empty checking. It improves readability and
removes repeated code.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-07 13:33:01 +01:00
Tomasz Lauda 03181b4537 pipeline: add missing check for PPL_STATUS_PATH_STOP
Adds missing check in pipeline_comp_copy for
PPL_STATUS_PATH_STOP. It fixes the issue, where
playback pipeline hasn't been able to stop copying
even with component returning such status.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-07 13:32:27 +01:00
Tomasz Lauda cac6e44007 ssp: cavs: decrease PLATFORM_SSP_DELAY
Decreases PLATFORM_SSP_DELAY for cAVS platforms.
This delay is used after SSP start and before stop
to let frame and clock synchronize. It was very long,
so was decreased from 1/8 ms to 1/24 ms. Experiments
show that it's still enough for slave clock to synchronize
and to not lose first data sample.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-07 09:54:05 +02:00
Janusz Jankowski b755fe92b7 rimage: fix possible strcpy and sprintf overflows
It's for preventing possible buffer overflow.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-07 09:53:24 +02:00
Marcin Rajwa b33574ce65 cmocka: update kpb test case
KPB_MAX_BUFFER_SIZE has changed therefore cmocka test
which uses this macro needs to be changed accordingly.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-06 09:47:33 +01:00
Marcin Rajwa 9034b08425 kpb: update kpb defines to accept different sampling width
Kpb defines like KPB_MAX_BUFFER_SIZE were calculating
buffer size only for one, fixed sampling width. Now
defines accept a parameter "sw" sampling width.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-06 09:47:33 +01:00
Marcin Rajwa d6e326e9cd kpb: add function verifying sampling width
This new function checks if config parameter regarding sampling
width is supported by current implementation.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-06 09:47:33 +01:00
Tomasz Lauda dad0742f11 trace: add new trace points
Adds new trace points to increase granularity of
logged sequence during firmware boot.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-06 09:42:19 +03:00
Tomasz Lauda 14bf67634f init: reorder trace points sequence
Reorders trace points sequence to be incremental.
Because of many changes in init code the trace points
values stopped to be logged in incremental order.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-06 09:42:19 +03:00
Tomasz Lauda 95d9fc9042 trace: fix indentation
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-06 09:42:19 +03:00
Tomasz Lauda 6c34f6785a idc: refactor sending in blocking mode
Refactors IDC sending in blocking mode to
utilize DONE interrupt instead of manually
polling for DONE bit. It allows for removal
of spinlock, which prevented longer IDC
timeouts.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Tomasz Lauda 4d22a98f6c idc: change waiting code to be ms based
Changes waiting code in arch_idc_send_msg to be
milliseconds based instead of DSP cycles based.
This aligns nicely with the rest of waiting functions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Tomasz Lauda 8ebc054726 idc: optimize interrupt handler
Optimizes IDC interrupt handler by:
- Omitting currently used core.
- Omitting check for DONE irq on slave cores.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Tomasz Lauda ee0affb2f4 idc: add arguments to trace_idc function
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Tomasz Lauda 08d5cba3d9 idc: add missing headers
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Adrian Bonislawski 25e6cb70b9 sof: add default ALIGN macro
This will add default ALIGN macro so defines which are using ALIGN
can work in main code and linker scripts using linker definition for ALIGN

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-05 18:19:22 +02:00
Tomasz Lauda eca023476f dma-trace: align copied trace size to DMA burst size
Aligns copied trace size to DMA burst size for HD-DMA.
Previously we've copied data on the DSP side and sent
the right offset to the host, but actually if the data
wasn't aligned to the burst size, the host would read
old traces for the part of data not yet pushed to the
host.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 13:09:59 +02:00
Janusz Jankowski 5dd9aaccb4 cmake: xtensa: use absolute paths for tools
CMake has convention of changing relative paths to absolute
for CMAKE_* variables. It does it automatically f.e. CMAKE_C_COMPILER.
However for our tools like objcopy we have to do it manually.
It also helps with integration of CMake in some IDEs.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-05 11:38:23 +02:00
Liam Girdwood f0eedcbab7 abi: user: make it obvious how to use ABI header from userspace.
Add more comments describing usage of header from userspace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-06-05 10:04:39 +01:00
Liam Girdwood 1782676acf tools: ctl: dump header information from CSV and DSP data
Dump the ABI header from source CSV or DSP data. This will make it
obvious if there are any ABI differences.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-06-05 10:04:39 +01:00
Liam Girdwood 2bb9ebe20d ctl: rename sof-eqctl to sof-ctl
This tool is generic and can be used with any binary kcontrol to
send data to/from components at runtime.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-06-05 10:04:39 +01:00
Tomasz Lauda e96efc1638 sof: unify multiple ALIGN macros
Unifies multiple different align macros spread
across the source code. Now we have ALIGN_UP and
ALIGN_DOWN macros defined in sof.h.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 09:22:29 +01:00
Tomasz Lauda 5c8c804766 dai: change starting sequence
Changes starting sequence of DAI. Now IO interface is
started before DMA. The purpose of this change is to
allow slave interfaces to prepare their FIFOs before
DMA starts transferring to them.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 10:02:06 +02:00
Tomasz Lauda 5d42e0fdf0 cavs: ssp: add delay after start
Adds delay after starting SSP interface.
It allows for SSP in slave mode to nicely
synchronize with clock and frame inputs.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 10:02:06 +02:00
Tomasz Lauda 67e954668e format: add missing #include <stdint.h>
Adds missing stdint header, since we are using types
defined in that file. Right now format.h compiles
by accident.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 07:41:19 +02:00
Tomasz Lauda 10495481c9 hda-dma: remove double spaces
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-04 11:47:48 +03:00
Tomasz Lauda 14b724f021 dma-trace: fix cache handling
Fixes cache handling for dma-trace buffer.
Current implementation wasn't fully supporting
multicore traces. This patch changes buffer
writeback invalidations after buffer write to
invalidations before read and writebacks after
write. Also removes not needed cache operations
on retrieving current traces size.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-04 01:21:24 +02:00
Tomasz Lauda 1db434afe4 dma-trace: move dropped_entries to common struct
Moves static variable dropped_entries to common
dma_trace_data structure. This structure is
accessed through uncached memory region, so
all the cores don't need any additional
synchronization.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-04 01:21:24 +02:00
Tomasz Lauda bab6398b27 dma-trace: remove not needed #if CONFIG_TRACE
Removes not needed #if CONFIG_TRACE.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-04 01:21:24 +02:00
Jaska Uimonen 54012bfdca dw-dma: set ctrl_hi to zero before bit masking
dw-dma transfer size setting was changed in cleanup and because of that
we need to zero the ctrl_hi value before twiddling the bits.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-06-03 16:04:18 +02:00