Commit Graph

7462 Commits

Author SHA1 Message Date
Ranjani Sridharan a1dd222112 topology2: move all cavs topologies
Move all cavs tooplogies to the cavs folder.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-01-06 21:38:43 +00:00
Ranjani Sridharan fcfd5d65be test: topology: fix build with latest alsa-lib
Remove the extra space to make the topology build with upstream
alsa-lib.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-01-06 09:52:51 -08:00
Kai Vehmanen afaad99125 coredump-reader: do not hardcode reset vector address
The gdb script created by coredump-reader has a fixed reset
vector address. This address only works on a subset of supported
SOF platforms and for other platforms, user has to manually fix
the reset address in the gdb script before use.

Modify the script to emit breakpoint for "_MemErrorVector"
symbol. This is not the reset vector, but the simulation will
still be trapped early. The symbol is part of the firmware
binary, so its address can be looked up at runtime.

Also add a second breakpoint for "_MemoryExceptionVector_text_start".
This will cover SOF binaries built with Zephyr as the RTOS.

BugLink: https://github.com/thesofproject/sof/issues/5125
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-05 13:28:51 +00:00
Kai Vehmanen b95d995bd2 xtensa-build-zephyr: add -v option for verbose build
Align with xtensa-build-all.sh and add a "-v" option to toggle
verbose build log ("west -v build").

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-05 13:23:00 +00:00
Mark Barton 7901eec1ca arch: add configuration override to enable DTS codec on mt8195
Allow SOF to be built for mt8195 platform with DTS codec and SOF IIR EQ enabled.

Signed-off-by: Mark Barton <mark.barton@xperi.com>
2022-01-05 13:15:35 +00:00
Lionel Koenig ba2d4fea72 comp: Add mock for google_rtc_audio_processing
This adds a mock to be able to build with the
google_rtc_audio_processing component.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-01-04 15:24:18 -08:00
Lionel Koenig 9ee413bf46 comp: Add initial Google AEC
Introduce a new component to perform acoustic echo cancellation
on capture path using a buffer from the playback as a reference.

1. Put the google_rtc_audio_processing at
$SOF_REPO/third_party_libraries
  - libgoogle_rtc_audio_processing.a
  - libgoogle_rtc_audio_processing_tuning.a
  - libc++.a (Corresponding stdlibc++)
  - libc++abi.a
2. Put the header in $SOF_REPO/third_party_includes
  - google_rtc_audio_processing.h

3. Build firmware and tool with xcc

4. To verify it works:
  - aplay some speech
  - At the same time arecord the mic which uses AEC
  The mic signal should not exhibit any echo from the playback.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-01-04 15:24:18 -08:00
Marc Herbert f45f5dffec xtensa-build-zephyr.sh: remove x-prefix in comparisons
Fixes new shellcheck 0.8.0 warning:

SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a
purpose.

