1# route and pipeline index start from pcm id * 10
2
3Define {
4	SDW_SPK_STREAM 'SDW1-Playback'
5	SDW_SPK_IN_STREAM 'SDW1-Capture'
6	ALH_2ND_SPK_ID 22
7	ALH_2ND_SPK_IN_ID 32
8	SDW_AMP_BE_ID 2
9	SDW_AMP_IN_BE_ID 3
10	AMP_FEEDBACK_CH 2
11	SDW_AMP_FEEDBACK true
12}
13
14Object.Dai.ALH [
15	{
16		dai_index 20
17		id 		$SDW_AMP_BE_ID
18		direction	"playback"
19		name		$SDW_SPK_STREAM
20		default_hw_conf_id	0
21		rate			48000
22		channels		2
23
24		Object.Base.hw_config.1 {
25			id	0
26			name	"ALH514"
27		}
28	}
29]
30
31Object.Pipeline {
32	host-copier-gain-mixin-playback [
33		{
34			index 20
35
36			Object.Widget.copier.1 {
37				stream_name "sdw amplifiers"
38			}
39			Object.Widget.gain.1 {
40				Object.Control.mixer.1 {
41					name 'Amplifier Volume'
42				}
43			}
44		}
45	]
46
47	mixout-gain-dai-copier-playback [
48		{
49			index 21
50
51			Object.Widget.copier.1 {
52				stream_name $SDW_SPK_STREAM
53				dai_type "ALH"
54				copier_type "ALH"
55				node_type $ALH_LINK_OUTPUT_CLASS
56			}
57			Object.Widget.gain.1 {
58				Object.Control.mixer.1 {
59					name 'Main Amplifier Volume'
60				}
61			}
62		}
63	]
64
65}
66
67IncludeByKey.NUM_SDW_AMPS {
68"2"	{
69		Define {
70			AMP_FEEDBACK_CH 4
71		}
72
73		Object.Pipeline {
74			io-gateway [
75				{
76					direction	"playback"
77					index $ALH_2ND_SPK_ID
78					copier_type "ALH"
79					Object.Widget.copier.1 {
80						stream_name	$SDW_SPK_STREAM
81						dai_type	"ALH"
82						copier_type	"ALH"
83						type		"dai_in"
84						node_type $ALH_LINK_OUTPUT_CLASS
85					}
86				}
87			]
88			io-gateway-capture	[
89				{
90					direction	"capture"
91					index $ALH_2ND_SPK_IN_ID
92					copier_type "ALH"
93
94					Object.Widget.copier.1 {
95						stream_name	$SDW_SPK_IN_STREAM
96						dai_type	"ALH"
97						copier_type	"ALH"
98						type		"dai_out"
99						node_type $ALH_LINK_INPUT_CLASS
100					}
101				}
102			]
103		}
104	}
105}
106
107Object.PCM.pcm [
108	{
109		name	"Speaker"
110		id 2
111		direction	"playback"
112		Object.Base.fe_dai.1 {
113			name	"Speaker"
114		}
115
116		Object.PCM.pcm_caps.1 {
117			name "sdw amplifiers"
118			formats 'S16_LE,S24_LE,S32_LE'
119		}
120	}
121]
122
123Object.Base.route [
124	{
125		source	"gain.21.1"
126		sink	"copier.ALH.21.1"
127	}
128	{
129		source 'mixin.20.1'
130		sink 'mixout.21.1'
131	}
132]
133
134IncludeByKey.SDW_AMP_FEEDBACK {
135	"true" {
136		Object.Dai.ALH [
137			{
138				dai_index 30
139				id 		$SDW_AMP_IN_BE_ID
140				direction	"capture"
141				name		$SDW_SPK_IN_STREAM
142				default_hw_conf_id	1
143				rate			48000
144				channels		2
145
146				Object.Base.hw_config.1 {
147					id	1
148					name	"ALH515"
149				}
150			}
151		]
152		Object.Pipeline {
153			host-gateway-capture [
154				{
155					index 30
156
157					Object.Widget.copier.1.stream_name	"amp feedback"
158					Object.Widget.copier.1.Object.Base.audio_format.1 {
159						# 32 -> 16 bits conversion is done here,
160						# so in_bit_depth is 32 (and out_bit_depth is 16).
161					in_bit_depth	32
162					}
163				}
164			]
165
166			io-gateway [
167				{
168					direction	"capture"
169					index 31
170					copier_type "ALH"
171
172					Object.Widget.copier.1 {
173						stream_name	$SDW_SPK_IN_STREAM
174						dai_type	"ALH"
175						copier_type	"ALH"
176						type		"dai_out"
177						node_type $ALH_LINK_INPUT_CLASS
178					}
179				}
180			]
181		}
182		Object.PCM.pcm [
183			{
184				name	"Amp feedback"
185				id 3
186				direction	"capture"
187				Object.Base.fe_dai.1 {
188					name	"Amp feedback"
189				}
190
191				Object.PCM.pcm_caps.1 {
192					name "amp feedback"
193					formats 'S16_LE,S32_LE'
194					channels_min $AMP_FEEDBACK_CH
195					channels_max $AMP_FEEDBACK_CH
196				}
197			}
198		]
199		Object.Base.route [
200			{
201				source	"copier.ALH.31.1"
202				sink	"copier.host.30.1"
203			}
204		]
205	}
206}
207