Commit Graph

10737 Commits

Author SHA1 Message Date
Andrula Song 38be6aa4dd Audio: use struct dai_ts_data replace timestamp_data
Use struct dai_ts_data replace timestamp_data if
CONFIG_ZEPHYR_NATIVE_DRIVERS is enabled.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-09-18 11:36:13 +03:00
Andrula Song b2ed867ce5 Audio: Fix the bugs of dai timestamp ops
use the ts_config of struct dai_data as input/output
parameter instead a temporary variable while calling
the dai timestamp functions.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-09-18 11:36:13 +03:00
Baofeng Tian dac982aaaa audio: host: remove one buffer usage in host copy
during host copy, buffer acuquire and release should be used
as less as possible, since it takes a lot of cycles, for this
patch, cycle reduction is: 425 to 406, nearly 5% reduced.

note: test plafrom is tgl up board with sof debug build, base
platform clock is 38.4mhz.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-15 17:11:35 +03:00
Baofeng Tian 6bed0f0bdb audio: host: remove duplicated calculation for sample bytes
in parameter, dma sample bytes already was calculated and assigned
to dma config, during copy, this can be directly used, cycle saving
is quite remarkable, 452 to 425, previous target is 420, we already
meet with this patch.

note: test platform is tgl board with sof debug build.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-15 17:11:35 +03:00
Baofeng Tian dd2a64ba1a audio: host-zephyr: remove redundant return
there are two return in common update, remove the first
to save cycles, test platform is tgl board with debug sof
build, it can save cycles from 455 to 452.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-15 17:11:35 +03:00
Zhang Peng 036da2ac43 imx: sai: Fix sof run fail issue on imx8ulp
Don't need to enable packed mode for sai on 8ulp.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2023-09-15 14:50:18 +03:00
Jakub Dabek 1721f70426 logging: add logging through probes
Logging with probes was not implemented. This implements
ipc that enables logging with probe configuration.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2023-09-15 12:57:07 +03:00
Bard Liao e38f3f7829 topology2: add sof-mtl-rt713-l0-rt1316-l12-rt1713-l3 support
Add sof-mtl-rt713-l0-rt1316-l12-rt1713-l3 support.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2023-09-15 10:04:12 +03:00
Seppo Ingalsuo e7816e9e63 Tools: Tune: dcblock: Fixes for Matlab compatibility
The script can be run in both Matlab and Octave with these
changes.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 21:06:13 +03:00
Seppo Ingalsuo 884bad441e Tools: Tune: dcblock: Avoid warning about ignoring imaginary
The abs() function need to be added to plot the correct magnitude
response. Matlab warned in this case about ignoring imaginary
part.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 21:06:13 +03:00
Seppo Ingalsuo dec770dd8d Tools: Tune: Add tplg2 support to dcblock setup tool
This patch adds generate of blob for tplg2 and ipc4 in
formats .conf, text, and binary formats.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 21:06:13 +03:00
Bard Liao 3eada7c188 topology1: add sof-rpl-rt711-l0-rt1316-l12.tplg support
Adding sof-rpl-rt711-l0-rt1316-l12.tplg. The topology is the same
as sof-rpl-rt711-l0-rt1316-l12-rt714-l3, but without local mic (rt714).

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2023-09-14 16:48:15 +01:00
Seppo Ingalsuo 0fd9828d0c Audio: Multiband-DRC: Fix comment for switch control workaround
The workaround is preserved but the comment is updated to describe why.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 16:25:17 +01:00
Seppo Ingalsuo 833a558b8d Audio: Multiband-DRC: Add switch control for IPC4
This patch adds switch control handling into multiband_drc_set_config()
operation. The switch control is a set large config with
param_id set to SOF_IPC4_SWITCH_CONTROL_PARAM_ID.

