Commit Graph

5381 Commits

Author SHA1 Message Date
Mohana Datta Yelugoti d9fea08a24 tools: testbench: check if pointer is null before accessing it
Check if a pointer is NULL before accessing it, else, it leads
to segmentation fault.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Mohana Datta Yelugoti 8737e0b726 tools: tplg_parser: free allocated memory to avoid memory leaks
When an error is occurred when loading the widget, the memory
allocated is not freed properly. This results in memory leaks.
Avoid these memory leaks by freeing the allocated memory before
exiting the function by returning error value.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Mohana Datta Yelugoti b1dec44124 tools: testbench: initialize pointer before freeing it
When we try to free a pointer which is not initialized, we are
using a value in the program which is undefined. So, initialize
the pointer variable, so that in future, when we free the pointer
it won't cause a problem.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Karol Trzcinski 369e9e3b5a ssp: Debug ssp_empty_tx_fifo()
This function should wait to transmission last element from FIFO,
what is indicated in SSSR and SSCR3 registers.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-04 11:07:52 +01:00
Marcin Rajwa ae7b911956 topology: fix playback & capture pipelines to be timer driven
This patch fixes several pipelines which are DMA driven by default
but should be driven in timer domain.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-08-03 21:57:27 +01:00
Artur Kloniecki 238cd1457d treewide: Remove references to .free and .avail members of audio_stream.
All audio_stream clients should use provided audio_stream_get_avail*/free*
API, instead of directly accessing .avail and .free member fields.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-08-03 21:53:14 +01:00
Bard Liao 7b8eec9f4f topology: add tgl-rt711-rt1316-rt714 support
tgl-rt711-rt1316-rt714 is almost the same as tgl-rt711-rt1308-rt715 and
can use the same topology file.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2020-08-03 21:11:51 +01:00
Sathyanarayana Nujella 091daf65c6 topology: Update sof-tgl-max98373-rt5682 to take amp SSP ID
Update sof-tgl-max98373-rt5682 to take speaker amp's SSP ID as input.
This is to accommodate DUT's which has amp connected on SSP2.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
2020-08-03 21:11:04 +01:00
Marc Herbert c74c29f920 README.md: remove misleading "Prerequisites" and "Build Instructions"
The "Prerequisites" and "Build Instructions" sections are dangerously
incomplete: they don't say a word about toolchains. Someone on gitter
just wondered why they don't work. sof-docs is the reference now and
lucky us that's already the first thing at the top of the file so keep
that. Remove these two sections so their build commands stop tempting
readers to skip the link to the unfortunately longer but necessary
sof-docs instructions.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-31 19:07:19 +02:00
Keyon Jie 66316d35be host-dma: only do DMA L1 exit when data is copied
Exiting the DMA L1 state, e.g. on a timer tick when there is no data to
copy, prevents the system from staying in S0ix power states. To extend
S0ix residency, this L1 exit needs to happen only after data copied.

Register host DMA usage when there is real data to be copied, for both
timer scheduled and DMA interrupt scheduled cases.

Add a l1_exit_needed field to hda_chan_data, to indicate if L1 exit is
needed at LL scheduler post run. Release the host DMA usage at the post
run notifier callback, to perform the DMA L1 exit when needed.

With these changes applied, the S0ix residency will be extended, and
only performing the DMA L1 exit at LL scheduler post run will preserve
the optimization of the low MCPS usage at the same time.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-07-31 12:42:09 +02:00
Karol Trzcinski 814dc46075 audio_stream: eq_fir: eq_iir: src: Remove audio_stream_copy_s16/s32()
Those functions do nothing more than audio_stream_copy(), so after
change source code will be little shorter without overhelming
pass-through function switch in processing components.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-31 11:35:44 +02:00
Karol Trzcinski 7cfd2187c5 eq_fir: Spell fix
Pass-trough -> Pass-through

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-31 11:35:44 +02:00
Karol Trzcinski f34d9ba928 audio_stream: Calculate sample size inside audio_stream_copy function
Sample size is related with frame format, which is saved inside
audio_stream, so this value can be easily calculated inside
audio_stream_copy function. This approach allows to delete
functions like audio_stream_copy_s16/s32 and functions related
to them, then code will be shorter and cleaner.

