Commit Graph

8135 Commits

Author SHA1 Message Date
Seppo Ingalsuo abb35a2f01 Audio: SRC: Remove redundant trace
There's same information traced just after this.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Seppo Ingalsuo 40b6c80f18 Audio: SRC: Fix incorrect and insufficient buffer size check
This patch checks in prepare() buffers for nominal frames count
(sample rate times schedule period) plus internal input and output
block size constraint. With this size check passed the SRC is able to
process a single block of data per copy() if upstream and downstream
components operate with reasonably small block constraints.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Seppo Ingalsuo 3aff4598f7 Audio: SRC: Increase length of internal buffer
The too small size of this buffer caused a new 11025 to 8000 Hz
conversion pipeline to freeze due to impossible condition in
source/internal/sink buffers.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Seppo Ingalsuo 8024351dae Audio: SRC: Allow SRC to not process in copy()
The zero consumed and produced is not an error for SRC
it can happen with some low sample rates those have
a larger internal block size than source or sink period.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Seppo Ingalsuo 914c415eed Audio: SRC fix bug in detecting pass-through condition
If the SRC rates matrix is non-symmetric, the indexes to
in and out sample rates matrix can't be compared. Compare
instead the rates.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Brent Lu a7103e0255 topology: sof-tgl-max98357a-rt5682: include intel-boards for link ID
Include intel-boards.m4 for BE DAI Link ID definition.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2022-04-28 15:02:53 +01:00
Brent Lu deb6c5c55a topology: intel-boards: new file for machind driver differentiation
The order of BE DAI Link in topology must match the order in machine
driver. Create this include file to organize the definition of BE DAI
Link ID.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2022-04-28 15:02:53 +01:00
Brent Lu 68871b05ca topology: sof-adl-cs35l41: support cs35l41 speaker amplifier
Add a topology sof-adl-cs35l41 which supports four Cirrus Logic
CS35L41/CS35L53 speaker amplifiers running in TDM mode without
headphone codec on ADL platform.

Two compile options are added to support the board configuration:
'NO_HEADPHONE' removes headphone pipelines from the topology while
'SSP_AMP_LINK_ORDER' uses the DAI Link order in sof_ssp_amp.c machine
driver instead of sof_rt5682.c.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2022-04-28 15:02:53 +01:00
Eddy Hsu 94e6c99697 kpb: Clean up params on component reset
Clean up kpb parameters in component data on reset().

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-04-27 15:12:52 +01:00
Rander Wang 99eac8de99 ipc4: add format conversion support of s32le to s24le
In ci test a format conversion of S32_LE to
S24_LE is required.

Validated in CI system.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-04-27 15:07:10 +01:00
Chao Song f4f9e6541e sof: replace log calls with zephyr logging api
The log context in zephyr is per file or module.

To use zephyr logging api, LOG_MODULE_REGISTER is used
to register a log context, LOG_MODULE_DECLARE is used
to refer to the registered context.

For function in header file, LOG_MODULE_DECLARE should
be used within that function to avoid context collapse,
a condition one source file have multiple context
registered or declared.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-04-27 15:05:24 +01:00
Eddy Hsu d67e2ea8a4 dcblock: Clean up processing function on reset.
Clean up dcblock processing function in component data on reset().

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-04-27 10:56:24 +01:00
Daniel Baluta 426542d17f codec_adapter: cadence: Resolve api_id at runtime
Linux host will send codec_id at runtime via sof_ipc_stream_params
as part of extended data appended at the end.

When ext_data_length is non-zero this means that the kernel wants us
the use dynamic codec id. When ext_data_length is zero, use backward
use default codec id which means we keep compatibility with older
kernels.

The codec_id is sent using compress API interface. We need to convert
that to internal cadence numbering scheme.

And final step, in order to use the dynamic id we need to move
cadence_codec_post_init() from init() function to prepare() in order
to be sure that the kernel already sent us the parameters.

