Skip to content

Commit

Permalink
Tools: Topology2: Add topology to test playback SRC conversions
Browse files Browse the repository at this point in the history
This patch adds to development topologies a topology
sof-hda-src-generic.tplg. It is similar to sof-hda-generic but adds
to first playback PCM pipeline a SRC component after gain. The
pipeline supports playback of S32_LE with 8 - 192 kHz rates.

The cavs/src.conf is merged to src.conf, and the SRC format
include files are brought up from cavs directory. The topology
cavs-sdw-src-gain-mixin.tplg related .conf files are updated
for common location. The missing rate_out attribute is added.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu authored and lgirdwood committed Feb 16, 2023
1 parent d806350 commit 64fe2ea
Show file tree
Hide file tree
Showing 10 changed files with 249 additions and 108 deletions.
1 change: 0 additions & 1 deletion tools/topology/topology2/cavs-sdw-src-gain-mixin.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<searchdir:include>
<searchdir:include/common>
<searchdir:include/components>
<searchdir:include/components/cavs>
<searchdir:include/dais>
<searchdir:include/controls>
<searchdir:include/pipelines/cavs>
Expand Down
126 changes: 126 additions & 0 deletions tools/topology/topology2/cavs-src-mixin-mixout-hda.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Define {
ANALOG_PLAYBACK_PCM 'Analog Playback'
ANALOG_CAPTURE_PCM 'Analog Capture'
HDA_ANALOG_DAI_NAME 'Analog Playback and Capture'
DEEP_BUFFER_PIPELINE_ID 15
DEEP_BUFFER_PCM_ID 31
DEEP_BUFFER_PIPELINE_SRC 'mixin.15.1'
DEEP_BUFFER_PIPELINE_SINK 'mixout.2.1'
DEEP_BUFFER_PCM_NAME 'Deepbuffer HDA Analog'
}

# include deep buffer config if buffer size is in 1 - 1000 ms.
IncludeByKey.DEEPBUFFER_FW_DMA_MS{
"[1-1000]" "platform/intel/deep-buffer.conf"
}

Object.Dai {
HDA.0 {
name $HDA_ANALOG_DAI_NAME
dai_index 0
id 4
default_hw_conf_id 4
Object.Base.hw_config.1 {
name "HDA0"
}
direction duplex
}
}
Object.Pipeline {
mixout-gain-dai-copier-playback.0 {
index 2

Object.Widget.copier.1 {
stream_name $HDA_ANALOG_DAI_NAME
dai_type "HDA"
copier_type "HDA"
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name '2 Main Playback Volume'
}
}
}

host-copier-gain-src-mixin-playback.0 {
index 1

Object.Widget.copier.1 {
stream_name $ANALOG_PLAYBACK_PCM
}

Object.Widget.src.1 {
}

Object.Widget.gain.1 {
Object.Control.mixer.1 {
name '1 2nd Playback Volume'
}
}
}

passthrough-capture.1 {
index 3
Object.Widget.copier.1 {
stream_name $ANALOG_CAPTURE_PCM
}
}

passthrough-be.1 {
index 4
direction capture

Object.Widget.copier."1" {
dai_type "HDA"
type "dai_out"
copier_type "HDA"
stream_name $HDA_ANALOG_DAI_NAME
node_type $HDA_LINK_INPUT_CLASS
Object.Base.audio_format.1 {
in_bit_depth 32
in_valid_bit_depth 32
out_bit_depth 32
out_valid_bit_depth 32
dma_buffer_size "$[$ibs * 2]"
}
}
}
}
Object.PCM {
pcm.0 {
id 0
name 'HDA Analog'
Object.Base.fe_dai.1 {
name "HDA Analog"
}
Object.PCM.pcm_caps.1 {
direction "playback"
name $ANALOG_PLAYBACK_PCM
formats 'S32_LE,S24_LE,S16_LE'
rate_min 8000
rate_max 192000
}
Object.PCM.pcm_caps.2 {
direction "capture"
name $ANALOG_CAPTURE_PCM
formats 'S32_LE,S24_LE,S16_LE'
}
direction duplex
}
}

