Commit Graph

8642 Commits

Author SHA1 Message Date
Ranjani Sridharan 5e4de90902 module_adapter: use memcpy instead of memcpy_s
ca_copy_from_source_to_module() and ca_copy_from_module_to_sink() are
both invoked during every copy. So use memcpy() instead of memcpy_s() to
speed up the copies.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-16 20:36:53 +03:00
Ranjani Sridharan c52aa30070 module_adapter: optimize module_adapter_copy()
When the module produces only period_bytes every period, there's no need
to save the produced samples in the intermediate local buffer, instead
copy them directly to the sink buffer and save an extra copy.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-16 20:36:53 +03:00
Ranjani Sridharan cad7394400 module_adapter: reset input/output buffers when consuming/producing
And avoid looping through the buffers again.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-16 20:36:53 +03:00
Ranjani Sridharan 5cfb95478b module_adapter: separate handling the processed output into a new function
Split the core for handling the processed output into a separate
function.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-16 20:36:53 +03:00
Ranjani Sridharan 8ceb2df7e9 module_adapter: remove the consume label
Simplify the logic by removing the unnecessary consume label. This will
change the logic to loop through the local output buffers when return is
-ENODATA or -ENOSPC. But since there will be no produced samples, this
loop will do nothing. It is not intended to optimize the performance at
this point and in fact the first few cycles might even take the hit
because of the extra looping. But this will help with clubbling the
handling of output samples simpler in the following patches.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-16 20:36:53 +03:00
Daniel Baluta 6c4f3ea42f module_adapter: Don't use config->type to identify component
We need to use UUID in order to identify a component. For now
we only support module_adapter components so just skip checking
config->type.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-05-14 11:40:53 +01:00
Chao Song c973358957 overlays: add common/debug_overlay.conf for debug build
The debug_overlay.conf is somehow missing from #5792,
add it in this patch.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-05-14 11:35:13 +01:00
Ming Jen Tai 4aa202dd78 [RTNR] Add audio stream layer between sof and RTNR
The audio_stream structure might be different between branches. To maintain the compatibility between branches, a layer between sof and RTNR is added.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-05-13 17:33:05 +02:00
Ranjani Sridharan d1db144e1b overlays: tgl: Add DMIC_NHLT
INTEL_DMIC_NHLT should be chosen for IPC4 for TGL.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-13 13:02:59 +01:00
Marc Herbert af6586bd81 checkpatch: update to Linux version v5.17
Minimal, SOF-only differences with v5.17

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-13 09:58:49 +01:00
Marc Herbert d0fe4933f4 checkpatch: update to Linux version v5.12
Minimal, SOF-only differences with v5.12

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-13 09:58:49 +01:00
Marc Herbert 4f4fd1a425 checkpatch: remove spurious white line before "if MAINTAINERS"
This removes a small but conflicting difference with upstream.

