Commit Graph

5282 Commits

Author SHA1 Message Date
Marc Herbert 1002899b95 Use '-imacros config.h' instead of explicit #include <config.h>
Using -imacros on the compiler command line instead of explicitly
including config.h is not just less tedious in the future:
- it also makes sure configuration always comes first and is never
  accidentally missed by an earlier #include
- it makes sure all translation units get the (same) configuration
- it lets parent projects like Zephyr override the config.h name

To test this I ran ./scripts/xtensa-build-all.sh -a -r, compared
binaries before and after this change and found no output difference.

Full disclosure: this required a few unrelated tricks not submitted here
like a .tarball-version file, commenting out __DATE__ and __TIME__ in a
few places, running strip-determinism on the .a files because our
crosstool-ng reference is not cutting-edge, etc.

As Tigerlake is not built by default it required a couple more hacks to
compile.

Blank lines are left instead of the former #include lines so even debug
objects are the same.

Only defconfigs were tested. On the other hand, this commit was _not_
performed by a script but by changing the name of the generated file and
clicking on and fixing every build failure. This proves that every
removed #include was actually required by one or more tested defconfigs
and that the added -imacros flag does affect the compilation of all the
modified files.

There is no #include config.h left: they were all in use in at least
one _defconfig.

I think comparing all binaries produced by ./scripts/xtensa-build-all.sh
-r -a provides extensive enough coverage but note this was tested only
with the crosstool-ng toolchain described in the SOF documentation.

The obsolete[*] xt-xcc front-end is gcc-based and the newer xt-clang
front-end is (surprise) clang-based. clang (copies many gcc options and)
does support -imacros so I don't expect any issue with either xt-xcc or
xt-clang. In the worst case, I do not expect any compiler front end to
_silently_ discard any unknown command line flag nor to ignore a missing
or misnamed config.h file.

[*] https://github.com/zephyrproject-rtos/zephyr/issues/3165

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:01:26 +01:00
Marc Herbert d7d86cb609 CMakeLists.txt: make CONFIG_H_PATH a build parameter
No functional change for now.

This is needed because SOF is a CMake sub/"external" project when
building some host tools. We want to switch all projects to "-imacros
config.h" but subprojects cannot inform parents where their files are
located. So make parents able to dictate where config.h is instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:01:26 +01:00
Marc Herbert 4a87d8c967 xtensa-build-all.sh: add tgl with xtensa-cnl-elf. No rimage yet.
Copy the icl and cnl configurations.

This build with the gcc toolchain has NOT been tested on tgl. The
purpose is purely to add the gcc build to CI, avoid future gcc bitrot
and catch more warnings and bugs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:00:56 +01:00
Marc Herbert 6833c5d542 xtensa//cpu.c: give void _WindowOverflow4 a type, fixes -Werror
Fixes this -Werror on tgl platform:

.../xtensa/lib/cpu.c:65:38: error: taking address of expression of
  type 'void' [-Werror]
    void *dyn_vec_start_addr = (void *)(&_WindowOverflow4);

While "void foo;" is syntactically correct, doing anything with it is
illegal in standard C.  Only the tgl platform was affected because it's
the only one with CONFIG_NO_SLAVE_CORE_ROM right now.

Any C type works, I tried a few and when compiling with xtensa-cnl-elf
they all produce the exact same -g0 binaries than the original without
-Werror. I find that the uint8_t[] type doesn't make _WindowOverflow4
look too different from what it is: assembly code.

This is the only change required to compile with the xtensa-cnl-elf
crosstool-ng toolchain documented in the getting started guide.

Note the build with this xtensa-cnl-elf gcc toolchain has NOT been
tested!  The purpose of this commit is purely to add the gcc build to
CI, avoid future gcc bitrot and catch more warnings and bugs.