We need to this operation atomically in one patch in order to avoid
breaking the functionality between patches.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-27 10:51:48 +01:00
Daniel Baluta 02dd7a6dfb codec_adapter: cadence: Remove api_id parameter
api_id parameter will be dynamically updated at runtime. Remove api_id
parameter id and use the default value in order to make code easier
to update for dynamic id change.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-27 10:51:48 +01:00
Marc Herbert 05969a0e34 .github: IPC4: build supported TGL platforms first
When the build fails we don't want to waste time wondering whether TGL
is affected or not. Other, unsupported platforms are only providing some
nice to have "randconfig" coverage (#5364), they're not important.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-27 10:51:22 +01:00
Marc Herbert dccf9c0798 .github/zephyr: download docker image from ghcr.io instead of docker.io
These are Github Actions, so let's use the Github server to increase
performance and reduce external dependencies.

According to https://github.com/zephyrproject-rtos/docker-image there is
no primary or secondary server for that image, they're both equivalent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-27 10:46:48 +01:00
Chunxu Li 75dea11da9 topology1: add mt8186 related pipelines and components
add topology file for mt8186
detail:
mt8186.m4
sof-mt8186-mt6366-da7219-max98357.m4
sof-mt8186-mt6366-rt1019-rt5682s.m4

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-27 10:42:54 +01:00
Seppo Ingalsuo 3334bede2a Tools: Testbench: Add components to testbench load
This patch adds load possibility of mux, demux, and
google-rtc-audio-processing to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 22:18:49 +01:00
Seppo Ingalsuo 69c69d01a4 Tools: Testbench: Add capture direction and multi-pipeline run
This patch changes testbench to retrieve pipeline direction
from pipeline host direction. Earlier all pipelines were forced
to playback.

The topology parsing filters the parsed pipelines to command line
specified pipeline IDs. All the pipeline operations are done
looped to these pipelines to be able to simulate multiple simultaneous
pipelines.

The pipeline context struct remains single. So the simulation works
only for pipelines with identical PCM format and rate.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 22:18:49 +01:00
Marc Herbert d09844ab98 zephyr/docker-build.sh: match UID with 'adduser' instead of 'chgrp -R'
This fixes SOF version.cmake which was just broken by a recent git
security update and started to fail like this:

```
  -- SOF version.cmake starting at 2022-04-25T18:14:56Z UTC
  -- /workdir/zephyr/.. is at git commit with parent(s):
  fatal: unsafe repository ('/workdir' is owned by someone else)
  To add an exception for this directory, call:

   git config --global --add safe.directory /workdir
```
(example at https://github.com/thesofproject/sof/runs/6162885265)

chgrp -R was always an ugly hack because it was messing with
(persistent) file permissions on the host, outside the container. This
new adduser solution is unfortunately much more code but it does not
leak any side effect outside the container.

Do not fix scripts/docker-run.sh yet because there is still no UID
mismatch between Github Actions and the SOF container (they're both
1001) but add a warning + TODO.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-26 22:08:53 +01:00
Seppo Ingalsuo b7d958bad9 IPC: IPC4: Fix return value handling in two helper.c functions
This patch changes function ipc4_create_chain_dma() to check return
value against IPC_SUCCESS. If not successful return the return
value.

The function ipc4_add_comp_dev() is changed to return value
IPC4_SUCCESS instead of zero since the other return value
in function is IPC4 style.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 21:54:21 +01:00
Seppo Ingalsuo 6c48d42f80 IPC: IPC4: Fix GCC build errors
This patch fixes errors:

src/ipc/ipc4/handler.c: In function 'ipc_cmd':
src/ipc/ipc4/handler.c:204:23: error: 'host' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
  struct ipc_comp_dev *host;
                       ^~~~
src/ipc/ipc4/helper.c: In function 'ipc4_trigger_chain_dma':
src/ipc/ipc4/helper.c:667:6: error: 'ret' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
  int ret;
      ^~~
src/ipc/ipc4/helper.c: In function 'ipc4_create_chain_dma':
src/ipc/ipc4/helper.c:507:13: error: 'frame_size' may be
used uninitialized in this function [-Werror=maybe-uninitialized]
  frame_size >>= 1;
  ~~~~~~~~~~~^~~~~

src/ipc/ipc4/helper.c:482:11: note: 'frame_size' was declared here
  uint32_t frame_size;
           ^~~~~~~~~~

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 21:54:21 +01:00
Li-Yu Yu 3af41339d6 CODEOWNERS: @benzh -> @bzhg
Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2022-04-26 17:04:52 +01:00
Rander Wang a1d9e6b258 ipc4: set sink sample rate before verifying params
Fix src issue on windows. Need to update sink format before
src_verify_params which uses it to generate dev->frame.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-04-26 09:29:06 +01:00
Balakishorepati 5be495c2e8 drivers: amd: renoir: use sample rate from topology
So far we only support 48000Hz as default sample rate.
Now introduce acp_params structure to pass configuration
from topology via AP to DSP.

Only Sample rate param for now to configure dmic clk.

While here, align sof_ipc_dai_acp_params struct
with the one from kernel.

Increment only ABI MINOR version which makes the
SOF FW backward compatible with older kernel versions

Signed-off-by: Balakishorepati <balaKishore.pati@amd.com>
2022-04-26 09:23:03 +01:00
Daniel Baluta 68e8c9066f ipc3: Check ipc size check for pcm_params to account for ext_data
Now that sof_ipc_pcm_params struct has some extended data at the end
the hdr.size will also account for this data.

Change sanity condition to see if hdr.size is updated to keep track of
extended data.

Also check that ext_data will not go beyond SOF_IPC_MAX_SIZE.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-25 19:50:23 +01:00
Daniel Baluta 0fa42076a0 codec_adapter: Copy extended data found at the end of sof_ipc_stream_params
When ext_data_length is not zero this means that sof_ipc_stream_params
will contain additional data appended at the end.

Copy this data in mod->stream_params so that we can use it later.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-25 19:50:23 +01:00
Daniel Baluta cad93fa1be ipc: stream: Add extended data at the end of sof_ipc_stream_params
In order to support sending the compress parameters (and maybe other
parameters) we introduce `ext_data_length` field inside
sof_ipc_stream_params.

We use 2 bytes from the reserved pool. This will represent
the size of extended data that will be placed at the end
sof_ipc_stream_params struct.

existing value for this reserved bytes is `0`. This will mean
that we can keep backward compatibility. 0 means no extended data.

Add also VLA data[] in order to easily access extended data.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-25 19:50:23 +01:00
Daniel Baluta c70b5cb4dd codec_adapter: Dynamically allocate stream_params
This prepares sof_ipc_stream_params structure to have some
extended data appended at the end.

For this reason we no longer can use the sof_ipc_stream_params
object inside processing_module, but we need a pointer.

stream_params is allocated at codec_adapter_params().

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-25 19:50:23 +01:00
Daniel Baluta 73813a2f1f codec_adapter: Remove assert after memcpy_s
Remove assert and report the error condition to the upper layers.
It does not make sense to stop the FW if config parameters fails.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-25 19:50:23 +01:00
Rander Wang 28582f6566 ipc4: refine config setting for chain dma
Fix bugs in playback mode and supports more frequencies.
This patch generates dma setting from dma blob data.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-04-25 16:40:49 +01:00
Rander Wang 03762e3de3 ipc4: trigger pipeline from host component
Fixed playback issue with chain dma. Pipeline
is always triggered with direction of host to dai,
so host is used for trigger.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-04-25 16:40:49 +01:00
Marc Herbert 51bb6339f8 .github: add some IPC4 builds
Add all platforms that can currently be built with IPC4:

  cnl icl jsl tgl tgl-h

Can be adjusted any time later with a one-line change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-25 16:39:50 +01:00
Marc Herbert 5f04af9f10 installer: add IPC_VERSION
One-line change + new test set

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-25 16:39:50 +01:00
Marc Herbert 0c5dcaca04 xtensa-build-all.sh: actually implement CONFIG_IPC_MAJOR_3=y
There was no actual "IPC3" value, it was ignored. The platform default
was used instead.

Stop ignoring invalid arguments, fail and report them.

Allow empty string as a no-op for scripting convenience.

Don't restrict IPC4 to tigerlake, it's not the job of
xtensa-build-all.sh to filter what's supported versus not.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-25 16:39:50 +01:00
Eddy Hsu 1c136b1d2f host: Clean up state on component reset
Clean up host state data in hd->config in component data on reset().

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-04-25 16:37:32 +01:00
Eddy Hsu 3f2f2ff32d selector: Clean up config and processing function on component reset
Clean up selector config and processing function in component data on
reset().

Signed-off-by: Eddy Hsu <eddyhsu@chromium.org>
2022-04-25 16:35:33 +01:00
Kai Vehmanen 020c9f3fa5 zephyr: track SOF app calls to enable/disable cores separately
Add a static variable w_core_enable_mask in Zephyr wrapper.c to
track requests to enable and disable cores, and use this to
implement arch_cpu_enabled_cores().

We don't yet have a implementation to power off secondary cores.
This creates issues to SOF application code that may rely on
disabling of cores to be reflected in cpu_enabled_cores(). Instead
of adding ifdefs in application code, manage this within wrapper.c.
Once the secondary core power-off is implemented, this static
variable can be removed.

BugLink: https://github.com/thesofproject/sof/issues/5701
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-25 16:24:39 +01:00
Pierre-Louis Bossart d380674ef2 topology1/kernel_dependent/v5.19: enable SoundWire deep-buffer headset topologies
This patch duplicates the configuration at the higher level and adds
the "HEADSET_DEEP_BUFFER" definition.

This is not very elegant and will require changes in two places, but I
don't see a better solution with M4.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart d636482970 topology1: SoundWire: make deep-buffer optional
We don't want to release these topologies to world+dog due to
dependencies on kernel version, so let's make the deep-buffer
optional. The next patch will enable these topologies in the
development/ directory.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart f1cf43126e topology1: SoundWire: add deep buffer support for headphone
Deep buffer is device 31 by convention

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 045e6f44e4 topology1: CMakeLists: split SoundWire NOJACK topologies
Before we enable the headset deep-buffer solution, we want to extract
the NOJACK topologies where the headset deep-buffer would be an
oxymoron.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 746bbff485 topology1: CMakeLists: regroup SoundWire topologies
For some reason the topologies are in separate blocks, regroup them.

No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 15200e4091 topology1/kernel_dependent/v5.19: enable HDaudio codec deep-buffer topologies
This patch duplicates the configuration at the higher level and adds
the "DEEP_BUFFER" definition. The topologies are generated in the
kernel_dependent/v5.19 directory and shall only be used by
distro/users when their kernel is based on 5.19-rc1 or later. If these
topologies are used with an older kernel, the ASoC DPCM state machine
issues will result in broken audio. We have no ability to detect a
dependency on kernel to load a topology.

This is not very elegant and will require changes in two places, but I
don't see a better solution with M4.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 94203a22ff topology1: sof-hda-generic: make deep-buffer optional
We don't want to release these topologies to world+dog due to
dependencies on kernel version, so let's make the deep-buffer
optional. The next patch will enable these topologies in the
development/ directory.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 030f27d556 topology1: sof-hda-generic: add deep-buffer pipeline for analog playback
Use SoundWire convention with deep-buffer using device 31.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Pierre-Louis Bossart 96be83b0ab topology1: move sof-hda-generic-kwd to development
We don't support this topology in production and it's not clear if
it's even maintained, move to development.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-04-25 16:03:13 +01:00
Seppo Ingalsuo 09a4aa8a8e Topology: Topology1: Add topology with playback DRC to HDA generic
This patch enables testing of DRC in HDA generic devices by adding
it to headset/speaker pipeline after mixer.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-25 16:00:02 +01:00
Seppo Ingalsuo 5911f7f661 Audio: DRC: Optimize source and sink buffers access
This patch replaces the audio_stream_read/write_frag_s16/s32
functions based source buffer read and sink buffer write with
audio_stream_bytes_without_wrap() based blocks access.

The drc_s16/s24/s32_default processing functions are simplified
by move of common delay input sample operation to separate
function. The same function is used in DRC disabled and enabled
part of processing functions.

The pass-through mode is optimized with generic audio_stream_copy()
that is a common function for all s16/s24/s32 formats.

The MCPS savings are in TGL-H for stereo 48 kHz stream
- Normal operation 68 to 50 MCPS, saving 18 MCPS
- Pass-through without delay 22 to 6 MCPS, saving 16 MCPS
- Pass-through with delay 21 to 7 MCPS, saving is 14 MCPS

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-25 16:00:02 +01:00
Guennadi Liakhovetski 2ea18383b3 pcm_converter: fix uninitialised variables
Two variables i and n in pcm_convert_s24_c32_to_s24_c24_link_gtw()
can be used uninitialised, which breaks compilation. Initialise them
to 0 which guarantees, that we don't perform any changes in the
invalid case of processed >= samples.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-04-25 15:08:55 +01:00