Commit Graph

255 Commits

Author SHA1 Message Date
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
Ranjani Sridharan ae370c111f pipeline: fixed return value from preload_downstream
This patch fixes the return value from the preload_downstream() call in
pipeline_params()

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2017-09-04 16:18:05 +01:00
Keyon Jie 14e2d8e61c alloc: Add support for allocating different types of memory from the heap
To add support for different types of heap memory, here it will:

1. add handle for RFLAGS_DMA which will allocate DMA buffer blocks
if exist;
2. refine free_block, which will free blocks of runtime heap,
general buffer heap, or dma buffer heap.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Tested-by: Zhang Keqiao <keqiao.zhang@intel.com>
2017-09-04 13:39:23 +01:00
Liam Girdwood 9f8983fceb sof: abi: Add component ABI header for host configuration
Add an ABI header to be pre-pended to all binary blobs or bespoke
component data structures that will be passed from host to DSP component
or vice versa (i.e via binary kcontrols).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-04 12:36:12 +01:00
Liam Girdwood 22ce806f58 comp: src: use buffer allocator when allocating delay lines.
delay lines are typically several kB in size so use buffer allocator.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-03 22:04:26 +01:00
Liam Girdwood b12aa0d2e6 comp: src: add validation to SRC config and runtime params.
Make sure we validate all config and params variables and complain
if there are omissions or errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-03 22:00:58 +01:00
Liam Girdwood c3148825b9 heap: byt: balance heap block size map
Balance the heap block map size out to better fit real world usage by
reducing small blocks to create extra larger blocks.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-03 21:58:04 +01:00
Liam Girdwood 854b2e518b component: data: Make component get/set data host API generic
Make the host API and IPC to set and get component runtime data and values
generic with no bespoke commands at the IPC level.

Create a generic structure that descibes the type and size of data and
whether that data is appended to the IPC message or is available to
be DMAed from host.

Update the components to use the new structure. Some components like
SRC, tone and tone still require some work to export thier ABI.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-02 23:14:02 +01:00
Seppo Ingalsuo aa62532d82 Testing: Add enums for file I/O based test components
This patch adds to ipc.h enabling for two new components to read and
write test vectors via file I/O. They are specific to test bench usage
on development computer only and are not real SOF components. This update
avoids need to edit this file for test bench build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-08-31 13:36:16 +01:00
Seppo Ingalsuo f36e74c424 Tone: Bug fixes and code cleanup
This patch fixes issues in setting up the tone generator for correct
sample rate and channels number. Component IPC was missing latest needed
changes. The buffers handling issue is fixed. Obsolete commented code is
removed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-08-31 13:17:57 +01:00
Seppo Ingalsuo 48adb1933f SRC: Remove obsolete conversion filters
These conversion filters are no more used and will be replaced later with
new. The deletion is because the stop-band spec was changed from 0.51xFs
to 0.50xFs (no intentional aliasing of transition band) so the file
names of new default high-quality filters will be with different filename.
The filter spec is appended to file name to differentiate different
bandwidth filters for same rates fraction.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-08-31 13:17:49 +01:00
Seppo Ingalsuo 28ef854d02 SRC: Bug fixes, add support for int16 coefficients, comments cleanup
This patch fixes bugs in sink and source buffers handling and adds
support for short coefficient type to save RAM in platforms with less
space such as BYT. The patch introduces also a RAM saving minimum
conversions set between 16, 44.1, and 48 kHz. A new possible rate 18.9 kHz
was added to supported rates indication bits. SRC filters quality is also
adjusted for lower default performance. The higher performance will need
>16bit coefficients usage. The larger conversion set and 32 bit
filter coefficients can be easily restored with the SRC tools in rimage.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-08-31 13:17:35 +01:00
Pierre-Louis Bossart 7e1610920f uapi: fix SOF_RATE common frequencies
Current definitions are missing 12 and 64 kHz, have
typos (11250, 22500), list a weird 40kHz and don't
have extension capabilities for non-standard rates

Before we create ABI problems with the Linux kernel, let's add all
the sampling frequencies needed before we submit stuff upstream
(the same list needs to be reflected in the kernel include/uapi)

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-08-30 22:17:49 +01:00
Liam Girdwood 6aebc6e26b drivers: ssp: Improve SSP I2S and DSP mode generation from topology.
Improve support for I2S and DSP modes alongside using topology data to
define the mode configuration. Add trace errors to reject any unsupported
configurations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-30 22:08:58 +01:00
Liam Girdwood a80e2f84cc comp: mixer: make error trace messages non verbose
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-25 21:08:07 +01:00
Liam Girdwood 50be05b950 pipeline: params: Use correct host side comp when installing params.
Some components have multiple sources/sink and the correct host side
component must be used when installing params. Make sure the correct
component is used here by tracking the previous component and passing it
to the params installation.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-25 20:15:40 +01:00
Liam Girdwood 3d640ff6af comp: dai: Verify config ib params() and be verbose about any errors
Verify the configuration in params and send any errors to host and trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-25 19:56:59 +01:00
Liam Girdwood 26e11996b6 comp: mixer: calculate frame and period bytes in params().
TODO: need to check all sources for params.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-24 22:12:25 +01:00
Liam Girdwood 0f8737e2a0 comp: volume: provie additional trace on prepare() errors
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-24 22:09:25 +01:00
Liam Girdwood 6c40c58532 ipc: make sure all messages start at 1 instead of 0 to simplify debug
Messages starting at offset 1 remove any ambiguity over whether the
message has been constructed correctly.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-24 22:06:06 +01:00
Liam Girdwood 803f33a676 comp: buffer: complain loudly if componenst try to under/over run buffers
Complain loudly in trace if we have components overruning or underruning
buffers. Components should check buffer free/avail before use.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-23 23:57:08 +01:00
Liam Girdwood 6d5723dfd6 comp: buffer: condense buffer status trace data.
Condense the buffer status data into fewer trace lines.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-23 23:55:33 +01:00
Liam Girdwood 4897246c75 ipc: component config must always be after comp header.
State this to be obvious. TODO: merge into 1 structure to enforce this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-23 23:54:15 +01:00
Liam Girdwood a68343fee8 comp: host: make sure we have enough data to copy to/from host
Perform a check in the copy() function to make sure there is enough
data to copy to/from host buffers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-23 23:52:00 +01:00
Liam Girdwood c73ff5c16d ipc: byt: remove comment
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:34:46 +01:00
Liam Girdwood b0df61d04e ipc: stream params: Add reply for stream params.
Stream params has it's own reply message so use it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:34:27 +01:00
Liam Girdwood 9ec831b137 comp: volume: use XRUN handler to report XRUNs
Use the new XRUN API to report XRUNs to host and trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:33:52 +01:00
Liam Girdwood bc83a0e147 component: xrun: Add XRUN convenience APIs for notification and trace
Add a simple convenience API to allow components to report XRUNs

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:32:21 +01:00
Liam Girdwood a1da5bcc8d pipeline: xrun: Add XRUN initial handler into pipeline
Add an XRUN handler into the pipeline to report bag overrun and underrun
from component buffers to the host. An XRUN on a component will now cause
a IPC XRUN message to each PCM interface source/sink to the component.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:31:04 +01:00
Liam Girdwood 2d5f55ca5f byt: mailbox: fix mailbox size.
4k is correct size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-22 22:24:17 +01:00
Liam Girdwood 7c43aefb6f trace: cleanup: cleanup some trace.
Simple cleanup of some trace calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-08-21 20:33:49 +01:00