Moreover in future, during compressed stream implementation, there
won't be need to add new copy function implementation for compressed
streams, it will be sufficient to return 1 in audio_stream_sample_bytes()
for non-pcm formats, then sample calculation will be equal to number
of bytes and generic function like copy shoudn't have any trouble to
handle such a data type.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-31 11:35:44 +02:00
Karol Trzcinski af136e0325 pcm_converter: Fix chunk size calculation in linear converter
Variable N1, N2, and chunk are compared to each other, so must be
in the same format - samples, because of possible different sample
size in source and sink buffer.
Use bitshift operations instead of division, to optimize source code.
It's possible because sample size must be power of two.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-30 13:35:41 +02:00
Keyon Jie 21573f449a cAVS: pm_runtime: change to use bool flag to denote the DSP target state
Remove the usage of refcount dsp_d0_sref, and use bool flag dsp_d0 to
denote is the DSP target state is D0 or D0ix (Low power mode).

This will simplify the logic of use of LPS and clock switching.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-07-30 10:56:54 +02:00
Pierre-Louis Bossart 1b49c6a05b Revert "schedule: edf: cycles budget"
This reverts commit e003afe582.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-29 15:50:42 -05:00
Pierre-Louis Bossart 3d4e658afa Revert "drivers: cavs: set budget for IPC task"
This reverts commit e8dc076f7a.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-29 15:50:42 -05:00
Pierre-Louis Bossart 28c3fd7428 Revert "idc: set budget for IDC task"
This reverts commit 443319a718.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-29 15:50:42 -05:00
Julien Olivain 7390933a63 drivers: imx: sdma: rewrite C99 for loops as C90
When compiling with Xtensa Tools xt-xcc, fixes the compilation error:

  sof/src/drivers/imx/sdma.c: In function ‘sdma_register_init’:
  sof/src/drivers/imx/sdma.c:192: error: ‘for’ loop initial declaration used outside C99 mode
  sof/src/drivers/imx/sdma.c:195: error: redefinition of ‘i’
  sof/src/drivers/imx/sdma.c:192: error: previous definition of ‘i’ was here
  sof/src/drivers/imx/sdma.c:195: error: ‘for’ loop initial declaration used outside C99 mode

