Commit Graph

5380 Commits

Author SHA1 Message Date
Pierre-Louis Bossart 1a56804ff7 topology: align cht-nocodec and byt-codec topologies
Additional work needed to make the BE name and index configuration, as
well as LBM quirk.
We should be using a single topology here.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart ec47eefa13 topology: sof-byt-codec: connect pipe-host-volume-playback to mixer-dai
remove the low-latency pipeline and pcm-media.

Instead, we use 2 two pipe-host-volume-playback with different periods
connected to the same mixer-dai.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart 7189916c53 topology: introduce pipe-host-volume-playback
Add a new pipeline definition to avoid mucking with either
pipe-low-latency or pipe-media.

The code is 90% similar to pipeline-volume-playback but includes a
scheduling component.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Pierre-Louis Bossart b971f2b753 topology: add pipe-mixer-dai-playback
Add separate pipeline starting with a mixer (similar to Baytrail
switch matrix and SKL closed-source firmware)

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-07-07 09:23:15 +01:00
Shreeya Patel 8a90be118c scripts: build-tools.sh: Make tools individually buildable
More control over which tools should be built, instead of building
everything every time.

Note: All the build files will be removed every time this script is ran
since tools are not independent of each other.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-07-06 17:19:04 +01:00
Karol Trzcinski 1f092df401 pcm_converter: Convert linear memory regions
Usage of pcm_convert_as_linear() function speed up conversion
and make core convert function easier to implement.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-07-06 17:15:17 +01:00
Tomasz Lauda cf8e4339fe cavs: shim: make register functions common
Moves register helper functions to common cavs header.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-07-06 17:05:24 +01:00
Seppo Ingalsuo 656b36967a Audio: ASRC: Track skew min/max values and trace them in asrc_reset()
This patch adds useful trace to help solve possible issues with slave
DAI rate stability. If there are quality issues with ASRC, it is
useful to check the reported values. Skew values are Q2.30 fractional
integers.

E.g. at skew of 1073518174 the measured DAI sample rate is
48000*2^30/1073518174 = 48010 Hz when nominal rate is 48 kHz.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-07-06 16:22:20 +01:00
Seppo Ingalsuo f63adb42d9 Audio: ASRC: Get consumed and produced frame counts from filter core
This patch changes the parameter input_num_frames to in/out type
for push mode 16 and 32 bit processing functions. If the processing
core needs to stop due to insufficient number of frames free in the
output buffer the amount of frames can be less than requested. The if
statement for exit from while() loop is simplified. Also the if
statement tests order for ASRC_BM_CIRCULAR is changed.

The changes for pull mode 16 and 32 bit mode are similar. The parameter
out_num_frames is changed to in/out since the frames count could be less
than requested if there is no sufficient amount of input frames
available.

The upper level 16 and 32 bit copy() functions are updated to use the
returned value for SOF buffers consumed/produced.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-07-06 16:22:20 +01:00
Keyon Jie 2bd3026291 detect_test: refine the activation threshold to fix trigger issue
Refine to use the consistent activation threshold for different formats,
use a unified coefficient 0.05, and update the threshold at .params().

These refinement will fix the KWD trigger volume inconsistent for
different sample format issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-07-06 16:17:57 +01:00
Marcin Maka 882875fa45 volume: add details to sink size error message
Required sink size and actual size should be available
in the log file.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-07-02 11:26:37 +02:00
Rander Wang 7b532d3712 topology: tgl-sdw-max98373: change DMIC16k format to 32LE
For original DMIC16k only S16_LE is supported in pcm capability.
Now this patch enables S24_LE and S32_LE for applications like
DMIC01.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2020-07-01 09:56:51 +01:00
Marc Herbert 1c4d14a5fb qemu-check.sh: restore error messages when test fails
Fixes 428804e1c ("scripts/qemu-check.sh: add set -e") which failed to
consider the case of an empty $IPC_REG or $IPC_MSG.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-30 11:30:19 +01:00
Marc Herbert 8ceef9d460 qemu-check.sh: make $ROM a quoted bash array "${ROM[@]}"
Removes shellcheck warning and could allow directory names with
whitespace in a very distant future.

Silence printf "$@" shellcheck warning in die() function.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-30 11:30:19 +01:00
Keyon Jie 77e42657c6 topology: sof-hda-generic-kwd: switch to use vol-kfbm mode
We need PGA to tune the volume for the KWD pipeline, switch to use
vol-kfbm mode to get it done.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-06-30 11:13:48 +01:00
Bartosz Kokoszko b4e7150f42 mn: clear mclk and bclk source clks in MDIVCTRL
We should clear MNDSS and MCDSS bits before setting
new mclk and bclks source clocks. This commit is
going to fix case when driver want to reconfigure
the same SSP (e.g. index = 0).
1. Driver sends ssp_config() and FW configures ssp
   (index = 0) with MCDSS bits set to e.g. 1.
