Commit Graph

10292 Commits

Author SHA1 Message Date
Kai Vehmanen d87b5f9d0b topology2: cavs-nocodec-bt: fix bclk for loopback A2DP case
The BCLK was incorrect for the loopback (LBM) configuration
for BT A2DP (48kHz 2ch 16bit), leading to incorrect playback/capture
speed.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-05-17 19:55:29 +03:00
Bard Liao 3436ea54ab topology2: add tgl rt712 topology
Add sof-tgl-rt712 support. rt712 is a multi function codec which
shpports headset, amp, and dmic functions.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2023-05-17 07:49:52 -07:00
Laurentiu Mihalcea 1eed2128d4 schedule: zephyr_dma_domain: Move the check for registrable ppl tasks from unregister_dma_irq()
There's nothing to be done in zephyr_dma_domain_unregister() for tasks
which are not marked as registrable. Because of this there's no point in
checking if the task is registrable during unregister_dma_irq().
Instead, this check should be done at the beginning of
zephyr_dma_domain_unregister().

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-17 14:20:24 +03:00
Laurentiu Mihalcea b04f7849f9 schedule: zephyr_dma_domain: Remove duplicate check for registrable pipeline task
In the case of non-registrable pipeline tasks,
zephyr_dma_domain_register() will return before register_dma_irq() is
called so there's no point in checking if the pipeline task is
registrable in register_dma_irq(). This commit removes this unnecessary
additional check.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-17 14:20:24 +03:00
Jaska Uimonen a2944ddc51 topology2: move bt nocodecs to development
Move bluetooth nocodec topology to development and add target
for mtl.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2023-05-17 13:11:33 +03:00
Marc Herbert 179f23331e .github/sparse-zephyr: switch to newer -DZEPHYR_SCA_VARIANT=sparse
-DSPARSE=y still works but has been deprecated for a while.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:59:25 +03:00
Marc Herbert 30f4c8c972 .github/sparse-zephyr.yml: delete obsolete REAL_CC magic
This hasn't been required since Zephyr commit 91902c5fd4db ("cmake: add
sparse support to the new SCA infrastructure")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:59:25 +03:00
Marc Herbert c1ae62e32b rebuild-testbench.sh: add -j jobs option
This is required to investigate build failures. Because of the way the
build is split, a failure in one component can become totally drown in
the long build logs of another component.

Example: with -j2 the `parser_ep` build failure below is completely
drown by the long (and successful!) build logs of `sof_ep`:

