Commit Graph

5817 Commits

Author SHA1 Message Date
Daniel Baluta 8a8e8736a8 topology: imx8: Add memory caps for i.MX8 platforms
This adds memory capabilities macros for different buffer
types on i.MX8.

Once we started to enable more complex pipelines
on i.MX8 we found out that we need these caps defined.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-11-21 13:50:56 +00:00
Seppo Ingalsuo da9e0d3c41 Tools: Tune: Add tool for DMIC FIR filters setup
This patch adds the the Matlab script dmic_init() that simulates
initialization of the Intel PDM digital microphones decimation
block. The tool computes the needed FIR filters and exports
them as C header files. The script dmic_batch computes all the
currently used decimation settings.

The generated header files from subdirectory include need to be
manually copied to src/include/sof/audio/coefficients/pdm_decim/
and the header file pdm_decim_table.h edited manually if the
header file names were changed due to different filter characteristic
(band frequencies, stop-band attenuation).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-11-20 11:42:24 +00:00
Marcin Rajwa cfe75333b4 codec_adepter: fix for memory list initialization
This patch moves memory list initialization from .prepare() to .init()
as we need that memory list be already initialized on codec
initialization otherwise we will lose track of memory allocated
prior to .prepare()

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-19 21:29:36 +00:00
Curtis Malainey c35b8875c2 kpb: fix logic bug
Storing the address of a know existing address space will always result
to be true. Therefore this variable is actually doing nothing. Remove
reference to fix this.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-18 12:07:56 +00:00
Jaska Uimonen 6f0829b2a6 scripts: remove restriction for tgl rimage signing
Currently xtensa-build-all.sh has restriction to use rimage for tgl
signing, because rimage didn't support tgl. As rimage now has support
for tgl signing let's remove this limitation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-11-18 12:07:23 +00:00
Guennadi Liakhovetski 926fe34d95 compile: fix 64-bit compilation warnings
The compiler issues warnings when converting 64-bit pointers to 32-bit
integers. Use uintptr_t instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Guennadi Liakhovetski a91219eb79 zephyr: remove infinite recursion on Broadwell
Broadwell support with Zephyr had only been dry-coded, it has never
been tested, and it contains an infinite recursion bug: functions
platform_timer_get() and arch_timer_get_system() call each other
infinitely. Break the recursion formally, until a proper fix is
available.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Guennadi Liakhovetski 375a46d176 zephyr: only build trace support if enabled in the configuration
Files under src/trace should only be built if CONFIG_TRACE is selected
in configuration.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Guennadi Liakhovetski 5204a29e2f dai: add a missing header
dai.h defines types with fields of type struct list_item so it must
include list.h.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Guennadi Liakhovetski 143af6d832 compile: add missing headers
using irq_local_enable() and irq_local_disable() requires including
interrupt.h

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Guennadi Liakhovetski 7659186571 xtensa: make multi-core configuration options available globally
Number of processing cores is a global parameter, it doesn't have to
reside in an xtensa-specific configuration menu.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-18 11:37:37 +00:00
Fred Oh 2dcb2ebe1d topology: cnl-nocodec: update data format in comment
Updated s24le data format in comment to match with actual value.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2020-11-18 11:10:04 +00:00
Fred Oh ceabe95d6b topology: icl-nocodec: enable more SSP and DMIC pipelines
Previously sof-icl-nocodec topology only enabled SSP0. To effectively test
more test cases, this enables more playback and capture pipelines with
SSP1, SSP2 and DMIC3.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2020-11-18 11:10:04 +00:00
Ranjani Sridharan f0d491a4ab ssp/dai: Dont treat dai_config during active audio as an error
When a DAI_CONFIG IPC is sent from the driver for a particular
DAI type and index, all DAI components that match the type and index
are configured. When all components are set up during topology
loading, this isn't really much of a problem as all DAI_CONFIG
IPCs will be sent at that time as well ie there is no active
playback/capture. But with dynamic pipeline loading, the playback
and capture DAIs will be individually configured whenever the
respective pipeline is started. This will end up with errors both
when configuring the SSP and when configuring the DAI comp itself.

