Commit Graph

235 Commits

Author SHA1 Message Date
Liam Girdwood 4d5924cfc9 timer: use 64 bit timestamps
Use 64bit timestamps now that 64 bit timers are implemented.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:47 +01:00
Liam Girdwood 90880bd287 ssp: irq: fix handler comment and remove FIFO empty loop
Comment is wrong and FIFO empty not needed in IRQ handler.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:34 +01:00
Liam Girdwood c00e48f22c dai: cache: Make sure we only writeback the amount copied
The DAI IRQ hanlder was always writing back full period size even when
less data was copied. Only writeback the amount of data copied.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:10 +01:00
Keyon Jie 7754fa10b9 interrupt-map: add cpu param for REEF_IRQ generation
This will be needed for multi-core, add it here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-09-20 23:31:10 +01:00
Yan Wang fc6820eeea Add IPC processing code for DMA tracing.
1. Add processing case branch of SOF_IPC_GLB_TRACE_MSG.
2. Add processing functions for SOF_IPC_TRACE_DMA_INIT and
SOF_IPC_TRACE_DMA_PARAMS for initlizing DMA for Trace and reply host.
3. Modify page table parsing fucntion for using in both PCM streaming and
DMA tracing case.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 5aef53511f Add the implementation for DMA tracing.
1. Initialize the data structure.
    a) Create local DMA buffer for saving trace data.
    b) Initialize the tracing work handler for syatem work queue.
2. Implement local circle buffer.
    a) When the local buffer is full, empty it and reset reading/writing pointer.
3. Save the host buffer PHY addr which is parsed from IPC message. After this
config, start trace work in work queue.
4. Provide dtrace_event() for recroding trace string into local buffer.
5. Add rstrlen() utility function for getting the trace string length because
DSP side hasn't strlen().
6. Enbale trace DMA copying once every 500ms or some special cases.
    a) Schedule the tracing sending work once every 500ms.
    b) If the local buffer is half full, call trace sending immediately.
    c) When the wrting pointer will arrive iat the end of local buffer, call
    trace sending immediately.
7. Use dma_copy_to_host() function to do trace sending.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 44fc644876 Add IPC message definition for DMA tracing.
1. Add SOF_IPC_GLB_TRACE_MSG class of IPC communication.
2. Add two IPC commands for DMA tracing.
  a) SOF_IPC_TRACE_DMA_INIT is used to initilize local buffer on DSP side.
  b) SOF_IPC_TRACE_DMA_PARAMS is used to receive host DMA buffer PHY.
