Commit Graph

3127 Commits

Author SHA1 Message Date
Seppo Ingalsuo 75b10a1cc8 Math: Add functions to convert decibels to linear
This patch adds two functions: db2lin_fixed() and exp_fixed().
The first can convert fractional format dB values to linear within
range -100..+66 dB. The latter is a more generic fractional e^x
function. See the code comments for used Qx.y fractional formats
and limitations.

The implementation for exp(x) core function is based on first 11 terms
of Taylor series approximation for |x| < 2. The larger values of x
are computed with help of rule exp(x) = exp(x/2) * exp(x/2). It
achieves sufficient accuracy for volume control type of applications.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-06-17 21:47:31 +01:00
Seppo Ingalsuo fe4ea779b1 Fix conversion to Q1.31 in macro Q_CONVERT_FLOAT()
This patch fixes the overflow that happened with term (1 << qy)
in the macro with qy set to 31. Casting to int64_t avoids the
macro internal overflow with all fractional 32 bit formats.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-06-17 21:47:31 +01:00
Janusz Jankowski 0dd6c23814 hsw: ssp: add quirks support
Enables quirks supported by HSW.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-15 12:03:55 +02:00
Janusz Jankowski b4f2e2a964 byt: ssp: add quirks support
Enables SSP quirks supported by BYT and checks
for unsupported quirks requests.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-15 12:03:55 +02:00
Janusz Jankowski e7af08b241 kconfig: hide cavs menu if not supported
If all symbols in menu are not selectable if some
other symbol is not present, then there is no point
in showing that menu.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-13 15:32:39 +02:00
Tomasz Lauda 917e64b8c5 component: remove min_bytes argument from comp_xrun methods
Removes min_bytes argument from comp_underrun and comp_overrun
methods. With the current way of copying as much data as possible
min_bytes doesn't say anything

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-13 13:34:34 +01:00
Tomasz Lauda cc7bff9e61 component: remove checks for xruns
Removes checks for xruns in all components besides
dai. There is no need to check for underrun and
overrun in every component, because no free or avail
space in buffer doesn't mean that data is not continuous.
We can have processing modules inside the pipeline, which
work on different frame sizes than rest of the pipe. In
such cases we will detect false xrun. In the future we
can think about adding xruns checks to the components,
which will be connection points for multiple pipelines
e.g. separate pipe with the mixer in the beginning.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-13 13:34:34 +01:00
Janusz Jankowski c6e12d53d8 scripts: add documentation generator
Process of documentation building and publishing requires
3 repositories. It is troublesome for people that are responsible
f.e. only for documentation publishing. It makes the process
easier by turning some easy to break steps from publisher instructions
into a script.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-13 13:29:02 +01:00
Tomasz Lauda d84395b755 buffer: remove circular dependency
Removes circular dependency between buffer and component
header files.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-13 13:39:59 +02:00
Adrian Bonislawski 39a2b4760e kconfig: CORE_COUNT config depends on SMP
This will prevent from configuring UP with CORE_COUNT > 1

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-13 11:54:45 +02:00
Adrian Bonislawski 248956be5b kconfig: remove CORE_COUNT from apl defconfig
Default build option for APL is UP so it should use default CORE_COUNT value (1) to not waste memory

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-13 11:54:45 +02:00
Tomasz Lauda 96a544e640 boot_loader: remove deprecated comment
Removes deprecated comment from boot_loader.
Memory window is enabled by ROM even before
FW is loaded, so there is no need for usage
of additional registers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-12 15:16:39 +02:00
Janusz Jankowski 8eb6a7861d testbench: move README from doc to tools
All tools-related programs should be in tools README.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-12 12:19:45 +02:00
Janusz Jankowski 730f051d67 doc: remove duplicated README for host
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-12 12:19:45 +02:00
Tomasz Lauda 0f1158dd20 component: remove frame_bytes from comp_dev
Removes frame_bytes field from comp_dev structure.
We don't need it globally, only for dai.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-12 12:00:35 +02:00
Tomasz Lauda 54ed3528f6 dai: remove period_bytes from dai_data
Removes period_bytes from dai_data structure as
it's only needed in dai_params function. No need
to store it globally.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-12 12:00:35 +02:00
Tomasz Lauda e7fe7fc669 component: split comp_set_period_bytes method
Splits comp_set_period_bytes method to two separate
functions: comp_frame_fmt and comp_period_bytes.
Setting these two parameters in one function wasn't
intuitive nor atomic enough. Also setting value typed
variables through reference isn't pretty.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-12 09:02:00 +02:00
Adrian Bonislawski d8690a482f platform: fix compile error if PLATFORM_CORE_COUNT is 1
Structs sys_rt_x_blockXXX should not be created if not used

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-12 08:57:56 +02:00
Tomasz Lauda 72d7b7d721 host: remove not needed check
Removes not needed check from host component.
It was supposed to detect if there is not enough
avail/free data, but since we've switched to
host copy on buffer callback this check is deprecated.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-12 00:04:16 +02:00
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