```
./scripts/rebuild-testbench.sh -j 1 -p tgl

sof/tools/testbench/build_xt_testbench/sof_parser/build/include/alsa/
sound/asoc.h:196: error: expected specifier-qualifier-list before ‘__le32’
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Marc Herbert 565a252c1d rebuild-testbench.sh: add missing shellcheck source=
Fixes last shellcheck -x warning

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Marc Herbert f0d1d4918f rebuild-testbench.sh: testbench_usage(): add missing ;;
Also: don't fail silently.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Bard Liao 004241927f topology2: sdw-amp-generic: use fixed format on amp feedback io
Use fixed 32 bit format on io-gateway and let host-gateway do the
conversion.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2023-05-16 09:05:44 -07:00
Andrula Song 39550177c3 Dummy smart_amp: copy input_pins and output_pin separately.
The original code confuses static code analyzers since it was
relying on the fact that we have the 2x input and 1x output pin
config in adjacent position in smart_amp_data struct similarly
to the extended module configuration.

While it works, it is not a good practice.

Split the copy of input and output pin formats to make the code
obvious and less error prone.

Fixes: andrula-song@ bcc1407 ("smart_amp_test: Split the module
config and blob receiving for IPC4")

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-05-16 14:15:37 +03:00
Andrey Borisovich a675edf8e7 LMDK: fixed rimage and key paths and discovery
Path to rimage and private key had been failing to be used while
provided in form of relative path using dots.
Changed how rimage is discovered in the scripts:
* rimage is searched for using find_program with paths and hints provided
* changed RIMAGE_COMMAND to RIMAGE_INSTALL_DIR so end-user may specify
directory where rimage executable is placed. It will be used by
find_program.
* If RIMAGE_INSTALL_DIR is not provided, find_program will try to
search for rimage in the directory where SOF project installs it
(west_dir/build-rimage).
* Updated README.md with instructions on how to build:
  - simplified configure and build commands
  - updated explanations on how to use RIMAGE_INSTALL_DIR
  - added information on how to use toolchain file
* private key path was parsed incorrectly when provided windows path
style using backslashes. It was passed to rimage as is resulting in the
invalid path as the last slash was made by rimage as forward slash.
Added path normalization what fixed the problem.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-05-16 14:04:32 +03:00
Laurentiu Mihalcea 0fec81b0e0 schedule: zephyr_dma_domain: Change domain thread priority to coop range
Problem: DMA domain thread can be preempted during a pipeline_copy()
operation. This leads to buffer->walking being set to true which, in
turn, leads to TRIGGER STOP in EDF thread (which has a higher
priority than the DMA domain and can preempt it) not being able
to stop all components in a pipeline.
This is evident in the following logs:

INFO ipc: new cmd 0x60050000
INFO starting pipeline trigger operation: 0x92c10aa0
INFO executing trigger 0 on pipe 0x92c10aa0, registrable: 0
INFO Starting first walk
INFO pipeline_comp_trigger(), current->comp.id = 17, dir = 0,
pipeline: 0x92c10aa0, registrable: 0
INFO component type: 1
ERROR BUFFER WALKING SKIP
INFO ended pipeline trigger operation returned: 0
INFO ipc: new cmd 0x60030000
INFO pipeline_comp_reset(), current->comp.id = 17, dir = 0
INFO component type: 1
ERROR BUFFER WALKING SKIP

Note: "BUFFER WALKING SKIP" error message is caused by a comp_err added
to the following section of pipeline_for_each_comp():

	if (buffer->walking) {
		comp_err(current. "BUFFER WALKING SKIP");
		continue;
	}

Most likely this has always been a problem with the DMA domain but
it was less likely to happen with only a single pipeline task at a
time (the only tested case). The problem was discovered when testing
the mixer component.

This commit solves this problem by simply changing the DMA domain's
thread priority to a value in the cooperative range. This way it won't
be preempted by the EDF thread.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-16 14:01:23 +03:00
Laurentiu Mihalcea b185ffa6b8 zephyr_dma_domain: Give semaphore resources based on sched_comp's state upon cancel
This implies the following changes:
	1) domain_task_cancel() shall no longer receive the number
	of tasks, but, instead, will receive the task to be cancelled.

	2) zephyr_dma_domain_task_cancel() will do k_sem_give() if the
	sched_comp associated with the given task is != COMP_STATE_ACTIVE.

	3) SEM_LIMIT is changed to CONFIG_DMA_DOMAIN_SEM_LIMIT and can
	be configured.

The reasoning for the changes are the following:
	1) and 2): In the case of mixers, domain_task_cancel()'s
	num_tasks is not a reliable way to determine if the DMA
	IRQs got cut off. Let's consider the following scenario:

	We have a mixer with 1 non-registrable pipeline task and
	1 registrable pipeline task. Upon TRIGGER_STOP we'd have
	the following flow (i.MX boards):
		a) SAI_STOP => DMA IRQs get cut off.
		b) Cancel non-registrable pipeline task.
		c) Cancel registrable pipeline task.

	During b) and c), domain_task_cancel() would get the following
	arguments:
		b) domain_task_cancel(sch, 1)
		c) domain_task_cancel(sch, 1)

	This is because the non-registrable pipeline task wasn't
	dequeued before c) so, even though the DMA IRQs got cut
	off during a), zephyr_dma_domain_task_cancel() does not give
	resources to the semaphore so what happens is zephyr_ll_run()
	will no longer execute and the pipeline tasks remain queued.

	3) Since the semaphore can accumulate more than 1 resource
	at a given time (and since it's safe to make SEM_LIMIT depend
	on the load of the system), SEM_LIMIT was changed into a config.
	This allows the user to change SEM_LIMIT based on the system
	load. For example, if there's 2 non-registrable pipeline tasks
	and 1 registrable pipeline task (same scheduling component),
	an appropriate value for SEM_LIMIT should be 3 (since the
	semaphore can be given at most 3 resources during the task
	cancellation process). Of course, making SEM_LIMIT depend on
	the system load is the worst case but this way we can make sure
	that the cancelled tasks get dequeued properly.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-16 14:01:23 +03:00
Laurentiu Mihalcea 465605f0ef schedule: zephyr_dma_domain: domain_register(): Return early for non-registrable tasks
Because DMA IRQs are not registered for non-registrable tasks,
register_dma_irq() will return 0 and not set data. This leads to
zephyr_dma_domain_register() returning -EINVAL for said tasks which
is not right.

This commit fixes this problem by returning early in the case
of non-registrable tasks. This means register_dma_irq() will not
even be attempted for such tasks.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-16 14:01:23 +03:00
Marc Herbert 2a8f6a6fc7 .github/fuzzer: apt-get install i386 dependencies explicitly
Let's try to fix the error below spotted in
https://github.com/thesofproject/sof/actions/runs/4981366388

I have no idea why this worked before and not anymore but if this makes
apt happy then we're happy.

```
libstdc++-12-dev:i386 :
  Depends: libstdc++6:i386 (>= 12.1.0-2ubuntu1~22.04) but it is not
           going to be installed
  Depends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not installable
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-15 15:50:30 -07:00
Seppo Ingalsuo 5af59eb5cc Tools: Tplg_parser: Add include of <linux/types.h>
These headers include alsa/sound/asoc.h and some versions of the
headers have this conditional include of types.h:

	#if defined(__linux__)
	#include <linux/types.h>
	#endif

