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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>