From 2a7a94d238a117946acc25607ad0978ea4923d9e Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 23 May 2023 16:11:12 +0300 Subject: [PATCH] Tools: Topology2: Add SRC component to cavs-nocodec.conf topologies 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 --- tools/topology/topology2/cavs-nocodec.conf | 133 +++++++++++++++------ 1 file changed, 95 insertions(+), 38 deletions(-) diff --git a/tools/topology/topology2/cavs-nocodec.conf b/tools/topology/topology2/cavs-nocodec.conf index 2a644d430..bac1fe211 100644 --- a/tools/topology/topology2/cavs-nocodec.conf +++ b/tools/topology/topology2/cavs-nocodec.conf @@ -18,6 +18,7 @@ + @@ -166,7 +167,7 @@ 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 @@ -174,7 +175,7 @@ Object.Dai.SSP [ # /---------------------------------------------------------------------->/ # SSP0 ---> PCM0 # SSP1 ---> PCM1 -# SSP2 ---> PCM2 +# SSP2 ---> SRC ---> PCM2 IncludeByKey.PASSTHROUGH { "false" { @@ -192,6 +193,9 @@ IncludeByKey.PASSTHROUGH { } } } + ] + + Object.Pipeline.host-copier-gain-src-mixin-playback [ { index 5 @@ -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 [ @@ -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 @@ -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 + + + } + } + ] + + Object.Widget.src.1 { + index 11 + rate_in 48000 + + + } + IncludeByKey.NUM_DMICS { "[1-4]" { Object.Pipeline.gain-capture [ @@ -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 { @@ -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" { @@ -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" { @@ -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" + } ] } }