Commit Graph

6292 Commits

Author SHA1 Message Date
Marc Herbert d6f6a456c1 logger: fix column and header alignments
Increase default width from 10 to 12 to stop common misalignment,
especially in relative mode.

New timestamp_width() function to avoid duplication and
divergence.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-27 12:17:53 +01:00
Marc Herbert 37e87e54b1 logger: partial rewording of one log_err() and usage message
Cosmetic change that does not fit in any other commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-27 12:17:53 +01:00
Guennadi Liakhovetski b617910feb zephyr: fix logging build breakage
The use of Zephyr LOG_*() API in SOF is breaking compilation.
Replace it with with the native trace logging until a proper
fix is available.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-27 12:11:41 +01:00
Liam Girdwood 9836a62bd9 ipc: abstraction: add support for other ABI major versions
Add a generic header type and update the mailbox and command handler
logic to accept generic headers. Generic header type should also support
the existing compact message API and expand it to other platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-27 11:05:00 +01:00
Liam Girdwood abb0015458 ipc3: remove uneeded casts
These casts are not needed so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-27 11:05:00 +01:00
Liam Girdwood 971cdea4fb ipc: common: remove unused headers and type declarations.
Not needed here so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-27 11:05:00 +01:00
Daniel Baluta ba6ba3cfc6 audio: codec_adapter: Make sure local_buff has enough room for processing
We need to make sure that the local buffer has enough room to hold
the output of the processing.

This means that for each type of decoding algorithm we need to know
the maximum possible output size and skip processing if local buffer
size is less than that.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-26 16:15:30 +01:00
Daniel Baluta dfb29d5227 codec_adapter: Introduce get_samples interface
This codec_adapter interface will return the number
of samples expected after decoding one compressed input frame.

This is optional. For codecs which do not care, this will return 0.
Do not care means that the number of input samples is equal with the
number of output samples after processing is done.

This will be used in the next patch to determine if the local output
buffer has enough space to copy the decoded samples.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-26 16:15:30 +01:00
Daniel Baluta da9a5ebe24 codec_adapter: Replace hardcoded codec api ids
Replace hardcoded codec api ids with meaningful enum names.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-26 16:15:30 +01:00
Yang XiaoHua 3500d0efef include:fix zephyr conflicting types and function
The atomic code is implemented in zephyr. When sof is used as
a zephyr module, there is no need to reimplement atomic.
The modification here is to solve the problem of repeated
definition of atomic related content.

Signed-off-by: Yang XiaoHua <yangxiaohuamail@gmail.com>
2021-04-26 15:19:44 +01:00
Slawomir Blauciak b500999477 scheduler: guard against subdivision underflow on domain clear
In some situations the domain clear routine might encounter
a case, when the number of clients is decremented and 0,
as such, a subsequent subdivision will result in an integer underflow.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2021-04-26 15:13:30 +01:00
Viorel Suman c9f442ba6b imx8m: remove SDMA2
With SDMA2 in place now it is shared by both A and HiFi core
- this breaks 8MP EVK + WM8960 topology. Remove SDMA2 so that
SDMA2 remains assigned to A core and SDMA3 assigned to HiFi core
as it was initially planned.

Suggested-by: Paul Olaru <paul.olaru@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2021-04-26 12:00:05 +03:00
Ranjani Sridharan 71ac0f97e9 component: do not reset component status in the case of xrun
Do not reset component status in the case of xrun.
An irrecoverable xrun will lead to the pipeline being
stopped by the host and resetting the status will result
in an error stating invalid current state during the STOP
trigger.

Also update the unit test to retain the same state during an xrun.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-04-23 14:54:50 +01:00
Marc Herbert 1a79de1c16 logger: warn user about wrapped logs and skipped garbage
Don't sweep logging issues under the rug.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-23 13:32:17 +01:00
Marc Herbert 73378e269f trace.c: don't split mbox events over the buffer's end and lose them
Don't try to pack the ring buffer to the very last byte so we don't
split (and lose!) trace events across the end and start of the
buffer. The logger on the receive side does not support such
re-assembly.