The patch changes config_id to param_id in this function. The
config_id name was confusing.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 16:25:17 +01:00
Seppo Ingalsuo ba079694f4 ipc4: header: Add support for ALSA switch and enum control handling
The structs sof_ipc4_control_msg_payload and sof_ipc4_ctrl_value_chan
match the similar structures in Linux kernel SOF IPC4 driver.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-14 16:25:17 +01:00
Liam Girdwood b720f1a733 audio: Add new kconfig for shared library modules
Add a new kconfig option to build the shared library modules that can be
used to run the pipelines on the host with the testbench or the ALSA
plugin.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood 40b9e31925 ipc4: Add preprocessor directive
Fix the base_fw.h file to add the missing preprocessor directive.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood d1dd0486df library: Add missing definitions
Add missing platform definitions for CPU freq, DAI definitions etc.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood 137c0bfc77 host: remove XTOS prefix from headers
And add the POSIX prefix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood 2a6d9d3c36 posix: Add posix headers
Add the posix headers for use with the SOF ALSA plugin.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood 5668576429 host: trace: decouple the testbench from host build
Host build should not depend on testbench symbols. Also add timestamp to
the trace log.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood 955a5b3fc8 host: cmake: make sure we build maths support for host config
Add maths directory for host.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Liam Girdwood b2c9944ae7 xtos: mailbox: use memcpy for host mailbox_write
Host based mailbox needs to be fixed in another place. It's here
now until rtos partitioning is done.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Guennadi Liakhovetski 832830aa13 IDC: fix message cache handling
When an IDC message is received from another core, the receiver core
doesn't have any useful data for it in cache. Writing back the cache
can corrupt the message data. Cache has to be invalidated instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-09-14 16:00:31 +01:00
Seppo Ingalsuo f27085f046 Tools: Tune: Multiband-DRC: Add comment about generator script
This patch helps to find the right tool to create the setup blobs.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-13 14:54:15 +01:00
Guennadi Liakhovetski 623bc38711 IPC4: remove a superfluous initialisation
module_init in ipc4_init_module_instance() is completely overwritten,
no need to initialise it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-09-13 12:13:45 +03:00
Baofeng Tian 88fdb10e52 audio: src: rename sample rate converter coefficient folder name
rename it from src to coef to reflect the real content inside.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-13 12:06:57 +03:00
Baofeng Tian 611374e3ff audio: src: move src header file to source folder
previously, these headers are located in include directory.
Now, move it to src/audio/src/ directory, since these headers
are only used by src module.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-13 12:06:57 +03:00
Baofeng Tian 9fdbf1c398 audio: src: split src ipc3 and ipc4 specific file
create new files to cover ipc3 and ipc4 specific code.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-13 12:06:57 +03:00
Baofeng Tian ca3f44f2d7 audio: src: move out src component data out from src source
move component data out of source file to avoid ipc3 and ipc4
usage in src source file.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-09-13 12:06:57 +03:00
Guennadi Liakhovetski b6aad8d205 smart-amp: remove unused header
platform.h isn't needed in smart_amp_test.h, remove it from there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-09-13 12:05:36 +03:00
Guennadi Liakhovetski 3f9e6be455 module-adapter: (cosmetic) remove a redundant check
rfree(NULL) is valid, remove a redundant NULL check.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-09-13 12:00:53 +03:00
Guennadi Liakhovetski 2c54a54887 module-adapter: make interface const
Module adapter interfaces are a collection of methods, implementing
the API, they never change. Make them const.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-09-13 12:00:53 +03:00
Marcin Szkudlinski bec031a7a3 dp: introduce dp_queue
DP queue is a lockless circular buffer
providing safe consumer/producer cached operations cross cores

prerequisites:
 1) incoming and outgoing data rate MUST be the same
 2) Both data consumer and data producer declare
    max chunk sizes they want to use (IBS/OBS)

required Buffer size:
	- 2*MAX(IBS,OBS) if the larger of IBS/OBS
          is multiplication of smaller
	- 3*MAX(IBS,OBS) otherwise

The queue may work in 2 modes
1) local mode
   in case both receiver and sender are located on
   the same core and cache coherency
   does not matter. dp_queue structure is located in cached memory
   In this case DP Queue is a simple ring buffer

