Commit Graph

4398 Commits

Author SHA1 Message Date
Tomasz Lauda bce7f241d2 dai: change place of setting DAI config
Changes place of setting DAI config from IPC handler to
dai_config operation of DAI audio component. It's much
more cleaner solution in terms of error reporting
and core ownership.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-23 12:07:15 +00:00
Tomasz Lauda 672409b14b buffer: add core id to comp_buffer
Adds core id to comp_buffer structure. It allows for
easy retrieval of core on which buffer has been created.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-23 12:07:15 +00:00
Tomasz Lauda 6c84639bb3 ipc: add new fields to ipc_comp_dev
Adds new fields to ipc_comp_dev structure: core and id.
ipc_comp_dev instances are shared among cores, so the data
from here can be easily accessed by SMP code.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-23 12:07:15 +00:00
Tomasz Lauda 6bb38957cd ipc: remove unused field from ipc_comp_dev
Removes unused field state from ipc_comp_dev.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-23 12:07:15 +00:00
Tomasz Lauda e437e1cc52 cpu: add helper method cpu_is_me()
Adds helper method for checking whether current core
is the one we are looking for.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-23 12:07:15 +00:00
Marcin Rajwa d24de27a0c kpb: add comment to comp_data
This patch adds short comment to each of comp_data
fields.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa 6f83a23a03 kpb: remove unused variable
This patch removes unused variable is_internal_buffer_full

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa 80eeda47f4 kpb: move validation of host params to prepare()
This patch moves the validation of host params to
prepare() method. Therefore we can tell user right
away something is wrong with his params instead of
waiting till draining.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa 846f49eb11 kpb: check if draining speed should be controlled
This patch checks if draining should be controlled
in terms of speed. Such condition may be necessary
if host buffer is smaller than KPB's history buffer.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa a7d16d0bee kpb: rework of validate_host_params() function
This patch slightly reworks validate_host_params()
function to check how big is host buffer. If it is
big enough to store all data from history buffer we
can skip further validation.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa 8685b2cafd kpb: refactor kpb->hb_buffer_size
This patch changes name of the variable to be more
meaningful

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Marcin Rajwa 895b46771c kpb: refactor some of KPBs macros
This patch refactor KPBs macros:

KPB_SAMPLING_WIDTH to KPB_SAMPLES_PER_MS as this is
exactly what this macro stands for - the amount of
samples we take each milisecond.

KPB_NR_OF_CHANNELS to KPB_NUM_OF_CHANNELS as the later
is more meaningful

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00:00
Karol Trzcinski 45eeb1c492 pcm_converter: Use copy method from audio_stream
In HiFi implementation should be used copy methods with prefix
from audio_stream_* instead buffer_* because of removing this
functionality to audio_stream module.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-23 10:38:49 +02:00
Karol Trzcinski e9a9e87af0 audio_stream: Create wrapping function
In source code there are places where are implemented pointer
wrapping by hand, what looks quite complicated for a first eye catch
and is messy because of pointer type casting.
Using as_wrap is very well descriptive method and consist with DRY
principle.

as_get_frag has been changed to preprocessor function as it is just
moving given pointer and wrapping result.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 9508d2efbd buffer: Create audio stream buffer
When new component will need to process audio data in two steps,
then temporary circular buffer will be needed. Also extra information
about data stream may be needed to choose right algorithm or assert data
compatibility.

Currently only 'comp_buffer' has such a possibility but it is component
defined in topology - with much wider capabilities - and shouldn't be
created inside component just to hold temporary data stream.

Use introduced structure in processing functions, move api responsible
for data processing from buffer to audio_stream module.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski eaf9b051cf buffer: Introduce local variable to short function call arg list
Changed line was longer than 80 chars and refer to nested variable
twice - after changes both problems disappears.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 4e6f23c309 buffer: Remove unused alloc_size
This variable is unused in whole project.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 8324cf488f dma: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 92c6bb4087 dma: Define processing function typedef
To keep code clean and consistent create processing function
interface outside comp_data function definition to omit
duplicated definitions.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 28f8bd8df1 volume: Mark input device pointer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
input devices buffer can be changed in processing functions -
- read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 42cf9f84ef volume: Define processing function typedef
To keep code clean and consistent create processing function
interface outside comp_data function definition to omit
duplicated definitions.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 0292060f44 src: Mark input device pointer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
input devices buffer can be changed in processing functions -
- read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski da4073ce38 src: Mark input buffer input buffers with const in src_get_copy_limits
Functions like src_get_copy_limits should have const marking to
avoid error related with unintentional fields editing.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 5e080c14f5 selector: Mark input device pointer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
input devices buffer can be changed in processing functions -
- read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski f9a4506cc2 selector: Define processing function typedef
To keep code clean and consistent create processing function
interface outside comp_data function definition to omit
duplicated definitions.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 8ce262312f mixer: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 3670079b09 kpb: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski fdb3483724 detect_test: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 3e7d3f0181 DAI: Use local variable holding frame format in dai playback and capture params
In new convention there is no need to break the line in function call,
so there will be less effort after rename location of local_fmt value
in near future.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 638a11ee99 DAI: Simplify dai_dma_cb by adding temporary sink_bytes variables
This value was calculated in two calls in dma_buffer_copy_*.
While those functions has long list of arguments, introducing
new variable makes code little more readable and avoid possible
error of making some patch on calculating sink_bytes in only
one place instead of both.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 6f24c82a27 mux: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 7343445ee3 ASRC: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 417b034420 ASRC: Define processing function typedef
To keep code clean and consistent create processing function
interface outside comp_data function definition.
This solution allow in a future to use pointers to function
with compatible interface as a function arguments or return type.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski be8c48bbeb fir: Mark source buffer as const in processing functions
Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.
Moreover same thing needs to be done in *setup_circular functions
to achieve successful compilation.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Karol Trzcinski 9a091a1320 test: Use common_mocks in each unit test
Link common_mock to each test by default.
Removed duplicated mocks in component specific folders.
Keep old mocks where implementation differs from
implementation in common_moks.c

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Karol Trzcinski 816f8919db test: Implement common mocks
In unit tests there are a lot of mocks duplication for mocks related
with memory management and panic routine.
As long as implementation doesn't have any module specific routines
and may be reused, it should be mocked in common mock space.