This patch simply rewrite loops as C90 "for" loops declaring "int i"
outside the loop.

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-07-29 08:30:14 +03:00
Karol Trzcinski 131f0d4f17 dma: Use generic function to update read/write pointers in stream
Usage of function from audio_stream component updates avail/free
fields. Moreover using generic function helps in maintaining code.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 21:16:27 +02:00
Karol Trzcinski 87574da19e dma: Remove redundant sink/source bytes parameter from dma_buffer_copy*
This value is strictly correlated with given samples number,
passing sink/source bytes number as separate parameter may
lead to data desynchronization.
Temporary number of samples and sink_bytes is calculated in
dma_buffer_copy_*() function, but it should be removed in
future. 'process' should be modified to take only number of
bytes to process from source stream and return number of
output bytes in sink stream, to allow easily handling of
compressed audio streams.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 21:16:27 +02:00
Karol Trzcinski 6ac8e1f2f8 host: Assign dma_stream params
Each audio_stream should have set valid metadata information.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 21:16:27 +02:00
Karol Trzcinski 0e837079fe smart_amp: Invalidate feedback component before use
Without this path, read status might be incorrect in situation
when smart_amp component is in shared memory region but feedback
component is not - component state value will be outdated.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski 55c3eafca8 pipeline: Writeback cache after component connection
When connecting components on different cores, then writeback is
needed to keep data synchronized. It is especially important for
components like smart_amp, because of copy source buffer address
to private data set, so without writeback this value may be
incorrect in prepare function.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski f1ceb6305b component: Writeback cache after status change
Component like mux checks component state in every copy_call,
so when running mux and connected component on another cores,
then status writeback is needed.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski dc5e7681de component: Add functions to component invalidate and writeback
For platfoms with cached memory, there should be dedicated API
for memory handling in component.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski 770215762e smart_amp: Properly handle buffer data invalidation and writeback
It's important to keep data synchronised, otherwise cashed values
may by used instead corred values.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski ff89639f36 smart_amp: Fix memory handling in prepare function
Without source buffer invalidation before read, outdated
data may be fetched in situation when source_buff is inter core
buffer. Also feedback buffer needs to be writeback after edit,
to synchronise data in inter core processing.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski e963c54f0d smart_amp: Set rate in feedback channel
Each audio stream should have assigned valid data description,
like channel number, data format and data rate. It's especially
important for audio streams used to connect two arbitrary
components together, because of them may need this information,
what leads to unpredicted errors.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Karol Trzcinski 5702b77200 smart_amp: Release feedback buffer when unused
Each code path should unlock locked components, otherwise
lock system won't work correctly.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-28 16:02:02 +02:00
Liam Girdwood 1c53b8e9dd arch: xtensa: idc: dont use xtos structs for zephyr.
Zephyr will provide it's own per core data in place of the xtos data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 22:00:22 +01:00
Liam Girdwood 74cacc3138 zephyr: ipc: dont enable DMA trace transport.
Zephyr trace does not yet support DMA transport. This will be reverted once
DMA trace is enabled on zephyr. In the mean time enable all the trace
infrastructure in preparedness.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 21:57:49 +01:00
Andrei Emeltchenko 5642e6ab26 zephyr: haswell: Split initialization
Split initialization for haswell zephyr support similar to CAVS.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-07-24 21:57:49 +01:00
Andrei Emeltchenko e126f81953 zephyr: baytrail: Split initialization
Split initialization for baytrail zephyr support similar to CAVS.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-07-24 21:57:49 +01:00
Liam Girdwood cf8e35f860 zephyr: init: create a zephyr entry point in SOF.
Zephyr already uses main() and has already performed a lot of init prior
to entering SOF. Make sure no HW init is repeated.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 21:57:49 +01:00
Andy Ross fd506970cc zephyr: kconfig: rename CONFIG_SMP -> CONFIG_MULTICORE
This kconfig collides with one of the same name in Zephyr.  Rename it
for clarity ("MULTICORE" was picked for symmetry with the existing
"CORE_COUNT", though it's admittedly a little long...).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-24 19:55:05 +01:00
Liam Girdwood 1cdff03f93 dma: dw: make sure all DONE bits are cleared in LLI
Some bits being missed due to cache coherency. This showed on
on Zephyr due to different cache/uncahe mappings and management.

On Zephyr we invalidate all descripts, clear all DONE bits and write
back. This guarantees all DONE bits are clear for nex LLI.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 12:07:18 +01:00
Liam Girdwood 099a187438 dma: dw: improve debug for buffer IO.
Trace buffer positions in verbose mode.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 12:07:18 +01:00
Liam Girdwood 2a70f114bc dai: trace: fix description for overrun error.
Overruns are when there is no free space available.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 12:07:18 +01:00
Liam Girdwood 61a2c75bf8 dma: dw: fix locking and calculations in dw_dma_get_data_size
No unlock on xrun and missing either avail/free depedning on direction
and xrun.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 12:07:18 +01:00
Liam Girdwood b1ea2051f0 zephyr: numbers: MIN/MAX INT already defined in Zephyr
Some macros are duplicated between SOF and Zephyr meaning we need
to undefine them in the short term until Zephyr and SOF can align
fully.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 12:03:24 +01:00
Liam Girdwood 6b0efa7004 trace: ipc: fix gcc unused variable warning when trace disabled.
Already declared on line 57

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 11:46:13 +01:00
Liam Girdwood 0f77541b26 build: elif statement has no conditional.
Looks like was never compiled ?

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 11:46:13 +01:00
Liam Girdwood eb9851c4b1 zephyr: lps_wait: Fix build on Zephyr by declaring memcpy_s
Fixes build for zephyr. TODO: memcpy_s() header inluces other
generic calls duplicated and colliding in Zephyr hence will need
to separate out in order to include correct header.

Define it locally atm.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 11:46:13 +01:00
Liam Girdwood 1cb190850b platform: cavs: Add sideband-ipc.h as include.
Fixes build for zephyr.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-24 11:46:13 +01:00
Liam Girdwood 44a65d850b components: ut: all components should be declared UT_STATIC
Zephyr build fails without this atm, but also needed for testbench.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-23 15:38:55 +01:00
Andrei Emeltchenko 8b2359b210 zephyr: Update README to add instruction for debug loggin on qmeu
Mention using LOG_BACKEND_XTENSA_SIM backend for console.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-07-23 14:58:25 +01:00
Mohana Datta Yelugoti 9f1106d8a5 testbench: add null pointer check for function argument
tb_pipeline_params() function takes an argument called ipc_pipe,
which is a pointer and is derefernced in the function to access
a member of structure that pointer is pointing to.

If this pointer is NULL, this leads to Segmentation fault. A
null pointer check is added before the argument is dereferenced.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-07-23 14:28:26 +01:00
Liam Girdwood 41e62eb4ba dmic: irq: removed unneeded code.
irq_enable/disable should be doing the unmasking and masking.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-07-23 14:17:28 +01:00
Karol Trzcinski 60211b3d70 dai: Remove frame_fmt from private data
This value is one of audio_stream property, so should be
saved in this place to keep data synchronised, and allow
to usage generic function working on audio_stream, like
stream converters.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-23 12:14:06 +02:00