Skip to content

Commit c196047

Browse files
committed
topology2: cavs-sdw: add Speaker and Microphone pcm
Add Speaker PCM to cavs-sdw topology. We need to set NUM_SDW_AMPS=1 in CMakeLists.txt if there is only one amplifier in the device and set NUM_SDW_AMPS=2 if there are two amplifiers. Set SDW_DMIC=1 if there is a SDW DMIC, like rt714 in the device. The 2nd ALH copier stream name should be the same as the 1st ALH copier, and no need to connect to the route. The 2nd ALH copier data will be set to the 1st ALH copier's gateway config in the aggregated mode. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 6d451b2 commit c196047

File tree

5 files changed

+188
-0
lines changed

5 files changed

+188
-0
lines changed

tools/topology/topology2/avs-tplg/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-generic-4ch.bin,USE_CHAIN_DMA=true
1717
# CAVS SDW topology with passthrough pipelines
1818
"cavs-sdw\;cavs-sdw\;DEEPBUFFER_FW_DMA_MS=100"
1919

20+
# IPC4 topology for TGL rt711 Headset + rt1316 Amplifier + rt714 DMIC
21+
"cavs-sdw\;sof-tgl-rt711-rt1316-rt714\;NUM_SDW_AMPS=2,SDW_DMIC=1"
22+
23+
# IPC4 topology for TGL rt711 Headset + rt1308 Amplifier + rt715 DMIC
24+
"cavs-sdw\;sof-tgl-rt715-rt711-rt1308-mono\;NUM_SDW_AMPS=1,SDW_DMIC=1,\
25+
SDW_JACK_OUT_STREAM=SDW1-Playback,SDW_JACK_IN_STREAM=SDW1-Capture,\
26+
SDW_SPK_STREAM=SDW2-Playback,SDW_DMIC_STREAM=SDW0-Capture"
27+
28+
# IPC4 topology for TGL rt711 Headset + rt1308 Amplifier + PCH DMIC
29+
"cavs-sdw\;sof-tgl-rt711-rt1308-4ch\;NUM_SDW_AMPS=1,NUM_DMICS=4,DMIC0_ID=3,\
30+
DMIC1_ID=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1"
31+
2032
# CAVS SDW with SRC gain and mixer support
2133
"cavs-sdw-src-gain-mixin\;cavs-sdw-src-gain-mixin"
2234

tools/topology/topology2/cavs-sdw.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Define {
5959
SDW_JACK_IN_STREAM 'SDW0-Capture'
6060
SDW_JACK_OUT_BE_ID 0
6161
SDW_JACK_IN_BE_ID 1
62+
NUM_SDW_AMPS 0
63+
SDW_DMIC 0
6264
}
6365

6466
# include DMIC config if needed.
@@ -80,6 +82,14 @@ IncludeByKey.DEEPBUFFER_FW_DMA_MS{
8082
"[1-1000]" "platform/intel/deep-buffer.conf"
8183
}
8284

