Commit Graph

437 Commits

Author SHA1 Message Date
Liam Girdwood 892ce16571 trace: dma: Help kernel and userspace detect missing trace messages.
Add message count and overflow detection to the trace position output
so that kernel and userspace can detect the trace buffer has overflowed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-19 17:27:20 +00:00
Liam Girdwood 2b86cb3e02 trace: dma: Make sure we can trace platform device initialisation.
Currently the trace initialisation must be performed after DMAC init
has completed. This means we miss the trace output from any platform
device initialisation.

Split the DMA trace initialisation into two parts so the trace buffer
is allocated early on and can accept messages meaning we dont miss any
device initialisation trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-19 17:27:01 +00:00
Liam Girdwood 1b31a13798 pipeline: docs: Add some comments to further document the pipeline core
Add more descriptive documentation to help document the pipeline core.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-19 17:21:40 +00:00
Keyon Jie 9b8e0e5fd7 dw-dma: set msize according to burst_elems setting
For memory to memory copy(burst_elems initialized to be 0),
we set msize to default value 3, that is 2 ^ 3 = 8 items for
each burst transaction.

For DMA copying which related to peripheral device(source or
destination), we will use the configured burst_elems, which
usually means the number of data items, e.g. slot number for
SSP dai fifos.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-19 11:14:26 +00:00
Keyon Jie 54e3325460 dai: set dai dma burst_elems according to slot number
We should set burst_elems for dma peripheral dev copy, for
dai/ssp, it should be set to valid slot number, otherwise,
the dma may copy in wrong burst size and data will run with
wrong speed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-19 11:14:26 +00:00
Keyon Jie 3676017be2 dw-dma: add burst_elems setting to struct dma_sg_element
We need configure different burst_elems for different dma copy, so
here introduce it to dma_sg_element struct.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-19 11:14:26 +00:00
Liam Girdwood ae8bd6059e dw-dma: trace: make sure all trace error are unique
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-17 12:33:23 +00:00
Liam Girdwood 7c2153af86 locks: Add try_lock API to attempt lock access without spinning
Add a try version to acquire a spin lock.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-13 21:58:00 +00:00
Liam Girdwood 471a47805e host: verify number of period > 0
Check number of periods is > 0 other wise return an error and emit some
trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-13 21:15:41 +00:00
Yan Wang 57d299420a Increase timeout of DMA trace work re-scheduling if local buffer is half full.
The timeout of work_reschedule_default() cannot be too short to finish
work queue rescheduling. Otherwise, the work will be rescheduled wrong
into the next timer loop.
Also change macro name of DMA trace time interval for reading easily.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-12-13 16:49:57 +00:00
Pierre-Louis Bossart c077cb31fa volume: pass format change to downstream components.
The volume component can change the sink data format depending on sink
component/pipeline topology configuration. This change is set locally,
but not to the host params that are passed downstream.

Fix this so that downstream components can check params match their
topology configuration.

Tested with test-passthrough-48k-vol-ssp2 and reef-byt-rt5651
topology files. Note that there are quite a few underflows likely added by
recent changes, more work needed to identify what goes on.

(first fix for prepare() from Liam, additional update for the params()
case by Pierre)

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-13 10:03:02 +00:00
Liam Girdwood 1824001278 dai: fix dma pointer init for passthrough pipelines.
Replace the r_ptr == w_ptr check as it was racy on the completion of the
host DMA preload. Better to check using the source component type.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-11 14:44:12 +00:00
Liam Girdwood 8d6e79a23e dai: buffer w_ptr must not equal r_ptr at playback stream start.
Upstream pipeline topology is unknown to the DAI so we must check that the
DMA r_ptr != source pipeline w_ptr for all DAI sources.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-10 20:45:04 +00:00
Liam Girdwood 771d118275 pipeline: only schedule playback streams at pipeline start.
Capture pipelines must wait for the DAI to fill one period of data
before they can be scheduled. This avoids underruning the pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-09 21:55:38 +00:00
Liam Girdwood b408ad4c88 dma: dw: write back linked list descriptors
The DMA linked list descriptors must be written back from cache so that
the DMA engine can read them.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-09 21:29:49 +00:00
Liam Girdwood 6c7c4a70e4 ipc: remove deprecated intel-ipc.h
Deprecated old ABI no longer used so can be removed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-09 21:29:49 +00:00
Liam Girdwood 9d1dfcbfc0 pipeline: make sure pipeline_down steam returns correct value
pipeline_copy down stream will return 0 instead of the component copy()
return value when an endpoint is reached. Make sure we return the
component value.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 22:41:31 +00:00
Liam Girdwood e0f65a2b82 src: return number of frames produced in copy
Return the number of frames we produce in the copy() function.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 21:52:57 +00:00
Keyon Jie 186806d11e README: correct the root-dir, which didn't work actually
Toolchain(xtensa-root) should be installed in the same layer with
the SOF repo, but maybe not in ~/source/reef/ folder.