To ensure types __le64, __le32, __le16, __u8 are defined explicitly
include types.h becore including asoc.h.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-15 11:49:43 +03:00
Paul Olaru 1acead174c west.yml: Upgrade zephyr to fa5117225a
This update is needed to include Zephyr specific patches required for
building SOF on i.MX platforms with Xtensa toolchain.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2023-05-15 11:44:28 +03:00
Paul Olaru 1ae0d1a4ec drivers: imx: interrupt: Use Zephyr wrapper definitions
For the functions platform_interrupt_clear and platform_interrupt_set,
the existing definitions based on arch_interrupt_* do not compile with
the xt-clang 2023 toolchain for imx. Use the Zephyr wrapper
implementations for those for now.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2023-05-15 11:44:28 +03:00
Paul Olaru ef38a0c265 arch: xtensa: core.h: Add define for UINT32_C
This define is used by the new 2023 xt-clang toolchain and, while there
are a few definitions (identical to this one) in various implementations
such as newlib, none of them is in use when building SOF with Zephyr
and XtensaTools.

Add this define so that the toolchain provided headers work correctly.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2023-05-15 11:44:28 +03:00
Ranjani Sridharan 8c005ef6a9 topology2: sof-lnl-nocodec-fpga: Add 2ch DMIC topologies
Build the 2ch topologies with either PDM0 or PDM1 enabled.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:26:12 +03:00
Ranjani Sridharan 9fa6adc2ca copier: Use dai_zephyr_new/free() during init_dai()
In preparation for removing the endpoint DAI device for multi endpoint
copiers, replace the DAI device new/free ops with dai_zephyr_new() and
dai_zephyr_free().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan f22c284522 copier: Use dai_zephyr_reset() for multi endpoint DAIs
In preparation for removing the creation of endpoint DAI devices,
replace the call to the endpoint device's reset op with
dai_zephyr_reset().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan cbbd3d17b6 copier: Use dai_zephyr_free() for multi endpoint DAIs
In preparation removing the creating of DAI devices for multiple
endpoint DAIs, replace the call to the endpoint device's free op with
dai_zephyr_free().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan c9820ccd47 copier: Avoid using device drv prepare() ops for multi endpoint case
Use the dai_zephyr_config_prepare() and dai_zephyr_prepare() instead in
preparation for removing the endpoint devices and buffers for the multi
endpoint DAI copiers.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan a0b5dec5a0 copier: Set state first during params()
It is OK to set the comp state to prepare before calling
dai_zephyr_config_prepare() as it only checks if the state is ACTIVE
before processing.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan d10b641083 copier: Use dai_zephyr_params() for multi endpoint DAIs
In preparation for removing the endpoint device and buffers for multiple
endpoint DAI copiers, use dai_zephyr_params() instead of calling the DAI
drv params ops.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Ranjani Sridharan 94e32ebf3c copier: refactor copier_params()
Multiple endpoints are only applicable for DAI copiers. So move the
params update for this case into the SOF_COMP_DAI case.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-15 11:24:46 +03:00
Marc Herbert ce0dd67bb7 sof_builder/Dockerfile: restore deleted toolchains
Building a Docker image takes several hours. To reduce costs and save
time we don't want to maintain a different Docker image for the
stable-v2.2 branch. Restore toolchains that were accidentally removed
from the Dockerfile because this will unnecessarily paint red every PR
submitted to the stable-v2.2 branch, example:

