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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Remove gateway type and direction for pcm conversion check and will move
them to copier module. This will make pcm conversion check more general
and simple. Also remove s16/c32 for gateway since it is never used.
Signed-off-by: Rander Wang <rander.wang@intel.com>
For sample format with 24 bits valid sample bit and 32 bits container,
valid sample is at msb 24bits if IPC4_TYPE_MSB_INTEGER is set.
Signed-off-by: Rander Wang <rander.wang@intel.com>
The CONFIG_SECONDARY_CORE_DISABLING_TIMEOUT is for FW to do secondary
core disabling check and set to 5000ms by default. Linux driver
set ipc timeout duration to 500ms, but FW wait 5000ms in
cpu_disable_core for SET_DX ipc message. This makes driver stop but fw
is still waiting. Actually the disabling can be successful in far less
than 5000ms and it was first designed for FPGA case. Now change it to
400ms to make debugging easier.
Signed-off-by: Rander Wang <rander.wang@intel.com>
This patch converts the component to module API. The configuration
blob handling is also changed to model handler.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
With stable-v2.7 branch create, set the mainline version
to 2.7.99 to prepare for SOF v2.8 development.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
NUM_HDMIS is set to 3 as default value for MTL platform. SPK_ID and BT_ID
are modified based on this change in the target cmake file.
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Contains 75+ commits, including following directly affecting
SOF targets:
f0fd9f171342 drivers: hda: insert an empty ";" statement before switch() labels
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Replace the call to z_abort_timeout() to be able to drop
dependency to timeout_q.h. This header is intended to be Zephyr
kernel private and plan is to remove this.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This patch adds 8 - 192 kHz playback and capture SRC to nocodec
topologies such sof-tgl-nocodec.tplg. It enables testing of SRC
component with IPC4 via the SSP loopback in the nocodec topologies
E.g. Play random noise at 44.1 kHz and capture it as 32 kHz. The
SSP loopback runs internally at 48 kHz.
aplay -Dhw:0,2 -f S32_LE -c 2 -r 44100 -d 10 -t raw /dev/random
arecord -Dhw:0,2 -f S16_LE -c 2 -r 32000 -d 10 /tmp/recording.wav
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch replaces src_format.conf and src_passthrough_format.conf
with more specific formats definitions for host copiers,
pass-through components, playback src, and capture src.
The DSP internal pipelines are 32 bits, so src_s32_passthrough.conf
is used for components like gain those pass the 8 - 192 kHz
rates with s32 format.
The formats in src_format_sxx_to_s32_convert.conf is for use for
for playback host copier. Input formats are s16/24/32 and the only
output format is s32. Similarly the src_format_s32_to_sxx_convert.conf
is for capture host copier.
The formats for playback SRC are in src_format_s32_convert_to_48k.conf,
and the formats for capture are in src_format_s32_convert_from_48k.conf.
The new formats definitions use the input_audio_format and
output_audio_format objects instead of audio_format. The unnecessary
word lengths are removed to minimize the formats count in every
component.
The pipelines host-copier-gain-src-mixin-playback.conf and
src-gain-mixin-playback.conf those used the previous format definitions
are updated with these changes.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch removes rule to require fixed rate_out for SRC
widget. A capture SRC in host pipeline or near it has typically
variable output rate.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>