Commit Graph

7912 Commits

Author SHA1 Message Date
Guennadi Liakhovetski c04b7fc13e pipeline: fix aborting STOP or PAUSE propagation
When trigger.aborted is set, pipeline_trigger_run() also returns
PPL_STATUS_PATH_STOP. So the current test for trigger.aborted in
pipeline_task_cmd() after pipeline_trigger_run() is a left-over from
an earlier implementation and is never entered with the current flow.
In the current implementation, a typical playback topology like
[pipeline A] PCM -> ... - [pipeline B] mixer -> ... -> DAI
when a pause is triggered mixer will stop its propagation, set
trigger.aborted on pipeline B to true and return
PPL_STATUS_PATH_STOP. pipeline_task_cmd() is still running in the
context of pipeline A, so it will detect PPL_STATUS_PATH_STOP, check
that trigger.aborted is not set and terminate the task. Then the
scheduler will run the task for pipeline B, that one will verify,
that trigger.host == NULL, then find the trigger.aborted to be true
and will keep the task running.

In a topology, where the PCM, the mixer and the DAI all belong to the
same pipeline, when PAUSE is triggered, the whole pipeline should be
left running which is what this patch achieves by checkint
trigger.aborted when PPL_STATUS_PATH_STOP is returned by
pipeline_trigger_run().

BugLink: https://github.com/thesofproject/sof/issues/5257
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-02-18 21:04:15 +00:00
Curtis Malainey 8b519858c5 google_rtc: copy ipc to dev
This is possibly a copy paste bug from the smart amp component.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-18 11:29:42 +00:00
Curtis Malainey 949d1f4d69 smart_amp: copy ipc config
It appears in the conversion of the IPC API the copy in the smart amp
code was missed and as a result the component loses its ID which results
in the graph being broken and a crash on trigger.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-18 11:29:42 +00:00
Andrey Borisovich bb314fca61 Fix for xtensa-build-zephyr.py. This fixes 1de3ef3
Existing xtensa-build-zephyr.py failed to copy sof logger
executable to staging directory due to missing '.exe' file extension.
This fixes the script.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-18 11:25:47 +00:00
Marc Herbert 15a7774626 Revert "topologies: switch all .m4 files to codec_provider and codec_consumer"
This reverts commit f50b6fe0ad.

I discovered the hard way that this change causes alsatplg version
1.2.2 (the default version in the current LTS Ubuntu) to corrupt just
a few bytes in .tplg output in an incredibly discrete and
time-consuming way: no error message at build time and same file size.
See example at https://github.com/thesofproject/sof/pull/5162.

We could/should just require a minimum alsatplg version at the CMake
level but at this moment we don't even know which minimum version is
needed and we would also need to take some time to test a few alsatplg
versions. If version 1.2.2 would just fail with an decent error
message that can be searched and discussed then everything would be
fine but silent corruption is really not OK.

So users of recent versions will unfortunately have to live with the
huge number of warnings for now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-18 11:22:36 +00:00
Peter Ujfalusi 64c7b9868e dma-trace: Make dmatb and DMA_GW dma_sg persistent after first allocation
Do not free the dmatb so that the trace code can continue collecting
information continuously in it's buffer.

We also have another memory leak (when CONFIG_DMA_GW is set) which can be
handled this way:
Every time the dma_trace_start() is called we allocate a new dma_sg. This
is fine when the dma_trace_start() is only called once right after the
DSP finished booting, but multiple calls would eventually going to lead to
OOM.

Move the dma_sg allocation at the same place where the dmatb is allocated
to make it persistent as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi 1ae525ad37 dma-trace: dma_sg_free() can not be used to free SOF_MEM_ZONE_SYS allocations
dma_sg_alloc() is called with SOF_MEM_ZONE_SYS which can not be freed up.

