Commit Graph

2895 Commits

Author SHA1 Message Date
Karol Trzcinski dca94d5da8 kconfig: volume: selective build by CONFIG_FORMAT
Include in footprint only support for selected
data formats. It may make footprint lighter.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 33d11ad659 kconfig: volume: group functions by supported data type
It will be helpful during next step - conditional code
compilation depending on configuration

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 4f66db1ca6 kconfig: src: selective build by CONFIG_FORMAT
Include in footprint only support for selected
data formats. It may make footprint lighter.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 6a80a46ce0 kconfig: iir: selective build by CONFIG_FORMAT
Include in footprint only code needed to support selected
data formats. It may make footprint lighter.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski a64bdddc81 kconfig: iir: group function pointer in arrays by data type
It will be helpful in next step - selective compilation.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 724617f282 kconfig: fir: selective build by CONFIG_FORMAT
Include in footprint only support for selected
data formats. It may make footprint lighter.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 8e6661dc63 kconfig: fir: group functions by supported data type
It will be helpful in next step -
- selective function compilation by
supported data type

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 85088ff193 kconfig: selector: selective code compilation according to data type
Compile support only for data types selected in configuration.
It may make footprint smaller.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski c5d7ecb2e2 kconfig: selector: group functions and callbacks by supported data type
It will be helpful in next step - conditional code compilation
according to configuration

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 0549c274e4 kconfig: mux: add selective data format compilation
Use introduced configuration option in mux component to make
firmware footprint smaller.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 2da5689bdf kconfig: mux: group functions by supported data type
It will be helpful during next step - conditional code
compilation depending on configuration

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 3d60d936ce kconfig: add supported data format menu in Kconfig
It will be used to make footprint smaller by selective
compilation of supported data format in components

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Bartosz Kokoszko 6a0cf6740f dmic: change spin_lock to spin_try_lock in dmic_work()
In order to avoid dead locks in dmic_work I've replaced
spin_lock() with spin_try_lock(). In case when
spin_try_lock() fails we reschedule dmic work.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-11 12:00:10 +00:00
Bartosz Kokoszko b03e15a765 spinlock: add return value to spin_try_lock macro
Adds return to spin_try_lock() in order to retrieve status
from arch_try_lock() function.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-11 12:00:10 +00:00
Bartosz Kokoszko 6071fb8dbf dmic: add missing schedule_task_cancel() in dmic_stop()
After trigger stop we should cancel dmic task
from low latency scheduler.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-11 12:00:10 +00:00
Jerome Laclavere fb068e6a7a drivers: imx: SAI : don't generate clocks in slave mode
The test determinating the current SAI mode (M/S) was buggy.
As a consequence SAI generated bit clock and FS clock when the codec was
in master mode (which is the default configuration for SAI currently with
SOF). This bug didn't prevent the DAI to function and to have good sound.

Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-08 16:42:23 +02:00
Marcin Maka de22810b0f pm: cavs: add lps flow
Use of low power sequencer lowers power consumption, since
DSP may be completely turned off when calling waiti and then
powered on interrupt, booting via restore vector installed in
lpsram.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-08 14:37:29 +01:00
Daniel Baluta b37ed9049d include: ipc: Update comment for type field of sof_ipc_comp_process
We need this in order to match the exact comment from the
similar file in the Linux kernel.

sof_ipc_effect_type was the old name of the component no longer
used now.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-08 13:21:11 +02:00
Paul Olaru 87f9a659bf platform: hsw: Do not call dai_probe() after dai_get()
dai_probe() is already called from within dai_get().

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-08 13:19:49 +02:00
Paul Olaru 7a0ee17f77 platform: byt: cht: Do not call dai_probe() after dai_get()
dai_probe() is already called within dai_get().

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-08 13:19:49 +02:00
Paul Olaru 73a70eddac platform: imx: Do not perform early get/init of the DAI
It isn't necessary to do a dai_get this early for the ESAI; the SAI
doesn't even have one.

Calling dai_probe() after dai_get() is pointless since dai_probe() was
already called from a previous dai_get() with CREAT flag (in particular
the one which incremented sref from 0 to 1).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-08 13:19:49 +02:00
Janusz Jankowski a366d378ba arch: xtensa: use optimization configs
Use optimization configs that come from Kconfig in CMake
to set appropriate compiler flags.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-08 10:28:21 +01:00
Guido Roncarolo fde7781a42 ipc: Introduce SAI IPC parameters definition
SAI is one of the DAIs found on i.MX8 platforms. Introduce
sai_params used to pass configuration from topology via AP to DSP.

Only MCLK and TDM related params for now.

Because this is a new struct, increment only ABI MINOR version
which makes the SOF FW backward compatible with older kernel
versions.

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-06 17:25:00 +02:00
Guido Roncarolo 8c1549e0fc topology: Add SAI tokens
Only add SAI MCLK ID token for now

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-06 17:25:00 +02:00
Karol Trzcinski 6984e86b15 trace: Repair mux tracev argument name typo
To repair tracev_mux_with_ids macro.
Because with current macro definition
and enabled CONFIG_TRACEV macro code won't compile.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-06 16:30:37 +02:00
Pan Xiuli 77918e1e89 audio: src: fix void pointer arithmetic in HIFI2
Fix issue with void pointer arithmetic for BYT/CHT
on xcc build with hifi2.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-06 14:43:00 +02:00
Pan Xiuli 5eb668cc52 lib: alloc: fix block_map uninitialized warning
Fix build warning as error:
error: 'block_map' may be used uninitialized in this function

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-06 14:43:00 +02:00
Marcin Maka b5c8f83c48 platform: cavs: use pm-runtime api to power gate dsp cores
Power control hw programming should go through the pm_runtime
interface. It provides more granular control over the power
gating of each single dsp core.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 22:30:14 +00:00
Marcin Maka 14dcd128bd pm-runtime: cavs: add power gating control for dsp cores
get() operation called for dsp core resource disables
power gating of that core so it is locked in d0 state.
This is a default power state when the core is running.

put() operation enables power gating of the core, so
that the core goes to d3 every time it enters idle
(waiti is called and there is no interrupt to handle).
This handler should be called before the waiti is called
if pm-runtime for the core is enabled (see pm_runtime_enable()).

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 22:30:14 +00:00
Marcin Maka 9b6ad970af platform: cavs: make windows clear on init optional
There might be other flows defined in future, that would
need to reprogram hw registers only while preserving
the content of memory windows.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 22:07:31 +01:00
Marcin Maka e5d8a5c933 arch: xtensa: add getters for special registers
Access to vecbase, excsave2/3/4/5 is required for saving
the dsp core context while internal d0/d3 transitions
initiated by the low power sequencer.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 17:41:45 +01:00
Karol Trzcinski e59374e0fc buffer: trace: remove void pointer arithmetic
remove void pointer arithmetic in comp_update_buffer_produce function

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Karol Trzcinski acddb9ac1b trace: use UNUSED for disabled traces
This will prevent from compiler warnings when
local variables are used only in trace log and
trace is disabled.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Karol Trzcinski e9e19136c1 meta: introduced UNUSED macro
UNUSED macro should prevent compiler from throwing warnings
about unused wariables during conditional builds.
Usable for example in trace logs.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Karol Trzcinski 0282941d94 trace: Swap definition order in trace_
It Is done to achieve consistent trace definition order in project.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Karol Trzcinski 408433d32e trace: Avoid duplication of trace_ definitions
It was needed to define empty implementation of error and verbose
macros in two places what is not compliant with DRY methodology.
It is done by moving trace defs around, outside #if CONFIG_TRACE block.
After changes it is defined in only one place.
Also trace_*_comp should be defined once bacause it may be
independent from CONFIG_TRACE values.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Karol Trzcinski edc81c521f trace: remove trace_value
Because those functions was hardly used in source code.
Moreover it is better practise to add short trace
description, at least variable name instead of trace
with only variable value.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-05 16:21:09 +00:00
Marcin Maka 5e6ceb0829 ipc: cavs: read set d0ix request directly from ipc registers
cavs specific set d0ix message is read directly from ipc
registers and does not use mailbox located in SRAM which is
the only safe way to send a message to the cAVS DSP when
the DSP is in a lower power state.

The message is translated to SOF_IPC_PM_PWR_GATING message.