# top-level pipeline connections
Object.Base {
route.1 {
sink 'copier.HDA.2.1'
source 'gain.2.1'
}
route.2 {
source 'mixin.1.1'
sink 'mixout.2.1'
}
route.3 {
source 'copier.HDA.4.1'
sink 'copier.host.3.1'
}
}
2 changes: 2 additions & 0 deletions tools/topology/topology2/development/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ USE_CHAIN_DMA=true,DEEPBUFFER_FW_DMA_MS=100,EFX_FIR_PARAMS=passthrough,EFX_IIR_P
HDA_CONFIG=efx,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\
PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-efx-generic-4ch.bin,USE_CHAIN_DMA=true,\
DEEPBUFFER_FW_DMA_MS=100,EFX_FIR_PARAMS=passthrough,EFX_IIR_PARAMS=passthrough"
# CAVS HDA topology with gain and SRC before mixin for HDA and passthrough pipelines for HDMI
"sof-hda-generic\;sof-hda-src-generic\;HDA_CONFIG=src,USE_CHAIN_DMA=true,DEEPBUFFER_FW_DMA_MS=100"
)
add_custom_target(topology2_dev)

Expand Down
100 changes: 0 additions & 100 deletions tools/topology/topology2/include/components/cavs/src.conf

This file was deleted.

19 changes: 15 additions & 4 deletions tools/topology/topology2/include/components/src.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ Class.Widget."src" {
token_ref "sof_tkn_comp.uuid"
}

DefineAttribute."num_audio_formats" {
# Token set reference name and type
token_ref "sof_tkn_comp.word"
}

#
# Bespoke attributes for SRC
#
Expand Down Expand Up @@ -65,10 +70,11 @@ Class.Widget."src" {
]

!mandatory [
"format"
"rate_out"
"num_input_audio_formats"
"num_output_audio_formats"
"num_input_pins"
"num_output_pins"
]

#
Expand All @@ -92,7 +98,12 @@ Class.Widget."src" {
#
# Default attributes for src
#
type "src"
uuid "6d:32:c5:c1:90:83:b4:46:aa:47:95:c3:be:ca:65:50"
no_pm "true"
type "src"
uuid "8d:b2:1b:e6:9a:14:1f:4c:b7:09:46:82:3e:f5:f5:ae"
no_pm "true"
period_sink_count 2
period_source_count 2
core_id 0
num_input_pins 1
num_output_pins 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# FE playback pipeline: host-copier-gain-mixin-playback
#
# All attributes defined herein are namespaced
# by alsatplg to "Object.Pipeline.host-copier-gain-src-mixin-playback.N.attribute_name"
#
# Usage: host-copier-gain-src-mixin-playback pipeline object can be instantiated as:
#
# Object.Pipeline.host-copier-gain-src-mixin-playback."N" {
# period 1000
# time_domain "timer"
# channels 2
# rate 48000
# }
#
# Where N is the unique pipeline ID within the same alsaconf node.
#

<include/common/audio_format.conf>
<include/components/copier.conf>
<include/components/mixin.conf>
<include/components/pipeline.conf>
<include/components/gain.conf>
<include/components/src.conf>

Class.Pipeline."host-copier-gain-src-mixin-playback" {

DefineAttribute."index" {}

<include/pipelines/pipeline-common.conf>

attributes {
!constructor [
"index"
]

!immutable [
"direction"
]

#
# host-copier-gain-src-mixin-playback objects instantiated within the same
# alsaconf node must have unique pipeline_id attribute
#
unique "instance"
}

Object.Widget {
copier."1" {
copier_type "host"
type "aif_in"
node_type $HDA_HOST_OUTPUT_CLASS

<include/components/src_passthrough_format.conf>
}

gain."1" {
<include/components/src_passthrough_format.conf>
}

src."1" {
rate_out 48000

<include/components/src_format.conf>
}

mixin."1" {}

pipeline."1" {
priority 0
lp_mode 0
}
}

Object.Base {
route.1 {
source copier.host..1
sink gain..1
}
route.2 {
source gain..1
sink src..1
}
route.3 {
source src..1
sink mixin..1
}
}

direction "playback"
dynamic_pipeline 1
time_domain "timer"
channels 2
channels_min 2
channels_max 2
rate 48000
rate_min 8000
rate_max 192000
}
Loading

0 comments on commit 64fe2ea

Please sign in to comment.