Commit Graph

8061 Commits

Author SHA1 Message Date
Ranjani Sridharan 2abef019d3 topology2: intel: dmic-generic: Add a few more variables
Add a few more variables to make the dmic-generic topology more
configurable.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
Ranjani Sridharan a2d8987921 topology2: clean up unnecessary nocodec topology builds
Only TGL is tested right now. So, build only that one.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
Daniel Leung 9a8fe76dee compile: use compiler version to guard fallthrough attribute
Some XCC/Clang are based on older Clang 3.9 which does not
support the fallthrough attribute. So a blanket statement
that all Clang supports fallthrough attribute is not true.
Also, XCC/Clang can be based on newer version of Clang which
will eventually support the fallthrough attribute. Therefore,
use the compiler version as guard on whether the fallthrough
attribute is supported instead of simply basing it on
what the underlying compiler is. Note that the fallthrough
attribute is supported since GCC 7 and Clang 10.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-26 11:06:01 +00:00
Ranjani Sridharan ae7e8daf21 codec_adapter: Modify the signature of codec_adapter_copy_from_module_to_sink()
Modify the signature of codec_adapter_copy_from_module_to_sink() to pass
the module buffer. Also, clarify comments to make it more easier to
follow.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-25 17:43:51 +02:00
Ranjani Sridharan 5cfae4b724 codec_adapter: rename ca_copy_from_lib_to_sink()
Rename it to ca_copy_from_module_to_sink(). No functional change.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-25 17:43:51 +02:00
Ranjani Sridharan 810ce398e6 codec_adapter: modify the signature of codec_adapter_copy_from_source_to_module()
Modify the signature of codec_adapter_copy_from_source_to_module() to pass
the buffer pointer and buffer size. Also, clarify the comments to make it
more easier to follow.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-25 17:43:51 +02:00
Ranjani Sridharan 4bfef7e8a2 codec_adapter: rename ca_copy_from_source_to_lib
rename it to ca_copy_from_source_to_module(). No functional change.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-25 17:43:51 +02:00
Ranjani Sridharan d73b626130 codec_adapter: waves/dts: Avoid using ca_source/ca_sink
In preparation for supporting more than 1 input/output buffers, access
the first source/sink buffer from the comp_dev's buffer_list instead of
accessing the ca_source/ca_sink.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-25 17:43:51 +02:00
Pierre-Louis Bossart 0fcad5052c topology: sof-apl-da7219: add missing virtual widgets
Align this topology with the GLK one to avoid probe errors

[    4.224516] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no source widget found for iDisp3 Tx
[    4.224518] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp3 Tx -> direct -> hifi3
[    4.224522] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no sink widget found for iDisp3 Tx
[    4.224524] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp3_out -> direct -> iDisp3 Tx
[    4.224529] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no source widget found for iDisp2 Tx
[    4.224531] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp2 Tx -> direct -> hifi2
[    4.224535] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no sink widget found for iDisp2 Tx
[    4.224537] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp2_out -> direct -> iDisp2 Tx
[    4.224542] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no source widget found for iDisp1 Tx
[    4.224544] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp1 Tx -> direct -> hifi1
[    4.224549] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: no sink widget found for iDisp1 Tx
[    4.224551] bxt_da7219_max98357a bxt_da7219_mx98357a: ASoC: Failed to add route iDisp1_out -> direct -> iDisp1 Tx
[    4.224559] bxt_da7219_max98357a bxt_da7219_mx98357a: snd_soc_bind_card: snd_soc_dapm_add_routes failed: -19

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-02-25 15:26:34 +00:00
Daniel Baluta bb7b7e3234 drivers: imx: esai/sai: Add .remove callback
With dynamic pipeline feature, pipelines are destroyed
when SOF device enters suspend and .remove callback is called in order
to free memory.

SAI/ESAI are missing this callback and the FW crashes. Fix this by
adding .remove callback.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-25 16:59:17 +02:00
Curtis Malainey 189a1fc4a3 switch: default off
This component is an incomplete shell, there is no reason to build it
unless someone decides to complete it.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-25 14:09:54 +00:00
Curtis Malainey 4f405e23e7 mux: collapse params function
There is no reason to have a function just call another function that is
used no where else.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-25 14:09:54 +00:00
Chao Song 2c0d875df1 topology1: move capture dai to another pipeline for echo ref
The explanation takes sof-adl-max98357a-rt5682 as an example:

