Skip to content

Commit 901ef88

Browse files
committed
Tools: Topology: Add echo reference for SDW speaker and jack
This patch adds an echo reference capture PCM for speaker and jack playback. The additions are normally disabled but can be enabled with build options SDW_JACK_ECHO_REF=true and/or SDW_SPK_ECHO_REF=true. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent e00764e commit 901ef88

5 files changed

Lines changed: 486 additions & 41 deletions

File tree

tools/topology/topology2/cavs-sdw.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<ssp.conf>
5252
<bt-default.conf>
5353
<deep-buffer-default.conf>
54+
<siggen-host-copier-capture.conf>
5455

5556
Define {
5657
PLATFORM "none"

tools/topology/topology2/include/common/common_definitions.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,6 @@ Define {
6969
SSP_BLOB_VERSION_3_0 0x300
7070

7171
PCM_FORMAT_ALL false # Basic s16/s24/s32, no float, 8-bit etc.
72+
SDW_JACK_ECHO_REF false # No echo reference for 3.5mm jack
73+
SDW_SPK_ECHO_REF false # No echo reference for speaker
7274
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#
2+
# Siggen capture pipeline
3+
#
4+
# This class provides host pipeline for capture with siggen input. All
5+
# attributes defined herein are namespaced by alsatplg to
6+
# "Object.Pipeline.siggen-host-copier-capture.N.attribute_name".
7+
#
8+
# Usage: siggen-host-copier-capture pipeline object can be instantiated as:
9+
#
10+
# Object.Pipeline.siggen-host-copier-capture."N" {
11+
# period 1000
12+
# time_domain "timer"
13+
# }
14+
#
15+
# Where N is the unique pipeline ID within the same alsaconf node.
16+
#
17+
18+
<include/common/input_audio_format.conf>
19+
<include/common/output_audio_format.conf>
20+
<include/components/pipeline.conf>
21+
<include/components/host-copier.conf>
22+
<include/components/siggen.conf>
23+
24+
Class.Pipeline."siggen-host-copier-capture" {
25+
26+
<include/pipelines/pipeline-common.conf>
27+
28+
attributes {
29+
!constructor [
30+
"index"
31+
]
32+
33+
#
34+
# siggen-host-copier-capture objects instantiated within the same alsaconf node must have
35+
# unique pipeline_id attribute
36+
#
37+
unique "instance"
38+
}
39+
40+
Object.Widget {
41+
siggen."1" {
42+
num_input_pins 0
43+
num_output_pins 1
44+
num_input_audio_formats 1
45+
num_output_audio_formats 1
46+
Object.Base.input_audio_format [
47+
{
48+
in_bit_depth 32
49+
in_valid_bit_depth 32
50+
}
51+
]
52+
Object.Base.output_audio_format [
53+
{
54+
out_bit_depth 32
55+
out_valid_bit_depth 32
56+
}
57+
]
58+
}
59+
60+
host-copier."1" {
61+
type "aif_out"
62+
node_type $HDA_HOST_INPUT_CLASS
63+
num_input_pins 1
64+
num_output_pins 1
65+
num_input_audio_formats 1
66+
num_output_audio_formats 1
67+
Object.Base.input_audio_format [
68+
{
69+
in_bit_depth 32
70+
in_valid_bit_depth 32
71+
}
72+
]
73+
Object.Base.output_audio_format [
74+
{
75+
out_bit_depth 32
76+
out_valid_bit_depth 32
77+
}
78+
]
79+
}
80+
81+
pipeline."1" {
82+
priority 0
83+
lp_mode 0
84+
}
85+
}
86+
87+
direction "capture"
88+
dynamic_pipeline 1
89+
time_domain "timer"
90+
}

tools/topology/topology2/platform/intel/sdw-amp-generic.conf

Lines changed: 208 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Define {
1313
AMP_FEEDBACK_CH_PER_LINK 2
1414
SDW_AMP_FEEDBACK true
1515
AMP_PLAYBACK_NAME 'Speaker Playback'
16+
SDW_SPK_ECHO_REF_PCM_ID 12
1617
}
1718

1819
Object.Dai.ALH [
@@ -636,44 +637,76 @@ Object.PCM.pcm [
636637
]
637638

638639
IncludeByKey.PASSTHROUGH {
639-
"false" {
640-
IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK {
641-
"true" {
642-
Object.Base.route [
643-
{
644-
source "drc.21.1"
645-
sink "alh-copier.$SDW_SPK_STREAM.0"
646-
}
647-
]
648-
}
649-
"false" {
650-
Object.Base.route [
651-
{
652-
source "gain.21.1"
653-
sink "alh-copier.$SDW_SPK_STREAM.0"
654-
}
655-
]
656-
}
657-
}
658-
Object.Base.route [
659-
{
660-
source 'mixin.20.1'
661-
sink 'mixout.21.1'
662-
}
663-
{
664-
source 'host-copier.2.playback'
665-
sink 'gain.20.1'
666-
}
667-
]
668-
}
669-
"true" {
670-
Object.Base.route [
671-
{
672-
source "host-copier.2.playback"
673-
sink "alh-copier.$SDW_SPK_STREAM.0"
640+
"false" {
641+
IncludeByKey.SDW_SPK_ECHO_REF {
642+
"true" {
643+
IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK {
644+
"true" {
645+
Object.Base.route [
646+
{
647+
source "drc.21.1"
648+
sink "module-copier.21.22"
649+
}
650+
{
651+
source "module-copier.21.22"
652+
sink "alh-copier.$SDW_SPK_STREAM.0"
653+
}
654+
]
655+
}
656+
"false" {
657+
Object.Base.route [
658+
{
659+
source "gain.21.1"
660+
sink "module-copier.21.22"
661+
}
662+
{
663+
source "module-copier.21.22"
664+
sink "alh-copier.$SDW_SPK_STREAM.0"
665+
}
666+
]
667+
}
668+
}
669+
}
670+
"false" {
671+
IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK {
672+
"true" {
673+
Object.Base.route [
674+
{
675+
source "drc.21.1"
676+
sink "alh-copier.$SDW_SPK_STREAM.0"
677+
}
678+
]
679+
}
680+
"false" {
681+
Object.Base.route [
682+
{
683+
source "gain.21.1"
684+
sink "alh-copier.$SDW_SPK_STREAM.0"
685+
}
686+
]
687+
}
688+
}
689+
}
674690
}
675-
]
676-
}
691+
Object.Base.route [
692+
{
693+
source 'mixin.20.1'
694+
sink 'mixout.21.1'
695+
}
696+
{
697+
source 'host-copier.2.playback'
698+
sink 'gain.20.1'
699+
}
700+
]
701+
}
702+
"true" {
703+
Object.Base.route [
704+
{
705+
source "host-copier.2.playback"
706+
sink "alh-copier.$SDW_SPK_STREAM.0"
707+
}
708+
]
709+
}
677710
}
678711

679712
IncludeByKey.SDW_AMP_FEEDBACK {
@@ -885,3 +918,141 @@ IncludeByKey.SDW_AMP_FEEDBACK {
885918
]
886919
}
887920
}
921+
922+
IncludeByKey.SDW_SPK_ECHO_REF {
923+
"true" {
924+
Object.Widget.alh-copier [
925+
{
926+
stream_name "LoopbackCapture_virtual_DAI"
927+
direction "capture"
928+
type "dai_out"
929+
index 22
930+
dai_index 25
931+
node_type $ALH_LINK_INPUT_CLASS
932+
num_input_audio_formats 1
933+
num_output_audio_formats 1
934+
num_output_pins 1
935+
936+
Object.Base.input_audio_format [
937+
{
938+
in_bit_depth 32
939+
in_valid_bit_depth $SDW_LINK_VALID_BITS
940+
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
941+
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
942+
}
943+
]
944+
Object.Base.output_audio_format [
945+
{
946+
out_bit_depth 32
947+
out_valid_bit_depth 32
948+
}
949+
]
950+
}
951+
]
952+
953+
Object.Widget.module-copier."22" {
954+
index 21
955+
num_input_pins 1
956+
num_output_pins 2
957+
num_input_audio_formats 1
958+
num_output_audio_formats 1
959+
Object.Base.input_audio_format [
960+
{
961+
in_bit_depth 32
962+
in_valid_bit_depth 32
963+
}
964+
]
965+
Object.Base.output_audio_format [
966+
{
967+
out_bit_depth 32
968+
out_valid_bit_depth 32
969+
}
970+
]
971+
}
972+
973+
Object.Pipeline {
974+
siggen-host-copier-capture [
975+
{
976+
direction "capture"
977+
index 22
978+
Object.Widget.host-copier."1" {
979+
stream_name "Speaker Echo Reference"
980+
pcm_id $SDW_SPK_ECHO_REF_PCM_ID
981+
num_input_audio_formats 1
982+
Object.Base.input_audio_format [
983+
{
984+
in_bit_depth 32
985+
in_valid_bit_depth 32
986+
}
987+
]
988+
num_output_audio_formats 3
989+
Object.Base.output_audio_format [
990+
{
991+
out_bit_depth 16
992+
out_valid_bit_depth 16
993+
}
994+
{
995+
out_bit_depth 32
996+
out_valid_bit_depth 24
997+
}
998+
{
999+
out_bit_depth 32
1000+
out_valid_bit_depth 32
1001+
}
1002+
]
1003+
}
1004+
Object.Widget.siggen."1" {
1005+
num_input_pins 1
1006+
num_output_pins 1
1007+
num_input_audio_formats 1
1008+
num_output_audio_formats 1
1009+
Object.Base.input_audio_format [
1010+
{
1011+
in_rate $JACK_RATE
1012+
in_bit_depth 32
1013+
in_valid_bit_depth 32
1014+
}
1015+
]
1016+
Object.Base.output_audio_format [
1017+
{
1018+
out_rate $JACK_RATE
1019+
out_bit_depth 32
1020+
out_valid_bit_depth 32
1021+
}
1022+
]
1023+
}
1024+
}
1025+
]
1026+
}
1027+
1028+
Object.PCM.pcm [
1029+
{
1030+
name "Speaker Echo Reference"
1031+
id $SDW_SPK_ECHO_REF_PCM_ID
1032+
direction "capture"
1033+
Object.Base.fe_dai.1 {
1034+
name "Speaker Echo Reference"
1035+
}
1036+
Object.PCM.pcm_caps.1 {
1037+
name "Speaker Echo Reference"
1038+
formats 'S16_LE,S24_LE,S32_LE'
1039+
}
1040+
}
1041+
]
1042+
1043+
Object.Base.route [
1044+
{
1045+
source "alh-copier.LoopbackCapture_virtual_DAI.25"
1046+
sink "siggen.22.1"
1047+
}
1048+
{
1049+
source "module-copier.21.22"
1050+
sink "siggen.22.1"
1051+
}
1052+
{
1053+
source "siggen.22.1"
1054+
sink "host-copier.$SDW_SPK_ECHO_REF_PCM_ID.capture"
1055+
}
1056+
]
1057+
}
1058+
}

0 commit comments

Comments
 (0)