85+
IncludeByKey.NUM_SDW_AMPS {
86+
"[1-2]" "platform/intel/sdw-amp-generic.conf"
87+
}
88+
89+
IncludeByKey.SDW_DMIC {
90+
"1" "platform/intel/sdw-dmic-generic.conf"
91+
}
92+
8393
#
8494
# List of all DAIs
8595
#
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Object.Pipeline {
3+
passthrough-be.$ALH_2ND_SPK_ID {
4+
direction "playback"
5+
index $ALH_2ND_SPK_ID
6+
copier_type "ALH"
7+
Object.Widget.copier.1 {
8+
stream_name $SDW_SPK_STREAM
9+
dai_type "ALH"
10+
copier_type "ALH"
11+
type "dai_in"
12+
node_type $ALH_LINK_OUTPUT_CLASS
13+
}
14+
}
15+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# route and pipeline index start from pcm id * 10
2+
3+
Define {
4+
SDW_SPK_STREAM 'SDW1-Playback'
5+
ALH_2ND_SPK_ID 22
6+
SDW_AMP_BE_ID 2
7+
}
8+
9+
Object.Dai {
10+
ALH."514" {
11+
id $SDW_AMP_BE_ID
12+
direction "playback"
13+
name $SDW_SPK_STREAM
14+
default_hw_conf_id 0
15+
rate 48000
16+
channels 2
17+
18+
Object.Base.hw_config."ALH514" {
19+
id 0
20+
}
21+
}
22+
}
23+
24+
Object.Pipeline {
25+
host-copier-gain-mixin-playback.20 {
26+
index 20
27+
28+
Object.Widget.copier.1 {
29+
stream_name "sdw amplifiers"
30+
}
31+
Object.Widget.gain.1 {
32+
Object.Control.mixer.1 {
33+
name 'Amplifier Volume'
34+
}
35+
}
36+
}
37+
38+
mixout-gain-dai-copier-playback.21 {
39+
index 21
40+
41+
Object.Widget.copier.1 {
42+
stream_name $SDW_SPK_STREAM
43+
dai_type "ALH"
44+
copier_type "ALH"
45+
node_type $ALH_LINK_OUTPUT_CLASS
46+
}
47+
Object.Widget.gain.1 {
48+
Object.Control.mixer.1 {
49+
name 'Main Amplifier Volume'
50+
}
51+
}
52+
}
53+
54+
}
55+
56+
IncludeByKey.NUM_SDW_AMPS {
57+
"2" "platform/intel/alh-2nd-spk.conf"
58+
}
59+
60+
Object.PCM {
61+
pcm.2 {
62+
name "Speaker"
63+
id 2
64+
direction "playback"
65+
Object.Base.fe_dai."Speaker" {}
66+
67+
Object.PCM.pcm_caps."playback" {
68+
name "sdw amplifiers"
69+
formats 'S16_LE,S24_LE,S32_LE'
70+
}
71+
}
72+
}
73+
74+
Object.Base {
75+
route.20 {
76+
source "gain.21.1"
77+
sink "copier.ALH.21.1"
78+
}
79+
80+
route.21 {
81+
source 'mixin.20.1'
82+
sink 'mixout.21.1'
83+
}
84+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# route and pipeline index start from pcm id * 10
2+
3+
Define {
4+
SDW_DMIC_STREAM 'SDW3-Capture'
5+
SDW_DMIC_BE_ID 4
6+
}
7+
8+
Object.Dai {
9+
ALH."771" {
10+
id $SDW_DMIC_BE_ID
11+
direction "capture"
12+
name $SDW_DMIC_STREAM
13+
default_hw_conf_id 0
14+
rate 48000
15+
channels 2
16+
17+
Object.Base.hw_config."ALH771" {
18+
id 0
19+
}
20+
}
21+
}
22+
23+
Object.Pipeline {
24+
passthrough-capture.40 {
25+
index 40
26+
27+
Object.Widget.copier.1.stream_name "sdw dmic"
28+
Object.Widget.copier.1.Object.Base.audio_format.1 {
29+
# 32 -> 16 bits conversion is done here,
30+
# so in_bit_depth is 32 (and out_bit_depth is 16).
31+
in_bit_depth 32
32+
}
33+
}
34+
passthrough-be.41 {
35+
direction "capture"
36+
index 41
37+
copier_type "ALH"
38+
Object.Widget.copier.1 {
39+
stream_name $SDW_DMIC_STREAM
40+
dai_type "ALH"
41+
copier_type "ALH"
42+
type "dai_out"
43+
node_type $ALH_LINK_INPUT_CLASS
44+
}
45+
}
46+
}
47+
48+
Object.PCM {
49+
pcm.4 {
50+
name "Microphone"
51+
id 4
52+
direction "capture"
53+
Object.Base.fe_dai."SDW DMIC" {}
54+
55+
Object.PCM.pcm_caps."capture" {
56+
name "sdw dmic"
57+
formats 'S16_LE,S24_LE,S32_LE'
58+
}
59+
}
60+
}
61+
62+
Object.Base {
63+
route.40 {
64+
source "copier.ALH.41.1"
65+
sink "copier.host.40.1"
66+
}
67+
}

0 commit comments

Comments
 (0)