Skip to content

app: Switch main return type to 'int'#28

Closed
keith-packard wants to merge 328 commits intozephyrproject-rtos:zephyrfrom
keith-packard:int-main
Closed

app: Switch main return type to 'int'#28
keith-packard wants to merge 328 commits intozephyrproject-rtos:zephyrfrom
keith-packard:int-main

Conversation

@keith-packard
Copy link
Copy Markdown

With Zephyr adopting a different type for 'main', adapt this application to match.

tmleman and others added 9 commits April 26, 2023 16:55
Zepych update: total of 132 commits.

Changes include GP DMA power management changes.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Earlier commits wrongly used struct audio_stream accessors to read
members of struct audio_stream_rtnr in rtnr_copy_to_sof_stream().
Revert those changes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Set the deep buffer PCM as D0I3 compatible only for MTL.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
When resetting a pipeline, components may be still in active state if
previous pipeline walkthrough of stop trigger aborted due to some
reason. Here we give it a second chance to stop the component before
resetting it. Without doing this, some components like dai could cause
DSP panic because the DMA is still running.

Signed-off-by: Brent Lu <brent.lu@intel.com>
Add a single comment to separate chromebook topologies
from non-chromebook topologies.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
This topology could be used by MTL SDW RVP with 3-in-1
SDCA codec board, or other hardware configuration with
the same codec layout:
    SDW0: RT711 Headphone
    SDW1: RT714 DMIC
    SDW2: RT1316 Speaker
    SDW3: RT1316 Speaker

Signed-off-by: Chao Song <chao.song@linux.intel.com>
This configuration is build tested, builds fine.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This configuration is build tested, builds fine.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This configuration is build tested, builds fine.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
nashif and others added 10 commits April 28, 2023 10:37
Use zephyr cache APIs instead of xtensa specific ones.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Multiple fields in struct audio_stream are only set in the
audio_stream.h header itself, which is valid, and in rtnr.c. Add
accessors to replace the latter operations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Fix a missed direct read of the stream channel count.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add accessors for setting .frame_fmt, .valid_sample_fmt, .channels
and .rate and convert direct assignments to use them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Don't access struct audio_stream internals in buffer_new(), pass
buffer flags to buffer_alloc() instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add read and write accessors for .underrun_permitted and
.overrun_permitted fields of struct audio_stream and convert the code
base to use them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Update parameter type for asrc_initialise() to match those
from header file.

This fixes "error: conflicting types for 'asrc_initialise'".

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Update parameter type for _xt_atomic_compare_exchange_4()
to match xthal_compare_and_set() from xtensa/hal.h

This fixes "error: passing argument 1 of
'xthal_compare_and_set' from incompatible pointer type"

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
To make sure the same prototype is used for all notifier callbacks
add a typedef.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Using the notifier between the copier and the host makes little
sense with native Zephyr drivers: it ends up in a direct function
call, but before that it has to look for the correct callback in a
global notifier list. The callback can perfectly be called directly
instead.

With legacy SOF drivers we still need to use the notifier because
that is how SOF DMA drivers trigger the host component. We have to
provide a compatibility callback in the copier for the IPC4 case.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@marc-hb
Copy link
Copy Markdown

marc-hb commented May 1, 2023

@keith-packard would you mind submitting this to SOF upstream? This would save some branching. I gave it a try and it looks like the actual SOF firmware (as opposed to the Zephyr test code) does not care about the main function at all:

@keith-packard
Copy link
Copy Markdown
Author

@keith-packard would you mind submitting this to SOF upstream? This would save some branching. I gave it a try and it looks like the actual SOF firmware (as opposed to the Zephyr test code) does not care about the main function at all:

* [TEST IGNORE app: Switch main return type to 'int' thesofproject/sof#7543](https://github.com/thesofproject/sof/pull/7543)

thesofproject#7544

Due to the fact that on i.MX93 the host will initialize the
SOF_IPC_FW_READY sequence there's no need to call
platform_boot_complete() at the end of start_complete(). This
will be handled in the IPC3 handler.

This commit makes sure that aforementioned scenario won't
happen for i.MX93 while keeping the flow constant for the
other platforms.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
In the case of i.MX93 Linux will send an IPC_FW_READY
message to SOF and will expect to receive the following information
in the hostbox:
	1) reply structure
	2) sof_ipc_fw_ready structure
	3) sof_ipc_fw_ready structure

