Commit Graph

474 Commits

Author SHA1 Message Date
Yan Wang c01584cdba Add IPC new message type and structure for sending DMA trace host offset.
It is used to update DMA trace host offset to kernel for realtime
output DMA trace.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-11-10 15:30:24 +00:00
Liam Girdwood 2a015d0df2 ipc: fix comp variable naming to match use case
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-08 16:26:57 +00:00
Yan Wang da1d49c73c Move DMA tracing intialization calling.
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>
2017-11-08 10:26:18 +00:00
Keyon Jie b791cc96a3 volume: fix 16_to_24 right channel wrong issue
The right channel was set duplicated to the left
channel, here correct it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-11-07 08:39:41 +00:00
Ranjani Sridharan caaab6c059 Replace user-defined 32-bit and 16-bit MAX and MIN values
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>
2017-11-06 11:47:45 +00:00
Pierre-Louis Bossart 8b299ceb59 Revert "Move DMA tracing intialization calling."
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>
2017-11-02 20:03:43 +00:00
Liam Girdwood 2dac794a89 cht: src: use small SRC coefficient set for CHT.
Standard set is too big for CHT memory.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-02 20:03:12 +00:00
Liam Girdwood aa66a3a52e cht: fix SSP IRQ sharing
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>
2017-11-02 19:57:14 +00:00
Seppo Ingalsuo 41075ebdec Volume, FIR EQ, IIR EQ, tone: Fix SOF_CTRL_CMD_SWITCH polarity
This patch inverts the use of switch value. A non-zero value
unmutes the audio path.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-10-30 16:39:55 +00:00
Seppo Ingalsuo 2b3f0abd15 EQ IIR: Update control IPC
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>
2017-10-20 22:12:00 +01:00
Seppo Ingalsuo 26aa4aec16 EQ FIR: Update control IPC
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>
2017-10-20 22:12:00 +01:00
Seppo Ingalsuo 7dc4fb1b7c Tone: Fix control ipc and add support for independent tones in channels
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>
2017-10-20 22:12:00 +01:00
Seppo Ingalsuo d7edf1068e Volume: Replace SOF_CTRL_CMD_MUTE/UNMUTE with SOF_CTRL_CMD_SWITCH
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>
2017-10-20 22:12:00 +01:00
Seppo Ingalsuo b32f643914 IPC: Add new enum commands and an index into control data struct
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>
2017-10-20 22:12:00 +01:00
Seppo Ingalsuo 4b007cb638 SRC: Use a multi-channel FIR core to optimize speed plus other cleanup
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>
2017-10-20 22:08:33 +01:00
Yan Wang 97addafa10 Move DMA tracing intialization calling.
Move it from ipc handler into platform_init().

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-10-20 22:03:47 +01:00
Yan Wang 0156aa6865 Move DMA tracing implementaion from src/audio to src/lib.
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>
2017-10-20 22:03:47 +01:00
Ranjani Sridharan 034b06f43a volume: fix for DC offset and handling of sign extension for 24-bit samples
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>
2017-10-20 08:54:44 +01:00
Liam Girdwood 7c16d2cd38 comp: remove unused list in struct component.
Not used so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-20 08:40:35 +01:00
Liam Girdwood 8fe770c8dd debug: locking: Add crude deadlock analysis around locks
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>
2017-10-19 17:32:42 +01:00
Liam Girdwood 60bb5741bf debug: Add debug to dump object contents at offsets in debug buffer
Allows objects to be inserted at any offset in the debug buffer for
analysis.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-19 17:28:02 +01:00
Liam Girdwood d26937b3b7 mixer: make sure mixer does not overflow sources.
Add protection to make sure we don't overflow the number of sources.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-19 17:26:53 +01:00
Liam Girdwood 3eb7a9e9d7 init: panic: dump stack if code ever returns from the main function.
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>
2017-10-19 17:26:01 +01:00
Liam Girdwood 929fd24ae6 ipc: trace: reduce number of IPC messges used to enable DMA trace
No need to 2 IPCs to enable DMA trace. Just use one IPC.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-19 17:24:43 +01:00
Liam Girdwood 3dca7b7778 trace: dma: Add atomic and nowait DMA tracing support.
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>
2017-10-19 17:18:34 +01:00
Liam Girdwood 1e5c559dd4 dma copy: trace: Fix locking with DMA trace and refactor API usage.
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>
2017-10-15 23:36:28 +01:00
Liam Girdwood 12c3df326c trace: dma: Fix locking and buffer wraps on DMA trace
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>
2017-10-13 23:16:52 +01:00
Liam Girdwood a7c6de90ac trace: use 64 bit timestamp for error trace
Make sure error trace uses 64 bit timestamps too.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-13 16:46:40 +01:00
Liam Girdwood 1f27f9dc04 scheduler: enforce locking for edf_schedule list operations
make sure our task list is protected by lock for readers and writers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-13 16:44:24 +01:00
Yan Wang 58e952db33 Forward trace event to DMA buffer.
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>
2017-10-12 22:35:28 +01:00
Yan Wang ec2ab38591 Modify API of DMA tracing for forwading trace to DMA buffer.
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>
2017-10-12 22:35:28 +01:00
Yan Wang 1c6ecd0023 Use "const char*" instead of "char*".
It is unnecessary to use "char*" for calculating string length.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-10-12 22:28:22 +01:00
Liam Girdwood a639ef098f component: host: add error trace for elem errors
Also place a TODO for future improvement.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood 5fa2fb7ca2 dma: dw: fix indentation in error path
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood 067b8ead34 comp: dai: wait for pause/stop to complete before returning.
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>
2017-10-12 16:51:04 +01:00
Liam Girdwood c47fd180b6 dma: dw: report any IRQs that are not cleared.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood 2f60b25062 dma: dw: check channel status at stop.
Report an error if channel is still active during stop.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood 2d48d47bf2 dma: dw: improve IRQ handler reload handling.
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>
2017-10-12 16:51:04 +01:00
Liam Girdwood 97dadbedde dma: dw: improve state handling in dw dma driver
Use the COMP_STATE_READY to indicate a channel has an assigned user and
ready for use.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood 6e2894faab dma: dw: fix position callback to use platform timer
Use platform timer for timestamp.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 16:51:04 +01:00
Liam Girdwood b083e58c94 component: enforce checking on component state transitions
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
2017-10-12 16:51:03 +01:00
Liam Girdwood e1f0ce26ff ssp: trail: disable DMA handling of trailing bytes
Make sure SSP does not assert FIFO requests for trailing bytes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-12 15:27:24 +01:00
Liam Girdwood 1bb7cda702 ssp: pause: fix pause/release logic
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>
2017-10-12 15:21:40 +01:00
Seppo Ingalsuo 28fafc1071 SRC: Support block sizes near or equal to period length
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>
2017-10-11 13:50:07 +01:00
Yan Wang 860292e74e Use 64-bit time instead of 32-bit time for work queue utility.
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>
2017-10-11 13:37:53 +01:00
Yan Wang 138fd825aa Fix the calculation of 64bit timeout.
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>
2017-10-09 12:20:37 +01:00
Liam Girdwood c1917ddd94 ipc: stream: add debug trace if triiger command is unknown.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-05 22:09:05 +01:00
Liam Girdwood fdf1a37d69 component: make sure we can enter the start from paused state
Fix state checking to make sure start can be entered after pause.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-10-05 22:03:21 +01:00
Seppo Ingalsuo 2a382e99a6 SRC: Fix use of int and uint types and remove unused function parameters
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>
2017-09-28 23:07:33 +01:00
Liam Girdwood 60d1bf3a33 xtensa: hal: fix build warnings
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>
2017-09-28 22:52:47 +01:00