Commit Graph

7890 Commits

Author SHA1 Message Date
Pierre-Louis Bossart 9709ef81dc topology1: sof-glk-es8336: use mclk ID0
It's not clear why the initial contribution used mclk ID1, mclk ID0 is
used by 99% of devices - and a manual inspection of NHLT supports that
claim. We will have to deal with the MCLK ID1 case with quirks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2022-03-03 16:46:39 +00:00
YC Hung ba29bdcda4 ipc: ipc3: reset host position in ipc_stream_pcm_params before reply
Reset host position in ipc_stream_pcm_params before reply. It could avoid
that linux side get invalid value before host position updating. This
invalid value happens when running alsa conformance test and use pcm
pointer function to get host position value but see invalid value at
the beginning. After providing this patch, the invalid value will be
replaced with zero.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-03 16:44:57 +00:00
YC Hung 6a18e5a8c9 audio: host: update position every period to improve precision
The position is currently updated by the host component when a
period was consumed. The granularity of this position is too large,
applications relying on timer-based scheduling may query the
position at any time and conformance test suites fail.

This patch introduce another field "cont_update_posn" in
sof_ipc_stream_params which suggests a more precise position
reporting, by storing the latest position in a memory window
when the host component completes a transfer. This will increase
the traffic to memory windows, but allow for a much smaller
granularity in position updates.

In hindsight, this solution should have been the default behavior
but to avoid backwards compatibility issues is added as a new
capability controlled by an ABI check. Only with a recent-enough
Linux kernel will this behavior be enabled.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-03 16:44:57 +00:00
Malik_Hsu c42ede6a97 topology: sof-adl-max98360a-rt5682-waves: add new topology
Add support for max98360a speaker amplifiers with waves function.

Signed-off-by: Malik_Hsu <malik_hsu@wistron.corp-partner.google.com>
2022-03-02 14:00:40 +00:00
Ranjani Sridharan 07d5432d5c codec_adapter: Modify the process API signature
Modify the signature of the process API in the module interface to pass
the input/output buffers along with the counts of the number of input
and output buffers.

Please note that the pass input/output buffers are not used at this
point. The codec implementations will be modified in the follow-up
patches to use them.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-03-02 13:50:52 +00:00
Ranjani Sridharan 8bcfd6fa20 module_interface: Introduce 2 new structures
Introduce 2 new structures to represent the input and output stream
buffers. These will be passed as inputs to the process API.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-03-02 13:50:52 +00:00
Rander Wang 0b537cba4d ipc4: init gain & mixin components for zephyr
Fix issue of ipc4 pipeline initialization with zephyr enabled.
Need to initialize these two components. Gain module is another
type of volume without peak volume support and mixin has subset
function of mixer.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-01 22:50:17 +00:00
Kai Vehmanen 26e08d4d55 xtensa-build-zephyr: use separate Zephyr config for TGPH builds
Zephyr recently added support for separate configs for 2-core and 4-core
variants of cAVS2.5. Use the new "tgph" configuration for when building
SOF for TigerLake-H variant.

BugLink: https://github.com/thesofproject/sof/issues/5018
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:49:36 +00:00
Kai Vehmanen f1e3c934f0 zephyr: use z_init_cpu() if Zephyr 3.0.99 or newer
Use the new interface to initialize non-primary cores before
enabling them with arch_start_cpu(). This interface is not
available in Zephyr 3.0.0, but is mandatory in later release.

