Skip to content

Commit

Permalink
Tools: Topology2: Add SRC component to cavs-nocodec.conf topologies
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
singalsu authored and kv2019i committed Sep 5, 2023
1 parent 961e4a6 commit 2a7a94d
Showing 1 changed file with 95 additions and 38 deletions.
133 changes: 95 additions & 38 deletions tools/topology/topology2/cavs-nocodec.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<dai-kpb-be.conf>
<wov-detect.conf>
<host-copier-gain-mixin-playback.conf>
<host-copier-gain-src-mixin-playback.conf>
<mixout-gain-dai-copier-playback.conf>
<mixout-gain-smart-amp-dai-copier-playback.conf>
<dai-copier-gain-module-copier-capture.conf>
Expand Down Expand Up @@ -166,15 +167,15 @@ Object.Dai.SSP [
# Pipeline definitions
#
# PCM1 ---> gain ---> Mixin ---> Mixout ---> gain ---> SSP1
# PCM2 ---> gain ---> Mixin ---> Mixout ---> gain ---> SSP2
# PCM2 ---> gain ---> SRC ---> Mixin ---> Mixout ---> gain ---> SSP2
# PCM4 ---> gain ---> Mixin -------------------------->\
# PCM3 ---> gain ---> Mixin ---->\ \
# PCM0 ---> gain ---> Mixin ---> Mixout ---> Mixin ---> Mixout ---> gain ---> smart_amp ---> SSP0
# /
# /---------------------------------------------------------------------->/
# SSP0 ---> PCM0
# SSP1 ---> PCM1
# SSP2 ---> PCM2
# SSP2 ---> SRC ---> PCM2

IncludeByKey.PASSTHROUGH {
"false" {
Expand All @@ -192,6 +193,9 @@ IncludeByKey.PASSTHROUGH {
}
}
}
]

Object.Pipeline.host-copier-gain-src-mixin-playback [
{
index 5

Expand Down Expand Up @@ -573,6 +577,14 @@ IncludeByKey.PASSTHROUGH {
pcm_id 0
}
}
{
index 11

Object.Widget.host-copier.1 {
stream_name 'SSP2 Capture'
pcm_id 2
}
}
]

Object.Pipeline.io-gateway-capture [
Expand Down Expand Up @@ -609,17 +621,6 @@ IncludeByKey.PASSTHROUGH {
}
}

Object.Pipeline.host-gateway-capture [
{
index 11

Object.Widget.host-copier.1 {
stream_name 'SSP2 Capture'
pcm_id 2
}
}
]

Object.Pipeline.io-gateway-capture [
{
index 12
Expand All @@ -644,6 +645,26 @@ Object.Pipeline.io-gateway-capture [

IncludeByKey.PASSTHROUGH {
"false" {
Object.Pipeline.host-gateway-capture [
{
index 11

Object.Widget.host-copier.1 {
stream_name 'SSP2 Capture'
pcm_id 2

<include/components/src_format_s32_to_sxx_convert.conf>
}
}
]

Object.Widget.src.1 {
index 11
rate_in 48000

<include/components/src_format_s32_convert_from_48k.conf>
}

IncludeByKey.NUM_DMICS {
"[1-4]" {
Object.Pipeline.gain-capture [
Expand Down Expand Up @@ -786,26 +807,6 @@ Object.PCM.pcm [
formats 'S16_LE,S24_LE,S32_LE'
}
}
{
name "$SSP2_PCM_NAME"
id 2
direction "duplex"
Object.Base.fe_dai.1 {
name "$SSP2_PCM_NAME"
}

Object.PCM.pcm_caps.1 {
direction "playback"
name "SSP2 Playback"
formats 'S16_LE,S24_LE,S32_LE'
}

Object.PCM.pcm_caps.2 {
direction "capture"
name "SSP2 Capture"
formats 'S16_LE,S24_LE,S32_LE'
}
}
]

IncludeByKey.PASSTHROUGH {
Expand Down Expand Up @@ -851,16 +852,60 @@ IncludeByKey.PASSTHROUGH {
channels_max $NUM_DMICS
}
}
{
name "$SSP2_PCM_NAME"
id 2
direction "duplex"
Object.Base.fe_dai.1 {
name "$SSP2_PCM_NAME"
}

Object.PCM.pcm_caps.1 {
direction "playback"
name "SSP2 Playback"
formats 'S16_LE,S24_LE,S32_LE'
rate_min 8000
rate_max 192000
}

Object.PCM.pcm_caps.2 {
direction "capture"
name "SSP2 Capture"
formats 'S16_LE,S24_LE,S32_LE'
rate_min 8000
rate_max 192000
}
}
]
}
}

Object.Base.route [
{
source "dai-copier.SSP.NoCodec-2.capture"
sink "host-copier.2.capture"
IncludeByKey.PASSTHROUGH {
"true" {
Object.PCM.pcm [
{
name "$SSP2_PCM_NAME"
id 2
direction "duplex"
Object.Base.fe_dai.1 {
name "$SSP2_PCM_NAME"
}

Object.PCM.pcm_caps.1 {
direction "playback"
name "SSP2 Playback"
formats 'S16_LE,S24_LE,S32_LE'
}

Object.PCM.pcm_caps.2 {
direction "capture"
name "SSP2 Capture"
formats 'S16_LE,S24_LE,S32_LE'
}
}
]
}
]
}

IncludeByKey.PASSTHROUGH {
"false" {
Expand Down Expand Up @@ -936,6 +981,14 @@ IncludeByKey.PASSTHROUGH {
source "gain.17.1"
sink "host-copier.$SSP0_CAPTURE_PCM_ID.capture"
}
{
source "dai-copier.SSP.NoCodec-2.capture"
sink "src.11.1"
}
{
source "src.11.1"
sink "host-copier.2.capture"
}
]
}
"true" {
Expand All @@ -952,6 +1005,10 @@ IncludeByKey.PASSTHROUGH {
source "host-copier.2.playback"
sink "dai-copier.SSP.NoCodec-2.playback"
}
{
source "dai-copier.SSP.NoCodec-2.capture"
sink "host-copier.2.capture"
}
]
}
}
Expand Down

0 comments on commit 2a7a94d

Please sign in to comment.