Commit Graph

690 Commits

Author SHA1 Message Date
Yan Wang e1604c96a3 APL/CNL: Implement host DMA setting and position update on APL/CNL.
The host DMA has the different config method:
1. Get DMA channel based on stream tag.
2. Prepare DMA elem list based on local DMA trace buffer which make
sure that one trace record data can be transferred at least.
3. Need start DMA on firmware side before trigger start on kernel side.
4. Because no DMA callback in host DMA, add position update
calling at the end of trace_work().

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-14 09:56:15 +00:00
Yan Wang df7fbb37d9 APL/CNL: Save stream tag and host buffer size from kernel driver.
It is necessary to save stream tag and host buffer size for host
DMA setting.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-14 09:56:15 +00:00
Yan Wang ef4ec1f366 APL/CNL: Implement host DMA copy in existed DMA copy API.
Get DMA channel based on stream tag when use host DMA.
Need also call different API in dma_copy_to_host_nowait().

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-14 09:56:15 +00:00
Yan Wang f5513cdfdb APL/CNL: Add stream_tag variable for saving parameter from kernel driver.
Add stream_tag variable for IPC message and DMA trace data
structure.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-14 09:56:15 +00:00
Pan Xiuli 9ec70bb523 dw-dma: Fix channel status
At the end of the DMA, we need to set the channel status into
parapre, otherwise next dma start will fail.
This will fix APL pause resume issues.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>

--
Test with:
Mininow max rt5651 and GP-MRB nocodec
SOF master: 728f1ff3e3
SOF-Tool master: 5b5bbe31e6
https://github.com/plbossart/sound/tree/topic/sof-v4.14:
fe5e29155127a717ba5ae454b4bdde99afa67723
2018-03-14 09:53:18 +00:00
Rander Wang cc421f6716 cnl: dma: refine dma interrupt processing on cnl
On cnl, all the dma share the same interrupt pin, so
all the dma controller need to be checked in interrupt
function.
2018-03-13 12:32:34 +00:00
Ranjani Sridharan c757d95c1c volume: fix volume underflows
This patch fixes the bug with volume ramp down which causes volume
to underflow causing unspecified behaviour.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2018-03-13 10:37:38 +00:00
Ranjani Sridharan fe5c842d78 library: fix host library build errors
This patch fixes the errors in host library compilation.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2018-03-13 10:21:29 +00:00
Yan Wang 14d3d18488 Use trace verbose intead of trace.
Too many trace will cause local trace buffer overflow.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-12 16:50:10 +00:00
Liam Girdwood 0e93dd516d timer: remove TIMER_AUDIO macro
Not used anywhere so delete it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-12 16:46:39 +00:00
Liam Girdwood ac894e489e hsw: timer: Use timer 1 for generic workqueue.
Timer 1 is the correct priority.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-12 16:46:28 +00:00
Liam Girdwood 0b400a2bdc hsw: timer: HSW/BDW use DSP core timers and have no ext timer.
HSW/BDW both use internal core DSP timers and dont have any external
timer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-12 12:12:13 +00:00
Ranjani Sridharan 20559967a0 volume: fix bug pertaining to volume ramp down
This patch fixes the bug in the check for terminating the volume
ramp down.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2018-03-12 12:12:11 +00:00
Pierre-Louis Bossart 26c291b88e ssp: fix inverted_frame handling for BYT and APL/CNL
inverted_frame variable should only be set in the _IF
cases

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-09 15:30:30 +00:00
Keyon Jie a92debe638 apl-ssp: fix for I2S/DSP_A/DSP_B/LEFT_J modes
Clean up SSPSP bits to make SSP output follow ALSA ASoC definition
of all I2S/DSP_A/DSP_B/LEFT_J modes.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-03-09 15:30:09 +00:00
Yan Wang 42be63b6f4 Fix channel number of CNL DMA.
The channel numbers of playback and capture are reversed on CNL.
The channel number of playback is 9.
The channel number of capture is 7.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-09 08:55:07 +00:00
Yan Wang 39838aa858 cnl: timer: Use SSP time source on CNL for workqueue.
Work queue cannot work rightly because it uses wrong timer setting.
Based on Keyon's comments, use SSP CLK intead of CPU CLK.
It is confirmed on my CNL platform.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-09 08:40:17 +00:00
Pierre-Louis Bossart 5851d164c3 clk: add missing break in switch block
Make static analyzers happy by adding a break.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-09 08:34:07 +00:00
Pierre-Louis Bossart cddc466c6b dw-dma: simplify conditional statement
detected with sonarcloud: fix pointer test and avoid
redundant evaluation of lli as always true.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-09 08:33:51 +00:00
Pierre-Louis Bossart 666770a159 volume: fix error in logical operations
Detected with sonarcloud: test evaluates as always true.
Make sure both volume and switch are handled correctly