During pipeline_complete(), we search for the source widget
for a pipeline from a list and the ipc_get_ppl_comp() returns
the first widget from the list of source widgets for a pipeline.

With SSP2.IN on pipeline 1, which is the same pipeline ID as the
ECHO_REF playback pipeline for PCM0P, pipeline_complete() for
pipeline 1 ends up not walking the rest of widgets in pipeline 1.

This Echo Ref feature works in chrome kernel today by accident,
because we set up the widgets in the reverse order after resuming
from runtime suspend and the source widget happens to be PCM0P.

To fix this, create a new pipeline for the capture dai widget SSP2.IN,
so that it doesn't pollute the widget list for pipeline 1.

Fixes: #5395

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-24 22:59:45 +00:00
Marc Herbert e986bc66d0 Restore Zephyr version in banner, fix 'zephyr:BUILD_VERSION'
This fixes the banner which was recently added by SOF commit
a053e04d7e ("trace: add Zephyr git version to the initial FW ABI
banner")

  SHM: FW ABI ... tags SOF:v1.2.3 zephyr:zephyr-v3.0.0-346-g1470228eb10

... but was broken very soon after by Zephyr commit 91709778a487 ("cmake:
version.h generation performed at build time")

  SHM: FW ABI ... tags SOF:v1.2.3 zephyr:BUILD_VERSION

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-24 22:52:05 +00:00
Tomasz Leman de358701cf ipc4: setdx: enable/disable cores
Adding code routine for enabling and disabling cores.
Cores id are check in high to low order, because primary core on path
to disable should be done last.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-02-24 22:23:06 +00:00
Tomasz Leman e60ce3f17d ipc4: setdx: validate message payload
Reading and validation of the ipc message payload.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-02-24 22:23:06 +00:00
Tomasz Leman 96c3268c7e ipc4: setdx: move payload definition to module messages
This patch removes code prepare for SetDx send via large config set.
Only module message is proper way to do this.
Moving payload struct from base_fw to module.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-02-24 22:23:06 +00:00
Tomasz Leman 22563ad029 ipc4: setdx: clean handler
Using copies of module_id and instance_id, otherwise they are unnecessary.
Removing unnecessary log, it has no useful information. Any value different
that 0 will be printed in error.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
2022-02-24 22:23:06 +00:00
Bard Liao c7246d2212 topology2: HDA: add 24 bit audio format
We declare that S24_LE is supported by a HDA PCM, but 24 bit audio
format is not included in the available audio format list.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2022-02-24 22:20:46 +00:00
Ranjani Sridharan 487d514b9d topology2: cavs: gain-pipelines: change the input/output bit depths
The DAI copiers only support 32-bit format. Change the gain-playback and
gain-capture to set the input/output bit-depth to match the DAI copier
requirement.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-24 21:42:08 +00:00
Ranjani Sridharan 33bae7afa1 topology2: cavs: dmic-generic: Add input/output bit depths
Add the input/output bit depth's for the BE DAI copier for the DMIC
capture pipeline.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-24 21:42:08 +00:00
Marc Herbert e2db3bcdb9 .github: switch to new xtensa-build-zephyr.py
Switch Github Actions away from older shell script.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-24 14:54:50 +00:00
Marc Herbert ce8bc4a394 xtensa-build-zephyr.py: important -v verbosity fixes
The most important fix is the addition of the "flush" argument which
means are commands are now printed when they are run and not all at the
end when everything is done.

Commands run by this script are very few so they are always shown.  This
makes it possible to debug just this script without being completely
drown in build noise. All '-v's are passed to west.

Pass -v to `west sign`, not just to `west build`.

Drop the manual "-DCMAKE_VERBOSE_MAKEFILE=ON", west knows how to do that.

Print directories first so commands are aligned, more visible and can be
copied. Use shlex to quote whitespace.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-24 14:46:17 +00:00
Seppo Ingalsuo be752fdc3f Audio: Volume: Optimize read frag usage from zero crossing search
This patch optimizes the buffer seek for zero crossing. The
audio_stream_read_frag_s16/24/32() is replaced with block
based search. The search block is defined by new stream function
audio_stream_rewind_bytes_without_wrap(). The other added stream
function audio_stream_rewind_wrap() handles the pointer wrap
when reading backwards.

The saving during volume ramping is from 12.4 MCPS to 10.8 MCPS
(1.6 MCPS) for 16 bit play, and 16.4 MCPS to 14.4 MCPS (2 MCPS)
for 24 bit and 32 bit playback.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-23 15:06:12 +00:00
Ranjani Sridharan acff9049f2 topology2: intel:dmic-generic: fix dma_buffer_size
It should be based on ibs but works today because ibs and obs are the
same.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-23 14:07:52 +00:00
Ranjani Sridharan 0d84f55361 topology2: pipelines: cavs: Fix the Dai copiers to only support 32-bit
format

Only the host copier should do the conversion based on the runtime
params. The DAI copiers should always support only 32-bit playback and
capture. So, fix the input/output formats for the copiers in the
respective pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-23 14:07:52 +00:00
Peter Ujfalusi 58ce6e6860 dma-trace: Preserve logs while dtrace is disabled
When the dma-trace is enabled (or re-enabled) the DMA channel is
re-initialized, configured.
The DMA will start reading data from the local buffer from the start (!!)
it can not be configured to start reading from the point it is left off.

Because of this, if the dtrace is disabled and re-enabled, the DMA will
copy old log entries starting from the beginning of the local buffer.

To be able to preserve the logs while the dtrace is disable we need to
reset both read and write pointers on the local buffer and when the dtrace
is again enabled we can transfer the logs from this point, without
misaligned or missed logs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-02-22 16:53:40 +00:00
Adrian Warecki 98ff79ea0c ipc_platform_send_msg: Replace goto with return.
Replaced assigning an error code to the ret variable and goto error with
return error code.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-02-21 15:42:43 +00:00
Adrian Warecki 42025e551a ipc: Added const specifier to protect IPC message content in sending functions.
Added the const specifier to protect the message passed to
ipc_platform_send_msg and ipc_prepare_to_send functions. The deletion of
the message from the list has been moved to ipc_send_queued_msg function.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-02-21 15:42:43 +00:00
Adrian Warecki 6b2e90ea0f ipc4/handler.c: Correction of ipc_prepare_to_send function.
This commit fixes two issues in the ipc_prepare_to_send function.
1. Function should not modify the message structure. Some modules
(eg. dma-trace) repeatedly send a previously prepared message. We can't
modify it.

2. Before freeing the dynamically allocated tx_data buffer, the function
should check for the processed message is an ipc reply.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-02-21 15:42:43 +00:00
Adrian Warecki b1eb7fd9fe dma-trace: Remove duplicated notify message
Removed redundant notification about log position from function
dma_trace_get_avail_data. Function trace_work already send it.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-02-21 12:38:48 +00:00
Seppo Ingalsuo 16c1db5379 Audio: EQIIR: Optimize pass-through mode read/write frags
This patch optimizes the remaining EQ functions eq_iir_s32_s16_pass()
and eq_iir_s32_s24_pass() to not use audio stream read/write
frag functions.

This patch did not change x-x bit case that was already handled
efficiently by 1:1 stream copy function with 6 MCPS. The 32-16 bits
case improved 22.4 MCPS to 6.4 MCPS (-16 MCPS), the 32-24 bits case
improved 23.6 MCPS to 6.8 MCPS (-16.8 MCPS).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-21 10:25:50 +00:00
Marc Herbert dbc8e0fb31 dma-trace.c: fix unsupported mtrace_printf("%s", ...) string specifier
The dictionary does not support character strings.

Fixes commit c11562b00a ("dma-trace: Align DMA buffer correctly to fix
dma tracing issues")

Take the opportunity to log the d pointer (which _is_ supported).

Fixes the following error message:

 TIMESTAMP         (us)              DELTA  C# COMPONENT          LOCATION                      CONTENT
error: String printing is not supported
[           2.604167] (           0.000000) c0 dma-trace             src/trace/dma-trace.c:266  ERROR <String @ 0xbe035e60> failed: no DMAC

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 10:22:44 +00:00
Marc Herbert 9fb7a607eb xtensa-build-zephyr.py: fix -C option so it can support whitespace
Make it possible to invoke -C multiple times which is required to
support whitespace as in:

  -C=--warn-uninitialized  -C '-DEXTRA_FLAGS=-Werror -g0'

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 09:23:40 +00:00
Marc Herbert 7d9aa8e04b xtensa-build-zephyr.py: switch to RawTextHelpFormatter and """
We need control to format add_argument(help=...) strings manually too.

Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 09:23:40 +00:00
Kai Vehmanen bcc789f981 drivers: Intel: SSP: fix update of DAI config in prepared state
The checks added in commit fc73578be7 ("drivers: Intel: SSP: ignore
config when SSP is already configured") also filter out cases where the
SSP parameters actually are modified in prepare state. This will happen
e.g. with a topology that has multiple configs for SSP and uses static
topology loading.

Modify the checks such that reconfiguration is done if:
 - the config is actually modified,
 - early MCLK/BCLK is not running.

BugLink: https://github.com/thesofproject/sof/issues/5375
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-21 09:21:26 +00:00
Seppo Ingalsuo 74fcc02ff5 Tools: Test, Tune: Improve Matlab scripts for EQ testing
The test scripts missed test component keyword change from e.g.
eqiir to eq-iir. Due to this the process_test() failed for IIR and
FIR for gain and frequency response due to wrong result expect.

The expected result is retrieved with the blob decode function. It
can be also used manually to check the filters defined in the
blob. The help texts in the decode functions needed fix. Also some
usage examples were added.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-18 21:47:16 +00:00
Ranjani Sridharan 0e53d54684 topology2: cavs: Add support for including DMIC in HDA topology
Currently we build separate topologies for TGL and CNL since their
io_clk's are different. Eventually, we'd need to unify these and let the
driver handle the blob selection in the kernel.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-18 21:39:50 +00:00
Ranjani Sridharan 8d0ac8e2da topology2: cavs: Add DMIC generic topology
Add the topology for 48k DMIC pipeline. 16K support will be added later.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-18 21:39:50 +00:00
Daniel Baluta b06f2cfe23 zephyr: add codec adapter components
This enables codec_adapter and cadence/passhtrough codecs
with SOF on Zephyr.

passthrough codec can be used as it is, but cadence codec
will also need codec libraries from cadence.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-18 21:12:24 +00:00
Daniel Baluta 5b7400a530 codec_adapter: Fix DECLARE_CODEC_ADAPTER macro
With the current implementation argument 'adapter' was ignored
for each instance of the codec the sys_*_init function name was the
same.

Fix this by properly using 'adapter' name.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-18 21:12:24 +00:00
Daniel Baluta 9bc69c7544 codec_adapter: Fix trace format mismatches
Two comp_err calls have mismatching formats and arguments. When built
with zephyr, comp_err() translates to printk which has better format
checks.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-18 21:12:24 +00:00
Rander Wang ecf557a19e ipc4: copier: add stream_start|end_offset support
host driver uses DMA link counter to calculate stream position for
playback, but it is not fit for the following 3 cases:
 (1) dai is enabled before host since they are in different pipelines
 (2) multiple stream are mixed into one dai
 (3) one stream is paused but the dai is still working with other stream

 host uses stream_start_offset & stream_end_offset to deal with such cases:
 if (stream_start_offset) {
	position = DMA counter - stream_start_offset
	if (stream_stop_offset)
		position = stream_stop_offset -stream_start_offset;
 } else {
	position = 0;
}
When host component is started  stream_start_offset is set to DMA counter
plus the latency from host to dai since the accurate DMA counter should be
used when the data arrives dai from host.

When pipeline is paused, stream_end_offset will save current DMA counter
for resume case

When pipeline is resumed, calculate stream_start_offset based on current
DMA counter and stream_end_offset

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Rander Wang 24b036930b ipc4: add state check for trigger function
return when the status is ready set

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Rander Wang f4b2901cf8 ipc4: disable ipc3 stream position
The ipc3 stream position is not fit for ipc4
and sends ipc3 message to host. Now disable it.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Rander Wang fa287e637b dw-dma: disable linear link position when releasing dma channel
The linear link position is only used by windows driver for
computing present position. When doing pause-resume operation
only zero data is reported by linear link position register.

Currently when stream is resumed after paused, dw-dma will
be first stopped and then started and the value of link position
register is cleared when it is disabled.

This patch will disable linear link position when the dma channel
is released

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Rander Wang fb19dcb8f5 ipc4: dai: remove sample count calculation for ipc4
Audio framework requires processed sample count
and audio driver gets processed bytes count and converts
to sample count, so fw doesn't need to calculate sample
count.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Rander Wang 79a9c873f8 ipc4: dai: initialized dma position in dai_config
The dma position is only used by ipc4 and host
requires it is initialized when the copier module
is initialized.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-02-18 21:09:36 +00:00
Marc Herbert 9edc5725fd .github: add fail-fast: false to gcc builds and qemu boot tests
We don't want one failure to cancel other platforms.

See unwanted cancellation example in #5386 /
https://github.com/thesofproject/sof/runs/5241344411

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-18 21:05:55 +00:00
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