Depends on Zephyr commit 2b210cb3db05 ("kernel: Refactor SMP cpu
initialization a bit").

BugLink: https://github.com/thesofproject/sof/issues/5456
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Kai Vehmanen 760f5ddea2 zephyr: fix race in secondary core power-up
z_wrapper_cpu_enable_secondary_core() may be called
repeatedly on a core that is already running. Add a check
to ensure we do not try to restart a core that is already
running.

Also add a check for ready_flag as done in upstream Zephyr
kernel/smp.c to ensure z_wrapper_cpu_enable_secondary_core()
does not return until the target core has finished its
startup and arch_cpu_active() returns true.

BugLink: https://github.com/thesofproject/sof/issues/5446
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Tomasz Leman 82240250c0 dmic: allow to set IPM_SOURCE_MODE from config blob
This bit determines operation mode for all source decimator.
0 = MONO
1 = STEREO

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 14:36:19 +00:00
Marc Herbert e3e038d6d4 Revert "dma-trace: Preserve logs while dtrace is disabled"
This reverts commit 58ce6e6860.

This commit has caused the DMA trace to be frequently empty on a number
of ADL and TGL in daily runs for two days in a row (test runs 10429 and
10459).

The DMA trace could be completely empty in the past but that was on
different platforms and a very long time ago, this had been fixed in
bug #4333 and had not happened for many months.

The _only_ commit difference between the last successful test
run (10402) and the first failing one (10459) is this commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-01 14:35:48 +00:00
YC Hung f551fdb9fb platform: mt8195: suspend switch clock back to 26M
When DSP enter suspend:
1.Define CLK_SUSPEND_CPU_HZ 26M for DSP suspend frequency and turn
  off adsp pll clock to avoid unexpected behavior after resume.
2.Increase wait for interrupt level to 15 to avoid unexpected interrupts.
3.Remove XT_WAITI_DELAY for LX7.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
2022-03-01 14:02:31 +00:00
Rander Wang 8f78c7ecd6 ipc4: invalidate dcache for host mailbox
Fix a regression issue on windows. Need to invalidate dcache
for host message or FW will get garbage data.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-01 14:01:52 +00:00
Seppo Ingalsuo 5cf5e32a40 Audio: TDFB: Switch to fir_32x16_2x() function in generic C
This patch replaces the two calls for FIR filter with the dual
FIR function call.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo 5eb7304f61 Math: FIR: Add more efficient generic C function fir_32x16_2x()
This patch adds FIR function that computes two samples per call
it reduces the coefficients and PCM data accesses. Saving from
original FIR is 34 MCPS from 134 MCPS to 100 MCPS.

The samples include constrain of FIR coefficients length to
be multiple of four and add two into delay line length to have
room for two input samples while keeping the length even.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo fc30b4b870 Math: FIR: Simplify and optimize generic C FIR filter
This change saves 18 MCPS as gcc build build for xtensa on TGL-H
from 134 MCPS to 115 MCPS in a stereo 48 kHz 64 tap filter case.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo da8ee993a7 Audio: TDFB: Optimize read/write frag in HiFiEP copy() function
The change similar as in generic C version patch but with
different core function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Seppo Ingalsuo eee82cb10a Audio: TDFB: Optimize read/write frag based generic C copy() function
The new samples processing loop uses audio_stream_without_wrap()
function to loop maximum amount of frames without source and
sink buffer pointers wrap check.

In a test with TGL-H and gcc build the performance was improved by
this patch 9.2 MCPS from 140 MCPS to 130 MCPS.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-01 14:01:16 +00:00
Tomasz Leman edf5866da7 ipc4: setdx: prevent d0 when ppl are active
This patch prevent driver from requesting FW to enter D0 state when
there are still active pipelines.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Tomasz Leman 00fce8bd20 fix: ipc4: setdx: infinity loop
This patch refactors the SetDX handler to avoid entering infinity loop.

Secondary cores are enabled/disabled in loop iterating from 1 to
CONFIG_CORE_COUNT. Primary core is disabled at the end, because it's
required that all secondary cores to be already disabled. If all
conditions are met, FW can enter the D3 state.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Tomasz Leman 4ea628e118 ipc4: setdx: update comment
This patch updates the comment for SetDX handler to be more accurate.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-03-01 13:57:47 +00:00
Daniel Baluta ab715d8e34 zephyr: spinlock: Fix compile time warnings
With Zephyr, spinlock.h needs to know `struct k_spinlock`
definition.

Include, Zephyr's <kernel.h> header.

This fixes compile time warnings like this:

z/modules/audio/sof/zephyr/../src/include/sof/schedule/ll_schedule_domain.h:
In function 'domain_init'"
z/modules/audio/sof/zephyr/../src/include/sof/schedule/ll_schedule_domain.h:93:18:
warning: passing argument 1 of 'k_spinlock_init' from incompatible
pointer type [-Wincompatible-pointer-types]

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-28 16:39:06 +00:00
Curtis Malainey 57e0e149aa topology1: add build with no hotword or 16k dmic
Some builds require more memory, hotword can be handled by CRAS so lets
add the ability to drop it. The 16kHz dmic is not needed either so lets
drop that too.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2022-02-28 13:19:19 +00:00
Daniel Baluta 2055068104 audio_buffer: Allow NULL to be passed to buffer_free
This will allow users to pass NULL to buffer_free.

This fixes codec_adapter_free crash, where mod->local_buff is only
allocated when the module is prepared.

With dynamic pipelines we could have the situation where the pipeline
is created then SOF device enters suspend and pipeline is destroyed.

Thus we try to free unallocated mod->local_buf. Fix this by allowing
buffer_free to live free when receiving a NULL pointer.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-28 11:49:58 +00:00
Chao Song 6f71808e3e xtensa-build-zephyr.py: add ipc4 build support for tgl
Add ipc4 build support for tgl with OVERLAY_CONFIG.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-26 11:06:59 +00:00
Ranjani Sridharan ce050aa25b topology2: cavs-nocodec: split pipelines into host and dai pipelines
Split pipelines into host and DAI pipelines and fix some SSP params

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
Ranjani Sridharan 3629141cbb topology2: cavs-nocodec: include dmic-generic.conf if needed
Include dmic-generic conditionally based on NUM_DMIC's and add nhlt
build support in CMake variables.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
Ranjani Sridharan ae5326ccd2 topology2: intel: dmic-generic: Move all definitions to dmic-default.conf
Move all defaults variable definitions to dmic-default.conf. These should
be included by all topologies before overriding the defaults with
platform-specific or machine-specific definitions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-02-26 11:06:21 +00:00
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