Fix HSW handler so that it checks host_pending flag and aligns with
BYT IPC handler wrt trace messages.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fill all available stack dump space with frames if available and update
any panic code to include passed value.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Initialise DMA trace prior to platform initialisation so that more users
may use trace as part of init.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
dma trace fix
Change the panic code is stack has been smashed. This allows platform
specific handlers to send new panic code to host if stack is smashed.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On some platforms(e.g. APL, CNL), the external timer(wall clock)
uses the external interrupt bits, here change the common timer
logic to call interrupt APIs, which give a chance to handle for
different cases.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Improve the output from panic to include DSP registers and stack dump.
Export panic codes to UAPI for host driver logging.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch fixes the overlap between heap buffer and stack. The macro
for calculation missed the data size that caused heap to become too large.
Compilation of sof with xt-xcc triggers this issue in rimage and causes
image build fail.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reduce the number of conditional build statements for gateway by moving
gateway code into fewer conditional build sections.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
We may have irq to modify buffer when are modifing the buffer.
Add the spin lock to make modify atomic.
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This patch fixes the volume mute/unmute logic in volume
to handle cases when volume is already muted/unmuted
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
For host with gateway, we need create extra dma_sg_elem *
period_count for hd->config.element_list, and free them
at host_reset() time, otherwise, the hd->local elements
may be broken if we use them for config.element_list.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
DW-DMA is more optimal using 32bit data size when transferring between
memories. Set configuration to always use 32 bit mode for non peripheral
copies from memory to memory.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
All GPDMA share the same irq on cannonlake, this is different with
appololake.The change is:probe GPDMA array when initilized, set the
array to the irq function; check the interrupt status of GPDMA array
in irq function, process the correct GPDMA that produces interrupt.
Signed-off-by: Rander Wang <rander.wang@intel.com>
Add a host and link DMA driver for Intel HDA DMA gateway.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Fix the dma not stop issue for using Hardware Link List mode.
Only enable it for APL/CNL at the moment.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Host GW DMA has no callback so host component has to manually notify
DMA driver when to copy each period.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Let clients know if they can expect a callback from DMA.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Allow clients to request a particular DMA channel if supported by the DMA
driver and it's available. If requested channel is not supported by DMAC
then return another channel. If requested channel is not free then we
return an error.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Some DMACs have an array of register elements to config and control
DMA channels. Provide a mapping here so that FW can easily calculate
the correct channel offset.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This API allows clients to manually inform the DMAC when they need more
data copied. The DMAC can then copy the desired amount of data.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
For dai component, it's frame_fmt may be different with host,
we usually configure it from topology, here fix it.
Contributor: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Due to misplaced parentheses the computation gives half of correct
result and omits rounding. Currently this macro is not used by code
in SOF git repository. Developers who may use format.h macros should
check their code.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
For hardware link list mode, we also need to configure address
and config registers for the first link list, here fix it.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
On Apollolake, the interrupt number for different channels of
the same controller are different, here add implementation of
it: register interrupt handler for each channel, and don't
need check channel in its specific handler anymore.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This patch provides library build support for host platform architecture.
It enables creating separate libraries for each SOF audio component.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add a support for a secondary boot loader than cant be used to bootstrap
multiple firmware modules.
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Apollolake has reset vector in ROM and some other changes that need
configured after reset.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Apollolake and Cannonlake have some register differences in DW-DMA HW.
Add macros to support those differences.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Allow interrupts to have a parent and child relationship in order to
support nested interrupts between different HW interrupt controllers.
This patch allows child handler to be registered for secondary interrupt
controllers and allow multiple child interrupt sources to share a single
interrupt pin.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Haswell and Broadwell have some differences with some DMA registers.
Add macros for these bits.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Coverity issue: 254842 Uninitialized scalar variable
The variable will contain an arbitrary value left from earlier
computations.
In parse_page_descriptors: Use of an uninitialized variable (CWE-457)
The elem.src variable is not initialized, but in
dma_trace_host_buffer() the code reads this initialized value.
Break
*e = *elem;
in
e->dest = elem->dest;
e->size = elem->size;
to only access relevant fields.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This patch updates the pointer cast in host/dai for library build
support for 64-bit arch
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Explicitly comment that the fall through in a switch case is not
a typo to make Coverity warnings go away.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
We don't need set host buffer size in each sg_elem, instead,
we can set it only one time, here set it in params().
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Make install/dist were missing some headers files and dirs. Add them and
make sure version generation works for building from the dist directory
where there is no git versioning information available.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Only compile dma-trace.c when BUILD_DMA_TRACE is true.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Acked-by: Yan Wang <yan.wang@linux.intel.com>
CONFIG_DMA_TRACE is selected by default. But we should
not do dma trace when CONFIG_DMA_TRACE is not selected
(--disable-dma-trace is added to configure command line),
here add this judgement to fix compiling issue for that
dma trace is not selected.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Acked-by: Yan Wang <yan.wang@linux.intel.com>
The DAI and host components states must be preserved during pause so that
when normal pipeline positions are used on resume. i.e. pause just looks
like a very long pipeline schedule.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The circular trace buffer can overflow if too much trace data is sent
before it can schedule a DMA copy to flush the data. This overflow
causes the avail bytes counter to be greater than the buffer size and
means the DMA copy is rescheduled until avail is 0 (repeating old data).
Fix this by resetting avail to 0 when we overflow.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The DAI and host components states must be preserved during pause so that
when normal pipeline positions are used on resume. i.e. pause just looks
like a very long pipeline schedule.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fix so that dump stack does not overwrite any debug data and does not
read past the end of the stack.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Initialise the SA during platform init and then notify SA of idle in the
main audio loop.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add a simple system monitoring agent that can detect when FW does not
execute correctly. The assumption is that FW will always idle from time
to time and this idling can be monitored by the SA. The FW wont idle if
it's thrashing, continually interrupted, continually running work or
continually rescheduling a task.
The SA will emit trace and panic if idle is not entered for a specific time
period.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fix so that dump stack does not overwrite any debug data and does not
read past the end of the stack.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch changes the condition for limiting the smallest gain to
eliminate a never executed code part when VOL_MIN is defined as zero. The
variable v is unsigned integer so less than zero is not possible.
The functionality is not modified by this patch.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes the condition for limiting the smallest gain to
eliminate a never executed code part when VOL_MIN is defined as zero. The
variable v is unsigned integer so less than zero is not possible.
The functionality is not modified by this patch.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This variable is set by the return value of dma_copy_to_host_nowait().
Unsigned type will mislead error checking.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
This variable is set by the return value of dma_copy_to_host_nowait().
Unsigned type will mislead error checking.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
Add a debug option that can detect deadlock and panic(). The deadlock
detection attempts to acquire a lock several times before giving up
and causing a panic() taht dumps the deadlock details.
Signed-off-by: Liam Girdwwod <liam.r.girdwood@linux.intel.com>
Add a debug option that can detect deadlock and panic(). The deadlock
detection attempts to acquire a lock several times before giving up
and causing a panic() taht dumps the deadlock details.
Signed-off-by: Liam Girdwwod <liam.r.girdwood@linux.intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
Move it from ipc handler into platform_init().
It should be placed after IPC and DMAC initialization.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
Replace the user-defined MAX and MIN values for 32-bit and 16-bit
with standard INTN_MAX/INTN_MIN macro
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This reverts commit 97addafa10.
git bisect tells me this is the source of IPC timeouts, 100% reproducible
[ 162.496099] sof-audio sof-audio: error: ipc timed out for 0x90010000 size 0x18
[ 162.496590] sof-audio sof-audio: error: cant set params for DMA for Trace-110
[ 162.496636] sof-audio sof-audio: error: failed to initialize trace -110
[ 162.808132] sof-audio sof-audio: error: ipc timed out for 0x30010000 size 0x3c
The same errors were also reported by Sven Schwermer on the mailing list
on a Tangier device, revert until we figure out what's wrong.
Cc: Sven Schwermer <sven@svenschwermer.de>
Cc: Yan Wang <yan.wang@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
SSP 0,1,2 on CHT share the same physical IRQ as SSP 3,4,5 respectively.
Fix this so that all SSPs IRQs are supported.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The previous patch for SOF updated component IPC commands and provided an
ABI for configuration and control. This patch updates the IIR equalizer
to use such controls.
Also the missing COMP_STATE_READY from method new() is added. Lack of it
caused pipeline prepare fail.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The previous patch for SOF updated component IPC commands and provided an
ABI for configuration and control. This patch updates the FIR equalizer
to use such controls.
Also the missing COMP_STATE_READY from method new() is added. Lack of it
caused pipeline prepare fail.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The control interface is fixed to follow the component ABI. Separate tone
generator instances are used to feed individual channels. It allows
simultaneous testing of all channels by use of different tone frequencies.
To simplify features there is no mixer so e.g. DTMF telephony UI sounds
generation would need a channel mixer component after a two channel tone
output in the pipeline.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Due to previous patch the volume mute is updated to be controlled with
SOF_CTRL_CMD_SWITCH that maps to ALSA switch style control. Mute for a
channel is set with an (unsigned) value larger than zero. Zero value
unmutes the channel.
In both mute and volume set code the if statement to compare component
channel map is changed to compare to chanv[j].channel instead of used
chanv[j].value that looks incorrect.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to struct sof_ipc_ctrl_data three new commands
SOF_CTRL_CMD_ENUM, SOF_CTRL_CMD_SWITCH, and SOF_CTRL_CMD_BINARY. In
addition an index parameter is added to address various features or
registers.
Commands SOF_CTRL_CMD_ROUTE, SOF_CTRL_CMD_SRC, SOF_CTRL_CMD_LOOPBACK,
SOF_CTRL_CMD_EQ_SWITCH, SOF_CTRL_CMD_EQ_CONFIG, SOF_CTRL_CMD_MUTE, and
SOF_CTRL_CMD_UNMUTE are removed.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes the sample rate conversion processing to use a single
multi-channel filter instead of per channel called mono filter instances.
The filter output is now rounded with 1/2 LSB add. The polyphase filter
input input block sizes are multiplied in SRC initialization to reach
near to or exacly the period length to reduce polyphase filter call
overhead.
The polyphase filter is now called via function pointer for more
flexibility with audio data formats. Currently S32_LE and S24_4LE are
supported.
Code cleanup includes removal of redundant variables and some debug
print code.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1. Move source and header file.
2. Change src/lib/Makefile.am and src/audio/Makefile.am.
3. Chnage header file path.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
This patch fixes the DC offsets introduced in the volume component
due to shifts and handles sign extension for 24-bit input samples
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add a simple trace method to output lock users and detect any sleeping
during atomic context. The intention is to provide simple trace data
that can be used to pinpoint any deadlocks or attempts to sleep whilst
atomic.
Future: The trace output in that patch can be improved to provide easier
lookup for lock users rather than line numbers.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Execution should never return from do_task(). Dump stack in the panic
if we do return here.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add support for DMA trace to run in atomic and IRQ contexts. Currently
DMA trace would sleep between DMA copies and enter atomic state when
inserting new tarce data into the trace buffer.
This patch adds new DMA _nowait() APIs that dont sleep and _atomic() APIs
for trace logging that can be safely called in atomic context.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fix locking in DMA trace. Also run the DMA trace as delayed work so
we dont block callers. Refactor API so that DMAC and channel are
pre-allocated.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
DMA trace must be run from a work context and not from any atomic
context as it waits on DMA completion IRQs.
Check the host and local buffers for wrap.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1. Ignore DMA trace event when forwarding for avoiding dead lock
because DMA tracing uses DMA API to copy trace event.
2. Add _trace_error() API to send error event by mail box at the same
time too when copying error event by DMA.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
1. Change trace data coping API for current trace event data including
64-bit timestamp.
2. Remove trace event of DMA tracing for avoiding dead lock.
3. If DMA tracing is ready, send event data when the data size is
half full or the DMA tracing buffer arrive at the end. Otherwise,
overwrite the data directly.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
Block on DMA completion for stop/pause to serialise IPC with host.
i.e. new host IPC is queued until DMA completes.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The reload handling code has 3 outcomes that are better represented in
a switch statement. Remove unreachable if statement too.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Make sure we check all component state transitions and report any errors
to trace by calling comp_set_state().
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
comp fixup
SSP can either be in paused or prepared state during stream pause
depending on the state of the other SSP data direction. Make sure this
is taken into account.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch decouples the first and second stage in two phase conversion
that is used for out/in rate fractions with high numerator or denominator
value. For e.g. 44.1 -> 48 kHz 160/147 fraction the 1st 8/7 stage and
2nd 20/21 stage are executed number of times close to period length in
time used for the scheduling rate. The number of consumed and produced
samples per copy() is no more constant. The latency of 44.1 kHz is
decreased about 2 ms and processing load is less variable.
This patch removes mute feature due to non-compatibility with variable
length data processing. It can be introduced later if needed as different
implementation.
The polyphase filter is also optimized slightly. More optimizations will
follow.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Current timer has been upgraded to 64-bit but work queue utility
still uses 32-bit.
So timer->hitime can't be added rightly because the 64-bit time
is truncated by work queue utility.
"rmbox" will still receive 32-bit timestamp value only and can't
be upgraded to 64-bit timestamp.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
Before the 1st rollover, timer->hitimeout = 0, it will cause
platform_timer_64_handler() set timeout = 1.
So the time irq is forced to be fired at the beginning of rollover.
And the timeout of platform_timer_set() will be invalid and work
queue cannot be fired.
Just set the new hitimeout to timer->hitimeout.
timer->hitime will be added in the next rollover.
It is unnecessary to check timer->hitimout > 0.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
This patch fixes the warning messages shown with gcc option -Wextra. The
source and sink buffer pointers advance is moved from filter function to
higher level copy function as update consume/produce parameter.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Make remaining region translation APIs static inline to avoid
unused function errors.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
gcc -Wall is not enough, add -Wmissing-prototypes to align with
kernel warnings.
Add relevant includes and move functions without prototype as static
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Last test would always evaluate as true, refactor to fold equal and
less than case as one
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA-C:2012, 15.4 - There should be no more than one break or goto
statement used to terminate any iteration statement
reshuffle the code to use a single break
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA-C:2012, 15.4 - There should be no more than one break or goto
statement used to terminate any iteration statement
reshuffle the code to use a single break with no additional tests.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Make static analysis warnings go away and comply with MISRA rules:
the final clause of a switch statement shall be the default case
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
MISRA C++:2008, 8.0.1 and CERT-DCL52-J require that one variable per
declaration.
Change tree-wide, keeping variables in the initial order (except
when it was obviously better to change).
No functional change. The Tensilica HAL remains as is as it should
be modified separately
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The IIR equalizer configure and control is updated to use the new
component ABI. In addition there are checks added to protect IIR
equalizer from invalid setup.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The FIR equalizer configure and control is updated to use the new
component ABI. Checks are added to protect equalizer from invalid
setup. Also an unused parameter is removed from fir_init_delay()
function.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds the code to check the generic ABI header fields and reject
data with invalid header. The individual components those use ABI need
to check the component specific fields in addition.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to component volume S24_4LE to S24_4LE processing. The
macro from audio/format.h is used to compute shifts needed for product.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
pipeline completion should check for valid pipeline status and return
any errors for invalid status (like already completed pipelines).
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch adds flexible field "data" to struct sof_abi_hdr to be used
to pass binary data via ABI.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds a define of 32 bit integer that equals to ASCII
string "SOF\0" to be used in checking for correct magic number in
binary data. The char type for the magic is changed to uint32_t for
simpler comparison.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch fixes the trace class and renames the macro to match module
name. Note that some trace patches are related to other changes data
and cannot be separated to this patch.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>