This flow is required because the FW (due to Jailhouse's design)
will be up before the platform driver from Linux so the
SOF_IPC_FW_READY sequence can't be initiated by SOF.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
kv2019i and others added 16 commits May 25, 2023 11:07
If the product of sampling rate and period size (in microseconds)
exceeds INT_MAX (signed 32bit), an invalid component->frame is
set. This happens for example with sampling rate of 48000Hz and
period size of 50000usec.

While the 'rate' and 'period' fields are uint32_t values, ceil_divide()
in math/numbers.h does calculation with signed 32bit values, leading to
invalid results with smaller input values.

Fix the issue by doing the frame size calculation with 64bit
arithmetic.

Link: thesofproject#7652
Reported-by: Vamshi Krishna Gopal <vamshi.krishna.gopal@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
The dd->local_buffer may be freed between calls to copy if
the peer module is unbound. This can only happen if the peer
module is on a different pipeline as runtime changes to
pipeline connections are not allowed while pipeline is active.
It is however allowed to connect the DAI to sink/sources
on another pipeline, so this scenario is still possible. This
issue only affects IPC4 builds using copier.

In current code, disconnection of local_buffer will lead
to heap corruption as dd->local_buffer is freed but DAI keeps
accessing the buffer in its copy calls.

Fix the issue by implementing an explicit DAI unbind and
setting dd->local_buffer to NULL in case the peer module is
disconnected.

This patch does not add support for dynamic reconfiguration
of the DAI to adjust converters and local_buffer to the new
connections. If capture DAI is set up with multiple sinks and
one of them is stopped, the DAI will stop processing data.

Link: thesofproject#7191
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
In IPC4 mode, the DAI supports writing data to multiple sinks.
It is possible one of the sinks to be on a different pipeline,
which can be disconnected while the DAI is still running.

Depending on the order of pipeline setup, the disconnected sink
might have been chosen as the local_buffer.

Handle this case by reconfiguring the local buffer after
disconnect in the copy function.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Optimize the eq_fir_2x_sx functions by remove the duplicated usage
of circular buffer.

Signed-off-by: Andrula Song <andrula.song@intel.com>
Widget type snd_soc_dapm_out_drv and snd_soc_dapm_output will be treat
as virtual widget and be ignored in sof topology in kernel.
We need to set type = output or out_drv in topology when it is a virtual
widget.

Fixes: 3835846 ("topology2: sdw-amp-generic: Show all aggregated DAIs on the graph")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Thanks to PR [1], Zephyr cache management API can now be
used on xtensa-based SoCs. As a consequence to this, there's
no longer a need to use SOF's arch/ layer for cache management.
This commit forces all SoCs which support Zephyr to use
its native cache management API.

[1]: zephyrproject-rtos/zephyr#50136

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit removes CACHE_INVALIDATE and CACHE_WRITEBACK_INV
macros which are not used.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Fixes commit 22ad526 ("LNL: Add hda_dma_config for interfaces")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Because now we can.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch adds to process_test.m test with amplitude sweep
to determine level dependent logarithmic gain.

Currently there is no test pass/fail criteria. But the test result
plot can be examined from directory plots. E.g. first full test
for DRC with "process_test('drc', 32, 32, 48000, 1);".

The view the plots from shell with "eog plots/ldlg_drc_*.png". Or
examine the plots directory with a file maneger GUI.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The bootloader was only used by Intel platforms when building SOF
with XTOS. Now that that possibility has been removed, bootloader
support can be removed too to eliminate dead code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Zepych update: total of 228 commits.

Changes include:

- build LNL with Zephyr SDK,
- MMU initial implementation,
- check for pending ack in intel_adsp_ipc_is_complete.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
The DSP cannot enter the power gating state if it has not yet received
an ack from host after sending an ipc message.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This patch changes for IPC4 configuration the DSP internal gain
format from Q1.23 to Q8.23. Minimum needed would be Q2.23 but
the integer part 8 bits is same as in IPC3 and would allow
signal amplification in volume component in some later phase. The
code is prepared for amplification due to IPC3.

The change allows the Q1.31 max gain (0x7fffffff) to round to
exactly one in Q8.23 notation (0x800000). The gain value one passes
effectively the input to output unmodified. The change prevents lose
about 1 dB of signal-to-noise ratio from peak quality of PCM formats.

The comment from convert_volume_ipc4_to_ipc3() is removed because it
is unrelated and some remain from old code version.

The hard coded 23 for conversion to/from Qx.23 is changed to
macro VOL_QXY_Y because it's used elsewhere in the component. The
saturation (to 32 bit signed) with 64 bit intermediate is kept in
the function convert_volume_ipc4_to_ipc3() in case of VOL_QXY_Y
would be 31. The code requires int32_t or ae_f32 compatible signed
32 bit compatible gain value instead of full uint32_t range.

The gain range for Q8.23 format is min. -138.47 dB and max. +42.14 dB.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This has bitrotten vs. the newer code upstream at oss-fuzz, involves
an expensive docker container build, and provides little value vs. the
newer fuzz.sh script that runs in the regular CI containers.

Let oss-fuzz handle the deep validation.  We should be using fuzzing
as a smoke test via the existing scripts.

Signed-off-by: Andy Ross <andyross@google.com>
@keith-packard
Copy link
Copy Markdown
Author

The required change has been merged upstream. I've merged the current head containing that fix, replacing my int-main branch with that result.

@joerchan
Copy link
Copy Markdown

This PR looks misconfigured, surely switching main return type to int is not 328 commits.

@marc-hb
Copy link
Copy Markdown

marc-hb commented May 31, 2023

surely <X> is not 328 commits.

This is often a sign that the target branch was force-pushed.

@keith-packard
Copy link
Copy Markdown
Author

surely is not 328 commits.

This is often a sign that the target branch was force-pushed.

In this case, it looked like the practice for getting upstream changes merged to the Zephyr branch was to pull in the upstream code that contained the change, not just cherry-pick the change over to the Zephyr code. Happy to do a cherry-pick if that is the right plan.

@cfriedt
Copy link
Copy Markdown
Member

cfriedt commented Jul 17, 2023

This looks good - please go ahead and merge (I'm ready to approve zephyrproject-rtos/zephyr#60124)

@nashif
Copy link
Copy Markdown
Member

nashif commented Aug 10, 2023

@keith-packard is this still needed? we synced the sof module and it is now pointing to a commit from yesterday.

@keith-packard
Copy link
Copy Markdown
Author

Looks like the sof module has been moved past the commit containing the fix; this PR is now stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.