Commit Graph

6760 Commits

Author SHA1 Message Date
Bard Liao 297b893dae intel: ssp: introduce ssp_set/release_mclk/bclk helpers to set/release mclk/bclk
MCLK and BCLK can be set/release separately. We can set/release mclk/bclk
more flexible with these helpers.

The helpers are defined after the Linux ones, 'prepare_enable' will
first select the relevant resources then enable the clock
output. Conversely 'disable_unprepare' will stop the clock output then
release the clock resources.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2021-07-06 17:12:30 +01:00
Bard Liao bdd8881301 ipc: dai-intel: add SOF_DAI_INTEL_SSP_CLKCTRL_MCLK/BCLK_ES bits
Add two clks_control bits. MCLK and/or BCLK will start during hw_params
and stop during hw_free if the corresponding bit is set.

This is tagged as a ABI 3.19 change.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2021-07-06 17:12:30 +01:00
Pierre-Louis Bossart 7ff5290554 ipc: dai: add flags for DAI_CONFIG IPC
The DAI_CONFIG IPC is currently used both for hw_params and
hw_free. For some DAIs, there are hacky ways with e.g. invalid DMA
channels to indicate a hw_free. Rather than adding a new IPC for
hw_params and hw_free, let's add a flag that indicates if the
DAI_CONFIG is really applied during a hw_params or hw_free stage.

This is tagged as a ABI 3.19 change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-07-06 17:12:30 +01:00
Pierre-Louis Bossart b4febf1779 intel: ssp: fix missing return code on bclk configuration issue
when the bclk is not based on the default source, we will thrown an
error message but return the result of the mclk configuration.

Fix by adding an explicit -EINVAL return value.

