Commit Graph

6499 Commits

Author SHA1 Message Date
Kai Vehmanen bc6888ecab zephyr: add sample-smart-amp component to the wrapper
Add the sample-smart-amp to the wrapper build if the component
is enabled in build config.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-06 14:45:05 +01:00
Kai Vehmanen e6729f0106 samples: fix prototype for smart_amp_test
Initialize sys_comp_smart_amp_init() with UT_STATIC to make
it unit-testable.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-06 14:45:05 +01:00
Daniel Baluta 8397e064da topology: Allow overriding DAI_PERIODS
This will allow topologies to use different size dai periods.

Fixes: 1280987999 ("topology: use DAI_PERIODS in calculation of DAI buffer size")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-05-06 14:44:20 +01:00
Marc Herbert 55e292ee85 xtensa-build-zephyr: add mkdir -p modules/audio
More robust support for "manual" installations.

Also rephrase usage string to remove a single quote breaking
the shell parser in one editor I use (sorry).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-06 14:36:25 +01:00
Jaska Uimonen b1775f27ea topology: define a channel map macro for all topologies
Previously we had a channel map macro only in general dmic topology. As
the pipelines used with dmic are also used with other topologies the
dmic specific macro does not work anymore. Thus define generic macro in
pipeline.m4 that defaults to stereo channel map. This can be overridden
in topologies as shown in general dmic.

fixes: #4136

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-06 14:34:23 +01:00
Ranjani Sridharan f2bd51a138 Revert "topology: Switch HDA topologies to use dynamic pipelines"
This reverts commit 2c69afc5fd.
The dynamic pipeline feature is broken with PA enabled. Revert
this change until the issue is sorted.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-05-06 14:31:50 +01:00
fy.tsuo 37d97d4357 audio: igo_nr: Added intelliGo noise reduction wrapper code and topology
This commit consists of files for adding IGO_NR component in arbitrary
topology. The proprietary static library shall be released by intelliGo
via private channel upon request.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-05 12:48:47 +01:00
fy.tsuo 776977852a topology: Added IGO_NR in sof-tgl-max98373-rt5682 topology.
This commit added IGO_NR component into sof-tgl-max98373-rt5682.m4
as DMIC capture PCM99 pipeline.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-05 12:48:47 +01:00
Guennadi Liakhovetski 59d2318a4c zephyr: schedule: enable multi-core scheduling
Initialise LL-schedulers on secondary cores too, which also
requires per-core scheduler data.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Guennadi Liakhovetski 3fefbf55f9 zephyr: notifier: per-core notifier support
Notifier data has to be per-core and its allocation is
performed in init_system_notify(), no need to also do it in
architecture code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Guennadi Liakhovetski 084b851e33 zephyr: fix multicore booting and status management
sof_main() doesn't run on secondary cores. Instead we provide
a new function, that initialises a dummy thread, runs SOF
initialisation by calling secondary_core_init() and switches
over to the dummy thread.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Guennadi Liakhovetski b406ca1ae8 zephyr: make timer-domain and EDF threads per-core
When running on Zephyr, timer domain and EDF scheduling is
implemented by per-core work queues. Make sure they only run
on designated cores.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Guennadi Liakhovetski bf4a65f2fa zephyr: allow multicore builds
Lift the temporary restriction on Zephyr builds: re-enable
multi-core support.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Guennadi Liakhovetski 385586a5f6 zephyr: implement IDC using P4WQ
When running on Zephyr we use P4WQ to implement inter-core
messaging.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-05 11:03:35 +01:00
Jaska Uimonen 147b6fcbfe kconfig: add separate format configs for pcm converter
Pcm converter function definitions are under same format configs as all
other component format configs. This creates problems if you want to for
example configure whole pipeline to 16 bits but your dai needs to be
fixed in other format. Thus duplicate and rename the format configs for
pcm converter for fine grained tuning.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-05 09:49:29 +01:00
Marc Herbert 0f989b10e9 xtensa-build-zephyr.sh: show zephyr short git log / version after clone
By default, the Zephyr build does not log its version. The fix has
already been submitted at
https://github.com/zephyrproject-rtos/zephyr/pull/34842 however:

- 34842 may take some time. Zephyr reviewers are even busier than the
  SOF reviewer.
- 34842 could even be rejected
- 34842 will at best log the SHA1 and no context. This is more verbose
  and future-proof because it supports more complex situations like
  testing a pull/12345/merge