This script requires bash anyway.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
Marc Herbert 0d39ff6b91 xtensa-build-zephyr.sh: add missing "${SOF_TOP}" quotes
Fixes commit a8c333b606 ("xtensa-build-zephyr: add deterministic
sha256sum of final .ri file")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
YC Hung 606cd44bc8 topology1: mt8195: support 1ms pipeline playback period
1. Default support 1ms period playback pipeline to update host position
more precisely.
2. Revise pcm node number description

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-01-03 21:38:43 +00:00
Guennadi Liakhovetski e0ff1b16d8 zephyr: add a generic Zephyr platform
When built with Zephyr, SOF ideally should be a fully platform-
agnostic application. All platform-specific code should reside in
Zephyr itself, including core architecture and platform
infrastructures and drivers. To prepare for this transition we add a
generic SOF-Zephyr platform. It is based on the current Tiger Lake
architecture and should be usable for cAVS 2.5 and newer systems.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-31 08:06:24 +00:00
Uday M Bhat 37ad90ba1c topology2: cavs-nocodec: support for the remaining 2 devices for nocodec
Current cavs-nocodec support only 1 playback device
This is to support 2 playback/capture devices.
Due to this, DMIC is moved PCM from 1 to 3

Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
2021-12-30 22:08:20 +00:00
Brent Lu 03adf55bed topology: sof-adl-max98357a-rt5682-4ch: add new topology
Add support for four max98357a speaker amplifiers running in TDM mode
which format is 8 slots with 32 bit slot/sample width on ADL boards.
The only difference between this one and sof-adl-max98360a-rt5682-4ch
is the SSP port for speaker amplifiers; this one is using SSP2 while
max98360a's topology is using SSP1.

This topology implements a 4-channel pipeline directly to speaker
amplifiers so audio effects need to be done in user space.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-12-27 20:53:31 +00:00
Marc Herbert 8f3f2d6f4b Revert "topology: redirection to workaround hardcoded alsatplg permissions"
This reverts commit eb34437522.

Fixes #5113

The `alsatplg -o -` feature is incompatible with `-v` and basically
buggy because it happily sends .tplg output and debug statements to
the same place without a care. To reproduce the bug, simply run:

   VERBOSE=1 ./scripts/build-tools.sh -T

... then observe .tplg output files like this:

B0x003d3b/015675 - pcm 'DMIC': write 912 bytes
B0x0040cb/016587 - pcm 'HDMI1': write 912 bytes
B0x00445b/017499 - pcm 'HDMI2': write 912 bytes
B0x0047eb/018411 - pcm 'HDMI3': write 912 bytes
B0x004b7b/019323 - pcm 'DMIC16kHz': write 912 bytes
B0x004f0b/020235 - block size for type be (11:10) is 0x2ad4/10964
B0x004f0b/020235 - header index 0CoSA^E^@^@^@^@^@^@^@^H^@^@^@$^@^@
^@^@^@^@^@s^@^@^@^@^@^@^@^A^@^@^@p^@^@^@ ^@^@^@.^@^@^@ ^@^@^@^F^@^
@^@^F^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^
@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^
@^@^@^@^@^@^@^@^@^...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-25 20:55:54 +00:00
Marc Herbert ecd2d464f9 Revert "zephyr: fix build after a recent trace filter PR"
This reverts commit b31d19b6c2.

Part of the fix for #5032

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-25 20:54:50 +00:00
Marc Herbert 749d41d577 Revert "trace: do not set trace_ctx section for Zephyr [REVERTME]"
This reverts commit 206df545c4.

Part of the fix for #5032

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-25 20:54:50 +00:00
Adrian Bonislawski ea85ccf25f ipc4: copier: update source format if needed
used only for rare cases where two pipelines are connected by a shared
buffer and 2 copiers, this will set source format only for shared buffers
for a short time when the second pipeline already started
and the first one is not ready yet along with sink buffers params

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2021-12-25 20:49:48 +00:00
Marc Herbert 8e8d1060f5 logger: move "log_entry_address x not in dictionary range" to stderr
Make DMA trace corruption #5120 a bit more visible in the logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-25 20:46:32 +00:00
Chao Song b673d4a3e2 test: improve compatibility for malloc
The C header file malloc.h does not exist on
some Xtensa processor configurations or host OSes,
include stdlib.h instead because they both provide
the prototype for 'malloc' function.

Fixes: #5102

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2021-12-25 20:44:02 +00:00
Mark Barton 37ce03fbd9 topology1: mt8195: Remove DTS-specific workaround for period
In a previous commit DTS changed the period of this topology to 1000 when `DTS` was defined. This
commit removes this behaviour as DTS codec now supports the original period for this topology

 Signed-off-by: Mark Barton <mark.barton@xperi.com>
2021-12-25 20:41:25 +00:00
Mark Barton 1727cecb0d audio: codec_adapter: Support for arbitrary periods in DTS Codec
DTS Codec can accommodate topologies containing pipelines with periods other than 1000.

Signed-off-by: Mark Barton <mark.barton@xperi.com>
2021-12-25 20:41:25 +00:00
Marc Herbert 5d66f1dac4 cmake: fix .ldc chksum fallback when no SOURCE_DIRECTORY/.git
Fixes old (Aug 2020) and untested commit b2a325a3b7 ("cmake: Handle
empty SOF_SRC_HASH_LONG") which tried to use GIT_LOG_HASH as a fallback
for the SOF_SRC_HASH .ldc checksum but always fell back on "0" instead
because of a misunderstanding of cmake's surprisingly complex "if"
operator.

Before Zephyr this was not an issue in practice because GIT_LOG_HASH was
empty anyway when SOURCE_DIRECTORY/.git was missing, so there was
nothing to lose.

For the Zephyr builds this will now use the SOF SHA1 as the .ldc checksum
for now. Probably not ideal yet but far better than the current constant
"0" which means no check at all.

Also log the SOF_SRC_HASH fallback value now and change the second
fallback (when GIT_LOG_HASH is also missing) from "0" to the
searchable hexspeak "baadf00d".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-24 22:15:13 +00:00
YC Hung 7981197f6d platform: mt8195: implement dsp clock function
Implement set_freq callback function to set dsp clock, dsp clock source
can be 26M(13/26M) or ADSPPLL(370/540/720M) for different use cases,
default support is 720MHz.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2021-12-24 21:59:52 +00:00
Bartosz Kokoszko b1ff2b303c ll_schedule: unregister domain in free function with IRQ_ONLY_FLAG
scheduler_free_ll() function should invoke domain_unregister()
in case when SOF_SCHEDULER_FREE_IRQ_ONLY flag is used, because
in timer domain case, timer_domain_unregister() function
unregisters timer interrupts.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2021-12-23 20:38:09 +00:00
Seppo Ingalsuo 7552de76cf Audio: KPB: Optimize kpb_copy_samples() function
The audio_stream_read/write_frag_s16/s32() functions usage and
sample-by-sample copying are replaced by more efficient block
memcpy() operations.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Seppo Ingalsuo 906131a255 Audio: KPB: Optimize kpb_buffer_samples() function
The audio_stream_read_frag_s16/s32() functions usage and
sample-by-sample copying are replaced by more efficient block
memcpy() operations.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Seppo Ingalsuo d8288601db Audio: KPB: Optimize kpb_drain_samples() function
The audio_stream_write_frag_s16/s32() functions usage and
sample-by-sample copying are replaced by block memcpy()
operations.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Seppo Ingalsuo 40046a2d25 Audio: Move audio stream copy inline functions to component.c
This patch moves functions audio_stream_copy(),
audio_stream_copy_from_linear(), and audio_stream_copy_to_linear()
into component.c. The functions are not changed.

There is no measurable code execution time
increase. In a test build this change saved about 800 bytes.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Seppo Ingalsuo 3d6b7c5730 Audio: Improvements for audio_stream_copy() function
The changes are:

- Prevent the inner MIN() from being evaluated twice. Due to
macro implementation the inner MIN() is evaluated first in
comparison and second time if latter parameter for MIN() is
selected.

- memcpy() instead of memcpy_s() and no assert check is faster in
hot path. The MIN() operations before data copy ensure that
bytes_copied is within limits of sink. In a component copy speed
test this saved 1 MCPS.

- The void pointer type casts are avoided with uint8_t type. The
pointer arithmetic lines are also made more compact.

- The internal variables for byte size are changed to size_t for
similarity with other copy functions.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Seppo Ingalsuo 7c83270582 Audio: Add to audio_stream.h copy between linear and circular
This patch adds inline functions audio_stream_copy_from_linear()
and audio_stream_copy_to_linear(). They are useful for fast
copy from SOF buffer to a linear memory region or vice versa.

Note: memcpy() is used instead of memcpy_s() because this is a
hot path.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-22 21:51:46 +00:00
Lionel Koenig 996a067632 topology: Ensure buffers get allocated on 0.
Ensure all buffers got allocated by core 0

Signed-off-by: Lionel Koenig <lionelk@google.com>
2021-12-22 21:34:38 +00:00
Rander Wang 4b201717bd ipc4: refine frame size calculation for 44.1khz
Dma buffer size should align with 32bytes which can't be compatible
with current 45K adjustment. 48K is a suitable adjustment. Change
the function since we are really calculating the nearest period frames

Tested 44.1khz music on both Linux & windows

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-12-22 21:13:20 +00:00
Marc Herbert 352ed2ca4b logger: when FW is loaded, show the expected checksum in -d output
Sample output:

logger ABI Version is   5:3:0
ldc_file ABI Version is 5:3:0
ldc_file src checksum           0x07d4f1ad
Loaded FW expects chksum        0x07d4f1ad       <=== NEW!

Components uuid dictionary size:        2400 bytes
Components uuid base address:           0x1fffa000
...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-22 20:11:25 +00:00
Marc Herbert 4aaffbe9a2 logger: add dictionary checksum in output of dump_ldc option
Since commit 901f991eee ("logger: Validate by src_hash instead of abi
version from fw_ready") the dictionary checksum has become the most
important information.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-22 20:11:25 +00:00
Marc Herbert 9ce91cbf74 logger: rename verify_fw_ver() to verify_ldc_checksum(), fix -h help
Fixes commit 901f991eee ("logger: Validate by src_hash instead of abi
version from fw_ready") that changed the feature without updating the
name.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-22 20:11:25 +00:00
Guennadi Liakhovetski ffc7cf5955 pm_runtime: unify function prototypes for cAVS platforms
All cAVS platforms use the same pm_runtime.c implementation, no need for
separate headers, repeating the same function declarations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-21 16:46:41 +00:00
Ranjani Sridharan b15e0a9e8e audio: codec_adapter: remove init_process op from the interface
In preparation for defining a generic module interface API that can
replace the existing codec_adapter interface and the comp_driver
interface, remove the init_process op from the codec interface.

The init_process operations will still be performed in the
codec-specific process op if the init_done flag is not set.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-12-21 16:33:09 +00:00
Ranjani Sridharan 75ee66ae7f audio: codec_adapter: Remove get_samples op from the interface
In preparation for defining a generic module interface API that can
replace the existing codec_adapter interface and the comp_driver
interface, remove the get_samples op from the codec interface.

The get_samples op is only defined for the cadence codecs at the moment,
so the check for free space in the local buffer in codec_adapter copy is
bogus for other codecs because it will be 0 anyway.

So move the check for free space to be performed during the first copy
after initialization in the codec-specific code.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-12-21 16:33:09 +00:00
Guennadi Liakhovetski 26577b21de alloc: don't initialise rballoc() memory
rballoc() doesn't guarantee zero-initialised memory, besides it's
often enough called at run-time and for relatively large buffers, so
performance losses aren't negligible. Remove the bzero() call.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-21 16:21:10 +00:00
Marc Herbert ca64ccf7a9 math/trig.c: remove bogus \CORDIC doxygen command
Fixes warnings:

sof/src/math/trig.c:42: warning: Found unknown command '\CORDIC'
sof/src/math/trig.c:103: warning: Found unknown command '\CORDIC'
sof/src/math/trig.c:183: warning: Found unknown command '\CORDIC'
sof/src/math/trig.c:42: warning: Found unknown command '\CORDIC'
sof/src/math/trig.c:103: warning: Found unknown command '\CORDIC'
sof/src/math/trig.c:183: warning: Found unknown command '\CORDIC'

etc.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-21 15:33:52 +00:00
Shriram Shastry 29fa4e1a9c math : Add square root function using lookup table
fix point math square function having positive number y as input and
return the positive number x multiplied by itself (squared)

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2021-12-21 15:30:20 +00:00
Ranjani Sridharan 5ce0d2b43f topology2: gain: fix dB scale min and step values
It is not intuitive for the end-ser to set linear values for
minimum gain. Set the dB gain min value to -90dB and steps to 2dB.
Also, modify the max to 45 to allow the volume gain range -90dB to 0dB.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-12-21 15:20:47 +00:00
Lionel Koenig 60944b31f9 hal: Add compare_exchange atomics for xtensa.
Add compare_exchange atomic for better support of std::atomic when using
c++.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2021-12-21 15:10:50 +00:00
Allen-kh Cheng 8cfa1cf720 platform: mt8195: adjust dram audio shared size
Increase buffer size for legacy audio for mt8195.

Signed-off-by: Allen-kh Cheng <allen-kh.cheng@mediatek.corp-partner.google.com>
2021-12-20 23:08:21 +00:00
Guennadi Liakhovetski aa767fd5ce zephyr: remove non-existent directories from CMakeLists.txt
Two directories for cAVS 2.0 and 2.5 in Zephyr CMakeLists.txt don't
exist. They're safely ignored, but remove them to avoid confusion.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-20 22:58:27 +00:00
Marc Herbert a8c333b606 xtensa-build-zephyr: add deterministic sha256sum of final .ri file
Checksumming the final binary is useful to compare before/after some
configuration change or to compare builds across different people /
systems.

Because rimage is not deterministic, ask sof_ri_info to do this.

Sample output:

Firmware file size 0x55000 page count 79
 pkcs_v1_5_sign_man_v1_8: signing with key
               'modules/audio/sof/keys/otc_private_key.pem'
 pkcs: RSA private key is valid.
 pkcs: digest for manifest is 5b52ac0b8809503c817a96dac7c5124dba5a90d...
Firmware manifest and signing completed !
Extended manifest found module, type: 0x0001 size: 0x01A0 ( 416) offset:
Extended manifest found module, type: 0x0005 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0004 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0003 size: 0x0030 (  48) offset:
Extended manifest found module, type: 0x0002 size: 0x0070 ( 112) offset:
Extended manifest found module, type: 0x0000 size: 0x0050 (  80) offset:
Extended manifest saved zephyr/zephyr.ri.xman size 0x02E0 (736) bytes

SOF Binary build-apl/zephyr/zephyr.ri size 0x4f2e0

  Extended Manifest ver 1.0.0 length 736

  cavs0015 (ADSP Manifest) file offset 0x22e0 name ADSPFW build ver
             0.0.0.0 feature mask 0xffff image flags 0x0
    HW buffers base address 0x0 length 0x0
    Load offset 0x2000

sha256sum build-apl/zephyr/reproducible.ri
46f3404e3b674ed....120c2173d6050bde35b build-apl/zephyr/reproducible.ri

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-20 22:35:09 +00:00
Marc Herbert 630b55e40a cmocka/test-all-defconfig.sh: add banners between platforms
Sample output:

[ 97%] Built target acos_32b_fixed
[ 98%] Linking C executable volume_process
[ 98%] Built target volume_process
[100%] Linking C executable strcheck
[100%] Built target strcheck

    =========  Building cmocka tests for broadwell_defconfig ======

+ cmake -DINIT_CONFIG=broadwell_defconfig -S /srv/mherber2/SOFub20/sof
   -B build_ut_defs/broadwell_defconfig -DBUILD_UNIT_TESTS=ON
   -DBUILD_UNIT_TESTS_HOST=ON

-- version.cmake starting SOF build at 2021-12-17T01:09:44Z UTC
-- Building git commit with parent(s):

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-20 22:34:03 +00:00
Marc Herbert 9005c90f3c cmocka: make test-all-defconfigs.h runnable from anywhere
Make test-all-defconfigs.h runnable from anywhere by merely adding a
cmake -S option.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-20 22:34:03 +00:00
Seppo Ingalsuo 0d296ce7d1 Tools: Tune: Make example FIR response long for large IPC test
The loudness EQ is changed to 250 taps to create large IPC
message type. It also improves subjective quality of this
effect with better bass response. The earlier version was
made very short to fit the that time IPC size limit.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-20 22:33:06 +00:00
Guennadi Liakhovetski afac44af5f trace: move identical code to a common header
Contents of platform/trace/trace.h on all cAVS platforms are
identical, replace them with a common header.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-16 20:26:24 +00:00