2) shared mode
   In this case we need to writeback cache when new data
   arrive and invalidate cache on secondary core.
   dp_queue structure is located in shared memory

dpQueue is a lockless consumer/producer safe buffer.
It is achieved by having only 2 shared variables:

 write_offset - can be modified by data producer only
 read_offset - can be modified by data consumer only

 as 32 bit operations are atomic, it is multi-thread and multi-core save

There some explanation needed how free_space and
available_data are calculated

number of avail data in circular buffer may be calculated as:
	data_avail = write_offset - read_offset
  and check for wrap around
	if (data_avail < 0) data_avail = buffer_size + data_avail

The problem is when write_offset == read_offset,
!!! it may mean either that the buffer is empty
    or the buffer is completely filled !!!

To solve the above issue having only 2 variables mentioned before:
 - allow both offsets to point from 0 to DOUBLE buffer_size
 - when calculating pointers to data, use:
         data_bufer[offset % buffer_size]
 - use double buffer size in wrap around check when calculating
   available data

And now:
  - write_offset == read_offset
		always means "buffer empty"
  - write_offset == read_offset + buffer_size
		always means "buffer full"

  - data_avail = write_offset - read_offset
	if (data_avail < 0) data_avail = 2 * buffer_size + data_avail

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-12 15:11:44 +03:00
Marcin Szkudlinski 3253175a5c source API: mark data pointers as const
Data provided by source interface cannot be modified in any way
by the module using source API.
Mark pointers as const

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-12 15:11:44 +03:00
Seppo Ingalsuo f114acecb1 Audio: Kconfig: Deprecate tone component
Tone component has been without maintenance and validation,
and there is no interface to control sound generation from
user space so it will be deprecated and removed from successive
release.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-11 15:57:30 +01:00
Marcin Szkudlinski 6ce1890443 sparse: do some cosmetic changes
after removal of __Sparse some of lines may be
formatted differently.

This commit contains cosmetic changes only

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 13:58:09 +01:00
Marcin Szkudlinski 0725ce8541 sparse: remove __sparse annotations from various places
Prev commit removing __sparse was a pure editor action,
this commit is removing some other __sparse annotations and
mappings that must have been done manually

This commit contains "safe" changes only

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 13:58:09 +01:00
Marcin Szkudlinski fc9fe6c043 sparse: remove all sparse_cache from buffer related structs
struct audio_stream __sparse_cache => struct audio_stream
struct comp_buffer __sparse_cache => struct comp_buffer
struct sof_source __sparse_cache => struct sof_source
struct sof_sink __sparse_cache => struct sof_sinkurce

this commit is 100% generated by editor find/replace
+ one cosmetic change (intent correction to make checkpatch happy)

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 13:58:09 +01:00
Seppo Ingalsuo 84809f9606 Tools: Topology2: Add Multiband-DRC
This patch adds the topology2 files for multiband-DRC. The EFX
processing chain is gain - IIR - FIR - DRC or Multiband-DRC. The
DRC selection is done with macro EFX_DRC_COMPONENT and values
"singleband" and "multiband".

The multiband-drc has two ALSA controls, bytes and switch. The
switch control switches the processing on and off.

The generated topology files with multiband-drc are:

sof-hda-efx-mbdrc-generic.tplg
sof-hda-efx-mbdrc-generic-2ch.tplg
sof-hda-efx-mbdrc-generic-4cg.tplg

The topology files with DRC are as before:

sof-hda-efx-mbdrc-generic.tplg
sof-hda-efx-mbdrc-generic-2ch.tplg
sof-hda-efx-mbdrc-generic-4cg.tplg

The configuration blob default is updated to what is generated
by the current example_multiband_drc.m configuration script. The
pass-through blob is set as default for tplg2. The topology 1
blobs are updated similarly.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-09-11 13:24:55 +01:00
Marcin Szkudlinski 94ebaa3166 sparse: remove notifier cache/uncache conversions
as buffer pointer now is not swapping between cached
and uncached aliases, there's no need to convert pointers
in notifier events

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 11:10:14 +03:00
Marcin Szkudlinski aaebb2563b sparse: add a debug core check for shared structures
to verify that shared structures are used in a proper way
a debug check is introduced

