Commit Graph

375 Commits

Author SHA1 Message Date
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
Liam Girdwood 1aded4f4a6 volume: fix frame bytes calculation.
Currently frame bytes is calculated as period bytes. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-16 10:32:10 +00:00
Liam Girdwood a1e35a2148 lock: debug: Improve and document lock debug trace output.
Make it easy to find deadlocks and lock holders in atomic and non
atomic contexts.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-15 21:15:51 +00:00
Liam Girdwood c43989b95a ipc: buffer: Add HDA stream tag to stream parameters.
Add the HDA stream tag to the IPC stream parameters.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-15 21:15:34 +00:00
Keyon Jie 57be70b31d scheduler: ignore the ignored tasks
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-11-15 20:49:50 +00:00
Seppo Ingalsuo 1b5c3ecce9 Volume: Remove channels mapping via channel map array from volume control
This patch removes the channel map table lookup from all volume control
since it is not used by the SOF 1.0 driver. Instead of enum channel
descriptors the channels are addressed with indices in
0..<number of channels -1> range.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-11-15 20:44:45 +00:00
Pierre-Louis Bossart b8fd49af3a ssp: clean-up register setup
Clean-up register configurations for SSCR0..5, SSPSP, SFIFOTT

The results are ok in I2S and LEFT_J 24 bits
Tested with RT5645 and DA7212

TODO:
1. fix 16 bit issue (right channel lost)
2. test DSP modes
3. connect SSP and DMA watermarks

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-11-15 20:35:20 +00:00
Pierre-Louis Bossart f945809917 sof: fix spelling mistakes in comments
M-x ispell-comments-and-strings
:set spell spelllang=en_us

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-11-10 16:45:35 +00:00
Pierre-Louis Bossart 95a7e13fa2 dma: dw: reorder register definitions by sequential address
Cosmetic change, for some reason the register definition was not
sequential as in the data sheet

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-11-10 15:30:24 +00:00
Pierre-Louis Bossart df1de7a0a4 sof: protect macro parameters
Make sure all macro parameters are protected with parentheses to avoid
unintended expansion issues

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-11-10 15:30:24 +00:00
Keyon Jie 69f3029c8a dw-dma: fix element might be used uninitialized issue
The dma_sg_elem might be used uninitialized if the callback
function forget to do that.

Here adding initialization to fix that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-11-10 15:30:24 +00:00
Yan Wang 9155f50c03 Fix DMA host offset calculation and wrapper condition checking.
1. "size" should not be considered twice.
2. Change host_offset to uint32_t type.
3. size = min(hsize, lsize), so it is unncessary to check ">"
for wrap local and host buffer.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-11-10 15:30:24 +00:00
Yan Wang eb2af44172 Send IPC message of DMA trace host update in DMA complete callback.
It is called every time DMA completes.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-11-10 15:30:24 +00:00