So, ignore the request to configure the SSP and the DAI comp
that is already active so that the other DAI comp can be
configured successfully when its pipeline is set up.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2020-11-18 11:08:59 +00:00
Ryan Lee e7a339bd4c smart amp: memory reset after allocation
Added memset by zero after memory allocation.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Ryan Lee 1b89167f51 smart amp: added forced parameter function
Read whole DSM parameters including non-volatile parameters
from DSM component instead of reading cache.
The function is added for the diagnostic purpose.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Ryan Lee f0b2017fc7 smart amp: parameter restoration after DSM re-init
DSM is re-initialized when the format is changed.
DSM parameters loaded from the blob before re-init
is not safe for the re-init process
Parameter re-configuration is necessary after re-init.
'maxim_dsm_restore_param' was added for this purpose.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Ryan Lee 4a27e4628d smart amp: support dynamic bit-depth conversion
Support dynamic bit deptch conversion on runtime.
Re-initialize DSM if the frame_fmt is changed.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Ryan Lee ce9db8ef60 smart amp: Changed buffer size for 32bit processing
Changed buffer size from 16bit to 32bit
Removed 32bit <-> 16bit conversion code.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Ryan Lee 5fe1a6a51f smart amp: replaced variable x and y by idx and channel respectively
Changed variable x to idx and variable y to ch because x and y are
not good name for an iterator.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
2020-11-17 16:05:29 +00:00
Curtis Malainey 0aa92d8963 mixer: delete unused function
This function isn't called anywhere, time to do some cleaning

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-16 08:10:55 -08:00
Daniel Baluta 8354454b4d platform: imx: Fix PLATFORM_DCACHE_ALIGN
At this point PLATFORM_DCACHE_ALIGN is equal with DCACHE_LINE_SIZE
which on i.MX boards is 128.

Functions like rmalloc and rzalloc are allocating memory aligned at
PLATFORM_DCACHE_ALIGN bytes. This means that blocks under 128 bytes
are not really used and blocks sized > 128 are preffered for small
allocations.

This seems to be an unnecessary overhead which results in SOF not
being abel to allocate memory for simple pipelines (e.g simple
pipeline with a mixer).

For this reason, we set PLATFORM_DCACHE_ALIGN to a smaller value
(sizeof(void*)) but keep HEAP_BUF_ALIGNMENT unchanged.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-11-16 11:59:11 +00:00
Andy Ross 23d1dc005a schedule/timer_domain: Correct Zephyr driver check
The comment implies that it's looking for what Zephyr knows as the
"cavs_timer" driver, but the test was specifying an old (and AFAICT
SOF-specific?) kconfig.  Use the one that corresponds to the actual
driver selection.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-11-16 11:23:50 +00:00
Andy Ross 2664fc30fb zephyr/wrapper: Disable check for CONFIG_SYS_HEAP_ALIGNED_ALLOC
This kconfig variable no longer exists in upstream Zephyr (the feature
it used to control is now zero-overhead and always enabled).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-11-16 11:23:50 +00:00
Andy Ross e1cf7f57c9 include/sof/common.h: Fix collisions with Zephyr symbols
IS_ENABLED and ARRAY_SIZE exist in effectively identical forms in the
Zephyr headers already.  Disable the SOF definitions when building
with Zephyr to avoid the macro redefinition collision.  Likewise
__unused gets defined twice.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-11-16 11:23:50 +00:00
Curtis Malainey 221189d3f7 trace: enforce mailbox size
If we are fuzzing we can get the trace system into a state where it
tries flush dma and overshoot the mailbox boundary.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-16 11:12:58 +00:00
Keyon Jie 60dfaa7ee3 ssp: refine the RX FIFO flushing logic
The SSSR_BSY is not necessary for flushing, we need to read out entries
every time the FIFO is not empty. This flushing may need take place
several rounds, and we need to wait 1 sample time between 2 flushing
rounds.

Fixes #3525

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-11-16 11:05:53 +00:00
Keyon Jie 322839449d clk: add helper to get sample ticks for a specific sample rate
Add helper clock_ticks_per_sample() to calculate and return the clock ticks
for a specific sample rate.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-11-16 11:05:53 +00:00
Curtis Malainey 324681ec62 kpb: fix logging cast issue
We cannot assume the build will always be 32bits, therefore when casting
an int to a ptr use uintptr_t

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-11 15:48:05 +00:00
Curtis Malainey 4eb262ae0f dai: include interrupt header
We are using interrupts here, lets include the header so we don't hit
build failures.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-11 15:48:05 +00:00
Curtis Malainey 731090510f library: add missing header
We are using int types in this header, we need inttypes.h otherwise
sometimes we fail to build.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-11 15:48:05 +00:00
Curtis Malainey 522ce1526b pcm_converter: fix type mismatch
the extern and the actual variable should have the same types

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-11 15:48:05 +00:00
Keyon Jie 50b7b3bc06 tools/README: update comment for testbench building
The host-build-all.sh is deprecated, update to the recommended
'rebuild-testbench.sh'.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-11-11 14:16:19 +08:00
Pin-chih Lin 984e02ef09 sof: drc: Implement s24 and s32 sample format cases
Implemented s24 and s32 sample format cases of both pass and default
functions.

Because both s24 and s32 cases use 32-bit samples for source/sink stream
while s16 case uses 16-bit, for pre_delay_buffers, it followed as well
(32-bit for s24/s32, 16-bit for s16). One special note is that we <<8 when
storing samples from source to pre_delay_buffers, and >>8 when loading from
pre_delay_buffers. It makes 32-bit samples in pre_delay_buffers are always
Q1.31 in both s24 and s32 cases.

