Commit Graph

690 Commits

Author SHA1 Message Date
Liam Girdwood 760ed9df22 apl: memory: increase TEXT_SIZE by 4k
Increase APL text size by 4k to avoid segmemt collision with data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-27 16:41:40 +00:00
Liam Girdwood 2fb2a77e2c apl: memory: fix heap system base.
Text base is from TEXT_BASE and not TEXT_START

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-27 16:40:52 +00:00
Liam Girdwood 40664b3f7b xtensa: Don't re-register ECC parity handler.
ECC parity handler already defined in ROM so no need to re-register.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:38:30 +00:00
Liam Girdwood a7f853d894 hsw: trace: write trace point data to IPCX.
Panic uses IPCD

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:33:31 +00:00
Liam Girdwood b46d579367 hsw: use CPU clock for scheduler and work queue.
No external SSP timer on HSW/BDW so need to use CPU clock.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:33:21 +00:00
Liam Girdwood 89262b0f37 core: initialise clocks before work queue init.
Work queue depends on clocks.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:33:10 +00:00
Liam Girdwood 30cd5900cc hsw: use timer 3 for work queue
Timer 3 has highest priority.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:32:59 +00:00
Liam Girdwood dbc4908a5b hsw: ipc: Fix IPC handler to align with logic on BYT
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>
2018-02-26 19:32:49 +00:00
Liam Girdwood 4930014c1b hsw: clk: allocate clk data from system pool
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:32:40 +00:00
Liam Girdwood 24851d2f74 ipc: dont assume DMAC0 is always used for IPC.
Refactor so other DMACs can be used for IPC purposes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:32:31 +00:00
Liam Girdwood dcf2369e4a hsw: memory: Add space for mailbox in memmap.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:32:21 +00:00
Liam Girdwood e590c2b186 hsw: irq: Fix timer3 irq to use correct mask
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:32:11 +00:00
Liam Girdwood f1185734ab panic: fill stack space with frames.
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>
2018-02-26 19:32:01 +00:00
Liam Girdwood 36e425e2e5 dma-trace: move to earlier initialisation point
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
2018-02-26 19:31:51 +00:00
Liam Girdwood a23e246286 debug: return new panic code if stack is smashed.
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>
2018-02-26 19:30:37 +00:00
Liam Girdwood bbad6ec982 debug: stack: fix stack dump lower limit.
Don't try and dump data outside of the stack.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:30:13 +00:00
Liam Girdwood bcb8b1abeb cache: bdw: cache writeback/invalidate not needed on HSW/BDW
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-26 19:30:01 +00:00
Keyon Jie bd01001674 timer: fix external timer doesn't work issue for APL/CNL
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>
2018-02-23 09:54:47 +00:00
Liam Girdwood 884c489e80 hsw: shim: fix IPCD size to 32bit
fix IPCD data to be 32bit like the HW

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:52:43 +00:00
Liam Girdwood 8a76994b10 mailbox: use FW "register" window for exceptions and stack dumps
This window is always available at all boot stages hence is ideal for
exception data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:51:58 +00:00
Liam Girdwood e52ce68347 panic: Improve panic reporting to include DSP regs and stack dump
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>
2018-02-22 16:51:54 +00:00
Liam Girdwood 7c0557faae sram: registers: Fix panic so ROM status is not clobbered.
Make sure we dont over write any ROM status and move "register" macros
into memory.h.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:49:50 +00:00
Liam Girdwood 33baaf2c27 apl: platform: remove platform_ext_timer as it's already declared
Already declared in the platform timer queue data so reuse.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:49:37 +00:00
Liam Girdwood 3056ce5de4 apl: clk: clock data to be allocated in system heap.
Fix clock data to be allocated in the system heap like other
system init data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:49:23 +00:00
Liam Girdwood ed14595001 hsw: fix heap buffer size so it doesnt overwrite stack
buffer heap overflowed. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-22 16:49:23 +00:00
Seppo Ingalsuo 529da2cea1 BYT memory: Fix calculation of HEAP_BUFFER_SIZE
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>
2018-02-22 16:49:22 +00:00
Seppo Ingalsuo 1b0cb08896 Pipeline: Compilation fix for xt-xcc compiler
The xt-xcc compiler does not accept NULL as return value from an int
function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-02-22 16:49:22 +00:00
Tomasz Lauda 34eee5e585 cnl: Add missing host and link DMA init
CONFIG_DMA_GW is set for Cannonlake, so add host and link initialization to avoid FW crash.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-02-22 16:49:22 +00:00
Tomasz Lauda 0172f2bb53 cnl: clock: Fix the referencing out of bounds clock
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-02-22 16:44:03 +00:00
Tomasz Lauda 9d3c67e1a0 cnl: linker: Correct platform name in CNL linker script
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-02-22 16:44:03 +00:00
Liam Girdwood bf3c0f25d9 audio: host: move gateway code into less condition statements
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>
2018-02-13 15:44:56 +00:00
Liam Girdwood 511d8c0b97 hda: dma: minor cleanup of newlines
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-13 14:32:03 +00:00
Liam Girdwood 32b399c051 dai: fix spelling.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-12 15:51:20 +00:00
Pan Xiuli 62cfeadb4e sof: buffer: add spin lock for buffer consume/produce
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>
2018-02-12 15:48:31 +00:00
Ranjani Sridharan 43e86cab60 volume: fix logic for volume mute/unmute
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>
2018-02-12 15:46:21 +00:00
Liam Girdwood d6426bc305 buffer: make sure we clear buffer contents during reset.
buffer contents were not being cleared on stream reset. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-09 16:27:55 +00:00
Keyon Jie bad1261098 host: fix playback failed from second time issue
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>
2018-02-09 12:30:01 +00:00
Liam Girdwood b0f8e5d5c2 dma: dw-dma: use 32 bit words for non peripheral copies.
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>
2018-02-09 12:29:08 +00:00
Keyon Jie 1532dfdad4 apl-ssp: use external clock for APL at the moment
We only enable external Audio Cardinal 24.576MHz clock for SSP
at the moment.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-02-09 12:23:35 +00:00
Rander Wang 1edc69c7c0 dma: dw-dma: refine GPDMA on CNL
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>
2018-02-09 08:49:07 +00:00
Rander Wang 019637ab25 ipc: return msg to empty list
DSP and host communicate each other with msg. It would
exhausted without return and make ipc failed
2018-02-08 20:23:47 +00:00
Liam Girdwood b6ab4a18e7 platform: apl: update dma platform data to use HDA driver
Add the HDA driver to the DMA platform data and clean up alignment.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-02-08 17:00:37 +00:00
Keyon Jie c610c64299 dma: hda dma: Add HDA host and link DMA driver
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>
2018-02-08 17:00:37 +00:00
Keyon Jie 616f1e57ef dw-dma: enable DW_USE_HW_LLI mode for APL/CNL.
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>
2018-02-08 17:00:36 +00:00
Liam Girdwood 3600a8eab6 audio: host: Add host GW DMA support to host component.
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>
2018-02-08 17:00:36 +00:00
Liam Girdwood e9027fb0ad core: dma: add return value to DMA set callback.
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>
2018-02-08 16:45:58 +00:00
Liam Girdwood 8ae350fc4a core: dma: add requested channel to dma_channel_get()
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>
2018-02-08 16:45:43 +00:00
Liam Girdwood 9a8a9ab82b core: dma: Add channel size to DMA platform data
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>
2018-02-08 16:45:43 +00:00
Liam Girdwood fa8abe145c core: dma: Add DMA copy API.
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>
2018-02-08 16:45:43 +00:00
Rander Wang 4502765ebe ssp: add ssp support for APL and CNL
Now it supports I2S & TDM4 master mode and no MN devide used.
For 19.2M clock, 16bit 48K stream maybe need to pack to 20bit
48K.
2018-02-08 16:41:21 +00:00
Pan Xiuli 5e60d064db dai: configure its frame_fmt from topology
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>
2018-02-06 16:35:45 +00:00
Seppo Ingalsuo 359af81a8a Audio format: Bug fix for erroneous fractional multiplication macro
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>
2018-02-06 16:10:10 +00:00
Keyon Jie dde493c45b dw-dma: fix hardware link list mode
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>
2018-02-06 15:06:23 +00:00
Keyon Jie eea19e6578 dw-dma: add support for interrupt per channel
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>
2018-02-06 15:06:12 +00:00
Ranjani Sridharan 0505823b96 build: add library build support for host platform
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>
2018-01-27 16:56:10 +00:00
Liam Girdwood 17c6bcf850 build: add build support for cannonlake
Build the Intel Cannonklake platform.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:19:59 +00:00
Rander Wang 0d09139b05 ipc: cnl: Add support for IPC on cannonlake
Support IPC on Intel Cannonlake platform.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:19:59 +00:00
Rander Wang 44c7093525 arch: xtensa: Add bootloader support
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>
2018-01-23 16:19:59 +00:00
Rander Wang aa85e2c0e9 platform: Add platform drivers for cannonlake
Add platform initialisation and drivers for Intel Cannonlake platform.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:15:51 +00:00
Rander Wang 0624f66f5f platform: cnl: Add cannonlake platform headers
Add platform headers for Intel Cannonlake platform.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:15:51 +00:00
Rander Wang 07d38c563a platform: cnl: Add xtensa headers for cannonlake
Add xtensa headers for Intel Cannonlake platform

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood e4f3b643f4 arch: xtensa: Add support for apollolake
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>
2018-01-23 16:15:51 +00:00
Liam Girdwood 095c907a3f build: add build support for apollolake
Build the Intel apollolake platform.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Keyon Jie 4239d894ec ipc: apl: Add support for IPC on apollolake
Support IPC on Intel Apollolake platform.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-01-23 16:15:51 +00:00
Keyon Jie 05df022020 platform: apl: Add platform drivers for apollolake.
Add platform initialisation and drivers for Intel Apollolake platform.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-01-23 16:15:51 +00:00
Keyon Jie 59b5e8b576 platform: apl: Add apollolake platform headers.
Add platform headers for Intel Apollolake platform.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 88456f3607 platform: apl: Add xtensa headers for apollolake
Add the xtensa ISA headers for Intel Apollolake platform.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Rander Wang 9b34b4dcf1 trace: add bootloader trace point values used by bootloader
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 2104ff80d4 trace: add gaps in macros for new items
Add gaps in the platform init tarce macros to allow other items to be
inserted.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Rander Wang a86d2d7ae2 io: Add support for 16bit register IO
Enable IO with 16 bit HW.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 2b5507232e drv: dw-dma: Add support for apollolake and cannonlake platforms.
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>
2018-01-23 16:15:51 +00:00
Liam Girdwood 5481482557 build: xtensa: fix build link order for all platforms.
Some platforms had unresolved symbols when platform was linked before
core. Fix that.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 4814b98146 uapi: manifest: Add UAPI for Intel firmware manifest
Add uapi header for Intel manifest based firmware file format.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood cc9fba353e build: configure: make sure we can include C headers in assembly
Set ASSEMBLY when we are building .S files so that C headers can
be included.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 9053e0455f ipc: trace: dma_trace cant use page tables on APL/CNL
Page tables are not used by DMA trace on CNL and APL. Make sure they
are not built in.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 46f1220ddc arch: xtensa: Support wait_for_interrupt on LX6
Add LX6 version of wait_for_interrupt() as this will be needed for
cannonlake.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Keyon Jie cfdfb8129f core: irq: Add support for nested interrupts.
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>
2018-01-23 16:15:51 +00:00
Liam Girdwood efff610a50 hsw: don't include pmc header.
Not used on Haswell or Broadwell.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood 42460843ad platform: byt: move DW-DMA specific headers into DMA driver.
Lets keep all the DW-DMA register/bits in one place.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-23 16:15:51 +00:00
Liam Girdwood f198ad907c platform: hsw: Add build support for haswell and broadwell
Add build support Makefiles

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-22 12:25:12 +00:00
Liam Girdwood b5d3e7748d ipc: hsw: Add IPC support for haswell and broadwell
Add IPC support for Haswell and Broadwell platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-22 12:25:12 +00:00
Liam Girdwood ab15603984 dma: dw-dma: Add register macros macro for haswell and broadwell
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>
2018-01-22 12:25:12 +00:00
Liam Girdwood c025039d8f platform: hsw: Add platform support drivers for haswell and broadwell
Add platform support drivers an initialisation for Haswell and Broadwell.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-22 12:25:12 +00:00
Liam Girdwood 495e5d2835 platform: hsw: Add platform headers for haswell and broadwell
Add SOF platform headers for Haswell and Broadwell

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-22 12:25:12 +00:00
Liam Girdwood 21839fc028 platform: hsw: Add xtensa headers for haswell and broadwell
Add xtensa headers for Haswell and Broadwell.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-22 12:25:12 +00:00
Pierre-Louis Bossart 97e4232f7f trace: don't copy uninitialized field from dma_sw_elem parameter
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>
2018-01-22 12:25:12 +00:00
Ranjani Sridharan 8440ec3f18 host/dai: update pointer cast to support 64-bit library build
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>
2018-01-19 09:28:59 +00:00
Pierre-Louis Bossart 61b4a160af dai: add fall through comment in switch case
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>
2018-01-19 09:13:52 +00:00
Keyon Jie d7706c84c0 host: set host_size in params()
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>
2018-01-19 09:07:26 +00:00
Liam Girdwood 5383104f36 build: dist: make sure agent.h is added to make dist.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-01-11 15:21:49 +00:00
Liam Girdwood fb1f18c135 Merge tag 'v1.0.1'
v1.0.1
2018-01-11 11:40:21 +00:00
Liam Girdwood b14e852bbe build: fix install and dist build targets.
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>
2018-01-10 17:36:41 +00:00
Liam Girdwood 8c7108ae82 Merge branch '1.0-stable' 2017-12-22 16:04:34 +00:00
Keyon Jie 1a8a653af8 dma-trace: add build condition for dma trace
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>
2017-12-22 15:59:47 +00:00
Keyon Jie 3318a16455 trace: do dma trace when CONFIG_DMA_TRACE is selected
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>
2017-12-22 15:53:37 +00:00
Liam Girdwood c14a4e97f1 comp: pause: Make sure dai/host state are preserved during pause/resume
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>
2017-12-22 14:33:23 +00:00
Liam Girdwood a9e1b6c673 trace: dont resend old buffers if trace buffer overflows
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>
2017-12-22 13:29:46 +00:00
Liam Girdwood 5277acbfe1 comp: pause: Make sure dai/host state are preserved during pause/resume
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>
2017-12-21 22:09:13 +00:00
Liam Girdwood 0c9e55b6da panic: fix panic_dump_stack()
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>
2017-12-21 21:07:24 +00:00
Liam Girdwood bc73899f9a arch: add API call to get stack current pointer.
Return the current stack pointer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 21:07:24 +00:00
Liam Girdwood cb6c5fd669 platform: Add a platform workQ clock source macro
Add this macro at platform level so it can be used by others.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 21:07:24 +00:00
Liam Girdwood b7bcd47085 baytrail: panic: fix panic on baytrail.
Simplify and fix panic output on baytrail.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 21:07:24 +00:00
Liam Girdwood cf3221b362 agent: integrate system agent into idle loop.
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>
2017-12-21 17:17:26 +00:00
Liam Girdwood d163f6d970 agent: Add initial system monitoring agent.
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>
2017-12-21 17:17:26 +00:00
Liam Girdwood 8334c554fa panic: fix panic_dump_stack()
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>
2017-12-21 17:17:26 +00:00
Liam Girdwood d1c61576a5 arch: add API call to get stack current pointer.
Return the current stack pointer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 16:50:18 +00:00
Liam Girdwood 141f972672 platform: Add a platform workQ clock source macro
Add this macro at platform level so it can be used by others.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 16:19:52 +00:00
Liam Girdwood 4335929c8b baytrail: panic: fix panic on baytrail.
Simplify and fix panic output on baytrail.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-21 16:14:58 +00:00
Seppo Ingalsuo ece72b5e1a Volume: Code cleanup for minimum gain value limiting
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>
2017-12-20 10:07:56 +00:00
Seppo Ingalsuo 33b144d2fe Volume: Code cleanup for minimum gain value limiting
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>
2017-12-20 10:07:25 +00:00
Yan Wang 53976e4c38 Change type of size in trace_work() callback from uint32_t to int32_t.
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>
2017-12-20 09:09:10 +00:00
Yan Wang b7cd6ac667 Change type of size in trace_work() callback from uint32_t to int32_t.
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>
2017-12-20 09:08:57 +00:00
Liam Girdwood bd220b212f lock: Add deadlock detection.
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>
2017-12-19 19:51:47 +00:00
Liam Girdwood 24ff686d9e lock: Add deadlock detection.
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>
2017-12-19 19:51:11 +00:00
Liam Girdwood 892ce16571 trace: dma: Help kernel and userspace detect missing trace messages.
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>
2017-12-19 17:27:20 +00:00
Liam Girdwood 2b86cb3e02 trace: dma: Make sure we can trace platform device initialisation.
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>
2017-12-19 17:27:01 +00:00
Liam Girdwood 1b31a13798 pipeline: docs: Add some comments to further document the pipeline core
Add more descriptive documentation to help document the pipeline core.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-19 17:21:40 +00:00
Keyon Jie 9b8e0e5fd7 dw-dma: set msize according to burst_elems setting
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>
2017-12-19 11:14:26 +00:00
Keyon Jie 54e3325460 dai: set dai dma burst_elems according to slot number
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>
2017-12-19 11:14:26 +00:00
Keyon Jie 3676017be2 dw-dma: add burst_elems setting to struct dma_sg_element
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>
2017-12-19 11:14:26 +00:00
Liam Girdwood ae8bd6059e dw-dma: trace: make sure all trace error are unique
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-17 12:33:23 +00:00
Liam Girdwood 7c2153af86 locks: Add try_lock API to attempt lock access without spinning
Add a try version to acquire a spin lock.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-13 21:58:00 +00:00
Liam Girdwood 471a47805e host: verify number of period > 0
Check number of periods is > 0 other wise return an error and emit some
trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-13 21:15:41 +00:00
Yan Wang 57d299420a Increase timeout of DMA trace work re-scheduling if local buffer is half full.
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>
2017-12-13 16:49:57 +00:00
Pierre-Louis Bossart c077cb31fa volume: pass format change to downstream components.
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>
2017-12-13 10:03:02 +00:00
Liam Girdwood 1824001278 dai: fix dma pointer init for passthrough pipelines.
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>
2017-12-11 14:44:12 +00:00
Liam Girdwood 8d6e79a23e dai: buffer w_ptr must not equal r_ptr at playback stream start.
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>
2017-12-10 20:45:04 +00:00
Liam Girdwood 771d118275 pipeline: only schedule playback streams at pipeline start.
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>
2017-12-09 21:55:38 +00:00
Liam Girdwood b408ad4c88 dma: dw: write back linked list descriptors
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>
2017-12-09 21:29:49 +00:00
Liam Girdwood 6c7c4a70e4 ipc: remove deprecated intel-ipc.h
Deprecated old ABI no longer used so can be removed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-09 21:29:49 +00:00
Liam Girdwood 9d1dfcbfc0 pipeline: make sure pipeline_down steam returns correct value
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>
2017-12-08 22:41:31 +00:00
Liam Girdwood e0f65a2b82 src: return number of frames produced in copy
Return the number of frames we produce in the copy() function.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 21:52:57 +00:00
Liam Girdwood 85f893f291 volume: fix xrun direction reporting
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 21:52:57 +00:00
Liam Girdwood 340b9e56db dai: prepare does not need to bzero buffers.
Already done by pipeline, but prepare still needs to write back.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-08 19:31:28 +00:00
Yan Wang 1611a0adeb Add support to replace stale stream/trace position updates.
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>
2017-12-07 12:55:24 +00:00
Keyon Jie fb784218b5 configure.ac: add CONFIG_HOST_PTABLE flag for platforms which need handle it
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>
2017-12-06 14:58:15 +00:00
Keyon Jie 0e42030c3c configure.ac: add CONFIG_DMA_TRACE flag for DMA trace feature
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>
2017-12-06 14:58:09 +00:00
Seppo Ingalsuo 83b7560eaf SRC: Bug fix for issuing xru and xro errors
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>
2017-12-06 11:04:57 +00:00
Yan Wang 9308679473 Use atomic API without spin lock for trace_error().
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>
2017-12-06 07:17:16 +00:00
Pierre-Louis Bossart e666b476eb cht: clk: fix SSP / PMC IPC settings
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>
2017-12-06 07:17:16 +00:00
Pierre-Louis Bossart dea87a704e byt: clk: fix 38.4 MHz CPU clock support
38.4 MHz is not available, replace by 50 MHz as documented in HAS

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-12-06 07:17:16 +00:00
Yan Wang 6881d96c06 trace: dont reschedule trace if it's already in progress.
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>
2017-12-05 21:20:06 +00:00
Seppo Ingalsuo 3805427244 SRC: Bug fix for handling a deleted conversion
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>
2017-12-05 20:41:23 +00:00
Liam Girdwood f63c7897b9 byt: use correct hifi2 EP version for BYT and CHT.
BYT and CHT have EP Hifi2 extension so enable it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-05 20:36:55 +00:00
Liam Girdwood 474d6fbf76 bvt: clk: Fix clock lookup table
Baytrail clock lookup has wrong MHz values for XTAL. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-12-05 20:36:55 +00:00
Liam Girdwood 8ba9ecfd00 uapi: make sure uapi headers are installed.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood 2eab467c16 configure: place AM_CONDITIONAL outside of conditional logic
Always runs AM_CONDITIONAL macros as placing inside conditional logic
can confuse autotools.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-30 16:03:46 +00:00
Liam Girdwood d78ff93a78 dma: dw-dma: dont use hard coded transfer size.
Use transfer size in SG config structure instead of hard coded values.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood c3a01f209b comp: use comp_sample_bytes() to set DMA transfer size.
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood 094153aece comp: add API to get sample size in bytes
Add an API to get the size of an individual sample in bytes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood e6b9594d79 dma: dw-dma: release spinlock in error path
Currently not released on any configuration errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-17 15:57:50 +00:00
Liam Girdwood bb5539bc5f dai: xrun: dont stop and restart DAI on XRUN recovery
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood 4252c49d53 pipeline: Add XRUN state and handler within pipeline.
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood ab505276a5 comp: buffer: Fix xrun reporting
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood 93a52130c1 pipeline: preloader: simplify preloader by reusing pipeline copy()
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood 6f9a43d307 pipeline: Allow pipeline copy to be scheduled when idle for preload.
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood 88d570de06 scheduler: check for any queued task before making context switch
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>
2017-11-17 15:57:50 +00:00
Liam Girdwood d1e88b2847 scheduler: Allow tasks to be scheduled when DSP enters idle state
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>
2017-11-17 15:57:50 +00:00
Keyon Jie 14b43b369b intel-ipc: fix host ring buffer size not page aligned issue
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>
2017-11-16 15:00:30 +00:00
Liam Girdwood 1aded4f4a6 volume: fix frame bytes calculation.
Currently frame bytes is calculated as period bytes. Fix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-16 10:32:10 +00:00
Liam Girdwood a1e35a2148 lock: debug: Improve and document lock debug trace output.
Make it easy to find deadlocks and lock holders in atomic and non
atomic contexts.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-15 21:15:51 +00:00
Liam Girdwood c43989b95a ipc: buffer: Add HDA stream tag to stream parameters.
Add the HDA stream tag to the IPC stream parameters.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-11-15 21:15:34 +00:00
Keyon Jie 57be70b31d scheduler: ignore the ignored tasks
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-11-15 20:49:50 +00:00
Seppo Ingalsuo 1b5c3ecce9 Volume: Remove channels mapping via channel map array from volume control
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>
2017-11-15 20:44:45 +00:00
Pierre-Louis Bossart b8fd49af3a ssp: clean-up register setup
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>
2017-11-15 20:35:20 +00:00
Pierre-Louis Bossart f945809917 sof: fix spelling mistakes in comments
M-x ispell-comments-and-strings
:set spell spelllang=en_us

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-11-10 16:45:35 +00:00
Pierre-Louis Bossart 95a7e13fa2 dma: dw: reorder register definitions by sequential address
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>
2017-11-10 15:30:24 +00:00
Pierre-Louis Bossart df1de7a0a4 sof: protect macro parameters
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>
2017-11-10 15:30:24 +00:00
Keyon Jie 69f3029c8a dw-dma: fix element might be used uninitialized issue
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>
2017-11-10 15:30:24 +00:00
Yan Wang 9155f50c03 Fix DMA host offset calculation and wrapper condition checking.
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>
2017-11-10 15:30:24 +00:00
Yan Wang eb2af44172 Send IPC message of DMA trace host update in DMA complete callback.
It is called every time DMA completes.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-11-10 15:30:24 +00:00
Yan Wang a3c73af857 Add API to send DMA trace host offset.
Fill IPC strucure by current host offset and send it.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-11-10 15:30:24 +00:00
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
Yan Wang a9d5181621 Add header file for avoiding compiing warning.
If no this, "error: no previous prototype for XXX" will be reported.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-28 22:50:16 +01:00
Pierre-Louis Bossart d46dd3567d sof: check for missing prototypes
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>
2017-09-27 10:54:34 +01:00
Pierre-Louis Bossart 0ffc585dff ipc: remove unnecessary tests
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 090d4f4c8d wait: reduce number of nested breaks
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 66bc346267 ssp: remove unnecessary direction parameter in ssp_stop
No longer needed since we do the same thing for playback and capture

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart e079f9eb96 ssp: replace switch by if for readability
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 8f03c9ba0a volume: replace switch by if for readability
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart c3253e1d8f tone: replace switch by if for readability
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart b513a45e10 SRC: replace switch by if for readability
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 0d9fd41b3b pipeline: simplify prepare loop
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 5f6d6c8391 pipeline: add missing default case
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>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 4ccf81daff sof: define each identifier in a dedicated statement
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>
2017-09-27 10:54:23 +01:00
Liam Girdwood 8af048f914 comp: host: Add trace output for buffer size errors
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-25 12:46:11 +01:00
Seppo Ingalsuo c46d66d7a1 EQ IIR: Get filter config and response switch via ABI
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>
2017-09-25 12:44:24 +01:00
Seppo Ingalsuo 34e4dac557 EQ FIR: Get coefficients and response switch via ABI
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>
2017-09-25 12:44:24 +01:00
Seppo Ingalsuo 03e670b16a Component ABI: Check for valid ABI header for COMP_CMD_SET_DATA command
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>
2017-09-25 12:39:46 +01:00
Seppo Ingalsuo 66cf828eb7 Volume: Add 24 to 24 bit samples volume processing
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>
2017-09-25 11:33:42 +01:00
Liam Girdwood 2293403b56 comp: volume: dump trace output on format matching failure.
Emit trace data to show format matching failures for source and sink data
types.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Liam Girdwood 6506fd93d4 pipeline: pipeline_complete() now checks pipe status and return errors
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>
2017-09-23 23:06:14 +01:00
Liam Girdwood 37cb3ebfc9 alloc: remove unecessary debug trace statement
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Liam Girdwood 52177cab21 pipeline: fix timestamp for capture streams.
Make sure we timestamp upstream in capture streams

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Pierre-Louis Bossart ea44940219 ssp: add missing break in dai format switch
Support for DSP_A is obviously broken.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo f9a671b8de Component ABI: Add SOF ABI header to struct sof_ipc_ctrl_data
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo e83a4808b7 Component ABI: Add data field to struct
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>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 94cd49734c Component ABI: Magic id for uapi/abi.h
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>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 8aa14a62cb EQ IIR: Fix duplicated buffers pointers advance
This patch removes pointers advance from filters function since it was
added to copy().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 1940496e25 EQ FIR: Fix duplicated buffers pointers advance
This patch removes pointers advance from filter function since it was
added to copy.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 8725de778a EQ FIR: Minor trace bug fix
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>
2017-09-23 23:06:14 +01:00