When built under Zephyr the wrong format generates a compiler
warning:
modules/audio/sof/zephyr/include/sof/trace/trace.h:35:11: warning: \
format '%d' expects argument of type 'int', but argument 3 has \
type 'uint64_t'
Since native SOF tracing cannot print 64-bit data, only print the
low 32 bits of the time interval.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
If one of the "if" branches contains a jump instruction like "goto,"
"return," "break" etc. usually making that the only "if" branch
simplifies the code. Fix one such case in schedule_ll_task().
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Several code paths use the existing clock_ms_to_ticks() function in
some not ideal ways, potentially leading to computation overhead or
to precision loss. The function is often called to calculate ticks
for 1 millisecond, which then is recalculated to the required time
interval. It's better to let the function calculate the number of
ticks for the required time interval directly. E.g. instead of
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * milliseconds
it's better to call
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, milliseconds)
directly. For microseconds however replacing
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * microseconds / 1000
with
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, microseconds / 1000)
can lead to a loss of precision. To avoid that a new function
clock_us_to_ticks() is added.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
We have some commands that fail to check the component's pipeline
pointer before running the command which results in various null pointer
dereferences across the codebase. Solution is to copy existing checks
and patch the code paths.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Use the Zephyr sys/printk.h when Zephyr RTOS is used.
Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
To roll back SSP clock setting to original one.
igo_nr now support 48k-in-48-out and the entire pipeline
DMIC_PIPELINE_48k is reverted back to 48k too.
Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
The Zephyr linker scripts for cavs20/25 do not map sections
on uncached RAM, so the memory accesses to uncached memory will
fail. This shows up as a DSP panic while loading initial topology.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add static inline for math sin() and cos()
functions.This PR is just moving existing code to
improve runtime performance due to less function calls
Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
Currently the DAI HW configuration is tightly bound to the IPC major
version and IPC structures. Provide a mechanism whereby different
IPC data structures can be passed for DAI configuration.
This change does the following changes.
1) Pass a common ipc_config_dai structure to all dai config call. This
allows retention of common logic that uses this common data.
2) Provide a IPC specific private data pointer to the dai config that
can be interpreted by the DAI as custom data. Today this is the
existing IPC, but it could also support an NHLT binary register blob in
the future.
3) Splits ipc specific code out of src/audio/dai.c and into
src/ipc/ipc3-dai.c.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Some new lines were not removed during a recent "sed" based search and
replace. Remove them now.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Replace several further "timer" name domain left-overs with zephyr
domain counterparts
- Remove useless "inline" specifier, the compiler will decide itself
- Remove the unused struct zephyr_domain::arg member
- Add delayable work cancellation when cancelling a task
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
timer_domain.c contains a lot of Zephyr- and XTOS-specific code and
relatively little common code. Aplit it into two files instead of
using a large number of #ifdef instructions.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Cordic sin cos input value range is [-2*pi to 2*pi]
and output range is [-1 to +1]
This is common function to calculate trignometric sine
and cosine using separate lookup table size for speeds
and accuracy calculation.
For 32bit sine and cosine
Error (max = 0.000000011175871), THD+N = -170.152933
For 16bit sine and cosine
Error (max = 0.000061), THD+N = -91.518584
Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
Add a proper namespace prefix to CONFIG_HW_LLI. While this
option is only used by DW-DMA driver at the moment, this is
a generic option, so remove the DW-DMA specific text from
top-level documentation.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
ASRC new() receives incorrect topology tokens values before this
fix. It occurred as pipeline DAI find fail for capture direction
ASRC.
Fixes#4193
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
... because it has definitely helped reproduce compilation issues in the
past in just two lines without going through the whole setup process,
see a list of examples in #4126.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
power_down is an assembly function that powers down memory banks.
Before that it locks the execution code and data into cache for
obvious reasons. However, for this cacheable address aliases have to
be used. Under Zephyr this code executes in a thread with a
dynamically allocated stack, which currently means, that it uses
uncached memory aliases. This leads to a memory access exception.
This patch fixes it by using a cached alias of the data.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Currently conversions between cached and uncached addresses is done
by adding or subtracting the alias offset. This is unsafe because it
cannot be done repeatedly. Setting and clearing the aliasing bit is
safe, but it cannot be used in static variable initialisations. This
patch converts conversions to bitwise operations where possible and
adds a new macro for static variable initialisation and uses it where
needed.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Lets not trust that everyone remembers to lint themselves or that they
fetch the repo in order to execute their job.
Also rename workflow file to be a bit more generic
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Fixes incomplete commit 0e60ec8da4 ("Copy sof-$platform.{ri,ldc} to
sof.{ri,ldc}"), see full rationale there. I missed the
copy/paste/diverge at the time and did it only in the MEU_SIGN case.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch moves DMIC pipeline to run on DSP core 2,
and SSP1 pipelines to run on DSP core 3 for multi-core
verification.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Zhang Keqiao <keqiao.zhang@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
When multi-core introduced, we need to use uncached address for the
global configuration variables, to make sure they are consistent for all
DSP cores.
When variables change, write through for both cached and uncached
addresses, to ensure the consistency.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This is similar with:
commit 761bbac5ac ("host: dai: limit number of bytes copied to one
period") which limits the number of copied bytes for CAPTURE direction.
This patch does the same thing for PLAYBACK direction.
We need this with codec adapter component that most of the time
will produce more than period_bytes in a period.
DAI will copy more than on period_bytes at a time and this
affects sound quality.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
When the DMIC pipeline is moved to a core other than the
primary core, the DMIC params and dmic_active_fifos are
not valid. Modify them to be shared data and handle
cache management when accessing/modifying them.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
A sequence of atomic_sub(); atomic_read() breaks atomicity. A single
atomic_sub() should be used instead.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The _memmap_cacheattr_reset linker script variable has
dedicate cache attribute for every 512M in 4GB space
1: write through
2: cache bypass
4: write back
F: invalid access
For imx, implement is_cached() based on
_memmap_cacheattr_reset.
Without this fix, when loading a topology we get:
sof-audio-of 556e8000.dsp: error: reply expected 20 got 12 bytes
sof-audio-of 556e8000.dsp: error: ipc error for 0x30010000 size 20
sof-audio-of 556e8000.dsp: error: DSP failed to add widget id 0 type 23 name : PCM0P stream Passthrough Playback 0 reply 0
sof-audio-of 556e8000.dsp: ASoC: failed to load widget PCM0P
sof-audio-of 556e8000.dsp: ASoC: topology: could not load header: -22
sof-audio-of 556e8000.dsp: error: tplg component load failed -22
sof-audio-of 556e8000.dsp: error: failed to load DSP topology -22
sof-audio-of 556e8000.dsp: ASoC: error at snd_soc_component_probe on 556e8000.dsp: -22
sof-audio-of 556e8000.dsp: ASoC: failed to probe component -22
asoc-simple-card sof-sound-wm8960: ASoC: failed to instantiate card -22
asoc-simple-card: probe of sof-sound-wm8960 failed with error -22
That's because, on mailbox_hostbox_read() we don't invalidate cache
before reading the address.
Fixes: bfe7707f37 ("cavs: disable data cache operations on uncached addresses")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
We should return error if the matching in get_stream_index() fail, add
check in the callers, stop using it and return failure when needed.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
A wrong error message was added in helper get_stream_index(), remove to
fix it.
Fixes: 80666b7cc7 ("ipc: component: abstract the component creation API")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
For speakers SDW2 link is used.
For Headset SDW0 link is used.
add sof-adl-sdw-max98373-rt5682 topology
Signed-off-by: Vamshi Krishna <vamshi.krishna.gopal@intel.com>
Add a new_target_tick to store the new target tick for the next set,
which is used during the reschedule stage.
Update the new_target_tick on tasks done on each core, and do the final
domain_set() at the point that tasks on all cores are finished.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Refinement to make the domain tasks/cores management more clear:
a. update the total_num_tasks and num_cores in the helper pair
domain_register/unregister().
b. update the enabled[core] and enabled_cores in the helper pair
domain_enable/disable().
c. for the completed task, do the domain client/task update in the new
created helper schedule_ll_task_done().
d. cleanup and remove the tasks/cores management from the ll_schedule
helpers schedule_ll_clients_enable(), schedule_ll_tasks_run(),
schedule_ll_domain_set() and schedule_ll_domain_clear().
Without those refinement, the num_clients was not used correctly,
we used it for both num_registered_cores and num_enabled_cores, with
that we observed that it may be changed to '-1' when component/pipeline
is asked for running on a slave core.
This reverts changes in 'commit b500999477 ("scheduler: guard against
subdivision underflow on domain clear")' as it is not needed anymore.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
The flag registered_cores was created to denote the number of registered
cores, but it is also used as the number of the enabled cores today.
Here add a new flag enabled_cores for the former purpose to remove the
confusion and help for the subsequent domain tasks/cores management
refinement.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Rename the 'num_clients' in struct ll_schedule_domain to 'registered_cores'
to reflect the real use of it.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add return value of domain_unregister(), which will be used for the LL
scheduler and the domain state management in the subsequent refinement.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
The timer_disable() in the timer_register() is wrong, the
interrupt_enable() calling handles the interrupt enabling already,
remove the wrong timer_disable() calling to correct it.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
A scheduler will run on a specific scheduler only, add a core index flag
to schedule_data to denote that.
To schedule or cancel a task, looking for the scheduler with correct
core index to perform the action.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>