dma config or start error skip the free as it is not going to work anyways.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi 9c3452330d dma-trace: Fix memory leak of host elem_array on reconfiguration
When the dtrace is disabled (via the SOF_IPC_TRACE_DMA_FREE IPC message) we
need to also free up the allocated dma_sg_elem_array to avoid leaking
memory on the next dtrace start.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi e11673258c dma-trace: Fix memory leak with buffer allocation on dtrace re-config
Do not attempt to allocate the dtrace buffer again if it has been already
allocated.
This only possible if we are re-configuring the dtrace which implies that
we also must have the DMA channel.

In such case, skip the allocation and do a re-init of the buffer after the
DMA channel has been stopped.

Reported-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi fbab621c9b ipc: ipc3: handler: Fix error handling in ipc_dma_trace_config()
We need to free up the allocated SG in case of a failure after a successful
ipc_process_host_buffer() call, which does the allocation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi 1745148343 dma-trace: Cancel the dtrace task before stopping the channel in reconfig
We should stop the task before the dtrace channel is stopped when we
need to re-configure it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi 676541b025 dma-trace: Move the first trace printing within dma_trace_buffer_init()
Move the tag printing out from dma_trace_enable() to
dma_trace_buffer_init()
to be close proximity of the buffer allocation for easier reading.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi 384403dfaf dma-trace: Use mtrace_printf() if dtrace buffer allocation fails
Printing the error via dtrace is not going to work when the memory for
the dtrace is not allocated.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Peter Ujfalusi ed7067f7f4 dma-trace: Simply return with if dma_trace_buffer_init() fails
dma_trace_buffer_init() can only fail if the rballoc fails so there is no
need to call dma_trace_buffer_free() as the buffer has not been allocated

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-18 11:10:20 +00:00
Rander Wang 0eda4302e3 ipc4: add gain module support
Gain works as peak volume except that Gain doesn't
report peak volume to host

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
Rander Wang 751d0a967e ipc4: add set|get large config support
ipc4 driver uses set|get large config to control volume

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
Rander Wang 6a7861181f ipc4: volume: add none-fade type for ipc4
The default fade type is SOF_VOLUME_LINEAR if fade
type is not set and this results unexpected ramp operation
and fw panic

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
Rander Wang 1bcfcfd692 ipc4: volume: convert ipc4 format to ipc3 one accurately
ipc4 volume need to be clamped into correct range, or
real volume will be different with target volume and
result to unexpected ramp operation with fw panic.

Implement two functions to do conversion between ipc4
and ipc3 since they will be used by more functions.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
Rander Wang 2eebc5d69f volume: Check ramp_func if ramp is initialized
Fix error when ramp is not enabled on windows.
ramp can be disabled on windows

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
Rander Wang 83f43ac059 volume: set ramp_finished to true by default
ramp_finished should be true for reset state or
it will result unexpected ramp operation.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-16 14:08:32 +00:00
fy.tsuo d6fdeb37a7 Implement nr_bypass flag in igo_nr.
Pass through all the data when nr_bypass is set.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2022-02-16 14:03:18 +00:00
Marcin Szkudlinski 13ddaaef03 SRC: compilation fix for src_hifi4.c. This fixes dcb9aeb308
Code has compilation issues when SRC_HIFI4 flag is enabled
src/audio/src/src_hifi4.c:356: warning: implicit declaration of function ‘MIN’

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-02-16 12:06:08 +00:00
Andrey Borisovich 1de3ef3675 Rewritten xtensa-build-zephyr.sh to python
Created new script with similar functionality to allow SOF + Zephyr
builds on both Windows and Linux operating systems.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-16 12:02:40 +00:00
Andrey Borisovich eb4a9381d3 Added #ifndef guards in compiler_attributes
Building with GCC on Windows using MSYS caused errors related to
macros redefinition in compile_attributes.h due to GCC using its
standard headers. Added #ifndef guards.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-16 12:02:40 +00:00
Andrey Borisovich 2c1f089d39 Added standard headers include path for MSYS
Windows users building with MSYS2 need to provide additional include
path to the POSIX standard headers to build sof-logger with GCC.
Added this include directory when environmental variable
MSYS_INSTALL_DIR is set.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-16 12:02:40 +00:00
Andrey Borisovich f11e275aab Fixed warning W-char-subscripts in sof logger
Newer gcc compilers 9.1+ issue a W-char-subscripts warning when argument
type passed to isspace is not explicitly int. Added cast to int.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-16 12:02:40 +00:00
Pierre-Louis Bossart 04a0d3c1b5 topology1: sof-cml-es8336: use correct 24MHz MCLK
Rookie mistake, the clock can't possibly be 19.2 MHz