As seen in (unrelated) PR #4123, we need Zephyr git versions NOW.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-05 09:45:55 +01:00
Marc Herbert 61f286c8a9 build-zephyr.sh: don't update rimage every time we run
Fixes 33c5f5d38e ("xtensa-build-zephyr: do not clone a second version of
sof.git")

The very first version of this test was checking whether the rimage/
directory exists, which proves nothing. So I switched to
rimage/CMakelists.txt but forgot change the `test` flag.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-05 09:43:54 +01:00
Seppo Ingalsuo b12ce50712 Topology: Add build of topology to run ASRC in cml-rt1011-rt5682
This patch adds development topology to run ASRC playback and
capture via SSP port to headset plug. We don't have many topologies
to test ASRC in current development devices so this is useful

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-05-04 20:04:13 +01:00
Daniel Baluta cdd64aa9f6 codec_adapter: Remove processing loop
Calling codec_process() multiple times in a loop limits the minimum
pipeline period we can choose.

For example with AAC one codec_process() can take up to 0.7ms which
means that we cannot reliable set pipeline period to 1ms on i.MX where
DSP has only 1 core.

In order to avoid this and to simplify the code remove the processing
loop hence each codec_adapter_copy() call will call exactly once the
codec_process() function.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-05-04 19:55:05 +01:00
Karol Trzcinski 234faf1879 rimage: Update
994ee247e1 ext_man: Fix code formating
6c44aefb1f ext_man: Fix memory leak after manifest build
dbb49e03b9 rimage: add cavs fw layout support
0d641a7b05 minor -h fix: -s meu_offset disables rimage signing
0dba230832 pkcs_v1_5_sign_man_v2_5(): add "salt length" comment

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-05-04 16:14:00 +01:00
Guennadi Liakhovetski 9e84ec2726 schedule: (cosmetic) use container_of() instead of a type-cast
Where possible container_of() should always be used instead of
direct type-casting.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 5a5d82eeb3 cavs: (cosmetic) remove superfluous parentheses
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 89eea6c5a9 cavs: register number is always 32-bit
Even when addressing 16-bit data the register number remains
the same - 32-bit.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski ac6939868c init: (cosmetic) make primary_core_init() static
primary_core_init() is never called from outside init.c, make
it static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 0eba431d66 schedule: edf: use a proper type for schedule_edf()
Now that schedule_edf() is just a static function, use a
proper type for its parameter.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 61c91be9fd scheduler: remove .scheduler_run
The .scheduler_run() operation is never used, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski fad27f13d1 zephyr: remove LOG_* API left-over
Remove a log-module declaration to eliminate unused static
variables until we return to using the LOH_* Zephyr API.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski e111252a5f zephyr: move library platform code to platform.c
Move logging code and static data to platform/library and
declare a LOG module properly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 1e4ff1ed5b perf: (cosmetic) use a high level API function
Call timer_get_system() instead of arch_timer_get_system().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 23fc4e5bc9 cavs: (cosmetic) add a comment to clarify function scope
Clarify, that platform_init() only runs on the primary core.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 369a59431a scheduler: make ops static
In both native and Zephyr builds schedule_edf_ops and
schedule_ll_ops are only used in one file each, make them
static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski 0c7e4c3255 init: (cosmetic) simplify a function
Simplify a function by removing a redundant variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Guennadi Liakhovetski ea1eda4faf xtensa: (cosmetic) fix a typo in a comment
Fix a typo: remove a duplicate "the."

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-04 16:10:49 +01:00
Marc Herbert ce52555173 numbers.h: simplify #ifndef ZEPHYR for MIN and MAX
Undefining and re-defining MIN/MAX when already defined is
convoluted. Simply define them if not __ZEPHYR__ instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-04 16:05:58 +01:00
Jaska Uimonen 301b98e5d2 dai: add check for NULL pcm converter function
If processing format is restricted from Kconfig there's a possibility of
pcm_converter not having proper conversion function. Thus check for NULL
in dai to avoid crashes.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-04 16:05:36 +01:00
Brent Lu 1ccc16c27d topology: sof-glk-da7219: add support for cs42l42
Add support for cs42l42 running on GLK boards. We add a 10 ms BCLK
delay to the SSP_CONFIG_DATA of SSP2 since the codec PLL is locking on
BCLK. Without the delay, there could be noise on TX path.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-05-03 22:17:13 +01:00
Curtis Malainey 7f604fb63f mux: conditionally compile format specific functions
we are building unused functions if we only enable specific formats,
lets put them with the functions that use them

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-03 22:11:33 +01:00
Marc Herbert cf85f21d08 numbers.h: downgrade MIN() and MAX() to unsafe versions
For compatibility with Zephyr, MIN and MAX macros are downgraded to the
basic, compile-time, standard compliant and unsafe implementation.

This means the code will now be the same whether it's compiled with Zephyr
versus not.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/33567 which
means it's now possible to use MIN() or MAX() in either Zephyr's
BUILD_ASSERT() or in SOF's equivalent STATIC_ASSERT() or in C11's
_Static_assert()

This implementation is unsafe because it can evaluate its arguments
twice which is obviously not desired when the argument has side-effects:

https://wiki.sei.cmu.edu/confluence/display/c/PRE31-C.+Avoid+side+effects+in+arguments+to+unsafe+macros

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-03 10:04:09 +01:00
Marc Herbert 9622079d2f Remove all function calls in arguments to MIN() and MAX() macros
For consistency with Zephyr, MIN and MAX macros are "downgraded" to the
basic, compile-time, standard compliant and unsafe implementation that
Zephyr uses. "Unsafe" because it can evaluate its arguments twice which
is obviously not desired when the argument has side-effects:
https://wiki.sei.cmu.edu/confluence/display/c/PRE31-C.+Avoid+side+effects+in+arguments+to+unsafe+macros

I reviewed every single invocation of MIN() and MAX() and found no
increment or assignment but I found a number of function calls in their
arguments. This commit removes them all. Note I did _not_ check for
volatile variables.

Most of these functions do not appear to have side-effects _but_ it's
much simpler and faster for the reader or static analyzer not to even
have to wonder about the possibility of side-effects and it's also more
future-proof; no risk of a function accidentally gaining side effects.

Note the following files are not compiled in the default configurations
and the changes in them were NOT compile-tested locally:

src/audio/codec_adapter/codec_adapter.c
src/audio/drc/drc_generic.c

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-03 10:04:09 +01:00
Marc Herbert e27cb45663 .github: add scant_fuzzer.yml build
This is NOT how to properly compile the fuzzer, this is only to detect
earlier and faster problems like
https://github.com/thesofproject/sof/pull/3824 (288e228) and
https://github.com/thesofproject/sof/pull/4118 (758e7be)

In other words, when reverting the oss-fuzz parts of either of these
commits this build fails as desired.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-03 09:31:00 +01:00
Daniel Baluta c2fe4ff10b codec_adapter: Add CONFIG options to select Cadence libraries
Each type of codec will have its own config option that will point
to the path in build filesystem where library binary is located.

This will make compiling Cadence libraries binaries more flexible.

The libraries will be statically linked with SOF firmware.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-30 16:31:46 +03:00
Marcin Rajwa 71bad3eef7 codec_adapter: state rework
This patch simplifies codec adapter state machine by removing
redundant state "ca_state" plus extending the other one with
new states like IDLE or PROCESSING.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-04-30 11:57:43 +01:00
Marcin Rajwa 65184ad300 codec_adapter: allow early config apply
This patch allows to apply runtime configuration as soon
as codec got created. This is too avoid high load spikes
which may happen when whole, large config blob is being
applied along side codec processing.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-04-30 11:57:43 +01:00
Marcin Rajwa 6c106e1567 cadence codecs: move reset of default values to init
Thanks to this change we reset all params to default values
on start, and reset only. The later is because on reset we
call init again due to lack of explicit reset API for cadence
codecs. Now we can apply runtime params earlier, during prepare or
as soon as codec has been instantiated and they won't be reset.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-04-30 11:57:43 +01:00
Marcin Rajwa 611f81e7a7 codec_adapter: Remove redundant state verification
The state has already been verified on the codec_adapter level.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-04-30 11:57:43 +01:00
Curtis Malainey 758e7be0c9 oss-fuzz: fix build
looks like with the new ipc mechanisms we changed the function signature
and moved casting the message from platform code to ipc code.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-30 11:50:16 +01:00
Marc Herbert 014a386dfb .github: add Zephyr build
Use the official image from the Zephyr project
https://github.com/zephyrproject-rtos/docker-image

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:12:29 +01:00
Marc Herbert 33c5f5d38e xtensa-build-zephyr: do not clone a second version of sof.git
This script lives in a sof.git/ clone yet it was systematically cloning
a second sof.git/. Besides the obvious confusion and risk of editing the
wrong files, this meant it was not possible to build code that has not
been merged yet! This was a problem for both CI and developers. Fixed by
using symbolic links to ourselves instead.

Note it is _still_ possible to build from another sof.git clone if
desired, however this script will never git re-clone a second sof.git
itself, that second clone has to be created (e.g.: by west) before this
script runs.

When cloning a brand new zephyrproject, use a shallow zephyr clone and
download only the two zephyr modules we actually use. This speeds up
automation considerably and makes it much faster for non-Zephyr
developers to reproduce Zephyr issues. Developers can always git
unshallow and west update once if they want to.

Rename the default west top to "zephyrproject" to not just match the
zephyr documentation but to also avoid creating a double zephyr/zephyr/
directory.

See the new print_usage() for a few more implementation details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:12:29 +01:00
Marc Herbert 831bb3755b xtensa-build-zephyr: fix "die()" function
It still looks smart but the \n addition compared to the original
version in xtensa-build-all.sh broke it for more advanced cases:

die '%s %d' str 5
-bash ERROR: -bash: printf: 5\n: invalid number

As reported by shellcheck. shellcheck saves lives.

In scripts/xtensa-build-zephyr.sh line 22:
	>&2 printf "$@\n"
                       ^-- SC2145: Argument mixes string and array.
                        Use * or separate argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:12:29 +01:00
Marc Herbert 80c482815b xtensa-build-all.sh: replace "type xtensa-bxt-elf-gcc" with "command -v"
... because the latter does not print on stderr when not found; so IDEs
and CIs don't display this as a warning.

Also remove the "... and ignore set -e" comment that made sense at the
time of commit cad86dc340 ("scripts: xtensa-build: fix alias detection
for bxt/apl gcc") but not anymore.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:11:22 +01:00