Commit Graph

8221 Commits

Author SHA1 Message Date
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
Guennadi Liakhovetski bbf81b8d24 git: remove "module" from .gitignore
We now have a "module" directory under
src/audio/module_adapter/module so it shouldn't be ignored by git any
more.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-06 15:46:03 +01:00
Pin-chih Lin 141da0793f scripts: update xtensa core name and version for renoir
Update xtensa core to RI-2019.1 for AMD platform Renoir

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-05-06 13:20:50 +01:00
Kai Vehmanen 9c9ad34464 zephyr: move Zephyr IDC implementation to zephyr_idc.c
SOF uses IDC (Intra DSP Communication) protocol to orchestrate
work across multiple DSP cores.

The interface in sof/drivers/idc.h defines the protocol and
also provides a high-level interface for drivers. On Zephyr,
the SOF IDC protocol is used, but the actual communication
is implemented on top of Zephyr P4WQ workqueue interface,
instead of directly calling into drivers.

Move the Zephyr implementation from src/schedule/ into
src/idc/ which is more suitable place for this code.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-05-06 10:21:00 +01:00
Jaska Uimonen 1e9dd8cc7d dai: add op to fetch dai fifo depth
Add function to fetch dai fifo depth from driver platform data, as for
some reason it is missing. Update all drivers that are actually using
it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-05-06 10:15:01 +01:00
Ranjani Sridharan 16fd76668a module_adapter: Add support for SET_VALUE/GET_VALUE control commands
In preparation for modifying the volume component to use the new
module API, add support for SET_VALUE/GET_VALUE control commands.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan 88ef648585 module_adapter: Add set/get_large_config ops
Define the set_large_config and get_large_config ops for the module
adapter component. These are mandatory ops needed to make the module
adapter compatible with IPC4.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan 1e9d9c6f31 module_adapter: Adapt the create op for different comp types
Module adapter can be used by components with types other than
SOF_COMP_MODULE_ADAPTER. So modify the create op to handle components
by type.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan bb842d36ad module_interface: modify the get_configuration API
Remove the const qualification for the data pointer and pass the pointer
for the data_offset_size. The data_offset_size will need to be read and
updated after copying the config data.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan f9a26e7ea2 module_adapter: delete module_adapter.h
And move the MAX_BLOB_SIZE macro to generic.h

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan 2751ea8b31 module_adapter: KConfig: rename menu option
Rename the menu option to "Processing modules"

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan 533b2ba832 module_adapter: Introduce a new macro module_get_private_data()
Introduce a new macro to access the module's private data and use it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Ranjani Sridharan e101aadcd1 module_adapter: drop the comp_get_module_data() macro
Change all functions to accept a pointer to struct processing_module
as a parameter and use mod->priv to access the module data.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-06 10:12:39 +01:00
Seppo Ingalsuo da603aefd4 Audio: EQ IIR: Convert assert to normal fail
This patch changes the assert to check of IIR processing function
and fail with -EINVAL if function is not set.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-05-06 10:11:43 +01:00
Seppo Ingalsuo 068ba4b230 Audio: EQ FIR: Convert assert to normal fail
This patch changes the assert to check of FIR processing function
and fail with -EINVAL if function is not set.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-05-06 10:11:43 +01:00
Pin-chih Lin dac8754449 perf_cnt: add the tracing of window-based average calculation
The average number of cpu cycles/ticks spent could be provided per 1024
scheduled tasks by the performance counter. It would be more accurate for
MCPS measurement than the peak number. Even so, the tracing macro will log
both of them to provide more insights.

This is enabled by CONFIG_PERFORMANCE_COUNTERS_RUN_AVERAGE, which depends
on CONFIG_PERFORMANCE_COUNTERS.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-05-05 21:52:13 +01:00
Pin-chih Lin dbb63071b1 component: fix comp_perf_info unsigned format
Use %u instead of %d in printf for uint32_t variable.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-05-05 21:52:13 +01:00
Guennadi Liakhovetski bd4f0e1ac4 coherence: convert buffer and audio-stream APIs to use __sparse_cache
To properly use buffer-locking functions many buffer and
audio-stream API functions have to use the __sparse_cache annotation too.
Note, that we don't convert comp_update_buffer_consume() and
comp_update_buffer_produce() yet. They will be converted together
with all the buffer API users to also move buffer acquisition out of
those functions into the caller scope.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-05 21:47:09 +01:00
Guennadi Liakhovetski 559266e7e9 common: add an attribute-preserving version of container_of()
With some compiler versions container_of() loses any type attributes
which then leads to compilation issues. Add an attribute-preserving
version of the macro.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-05 21:47:09 +01:00
Guennadi Liakhovetski a85dbaf592 sparse: add __sparse_cache annotations to buffer locking functions
buffer_acquire() and buffer_release() convert between cached and
uncached addresses. Add the sparse __sparse_cache annotation to them to
track down any API misuses.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-05 21:47:09 +01:00
Guennadi Liakhovetski aba5f9ae37 sparse: use __sparse_cache for cache-uncache conversion functions
cache_to_uncache() and uncache_to_cache() functions take a cached
memory alias or return one respectively. Add the __sparse_cache annotation
to them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-05 21:47:09 +01:00
Guennadi Liakhovetski e7da88d439 coherent: use sparse annotations
Add the '__sparse_cache' annotation to coherent API functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-05 21:47:09 +01:00