In common functions (e.g. drc_compress_output), sample byte information is
required to pass if the function has the operation of pre_delay_buffers, to
distinguish 16-bit and 32-bit sample cases.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-11-10 18:38:57 -08:00
Pin-chih Lin 8a70f62846 sof: drc: component implemented by fixed-point calculations
In drc_generic.c and drc_math_generic.c, all floating-point math functions
are removed, and all float vaiables are replaced by fixed-point (int32_t)
variables with the appropriate precisions. It is verified that the
fixed-point replacement only lead to quite insignificant MSE errors among
all test patterns.

 - Multiplications are replaced by Q_MULTSR_32X32 with the appropriate
   precisions.

 - Divisions (x/y) are replaced by Q_MULTSR_32X32(x, inv(y)), where inv(y)
   is approximated 1/y by polynomial functions generated by fpminimax of
   Sollya with rexp optimization.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-11-10 18:38:57 -08:00
Pin-chih Lin 91998d7d01 sof: drc: Use one_over_attack_frames in replace of attack_frames
Replaced the config coefficient "attack_frames" by "one_over_attack_frames"
(=1/attack_frames). It is because only "one_over_attack_frames" is used by
firmware and it could save a division operand by the replacement.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-11-10 18:38:57 -08:00
Pin-chih Lin 03b1fba732 sof: drc: More fixed-point approximative functions
Implemented the following fixed-point functions for the approximation of
math calculations in drc_math_generic.c. fpminimax of Sollya is used for
generating a good polynomial approximation of wanted functions.

logf(x)
 - Input is Q6.26: max 32.0
 - Output range ~ (-inf, 3.4657); regulated to Q6.26: (-32.0, 32.0)

linear_to_decibels(x)
 - Input is Q6.26: max 32.0
 - Output range ~ (-inf, 30.1030); regulated to Q11.21: (-1024.0, 1024.0)

asinf(x)
 - Use two-step polynomial approximation among [0, 1] whose pivot point is
   1/sqrt(2)
 - Input is Q2.30: (-2.0, 2.0)
 - Output range: [-1.0, 1.0]; regulated to Q2.30: (-2.0, 2.0)

powf(x, y)
 - Input x is Q6.26: (-32.0, 32.0); y is Q2.30: (-2.0, 2.0)
 - Output is Q12.20: max 2048.0

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-11-10 18:38:57 -08:00
Curtis Malainey 9b5ba31938 dma-trace: free buffer on error
We are leaking memory if the host sends bad messages to the firmware
since we are not freeing the buffer.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-11-09 22:20:45 +00:00
Bartosz Kokoszko 85986e1f4f demux: add demux_prepare_active_look_up() function
This commit adds demux_prepare_active_look_up()
function. It contains channel parameter checking.
Look up table should not include elements referring
to channels higher than those actually set in
source/sink buffers.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-11-09 22:19:08 +00:00
Bartosz Kokoszko acc022b4c4 mux: add channels check in mux_prepare_active_look_up()
This commit adds channel parameter checking in
mux_prepare_active_look_up() function. Look up
table should not include elements referring to
channels higher than those actually set in
source/sink buffers.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-11-09 22:19:08 +00:00
Bartosz Kokoszko 473d8894f0 mux: change prepare_active_look_up() function name
This commit changes prepare_active_look_up() function
name to be mux specific.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-11-09 22:19:08 +00:00
Marcin Rajwa a6a11d8e65 topology: add C_CONTROL to codec processing topology
This patch extends codec processing topology with C_CONTROLS
which comprises of SETUP configuration for both SoF component
and CADENCE codec.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa aacbe98768 topology: add simple topology with codec processing
This patch adds a processing topology which uses external
codec for processing. This topology comprises of:

HOST -> CODEC_ADAPTER -> DAI

So the only processing component is codec_adapter which can be
configured to work with any codec.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa 09dadff771 topology: add codec_adapter component
This patch adds codec_adapter component in the topology
of SoF.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa af78d51912 codec_adapter: call middle layer interfaces
This patch calls middle layer interfaces to perform
codec specific operations.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa f5f097a715 codec_adapter: export cadence specific functions
This exports cadence interfaces for the middle layer.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa bb9254fd27 codec_adapter: add cadence codecs support
This implements ops for cadence codecs.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa 9da98fdc7f codec_adapter: cadence: add header files
This adds header files for codecs working with CADENCE
API.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa 02e7da03ac codec_adapter: add mapping function for codecs
This implements a middle layer between the SoF component
codec_adapter and specific codec. For example, the SoF component
may receive a prepare request from the driver, so it prepares itself
(assigns sink/source buffers, check states, etc) and then calls this
middle layer which proceed with codec specific preparation. The exact
same scenario happens for any other interface as well.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00
Marcin Rajwa 969d008f78 component: add "codec adapter" component
This introduces new SoF component called "codec adapter".
It provides means to process samples through external codec
libraries. This part implements only the SoF component.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-11-09 22:14:38 +00:00