Fixes: 43e86cab60 ('volume: fix logic for volume mute/unmute')
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-09 08:33:32 +00:00
Pierre-Louis Bossart 0ead019e1c pipeline: fix error handling
missing assignment of 'ret' variable, fix
Detected with sonarcloud.

Fixes: 4252c49d53 ('pipeline: Add XRUN state and handler within pipeline')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-09 08:31:27 +00:00
Seppo Ingalsuo 618bedeb35 SRC: Deleted tiny int16 coefficients
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Seppo Ingalsuo 787baab230 SRC: Deleted std int24 coefficients
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Seppo Ingalsuo 3b3d2a9237 SRC: Deleted small int24 coefficients
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Seppo Ingalsuo 4ed28999bd SRC: Updated 16 bit coefficients
Update due to need for subfilter lengths those are multiple of four.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Seppo Ingalsuo b3417f6aa4 SRC: Updated 32 bit coefficients
The optimization assumes that sub-filters have length that is multiple
of four. The int24 Q1.23 format filter coefficients are replaced by
int32 Q1.31 format coefficients due to better match with Xtensa HiFi2
EP and and HiFi3 fractional types.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Seppo Ingalsuo e8afa16c33 SRC: Files structure change and add Xtensa optimized versions
This patch moves generic common code to src.c/h from src_core.c/h and
places generic C optimized filter to src_generic.c. The HiFi EP
version is in src_hifi2ep.c and HiFi3 version is in src_hifi3.c. Use of
the Xtensa optimized versions require xt-xcc compiler.

The non-used SRC in/out rates query code is removed. The 24 bit
coefficients were replaced by 32 bit coefficients those are compatible
with Xtensa fractional integer types.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2018-03-09 08:18:55 +00:00
Keyon Jie 728f1ff3e3 dma: change dma transfer type to enum.
Change to use enum for dma transfer type.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-03-07 11:31:50 +00:00
Keyon Jie 3e24ac8e9f hda-dma: fix src_width and dest_width for 32 bit container case
The src_width and dest_width are configured already in Bytes,
here fix it, otherwise 24/32 bit copying with hda-dma may have
problem.