Here correct it by using relative path.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-08 21:52:57 +00:00
Liam Girdwood 85f893f291 volume: fix xrun direction reporting
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 21:52:57 +00:00
Liam Girdwood 340b9e56db dai: prepare does not need to bzero buffers.
Already done by pipeline, but prepare still needs to write back.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 19:31:28 +00:00
Pan Xiuli 35372ea17f git-version: Fix REEF_TAG bug when having rc tags
Use git log to make sure REEF_TAG has git commit.
2017-12-07 14:27:23 +00:00
Yan Wang 1611a0adeb Add support to replace stale stream/trace position updates.
Host message queue is long sometimes. So when one new IPC message like
DMA trace host offset is pushed into, the previous same type IPC message may
haven't been sent.
For every type of IPC message, there are different comparison conditions.
So need a group of sub-finding functions to do and user also can extend them
easily based on new requirements in the future.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-12-07 12:55:24 +00:00
Keyon Jie fb784218b5 configure.ac: add CONFIG_HOST_PTABLE flag for platforms which need handle it
We only need handle host page tables on platforms that we
program DMA host buffer(addr/size) inside firmware, for
other platforms, host driver will program these settings
and won't pass in page tables.

So here add frag CONFIG_HOST_PTABLE to configure this for
different platforms, on Baytrail, Cherrytrail, we need
CONFIG_HOST_PTABLE to be selected.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-06 14:58:15 +00:00
Keyon Jie 0e42030c3c configure.ac: add CONFIG_DMA_TRACE flag for DMA trace feature
For debug reason, e.g. DMA trace doesn't work or not implemented
yet, we can use --disable-dma-trace in configure command line,
which will unset CONFIG_DMA_TRACE flag, and it will fallback
to use traditional mailbox trace instead.

The flag is set by default, if we don't add '--disable-dma-trace'
to configure command.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-12-06 14:58:09 +00:00
Seppo Ingalsuo 83b7560eaf SRC: Bug fix for issuing xru and xro errors
This patch prevents SRC to stall due to too demanding criteria of
function comp_buffer_can_copy_bytes. Since the input and output rate and
period length of SRC are different for source and sink both buffers do
not need to meet both criteria.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-12-06 11:04:57 +00:00
Yan Wang 9308679473 Use atomic API without spin lock for trace_error().
When trace_error() is used to save error information into trace buffer,
the firmware may not in normal state and some spin lock be still locked.
So it may cause dead lock if trace_error() still uses non-atomic API
with spin lock.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-12-06 07:17:16 +00:00
Pierre-Louis Bossart e666b476eb cht: clk: fix SSP / PMC IPC settings
Cherrytrail SSP settings were the same as Baytrail but the SSP root
clock is different. To use 19.2MHz the Xtal source needs to be selected

Also add definition for SSP @ 25 MHz - even if it's unlikely to ever
be used

Tested on Up board and Cyan Chromebook.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-12-06 07:17:16 +00:00
Pierre-Louis Bossart dea87a704e byt: clk: fix 38.4 MHz CPU clock support
38.4 MHz is not available, replace by 50 MHz as documented in HAS

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-12-06 07:17:16 +00:00
Yan Wang 6881d96c06 trace: dont reschedule trace if it's already in progress.
The purpose of checking half fullness is sending trace data as soon as
possible. It will avoid local DMA trace buffer full and unsent trace data
overwritten.
If DMA trace copying is running currently, it is unnecessary to checking
half fullness local DMA trace buffer.