Note this was never noticed because the logger tends to silently (!)
discard garbage like this, addressed in other commit(s).

Also switch to memset() and memcpy_s()

Fixes commit 271c75aa71 ("debugability: Fix potential buffer overflow
in mbox traces")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-23 13:31:02 +01:00
Marc Herbert d54a9281f8 logger: print a separator when the timestamp goes back in time
This makes the display of the mailbox ring buffer log much less
confusing. It should not happen with the DMA trace but will behave the
same in case something goes wrong.

Before this commit the only clue that wrapping had happened was a NaN in
the delta column (instead of the negative value).

The "other?" is because the start of the mailbox is sometimes corrupted,
or the timestamp goes sometimes back at boot for no obvious reason. In
other words this new separator is useful to highlight bugs too.

Absolute mode -e 0 with this commit:

    TIMESTAMP         DELTA C# COMPONENT          LOCATION

[22598174808] (        11) c0 ipc                  src/ipc/....
[22598174824] (        15) c0 ipc                  src/ipc/....
[22598443257] (    268433) c0 dma-trace             src/trace/....
[22598443271] (        14) c0 dma-trace             src/trace/....
[22598443286] (        14) c0 dma-trace             src/trace/....
[22598943257] (    499971) c0 dma-trace             src/trace/....

		 --- negative DELTA: wrap, IPC_TRACE, other? ---

[22430943257] (         0) c0 dma-trace             src/trace/....
[22530943257] ( 100000000) c0 dma-trace             src/trace/....
[22542943257] (  12000000) c0 dma-trace             src/trace/....
[22542943271] (        14) c0 dma-trace             src/trace/....
[22542943285] (        14) c0 dma-trace             src/trace/....

Relative mode -e 1 with this commit:

    TIMESTAMP         DELTA C# COMPONENT          LOCATION

[  3080783.6] (       11.4) c0 ipc                  src/ipc/....
[  3080799.1] (       15.5) c0 ipc                  src/ipc/....
[  3349232.5] (   268433.4) c0 dma-trace             src/trace/....
[  3349246.8] (       14.3) c0 dma-trace             src/trace/....
[  3349261.2] (       14.4) c0 dma-trace             src/trace/....
[  3849232.4] (   499971.2) c0 dma-trace             src/trace/....

		 --- negative DELTA: wrap, IPC_TRACE, other? ---

[22430943257.0] (      0.0) c0 dma-trace             src/trace/....
[100000000.0] (100000000.0) c0 dma-trace             src/trace/....
[111999999.5] ( 12000000.0) c0 dma-trace             src/trace/....
[112000013.9] (       14.4) c0 dma-trace             src/trace/....
[112000028.2] (       14.3) c0 dma-trace             src/trace/....

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-23 13:28:26 +01:00
Yang XiaoHua 825bf79871 pcm_converter: Fix architectures not supporting XT_ROUND_S
XT_ROUND_S is available only when you include option of
"Xtensa's single precision FPU option (scalar)".
IF current DSP includes optional vector FPU (single precision).
FIROUND.S (with appropriate RoundMode state set) followed by
TRUNC.S can be used to emulate Xtensa scalar FPU’s ROUND.S, CEIL.S and
FLOOR.S instructions."FIROUND.S", does round, but no scaling.Result
still in float format.Use TRUNC.S to scale it and truncate as necessary.

Signed-off-by: Yang XiaoHua <yangxiaohuamail@gmail.com>
2021-04-23 14:22:34 +03:00
Keyon Jie d5c779918c Revert "topology: sof-tgl-nocodec-ci: change to run smart_amp on core 1"
This reverts commit cd2444adbf.

Reverting this to unblock the CI runningon tgl-nocodec-ci platform.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-04-22 19:43:03 +01:00
Guennadi Liakhovetski 975fa04088 zephyr: allow building with dynamic interrupts disabled
SOF registers IRQ handlers dynamically, therefore disabling
support for dynamic interrupts for SOF builds doesn't make
much sense. However, this can be used to at least increase
compile-time testing coverage and potentially enable
applications, not using dynamic interrupt registration.

BugLink: https://github.com/thesofproject/sof/issues/4044
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-22 14:04:45 +01:00
Guennadi Liakhovetski 3e8526110c zephyr: fix build: add a missing IPC file
Commit b3f195e92a ("zephyr: fix build with recent file name
changes.") partially fixed a regression, caused by 4e436f8570
("ipc: split out ipc functions into separate files.")
partially. This patch completes the fix.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-22 14:03:49 +01:00
Guennadi Liakhovetski c73ec9f981 zephyr: add a build script
Add a script to build Zephyr with the SOF main branch.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-22 12:18:38 +01:00
Curtis Malainey 30719babb4 testbench: print error on failure to prepare
We are capturing the error, we should log it, thank cppcheck for the
find.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 0f0dd1d7ab testbench: remove unused sets
looks like a bug to checkpatch.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey f227ae7af2 tplg_parser: fix exit path
goto after return is incorrect since it generates unreachable code.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 30f7931c4e tplg_parser: don't use void * in pointer math
Void * math is technically undefined, so for portability sake lets not
use it.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 5436fec004 tplg_parser: don't use unsigned types with signed math
cppcheck is (legitmately) upset that we are doing signed math size_t

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey f2bd45bac8 tplg_parser: don't assign unused values
minor style violation

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 5cd4e68c11 dai: don't set values we won't use
we are setting the value but have paths that don't use it and always set
on paths that do use it, lets remove the double write.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Keyon Jie 966e37bc75 platform: apollolake: increase runtime heap 256B count
Increase the count of the runtime heap 256 Bytes block on apollolake to
satisfy the buffer requirement of the new implemented dynamic DAI config
feature.

Fixes: 6c2cdffd02 ("dai: dai_config refinement")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-04-22 09:59:33 +01:00
Yong Zhi 05eb73e4cb topology: sof-tgl-max98373-rt5682: add Bluetooth audio offload support
Add passthrough pipelines to support Bluetooth sample rates
on SSP port2.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-04-21 22:32:09 +01:00
Yong Zhi 5fc21b6fb7 topology: intel: add generic Bluetooth audio offload pipeline
Make BT offload m4 generic for platforms that supports it.
User needs to provide id number for pipe/link/pcm and hw config.

I2S config for BT SCO:
16 bit samples, 1 slot TDM, no padding
19.2Mhz MCLK, 256/128kHz BCLK, 16/8kHz fsync
Frame-sync length 1 cycle ("DSP_A" mode)
Codec clk in primary mode

For BT A2DP:
16 bit samples, DSP_A protocol
2 slot TDM, no padding
38.4Mhz MCLK, 1.536Mhz BCLK, 48kHz fsync
Codec clk in secondary mode

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-04-21 22:32:09 +01:00
Yong Zhi e81c25eab7 topology: Add CHANNELS_MIN macro for passthrough pipeline
Add macro to restrict channel number of PCM capabilities, this will
allow channels_min to be configurable. The default behavior is
not changed with this patch.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-04-21 22:32:09 +01:00
yxh 5447a4f7b1 cmake file: PLATFORM variable is empty
When CONFIG_LIBRARY is enabled, but the architecture that
exists in sof is not enabled, the "PLATFORM" variable in
the zephyr\CMakeLists.txt file is empty, resulting in an
error in the include path.
The modification here is to get the correct include
path under this condition

Signed-off-by: yxh <yangxiaohuamail@gmail.com>
2021-04-21 09:18:14 +01:00
Ranjani Sridharan 0315863d98 probe: fix compilation error
Use the right header file to fix the compilation
error when building with probes enabled.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-04-21 09:15:58 +01:00
Viorel Suman 9c72534836 dai: add DAI driver "hw_params" callback
Add "hw_params" callback in order to provide the
stream information like stream rate, number of channels
and format to DAI IP driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2021-04-21 08:37:52 +03:00
Ross Chisholm c08f030d53 topology: fixing comments in jsl-rt1015 topology
Corrected comments relating to s32le (was s24le)

Signed-off-by: Ross Chisholm <ross.chisholm@xperi.com>
2021-04-20 19:28:03 +01:00
Ross Chisholm 71814655e6 topology: adding optional support for IIR component on jsl-rt015 topology
Allows the IIR component to be added to the jsl-rt015 topology allowing
tuning

Signed-off-by: Ross Chisholm <ross.chisholm@xperi.com>
2021-04-20 19:28:03 +01:00
Guennadi Liakhovetski 6874740165 zephyr: CONFIG_CAVS_TIMER is only required on cAVS platforms
Allow building SOF with Zephyr with Xtensa platforms other than
cAVS.

BugLink: https://github.com/thesofproject/sof/issues/4046
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-20 17:09:28 +01:00
Liam Girdwood 2f270ea3c6 cmocka: add support to build mocks on xtensa GCC
Allows the mocks to be built only for xtensa GCC. i.e a build test only.
Running on qemu requires more work.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-20 15:35:18 +01:00
Liam Girdwood 4d6da60931 cmocka: add support to run mocks on host architecture
Allows the mocks to be quickly run on the host with full access to host
debug and development tooling.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-20 15:35:18 +01:00
Marc Herbert dc0ab8a449 logger: fix precision bug introduced by new -e option
Add missing "break" so the -e option stops spilling on the -f precision
option. Fixes commit 53ce8b9d9f ("logger: new relative timestamps
option, relative to first entry seen"). Since that commit the -e option
was wrongly assigned to the precision too.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-19 15:43:06 +01:00
Keyon Jie 6c2cdffd02 dai: dai_config refinement
This is cleanup of the dai_config logic to make it more robust.

The host side should send _DAI_ONFIG IPC before trigger start, it can be
at:
a. topology parsing and pipeline initialization stage, or
b. before hw_params, send _DAI_CONFIG according to runtime params.

For both #a and #b, the configured dai will be stored in the new added
dai_data.dai_config, then set at the start of .params(), while the DMA
channel will be requested later at .prepare() and freed at .reset().

There is no need for the host side to send DMA_CHAN_INVALID to ask for
freeing the DMA channel anymore, if the host side keep sending this,
it will be ignored since the dd->chan is already freed at .reset().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-04-19 14:49:05 +01:00
Liam Girdwood b3f195e92a zephyr: fix build with recent file name changes.
Align the Zephyr build to recent file name changes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:46:10 +01:00
Liam Girdwood 16842868d9 cmocka: reduce number of mocked functions and increase test coverage
Reduce the number of functions we mock and use the real functions where
we can. This brings in more runtime code so will increase the test
coverage.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood 1931168185 pipeline: decouple IPC major from pipeline_new().
Decouple the IPC ABI major version from pipeline creation. This moves
struct sof_ipc_pipe_new from the pipeline and replaces it with it's
members (saving 8 bytes as no header is needed).

Add new feature specific pipeline APIs to configure pipeline at creation.

Additionally align testbench and UTs to API change.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood 36cc8475df ipc: move generic code to ipc-common.
ipc_msg_send() and ipc_schedule_process() are IPC generic and hence can
be moved to ipc-common.

No code changes, only moves.


Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood d10eefc199 ipc: move IPC buffer logic to IPC helper.
buffer_new() is IPC specific so move to IPC helper.
No code changes only moves.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood 376d94fe6b ipc: move IPC specific component logic into IPC helper.
comp_new() and dependencies are all specific to the IPC ABI MAJOR,
move them to IPC helper.

No code changes, move only.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood df2f931171 ipc: move IPC message builder helpers to helper file
IPC builders are IPC ABI specific so move to ABI helper file.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood 86a94912f7 ipc: move ipc ABI specific code out of common IPC logic.
ipc_comp_new() and ipc_comp_free() are ABI specific so move to
ABI handler. Code move only, no changes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00