Reported-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-07-06 17:12:30 +01:00
Guennadi Liakhovetski 5796bf7eeb zephyr: switch LL scheduler to native timing API
Use the native Zephyr timing API for LL scheduling.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-06 15:10:43 +01:00
Guennadi Liakhovetski 2ece18ff7e ll-scheduler: remove unused Zephyr code
SOF under Zephyr has switched over to a separate LL scheduler, this
code isn't used any longer, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-06 15:10:43 +01:00
Guennadi Liakhovetski 0ae3b13a48 Revert "pipeline: dont disable IRQs around pipeline scheduling."
This reverts commit af6655e7fa.
That commit removed disabling interrupts in
pipeline_schedule_triggered() which is usually fine, except if an
xrun happens during pipeline_schedule_copy() which then removes the
task from the scheduler list, it then leads to a DSP exception in
pipeline_schedule_copy() is called for the next pipeline in the list.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-06 15:10:43 +01:00
Marc Herbert 223c20acbe Fix !CONFIG_TRACE again, broken when adding mtrace_printf()
Fixes commit 50eb5c9ca2 ("trace.c: add mtrace_printf() low-level
shortcut")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-06 13:34:10 +01:00
Marc Herbert ef03e727db smex: un-hardcode "-O2 -g", use CMAKE_BUILD_TYPE, default to Debug
Anyone having a performance issue can use the standard
-DCMAKE_BUILD_TYPE=Release. Crashes seem more common.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-06 13:18:46 +01:00
Marc Herbert 46ddb38159 smex: use strerror()
Before:

  error: unable to open sof.elf for reading: 2

After:

  error: unable to open sof.elf for reading: No such file or directory

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-06 13:18:46 +01:00
Marc Herbert 53ebd8abd0 smex: fix crash in elf_free_module() when input file not found
fclose() seems to require a valid argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-06 13:18:46 +01:00
Iuliana Prodan 4c06d00084 zephyr: wrapper: include arch/xtensa/cache.h if CONFIG_KERNEL_COHERENCE not set
When building SOF with Zephyr, for i.MX, we get the following
error: undefined reference to `z_xtensa_cache_inv'.

i.MX has only one DSP core, so CONFIG_KERNEL_COHERENCE is not set.

Therefore include arch/xtensa/cache.h, where z_xtensa_cache_inv
is defined and implemented, in cases when the kernel is not built in
a mode where all shared data is placed in uncached memory.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 34bb9b7282 zephyr: wrapper: build SOF with Zephyr for imx
When building SOF with Zephyr for i.MX the following
additional adjustments, to the wrapper, are required:
1. include heapmem variable in .heap_mem section,
otherwise the HEAP_SIZE is duplicated in two sections and
the sdram0 region overflows;
2. no need to split heap into shared and unshared since
we only have 1 DSP core; In this case, the kernel will
never be built in a mode where all shared data is placed
in multiprocessor-coherent (generally "uncached") memory.
3. use simple interrupt_get_irq() to get the Linux interrupt
and later pass it to irq_steer;
4. use Xtensa timer, as we do now with SOF and XTOS.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 7d2f621f36 zephyr: imx: use zephyr utilities when enabled
Use the Zephyr sys/util.h when Zephyr RTOS is used.

While here, remove sof/lib/cpu.h which is not used.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 4e8743f76f zephyr: imx: split initialization
Zephyr already uses main() and has already performed
a lot of initialization before entering SOF.
Split initialization, for i.MX platforms, to make sure
no operation is repeated.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 894f28fbda zephyr: build: add initial support for imx
Build SOF with Zephyr for i.MX platforms.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Marcin Rajwa e05fbff7c6 codec_adapter: cadence: get init_done status on prepare
This patch adds init_done status check at the very end of
cadence_codec_prepare() function. This is needed to know if
codec is fully prepared for the processing or not. Note we don't
do anything with the value read at prepare, we postpone final
verification until copy/process time since some codec variants
require input in order to finish its initialization.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa fcb93569f0 codec_adapter: cadence: change reset procedure
This patch simplifies reset procedure of cadence codecs
by only calling the init_process() function in which
XA_CMD_TYPE_INIT_PROCESS is the API call responsible for
the actual reset of codec parameters.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa efe26a26c1 codec_adapter: generic: simplify reset procedure
After the reset codec should not need to be prepared again.
We want reset procedure to just set all the parameters to their
default values.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa d2b188e4c1 codec_adapter: generic: fix comments
This patch fixes wrong comment in generic processing function.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Guennadi Liakhovetski a439ea93f6 zephyr: ll-schedule: switch over to a simplified implementation
Switch SOF under Zephyr to use a simplified native low-latency
scheduler implementation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski 83f86defa4 zephyr: ll-domain: make semaphore per-core
Currently a global semaphore is used to signal all schedulers on all
cores, waiting for the next timer period. A more reliable solution is
using a per-core semaphore. This patch switched over to that
approach.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski a1c5183aa9 zephyr: ll_schedule: support no-return in domain_unregister()
Under Zephyr LL scheduling is implemented by per-core threads. They
are spawned when the first task on that core is scheduled. When the
last task on that core is completed, the thread is terminated, which
can happen in context of that very thread. This patch adapts the
generic LL scheduler code and the Zephyr LL domain scheduler for
that by making sure to call thread termination in a consistent state.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski d2409a233d zephyr: ll-domain: stay within the zephyr_* namespace
zephyr_domain.c is a drop-in replacement for timer_domain.c. To avoid
modifying initialisation code we used the same timer_domain_init()
name for its initialisation function. However, the rest of the file
uses the zephyr_domain_* namespace. Rename the function to stay
within the same namespace and use a macro to redirect the call.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski 91a5e63d47 zephyr: ll-domain: update .next_tick on each timer interrupt
.next_tick has to be initialised at domain registration and updated
on each scheduling domain event.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski a971f85c1a zephyr: ll-domain: fix domain unregistration
When the .domain_unregister() method is called, .total_num_tasks is
still positive, it will only become 0 for the last task after
.domain_unregister() returns. When cleaning up also set the user
pointer to NULL.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski f9e07679b9 schedule: remove an unused "period" parameter
When registering scheduling domains period is never used, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Pierre-Louis Bossart a0f789dfc6 topology: cavs-nocodec: temporarily fix jsl-nocodec issues with s24le
For some reason s32le does not work for DAI definitions on JSL-NOCODEC
platforms. alsa-bat tests fail, but they work fine on APL, CNL,
TGL. This is likely to be an ICL platform issue. The root cause is
still TBD

Use s24le for now to unlock Intel daily tests.
All other platforms remain with s32le.

BugLink: https://github.com/thesofproject/sof/issues/4427
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-07-01 13:31:57 -05:00
Ranjani Sridharan e1b1fed3b2 Revert "pipeline/buffer: alloc them in the runtime shared zone"
Revert these for now. Will be fixed with other multi-core fixes.

This reverts commit 928dba0853.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-01 12:24:15 +01:00
Kai Vehmanen db36db4778 cavs: memory: unify access macros on Zephyr
With Zephyr linker scripts updated on all cAVS platforms, we can now
unify uncache_to_cache() and cached_to_uncache() implementation in
Zephyr builds.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-30 19:14:47 +01:00
Marc Herbert 02c21c25ba dma-trace.c: use new mtrace_printf() to demote FW ABI banner to INFO
... down from ERROR. It was never an error, this was a hack to be
duplicated to both trace and etrace. This will make it easier to search
for actual errors.

Also make the banners slightly different between etrace and trace thanks
to new SHM: and DMA: prefixes. This makes identification of log files
easier.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 1a7c0056a2 dma-trace.c: use new mtrace_printf() to add some error handling
Replace some tr_err() too.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 50eb5c9ca2 trace.c: add mtrace_printf() low-level shortcut
Direct access to mbox shared memory logging when DMA tracing is
either not initialized yet or disabled or found broken for any
reason.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 532642bb32 timer.h: add platform_safe_get_time(timer) and use it in trace.c
Returns a small constant instead of crashing platform_timer_get() when
timer is NULL.

This is required to restore early tracing before sof->timer is
initialized.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 3674c0f113 trace.c: mtrace_event: fix memcpy_s( dest_size ) argument
Found by chance while looking for something else.

This makes no difference right now because we checked the "length" in
the line immediately before but let's do the right thing anyway, at the
very least it's more readable.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert a0743971c9 check patch: turn off printk warnings
Zephyr's printk does not work like Linuxs printk

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Li-Yu Yu 0c21218b37 comp: Free model_handler in error paths during create
Add matching comp_data_blob_handler_free calls for
comp_data_blob_handler_new in error paths, which are
missing in many components' "new" functions.

Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2021-06-29 23:05:42 +01:00
Marc Herbert c194125b83 zephyr: add notifier_register(ipc_send_queued_msg) in task_main_start()
Fixes #4356

In XTOS SOF, ipc_send_queued_msg() is run by task_main_primary_core(),
the initialization of which has a hard and circular dependency with the
initialization of the EDF scheduler. This EDF scheduler is not part of
Zephyr. Because of the circular dependency it does not seem
possible (nor desirable?) to refactor this code and make it compatible
with Zephyr. So schedule ipc_send_queued_msg() differently in Zephyr:
using a notifier triggered by the periodic Low Latency scheduler.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:04:04 +01:00
Marc Herbert cf3a7d1604 notifier.h: document the API
... and rename some parameter names.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:04:04 +01:00
Zhang Keqiao 130bffa6a9 topology: add tgl-h nocodec topology build
add the TGL-H nocodec topology for zephyr test.

Signed-off-by: Zhang Keqiao <keqiao.zhang@intel.com>
2021-06-29 22:51:10 +01:00
Kai Vehmanen 8633d5fd6d cavs: pm: improve PM_RUNTIME_HOST_DMA_L1 documentation
Reword doxygen comments and change the private helper function
names to better reflect the actual implementation. No functional
change.

The PM_RUNTIME_HOST_DMA_L1 resource is used to coordinate host DMA
users, so that DMI link is kept in L1 until all users are ready to
activate the link. This is a bit unusual usage of runtime-pm interface
in that a 'put on a resource' triggers transition to higher power state,
so this deserves some more documentation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-29 22:49:50 +01:00
Brent Lu 8c863f43af topology: sof-glk-cs42l42: using 24-bit sample depth on SSP2
Changing sample depth of SSP2 to 24 bits for better dynamic range.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-06-29 22:41:08 +01:00
Liam Girdwood eb7add5135 testbench: add a option for specifying the number of copy() iterations
All the user to specify the number of copies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood b8d6760600 testbench: fix crash when file has no . extension
Testbench crashed when a in/out file has not . extension. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 305223a1f6 testbench: free components and pipeline after test results.
Move the comp free to after the results and free the pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 777c0008c1 testbench: add more helpful output for options parsing.
Lets be more helpful to the user.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood bc10ba8b76 testbench: squash some valgrind warnings.
Buffer and params not initialised to zero like the other IPC structures
used by testbench. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 1ab68bfc00 mocks: enable allocator tests in host mocks with valgrind
This enables support for running the allocator mocks with valgrind by
building the allocator for the host library target using a similar
heap map to Intel CAVS targets (memory.c is almost identical copy of CAVS
version).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:02 +01:00
Liam Girdwood c1f0f7068e pipeline: add heap trace to pipeline_new()
Balance the heap status with the existing pipeline_free() heap debug.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:02 +01:00
Marc Herbert 24a6159cb2 apollolake/memory.h: sort regions table comment by address
This makes it possible to match the table with the definitions.

Pure comment change, no code change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 09:25:19 +01:00