Commit Graph

3345 Commits

Author SHA1 Message Date
Marcin Rajwa afbb2a6f53 memcpy: fix bug in memcpy_s for cmocka
memcpy_s has wrong check condition for
overlapping sections. The copy from adjacent memory
bloks will result in dsp panic while it should be
allowed. This patch fixes the issue for cmocka
tests.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-18 23:16:21 +02:00
Marcin Rajwa c357561ec9 memcpy: fix bug in arch_memcpy_s for xtensa arch
arch_memcpy_s has wrong check condition for
overlapping sections. The copy from adjacent memory
bloks will result in dsp panic while it should be
allowed. This patch fixes the issue for xtensa
architecture.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-18 23:16:21 +02:00
Marcin Rajwa 25c50fd443 memcpy: fix bug in arch_memcpy_s for host arch
arch_memcpy_s has wrong check condition for
overlapping sections. The copy from adjacent memory
bloks will result in dsp panic while it should be
allowed. This patch fixes the issue for host
architecture.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-18 23:16:21 +02:00
Marcin Rajwa e9b8c94879 kpb: fix wrong trace message
Correct trace message in kpb_clear_history_buffer().

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-18 23:16:21 +02:00
Adrian Bonislawski f8aa67ef81 memory: reorder heap defines to match order from SUE memory layout
This will make easier to analyse heaps in memory.h

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski c8e957c0dd memory: reorder heap defines to match order from CNL memory layout
This will make easier to analyse heaps in memory.h

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski a71aed4210 memory: reorder heap defines to match order from ICL memory layout
This will make easier to analyse heaps in memory.h

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski 93c592cc89 memory: reorder heap defines to match order from APL memory layout
This will make easier to analyse heaps in memory.h

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski 936ad1a06e memory: remove unnecessary HEAP BASE define for ICL
This define is not used anymore

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski 781f003466 memory: remove unnecessary HEAP BASE defines for APL
This defines are not used anymore

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 16:11:07 +01:00
Adrian Bonislawski b8e27e6c3e memory: make buffers aligned to HEAP_BUF_ALIGNMENT in SUE
It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 15:45:56 +01:00
Adrian Bonislawski 1fb7c87103 memory: make buffers aligned to HEAP_BUF_ALIGNMENT in ICL
It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 15:45:56 +01:00
Adrian Bonislawski 2741645f11 memory: make buffers aligned to HEAP_BUF_ALIGNMENT in CNL
It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 15:45:56 +01:00
Adrian Bonislawski b0f7059800 memory: add static assert for heap_buf_alignment value
This will check if heap buffers alignment is valid

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 15:45:56 +01:00
Adrian Bonislawski 7ca0f3f6b3 memory: add heap_buf_alignment define for cavs platforms
This value will determine alignment for heap buffers

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 15:45:56 +01:00
Adrian Bonislawski cc22442d38 dma: add missing error handling in dma_trace_start
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-18 10:33:59 +02:00
Seppo Ingalsuo c328dd85f6 DMIC: Add support for passing unmute ramp time from topology
The raw capture from digital microphones contain some DC signal
in the beginning. The DC compensation filter is set to be quite slow
to enable capturing lowest audio frequencies. The unmute gain ramp
is used in DMIC driver to conceal the DC signal. The required time
for clean looking start is is microphone model and platform dependent.
Also since not all applications are sensitive to DC waveform it is useful
to specify the ramp length in topology.

This patch adds to DMIC driver feature to define the unmute ramp
length in milliseconds. If the value from IPC is zero the existing
hard coded 400 ms long ramp is used. If the value is non-zero and
within min/max 10ms/1000ms limits the topology defined ramp length is
used.

The code uses the db2lin_fixed() function to convert the dB step
to a linear gain update coefficient. Also the hardcoded ramp definition
is simplified to use dB initial gain value and length in milliseconds
instead of magic looking numbers.

This patch also contains ABI minor version increase to 8.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-06-17 21:47:31 +01:00
Seppo Ingalsuo 909b790235 Topology: Add SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS token
This patch adds to all DMIC related topologies the new token
SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS. The value is set to 400
to correspond to 400 milliseconds long unmute ramp time. The
topology defined unmute will override the firmware internal
hard coded value if it is set in topology.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-06-17 21:47:31 +01:00
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