Commit Graph

2895 Commits

Author SHA1 Message Date
Paul Olaru 29c7195ed6 sof: spinlock: Separate typedef for spinlock_t in a separate header
This separation breaks a cyclic dependency between <sof/spinlock.h> and
<sof/drivers/interrupt.h> (which wasn't visible before).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-12-13 13:11:13 +02:00
Paul Olaru 14b90a3ee1 sof: spinlock: Remove trace_lock_value references
Recent changes in the tracing system removed the trace_value function
for it being not verbose enough to be helpful for debug. This hasn't
been caught due to debug not being tested in SOF CI.

This patch replaces this with trace_lock_error or trace_lock calls, and
adjusts the macros to support this replacement.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-12-13 13:11:13 +02:00
Tomasz Lauda f5bcc4bb06 init: remove need to access sof struct on slave cores
Moves sof structure initialization to master core to avoid
data being overwritten by slave cores in case of future use.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-12 14:36:55 +01:00
Tomasz Lauda 1f8df21549 schedule: make ops constant
Makes schedulers and scheduling domains ops constant and effectively
puts them in rodata segment.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-12 12:41:26 +01:00
Tomasz Lauda 1290a45ea8 alloc: fix modulo zero bug
Fixes modulo bug in get_ptr_from_heap function,
where alignment can potentially be 0. Modulo zero
is undefined operation.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-12 12:34:41 +01:00
ArturX Kloniecki c89d916917 dma: Implement DMA IRQ callback using notifier interface.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki 07bf590cc9 dma: Make use of notifier callback interface for DMA callbacks handling.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki a17efdc379 buffer: Implement buffer free callback.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki 04e3742c00 buffer: Reorganize buffer callbacks using notifier as event hub.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki 81936774c8 notifier: Add traces for notifier.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki a88543a92c notifier: Refactor notifier interface and inner workings.
This patch changes usage of notifier, passing control over callbacks
allocation, allows nested callbacks processing and prepares interface
for future extenting.
This also optimizes unnecessary cache writeback/invalidation when
evaluating callback on the same core it was dispatched.

Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
ArturX Kloniecki 188b37f6eb memory: Increase amount of small sys runtime heap blocks.
Increase amount of 64B-sized blocks on sys runtime heap in preparation
for increased usage by callback handles allocated by notifier.

Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
Pan Xiuli 8f51e6bbb4 build: disable asrc xcc defconfig for byt cht
Need to disable asrc support for BYT and CHT for xcc build.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-12-09 12:52:31 +01:00
Tomasz Lauda 8dfb717645 alloc: invalidate uncached memory
Invalidates memory regions, which are requested to be uncached.
This way we can make sure we won't overwrite data by accident.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-09 11:52:04 +01:00
Janusz Jankowski bdf4d5a403 cavs: lib: check status mask in cpu clock set
On some platforms clocks may not be switched instantly and f.e.
there may be need to wait for clock availability before switching to it.
That's why there is need for mask that is used for checking status.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski 2a81c56f58 tigerlake: shim: clock status registers
Add registers for checking clock status.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski dcd72a5d9d tigerlake: shim: clock control registers
Add registers for requesting clocks.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski bec643e265 icelake: shim: clock status registers
Add registers for checking clock status.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski d569859e4b icelake: shim: clock control registers
Add registers for requesting clocks.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski 431110e015 suecreek: shim: clock status registers
Add registers for checking clock status.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski 3dc5ea81a5 suecreek: shim: clock control registers
Add registers for requesting clocks.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski f275568f01 cannonlake: shim: clock control registers
Add missing registers for requesting clock changes.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Janusz Jankowski 27c1edcaf5 cannonlake: shim: clock status registers
Add registers for checking clock status.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-12-09 11:50:16 +01:00
Paul Olaru 65de27d2cb platform: imx: Add the heap_trace_all call at the end of platform init
This is to align with the other platforms' init functions.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-12-04 21:16:56 +02:00
Paul Olaru cac98242ca platform: imx: Enable DMA trace
DMA trace is supported since this platform has a working host DMA. This
patch enables it for this platform.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-12-04 21:16:56 +02:00
Bartosz Kokoszko 0205c95a3d mux: fetch params from sink buffer
Fetches channels and frame_fmt from sink buffer (sink
buffer params are set in pipeline_set_params()
before mux_params()).

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-12-03 19:00:55 -06:00
Bartosz Kokoszko a81496f3a1 mixer: fetch frame bytes from sink buffer
Fetches frame bytes from sink buffer (sink buffer params
are set in pipeline_set_params() before mixer_params()).

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-12-03 19:00:55 -06:00
Marcin Maka 9d36627cd0 cnl: clk: add config option to select default ro clock
A new config option allows to select between the default
ring oscillator used to clock the dsp core and memory
on Intel Cannonlake platform.

CANNONLAKE_LPRO sets the default clock to 120MHz low power
oscillator, otherwise 400MHz oscillator is used.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-12-03 14:50:00 +01:00
Lech Betlej b8d9a1d583 detector: fix bug in synthetic load calculation
The assumption is that load_mips equals MCPS (million cycles per second).
Then only a fraction of MCPS has to be consumed for each processing frame
depending on a frame length and a sampling rate.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-12-03 14:29:27 +01:00
Karol Trzcinski 36d9121532 mux: Remove artefact from trace in mux_params
There was unintended phrase from trace.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-03 14:45:10 +02:00
Bartosz Kokoszko feb9e2b227 Fix style coding issues
Fixes style coding checkpatch issues.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-29 10:58:33 +00:00
Bartosz Kokoszko 74e1bcc786 component: move pcm params from component to buffer struct
Moving pcm params from component to buffer is the first
step to improve parameter propagation within pipelines. This commit
moves several pcm paremeters (framet_fmt, buffer_fmt, rate,
channels, chmap, except direction) to comp_buffer struct.
Some of specific parameters are moved to private host and
kpb data.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-29 10:58:33 +00:00
Seppo Ingalsuo c9bf3dc15a ASRC: Add ASRC into testbench
This patch adds the ASRC component and the new tokens into topology
parser and testbench component loader.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-27 09:49:48 +00:00
Seppo Ingalsuo 612ff60923 ASRC: Add 4 kB pool into heap runtime
This patch adds a single 4 kB space for allocation. The 2 kB space
is added as well but configured to zero available. The ASRC typically
needs 2 - 4 kBytes of dynamically allocated storage.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-27 09:49:48 +00:00
Seppo Ingalsuo 4c995d0375 ASRC: Add asynchronous sample rate converter component to SOF
This patch adds the new ASRC feature to SOF. It supports both
optimized HiFi3 build with xt-xcc and generic C version for
gcc build. The generic C version is currently feasible only
for testbench run due lack of sufficient speed for realtime but
will be optimized later.

The feature is disabled by default for BYT, CHT, BDW, and HSW
platforms to save RAM.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-27 09:49:48 +00:00
Seppo Ingalsuo 6b0529e79e ASRC: Add filter coefficients for ASRC
This patch adds the FIR filter coefficients and filter parameters
header files for the ASRC.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-27 09:49:48 +00:00
Paul Olaru 6985b39686 sof: clk: Remove specificity on clock notifier change ID
The previous version changes behavior on the BYT platform.

Fixes: ee9283c159 ("sof: lib: notifier: Do not break build on platforms
without CLK_SSP").
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-27 09:41:54 +00:00
Tomasz Lauda d740a3e068 eq_iir: use buffer_copy function
Uses buffer_copy function for bypass mode to avoid code duplication.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 3b911d10a4 eq_fir: use buffer_copy function
Uses buffer_copy function for bypass mode to avoid code duplication.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda a73c01f0f8 src: use buffer_copy function
Uses buffer_copy function for bypass mode to avoid code duplication.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda c3594e3a05 buffer: reimplement copy functions to faster versions
Reimplements buffer_copy functions to use memcpy_s instead of
fragment API. Based on my tests it gives 20% better performance
than previous implementation. Note that memcpy_s function
uses vec_memcpy when built using XCC.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda e3545fab4e buffer: selective build by CONFIG_FORMAT
Builds buffer_copy functions based on the selected formats
in kconfig.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 8566b3101c host: use copy functions from pcm_converter
Uses pcm_converter to choose the right processing function.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 67097327fe dai: remove unused code
Removes unused code from dai_config. Frame bytes are always
calculated from scratch in dai_params, so no point in keeping
this dead code.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda e0491ff778 dai: volume: make pcm conversion in dai component
Changes processing flow and moves pcm frame format conversion
from volume to dai component. This way we'll no longer need to
artificially add volume into the pipelines, where it's not really
needed but frame format change is e.g. KPD topology. Dai is the perfect
place for conversion, since it's format is pretty much predefined and
comes from topology. Rest of the pipeline is configured from the host.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 5f19803611 component: use frame_bytes and sample_bytes functions
Uses newly added frame_bytes and sample_bytes methods in its
own component based functions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 21dec616c8 format: add sample_bytes and frame_bytes functions
Implements functions for sample bytes and frame bytes calculations
based on provided frame format and channels.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 390a6e5306 pcm_converter: add HiFi3 implementation
HiFi3 implementation of PCM converter is optimized to
process either two samples at once for 32 bit data or
four samples for 16 bit data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 8270ad3bc3 pcm_converter: add generic implementation
Implements generic version of PCM converter library component.
This module provides static functions, which allows to copy
buffer data with frame format conversion.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 678ae1197b common: add IS_ALIGNED macro
Implements macro to check whether value is aligned.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Tomasz Lauda 6ad952d52a dma: change signatures of copy buffer functions
Changes signatures of copy DMA buffer functions to differentiate
between source and sink bytes. Process function from now on will
work on provided samples to handle different formats on input and output.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +00:00
Pan Xiuli d6b05caf5b build: add xcc defconfig for byt cht and sue
bay cht and sue xcc build has bigger size, need to use -Os to reduce size.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-26 12:53:03 +01:00
Pan Xiuli deccf8f08f memory: modify bootloader for xcc build
xcc build will have bigger TEXT.
Need to keep the total block size unchange as the block need to be
4k align.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-26 12:53:03 +01:00
Pan Xiuli 71a68ed2ae haswell: fix _memmap_vecbase_reset address
Use SOF_MEM_VECBASE_TEXT_BASE to repalce unset variable.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-26 12:53:03 +01:00
Pan Xiuli d3956d0a9c arch: string: enable vec_memcpy only with HIFI3
xcc HIFI2 do not vec_memcpy, we can only use vec_memcpy on HIFI3 supported
platforms.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-26 12:53:03 +01:00
Guido Roncarolo 4e28b0acf7 drivers: imx: sai: fix minor log issue
Correct log verbosity in SAI driver

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-11-26 11:17:39 +00:00
Guido Roncarolo 97f4bb67bf drivers: imx: sai: Set configurations for capture
SAI hardware needs on capture side to have SYNC mode set as
'Synchronous with receiver' in order to work properly
Set this field on Capture register RCR2, transmitter side
must be configured in asynchrounous mode

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-11-26 11:17:39 +00:00
Marcin Maka d6fe2b138b pm: cavs: fix literal dcache lock in power down
Compiler options has to be changed in order to compute
the literal block address correctly.

Some literals must be declared explicitly and loaded
indirectly to make sure that compiler does not optimize
the out to another shared region.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-11-22 20:42:10 +00:00
Paul Olaru 100621d422 platform: imx8: Remove all references to SSP clock
The i.MX8 platform doesn't have an SSP clock. We had a fake define for
this platform due to prior inflexibility in SOF itself. Now that said
lack of flexibility is gone, this patch removes all such references.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-22 18:32:33 +00:00
Paul Olaru ee9283c159 sof: lib: notifier: Do not break build on platforms without CLK_SSP
Some platforms do not have a SSP clock, so a dummy define for CLK_SSP
and related macros shouldn't be required to exist in order for the
firmware to build.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-22 18:32:33 +00:00
Karol Trzcinski fcf6c8c416 trace: Use uncached memory in trace_point and panic
It didn't work correctly if multiple cores write to "sw regs"
 allocated on the same cache line.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-22 14:16:33 +00:00
Tomasz Lauda b2f088789d dw-dma: enable channel linear link position
Enables DW-DMA channel linear link position counter based
on the selected peripheral connection. It can be used
to retrieve timestamping information on platforms supporting it.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-22 14:09:16 +00:00
Tomasz Lauda d343039093 shim: cleanup and extend GPDMA shim registers
Cleanups definitions of GPDMA shim registers for all cAVS platforms
and extends them by adding support for channel linear link position
control register.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-22 14:09:16 +00:00
Karol Trzcinski 714859d925 trace: use trace_point instead of platform_* in boot_loader.c
After disabling tracing code have compilation error because of
implicit declaration of platform_trace_point function.
After calling through trace_point it is replaced with empty
define after disabling trace.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-22 09:45:58 +00:00
Paul Olaru 9b5dc8c6ef sof: Align interrupt stacks
Xtensa ABI requires the stack to always be aligned to a multiple of 16
bytes. This commit aligns the stacks used for interrupt handling.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-21 16:45:33 +02:00
Janusz Jankowski a25d50eb64 clk: platform agnostic clocks
Create abstract interface for clocks and move platform specific
clocks code to platform folders.
It was also necessary to move SSP clocks declarations to
SSP driver code to decouple clocks logic from mandatory
SSP clocks.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-21 14:38:28 +00:00
Lech Betlej 07444f4b78 Remove doxygen warnings during documentation generation
The changes fix command unbalanced groupings and remove discrepancy
between parameters in function declaration & definition of
set_power_gate_for_memory_address_range() function.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-11-21 14:34:26 +00:00
Paul Olaru 0e1efdfaad platform: imx: Enable WAITI_DELAY
The description says that any LX6 Xtensa architecture revision DSP
should have this enabled, and the particular DSP in the i.MX8 does fit
this description.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-20 10:47:09 +00:00
Slawomir Blauciak c7b914dd14 ipc: channel map structures and api
This change adds stream map and channel map structures
used for channel re-routing and stream aggregation.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2019-11-20 10:44:51 +00:00
Tomasz Lauda e3ba648de0 pipeline: schedule pipelines separately
This patch enables separate scheduling of connected
pipelines. It allows for different scheduling periods
between connected pipelines and flexible controlling
of such topologies.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda f42ddc06fd ll_schedule_domain: use pipeline_task in DMA domains
Uses pipeline_task in DMA domains to check, if tasks should be even
registered on interrupts. Non registrable tasks are the one,
whose pipelines are not the owners of scheduling component e.g.
host pipelines connected to mixer pipeline. Such tasks are still
added to the scheduler's list and executed, but they are driven
by the pipelines with scheduling component.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda 5ead758e24 pipeline: use pipeline_task
Initializes and uses pipeline_task instead of regular task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda 3de6844497 task: add pipeline_task
Adds definition of pipeline_task. It's a task type registered
by pipelines and used in DMA scheduling domains.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda 5dca048ed6 schedule: remove SOF_SCHEDULE_FLAG_SYNC/ASYNC flags
Removes SOF_SCHEDULE_FLAG_SYNC and SOF_SCHEDULE_FLAG_ASYNC.
They are no longer used nor needed.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda 6ffcd61c19 ll_schedule: use domain property instead of sync/async flags
Changes ll scheduler implementation to use synchronous property
of domain to check if given task should be scheduled synchronously
or asynchronously. It makes sense, since it's heavily dependent
on particular domain functionality.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda 95ba01ebd2 ll_schedule_domain: add synchronous field
Adds new synchronous field to indicate if tasks registered
to this domain should be scheduled synchronously or asynchronously.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda d9aecd8498 ll_schedule_domain: describe structure
Describes ll_schedule_domain structure.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda b734091d63 ll_schedule_domain: pass task during unregistration
Changes domain_unregister operation to also receive task
being unregistered.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Tomasz Lauda cb5506f0b9 pipeline: cleanup header file
Removes unused pipeline_schedule() declaration and
not needed inclusion of task header.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-19 10:56:15 +00:00
Paul Olaru 1613f10689 drivers: imx: interrupt: Change how the cascade IRQ template is defined
Instead of taking the name from an array of strings (which is allowed by
GCC) I compose the name directly inside the IRQSTR_CASCADE_TMPL_DECL
macro. GCC is able to detect that the name is a compile time constant
and allows the old code, XCC does not and requires this change.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-19 11:15:16 +02:00
Paul Olaru aee8e0553a drivers: imx: edma: Make soff and doff signed
This allows the SGN macro to no longer generate a warning on the "-1"
case and thus allows building with XCC. GCC doesn't seem to care about
this one. No actual change in the logic itself.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-19 11:15:16 +02:00
Paul Olaru aa293bbe21 drivers: imx: esai: Remove PADC bit from rx configuration
PADC means to have ESAI pad samples with zeros instead of sign-extending
them when they are smaller than the (32-bit) container. This doesn't
make senseon capture and indeed that specific bit is hardware reserved.
So don't use it.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Paul Olaru 205b079253 drivers: imx: esai: Various cleanups
Generally comment cleanups but also moving the "|" operator to be at
the end so that the various options in dai_update_bits are aligned.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Paul Olaru d28278808a drivers: imx: esai: Set configurations for capture
The configurations will be mostly similar to those used for playback,
but while the ESAI is master on playback it must be slave on capture
as a workaround due to hardware limitations. These differences must be
hardcoded due to the topology not specifying these configurations for
each direction of the link.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Paul Olaru e17aa44c30 drivers: imx: edma: Correctly compute available data size on capture
Currently this just returned a zero and wasn't able to correctly
interpret the direction of the channel.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Paul Olaru ea6060c9ca drivers: imx: edma: Store direction from config into the channel data
This direction is to be used later.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Paul Olaru fa6206d47c platform: imx: dai: Get the direction from the component instead of the IPC
The direction was already configured correctly in the component during
dai_new, and the IPC data is shared for both instances of the DAI
component (playback and capture).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-18 11:06:06 +00:00
Bartosz Kokoszko 655d077f72 spinlock: spin_try_lock refinement
Use block expression instead of do {} while(0) macro
in spin_try_lock in order to return its value in a
safer way.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-15 14:17:01 +00:00
Jerome Laclavere f004d11f30 drivers : interrupt: alignment of cascaded IRQs
The base irq of the first created cascaded struct is currently equal to
PLATFORM_IRQ_HW_NUM, which is 32 on HIFI4.

On IMX platform the number of children per such a struct is equal to 64
(as per IMX steer IRQ mapping).

Since steer irq in range [0-63] are not routed to the DSP on IMX8 it is
possible to create the cascaded structs only from 64.

Starting them from 32 creates a bias in the management of interrupts,
making the storing of the irq-handlers un-natural and complicated.

This commit wants to replace the initialization of cascade_root.last_irq
by a new constant PLATFORM_IRQ_FIRST_CHILD which would be defined at
platform level.

In the case of IMX it takes value 0, while in all other platform it takes
the value PLATFORM_IRQ_HW_NUM in order to keep things as they are.

Signed-off-by: Jerome Laclavere <jerome.laclavere@nxp.com>
2019-11-14 16:36:49 +02:00
Seppo Ingalsuo decd206460 SRC: Fix pointer arithmetic in circular buffer wrap functions
The previously used cast of pointer to size_t (unsigned int)
has worked but it's horrible way to do it. Cast to uint8_t *
should be clean portable code.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-13 14:48:42 +00:00
Bartosz Kokoszko 835d876b90 component: add min_sink/source_bytes to comp_dev struct
Add two parameters to comp_dev struct in order to allow
configuration of the component processing variable frames.
Added parameters are:
- min_sink_bytes - min free sink buffer size measure in bytes
  required to run component's processing;
- min_source_bytes - amount of data measured in bytes
  available at source buffer required to component's
  processing.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-12 16:29:34 +00:00
Guido Roncarolo 778095e36c drivers: imx: sai: configure frame_bytes from format
Configure frame_bytes from topology format

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-12 16:40:30 +02:00
Guido Roncarolo 645e0aaaa8 drivers: imx: sai: correct clock divider
For stereo playback correct divider is 0x7

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-12 16:40:30 +02:00
Seppo Ingalsuo b27b21a865 EQ IIR: Code style fixes for trace prints
This patch contains maintenance for module traces. Some redundant
traces are removed and some new traces with useful information are
added, especially if they are related to an error with configuration
request. The long trace strings are shortened to and split to
several lines at numbers print when possible.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-11 16:10:43 +00:00
Seppo Ingalsuo d80ed44790 EQ IIR: Add support for response reconfigure during streaming
This patch adds capability to equalizer to switch response during
audio playback or capture. The glitches are minimized by check
and apply of the filter configuration before each copy()
operation.

The existing only halfway implemented SOF_CTRL_CMD_ENUM for quick
stored presets switching during streaming is removed for now
since there is no driver support.

The internal code cleanup includes extract of two functions from
eq_iir_setup() for check and initialize of coefficients and
initialize of filter delay lines. It helps to better understand
the setup flow.

The extrapolation of channels to response assign map is changed
to use previous channel response instead of first if the stream
contains more channels than the response definition. The
procedure was changed to avoid a code static analysis issue. The
behavior is not specified so this simpler way was chosen.

To minimize number of duplicated functions in generic and HiFi3
version a new module iir_generic.c is created for the filter
core. After the change iir.c contains only the common code for
both implementations.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-11 16:10:43 +00:00
Janusz Jankowski 1d92e8e175 sof: use RELATIVE_FILE instead of __FILE__
Use RELATIVE_FILE because __FILE__ makes binary output
dependent on project location.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-11 12:50:30 +00:00
Karol Trzcinski 2f8fb81495 kconfig: kpb: 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 405b6034d3 kconfig: mixer: 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 7003c1fb4e kconfig: keyword: 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 662e70964f kconfig: dai: 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 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