If compiled with COHERENT_CHECK_NONSHARED_CORES flag
each usage of shared structures will be verified
against proper memory alias usage

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 11:10:14 +03:00
Marcin Szkudlinski 4a03699911 buf: remove coherent.h from struct comp_buffer
This commit removes coherent.h from struct comp_buffer

As sharing status of a buffer is known at creation time, it is
enough to create a buffer in shared (not cached mem alias)
when it will be used by several cores

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 11:10:14 +03:00
Ranjani Sridharan 9ccfbc4e39 sof-glk-nocodec: disable pipelines when disabling SSPs
When we added the flags to disable SSP0 and SSP1 on the UP2, we took the
shortcut of just removing the PCMs in topology but left the pipelines
and widgets in the topology in. While this works in practice to prevent
us from testing those SSPs, the right way is to also remove those
pipelines also when the SSPs are disabled.

This stops tplgtool2.py from complaining constantly about this
inconsistency since https://github.com/thesofproject/sof-test/pull/1079
which made the sof-test verify-tplg-binary.sh fail every time:

```
tplgtool2.py sof-glk-nocodec.tplg

ERROR: No pcm id=0 for widget=PCM0C
ERROR: No pcm id=1 for widget=PCM1C
ERROR: No pcm id=0 for widget=PCM0P
ERROR: No pcm id=1 for widget=PCM1P
ERROR: tplgtool2.py returned 4
```

This change affects only sof-apl-nocodec and sof-glk-nocodec.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-11 10:17:07 +03:00
Brent Lu bd6933b5ab topology1: sof-tgl-max98357a-rt5682: add sof-adl-rt5650 topology
Add a new topology sof-adl-rt5650 for ALC5650 which supports SSP0 for
headset and SSP1 for speakers since this codec implements two I2S
interfaces.

DAI format changed to mclk: 24.576MHz, bclk: 3.072MHz, sample bits:
24-bit to avoid using ASRC function on codec side.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2023-09-08 14:38:57 +01:00
Ranjani Sridharan 2c6c1b4d4f audio: google_rtc: Remove set_large_config op for IPC4
The input and output audio formats are sent during module init already.
So no need to overwrite it with topology data that could be incorrect.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-07 15:49:02 +03:00
Gerard Marull-Paretas 014d2624ca zephyr: lib: regions_mm: add missing init.h
Because module uses SYS_INIT defined in init.h. Things likely worked
because of indirect includes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-09-06 14:09:36 +03:00
Gerard Marull-Paretas b66e79dc3d zephyr: lib: alloc: s/device.h/init.h
Module is using Zephyr SYS_INIT API, defined in init.h, not device.h.
Code relied on indirect includes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-09-06 14:09:36 +03:00
Rander Wang 65b2e0b390 copier: adjust valid format based on sample type
Adjust valid format in copier for some types of dai gateway which
need to use MSB type.

Currently sample type only affect the copier module so we don't do
it in audio_stream_fmt_conversion.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-09-06 12:14:42 +03:00
Rander Wang fc8a4b6730 topology2: change the sample type for Linux audio system
At first the sample type is set to MSB_INTEGER to follow windows
settings, but actually we use LSB_INTERGER type such as S24_4LE.
Now change the default sample type to LSB_INTERGER to align with
FW usage. For DAI copier we need to use MSB_INTERGER for hardware
requirement. Currently sample type only affect s24/c32 case, so only
change sample type in dai for this format config.

FW will use sample type to choose correct format conversion
function and can deal with Windows audio stream correctly with MSB
s24/c32 format.

out_fmt_cfg is redefined for a alsa-lib bug. Alsa-lib will first process
out_fmt_cfg = '$[($out_channels | ($out_valid_bit_depth * 256)) |
($out_sample_type * 65536)]' in base class and then deal with
out_sample_type, so error is reported. Now first define out_sample_type
and then out_fmt_cfg, everything works.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-09-06 12:14:42 +03:00