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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Each code path should unlock locked components, otherwise
lock system won't work correctly.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
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>
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>
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>
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>
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>
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>
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>
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>