From 080363ece967ad61e1ab5bda6d9f2941440e9354 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 29 Nov 2022 10:54:28 +0800 Subject: [PATCH] topology2: add sdw spk feedback pcm This commit create a PCM that can pass amplifier feedback to user space. Signed-off-by: Bard Liao --- .../topology2/platform/intel/alh-2nd-spk.conf | 15 +++++ .../platform/intel/sdw-amp-generic.conf | 57 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/tools/topology/topology2/platform/intel/alh-2nd-spk.conf b/tools/topology/topology2/platform/intel/alh-2nd-spk.conf index 8e976914c..2cf6dddd2 100644 --- a/tools/topology/topology2/platform/intel/alh-2nd-spk.conf +++ b/tools/topology/topology2/platform/intel/alh-2nd-spk.conf @@ -12,4 +12,19 @@ Object.Pipeline { node_type $ALH_LINK_OUTPUT_CLASS } } + passthrough-be.$ALH_2ND_SPK_IN_ID { + direction "capture" + index $ALH_2ND_SPK_IN_ID + copier_type "ALH" + Object.Widget.pipeline.1 { + stream_name 'SPK IN stream' + } + Object.Widget.copier.1 { + stream_name $SDW_SPK_IN_STREAM + dai_type "ALH" + copier_type "ALH" + type "dai_out" + node_type $ALH_LINK_INPUT_CLASS + } + } } diff --git a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf index aaa68a40b..fdf19bf33 100644 --- a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf @@ -2,8 +2,11 @@ Define { SDW_SPK_STREAM 'SDW1-Playback' + SDW_SPK_IN_STREAM 'SDW1-Capture' ALH_2ND_SPK_ID 22 + ALH_2ND_SPK_IN_ID 32 SDW_AMP_BE_ID 2 + SDW_AMP_IN_BE_ID 3 } Object.Dai { @@ -19,6 +22,18 @@ Object.Dai { id 0 } } + ALH."515" { + id $SDW_AMP_IN_BE_ID + direction "capture" + name $SDW_SPK_IN_STREAM + default_hw_conf_id 1 + rate 48000 + channels 2 + + Object.Base.hw_config."ALH515" { + id 1 + } + } } Object.Pipeline { @@ -51,6 +66,32 @@ Object.Pipeline { } } + passthrough-capture.30 { + index 30 + Object.Widget.pipeline.1.stream_name "SPK IN stream" + + Object.Widget.copier.1.stream_name "amp feedback" + Object.Widget.copier.1.Object.Base.audio_format.1 { + # 32 -> 16 bits conversion is done here, + # so in_bit_depth is 32 (and out_bit_depth is 16). + in_bit_depth 32 + } + } + passthrough-be.31 { + direction "capture" + index 31 + copier_type "ALH" + Object.Widget.pipeline.1 { + stream_name 'SPK IN stream' + } + Object.Widget.copier.1 { + stream_name $SDW_SPK_IN_STREAM + dai_type "ALH" + copier_type "ALH" + type "dai_out" + node_type $ALH_LINK_INPUT_CLASS + } + } } IncludeByKey.NUM_SDW_AMPS { @@ -69,6 +110,17 @@ Object.PCM { formats 'S16_LE,S24_LE,S32_LE' } } + pcm.3 { + name "Amp feedback" + id 3 + direction "capture" + Object.Base.fe_dai."Amp feedback" {} + + Object.PCM.pcm_caps."capture" { + name "amp feedback" + formats 'S16_LE,S32_LE' + } + } } Object.Base { @@ -81,4 +133,9 @@ Object.Base { source 'mixin.20.1' sink 'mixout.21.1' } + + route.30 { + source "copier.ALH.31.1" + sink "copier.host.30.1" + } }