Commit Graph

3974 Commits

Author SHA1 Message Date
Keyon Jie 6eb35e61c4 topology: pcm: add helper for creating low power Capture PCM.
Add implement PCM_CAPTURE_LP_ADD() to create low power Capture PCM,
which can run at low power status like d0i3.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-10-28 23:31:35 +01:00
Keyon Jie 9fcbd3e16a topology: add token for low power PCM.
Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can run
at low power d0i3 status or not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-10-28 23:31:35 +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
Keyon Jie aa7c73c156 scripts:xtensa-build-all: update to use 2017.8 toolchain for CNL
Let's align to use the newer 2017.8 toolchain for CNL building.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-10-25 14:57:41 +02:00
Pan Xiuli 63cd5a52a3 CI: travis: disable agent for QEMU test
QEMU boot test will random fail with agent. Disable it to make sure
QEMU boot test will not fail.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-10-25 11:06:19 +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
Pan Xiuli ffe904c9f9 CI: travis: update with matrix to hold more platforms
Use matrix to maintain build job for easy extension.
Add workaroud to QEMU test to avoid accuracy error may cause false
alarm in boot test.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-10-24 10:18:02 +02:00
Tomasz Lauda 79efa9391c topology: revert all cAVS pipelines to 2 periods
Reverts all previosly changed cAVS pipelines from 3 to 2 periods.
Now we have separate buffers for DMA, so there is no need to make
DAI buffers consist of 3 periods. DMA will take care of any internal
hardware requirements.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +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 325f5d088e topology: add mute switch with led to eq capture pipe
Add mute switch with led control to capture playback pipeline's volume
component. This will show in user space alsa controls as 1 element with
2 controls (volume and mute switch). Some user space audio software like
this a lot.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-10-23 17:30:11 +02:00
Jaska Uimonen cc517edd48 topology: add mute led support to mixer control
Add optional mute led token support to mixer control. Optional
parameters at the end of mixer control macro will add mute led tokens
and related parameters to the private data section.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-10-23 17:30:11 +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