Response always use the mailbox since there is no way to write
the *T registers back with the current bi-directional communication
implemented using a single *T register set.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 15:31:53 +00:00
Marcin Maka bc0cbe2a27 ipc: add pm power gating message
A new message that may be used by the driver to configure
power gating and clock gating using platform specific method.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-05 15:31:53 +00:00
Tomasz Lauda 0b7fd030b3 demux: return config on COMP_CMD_GET_DATA
Returns current config on COMP_CMD_GET_DATA. It fixes the problem
with wrong demux configuration after suspend. Kernel doesn't cache
initial kcontrol config and overwrites it with configuration returned
from component.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-04 17:01:05 +00:00
Paul Olaru 5c7a49af38 sof: build: Disallow void pointer arithmetic
Add compiler flags so that void pointer arithmetic is not allowed.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-04 15:26:20 +01:00
Paul Olaru 8e16ced80c platform: imx: Fix NUM_CLOCKS being too small
Since SOF requires CLK_SSP to be defined and the SSP clock should be
separate from the actual CPU clock increasing the array size to 2 should
fix it.

This is a hack because i.MX doesn't actually have a SSP clock but SOF
unconditionally uses CLK_SSP macro.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-04 14:12:20 +01:00
Paul Olaru e5fe2ca270 sof: components: dai: Only get the handshake for DAIs which require it
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-02 11:34:35 +02:00
Paul Olaru 18e7c88b1e drivers: imx: sai: Select correct EDMA channel number
The SAI doesn't use channel 0, but channels 14 and 15. The handshake
contains the correct channel number.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-02 11:34:35 +02:00
Karol Trzcinski ccff986795 trace: Add pipeline id to src traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 70b85f5ec4 trace: Add pipeline id to selector traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski f6304f5154 trace: Add pipeline id to tone traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski a9c3c9a489 trace: Build switch traces macro
Old switch macro traces didn't have VA_ARG arguments.
It will be helpful during debugging components
to see correlated pipeline id after using with_ids macros.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 21d3ece9ac trace: Add pipeline id to kpb traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 5300ab42f2 trace: Add pipeline id to component traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 3df1d5b978 trace: Add pipeline id to keyword traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski fea2b7e491 trace: Reformat trace_dai macro
Trace verbose and trace error macros positions
is swapped to be more consistent with rest of files

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 92d63e2bb3 trace: Add missed pipeline id to dai traces
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski bf7f74f289 trace: Add pipeline id to mux traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski ac5d174025 trace: Add pipeline id to eq_iir traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 643b9ade00 trace: Add pipeline id to eq_fir traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski cdfa9d78ad trace: Add pipeline id to mixer traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 7de934a7e7 trace: Add pipeline id to volume traces
It will be helpful during debugging components
to see correlated pipeline id.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski a213fb94a1 trace: Resolve unused variable warning
During compilation as library there was unused id_0
and id_1 in _log_message preprocessor function.
Solved by casting parameters to void type.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Karol Trzcinski 7a60f7cd91 trace: Create trace macros _comp family
It makes trace macros in component space much shorter
and simpler so trace module will be more reliable.
Thanks to usage one preprocessor macro in each type of
_comp traces, code is more flexible and consistent.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-01 10:16:17 +01:00
Bartosz Kokoszko 010f60184c dma: remove spinlock_init() in dw_dma_probe()
Remove spinlock_init() in dw_dma_probe() function
in order to avoid memory leaks. spinlock_init() is
invoked in dmac_init() platform/*/lib/dma.c
files.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-01 10:04:04 +01:00
Tomasz Lauda fe321d65f8 host: dai: handle dma buffer in cache functions
Adds missing writebacks and invalidations of DMA buffer in
host and dai components.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-31 18:34:32 +01:00
Paul Olaru e2e3ed3fd8 sof: spinlock: Fix trace_lock_value macro
_trace_error_atomic doesn't exist, so this commit replaces it with
what was probably intended in the first place.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-31 09:06:31 +01:00
Paul Olaru f3163c958a sof: spinlock: Fix several compile errors related to spinlock debug
src/include/sof/schedule/ll_schedule_domain.h: In function 'domain_init':
src/include/sof/spinlock.h:87:9: error: 'domain->lock' is a pointer; did you mean to use '->'?
   (lock)->user = __LINE__; \
         ^~
src/include/sof/schedule/ll_schedule_domain.h:71:2: note: in expansion of macro 'spinlock_init'
  spinlock_init(&domain->lock);
  ^~~~~~~~~~~~~

Plus specific errors related to the platform, like:

src/platform/imx8/lib/dma.c: In function 'edma_init':
src/include/sof/spinlock.h:87:9: error: 'dma[i].lock' is a pointer; did you mean to use '->'?
   (lock)->user = __LINE__; \
         ^~
src/platform/imx8/lib/dma.c:54:3: note: in expansion of macro 'spinlock_init'
   spinlock_init(&dma[i].lock);
   ^~~~~~~~~~~~~

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-31 09:06:31 +01:00
Bartosz Kokoszko 20ce9661da volume: add schedule_task_free() in volume_free()
Adds schedule_task_free() in volume_free() in order
to avoid memory leaks.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-10-31 08:59:49 +01:00
Bartosz Kokoszko 2e9c5c5636 kpb: kpb task initialization displacement
Moves kpb task initialization from kpb_prepare()
to kpb_new() (kpb_prepare() can be invoked several times
for one kpb instance). Adds schedule_task_free() to
kpb_free() in order to avoid memory leaks.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-10-31 08:59:49 +01:00
Bartosz Kokoszko 782a962218 dmic: dmic task initialization displacement
Moves dmic task initialization from dmic_set_config()
to dmic_probe() in order to avoid memory leaks - in theory
driver could send dmic_set_config() ipc many times without
releasing resources. Also adds schedule_task_free() in
dmic_remove().

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-10-31 08:56:41 +01:00
Pan Xiuli 60ca19ff22 build: Fix firmware name for Jasperlake build
JSL FW should use sof-jsl.ri instead of sof-icl.ri.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-10-30 17:46:11 +01:00
Karol Trzcinski 3600cf0eea ipc: Break ipc_comp_dai_config after first error
Added break statement after error, as it was before refactoring
this part of code in commit <89ef0af07612c0bcf1a85fec3871d0c31e60087b>
("ipc: Refactor ipc_comp_dai_config function").
While at it, also removed additional parenthesis around trace_ipc_error.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-10-30 14:25:03 +01:00
Paul Olaru fb21866c0d sof: debug: Do not have empty debug macros when debug is disabled
This allows using them in if() expressions similarly to the previous
commit without any breakage.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-30 11:02:07 +01:00
Paul Olaru 47eece02b1 sof: trace: Do not have empty trace macros when traces are off
This commit allows code such as:

if (ret < 0)
  trace_error("error: %d", ret);
return ret;

to work properly.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-30 11:02:07 +01:00
Paul Olaru 30528e3e48 assert: Do not call assert() with side effects in the argument
If the assert semantics are changed to be the more usual ones, on
disabling asserts the calls that I changed would have also removed the
desirable side effects when the assertion itself passed (no memcpy_s
would have occurred, in particular). I have changed the usage of the
assert() macro so that the code becomes immune to such a change.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-30 10:53:37 +01:00
Bartosz Kokoszko 0e8cf66e57 pipeline: add rfree pipe_task in pipeline_free
Memory allocated for p->pipe_task should be freed
in pipeline_free() in order to avoid memory leaks.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-10-28 23:36:32 +01:00
Tomasz Lauda 15201664ca dai: refactor xrun checking
Refactors code for underrun and overrun detection. We should report
an xrun only if DMA get data size or DMA copy fails. In other case
even 0 available copy bytes doesn't mean anything, because we are always
copying as much as possible. Buffer could potentially be filled up front.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-28 17:04:10 +00:00
Tomasz Lauda c7ca517461 dw-dma: implement proper xrun checking
Implements proper flow for underrun and overrun checking.
DW-DMA should verify whether the channel running on hardware
linked list is still enabled.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-28 17:04:10 +00:00
Tomasz Lauda bdf4bc487e hda-dma: implement proper xrun checking
Implements proper overrun and underrun detection flow.
We should return error in case HDA-DMA link detects one.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-28 17:04:10 +00:00
Marcin Maka 78b022bfd3 dma-trace: fix race condition during initialization
dtrace_event...() is protected by dmatb.addr verification
which may be assigned while other buffer attributes are
not set yet. It results in assert in case the initialization
is pre-empted by a code that attempts to log something.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-10-26 12:46:43 +02:00
Tomasz Lauda 6d6f61cd72 agent: add option to enable system agent
Adds config option to enable system agent. It can be disabled
on the still unstable systems, which cannot guarantee that
agent will execute on time.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-25 11:03:33 +02:00
Rander Wang 742ee80785 host: refine stream position update for FW version before 3.11
FW sends stream position message to kernel for its version before
3.11. In kernel, no_stream_position will be set to 1 for FW version
after 3.10, and host_period_bytes will be set to 0 for other versions.
So in host_update_position, the condition is always true for hd->report_pos
>= dev->params.host_period_bytes for FW version before 3.11

Now check the condition dev->params.host_period_bytes != 0 according to
commit:b39b17ddf3e

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2019-10-25 10:27:36 +02:00
Karol Trzcinski 89ef0af076 ipc: Refactor ipc_comp_dai_config function
After refactor there is lower level of indentation in function.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-10-24 14:19:18 +03:00
Marcin Maka b37efd554f trace: complete trace on/off api including dma trace state
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-10-24 12:34:38 +02:00
Tomasz Lauda f724ef1058 edf_schedule: do not pass sof structure anymore
Changes scheduler_init_edf and task_main_init function
definitions as sof structure is no longer needed. It was
only used to pass agent object to main idle task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda c07e43fad5 platform: remove PLATFORM_IDLE_TIME definition
Removes PLATFORM_IDLE_TIME definition, because it's
no longer used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 0d0ee34a31 agent: remove disable and enable functions
Removes disable and enable functions, because they
are no longer needed. Agent will now update its lat_check
time above passive level, so every long running task will
be preempted.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 9e0d994e8d agent: refactor agent to be more useful
Refactors agent's functionality to really verify DSP
responsiveness. Instead of updating last_idle time
on passive level before entering waiti, let's change it
to last_check and update it on actual scheduler task
execution. Task is executed above passive level, so it
should preempt every other long running processing.
Since we don't have any additional precautions to guarantee
that low latency tick will happen exactly at the scheduled time,
let's define warning and panic thresholds to control stability
of the system.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 8137aef7bd agent: add error tracing macro
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 4cd4fd8f12 platform: remove PLATFORM_LL_DEFAULT_TIMEOUT definition
Removes PLATFORM_LL_DEFAULT_TIMEOUT definition. It has been
replaced by CONFIG_SYSTICK_PERIOD.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 56ebbad475 platform: define and use CONFIG_SYSTICK_PERIOD
Adds additional CONFIG_SYSTICK_PERIOD to Kconfig,
which is used to drive timer based low latency scheduler
and also will be used as a timeout check value for system agent.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 87a4bed002 dai: call dma_copy even if there is no data
Changes flow of dai_copy to call dma_copy even if there is no data
available. This way we make sure that all DMA needed procedures are
executed, since buffers pointers won't be changed anyway.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda d6f86e57ee dma: remove unused DMA_COPY_PRELOAD flags
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 048145fe60 pipeline: remove code related to preload
Removes code related to preload as with separate DMA
buffers we no longer need it.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 7989281b13 component: remove unused is_dma_connected field
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 8fa4b80213 component: do not set buffer sizes
Change flow of components to not resize sink buffers.
We should just check the size of the allocated buffers
and let the topology define the maximum sizes.
Components can easily work with non aligned buffer sizes.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda cec76442eb buffer: remove buffer cache operations
Removes buffer cache operations done based on the fact,
whether buffer is used by DMA or not. From now on DMAs have
their own dedicated buffers with dedicated copy functions,
so this code is no longer needed.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 1bfb1978d4 dma: alloc separate buffers for DMAs
Currently DMAs are using buffers on pipelines connected to either
host or dai components. This causes many problems in firmware logic
e.g. we need to preload playback pipelines with data or we need
to manually override buffer sizes, if the buffer isn't complaint
with specific DMA requirements. Also it requires from topology
creators to know some hardware specific things on each platform
like that for timer based scheduling on cAVS platforms we need
to have 3 periods in buffers connected to dai components.
This patch allocates separate buffers for DMAs, which are made
complaint by using different DMA attributes first. We no longer
need to preload playback streams, because we can start DMA
right away and just let it transfer zeroes before any valid
data will come.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 2f818ec801 dw-dma: fix buffer and copy alignments
DW-DMA has no specific alignments regarding buffer and copy sizes.
However setting it to 32 bytes breaks stream formats with period
sizes lower than 32 bytes, as linked list is being configured
incorrectly.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda ed64f40935 dma: implement dma buffer copy functions
Implements copy functions from/to DMA buffer. They take care
of cache operations and also can perform custom processing
during copy. By default it will be usual buffer copy, but in the future
it can be replaced with pcm conversions, so we don't need volume
into the pipelines just for that operation.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda eaa0ad01f3 buffer: implement buffer copy functions
Implements simple buffer copy functions for 16 and 32 bit data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 2e7d199c43 dma: add new attribute DMA_ATTR_BUFFER_PERIOD_COUNT
Adds new DMA attribute DMA_ATTR_BUFFER_PERIOD_COUNT and implements
it for every DMA. This attribute says how many periods should DMA
buffer consist of.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda a31d97671e buffer: extract allocation part to separate function
Extracts allocation part of buffer_new to separate function.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda df6017f950 buffer: add and init id, pipeline_id and caps fields
Adds and initializes id, pipeline_id and caps fields in buffer struct.
This is the only data needed after buffer creation. It allows us to
remove the whole sof_ipc_buffer struct from the buffers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Paul Olaru b6a863909b drivers: imx: esai: Enable the ESAI on the i.MX8 platform
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-24 10:55:45 +03:00
Paul Olaru c4d1408a6f drivers: imx: Add initial ESAI support
The ESAI is a hardware DAI on the i.MX platform. This commit brings the
initial support for the ESAI.

For now, the hardware FIFO watermark is hardcoded to 96 which means that
DMA transfers will be initiated when 96 of the 128 FIFO slots are empty.
IRQ handling is disabled (but possibly not needed anyway) and the clock
divider settings are hardcoded and correct for MCLK of 49152000 Hz,
48000 Hz sample rate, 2 channels, 32-bit samples (for the codec).

See https://www.nxp.com/docs/en/reference-manual/IMX8DQXPRM.pdf, pages
7435-7506 (ESAI).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-24 10:55:45 +03:00
Jakub Dabek f277189b3a build: Add config for Jasperlake build
Add defconfig file for Jasperlake platform.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-23 19:07:52 +02:00
Marcin Maka 40f7629f0b cnl: shim: fix typo in CLKCTL bits definition
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-10-23 19:07:34 +02:00
Jaska Uimonen bcf00a293a topology: add mute led tokens
Add tokens to topology for led use and led direction. Led use is true
for positive integers, false for 0. Led direction 0 corresponds to
playback and positive integers to capture.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-10-23 17:30:11 +02:00
Paul Olaru bea68b77d3 platform: imx: Enable caching on the i.MX platform
This improves the performance quite significantly -- pipeline_copy on
the simple ESAI pipeline (the cs42888 pipeline) took around 781us before
while with caching I got times of 15us at a minimum (a 50-fold
improvement).

Values:
-> 0x40000000-0x5FFFFFFF: 2 (bypass, contains ADMA registers)
-> 0x80000000-0x9FFFFFFF: 1 (write-through, write allocate). This
contains almost all of the code in 0x92400000-0x92BFFFFF and all the
heaps in 0x92C00000-0x933FFFFF.
-> Everything else has cache bypass (Dummy DMA needs to be able to use
host buffers from wherever)

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-23 16:53:14 +02:00
Paul Olaru 44c1d9217f drivers: generic: dummydma: Make the Dummy DMA compatible with caching
The semantics of a DMA driver is to transfer data to/from RAM rather
than to/from the DSP cache. As such I need to flush the cache before
and after the copy (see comments inline).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-23 16:53:14 +02:00
Lech Betlej a564aa293a cavs: enable power gating for lp/hpsram on d3 entry
Power gating for HPSRAM & LPSRAM on D3 entry enabled for all cAVS
platforms (cAVS 1.5/1.8/2.x) except SueCreek. Implementation shared
between cAVS 1.8/2.0/2.5 is located in cavs lib, cAVS 1.5 specific
implementation remains in ApolloLake platform directory.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-10-23 12:16:02 +02:00
Lech Betlej c548489e38 cavs: deduplicate power down sequence for cavs platforms
cAVS power down sequence refactored by moving CannonLake (cAVS 1.8)
implementation to cavs lib as a base for cAVS 1.8/2.0/2.5 common
code. ApolloLake (cAVS 1.5) specific implementation remains as a
platform specific code.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-10-23 12:16:02 +02:00
Tomasz Lauda 6d3d5bcdad cpu: fix cache misalignment
Fixes cache misalignment of active_cores_mask value.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-23 09:47:16 +02:00
Guido Roncarolo 6cab99c729 drivers: imx: edma: fix bytes copied at each iteration
The number of bytes copied at each ieration must
match half the total size copied as we have an
interrupt at HALF and MAJOR loop

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-10-23 10:08:22 +03:00
Guido Roncarolo d781385a91 drivers: imx: edma: translate burst size in bytes
burst_size represents the FIFO width in words, translate it
into bytes to have homogeneous quantities

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-10-23 10:08:22 +03:00
Marcin Rajwa 8b059f6566 kpb: make draining algorithm more secure
This patch slightly modifies draining speed algorithm.
Instead of copying half the buffer each period we
copy two periods. This slightly decreases draining
speed but avoids XRUNs in rare cases.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-10-22 20:33:41 +02:00
Paul Olaru 47b3050b3d sof: Fix compile errors when traces are disabled.
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-22 20:27:55 +02:00
Tomasz Lauda 9d5a82e78a ll_schedule: fix race condition for multicore scheduling
Fixes race condition in low latency scheduler when multiple cores
are processing tasks on the same scheduling domain. Task's start
time is updated based on last_tick right after the task is finished.
Last_tick can be updated in the meantime by other core in the situation,
where it starts handling interrupt later, but finishes its tasks
earlier.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-22 13:25:33 +02:00
Jakub Dabek bf11710734 memory: Fix DEBUG_HEAP build
Unify function naming to fix DEBUG_HEAP build

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-21 19:50:46 +02:00
Paul Olaru 3cec2101da platform: imx: Increase system runtime heap size
The introduction of the DMA multi channel domain made it so the cascaded
interrupt handling fails to allocate memory from this heap. Increasing
the size of the system runtime heap will allow the registering of
cascaded interrupts (and in particular the EDMA interrupt within the DMA
scheduling domain) to continue.

On this platform we have 8MB of total memory. Allocating 24kB instead of
12kB for the system runtime heap does not cause any noticeable change
besides removing the memory allocation failures.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-21 17:49:11 +03:00
Jakub Dabek 0234df5b4a buffer: Add alignment setting for DMA buffers.
Add seeting of alignment for DMA buffer that is required by
Hardware configuration.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-21 12:07:03 +02:00
Jakub Dabek b63f559bb4 memory: removed hp buffer heap
Merged hp buffer heap with normal buffer heap.
Since current buffer heap was actually using hp memory and it served
no purpose to have two heaps.
Removed extern capabilities and merged other capabiliteis to
buffer heap. Currently none of those buffer heaps supports extern.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-21 12:07:03 +02:00
Guido Roncarolo 3d5d314626 drivers: imx: edma: fix accessing register logic
channel must not be accessed when status *is* INIT
Fixes: 61b0b58

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-10-18 17:15:19 +03:00
Marcin Rajwa b717e0a0a1 host: fix wrong trace value
This patch fixes the trace message which logs always zero
value.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-10-18 13:48:22 +02:00
Seppo Ingalsuo f4084551e5 SRC: Report properly the non-supported rates combination error
The earlier error message was hard to understand and could be
mistaken as internal fail. A redundant trace message about block
sizes is removed because the block sizes are set in each copy()
in current SRC version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-10-17 15:43:31 +02:00
Seppo Ingalsuo 703e8269f3 SRC: Fix sink and source PCM formats handling in prepare()
This patch avoids wrong configuration for PCM format and audio
corruption in capture pipelines usage if the pipeline requires
format conversion.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-10-17 15:43:31 +02:00
Tomasz Lauda 6b22503e54 ipc: check whether pipeline id is already taken
When new pipeline is created we need to also verify whether
given pipeline id is already taken.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:41 +02:00
Tomasz Lauda 99c16a69e3 ipc: rename ipc_get_comp function
Renames ipc_get_comp function to ipc_get_comp_by_id.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:41 +02:00
Tomasz Lauda 089de0f6ab platform: remove unused PLATFORM_HOST_FINISH_TIMEOUT
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda d3ca5cb1c0 platform: remove unused PLATFORM_HOST_FINISH_DELAY
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda 276463d6dc platform: rename and move PLATFORM_HOST_DMA_TIMEOUT
Renames PLATFORM_HOST_DMA_TIMEOUT to HDA_DMA_TIMEOUT and
moves to hda-dma, where it belongs.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda 9b535ce1a2 platform: rename PLATFORM_DMA_TIMEOUT and move to dw-dma header
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda 19db14e55f platform: remove PLATFORM_SCHED_CLOCK
Removes PLATFORM_SCHED_CLOCK definition as it's the same
as PLATFORM_DEFAULT_CLOCK.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda a12d58d170 platform: rename and move PLATFORM_HOST_DMA_MASK
Renames PLATFORM_HOST_DMA_MASK to PLATFORM_DW_DMA_HOST_MASK
and moves to dw-dma header, where it belongs.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda 66f937dd52 platform: remove unused MAX_PRELOAD_SIZE
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Tomasz Lauda 557e3b7609 platform: remove unused PLATFORM_SCHEDULE_COST
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:11 +02:00
Jakub Dabek 089ddcc2b2 memory: fix DEBUG_HEAP build
Fixed issue with DEBUG_HEAP configuration not building correctly.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-17 13:35:22 +02:00
Janusz Jankowski ed9989ebbe pipeline: check task init result
In case of unsuccessful scheduler task init, the pipeline
task init should also fail.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-10-17 12:53:35 +02:00
Guido Roncarolo 54127b0374 drivers: imx: sai: add one word to FIFO
FIFO should be pre-filled with one word as per RM
recommendation after TRCE has been anabled

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-10-17 13:03:45 +03:00
Tomasz Lauda 063ecded7f src: fix frames calculation for capture stream
Fixes source_frames and sink_frames calculation for SRC
in the capture pipeline.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 11:28:34 +02:00
Tomasz Lauda 844526abdf ipc: return an error on dai not found
Returns an error, when there is no DAI component
connected to the DAI index specified by DAI config
IPC.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 11:22:51 +02:00
Guido Roncarolo 830ecf323c drivers: imx: edma: parameterize iteration size on FIFO size
various interfaces e.g. SAI or ESAI have different
FIFO size: EDMA has to take into account this when
programming the iteration size

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-10-17 11:28:10 +03:00
Guido Roncarolo 61b0b58865 drivers: imx: edma: avoid accessing register for non ready channels
avoid accessing registers for EDMA channels that are not
started to prevent crash

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-10-17 11:28:10 +03:00
Janusz Jankowski 6154b59e3b tigerlake: increase system runtime heap size
Update memory.h to have similar capabilities to other platforms,
that were updated when dynamic DMA channels were introduced.
Previous values were not enough for some topologies.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-10-17 07:06:02 +02:00
Zhang Peng 0d54df1dbc drivers: cavs: dmic: Remove dmic_read/write/update_bits functions
Remove dmic_read/write/update_bits functions, instead by dai_read/
write/update_bits functions.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
2019-10-16 16:52:16 +03:00
Tomasz Lauda 5f539d9448 dai: fix rare case of xrun on release
Adds new start_position field based on which we assess whether
we should throw an xrun. It fixes rare cases of xruns on release
with timer scheduled pipelines.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-16 10:27:21 +02:00
Tomasz Lauda 6f26cfd8c4 dai: verify if DMA channel exists in dai_prepare
Checks if DMA channel exists in dai_prepare. This way we will
avoid exception in case DAI config hasn't been called before.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-16 10:26:36 +02:00
Lech Betlej b5982a46aa cnl: Access to HPSRAM power gating status register - macro updated
Macro modified for SRAM segments > 0 fixed by register offset
update to a proper value.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-10-15 13:10:13 +02:00
Lech Betlej 79393f7c3e lib: Make sure shifted quantity is treated as 64bit type
Append type to constants in order to make sure they are
treated as 64 bit integers.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-10-15 12:37:35 +03:00
Tomasz Lauda 4839742c35 dw-dma: reload lli in irq_callback
For DW-DMA without hardware linked list support we need
to manually reload linked list items after every interrupt.
It's very time-sensitive and even the slightest drift can
cause glitches, so this patch moves lli reload routine
to be called from DMA domain as an interrupt callback.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-15 10:06:54 +02:00
Tomasz Lauda 6ec25256da dma: add irq_callback to dma_chan_data
Adds irq_callback to dma_chan_data. It's called by the
DMA domain right after receiving an interrupt, so should
execute very time-sensitive operations.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-15 10:06:54 +02:00
Guido Roncarolo a1f80afe44 drivers: imx: Add SAI support
The SAI is a hardware DAI on the i.MX platform. This commit brings
the initial support for the SAI.

Current limitations:
 -> Hardware FIFO watermark is hardcoded to HALF FIFO size
 -> current codec only support stereo channels
 -> slot size hardcoded to 32 bit
 -> clock divider is set to 8

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-10-15 09:25:34 +03:00
Paul Olaru 40bf5e070e drivers: imx: edma: Remove hardcoding of interrupt numbers
Initially I have hardcoded the specific values required for the ESAI.
That however is highly inflexible.

This commit refactors that to allow a more flexible declaration so that
other DMA clients can also get their proper interrupt numbers.

Only hardware which delivers its DMA interrupts via IRQ_STEER is
supported, however on this platform that is fine (all DMA channels
deliver their interrupts as shared interrupts via IRQ_STEER).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-14 15:12:14 +03:00
Paul Olaru a7d4690a92 drivers: imx: edma: Initialize DMA scheduling domain
On the pipelines which use EDMA, the EDMA interrupts are the ones which
schedule all the copies and processing happening inside a pipeline.

This commit enables the EDMA controller to schedule copies on this
platform.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-14 15:10:14 +03:00
Paul Olaru 50dfa9c751 drivers: imx: edma: Copy is_scheduling_source field from config
This field is required for the DMA scheduling domain to work.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-14 15:10:14 +03:00
Tomasz Lauda 7eb051592e dma_single_chan_domain: add trace logs
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-14 12:28:08 +03:00
Tomasz Lauda fdc6fba36c dma_multi_chan_domain: add trace logs
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-14 12:28:08 +03:00
Tomasz Lauda 0eaa11495e timer_domain: add trace logs
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-14 12:28:08 +03:00
Tomasz Lauda c7d01494bb pipeline: fix tasks initialization
Fixes tasks initialization for connected pipelines.
If we play on pipeline, which is not the owner of
the scheduling component, then the pipeline_prepare()
is not called on pipe owning that component and tasks
stay unitialized.

Fixes: de7d4c95cf ("pipeline: allocate pipe_task only if needed")

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:49:07 +02:00
Jakub Dabek 66b0a0f0b8 memory: Add alignment option for allocation
Add alignment option for memory requests.
Fix alloc definitions for UT.
Function definitions were using defines in their body
which blocked usage of const values in said defines.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-11 14:26:08 +02:00
Jakub Dabek 823e57a1b2 memory: adjust memory sizes for heaps
Adjust memory sizes for heaps to provide
enough memory for alignment in buffer heap.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-11 14:26:08 +02:00
Paul Olaru 51a6c9cdc5 drivers: generic: dummydma: Add config option
This config option also encapsulates a required dependency on
HOST_PTABLE.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-11 14:21:30 +02:00
Paul Olaru f1e249dd37 drivers: dummydma: Move the driver file to generic/
This driver can apply to any platform with the buffers in shared memory,
not just to i.MX.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-11 14:21:30 +02:00
Paul Olaru 4bee59c112 drivers: imx: dummydma: Change number of channels
This is to optimize memory consumption from this driver. With 32
channels we would have needed a memory block >1024 bytes in size to
allocate the dma_chan_data array. However 16 channels (which means
allocating a smaller block) should be enough for everyone.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-11 14:21:30 +02:00
Paul Olaru 9035c1f05c drivers: imx: Add Dummy DMA driver initial implementation
The dummy DMA is a software-based DMA which acts as a host DMA. This
one can be implemented in software alone because all host physical
address space (at least the RAM portion) is accessible directly from
the DSP on this platform.

The driver works by taking the physical addresses for both the source
and destination addresses from the elems. This works because no paging
is enabled on the DSP side, and because the page tables interpretation
allows these elements to actually have physical addresses on the host
side. Given these addresses, the copy itself is done synchronously on
the DSP within a memcpy_s call.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-11 14:21:30 +02:00
Paul Olaru d384b851db platform: imx: Implement page tables for DMA transfer.
Enabling this config option changes the way the SG elems are generated,
such that the host addresses in the elems are actual, physical
addresses.

This is required by the Dummy DMA driver, which can only operate with
said physical addresses.

This commit enables the config option and fixes compile errors which
appeared after this enabling.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-11 14:21:30 +02:00
Tomasz Lauda 8e4d0c95d6 pipeline: trigger pipeline in non-atomic context
With new schedulers implementations we don't need to trigger
pipeline in atomic context anymore.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda 46d080dc21 pipeline: don't copy not active component
Doesn't copy sink component, if it's not active.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda 71d9ee4681 platform: cavs: switch to DMA single channel domain
Switches from DMA multi channel domain to single channel
as the scheduling source for one of the low latency schedulers
for cAVS platforms.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda b7bb5b8539 schedule: implement dma_single_chan_domain
Adds implementation of DMA single channel scheduling domain.
This domain allows to schedule all the tasks on all the cores
on single DMA channel interrupt. This way we have only one
interrupt source and we don't need to worry about handling
many interrupts. We always select the channel with the lowest
period. This domain cannot be used with the DMAs, which require
to manually reload the next data to be transferred e.g. DW-DMA
on BYT or HSW.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda 6e48480165 ll_schedule: clear domain earlier
Some ll scheduling domains require to have interrupt cleared
right at the beginning of handler. Clear domain earlier to
fulfill that requirement.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda 2ce790d640 dma: add period to dma_chan_data
Adds DMA channel period value to dma_chan_data.
We can now easily retrieve the period value of
DMA channel transfers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda a91a396d5c notifier: add new NOTIFIER_ID_DMA_DOMAIN_CHANGE
Adds new NOTIFIER_ID_DMA_DOMAIN_CHANGE. This id will be used
by DMA single channel scheduling domain.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-11 14:17:29 +02:00
Tomasz Lauda e755494e7e timer: fix return values of platform_timer_set and arch_timer_set
Fixes return value of platform_timer_set and arch_timer_set functions.
Change was introduced for cAVS platforms, which accidentally broke
these functions for other platforms. The intention of this functions
is to return value of set ticks, so the timer scheduler can check
for delays.

Fixes: 75188e2243 ("timer: rework timer_set() so it verifies requested ticks")

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-10 17:14:05 +03:00
Paul Olaru 1a413d0b27 drivers: imx: edma: Set correct IRQ number
For the moment, the EDMA will only be used with one client -- the ESAI.
The IRQ number for both of the channels corresponding to the ESAI (as
well as the controller name) will be the same, and will map to interrupt
442 (which, according to the calculations required by IRQ_STEER, map to
interrupt 442 % 64 = 58 on controller 442 / 64 = 6).

In the future we should make this more flexible.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Paul Olaru 1a9ee6e453 drivers: imx: Add initial EDMA support
This is a hardware DMA controller on the i.MX platform. This one is
capable of doing mem-to-dev and dev-to-mem copies of any data.

This commit contains most of the initial implementation but a few things
related to IRQ handling (such as IRQ numbers).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Paul Olaru d21bba52e3 drivers: imx: edma: Remove specific register accessor functions
There are generic functions like dma_chan_reg_read and the rest which
can be used instead of these.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Paul Olaru 109d9f5bc9 lib: dma: Add support for different IRQ names for DMA per-channel IRQ
DMA controllers on the i.MX8 platform provide separate interrupts per
channel which may fall on different IRQ_STEER interrupt lines. Due to
the current architecture of the IRQ_STEER driver, this means the
channels may have their interrupts fall on different interrupt
controllers.

This commit allows setting an interrupt controller name per interrupt.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Paul Olaru d61a6b8e29 sof: lib: dma: Introduce {io,dma_chan}_reg_update_bits16
These functions are 16-bit counterparts to the preexisting 32-bit
functions io_reg_update_bits and dma_chan_reg_update_bits and are
intended to be used for general (in the former case) and DMA (in the
latter) 16-bit registers.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Paul Olaru 89ec81bc25 sof: lib: math: Add sign function
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-10 17:04:45 +03:00
Tomasz Lauda 459d9519f8 pipeline: reset pipeline in non-atomic context
With new schedulers implementation we don't need to reset
pipeline in atomic context anymore.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-10 09:57:18 +02:00
Tomasz Lauda 2c3c0cb4c9 kpb: fix overflow in buffering
Fixes the problem with copying to internal buffer,
where we didn't take into an account circularity
of source buffer.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-10 09:56:45 +02:00
Paul Olaru a358ea980d platform: imx: Change the ordering of initializations in platform_init
We first initialize the interrupts (IRQ_STEER controller) before
initializing the DMA domain because the interrupt numbers/names in the
DMA controller will be queried in the domain initialization.

Also, in anticipation of future changes we move
platform_interrupt_init() as the first call before clock_init() and
scheduler_init_edf() as they might be using interrupts in the future.

Suggested-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-10-09 11:14:17 +02:00
Tomasz Lauda fee25179d7 kconfig: enable interrupt levels per platform
Deselects all interrupt levels by default and sets
them appropriately for every platform.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-07 19:02:57 +02:00
Tomasz Lauda 04cf5d6aaf platform: tgl: change scheduling interrupt
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-07 19:02:57 +02:00
Tomasz Lauda 6ffd5f3fef interrupt: use CONFIG_INTERRUPT_x options
Uses CONFIG_INTERRUPT_x options to conditionally build interrupt
drivers' code. These definitions should only be used in interrupt
drivers and platform interrupt headers. In case there is a need
to use additional interrupt level the appropriate kConfig option
should be selected. Otherwise the build will fail.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-07 19:02:57 +02:00
Tomasz Lauda c9951ff207 dma: cavs: remove interrupts from HDA DMAs
Removes interrupt numbers and names assignment to HDA DMAs.
These interrupts are unusable due to hardware restrictions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-07 19:02:57 +02:00
Tomasz Lauda d1f4320988 interrupt: remove unmask parameter
Removes unmask parameter from interrupt structures and functions.
It's not been used for a long time now.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-05 20:14:50 +03:00
Tomasz Lauda 0f2315fba8 ssi-spi: align ssi-spi driver with latest DMA scheduling
Aligns ssi-spi driver implementation with latest DMA scheduling
changes.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-05 13:25:16 +02:00
Daniel Baluta 988510b7fd ipc: Introduce ESAI IPC parameters definition
ESAI is one of the DAIs found on i.MX8 platforms. Introduce esai_params
used to pass configuration from topology via AP to DSP.

Only MCLK and TDM related params for now.

Because this is a new struct, increment only ABI MINOR version
which makes the SOF FW backward compatible with older kernel versions.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-10-05 01:09:29 +03:00
Daniel Baluta ab0847d5d2 topology: Add ESAI tokens
Only add ESAI MCLK ID token for now

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-10-05 01:09:29 +03:00
Tomasz Lauda c623e92463 dai: prevent dai_config while in active state
Prevents dai_config while DAI is in active state.
It leads to undefined behavior and DSP exception
in some cases.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-04 15:14:28 +03:00
Slawomir Blauciak c4c42d34db platform: fix SPDX for headers
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2019-10-02 21:09:35 +02:00
Slawomir Blauciak 85a333db74 tigerlake: enable alh and supply headers
This change adds ALH support for Tiger Lake platforms
and enables it by default.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2019-10-02 21:09:35 +02:00
Janusz Jankowski a3af6df17a manifest: add v2.5 definitions
New version of manifest introduced with TGL platform
uses SHA384 for component hash.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-10-01 16:19:33 +01:00
Tomasz Lauda f69f4a839f host: remove not needed set of DMA_CB_STATUS_END
Next has this status set by default, so there is no need
to set it explicitly.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda f1fb5d3807 dma: remove unused DMA_CB_STATUS_SPLIT
Removes unused DMA_CB_STATUS_SPLIT and related code.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda d2d0eba43a dma: remove unused DMA_CB_STATUS_IGNORE
Removes DMA_CB_STATUS_IGNORE, which is no longer used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 4777f261e1 dw-dma: cleanup and remove irq related code
Cleanups DW-DMA driver and removes any code related
to interrupt handling.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 45015fa361 dw-dma: remove double channel index assignment
Removes double channel index assignment in dw_dma_probe.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 99fcd37f13 schedule: use DMA multi channel scheduling domain
Registers low latency scheduler with DMA multi channel
domain as scheduling source. This way we can finally get rid
of scheduling code from DW-DMA driver and DAI component.
Functionally it works the same as the previous implementation,
but transfers scheduling layer to the right places.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda ed9e888358 platform: hsw: increase system heap size
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda bf15c8973b dw-dma: add PLATFORM_DW_DMA_INDEX definition
Adds PLATFORM_DW_DMA_INDEX definition. This allows
to access this value from the generic API.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda faf12ac7a7 dw-dma: rename DMA_AGGREGATED_IRQ definition
Renames DMA_AGGREGATED_IRQ to DW_DMA_AGGREGATED_IRQ
definition. This is more appropriate as it's not generic
DMA setting.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 2ab6bc9afe dma: extract dma array
Extracts dma array to be accessible from the generic API.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda f6ffa55621 dw-dma: add PLATFORM_NUM_DW_DMACS definition
Adds PLATFORM_NUM_DW_DMACS definition. This way generic
API can access this information.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 24201a650d schedule: implement DMA scheduling domain
Implements DMA scheduling domain. It allows to initialize
another low latency scheduler and schedule on any DMA channel.
The functionality stays the same as the one already done in
DMA drivers e.g. DW-DMA.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda e1d76a9a61 dma: imx8: add missing dma_chan_irq macro
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 30241d0d20 dma: add PLATFORM_MAX_DMA_CHAN definition
Adds PLATFORM_MAX_DMA_CHAN definition to every platform.
This way generic API can retrieve this information.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda fa9b4ed674 hda-dma: remove HDA_DMA_MAX_CHANS definition
Removes HDA_DMA_MAX_CHANS definition as it's not needed.
We can directly use the number of allocated channels.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 43d608674d dma: move CAVS_PLATFORM_NUM_DMACS to specific platforms
Moves CAVS_PLATFORM_NUM_DMACS definition to specific platforms
and renames it to PLATFORM_NUM_DMACS. This way we can access
to the number of platform DMAs from generic code.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 818090f962 schedule: add SOF_SCHEDULE_LL_DMA
Adds SOF_SCHEDULE_LL_DMA as the new low latency scheduling
domain type.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda e08f951591 schedule: rename SOF_SCHEDULE_LL to SOF_SCHEDULE_LL_TIMER
There can be many potential low latency scheduling domains,
so let be more specific here.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 5a63a6baf5 dma: add scheduling_source
Adds scheduling_source field and dma_is_scheduling_source
function. It allows for easy identification whether particular
DMA channel is the source of pipeline scheduling.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 67826253ea component: add comp_is_scheduling_source function
Adds comp_is_scheduling_source function, which checks whether
component is the one used as a scheduling source for the pipeline.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda b7591b579e dma: add core to dma_chan_data structure
Adds core to dma_chan_data structure. This way we can
easily identify which core currently owns the DMA channel.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda ecae65c92d pipeline: add preload_task
Adds preload_task to pipeline. This task is only
allocated and initialized, when pipeline needs to be
preloaded with data e.g. render pipe scheduled on DMA irq.
It's always an EDF task, so we make sure it's get scheduled
no matter if interrupt was triggered or not.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda de7d4c95cf pipeline: allocate pipe_task only if needed
Changes implementation of pipe_task allocation and initialization
to happen in prepare call instead of during pipeline creations.
It might be that the pipeline will never be used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda f58b83387c host: use blocking copy for one shot mode
Changes copy method for host working in one shot mode.
Blocking copy replaces interrupt based copy. In an effort
of extracting DMA interrupt based scheduling from DMA
to scheduler we need to minimize number of irq sources
in our flows. This patch also changes the interrupt
based implementation of traces copying through DMA.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda c38879d5ca dma: add interrupt ops implementations
Adds interrupt operation implementations for all existing
DMA drivers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 0b1eb91f10 dma: add interrupt operation
Adds interrupt operation and operation type to DMA API.
This is the first step in excluding DMA interrupt handling
to schedule layer.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 450ed737ee platform: cavs: include missing headers
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +02:00
Tomasz Lauda 1d3fa8a432 platform: tgl: remove non-existent options selection
Removes selection of non-existent options.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 15:01:22 +03:00
Tomasz Lauda 17f2de5599 arch: xtensa: fix stack dump for exceptions in irq handlers
Fixes stack dump procedure for exceptions happening in interrupt
handlers. Stack base and size haven't been set to the interrupt's
one in current task context, so when exception happened during
interrupt processing we've got SOF_IPC_PANIC_STACK cause instead
of the real one.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:21:00 +01:00
Tomasz Lauda 84e75633d0 arch: xtensa: verify xtos_active_task offset
Adds STATIC_ASSERT to verify if the XTOS_TASK_CONTEXT_OFFSET
is set to the right value.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:21:00 +01:00
Tomasz Lauda db2a6e5b58 arch: xtensa: add macros to store values
Adds additional macros to store register values under the
selected structures per core.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:21:00 +01:00
Tomasz Lauda 7d12a6599b ipc: cleanup ipc functions
Cleanups ipc functions, so we don't have many not needed
layers of execution.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda 7f23b259c0 ipc: remove host_pending as it not needed
Removes host_pending from ipc structure, because it's no
longer needed. Scheduler will automatically throw an error,
when we'll try to run not completed task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda 2e7fb133c8 ipc: add complete task callback
Changes ipc task implementation, so it accepts new messages from
host in a complete task callback. This way we will avoid the
situation, where host will send another message before we
truly complete current ipc task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda 3c79047dad wait: panic only if we're lowering irq level
Change the waiti implementation to panic only if we're
lowering current interrupt level. In some rare cases
(like entering D3 for some platforms) we don't care,
because DSP will be disabled anyway.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda 3afc474518 task: add complete callback
Adds complete callback to task. Some EDF tasks will need to have
additional callback on task completion, which will be executed
in critical section along the setting task state to complete.
Doing it during regular execution is not enough, because it's done
on passive level and we want to avoid any race condition.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda eb0d309cf9 task: rename func to run
Renames task's func to run to better show intention of this callback.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda 752a3b2e15 task: change IPC and IDC tasks' priority
Changes priority of IPC and IDC tasks. They are always scheduled
as EDF tasks, where order of scheduling is based on deadline
and priority is meant for special tasks e.g. IDLE or ALMOST_IDLE.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Liam Girdwood db52ec9cac xtensa: add support for platforms with no threadptr register.
Fix the core-isa headers for HSW and BDW.

Provide a virtual threadptr register in the memory map using a linker
area below the stack. This can then be referenced instead of the register
for ISAs that dont support threadptr.

This patch also includes initial vthreadptr support for HSW/BDW platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-09-30 15:25:37 +01:00
Tomasz Lauda b80338c395 idc: move to cavs drivers
Moves idc implementation to cavs drivers instead of keeping
it in generic xtensa arch directory. IDC is specific for
SMP cAVS platforms.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-30 11:34:39 +02:00
Tomasz Lauda 51c7667709 arch: xtensa: fix exception in case of spurious interrupt
We need to switch stacks before check for spurious interrupt,
because otherwise we will jump and try to restore stack pointer
from the wrong location.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-30 11:32:42 +02:00
Tomasz Lauda 889f0143a1 interrupt: imx: run cascaded irq handler in non atomic ctx
Runs interrupt handlers for cascaded interrupts in non atomic
context. Otherwise we are blocking other cores during execution,
which is not needed, since we only need to protect integrity of
the list.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-30 10:53:00 +02:00
Tomasz Lauda 564a18a1af interrupt: cavs: run cascaded irq handler in non atomic ctx
Runs interrupt handlers for cascaded interrupts in non atomic
context. Otherwise we are blocking other cores during execution,
which is not needed, since we only need to protect integrity of
the list.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-30 10:53:00 +02:00
Guennadi Liakhovetski b65f05006c mixer: fix mixer for capture pipelines
When triggering a pipeline, containing a mixer in the playback
direction, all input pipelines have to be considered. However, this
isn't applicable if the mixer is used in the capture direction. This
patch adds the missing check to mixer_trigger().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-29 14:45:36 +01:00
Marcin Rajwa 8528d932a9 host: verify if channel exists before resetting it
This patch provides a check for channel existence
before performing any action on it during reset
procedure.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-27 23:44:32 +02:00
Tomasz Lauda 913644b1a8 dai: fix dma channel free
Fixes freeing of dma channel. It's set during dai configuration,
so we should first check if it exists.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-27 17:55:00 +02:00
Marcin Maka 2ef3c07e1b pm-runtime: cavs: add dsp pm control
PM of the dsp may be enabled and disabled on the cavs platform.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-27 16:20:53 +01:00
Marcin Maka 80c1460f9b pm-runtime: add pm runtime active, enable, disable interfaces
PM enable and disable is an interface to control the power
management of a resource.

PM is_active is an interface to query the pm management status
of the resource.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-27 16:20:53 +01:00
Marcin Maka edea885ba5 pm-runtime: cavs: introduce common pm runtime data
A common structure should be define for all cAVS platforms
for data that will be used by common cAVS pm runtime routines.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-27 16:20:53 +01:00
Marcin Maka bf8aded456 platform: add wait for interrupt handler
Another platform specific platform_wait_for_interrupt handler
enables more platform level power optimizations when
entering sleep mode.

By default implemented as a call to the generic wait_for_interrupt
until the platforms start additing their specific settings there.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-27 16:20:53 +01:00
Marcin Maka ab5059145e arch: host: remove include constraint from wait.h
This header may be included by a platform specific, intermediate
wait() layer inserted between the lib and the architecture code.
Therefore the including unit should not be limited to lib only.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-27 16:20:53 +01:00
Curtis Malainey 7804f530e9 platforms: Enable optional cherrytrail DMA
The 3rd DMAC that CHT has seems to be causing issues. Since it is not
needed lets make it optional so the platform can be usable.

Signed-off-by: Curtis Malainey <cujomalainey@google.com>
2019-09-27 15:52:15 +01:00
Tomasz Lauda f585df2a3b ll_schedule: don't run tasks in non atomic context
Low latency scheduler is low latency, so the tasks shouldn't
be preempted by other things. This doesn't change any flow,
because xtos sets highest possible irq level in interrupt
dispatcher anyway.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-27 15:49:28 +01:00
Marcin Rajwa 3ce82a1544 kpb: make change state logs verbose
This patch makes logs related to state change in KPB
component verbose.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-25 17:57:14 +02:00
Tomasz Lauda 3be6f2e742 dw-dma: use generic dma reg functions
Changes usage to generic dma reg functions instead of using
dw-dma specific methods.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-25 17:53:52 +02:00
Tomasz Lauda 941834da57 hda-dma: use generic dma reg functions
Changes usage to generic dma reg functions instead of using
hda-dma specific methods.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-25 17:53:52 +02:00
Paul Olaru 9871995697 drivers: dw: Use generic dma_reg_* functions
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-09-25 13:36:11 +02:00
Paul Olaru def04819b3 drivers: hda-dma: Use generic dma_reg_* functions
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-09-25 13:36:11 +02:00
Paul Olaru f8bdaf0328 sof: lib: dma: Add register access helper functions
These functions replace the raw io_reg_* functions for accessing the DMA
hardware registers.

Every DMA driver makes auxiliary functions for accessing the hardware
registers; this is an effort to make common functions for this purpose.

This commit adds the generic functions.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-09-25 13:36:11 +02:00
Bartosz Kokoszko d42c01956f buffer: add overwrite in circular wrap case
In case when we overwrite "old" data in buffer
(when buffer is full) we should align r_ptr
with w_ptr.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-09-24 12:44:16 +02:00
Paul Olaru c22d3c188d drivers: imx: timer: Do not enable timer in timer_start
This function is called too early for native timers to work. On the
other platform which uses native timers (Haswell) this function is also
empty.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-09-24 13:37:49 +03:00
Marcin Maka 9794dd7866 task: add option to provide stack allocated externally
Dynamic allocations of the stack with the default size
may impact the performance in case of frequently re-initiated
short tasks. This option may be useful in that case.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-23 21:48:01 +02:00
Marcin Rajwa 6cc3892f71 host: fix wrong check for host_period_bytes
This patch fixes the incorrect check for
host_period_bytes. This value was incorrectly used
to store host request for stream position. After
we introduced dedicated parameter for this purpose
(no_stream_position) the check needs to be updated
accordingly. Therefore this patch adds a check
for no_stream_position rather than host_period_bytes
to decide if stream position shall be send.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-23 10:28:26 +02:00
Marcin Rajwa 1852036454 ipc: align stream.h with kernel
This change is to align sof_ipc_stream_params with its
kernel equivalent. In this patch no_stream_position
parameter is added to relax host_period_bytes from
storing information about the need of stream position
update.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-23 10:28:26 +02:00
Marcin Rajwa ccba8e0668 timer_domain: check if delay occurred during scheduling
This patch checks if during scheduling we were
delayed.
If such situation happens we log error message.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-20 14:43:58 +02:00
Marcin Rajwa 75188e2243 timer: rework timer_set() so it verifies requested ticks
This patch reworks cAVS timer_set() interface used
to write into timer's compare register.
This change takes care of ticks request which are
"past time". If such condition occur we set compare
register to current time so the latency is minimum.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-20 14:43:58 +02:00
Tomasz Lauda 0bed38788e timer: remove unused core field
Removes unused core field from timer structure.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 7325dda291 timer: remove unused timesource_data structure
Removes structure timesource_data, which is no longer used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 0e6f3a9fe4 platform: rename PLATFORM_WORKQ_DEFAULT_TIMEOUT define
Renames define PLATFORM_WORKQ_DEFAULT_TIMEOUT to
PLATFORM_LL_DEFAULT_TIMEOUT.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda ec0570483d platform: remove unused PLATFORM_WORKQ_CLOCK define
Removes unused define PLATFORM_WORKQ_CLOCK.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 93ecfe671a agent: use PLATFORM_DEFAULT_CLOCK
Changes clock used by agent to PLATFORM_DEFAULT_CLOCK.
Previously used PLATFORM_WORKQ_CLOCK also has value of
PLATFORM_DEFAULT_CLOCK.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda e95edfe48d platform: remove unused PLATFORM_WORKQ_WINDOW define
Removes unused define PLATFORM_WORKQ_WINDOW.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 0f1f3d1222 platform: remove unused PLATFORM_LINK_DMA_TIMEOUT define
Removes unused define PLATFORM_LINK_DMA_TIMEOUT.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 7d5842f300 ll_schedule: use ll_schedule_domain in ll_schedule
Refactors ll scheduler in order to incorporate the usage
of ll scheduling domain. Functionally it stays the same.
Now we use data shared in ll_schedule_domain instead
of allocating shared ll context.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda a4b4d5ff2b notifier: add macro for getting clk notification id
Adds macro to simplify getting clock change notification id
based on the selected clock id.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 8fa4c0013c schedule: add timer_domain
Adds first ll scheduler domain, which is timer.
Timer domain implementation is functionally the same,
as the implementation already used in ll_schedule.
It will replace the original ll_schedule one.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 869b0c11e3 timer: save handler irq argument in scheduler
Changes timer API to save interrupt handler argument
in ll scheduler shared context instead of timer struct.
This way we will be able to share the same timer structure
between all the cores.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Tomasz Lauda 4ee233990e schedule: introduce ll_schedule_domain
This patch introduces new structure called ll_schedule_domain.
It will be used to initialize ll scheduler with different
types of scheduling time domains. Right now it's only working
based on timer interrupts, but will be extended.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-19 15:32:23 +01:00
Liam Girdwood 460c41aa66 tgl: platform: removed unused scheduling macros.
No longer used so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-09-18 21:01:16 +02:00
Liam Girdwood 39874c5f6c mailbox: remove duplicated mailbox macro
Duplicates MAILBOX_SIZE

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-09-18 21:01:16 +02:00
Liam Girdwood 049411519e linker: Make sure config.h is used by all linker scripts and memory.h.
This was partially used in some scripts. Fix it so all scripts can use
config.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-09-18 21:01:16 +02:00
Bartosz Kokoszko 03d68261cf alloc: fix first free update in alloc_cont_blocks()
In alloc_cont_blocks() function after allocation we should
check whether new first_free block has been already used.
If it was used, we should find first not used block.

fixes #1714

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-09-17 09:22:42 +02:00
Jaska Uimonen 0d74d3a563 src: do not treat 0 size input data as error
Currently SRC returns error when 0 size input or output data is detected
and pipeline interpretes this as fatal xrun error. This could happen
for example when host dma has no time to fill in first iteration of
samples. So instead of error, return PPL_STATUS_PATH_STOP as SRC in the
middle of the pipeline should handle also occasional 0 size data.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-09-17 09:22:19 +02:00
Marcin Maka 2339a62762 arch: xtensa: remove include constraint from wait.h
This header may be included by a platform specific, intermediate
wait() layer inserted between the lib and the architecture code.
Therefore the including unit should not be limited to lib only.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-16 12:59:34 +02:00
Marcin Maka ced0ea054c arch: xtensa: remove dependency on platform headers
Integration specific tweaks for xtensa architecture should
use Kconfig options selected for required platforms, not the
platform headers.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-16 12:59:34 +02:00
Marcin Maka 0f00c11531 cavs: pm: fix include of version header
Should include cavs/version to compile on < 1.8, not
the global version.h one.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-16 12:59:34 +02:00
Tomasz Lauda 2bd725df02 trace: move platform_trace_point to dedicated headers
Moves platform_trace_point macro from platform/platform.h
to platform/trace/trace.h. This way we don't need to
include platform header from generic sof/trace/trace.h.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-14 23:53:02 +02:00
Marcin Maka 94733aa588 task: remove edf specific elements from context switching layer
The context switching layer is a common mechanism for all
pre-emptive schedulers and should not depend on data types
defined for any specific one.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-09-13 14:35:18 +03:00
Tomasz Lauda e01c696337 common: add missing include
Adds missing include of stddef.h, which defines offsetof
macro.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-13 11:57:37 +02:00
Tomasz Lauda 8c61213c37 schedule: support dynamic scheduler creation
Refactors schedule code in order to allow dynamic scheduler
creation. We don't want to add every new scheduler to the static
array of scheduler_ops and also we don't want to have every
scheduler created on every platform. Maybe some of the platforms
won't need some of the future scheduler types.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-11 16:24:00 +02:00
Tomasz Lauda 09a44ab7c9 kpb: add missing flag to task init
Adds missing flag during draining task initialization.
It's needed at the moment, so the EDF scheduler can ignore
deadline for this task. Scheduling flags will be soon
refactored.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-10 23:08:12 +02:00
Marcin Rajwa 0242a5c0f8 pipeline: don't disable IRQs on prepare()
This patch removes the IRQ disable during
pipeline_prepare() as there is no potential
race condition. Also, the disable of IRQs
result in long delays in queued interrupts.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-10 16:24:42 +02:00
Marcin Rajwa 43b1cc428b pipeline: don't disable IRQs on params()
This patch removes the IRQ disable during
pipeline_params() as there is no potential
race condition. Also, The disable of IRQs
result in long delays in queued interrupts.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-09-10 16:24:42 +02:00
Jerome Laclavere 114692728a host: remove empty new line
Make code easier to read. Found using checkpatch.

Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-09-10 13:00:31 +03:00
Guennadi Liakhovetski 596f761bf0 ipc: propagate an error from ipc_stream_pcm_params()
Instead of always returning -EINVAL propagate the error code from
ipc_stream_pcm_params() that actually caused the failure.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski bd9bd37f3f pipeline: remove redundant variable initialisations
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski fef188562a audio: host: remove superfluous variables
Two variables in host_new() contain constant values and only obscure
the code. Remove them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski 7d7fa49ea0 schedule: remove redundant initialisations
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski d9895174eb ll-schedule: remove "inline" and redundant initialisations
There is usually no need in explicit "inline" qualifiers in C, in
most cases the compiler does a good job deciding which functions to
inline. Also remove a redundant variable and simplify a function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski 413c69acc8 notify: remove meaningless action
notify->list is a list head, no need to do a list-remove on it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski a57b951f2c notifier: remove superfluous initialisation
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski 32fa6fd387 ipc: remove redundant initialisation
rzalloc() allocates 0-initialised RAM, there's no need to initialise
it to 0 immediately after allocation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski 2198f59a91 ll_schedule: replace macros with safe versions
Current implementations of ll_sch_set_pdata() and ll_sch_get_pdata()
are unsafe, replace them with safe versions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Guennadi Liakhovetski d516a66c08 xtensa: remove superfluous initialisation of static data
Static data is always zeroed in C, no need for an explicit
initialisation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-09-09 12:52:03 +02:00
Tomasz Lauda 20acc16791 edf_schedule: implement the new version of EDF scheduler
This patch implements the new version of EDF scheduler.
This is the first basic implementation, which can be easily extended
in the future.

Previous implementation had two major flaws:
- Tasks could only be preempted based on the interrupt level on which
they have been scheduled, so it was limited based on the hardware.
- This led to the system not fully utilized, so we could never achieve
full EDF functionality.

The new implementation uses only one software interrupt and allows for
dynamic context switching between different tasks based on the deadline.
Also for some cases priority is taken into consideration e.g. for idle
and almost idle tasks, which don't have deadline at all and should be
executed only if the system is free. All other normal tasks should have
the same priority. Task chosen to be run is executed on passive level,
so automatically can be preempted by every interrupt. Every task has
its own private stack on which current context is saved and restored
if needed. Note that main firmware loop is task scheduled with
idle priority, so it will be executed only after every other task
is completed.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-06 15:51:02 +01:00
Tomasz Lauda fe9f9a1f36 apl: increase HP Buffer Heap and Runtime Sys Heap sizes
Increases HP Buffer Heap and Runtime System Heap sizes in order to
fit all the pipeline buffers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-06 15:51:02 +01:00
Tomasz Lauda 1c93a4c15f schedule: pass sof context during scheduler init
Passes sof context structure to the schedulers during
scheduler initialization. It will be required by the new
EDF scheduler.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-06 15:51:02 +01:00