2. Driver wants to reconfigure the same ssp (index = 0)
   by sending new ssp_config() and FW tries to configure
   ssp 0 once again, but firstly it reads MDIVCTRL
   register:
	mdivc = mn_reg_read(MN_MDIVCTRL, mclk_id)
   and then tries to set MCDSS(0):
	mdivc |= MCDSS(0);
   , but there is "or" function here - after it MCDSS bits
   still will be set to 1. That's why we should clear this
   bits earlier.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-30 10:34:11 +01:00
Marcin Maka 461f7d552c kpb: add detailed info to error messages
Parameter validation should give detailed information about wrong
settings to speed up the troubleshooting.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-06-29 21:58:08 +01:00
Seppo Ingalsuo 6bae1569a2 Audio: Make volume gain ramp update rate variable
This patch adds to volume component capability to use one of
four ramp update rate presets 125 to 1000 us depending on topology
defined ramp length that is typically between 20 to 250 ms. The
rate needs to be higher for faster ramps to avoid zipper noise.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-29 21:55:44 +01:00
Seppo Ingalsuo 3dc0ae97ac Audio: Improve volume ramp time calculation precision
This patch changes the ramp time (from ramp start) calculation
unit from millisecond to Q29.3 milliseconds. It changes the smallest
time difference and therefore ramp slop point value down to 125 us
so finer than 1000 us volume update rate can be used. E.g. update
rates 125/250/500 us are good choices for high update rate.

The higher ramp update rates can be defined in volume.h if the volume
ramp need to be much shorter than currently while avoiding
audible zipper noise.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-29 21:55:44 +01:00
Seppo Ingalsuo 673e335a7a Tools: Topology: Change playback volume ramp duration to 20 ms
This patch shortens the ramp duration to 20 ms from 250 ms in all
topologies with volume playback. In addition the zero crossings detector
mode is enabled to mitigate zipper noise.

The change includes for the not yet updated pipeline macros a rename
of macro for tokens data with pipeline number suffix to ensure no
undesired volume instances are impacted by this change.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-06-29 21:55:44 +01:00
Daniel Baluta 259a98ed4c scripts: checkpatch: deprecate 80-column warning
Yes, staying withing 80 columns is certainly still _preferred_.  But
it's not the hard limit that the checkpatch warnings imply, and other
concerns can most certainly dominate.

Increase the default limit to 100 characters.  Not because 100
characters is some hard limit either, but that's certainly a "what are
you doing" kind of value and less likely to be about the occasional
slightly longer lines.

Miscellanea:

 - to avoid unnecessary whitespace changes in files, checkpatch will no
   longer emit a warning about line length when scanning files unless
   --strict is also used

 - Add a bit to coding-style about alignment to open parenthesis

dbaluta: This patch is taken and manually applied from Linux kernel
tree. See commit, in Linux kernel tree:

bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning")

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-06-29 20:57:55 +01:00
Adrian Bonislawski eaf49e26b4 mailbox: unify sram fw regs
This patch will move all sram fw regs offsets (only offsets) to a commpon
mailbox.h

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-29 20:11:06 +01:00
Tomasz Lauda b49080c784 mixer: reset additional check is only needed for playback
Limits additional check in mixer_reset to playback streams only.
For mixer in capture streams the request will always come from downstream,
which means that source components will always be in state >
COMP_STATE_READY. Checking sink component also doesn't make,
because it's the source of the request. The logic is now similar
to the mixer_trigger, where for capture streams we also don't require
additional checks.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-06-26 21:23:04 +01:00
Karol Trzcinski e9d274529e buffer: Describe buffer flags in init log
Buffer flags is important field and should be accessible in logs
output.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-26 10:08:24 +01:00
Karol Trzcinski ebd2b1869e smart_amp: Merge dbg logs from copy function
Number of available frames from feedback and passthrough buffers
should be in the same format and close together for easily compare.
Moreover reducing number of logs, especially from copy function is
important in terms of logs readability and FW performance - adding
one more parameter have much less impact on FW than adding one more
log message.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-25 14:32:18 +01:00
Bartosz Kokoszko dcb185a78c comp: return 0 in data size 0 case in comp_set_model
In comp_set_model() function, when required size is equal to 0,
we should not allocate memory and just return 0.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-25 14:31:37 +01:00
Bartosz Kokoszko 998f0a422d comp: return warning instead of error in comp_get_model()
In comp_get_model() function we should return warning in
case not allocated model->data.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-25 14:31:37 +01:00
Karol Trzcinski 6a23e48e15 perf_cnt: Add simple tic-toc api
For simple performance measurement and optimization in development stage,
tic-toc api is provided. Performance data are traced at each tok call,
to allow fast clocks usage deviation estimation.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-25 14:28:55 +01:00
Marcin Maka 96b303ea6a gitignore: add Eclipse project metadata
When sof source code is edited in Eclipse, the project
metadata files should be ignored by git.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-06-25 14:28:12 +01:00
Keyon Jie 20ab16c36e topology: sof-smart-amplifier: change the mclk to fix the noise issue
Since we are sharing the same mclk_id among SSP interfaces, we should
use the fixed frequency for the mclk. Here add a macro for it to make
sure it is aligned with the SSP configure in the upper layer.