Reported-by: Zhigang Wu <zhigang.wu@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-03-07 11:01:10 +00:00
Rander Wang 680798071e cnl: ssp: fix DSP_B setting in ssp
set ssp according to DSP_B spec

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
2018-03-07 09:35:50 +00:00
Rander Wang 0857b21acb cnl: dma: refine dma probe
Probe each dma individually
2018-03-07 09:33:34 +00:00
Pierre-Louis Bossart 1a784a9311 platform: cnl: fix clock settings
25MHz is not supported, use 24MHz

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-07 09:06:11 +00:00
Pierre-Louis Bossart fafb515277 clk: fix CNL clk allocation
All other platforms use RZONE_SYS, not sure why CannonLake
should be any different.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-07 09:06:11 +00:00
Pierre-Louis Bossart 7ee7d1f723 clk: fix ApolloLake SSP clock values
24.576, not 24.0 MHz

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-03-07 09:06:11 +00:00
Keyon Jie 77ed88aa4a hda-dma: fix configure direction wrong issue
The directions configured in sg_elem are actually dma transfer type,
not playback/capture direction, here correct them.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-03-06 21:41:50 +00:00
Keyon Jie 59c57d05cb host: host-gw: only check first_copy for playback
For capture, we don't need produce empty bytes, here add
check to fix capture can't start issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2018-03-06 21:41:40 +00:00
Liam Girdwood c4492e48b7 dma-trace: fix DMA trace buffer must be DMA-able memory
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-06 15:18:37 +00:00
Liam Girdwood 1376a81f31 apl: probe all SSP ports in platform init
Fix. We must probe all our SSP ports in platform init.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-06 15:01:24 +00:00
Liam Girdwood 5972ac363d alloc: rmalloc must check other zones/pools for capabilities
rmalloc should also check the buffer heap if no capable memory can be
found in the runtime heap.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-06 14:15:32 +00:00
Pan Xiuli e92ef97834 ipc: replace ipc position update with memory window
Add memeory window for stream region. And position offset binding for
component. Replace IPC position update with memory window update.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2018-03-05 14:50:55 +00:00
Pan Xiuli aa562f81ba platform: add stream region into sof_ipc_window
Add stream region memory window into sof_ipc_window used for position
update.
For APL and CNL, we got a 1 page space for stream region.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2018-03-05 14:49:57 +00:00
Pan Xiuli be610d53f9 platform: add sof_ipc_window for byt, hsw and bdw
Add sof_ipc_window for all platforms, and add IPC send after boot
compelted. Also remove the deprecated ready window.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2018-03-05 14:49:46 +00:00
Liam Girdwood 1f6aee5a39 memory: allocator: Remove RFLAGS_NONE/USED and use caps
Dont use RFLAGS_NONE, but use the new memory capabilities flags instead.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-05 14:49:35 +00:00
Liam Girdwood c760f83100 memory: allocator: Add support for different memory types and mappings
Currently memory heap pools are statically defined in the allocator core
and don't define the capabilities of the memory in each pool.

This patch adds support for different memory capabilities so that users
can allocate memory that complies with any capability requirements for
requested memory.

The patch also moves the memory heap pool mappings to platform specific
code so that platforms can define their own mappings, support multiple
mappings and can move the mappings into different physical memory areas.
mappings

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-05 14:49:15 +00:00
Liam Girdwood 3ef88cf994 alloc: add sanity check for malformed images.
Add a sanity check to make sure that data/rodata contains expected values
otherwise this can cause unpredictable behaviour that is difficult to
later diagnose.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-03-05 14:49:04 +00:00
Yan Wang fc7dcbf141 ipc: Remove "void*" pointer of parse_page_descriptors().
Compiler cannot check the real type of "void*" pointer.
It is easy to cause pointer conversion error.
So use the pointer of element list of struct dma_sg_elem instead
of void* pointer.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-02 09:25:11 +00:00
Pan Xiuli 6fe22aa929 apl: Add text size in module info
Add total text size we used in memory mapping into module info to
help rimage build the right FW binary.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2018-03-02 09:06:30 +00:00
Rander Wang f8126f09e4 cnl: dma: fix playback failed at second time
Stop dma at the end of playback, or next time dma
is not available for playback
2018-03-02 09:03:27 +00:00
Yan Wang 1693b66bb1 Fix pointer of struct dma_trace_data.
Liam's previous patch modify the structure variable from instance to
pointer. So it is unnecessary to use "&".
This parameter of parse_page_descriptors() is "void*", so complier
doesn't find this error.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2018-03-01 12:42:03 +00:00
Rander Wang 28cb21b578 cnl: clk: correct it on cnl according to spec
Signed-off-by: Rander Wang <rander.wang@intel.com>
2018-02-28 09:24:49 +00:00
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