3. Define DMA for Trace params IPC info structure.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 05e2b6f1b9 Add DMA callback for dma_copy_to_host() and dma_copy_from_host().
It is necessary to add dma callback to set completion_t variable to notify
DMA copying is finished. Otherwise it will always enter into error handler.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Seppo Ingalsuo 887628a498 SRC: Add S24_4LE format and platform specific coefficient set
This patch adds missing S24_4LE format. Input and output format need to
be still the same. The filter coefficient set is configured in
src_config.h per platform. BYT uses a small int24 set, other use
standard int24 set. SRC wasnot unmuted by pipeline so in this version
SRC initialized to unmuted state.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Seppo Ingalsuo e81699a1ac SRC: Increase default DSP clock speed in BYT platform
As temporary fix to allow SRC to run do not drop clock frequency to
minimum after BYT platform boot is completed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Seppo Ingalsuo 2c25480a17 SRC: Add small 24bit coefficient set
This coefficient is suitable for BYT platform RAM. It provides conversions
for 8/16/24/32/44.1/48 kHz to/from 48 kHz. Coefficients are 24 bit word
length.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Seppo Ingalsuo 36a8ca3d83 SRC: Remove old coefficient set with bug
This set prevented passtrough conversions to work, e.g. 48 kHz to 48 kHz
due to a bug in table. This set is replaced with coefficients with a
profile keyword to help selecting suitable set for a platform.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Liam Girdwood 1ad337c5ba ipc: report any unknown trigger commands to trace.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:38 +01:00
Liam Girdwood 2aefb173e3 work: Add new work API calls for rescheduling work
Add support for rescheduling work with a new deadline and for scheduling
on a specific clock tick value.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:30 +01:00
Liam Girdwood da7b389af2 ssp: mask/unmask SSP IRQ sources. Make sure RWOT is always enabled
Mask Rx/Tx FIFO status IRQs and make sure RWOT is always enabled.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:23 +01:00
Liam Girdwood 9d30f25d3d ssp: set SSP FIFO levels for playback/capture
Configure FIFO levels. TODO add to topology.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:19 +01:00
Liam Girdwood d5491206ae dma: dw-dma: check DMA IRQs are cleared correctly
Reread the DMA IRQ status after clearing the IRQ source to make sure
that the IRQ has been cleared correctly.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:14 +01:00
Liam Girdwood 85233a5720 dai: reset wallclock during DAI reset()
Make sure we reset the DAI wallclock to 0 during reset()

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:11 +01:00
Liam Girdwood 92b72e093c dai: rename dai new() to remove SSP reference.
DAI driver is generic so shouldn't refer to SSP.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:04:06 +01:00
Liam Girdwood 7d00023689 ipc: validate pipeline on stream free IPC.
Make sure we have a valid pipeline for stream free IPC calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 27d354dbde ssp: Add IRQ handler to SSP port
Add an interrupt handler to slear any SSP IRQs. TODO: extend this to
report XRUNS and other errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 5b34187b24 clock: use 64 bit values when converting us to ticks
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 4ad0a66101 comp: states: align states between DAIs, DMACs and components.
Align all components, DAIs and DMACs to use the same state levels and
transitions. This simplifies DAI and DMAC components integration.

The DRAIN state has also been removed to further reduce DMAC and DAI
complexity.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 2550480f80 pipeline: copy: Only perform copy within pipeline
Don't propagate the copy into other pipelines that may have different
scheduling.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 875a5094eb pipeline: add API to cancel any pipeline work
Add an API call to allow pipelines to cancel any scheduled work.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 0c0dff1bf1 platform: byt: Add support for masking all DMACs and SSPs
Add the remaining DMACs and SSP to platform IRQ mask/unmask and clear.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 488f02d53b timer: Add support for 64 bit timers.
This patch changes the time and timeouts used by timers from a uint32_t to a
uint64_t. This means clocks can run for years before overflow.

This patch also provides a virtual high 32 bits for HW that only has
32bit timer support. i.e. the high 32 is incremented at every HW timer
overflow.