Fixes  #2516 / commit be083cf350 ("cpu: unpack dynamic vectors")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:00:56 +01:00
Janusz Jankowski 3d8a0ac809 chrome: config: enable LPRO for TGL
Set LPRO as default clock for power optimizations.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2020-06-18 16:47:20 +02:00
Karol Trzcinski 99f7ad112a ipc: pipe: Fix pipe id value in log message
`pipe` should refer to `pipeline_id`, using `comp_id` is misleading.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-18 12:11:13 +02:00
Adrian Bonislawski b6485b2fa4 arch: shared_vecbase cache fix
This will fix cache handling for shared_vecbase and allow to
boot slave cores in a proper way.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-18 12:09:25 +02:00
Bartosz Kokoszko f06da576cf smart_amp: add smart amplifier test component
Smart amplifier should be used in following topology:

                 +------------------------------------------+
     +------+    | +---+  +-------------+  +---+  +-------+ |
     | Host |----->|Buf|->|  Smart Amp  |->|Buf|->|SSP Dai|-----------+
     +------+    | +---+  +-------------+  +---+  +-------+ |         |
                 +-----------------^------------------------+         |
                                   |                                  |
                                 +---+                                |
				 |Buf|                                |
                                 +---+                                |
                                   ^                                  |
                 +-----------------|--------------------------+       |
     +------+    | +---+  +--------|------+  +---+  +-------+ |       |
     | Host |<-----|Buf|<-|     Demux     |<-|Buf|<-|SSP Dai|<--------+
     +------+    | +---+  +---------------+  +---+  +-------+ |
                 +--------------------------------------------+

Smart amplifier test component does not implement any specific processing
algorithm at the moment. I can pass chosen channels from source (buffer
between Host and Smart amplifier) or feedback (buffer between Smart
amplifier and Demux component) buffers. Those channels are selected by
sending proper config to this component. Smart amplifier can be
configured via SOF_SMART_AMP_CONFIG or SOF_SMART_AMP_MODEL data
(similarly as it happens in detector case).

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-17 11:33:23 +02:00
Bartosz Kokoszko 4d9244f080 detector: replace private data model functions with generic ones
This commit replaces private detector component functions with
generic ones in order to remove code duplication.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-17 11:33:23 +02:00
Bartosz Kokoszko a2d1e1efdc component: add set of helper functions for large config configuration
This commit rewrites functions responsible for large config configuration
from detect_test component and puts them in component.c file as
generic ones - as a result they can be used by other components.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-17 11:33:23 +02:00
Bartosz Kokoszko 4f1090d083 mux: select demux proc function based on source buffer
Demux should select proc func based on source buffer,
because sink can be not set yet (e.g. this can be observed
in Smart Amplifier topology scenario where we have
buffer between playback and capture pipeline).

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-16 15:01:16 +02:00
Janusz Jankowski 5257bd2dab cavs: timer: set logical_irq for arch timers
All timers should have logical_irq properly set up.
In case of arch timers logical_irq is equal to irq.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2020-06-16 10:19:37 +02:00
Marc Herbert e76ccbad59 scripts/xtensa-build-all.sh: clarify help of -c option
"Configure defconfig" misses the most important, interactive difference.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-16 09:04:05 +01:00
Marc Herbert 2afbbd0ef1 cmake/git-submodules: don't throw away work in progress at build time
- Add a simple test in cmake to download submodules only when rimage is
  missing. This stops randomly changing the source code from one build
  to the next and overwriting any submodule work in progress.

- Remove the GIT_SUBMODULE option which is now useless because rimage is
  not optional for sof

- Add a --merge option for safety. It makes zero difference right now
  but could save work in progress if we ever add more
  submodules (hopefully not) and someone struggles with submodules and
  ends up in a partially initialized state.

Git submodules are rarely ever the answer; these few changes make them a
bit more usable.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-15 21:23:30 +01:00
Karol Trzcinski a10b0ad27e ext_man: Port SOF_IPC_EXT_WINDOW to extended manifest
This information known at build time does not need to be
provided in a mailbox.
There was need to remove variable array from sof_ipc_window,
what give possibility to embed this struct inside another one,
but leads to ABI minor change.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-12 11:16:56 +01:00
Karol Trzcinski 8f318536ef ext_man: Add variables porting macro
Such a macro can be used to port .fw_ready structures to .fw_metadata
section with proper header.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-12 11:16:56 +01:00
Uday M Bhat 4d005a0554 topology: Add jsl+ MX98360a amp with ALC5682 Headset codec
Topology is modified to include another JSL+ product variant with
MX98360a AMP + ALC5682 Headset codec. Created a platform specific
for RT1015, included this and already existing MX98360a in
sof-jsl-rt5682.m4

Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
2020-06-12 11:00:28 +01:00
Daniel Baluta a8ec8bf8c6 .travis.yml: add IRC notifications
SOF has #sof dedicated channel on irc.freenode.net server.
This will enable travis ci to send notifications to the IRC
channel each time a build is finished (either successful or not).