Reported-by: Nikolai Kostrigin <nickel@altlinux.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-02-16 12:01:30 +00:00
Ranjani Sridharan 24d1b1a012 topology2: cavs: hda: remove unwanted topologies
We only want the mixin/mixout based HDA and passthrough HDMI topologies.
Delete everything else.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-16 11:59:00 +00:00
Ranjani Sridharan 3d9b6ffd29 topology2: cavs: remove deep buffer pipeline
Remove deep buffer pipeline until the driver code to ready to handle it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-16 11:59:00 +00:00
Ranjani Sridharan 6001e44241 topology1: remove redundant kcontrol for codec adapter pipelines
The codec adapter component only uses a single config now. So remove the
runtime config kcontrol as the same kcontrol can be used for runtime
config as well.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-16 12:28:08 +02:00
Adrian Warecki 838c7328f8 asrc: Fixed sink rate selection
Don't change sink rate if value from IPC is 0 (auto detect)

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-02-15 14:59:48 +00:00
Ranjani Sridharan 8c0b05d579 topology2: cavs: all pipelines should be dynamic by default
Set all pipelines to be dynamic by default.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-15 10:58:34 +00:00
Tomasz Leman 819c023d23 ipc4: fix pipeline reset
During pipeline reset all components remains in previous state. This
cause issue at pipeline deletion. This patch allowed to propagate state
transition to all pipeline components.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-02-14 12:05:04 +00:00
Tomasz Leman 4ec8d8b6f5 ipc4: helper: unbinding modules from the same pipeline
When both module instances are parts of the same pipeline Unbind IPC
would be ignored by FW since FW does not support changing internal
topology of pipeline during run-time. The only way to change pipeline
topology is to delete the whole pipeline and create it in modified form.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-02-14 12:05:04 +00:00
Ranjani Sridharan c84d64b524 topology2: CMakeLists: clarify the pipelines for mixin-mixout tplg
Only the HDA pipelines use mixin/mixout based pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-14 11:12:44 +00:00
Ranjani Sridharan c94ae772a0 topology2: cavs: split the passthrough pipeline into host and DAI parts
We cannot have one single pipeline going from the host copier to the DAI
copier. So split the passthrough pipeline into host and DAI pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-14 11:12:44 +00:00
Ranjani Sridharan 788e0534d6 topology2: mixin/mixout pipelines: Add gain before and after mixers
Add gain widgets before and after the mixers in all the
mixin/mixout-based pipelines. Change the cavs-mixin-mixout-hda.conf
topology to add the mixer names for all gain widgets.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-14 11:12:44 +00:00
Ranjani Sridharan 3120b7c4c9 topology2: gain: remove default audio formats
Remove the default audio formats from the gain class definition.
They should be added depending on the number of formats based on the
pipeline. Fix the gain-playback and gain-capture pipelines to add the
audio formats for the gain widgets.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-14 11:12:44 +00:00
balapati b8954754f0 amd: renoir: clk: Fix ACP clock to default clock
Fix ACP clocks to default clock during boot up time.

Signed-off-by: balapati <balakishore.pati@amd.com>
2022-02-11 16:11:00 +00:00
Adrian Bonislawski 735d44368f probe: update dma copy method to dma_copy_to_host()
dma_copy_to_host_nowait() no longer exists and needs to be updated

