Commit Graph

10063 Commits

Author SHA1 Message Date
Ranjani Sridharan eb157a5c2f topology2: mixout-gain-host-copier-capture: Use host-copier
Replace the generic copier with host-copier in the class definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
Ranjani Sridharan b86acaa353 topology2: deepbuffer-playback: Use host-copier
Replace the generic copier with host-copier in the class definition and
the instances.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
Ranjani Sridharan f942a0338a topology2: src-gain-mixin-playback: Use host-copier
Replace the generic copier with host-copier in the class definition and
the instances.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
Ranjani Sridharan be825a8581 topology2: host-copier-gain-src-mixin-playback: Use host-copier
Replace the generic copier with host-copier in the class definition and
the instances.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
Ranjani Sridharan f211f4c9da topology2: host-copier-gain-mixin-playback: Use host-copier
Replace the generic copier with host-copier object in the pipeline class
definition and all its instances.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
Ranjani Sridharan f64a424bfd topology2: components: Add a new class definition for the host copier gateway
This will replace the generic copier for the host gateway.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-19 08:17:34 -07:00
apoorv 5fa9cb6be4 topology1: CMakeLists: add RPLP CRB support for SoundWire
Added RPLP CRB support for SoundWire0 and SoundWire2

Signed-off-by: apoorv <apoorv@intel.com>
2023-05-19 10:07:45 +03:00
Daniel Baluta aa91bedf38 CODEOWNERS: Add NXP people as owners for scheduler
With the work done for zephyr DMA domain we got a lot of insights
about how scheduler works.

So add myself and Laurentiu as codeowners.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2023-05-19 10:06:07 +03:00
Marc Herbert 2d3c7eae4f xtensa-build-zephyr.py: don't extract SOF_BUILD from generated .h file
This replaces and simplifies commit a823958a8d ("xtensa-build-zephyr:
pass sof build version to rimage") with a constant 1.

That commit was submitted to avoid a test failure in a broken, internal
test looking for an SOF_BUILD value... hardcoded to 1! (internal FW issue
257, test TestLoadFwExtended::()::test_00_01_load_fw_and_check_version")

The final goal is for this script to stop extracting anything from
`generated/sof_versions.h` so rimage can be configured _before_ the build
has started. Other commits will deal with other parts of sof_versions.h

SOF_BUILD can be replaced by a constant because it has always been one
when building with Zephyr. The optional BLD_COUNTERS feature - disabled
by default in XTOS since commit 9f8cce1522 ("Disable __TIME__ and the
non-reproducible build counter by default") for build reproducibility
reasons - has never worked with Zephyr for the following reasons:

- The sof_add_build_counter_rule() invocation is located in the
top-level sof/CMakeLists.txt file which has never been used by the
Zephyr build.

- sof_add_build_counter_rule() registers a POST_BUILD command for the
top-level "sof" CMake target but there is no "sof" build target in the
Zephyr build.

- Variables like VERSION_BUILD_COUNTER_CMAKE_PATH are not defined in the
Zephyr build for some unknown reason.

- Probably others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-19 10:02:03 +03:00
Ranjani Sridharan d132e25480 topology2: cavs-nocodec-bt: Remove duplicate route
This has already been added in bt-generic.conf.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-18 09:09:05 -07:00
Ranjani Sridharan 43cd6e26d6 copier: set DAI copier endpoint conversion only once
No need to do this more than once for multiple endpoint DAI copiers.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 313b959f6e copier: Remove init_dai_single()
No need to handle this differently as multi-endpoint DAIs no longer
create endpoint devices/buffers too.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 138e1c9b25 copier: Remove creation of DAI endpoint device/buffer
These are not used anymore for the multi-endpoint DAI copiers, so remove
the creation/freeing of endpoint devices/buffers.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 36a490414c copier: Save the endpoint channel map
Modify copier_set_alh_multi_gtw_channel_map() to save the channel map and
channel count for each gateway. Since the endpoint buffer is not used for
DAI copiers, there is no need to set the channel map in this case.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan ef4c467df6 copier: Remove usage of endpoint device for multiple endpoint DAIs
Remove the usage of the endpoint device for params, prepare, trigger
and reset.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 6ffb052691 copier: Remove DAI device drv trigger
Use dai_zephyr_trigger() instead. Remove the state modification in
dai_zephyr_trigger() and handle it in the copier_comp_trigger().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 5f4be32822 copier: Optimize the DAI copy for multiple endpoint DAIs
Currently copying from the multiple endpoint buffer to the DMA involves
2 copies, first from the multi_endpoint_buffer to the endpoint_buffer
and then from the endpoint_buffer to the DMA buffer. Remove the
intermediate buffer copy so that demux and copy can be performed directly
from the multi_endpoint_buffer to the DMA buffer. Similarly, for the
capture case, remove the intermediate copy to the endpoint buffer from
the DMA buffer.

Add a couple of fields in struct copier_data to save the channel map and
channel count for multiple endpoint DAIs. Also remove the
copy_single_channel field as this is set directly in the process
callback in the dai_data now.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan fa96044d75 dai-zephyr: Add support for multi endpoint DAIs
Introduce helper functions for multiple endpoint DAI copiers to demux
and copy the channels into the respective DMA buffers.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 0b0ef4a445 dai-zephyr: Use params channels
Use the params channels directly instead of using the local_buffer to
get the channel count. This is in preparation for optimizing the
multiple endpoint DAIs where the local_buffer will not be used.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan 48910da79d copier: Modify channel_copy_func
Modify the channel_copy_func to align it with other processing function
signatures.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
Ranjani Sridharan f0d338278b copier: Add a helper function to set buffer channel map
Add a helper function to set the channel map for the endpoint buffer.
This is in preparation to remove the endpoint buffer and save the
channel map to be set directly in the DMA buffer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-17 15:22:52 -07:00
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