We will see how this works and refine it later if it is too spammy.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-06-11 18:57:42 +01:00
Seppo Ingalsuo 700ca2ae9a Audio: Fix error trace for build specific limitation for FIR EQ
This patch fixes from errors trace a message where the length
parameter is always shown as zero:

ERROR Filter length 0 exceeds limitation for build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-10 21:31:52 +01:00
Karol Trzcinski 34507f4f94 trace: Improve sof/trace/trace.h code formatting
Align escape characters in macros, use tabs instead of spaces
(when possible), use single tab indentation in tracec context
declaration.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 21:30:50 +01:00
Karol Trzcinski 0de401f074 trace: Remove unused structures
Unused parts of code only makes maintanace harder.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 21:30:50 +01:00
Karol Trzcinski bb7ba30f45 trace: Keep only single _DECLARE_LOG_ENTRY definition
This definition is unusefull in LIBRARY build.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 21:30:50 +01:00
Karol Trzcinski 256d02adc3 trace: Move _log_message definition to same place for FW and library
The same function implementation should be kept in same place or in
separate implementation files, to easily get which one is used under
what condition.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 21:30:50 +01:00
Karol Trzcinski cd4b08a48e trace: Add condition name near #endif and #else
It's quite easy to get lost when long, multi level #if/#endif are
used, pointing corresponding condition name near #else and #endif
helps to keep context during reading.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 21:30:50 +01:00
Yong Zhi 52c1174c18 topology: Add jsl+ tplg for RT1015 amp and ALC5682 Headset codec
The topology is cloned from sof-tgl-max98357a-rt5682.m4 with
changes on ssp config, iDisp and DMIC pipeline pcm number etc.

The dai_index matches the order defined in sof-rt5682.c machine driver.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2020-06-10 12:03:33 +01:00
Seppo Ingalsuo f269d0c732 Topology: Add ASRC capture pipe for WM8804 SPDIF input
This patch adds capture PCM with ASRC for capturing from SPDIF
input of WM8804 codec. This topology is used mainly for testing
of a bi-directional ASRC connected slave-DAI.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-10 12:01:02 +01:00
Seppo Ingalsuo 17f281de97 Audio: Improve volume gain ramp length accuracy
This patch replaces the fixed step increment/decrement linear ramp
update with a time since transition start calculated direct line point
value. It does not suffer from accumulated rounding errors.

The new ramp_coef[] vector (that replaced ramp_increment[]) defines
per channel the slope coefficient as Q16.16 units per millisecond. The
slope points calculation needs a new counter variable that counts
frames since ramp start. Also the volumes vector at time of ramp start
need to be stored. The old fixed increment calculation related macros
are removed.