https://github.com/thesofproject/sof/actions/runs/4867162042/jobs/8679468096

If we want to stop supporting something then let's keep things simple
and remove it only where it actually gets in the way and where it
actually becomes a problem. No need to search and scrub every reference
to it from the face of the planet and accidentally make our life harder
on release branches, create pointless git conflicts and _increase_
maintenance costs when trying to reduce them!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-15 11:17:40 +03:00
Marc Herbert fca84b8773 .github/zephyr: align hal_xtensa when compiling with Zephyr main branch
We import hal_xtensa indirectly through zephyr/west.yml.

When overriding the Zephyr revision in sof/west.yml to test the Zephyr
main branch "zmain", we must also update the version of hal_xtensa
specified in zephyr/west.yml. Stop doing a manual, single repo git fetch
and use a submanifest to perform this correctly. This is exactly why
submanifests/ were added in the first place.

These fixes the imx8m compilation error spotted and discussed
in (unrelated) #7579 following the IMX rename in
https://github.com/zephyrproject-rtos/zephyr/pull/57084 and
https://github.com/zephyrproject-rtos/zephyr/pull/57795

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-12 11:40:42 -07:00
Kwasowiec, Fabiola adb7b14793 Peakvol: correct volume processing function
When calculating the out_sample value,
the AE_SLAI32S function is used,
which rounds the result to the value 1/(-1),
resulting in a rectangular signal.

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2023-05-12 11:35:13 -07:00
Baofeng Tian 51ade663cb copier: fix ipcgtw position issue
there is no interface for ipcgtw position, also no variables to
track for ipcgtw position, since ipcgtw device was removed,
ipcgtw position support have to be removed from copier.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian bc74137c3c ipcgtw: remove all device related function content
Those standard interface are no longer needed by copier, since
copier already can call with zephyr prefix function to have same
functionality, so removed those code.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian ce6ec18fcb copier: remove ipcgtw device creation and its usage
After all ipcgtw expose new interface to copier, copier does not
depend on ipcgtw device anymore, remove it to align with host and
dai optimization.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 84e4484b94 copier: remove ipcgtw copy case
ipcgtw copy is empty, due to ipcgtw device will be removed, so
remove its copy function.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian e9d00eb4ef copier: expose ipcgtw_zephyr_params and reset to copier
copier use zephyr prefixed function calling instead of through
ops driver to implement params and reset functionality.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 77904bacf9 ipcgtw: split the ipcgtw_params function
Split the ipcgtw_params() function and add a new helper,
ipcgtw_zephyr_params() that can also be invoked from the copier device.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 65bd630f96 ipcgtw: split the ipcgtw_reset function
Split the ipcgtw_reset() function and add a new helper,
ipcgtw_zephyr_reset() that can also be invoked from the copier device.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian df9421836e copier: replace ipcgtw trigger and prepare with direct calling
for ipcgtw case, there is nothing to do for it, except for set
ipcgtw device state, so directly set state for prepare and trigger
instead of through ops driver, this part of code will be removed
since ipcgtw device will be removed eventually.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 79faeb5a95 copier: expose ipcgtw_zephyr_new and ipcgtw_zephyr_free function
Expose the ipcgtw_zephyr_new()/free() functions and use them for
creating/freeing the endpoint device. This is preparation to
replace the endpoint device with the copier device and eventually
remove the endpoint device itself.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 07805bfb09 ipcgtw: split the ipcgtw_free function
Split the ipcgtw_free() function to add a helper function,
ipcgtw_zephyr_free() in preparation for this to be called
from both a ipcgtw device and copier device.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Baofeng Tian 8d89d8223c ipcgtw: split the ipcgtw_new function
Split the ipcgtw_new() function to add a helper function,
ipcgtw_zephyr_new() in preparation for this to be called from both
a ipcgtw device and copier device.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-05-12 08:01:32 -07:00
Ranjani Sridharan 9e7ec5a3f2 Revert "topology2: cavs-nocodec: add a module copier to SSP 0 capture pipeline"
DAI copiers now support multiple sinks. So revert the temporary
workaround in the cavs-nocodec topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-12 14:26:51 +03:00
Ranjani Sridharan 5e60b3721e dai-zephyr: Support multiple sink buffers with single endpoint copier DAIs
Add support for single endpoint DAI copiers with multiple sinks by copying
from the DMA to all the sink buffers in a loop while using the right PCM
converter function. Modify the signature of dai_zephyr_copy() to pass the
array of converter functions to be used while copying from the DMA.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-12 14:26:51 +03:00
Ranjani Sridharan a09982e093 lib: dma: Add a new DMA buffer copy function
Add a new DMA copy function, dma_buffer_copy_from_no_consume(), that can
be used to copy from the DMA buffer to the sink without modifying the
read pointer in the DMA buffer. This will be used when the DMA data
needs to be copied to multiple sink buffers. The DMA buffer pointer
should be updated at the end of all copies in this case.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-12 14:26:51 +03:00
Kai Vehmanen 4a4d8d2619 intel: ssp: drain RX fifo when starting
If DMA transaction is ongoing when RX is enabled, this can lead
to stuck communication between DMA and SSP (DMA service request
not seen by the DMA).

To avoid this, flush the RX fifo before enabling SSP RX.

Link: https://github.com/thesofproject/sof/issues/7548
Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-05-12 14:01:43 +03:00
Kai Vehmanen e94071fb82 intel: ssp: do not read data directly if DMA is active
If DMA is active, do not read data directly from the SSP
RX fifo.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-05-12 14:01:43 +03:00
Serhiy Katsyuba c00354b46d LMDK: Loadable Modules Dev Kit build scripts
Initial commit with set of cmake and linker scripts to build loadable
modules binary.

Things yet TODO:
  add all necessary Dev Kit header files to include dir,
  replace dummy example with somewhat useful module example.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-05-12 10:56:34 +02:00
Kwasowiec, Fabiola 0f20e2affb dma: reset DGCS_GEN when pipeline is reset
DGCS_GEN bit should be set to 0 on a pipeline state change to reset

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2023-05-12 10:43:24 +02:00