Change to use 19.2MHz as the default mclk for smart_amp SSP.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-06-24 20:04:03 +01:00
Keyon Jie fc2b8d14a6 topology: sof-smart-amplifier: configure ssp quirk to 0 by default
We should make sure SMART_SSP_QUIRK is set, if it is not defined from
the upper layer, let's set it to explicit 0.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-06-24 20:04:03 +01:00
Rander Wang 642ac57ed3 topology: tgl-max98373-rt5682: adjust channel usage for sdw DSM support
For original design, there are 4 channels 24bit stream for playback
and 8 channels 24bit IV feedback for capture stream. This requirement
exhausts all resource on single link. Now adjust it to a 2 channels stream
for playback and a 4 channels stream for capture

Signed-off-by: Rander Wang <rander.wang@intel.com>
2020-06-24 20:02:50 +01:00
Karol Trzcinski edfbf0d3c2 volume: Rename UUID component name to PGA
PGA name is used in topology files and names between topology
and UUID dictionary (used by logger) should be aligned to omit
ambiguity.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 14:59:07 +02:00
Marc Herbert a3a9eb3a2b cmake: no space after -imacros to avoid de-duplication
This is not needed yet as we use only one -imacros at a time but could
save someone a lot of time in the future; including the author of this
patch who will have forgotten about it in a few weeks.

For more details see
https://github.com/zephyrproject-rtos/zephyr/commit/e53c0d0ec7640b
and links from there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-24 11:29:27 +01:00
Karol Trzcinski 01bbc3053d ipc: Remove redundant `sof` struct definition
File with `sof` struct definition is included - `sof/sof.h`,
so this line wasn't needed.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:43:54 +01:00
Karol Trzcinski f4bb9fe079 ipc: Extract pipeline id dereference from ipc_comp_dev structure
Mechanism of comparison pipe_id from ipc_comp_dev will be used in
trace filtering, so this part should be moved to separate function
and allow code reusability.
Moreover function usage is compact and descriptive method to define
what given block of code should do, so after such a refactor code
readability is improved.
Include from pipeline.h is removed to omit circular reference.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:43:54 +01:00
Karol Trzcinski cb10221109 logger: Rename float_precision to time_precision
New name better describes variable functionality.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:30:26 +01:00
Karol Trzcinski d97e9291e1 logger: Add possibility to hide timestamps
After removing timestamps it is possible to compare output logs
with tools like diff or similar. Moreover then output logs are
in more compact form.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:30:26 +01:00
Karol Trzcinski 4e867bcad4 dai: Rephrase misleading log from dai_config()
Structure X.Y is as usual used to describe pipeline and component
id, so usage of them in different context may be misleading.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:28:49 +01:00
Karol Trzcinski 99d7152a11 dai: Log number of frames in copy function
It easier to compare number of copied frames between dai and
process components than copied bytes.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:28:49 +01:00
Karol Trzcinski f69240a279 pipe: Trace with pipe component instead of class less method
Whenever it is possible, trace function with reference to pipe
component should be used instead of class less method. It allows
to print pipeline id in output logs and filter logs by this value.
In pipeline_new() moved trace context and ipc_pipe copy, to allow
tracing with context in earlier stages of this function.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-23 12:17:08 +01:00
Pan Xiuli 19c3ff9924 topology: fix wrong parameter for HDMI in sof-jsl-da7219
Remove the wrong one more 0 in the DAI config for HDMI.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-06-23 12:13:49 +01:00
Jaska Uimonen d76622a967 topology: fix dmic names (again)
We broke the upstream UCM configs by introducing pipeline id's to dmic
names. This differentiation is mandatory for reasons in alsaconf parsing
and ASoC layer combining the control names to pga's. However, the
differentiator can't be pipeline id as it can change depending on the
topology. So let Dmic0 have the old "Capture Volume" control name and
prefix Dmic1 control name with "2nd". This should not break the UCM's as
Dmic1 is not currently referenced.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-06-23 12:05:05 +01:00
Marc Herbert 81a416b75c .travis.yml: build ROM for "buildonly" platforms too
No obvious reason not to build ROM for "buildonly" platforms too.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-23 12:03:15 +01:00
Adrian Bonislawski f4f7263b09 debug: disable stack rewind in exception
this will restore functional backtrace for exception dump because stack rewind
is not implemented correctly

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-23 12:58:47 +02:00
Adrian Bonislawski 5441b13cdc ipc: component free fix
This will allow to free component properly and stop using
already freed memory which can result in dsp panic if configured
with CONFIG_DEBUG_BLOCK_FREE

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-06-22 14:10:43 +01:00
Karol Trzcinski 806b7c3713 demux: Fix buffer lock in copy function
Sink buffer should be locked and invalidated (inside lock function)
before reading, to acheve consistent data between multiple cores.
Otherwise readed data may be outdated.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-22 13:10:32 +01:00
Marc Herbert ee8a0d8840 CMakeLists.txt: change generated config.h default to autoconfig.h
Change generated config.h default name to autoconfig.h to catch any
remaining #include config.h left in any other PR, branch or any other
concurrent work in progress unknown to this.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:01:26 +01:00
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