Fixes commit d98a7ed103 ("checkpatch: check ABI updates before warning
on it")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-13 09:58:49 +01:00
Marc Herbert d19009ab8c checkpatch: do not combine if (!$SOF) with other ifs
Use a separate if(!$SOF) to minimize differences with upstream.

Also remove some spurious whitespace differences with upstream.

Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-13 09:58:49 +01:00
Ranjani Sridharan 0c1acc5623 copier: fix spelling mistake
Only a cosmetic change. use "unable" instead of "unenable"

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-13 09:34:27 +01:00
Marc Herbert 7c4a53f802 checkpatch: add __sparse_cache and __sparse_force attributes
These attributes were added to Zephyr's include/zephyr/debug/sparse.h by
commit 17eb313a1b15 ("sparse: add an address space and a __sparse_force
annotation")

This gets rid of dozens of warnings in
https://github.com/thesofproject/sof/runs/6387526478

```
ERROR: need consistent spacing around '*' (ctx:WxV)
+	struct comp_buffer __sparse_cache *buffer_c, *sink_c;
 	                                  ^

ERROR: need consistent spacing around '*' (ctx:WxV)
+	struct comp_buffer __sparse_cache *source_c;
 	                                  ^
```

etc.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-13 09:29:37 +01:00
Eddy Hsu f64e6fbdba crossover: change to use model_handler to handle configs.
Change to use the new model_handler to handle configs. In this way,
`config_new` is no longer needed and the code looks much cleaner now.

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-05-13 09:28:22 +01:00
Eddy Hsu 1bc57fa9a6 crossover: Not clean out configs in reset
Configs from userspace should not be cleared out on reset.

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-05-13 09:28:22 +01:00
mengdonglin 363d96dbff rimage: update to May 4th version 9d453321f8
Update rimage from version from ee5c3e1deb to 9d453321f8

9d453321f8 (origin/main) Write firmware file micro version to manifest
             for cAVS platforms
05be213d46 config: Add mt8186.toml
ee5c3e1deb (HEAD) Added handling of OpenSSL on Windows with MSYS2

Signed-off-by: mengdonglin <mengdong.lin@intel.com>
2022-05-12 17:32:09 +01:00
Rander Wang 521aa0ba82 ipc4: avoid pipeline sink component check in different pipeline
Fix panic with capture pipeline prepare. Fw checks sink component
in another incomplete pipeline but the sink component is not set
at this time.

Stop pipeline check for ipc4 component in another pipeline and
return immediately.

BugLink: https://github.com/thesofproject/sof/issues/5777

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-05-12 17:24:03 +01:00
Jyri Sarha 919e6463c6 ipc: ipc4: Use Zephyr API k_sleep() instead of obsolete wait_delay()
Use Zephyr API k_sleep() instead of obsolete wait_delay(). In XTOS
build the k_sleep() is implemented in xtos-wrapper/include/kernel.h
and it actually calls the same old wait_delay().

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-05-12 15:58:08 +01:00
Jyri Sarha 48b57cd1b8 xtos-wrapper: Add Zephyr k_sleep() API to XTOS using wait_delay()
Add k_sleep() and a minimum set of related typedefs and macros needed
to make the API usable. The implementation calls wait_delay(). Commit
adds also safeguard not to let Zephyr build include the file.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-05-12 15:58:08 +01:00
Tinghan Shen 42e0d5e0b5 drivers: mediatek: fix build error
fix mediatek driver build error after ipc_cmd_hdr is updated.

sof/src/drivers/mediatek/mt8186/ipc.c: In function ‘ipc_platform_do_cmd’:
sof/src/drivers/mediatek/mt8186/ipc.c:77: error: ‘ipc_cmd_hdr’ undeclared (first use in this function)
sof/src/drivers/mediatek/mt8186/ipc.c:77: error: (Each undeclared identifier is reported only once
sof/src/drivers/mediatek/mt8186/ipc.c:77: error: for each function it appears in.)
sof/src/drivers/mediatek/mt8186/ipc.c:77: error: ‘hdr’ undeclared (first use in this function)
CMakeFiles/sof.dir/build.make:714: recipe for target 'CMakeFiles/sof.dir/src/drivers/mediatek/mt8186/ipc.c.o' failed

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
2022-05-12 14:58:53 +01:00
Daniel Baluta 2e3823ac34 zephyr: Fix compile error after switching to module_adapter naming
There are few left paths and config names after switching from
codec_adapter to module_adapter.

Without this building codec modules fails

Fixes: b4591ca8f4 ("codec_adapter: rename it to module_adapter and fix all includes")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-05-12 09:50:04 +01:00
Rander Wang 1e7220e4d0 ipc4: return ipc4 error status instead of posix error
Convert posix error to ipc4 error and return ipc4 error for
functions in ipc4 directory.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-05-12 09:49:05 +01:00
Guennadi Liakhovetski 8397711d64 heap: heap_alloc_aligned_cached() returns a cached address
heap_alloc_aligned_cached() is a helper function used to allocate
memory with a cached alias. Therefore its returned pointer should
use the __sparse_cache annotation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-11 14:30:11 +01:00
Guennadi Liakhovetski 51f6a80124 cache: add type-casts where cache-manipulation is done
Cache synchronisation and address space conversion functions
explicitly specify the address space for their arguments and return
types. Add forced type-casts to make sure such address space changes
are documented.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-11 14:30:11 +01:00
Li-Yu Yu 842794af20 mux: Annotate packed for structs that require a predictable layout
struct sof_mux_config and struct mux_stream_data are used to
load binary data from userspace. Add packed attribute to ensure
it has a stable and platform-independent layout.

Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2022-05-11 09:58:37 +01:00
Li-Yu Yu 2fd648efac mux: Use a fixed size for mux_stream_data
sizeof(struct mux_stream_data) was PLATFORM_MAX_CHANNELS-dependent.
In particular, if PLATFORM_MAX_CHANNELS < 8 the struct becomes
smaller. However in m4/muxdemux.m4, there is no easy way to supply
ROUTE_MATRIX with a smaller matrix other than 8x8 bits.

This commit pads struct mux_stream_data so it always has the a
platform-independent size: as if PLATFORM_MAX_CHANNELS were 8.

Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2022-05-11 09:58:37 +01:00
Chao Song de352e0beb xtensa-build-zephyr.py: add -d option for debug build
Add a new -d option to support SOF debug build. This
option will add CONFIG_DEBUG=y to SOF configuration,
which is aligned with xtensa-build-all.sh script.

The -d option is a shortcut for '-o debug_overlay_path'.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-05-11 09:56:02 +01:00
Chao Song 30431a19a9 xtensa-build-zephyr.py: add -o option for overlay
Add -o option for user to specify overlays while
building SOF.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-05-11 09:56:02 +01:00
Seppo Ingalsuo a781886f6f Topology: Topology1: Fix mistake in buffer size calculation
Pipeline macro pipe-eq-iir-volume-capture-16khz.m4 misses an
update done to other pipelines. The macro COMP_PERIOD_FRAMES()
gives the correct buffer size in other pipelines.

Without this patch change of pipeline scheduling to 10 ms
from default 1 ms causes pipeline fail to buffer size check.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-05-10 17:11:20 +01:00
Ming Jen Tai 0d5180d804 Add MT8195 override config
This commit adds Google RTC processing and RTNR to MT8195 override
config.

Please note that Google RTC Audio mocking processing is used in this
commit.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-05-10 16:57:57 +02:00
Ming Jen Tai c8b375638c topology1: mt8195: support Google rtc audio process with RTNR
This commit adds Google RTC Audio Processing with RTNR to MT8195
topology.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-05-10 12:01:05 +02:00
Rafal Redzimski 2fbbdb032c ipc: separate ipc3 and ipc4 header
The current IPC4 protocol implementation is not standalone but
but builds up on top of IPC3 which is used throughout SOF core.
The sof/ipc/common.h holds definitions which are related to
component interface and not IPC ABI specific so it's not a
suitable spot to keep IPC3 or IPC4 specific definitions.
This patch fixes the hierarchy of IPC4/IPC3 to match reality and
moves the ABI specific definitions of ipc_cmd_hdr to a suitable spot.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-05-09 15:50:15 +01:00
Rafal Redzimski 12b056600d ipc4: update ipc_cmd_hdr to fit largest ABI header
The ipc_cmd_hdr should have size no lesser that largest
of the headers amongst all ipc protocol versions.
The use of smaller type for ipc_cmd_header is unsafe because
of casting pointers between differently sized headers followed by
accessing data through incremented pointer.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-05-09 15:50:15 +01:00
Rafal Redzimski 8bec4078bd ipc4: update request/reply structs and fix extension usage
IPC4 request/reply always consists of primary and extension dwords.
Since the extension is always present it makes no sense to:
- pretend that extension is first dword of payload,
- do tx_size related logic to handle extension,
- dynamically allocate extension along payload.
This patch updates common IPC4 structure definitions and
modifies the usage to get rid off the special treatment of
the extension dword.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-05-09 15:50:15 +01:00
Rafal Redzimski 82f2a7974e ipc4: update specific ipc4 command fields names
For every IPC4 command the header consists of two dwords.
First of which is primary and the second being extension.
This patch renames the ipc4 header fields for specific ipc4 command
structures to reflect that.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-05-09 15:50:15 +01:00
Rafal Redzimski c5a5bf1793 ipc: fix ipc_msg_init call to use preinitialized structure fields
ipc_msg_init should use the already initialized size field in
rhdr structure instead using the sizeof.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-05-09 15:50:15 +01:00
Guennadi Liakhovetski 70dc03dc65 buffer: add cached consume and produce update versions
comp_update_buffer_produce() and comp_update_buffer_consume() acquire
and release buffers internally. We need versions of those functions,
that take already acquired cached buffer objects as arguments, we
will switch over to them completely gradually. This patch adds such
functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-09 14:22:27 +01:00
Marc Herbert bc39c0e912 Make Zephyr build compatible with optional assert() with __unused
For some legacy reason(s), SOF assert() is not optional. This is unlike
any other assert() anywhere else. This hasn't been a problem yet because
until now SOF assert() has been mapped to a non-optional and limited
Zephyr k_oops()

This commit makes it possible to temporarily or permanently switch the
Zephyr build to Zephyr's __ASSERT(expr, #expr) macro which logs the
asserted expression. This commit does NOT make such a switch.

Note this commit is not enough to make assert() optional in the XTOS
build.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-09 10:05:04 +01:00
Marc Herbert 8f0df0085e Audio: SRC: Convert assert to normal fail
Change the assert() to check for processing function and fail with
-EINVAL if not set.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-09 10:05:04 +01:00
Marc Herbert dba3c4f63d Break down buggy assert(!memcpy_s(...)) into two statements
assert() semantics are very clear: because asserts are optional, the
argument should never have side-effect, period. assert arguments should
be treated exactly the same as logging arguments. So
`assert(!memcpy_s())` is an obvious bug. Use variable to break that down
into two statements.

Fixes commit 0b7fd030b3 ("demux: return config on COMP_CMD_GET_DATA")

Fixes commit 385586a5f6 ("zephyr: implement IDC using P4WQ")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-09 10:05:04 +01:00
Mengdong Lin 8ab452a338 CMake: pass firmware file micro version to rimage
SOF CMake defines SOF_MAJOR, SOF_MINOR and SOF_MICRO for 3 fields of
firmware file version major.minor.micro. But CMake only passes the major
and minor version to rimage.

Now CMake will also pass the mirco version to rimage, so that rimage can
write it to different firmware manifest headers for cAVS platforms and
then sof_ri_info.py will be able to dump entire file version info from
the firmware binary.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
2022-05-09 10:04:21 +01:00
Ming Jen Tai 05bd87da37 Add RTNR library path for MT8195
This commit separates RTNR library path for multiple platforms including
MT8195.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-05-09 09:59:16 +01:00
Eddy Hsu 803782a5f1 smart_amp: Clean up processing function and state on component reset
Clean up smart amp processing function and state in component data on
reset().

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-05-09 09:56:14 +01:00
Jyri Sarha 301d3d8b9f pipeline: Use Zephyr API k_msleep() instead of obsolete wait_delay_ms()
Use Zephyr API k_msleep() instead of obsolete wait_delay_ms(). In XTOS
build the k_msleep() is implemented in xtos-wrapper/include/kernel.h
and it actually calls the wait_delay_ms().

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-05-09 09:29:10 +01:00
Jyri Sarha e4692e644e xtos-wrapper: Add Zephyr kernel.h replica with k_[mu]sleep() for XTOS
The commit adds kernel.h header at the top level of xtos-wrapper
include directory. The idea is to be able to write OS agnostic code
using Zephyr kernel API calls and simply including kernel.h without
worrying if we are building for XTOS or Zephyr.

This first commit contains Zephyr API style k_msleep() and k_usleep()
implementations. The functions in fact call the old
wait_delay-functions.

More implementations and declarations following Zephyr kernel.h
content can be added as needed.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-05-09 09:29:10 +01:00
Brent Lu b36db45a7d topology: sof-adl-max98360a-rt5682: enable BT offload
Enable compile option "BT_OFFLOAD" to enable pipeline for Bluetooth
Offload.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2022-05-08 10:03:38 +01:00
Marc Herbert 464fb0e280 xtensa-build-zephyr.py: make sure that west can find SOF
This can fail for various reasons listed in a comment.

Remove now redundant `west topdir` check.

Without this check, a not found SOF fails with very cryptic Kconfig
errors:

zephyr/samples/subsys/audio/sof/prj.conf:5:
  warning: attempt to assign the value 'n' to undefined symbol HAVE_AGENT

zephyr/samples/subsys/audio/sof/prj.conf:8:
  warning: attempt to assign the value 'n' to undefined symbol
  DEBUG_MEMORY_USAGE_SCAN

zephyr/samples/subsys/audio/sof/boards/intel_adsp_cavs15.conf:1:
 warning: attempt to assign the value 'y' to undefined symbol APOLLOLAKE

etc.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-08 10:01:57 +01:00
Marc Herbert 3f86cab70f zephyr/docker-build.sh: make failure to symlink the SDK not fatal
When running interactively the symlink may already be there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-08 10:01:57 +01:00