The zero crossings timed volume mode suffered from fixed step the most
since depending on signal the fixed step could update the value too
much or too little.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-10 11:53:30 +01:00
Karol Trzcinski c419fadc3e trace: Filter messages in runtime
Ability to change log level per UUID component improve user
experience during debugging firmware. Threshold trace level
defined in log message with value from trace context, where
trece context is related with component instance (local or
global instance).

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 11:51:41 +01:00
Karol Trzcinski 568ed165a7 pcm_converter: Fix first output sample pointer calculation
Output sample size is unrelated wit input one. To calculate
write pointer address, correct value should be use.
Without this path, output data will be placed in wrong memory
area, what results in corrupted output stream when output offset
differ from zero.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-10 11:49:33 +01:00
Adrian Bonislawski bfcdee6c90 tgl: align to hardware recommended flow for clock change
This patch will update our clock change procedure to align
with hardware recommended flow for TGL platforms

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-10 11:46:48 +01:00
Adrian Bonislawski 6b8e67c41b cpu: use simple counter to validate core power down
This will prevent core power down if it is not allowed
and still in use

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-10 11:46:48 +01:00
Marc Herbert 7f0a59be29 README.md: fix Travis badge not to show the random PR of the moment
As discussed in PR #2964, the Travis badge shows the status of the
master branch but it links to the random PR of the moment. Fix that link
to point to the more useful "branches" page which has the master branch
at the top.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-10 10:56:24 +01:00
Tomasz Lauda 3a72e9e5d6 kconfig: remove cAVS menu
Removes cAVS menu and moves all platform specific things
to platform menu.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-10 10:40:02 +01:00
Mohana Datta Yelugoti b504367189 ipc: use macro instead of a magic number for timeout period
Currently, in the ipc_schedule_process function, when we call
schedule_task to schedule an ipc task, we use magic number to
indicate the time kernel waits before calling timeout on an
IPC. This makes it difficult to search for the timeout period
using grep and other utilities. Replacing it with a macro makes
it easier to search and change only at one place.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-06-09 20:25:26 +03:00
Marc Herbert 428804e1cb scripts/qemu-check.sh: add set -e
qemu always times out and fails, ignore that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert 454b2b1f43 scripts/qemu-check.sh: add find_qemu_extensa()
qemu-check.sh can now be invoked from more places: not just the qemu
directory but also from sof/ and from their parent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert de8b043371 scripts/qemu-check.sh: unhardcode ../sof.git/
Find it with dirname "$0" instead. Can also be overridden with
SOF_BUILDS from now on.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert 7c0ab36ac3 scripts/qemu-check.sh: double-quote "$vars" expansion. Zero-change.
As reported by shellcheck SC2086.

Minor usage() fix.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Adrian Bonislawski cc0f713e75 ipc: header size validation fix
This patch will deny IPC headers with size 0

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-05 13:57:37 +01:00
Tomasz Lauda aef54e4066 init: add missing inclusion
Adds misssing inclusion of drivers\interrupt.h.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-05 10:23:06 +03:00
Tomasz Lauda 01819425f9 io: add additional variations of reg access functions
Adds additional variations of register access functions:
- 64 bit register write,
- 8 bit register read,
- 8 bit register write,
- 8 bit register update.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-04 15:51:53 +01:00
Karol Trzcinski 014499c5db component: Align struct description
If it's possible, each line with comment to struct field
should be aligned, to keep code style consistent.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-04 15:42:52 +01:00
Karol Trzcinski 2c6cf95c73 component: Use UUID value stored in SRAM memory in component driver
It allows to comparison this full UUID value with value in IPC message,
what is important step to create new component from topology by their
UUID value.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-04 15:42:52 +01:00
Karol Trzcinski 03d92cef52 sof: Put UUID value of IPC components to runtime memory
UUID entries, related with components from topology,
should be loaded into SRAM to allow runtime comparison with
value in IPC message during component creation.
UUID of the components whose are not created by IPC message
are not needed in runtime, so there should not be there to
reduce memory consumtion - as it is now. It's untouched.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-04 15:42:52 +01:00
Karol Trzcinski 27d4c943f3 testbench: Add UUID for file component
Each component driver should have assigned UUID value and trace
contecxt, to allow generic component creation routine usage.
It's espiecially important for trace context, because it's
accessed by pointer so dereferencing NULL pointer will lead to
segmentation fault.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-04 15:42:52 +01:00
Tomasz Lauda c6f1609c51 mn: cleanup definitions
Cleanups MCLK and MN related functionality. Moves some defines
from ssp to mn header. Also hides some definitions in platform
specific headers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-04 15:31:06 +01:00
Janusz Jankowski 2a66504b29 schedule: dma: check irq register result
Check if re-register failed in dma_domain_unregister_owner.
Error reported by clang static analyzer.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2020-06-04 14:59:50 +01:00
Tomasz Lauda 3f079f9c0f ssp: use default clock for platforms without M/N dividers
Uses default SSP source clock for platforms without support
for M/N dividers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-04 14:27:05 +01:00
Tomasz Lauda a62f7a79fb dmic: add DMIC_HW_VERSION 3
Implements new DMIC_HW_VERSION 3. It requires to set ipm values
no matter how many controllers are implemented.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-04 14:25:50 +01:00
Slawomir Blauciak 9b2b031da7 topology: fix pipeline parameters mismatched with hardware configuration
The stream parameters set in the pipeline were mismatched with
the DMIC hardware configuration, which resulted in failures.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2020-06-04 14:22:36 +01:00