The following is implementation details:
1. Add one flag in DMA trace data strcuture.
2. Set/unset this flag in trace_work() callback.
3. Add checking for this flag in dtrace_event().

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-12-05 21:20:06 +00:00
Seppo Ingalsuo 3805427244 SRC: Bug fix for handling a deleted conversion
This patch fixes a regression that caused SRC to try to initialize
for a mode that has been disabled from in/out rates matrix. The feature
exist to save tables RAM with modes those are not required. The bug
caused a divide by zero to happen in src_buffer_lengths() function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-12-05 20:41:23 +00:00
Liam Girdwood eaf0c0669f build: Make sure build all runs configure before make clean.
We must build the Makefile before we can clean old object files.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-05 20:36:55 +00:00
Liam Girdwood f63c7897b9 byt: use correct hifi2 EP version for BYT and CHT.
BYT and CHT have EP Hifi2 extension so enable it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-05 20:36:55 +00:00
Liam Girdwood 474d6fbf76 bvt: clk: Fix clock lookup table
Baytrail clock lookup has wrong MHz values for XTAL. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-05 20:36:55 +00:00
Liam Girdwood 8ba9ecfd00 uapi: make sure uapi headers are installed.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood 2eab467c16 configure: place AM_CONDITIONAL outside of conditional logic
Always runs AM_CONDITIONAL macros as placing inside conditional logic
can confuse autotools.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood 40bcde3c9e git-version: echo version for AC_INIT
AC_INIT needs version information for building shared libraries.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood 5f5d7c2b93 configure: reset build count every time autogen.sh is run.
autogen.sh rebuilds the build system so also reset any build count to 0.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood d78ff93a78 dma: dw-dma: dont use hard coded transfer size.
Use transfer size in SG config structure instead of hard coded values.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood c3a01f209b comp: use comp_sample_bytes() to set DMA transfer size.
Use comp_sample_bytes() to set DMA transfer size in DAI component and
comment why host always copies using word size transfers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood 094153aece comp: add API to get sample size in bytes
Add an API to get the size of an individual sample in bytes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood e6b9594d79 dma: dw-dma: release spinlock in error path
Currently not released on any configuration errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood bb5539bc5f dai: xrun: dont stop and restart DAI on XRUN recovery
In most situations the DAI should not be stopped and the restarted on XRUNs,
e.g. upstream/downstream component XRUNs. This patch will keep the DAI
running in those circumstances.

There will be a subsequent patch that will allow for stopping and
restarting the DAI for XRUN's e.g. SSP XRUNs

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood 4252c49d53 pipeline: Add XRUN state and handler within pipeline.
Add an XRUN handler to notify components that an XRUN has occurred and
to take any remedial action. The pipeline itself will handle an XRUN by
re-preparing the components and then send start again from the pipeline
source component.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood ab505276a5 comp: buffer: Fix xrun reporting
Fix the free/avail buffer calculations to make sure any overrun or underrun
is reported in trace and returned as a negative error in copy().

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood 93a52130c1 pipeline: preloader: simplify preloader by reusing pipeline copy()
Currently the preloader is bespoke and runs in the same context as
the IPC. This means some components may delay IPC and block other
components.

Reuse the existing pipeline copy() infrastructure so that the
preload is done after prepare() but before trigger() using the
same pipeline copy code on the same DSP core and context. i.e.
we preload a host buffer (for playback) and then schedule the
pipeline copy(s) after the preload IPC is done.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood 6f9a43d307 pipeline: Allow pipeline copy to be scheduled when idle for preload.
Use the new idle schedule API to schedule a pipeline copy for preload
after prepare() and before trigger(). This pipeline preload copy will
run within the same context as the regular pipeline copy.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood 88d570de06 scheduler: check for any queued task before making context switch
Minimise any context switches in the scheduler by first checking for
any queued tasks in the task list prior to changing context. If there are
no queued tasks then there is no need to context switch.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood d1e88b2847 scheduler: Allow tasks to be scheduled when DSP enters idle state
Add an API to allow tasks to be added to the scheduler task list but not
run until the DSP enters an idle state. i.e. we schedule the task as normal
but dont immediately call schedule() to schedule that task for execution
and instead wait until schedule() is next called (at the end of some other
work).

This patch also calls schedule() before entering the idle state in the main
processing loop.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Keyon Jie 14b43b369b intel-ipc: fix host ring buffer size not page aligned issue
The host ring buffer size may be not page aligned,
but the last page was utilized by host component
wrongly, which may introduce beating noise.

Here change to correct size for the last element,
which will fix the issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-11-16 15:00:30 +00:00