Commit Graph

3108 Commits

Author SHA1 Message Date
Tomasz Lauda 347ee08cb0 hda-dma: change preload from blocking to repeating
Changes preload flow for host component using HDA-DMA.
Instead of waiting for DMA status for a limited amount
of time, it's better to just reschedule the pipeline
and check again. At least this time if the status
won't be set, we will know it's rather HW issue than
too small delay.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-11 22:14:06 +01:00
Seppo Ingalsuo 6f65414176 Volume: Use min and max volume scale values from IPC
This patch adds feature to retrieve volume scale min and max from
IPC if the parameters are set. Volume min and max are now used
with ramp time parameter to compute gain ramp step to achieve
constant rate ramps with any volume scale. If the min and max are
zeros the previous FW operation is preserved.

Previously the firmware did not know the volume range so the
volume code uses in volume request a check to prevent exceeding
ramp length specified in topology by step size re-adjust. It was
done to prevent very long ramps to happen with volume scales with
large gain. However the smaller transitions remained longer than
necessary. This patch fixes that last remaining issue.

The ramp length check code is preserved to be compatible with
kernel versions those do not provide the min and max volume scale
values. When provided the check code has no impact.

The patch includes some cosmetic re-arranging of volume comp data
struct fields in addition to adding new the fields vol_ramp_range,
vol_min, and vol_max.

Also error traces were added to notify if the volume min/max or
request has been limited to fit to supported volume range.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-06-11 22:35:34 +02:00
Janusz Jankowski a2fa79f211 cmake: dw: use feature configs in ifs
It is better to include features based on feature Kconfig symbols,
instead of hardcoding them per platform.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Janusz Jankowski def3e2de5d drivers: group DW configs in one Kconfig file
It is better to have company/family related features grouped.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Janusz Jankowski c71a45e718 kconfig: icelake: fix help indent
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Janusz Jankowski fed2b72df6 kconfig: platform: add INTEL config
Add INTEL config to be able to build Intel drivers only for Intel platform.
CMake should go into intel folder if it's requested explicitly.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Janusz Jankowski ea909bd17b cmake: drivers: add DW config
DW folder shouldn't be included by default.
Designware features should be enabled explicitly.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Janusz Jankowski aab739ec29 cmake: drivers: fix indentation
CMake supports indenting, so we should use it.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-11 15:31:18 +02:00
Tomasz Lauda 7d8d44da05 hda-dma: remove not needed check
Removes not needed check for DMA_CB_STATUS_END
in hda_dma_post_copy. HD-DMA is not driven using
interrupts, so there is no need to asynchronously
stop the transfer.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-11 14:01:24 +02:00
Tomasz Lauda 7e357d14a0 dma: refactor callback data
Refactors DMA callback data by using dedicated
callback struct along with callback status enum.
Previously field size was used to pass status
from component to DMA, which was misleading
and could cause potential issues e.g. value
0 was a valid number of bytes, but it was
also a value for DMA_RELOAD_END definition.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-11 14:01:24 +02:00
Adrian Bonislawski f1fe78367a memory: new memory layout for APL, ICL, CNL and SUE
This will optimize memory usage and introduces two significant optimizations:

> Separate the memory (heaps, stack) by cores so if we will turn off a specific core we can also turn off all memory of this core.
> Remove fixed defines and gaps, previously stack was at fixed position: end of memory and buffer heap was everything between stack and fw. Now everything will be packed at sof_fw memory segment and takes only this memory which is really needed, everything else we can turn off.

Changelog:
BSS section now includes heaps and stack
Removed many heap fixed position defines
Removed gap before fw text section
memmap init is using real linker positions for heaps
Temporary stack for boot_ldr placed in heap_hp_buffer (safe)
sof fw max_size and segment limited to memory configured by memory banks count

Using new macro to stack init per core
Stack is no longer a one big block for all cores (core_count*stack_size)
System_runtime_heap and system_heap are no longer a one big block for all cores

For suecreek memory it will also introduce similar changes previously introduced
in other platforms
(One shared memory block SOF_FW for SOF_TEXT, SOF_DATA and SOF_BSS sections
Moved fw_ready near to .rodata and .data)

Memory layout for every slave core aligned to hw memory bank:
--align to memory bank--
system_heap
system_runtime_heap
stack
--align to memory bank--
next slave core..

Similar layout applies to master core

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski d082758cbc stack: new macro to setup stack per core
This will add new macro to setup stack with a new memory layout when memory is separated by core

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski f9eb86c354 alloc: use linker heap position in sanity check
This will replace a fixed position define with a real linker position, which allows to set heap position by linker

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski 2962e2bfaa linker: fix for symbol overwrite in imx8 linker
It will fix symbol overwriting, _system_heap_start was already used in system_heap section

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski 106ea58d7d linker: fix for symbol overwrite in hsw linker
It will fix symbol overwriting, _system_heap_start was already used in system_heap section

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski 735d9e9fb8 linker: fix for symbol overwrite in byt linker
It will fix symbol overwriting _system_heap_start was already used in system_heap section

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Adrian Bonislawski f07fabe12e memory: use linker stack position in boot entry
This will allow to use real stack position instead of a fixed define

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Marcin Rajwa fb111cdebe cmocka: update KPB tests for new dependencies
KPB source code started to use timer related features
therefore cmocka tests need to include these
dependencies.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa bea5ab3784 platform: include clk.h in platform.h for imx8 target.
The CLK_CPU macro is undefined for imx8 platform therefore
shall be added.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa 0b77e12395 kpb: remove redundant pause of selector in kpb_init_draining()
After detection of keyword we shall stop further copy to selector
pipeline. We do this in regular copy() function so there is no need
to do it also in init_draining() function.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa 6eca8c98c9 kpb: rename sinks to be more understandable
Kpb rt_sink is confusing and was replaced with
sel_sink which stands for selector sink - the component
to which KPB copies during BUFFERING state. Likewise
the cli_sink was replaced to host_sink clearly stating
that we copy out of DSP.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
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