Fixes commit 443b21de4b ("dma-trace: Fix potential race issue by using
blocking DMA copy")

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-02-11 12:17:36 +00:00
Seppo Ingalsuo 2b6001e065 Audio: EQFIR: Optimize source and sink buffers use in generic C version
This patch replaces the audio stream read/write frag based
access to source and sink by block processing based on
audio_stream_bytes_without_wrap() bytes count.

In a test with forced generic C for xtensa build processing load in
original was 324 MCPS, in optimized 309 MCPS, saving is 15 MCPS. The
load is nearly same for all formats s16/s24/s32. The base load was
very high in test due to a very long used FIR filter. The MCPS saving
should be the same for all stereo 48k streams.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-11 11:52:51 +00:00
Guennadi Liakhovetski d0057a7def Revert "zephyr: add a generic Zephyr platform"
This reverts commits e0ff1b16d8,
339e5ac217 and
09c69b7607. A different approach will
be used for making SOF a platform-agnostic Zephyr application.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-02-11 11:18:54 +00:00
Chao Song bf191f6b67 audio: force pcm_converter_generic for IPC4 with zephyr
The copier component depends on special pcm conversion
code, which is only implemented in the generic pcm
converter. If we build SOF with IPC4 support with XCC,
the HIFI3 pcm converter is selected automatically, and
causes the issue of
    undefined reference to `pcm_func_vc_count'
    undefined reference to `pcm_func_vc_map'.

This patch forces the use of generic pcm converter
if build SOF with IPC4 and Zephyr.

This patch should be reverted once the HIFI3 pcm converter
counterpart is implemented.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-11 11:02:19 +00:00
Chao Song 487363fb1b zephyr: add copier and base_fw components
The two components copier and base_fw are
essential to IPC4 support on SOF on Zephyr.

This patch integrates the build of the two
components to SOF build with zephyr RTOS.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-11 11:02:19 +00:00
Seppo Ingalsuo cf43cb1604 Tools: Topology: Add long FIR EQ topology for sof-hda-generic
The topology is useful for testing long binary control IPC and to
test equalization of headset and speaker in sof-hda-generic devices.
It adds a flat IIR and a generic FIR that creates a mild loudness
effect.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-11 10:41:55 +00:00
Seppo Ingalsuo e9048e4b7d Tools: Topology: Fix erratic FIR example response
The previous patch increased the FIR length but it also triggered
a numerical issue in FIR design with long minimum phase filters. The
filter became essentially a band-stop filter and causes difficulties
in test of EQ component. Also the equalizer sounds subjectively
bad. The fix is to change the design to linear phase that always
converges.

Fixes: 0d296ce7d1

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-11 10:41:55 +00:00
Shriram Shastry 10b4c56ed9 math: Add logarithm base E and base 10
fixpoint math log() and log10() function.  logarithm of a
number is the power or exponent by which another value
must be raised to produce an equivalent value of the given number
fix point  log10(x) is a derivative of log2(x)/log2(10)
and loge(x) is log2(x)/log2(e)

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
2022-02-10 16:42:00 -08:00
Lionel Koenig 28de049330 topology1: Fix issue in google-rtc-audio-processing pipeline
This fixes a mistmatch in the PCM capabilities for the Google
RTC audio processing pipeline.

Signed-off-by: Lionel Koenig <lionelk@google.com>
2022-02-10 16:37:13 -08:00
Jyri Sarha 443b21de4b dma-trace: Fix potential race issue by using blocking DMA copy
It is possible that that in trace_work() sof_ipc_dma_trace_posn ipc
message reaches host side sof driver before the dma_copy_to_host_nowait()
is finished. Change the dma_copy_to_host_nowait() implementation to
dma_copy_to_host() by adding DMA_COPY_BLOCKING flag to dma_copy()
command.

The flag is already there on the !defined(CONFIG_DMA_GW) version of
the function and the old name of the function was a bit misleading.

This commit changes also probe.c probe_task() so that it also uses the
new blocking DMA copy. I could not see any justification to use nowait
version there either.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-02-10 11:57:27 +00:00
Jyri Sarha 5afc494671 drivers: Intel: hda-dma: DMA buffer address should be correctly aligned
Add check for DMA buffer address alignment to hda_dma_set_config().
Wrongly aligned DMA buffer does not work correctly.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-02-10 11:57:27 +00:00