Finally the patch updates all timer users to use uint64_t timeouts.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Liam Girdwood 45984c98d3 timer: pass platform timer structure in to all platform timer calls.
Make sure we pass in our timer structure. In preparation for 64bit timers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 15:03:07 +01:00
Seppo Ingalsuo 5416229b18 SRC: Sink and source buffers handling bug fixes
This patch improves robustness to various buffering settings by adding
more check for sufficient buffers sizes vs. internal block processing
length of SRC. The resize of sink buffer is changed to allow at least
internal output block length plus one period to the buffer. The bug in
rejecting disabled SRC modes is fixed in SRC core module.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-12 16:48:28 +01:00
Ranjani Sridharan 90dfc107b7 volume: fix calculation for source/sink period bytes
This patch fixes the calculation for source/sink period_bytes to
use comp_frame_bytes().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2017-09-12 16:48:16 +01:00
Liam Girdwood 8f3c77f76e comp: volume: Add volume get callback and validate number of channels.
Add a volume get() callback alongside the set() callback. validate the
number of channels for both get/set.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-08 14:43:55 +01:00
Liam Girdwood d0adf05f8a ipc: ctrl: Add reply header to control data structure
Need to add a reply to ctrl data, since the structure can be returned
to host e.g. during kcontrol get() calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-08 14:29:48 +01:00
Liam Girdwood 3074396f6d core: make sure we emit trace errors for when returning error values.
Makes debug easier.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-08 14:28:15 +01:00
Liam Girdwood 44509242b0 comp: buffer size: Add resize support for SRC, EQ and DAI
Make SRC, EQ and DAI use the new buffer size and reset position API
calls rather than manually resetting and sizing the buffer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-07 15:34:42 +01:00
Liam Girdwood 4e3ebe9b98 comp: buffer: reject buffer size 0 requests.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-07 15:33:19 +01:00
Ranjani Sridharan 6200408cd7 comp: default function to set comp state
This patch adds a the comp_set_state() used for
the mandatory pipeline commands, START, STOP, PAUSE and RELEASE. It also
updates the cmd method in existing components to use comp_set_state().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2017-09-07 12:17:45 +01:00
Liam Girdwood a57a7b1ec8 comp: dai: drain and stop notifications come from host.
Make sure all stop/drain notification come from host and not DAI
component.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-07 11:46:38 +01:00
Liam Girdwood 158a203e96 buffer: trace: improve R/W position to trace
Make sure R/W positions are in trace. Clarify comment for buffer size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-06 23:42:14 +01:00
Liam Girdwood 1291afeaa0 comp: mixer: fix buffer position update
Buffer pointers were being updated twice. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-06 23:40:52 +01:00
Liam Girdwood 1eee57481c buffer: add new buffer management apis for component convenience
Add new APIs to allow components to easily resize, reset and clear
buffers. Update host, mixer and volume to use them.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-06 23:39:00 +01:00
Liam Girdwood 8e1e7e6dbd comp: buffer: add support for non period aligned buffers
Add support for non period aligned buffers to the buffer free/avail
calculation.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-06 23:33:29 +01:00
Seppo Ingalsuo cb3a64d3e6 SRC: Bug fix for copy period length and some init code cleanup
The error in computing block length in copy() function is fixed. It
caused SRC to use unnecessarily long blocks with some rates and fail
to execute within available buffer size. The input and output block
length is now computed in initization. Sample rates support mask bit
for 7350 Hz is removed also.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-06 21:29:53 +01:00
Liam Girdwood b1aaef8199 comp: buffer: Align trace buffer output on 2 * 16 bit shorts.
Align on shorts now that rmbox supports 32bit values in trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:53:10 +01:00
Liam Girdwood 10be4902d6 ipc: streams: add stream component ID to stream messages.
Make sure we include the stream component ID in any stream message to
the host.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:51:05 +01:00
Liam Girdwood 46be4c583d ipc: mailbox: simplify mailbox usage.
There can be some confusion over mailbox naming wrt to in/out and up/down
naming with respect to DSP or host context.

Rename the mailboxes to imply either host initiated or DSP initiated IPC
so that it's obvious to driver and FW engineers which is the correct
mailbox to use.

This change also simplifies the IPC command replies by returning 1 if
the command function creates the reply message otherwise a generic
reply is used.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:49:38 +01:00
Liam Girdwood 097e0a1947 pipeline: preload: dont return an error if preload completes
Dont return an error and emit trace errors if preload succeeds.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:42:43 +01:00
Liam Girdwood 4d5af6f8ac comp: xrun: improve trace output for xruns
Add more data for xrun trace analysis.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:39:22 +01:00
Liam Girdwood dc028171bb pipeline: XRUNs: Only transmit XRUN to host when pipeline is running.
ALSA can get confused during preload if we send an XRUN (i.e. before ALSA
has triggered).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:36:19 +01:00
Liam Girdwood b22edfdbdf pipeline: xrun: fix timestamp to use comp type instead of ID to find DAIs
Pipeline should use the comp type to find DAIs and not IDs.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:35:17 +01:00
Liam Girdwood 505a3a8335 comp: mixer: report any mixer XRUNs to pipeline.
Report any mixer underruns or overruns for each source and sink to
pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-05 23:29:56 +01:00