Marked each mock as WEAK to make it possible to overwrite this
implementation in specific test.

To use assert_false in __panic function, added dependence of
universal_mock from cmock.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Karol Trzcinski b7c92f18e6 test: Rename universal_mocks.c to common_mocks.c
Old name was quite misleading, new one better describes file content

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Daniel Baluta 3fdd722ea7 platform: imx8m: Mark timer as SHARED_DATA
Timers can be shared between cores, so we need to mark
timer as SHARED_DATA in order to benefit of the newly
introduced platform_shared_commit() API.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 14:52:20 +02:00
Daniel Baluta 72d2f6c4c1 platform: imx8m: Remove unused platform_timer variable
After commit dece398b22 ("timer: add platform timer to sof context")
platform timer was added to sof context so global platform timer is
no longer used. Remove it now.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 14:52:20 +02:00
Daniel Baluta ee6449be83 platform: imx8m: Set cpu_timer in global sof context
After commit 8dcf0a7c89 ("timer: add cpu timer to sof global
context") cpu timer is also stored in sof context for later use.

Initial support for i.MX8M didn't set cpu_timer field of sof global
context, so set it now.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 14:52:20 +02:00
Daniel Baluta 3e0321f893 platform: imx8m: Use dma from sof context for domain init
Changes sequence of initialization in platform_init(),
so that DMA scheduling domain can be initialized with the DMA
taken through sof context. This allows for removal of another
externed global variable.

This is similar with commit 9c62ac56eb ("platform: use dma from sof
context for domain initialization")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 14:52:20 +02:00
Daniel Baluta 0d1344a53b scripts: Add build support for imx8m
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta b600ddb595 platform: imx8m: Initialize memap
This is similar with implementation for i.MX8/i.MX8X.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta 3724608373 platform: imx8m: Add platform drivers support
This adds minimal support for dma, dai, clk, interrupt and mailbox.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta 4dc194d6a9 imx8m: Add support for NXP i.MX8M platform
The i.MX 8M Plus family focuses on machine learning and vision,
advanced multimedia, and industrial IoT with high reliability.

This patch adds support for the low power voice accelerator:
Tensilica HiFi4 DSP @ 800 MHz.

Documentation about i.MX8MP can be found here:
https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i.mx-applications-processors/i.mx-8-processors/i.mx-8m-plus-arm-cortex-a53-machine-learning-vision-multimedia-and-industrial-iot:IMX8MPLUS

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta ea13eacae2 drivers: imx: interrupt: Add IRQSTEER address for i.MX8M platform
i.MX8M has a different IRQSTEER address. Select the correct
address base on CONFIG_ option.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta 5241050337 drivers: refactor: Make MU implementation generic
Messaging Unit can be found on all i.MX8 platforms so move
the implementation into a common place so that it can be
used by everyone.

Users need to define their own specific MU_BASE address.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Daniel Baluta 0781a4bed5 rimage: Add support for imx8m
This defines the iram/dram/sram memory zones and creates
a new machine type for i.MX8M.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-22 09:57:21 +02:00
Pierre-Louis Bossart b00869e204 topology: fix DMIC device names
DMIC01 is just useless for a user. After multiple rounds of
discussion, we agreed to remove numbers (which could be understood as
a mic position) or a frequency (which is misleading since it can be
updated to e.g. 96kHz by topology), so by default the DMIC interface
is called just that...

Conversely, we add a clear 16kHz qualifier for the low-frequency
path. While in theory the frequency can be changed with modifications
of the FIR filter, applications do need 16kHz support.

Also make sure we only use 'DMIC' for 'PCH-attached DMICs'. For
RT715-based solutions, the microphones can be analog, so use more
generic 'Microphones' description.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-01-21 16:21:26 +00:00
Tomasz Lauda 9c62ac56eb platform: use dma from sof context for domain initialization
Changes sequence of initialization in platform_init(),
so that DMA scheduling domain can be initialized with the DMA
taken through sof context. This allows for removal of another
externed global variable.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-21 16:20:07 +00:00