1
2
3
4
5#include <linux/init.h>
6#include <linux/err.h>
7#include <linux/module.h>
8#include <linux/platform_device.h>
9#include <linux/of_platform.h>
10#include <linux/bitops.h>
11#include <linux/component.h>
12#include <linux/mutex.h>
13#include <linux/of_device.h>
14#include <linux/slab.h>
15#include <sound/core.h>
16#include <sound/soc.h>
17#include <sound/soc-dapm.h>
18#include <sound/pcm.h>
19#include <sound/control.h>
20#include <sound/asound.h>
21#include <sound/pcm_params.h>
22#include "q6afe.h"
23#include "q6asm.h"
24#include "q6adm.h"
25#include "q6routing.h"
26
27#define DRV_NAME "q6routing-component"
28
29#define Q6ROUTING_RX_MIXERS(id) \
30 SOC_SINGLE_EXT("MultiMedia1", id, \
31 MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,\
32 msm_routing_put_audio_mixer), \
33 SOC_SINGLE_EXT("MultiMedia2", id, \
34 MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,\
35 msm_routing_put_audio_mixer), \
36 SOC_SINGLE_EXT("MultiMedia3", id, \
37 MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,\
38 msm_routing_put_audio_mixer), \
39 SOC_SINGLE_EXT("MultiMedia4", id, \
40 MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,\
41 msm_routing_put_audio_mixer), \
42 SOC_SINGLE_EXT("MultiMedia5", id, \
43 MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,\
44 msm_routing_put_audio_mixer), \
45 SOC_SINGLE_EXT("MultiMedia6", id, \
46 MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,\
47 msm_routing_put_audio_mixer), \
48 SOC_SINGLE_EXT("MultiMedia7", id, \
49 MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,\
50 msm_routing_put_audio_mixer), \
51 SOC_SINGLE_EXT("MultiMedia8", id, \
52 MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,\
53 msm_routing_put_audio_mixer),
54
55#define Q6ROUTING_RX_DAPM_ROUTE(mix_name, s) \
56 { mix_name, "MultiMedia1", "MM_DL1" }, \
57 { mix_name, "MultiMedia2", "MM_DL2" }, \
58 { mix_name, "MultiMedia3", "MM_DL3" }, \
59 { mix_name, "MultiMedia4", "MM_DL4" }, \
60 { mix_name, "MultiMedia5", "MM_DL5" }, \
61 { mix_name, "MultiMedia6", "MM_DL6" }, \
62 { mix_name, "MultiMedia7", "MM_DL7" }, \
63 { mix_name, "MultiMedia8", "MM_DL8" }, \
64 { s, NULL, mix_name }
65
66#define Q6ROUTING_TX_DAPM_ROUTE(mix_name) \
67 { mix_name, "PRI_MI2S_TX", "PRI_MI2S_TX" }, \
68 { mix_name, "SEC_MI2S_TX", "SEC_MI2S_TX" }, \
69 { mix_name, "QUAT_MI2S_TX", "QUAT_MI2S_TX" }, \
70 { mix_name, "TERT_MI2S_TX", "TERT_MI2S_TX" }, \
71 { mix_name, "PRIMARY_TDM_TX_0", "PRIMARY_TDM_TX_0"}, \
72 { mix_name, "PRIMARY_TDM_TX_1", "PRIMARY_TDM_TX_1"}, \
73 { mix_name, "PRIMARY_TDM_TX_2", "PRIMARY_TDM_TX_2"}, \
74 { mix_name, "PRIMARY_TDM_TX_3", "PRIMARY_TDM_TX_3"}, \
75 { mix_name, "PRIMARY_TDM_TX_4", "PRIMARY_TDM_TX_4"}, \
76 { mix_name, "PRIMARY_TDM_TX_5", "PRIMARY_TDM_TX_5"}, \
77 { mix_name, "PRIMARY_TDM_TX_6", "PRIMARY_TDM_TX_6"}, \
78 { mix_name, "PRIMARY_TDM_TX_7", "PRIMARY_TDM_TX_7"}, \
79 { mix_name, "SEC_TDM_TX_0", "SEC_TDM_TX_0"}, \
80 { mix_name, "SEC_TDM_TX_1", "SEC_TDM_TX_1"}, \
81 { mix_name, "SEC_TDM_TX_2", "SEC_TDM_TX_2"}, \
82 { mix_name, "SEC_TDM_TX_3", "SEC_TDM_TX_3"}, \
83 { mix_name, "SEC_TDM_TX_4", "SEC_TDM_TX_4"}, \
84 { mix_name, "SEC_TDM_TX_5", "SEC_TDM_TX_5"}, \
85 { mix_name, "SEC_TDM_TX_6", "SEC_TDM_TX_6"}, \
86 { mix_name, "SEC_TDM_TX_7", "SEC_TDM_TX_7"}, \
87 { mix_name, "TERT_TDM_TX_0", "TERT_TDM_TX_0"}, \
88 { mix_name, "TERT_TDM_TX_1", "TERT_TDM_TX_1"}, \
89 { mix_name, "TERT_TDM_TX_2", "TERT_TDM_TX_2"}, \
90 { mix_name, "TERT_TDM_TX_3", "TERT_TDM_TX_3"}, \
91 { mix_name, "TERT_TDM_TX_4", "TERT_TDM_TX_4"}, \
92 { mix_name, "TERT_TDM_TX_5", "TERT_TDM_TX_5"}, \
93 { mix_name, "TERT_TDM_TX_6", "TERT_TDM_TX_6"}, \
94 { mix_name, "TERT_TDM_TX_7", "TERT_TDM_TX_7"}, \
95 { mix_name, "QUAT_TDM_TX_0", "QUAT_TDM_TX_0"}, \
96 { mix_name, "QUAT_TDM_TX_1", "QUAT_TDM_TX_1"}, \
97 { mix_name, "QUAT_TDM_TX_2", "QUAT_TDM_TX_2"}, \
98 { mix_name, "QUAT_TDM_TX_3", "QUAT_TDM_TX_3"}, \
99 { mix_name, "QUAT_TDM_TX_4", "QUAT_TDM_TX_4"}, \
100 { mix_name, "QUAT_TDM_TX_5", "QUAT_TDM_TX_5"}, \
101 { mix_name, "QUAT_TDM_TX_6", "QUAT_TDM_TX_6"}, \
102 { mix_name, "QUAT_TDM_TX_7", "QUAT_TDM_TX_7"}, \
103 { mix_name, "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"}, \
104 { mix_name, "QUIN_TDM_TX_1", "QUIN_TDM_TX_1"}, \
105 { mix_name, "QUIN_TDM_TX_2", "QUIN_TDM_TX_2"}, \
106 { mix_name, "QUIN_TDM_TX_3", "QUIN_TDM_TX_3"}, \
107 { mix_name, "QUIN_TDM_TX_4", "QUIN_TDM_TX_4"}, \
108 { mix_name, "QUIN_TDM_TX_5", "QUIN_TDM_TX_5"}, \
109 { mix_name, "QUIN_TDM_TX_6", "QUIN_TDM_TX_6"}, \
110 { mix_name, "QUIN_TDM_TX_7", "QUIN_TDM_TX_7"}
111
112#define Q6ROUTING_TX_MIXERS(id) \
113 SOC_SINGLE_EXT("PRI_MI2S_TX", PRIMARY_MI2S_TX, \
114 id, 1, 0, msm_routing_get_audio_mixer, \
115 msm_routing_put_audio_mixer), \
116 SOC_SINGLE_EXT("SEC_MI2S_TX", SECONDARY_MI2S_TX, \
117 id, 1, 0, msm_routing_get_audio_mixer, \
118 msm_routing_put_audio_mixer), \
119 SOC_SINGLE_EXT("TERT_MI2S_TX", TERTIARY_MI2S_TX, \
120 id, 1, 0, msm_routing_get_audio_mixer, \
121 msm_routing_put_audio_mixer), \
122 SOC_SINGLE_EXT("QUAT_MI2S_TX", QUATERNARY_MI2S_TX, \
123 id, 1, 0, msm_routing_get_audio_mixer, \
124 msm_routing_put_audio_mixer), \
125 SOC_SINGLE_EXT("PRIMARY_TDM_TX_0", PRIMARY_TDM_TX_0, \
126 id, 1, 0, msm_routing_get_audio_mixer, \
127 msm_routing_put_audio_mixer), \
128 SOC_SINGLE_EXT("PRIMARY_TDM_TX_1", PRIMARY_TDM_TX_1, \
129 id, 1, 0, msm_routing_get_audio_mixer, \
130 msm_routing_put_audio_mixer), \
131 SOC_SINGLE_EXT("PRIMARY_TDM_TX_2", PRIMARY_TDM_TX_2, \
132 id, 1, 0, msm_routing_get_audio_mixer, \
133 msm_routing_put_audio_mixer), \
134 SOC_SINGLE_EXT("PRIMARY_TDM_TX_3", PRIMARY_TDM_TX_3, \
135 id, 1, 0, msm_routing_get_audio_mixer, \
136 msm_routing_put_audio_mixer), \
137 SOC_SINGLE_EXT("PRIMARY_TDM_TX_4", PRIMARY_TDM_TX_4, \
138 id, 1, 0, msm_routing_get_audio_mixer, \
139 msm_routing_put_audio_mixer), \
140 SOC_SINGLE_EXT("PRIMARY_TDM_TX_5", PRIMARY_TDM_TX_5, \
141 id, 1, 0, msm_routing_get_audio_mixer, \
142 msm_routing_put_audio_mixer), \
143 SOC_SINGLE_EXT("PRIMARY_TDM_TX_6", PRIMARY_TDM_TX_6, \
144 id, 1, 0, msm_routing_get_audio_mixer, \
145 msm_routing_put_audio_mixer), \
146 SOC_SINGLE_EXT("PRIMARY_TDM_TX_7", PRIMARY_TDM_TX_7, \
147 id, 1, 0, msm_routing_get_audio_mixer, \
148 msm_routing_put_audio_mixer), \
149 SOC_SINGLE_EXT("SEC_TDM_TX_0", SECONDARY_TDM_TX_0, \
150 id, 1, 0, msm_routing_get_audio_mixer, \
151 msm_routing_put_audio_mixer), \
152 SOC_SINGLE_EXT("SEC_TDM_TX_1", SECONDARY_TDM_TX_1, \
153 id, 1, 0, msm_routing_get_audio_mixer, \
154 msm_routing_put_audio_mixer), \
155 SOC_SINGLE_EXT("SEC_TDM_TX_2", SECONDARY_TDM_TX_2, \
156 id, 1, 0, msm_routing_get_audio_mixer, \
157 msm_routing_put_audio_mixer), \
158 SOC_SINGLE_EXT("SEC_TDM_TX_3", SECONDARY_TDM_TX_3, \
159 id, 1, 0, msm_routing_get_audio_mixer, \
160 msm_routing_put_audio_mixer), \
161 SOC_SINGLE_EXT("SEC_TDM_TX_4", SECONDARY_TDM_TX_4, \
162 id, 1, 0, msm_routing_get_audio_mixer, \
163 msm_routing_put_audio_mixer), \
164 SOC_SINGLE_EXT("SEC_TDM_TX_5", SECONDARY_TDM_TX_5, \
165 id, 1, 0, msm_routing_get_audio_mixer, \
166 msm_routing_put_audio_mixer), \
167 SOC_SINGLE_EXT("SEC_TDM_TX_6", SECONDARY_TDM_TX_6, \
168 id, 1, 0, msm_routing_get_audio_mixer, \
169 msm_routing_put_audio_mixer), \
170 SOC_SINGLE_EXT("SEC_TDM_TX_7", SECONDARY_TDM_TX_7, \
171 id, 1, 0, msm_routing_get_audio_mixer, \
172 msm_routing_put_audio_mixer), \
173 SOC_SINGLE_EXT("TERT_TDM_TX_0", TERTIARY_TDM_TX_0, \
174 id, 1, 0, msm_routing_get_audio_mixer, \
175 msm_routing_put_audio_mixer), \
176 SOC_SINGLE_EXT("TERT_TDM_TX_1", TERTIARY_TDM_TX_1, \
177 id, 1, 0, msm_routing_get_audio_mixer, \
178 msm_routing_put_audio_mixer), \
179 SOC_SINGLE_EXT("TERT_TDM_TX_2", TERTIARY_TDM_TX_2, \
180 id, 1, 0, msm_routing_get_audio_mixer, \
181 msm_routing_put_audio_mixer), \
182 SOC_SINGLE_EXT("TERT_TDM_TX_3", TERTIARY_TDM_TX_3, \
183 id, 1, 0, msm_routing_get_audio_mixer, \
184 msm_routing_put_audio_mixer), \
185 SOC_SINGLE_EXT("TERT_TDM_TX_4", TERTIARY_TDM_TX_4, \
186 id, 1, 0, msm_routing_get_audio_mixer, \
187 msm_routing_put_audio_mixer), \
188 SOC_SINGLE_EXT("TERT_TDM_TX_5", TERTIARY_TDM_TX_5, \
189 id, 1, 0, msm_routing_get_audio_mixer, \
190 msm_routing_put_audio_mixer), \
191 SOC_SINGLE_EXT("TERT_TDM_TX_6", TERTIARY_TDM_TX_6, \
192 id, 1, 0, msm_routing_get_audio_mixer, \
193 msm_routing_put_audio_mixer), \
194 SOC_SINGLE_EXT("TERT_TDM_TX_7", TERTIARY_TDM_TX_7, \
195 id, 1, 0, msm_routing_get_audio_mixer, \
196 msm_routing_put_audio_mixer), \
197 SOC_SINGLE_EXT("QUAT_TDM_TX_0", QUATERNARY_TDM_TX_0, \
198 id, 1, 0, msm_routing_get_audio_mixer, \
199 msm_routing_put_audio_mixer), \
200 SOC_SINGLE_EXT("QUAT_TDM_TX_1", QUATERNARY_TDM_TX_1, \
201 id, 1, 0, msm_routing_get_audio_mixer, \
202 msm_routing_put_audio_mixer), \
203 SOC_SINGLE_EXT("QUAT_TDM_TX_2", QUATERNARY_TDM_TX_2, \
204 id, 1, 0, msm_routing_get_audio_mixer, \
205 msm_routing_put_audio_mixer), \
206 SOC_SINGLE_EXT("QUAT_TDM_TX_3", QUATERNARY_TDM_TX_3, \
207 id, 1, 0, msm_routing_get_audio_mixer, \
208 msm_routing_put_audio_mixer), \
209 SOC_SINGLE_EXT("QUAT_TDM_TX_4", QUATERNARY_TDM_TX_4, \
210 id, 1, 0, msm_routing_get_audio_mixer, \
211 msm_routing_put_audio_mixer), \
212 SOC_SINGLE_EXT("QUAT_TDM_TX_5", QUATERNARY_TDM_TX_5, \
213 id, 1, 0, msm_routing_get_audio_mixer, \
214 msm_routing_put_audio_mixer), \
215 SOC_SINGLE_EXT("QUAT_TDM_TX_6", QUATERNARY_TDM_TX_6, \
216 id, 1, 0, msm_routing_get_audio_mixer, \
217 msm_routing_put_audio_mixer), \
218 SOC_SINGLE_EXT("QUAT_TDM_TX_7", QUATERNARY_TDM_TX_7, \
219 id, 1, 0, msm_routing_get_audio_mixer, \
220 msm_routing_put_audio_mixer), \
221 SOC_SINGLE_EXT("QUIN_TDM_TX_0", QUINARY_TDM_TX_0, \
222 id, 1, 0, msm_routing_get_audio_mixer, \
223 msm_routing_put_audio_mixer), \
224 SOC_SINGLE_EXT("QUIN_TDM_TX_1", QUINARY_TDM_TX_1, \
225 id, 1, 0, msm_routing_get_audio_mixer, \
226 msm_routing_put_audio_mixer), \
227 SOC_SINGLE_EXT("QUIN_TDM_TX_2", QUINARY_TDM_TX_2, \
228 id, 1, 0, msm_routing_get_audio_mixer, \
229 msm_routing_put_audio_mixer), \
230 SOC_SINGLE_EXT("QUIN_TDM_TX_3", QUINARY_TDM_TX_3, \
231 id, 1, 0, msm_routing_get_audio_mixer, \
232 msm_routing_put_audio_mixer), \
233 SOC_SINGLE_EXT("QUIN_TDM_TX_4", QUINARY_TDM_TX_4, \
234 id, 1, 0, msm_routing_get_audio_mixer, \
235 msm_routing_put_audio_mixer), \
236 SOC_SINGLE_EXT("QUIN_TDM_TX_5", QUINARY_TDM_TX_5, \
237 id, 1, 0, msm_routing_get_audio_mixer, \
238 msm_routing_put_audio_mixer), \
239 SOC_SINGLE_EXT("QUIN_TDM_TX_6", QUINARY_TDM_TX_6, \
240 id, 1, 0, msm_routing_get_audio_mixer, \
241 msm_routing_put_audio_mixer), \
242 SOC_SINGLE_EXT("QUIN_TDM_TX_7", QUINARY_TDM_TX_7, \
243 id, 1, 0, msm_routing_get_audio_mixer, \
244 msm_routing_put_audio_mixer),
245
246struct session_data {
247 int state;
248 int port_id;
249 int path_type;
250 int app_type;
251 int acdb_id;
252 int sample_rate;
253 int bits_per_sample;
254 int channels;
255 int perf_mode;
256 int numcopps;
257 int fedai_id;
258 unsigned long copp_map;
259 struct q6copp *copps[MAX_COPPS_PER_PORT];
260};
261
262struct msm_routing_data {
263 struct session_data sessions[MAX_SESSIONS];
264 struct session_data port_data[AFE_MAX_PORTS];
265 struct device *dev;
266 struct mutex lock;
267};
268
269static struct msm_routing_data *routing_data;
270
271
272
273
274
275
276
277
278
279
280
281int q6routing_stream_open(int fedai_id, int perf_mode,
282 int stream_id, int stream_type)
283{
284 int j, topology, num_copps = 0;
285 struct route_payload payload;
286 struct q6copp *copp;
287 int copp_idx;
288 struct session_data *session, *pdata;
289
290 if (!routing_data) {
291 pr_err("Routing driver not yet ready\n");
292 return -EINVAL;
293 }
294
295 session = &routing_data->sessions[stream_id - 1];
296 pdata = &routing_data->port_data[session->port_id];
297
298 mutex_lock(&routing_data->lock);
299 session->fedai_id = fedai_id;
300
301 session->path_type = pdata->path_type;
302 session->sample_rate = pdata->sample_rate;
303 session->channels = pdata->channels;
304 session->bits_per_sample = pdata->bits_per_sample;
305
306 payload.num_copps = 0;
307 topology = NULL_COPP_TOPOLOGY;
308 copp = q6adm_open(routing_data->dev, session->port_id,
309 session->path_type, session->sample_rate,
310 session->channels, topology, perf_mode,
311 session->bits_per_sample, 0, 0);
312
313 if (!copp) {
314 mutex_unlock(&routing_data->lock);
315 return -EINVAL;
316 }
317
318 copp_idx = q6adm_get_copp_id(copp);
319 set_bit(copp_idx, &session->copp_map);
320 session->copps[copp_idx] = copp;
321
322 for_each_set_bit(j, &session->copp_map, MAX_COPPS_PER_PORT) {
323 payload.port_id[num_copps] = session->port_id;
324 payload.copp_idx[num_copps] = j;
325 num_copps++;
326 }
327
328 if (num_copps) {
329 payload.num_copps = num_copps;
330 payload.session_id = stream_id;
331 q6adm_matrix_map(routing_data->dev, session->path_type,
332 payload, perf_mode);
333 }
334 mutex_unlock(&routing_data->lock);
335
336 return 0;
337}
338EXPORT_SYMBOL_GPL(q6routing_stream_open);
339
340static struct session_data *get_session_from_id(struct msm_routing_data *data,
341 int fedai_id)
342{
343 int i;
344
345 for (i = 0; i < MAX_SESSIONS; i++) {
346 if (fedai_id == data->sessions[i].fedai_id)
347 return &data->sessions[i];
348 }
349
350 return NULL;
351}
352
353
354
355
356
357
358
359
360void q6routing_stream_close(int fedai_id, int stream_type)
361{
362 struct session_data *session;
363 int idx;
364
365 session = get_session_from_id(routing_data, fedai_id);
366 if (!session)
367 return;
368
369 for_each_set_bit(idx, &session->copp_map, MAX_COPPS_PER_PORT) {
370 if (session->copps[idx]) {
371 q6adm_close(routing_data->dev, session->copps[idx]);
372 session->copps[idx] = NULL;
373 }
374 }
375
376 session->fedai_id = -1;
377 session->copp_map = 0;
378}
379EXPORT_SYMBOL_GPL(q6routing_stream_close);
380
381static int msm_routing_get_audio_mixer(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_value *ucontrol)
383{
384 struct snd_soc_dapm_context *dapm =
385 snd_soc_dapm_kcontrol_dapm(kcontrol);
386 struct soc_mixer_control *mc =
387 (struct soc_mixer_control *)kcontrol->private_value;
388 int session_id = mc->shift;
389 struct snd_soc_component *c = snd_soc_dapm_to_component(dapm);
390 struct msm_routing_data *priv = dev_get_drvdata(c->dev);
391 struct session_data *session = &priv->sessions[session_id];
392
393 if (session->port_id == mc->reg)
394 ucontrol->value.integer.value[0] = 1;
395 else
396 ucontrol->value.integer.value[0] = 0;
397
398 return 0;
399}
400
401static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
402 struct snd_ctl_elem_value *ucontrol)
403{
404 struct snd_soc_dapm_context *dapm =
405 snd_soc_dapm_kcontrol_dapm(kcontrol);
406 struct snd_soc_component *c = snd_soc_dapm_to_component(dapm);
407 struct msm_routing_data *data = dev_get_drvdata(c->dev);
408 struct soc_mixer_control *mc =
409 (struct soc_mixer_control *)kcontrol->private_value;
410 struct snd_soc_dapm_update *update = NULL;
411 int be_id = mc->reg;
412 int session_id = mc->shift;
413 struct session_data *session = &data->sessions[session_id];
414
415 if (ucontrol->value.integer.value[0]) {
416 session->port_id = be_id;
417 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update);
418 } else {
419 session->port_id = -1;
420 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update);
421 }
422
423 return 1;
424}
425
426static const struct snd_kcontrol_new hdmi_mixer_controls[] = {
427 Q6ROUTING_RX_MIXERS(HDMI_RX) };
428
429static const struct snd_kcontrol_new primary_mi2s_rx_mixer_controls[] = {
430 Q6ROUTING_RX_MIXERS(PRIMARY_MI2S_RX) };
431
432static const struct snd_kcontrol_new secondary_mi2s_rx_mixer_controls[] = {
433 Q6ROUTING_RX_MIXERS(SECONDARY_MI2S_RX) };
434
435static const struct snd_kcontrol_new quaternary_mi2s_rx_mixer_controls[] = {
436 Q6ROUTING_RX_MIXERS(QUATERNARY_MI2S_RX) };
437
438static const struct snd_kcontrol_new tertiary_mi2s_rx_mixer_controls[] = {
439 Q6ROUTING_RX_MIXERS(TERTIARY_MI2S_RX) };
440
441static const struct snd_kcontrol_new slimbus_rx_mixer_controls[] = {
442 Q6ROUTING_RX_MIXERS(SLIMBUS_0_RX) };
443
444static const struct snd_kcontrol_new slimbus_1_rx_mixer_controls[] = {
445 Q6ROUTING_RX_MIXERS(SLIMBUS_1_RX) };
446
447static const struct snd_kcontrol_new slimbus_2_rx_mixer_controls[] = {
448 Q6ROUTING_RX_MIXERS(SLIMBUS_2_RX) };
449
450static const struct snd_kcontrol_new slimbus_3_rx_mixer_controls[] = {
451 Q6ROUTING_RX_MIXERS(SLIMBUS_3_RX) };
452
453static const struct snd_kcontrol_new slimbus_4_rx_mixer_controls[] = {
454 Q6ROUTING_RX_MIXERS(SLIMBUS_4_RX) };
455
456static const struct snd_kcontrol_new slimbus_5_rx_mixer_controls[] = {
457 Q6ROUTING_RX_MIXERS(SLIMBUS_5_RX) };
458
459static const struct snd_kcontrol_new slimbus_6_rx_mixer_controls[] = {
460 Q6ROUTING_RX_MIXERS(SLIMBUS_6_RX) };
461
462static const struct snd_kcontrol_new pri_tdm_rx_0_mixer_controls[] = {
463 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_0) };
464
465static const struct snd_kcontrol_new pri_tdm_rx_1_mixer_controls[] = {
466 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_1) };
467
468static const struct snd_kcontrol_new pri_tdm_rx_2_mixer_controls[] = {
469 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_2) };
470
471static const struct snd_kcontrol_new pri_tdm_rx_3_mixer_controls[] = {
472 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_3) };
473
474static const struct snd_kcontrol_new pri_tdm_rx_4_mixer_controls[] = {
475 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_4) };
476
477static const struct snd_kcontrol_new pri_tdm_rx_5_mixer_controls[] = {
478 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_5) };
479
480static const struct snd_kcontrol_new pri_tdm_rx_6_mixer_controls[] = {
481 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_6) };
482
483static const struct snd_kcontrol_new pri_tdm_rx_7_mixer_controls[] = {
484 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_7) };
485
486static const struct snd_kcontrol_new sec_tdm_rx_0_mixer_controls[] = {
487 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_0) };
488
489static const struct snd_kcontrol_new sec_tdm_rx_1_mixer_controls[] = {
490 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_1) };
491
492static const struct snd_kcontrol_new sec_tdm_rx_2_mixer_controls[] = {
493 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_2) };
494
495static const struct snd_kcontrol_new sec_tdm_rx_3_mixer_controls[] = {
496 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_3) };
497
498static const struct snd_kcontrol_new sec_tdm_rx_4_mixer_controls[] = {
499 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_4) };
500
501static const struct snd_kcontrol_new sec_tdm_rx_5_mixer_controls[] = {
502 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_5) };
503
504static const struct snd_kcontrol_new sec_tdm_rx_6_mixer_controls[] = {
505 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_6) };
506
507static const struct snd_kcontrol_new sec_tdm_rx_7_mixer_controls[] = {
508 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_7) };
509
510static const struct snd_kcontrol_new tert_tdm_rx_0_mixer_controls[] = {
511 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_0) };
512
513static const struct snd_kcontrol_new tert_tdm_rx_1_mixer_controls[] = {
514 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_1) };
515
516static const struct snd_kcontrol_new tert_tdm_rx_2_mixer_controls[] = {
517 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_2) };
518
519static const struct snd_kcontrol_new tert_tdm_rx_3_mixer_controls[] = {
520 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_3) };
521
522static const struct snd_kcontrol_new tert_tdm_rx_4_mixer_controls[] = {
523 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_4) };
524
525static const struct snd_kcontrol_new tert_tdm_rx_5_mixer_controls[] = {
526 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_5) };
527
528static const struct snd_kcontrol_new tert_tdm_rx_6_mixer_controls[] = {
529 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_6) };
530
531static const struct snd_kcontrol_new tert_tdm_rx_7_mixer_controls[] = {
532 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_7) };
533
534static const struct snd_kcontrol_new quat_tdm_rx_0_mixer_controls[] = {
535 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_0) };
536
537static const struct snd_kcontrol_new quat_tdm_rx_1_mixer_controls[] = {
538 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_1) };
539
540static const struct snd_kcontrol_new quat_tdm_rx_2_mixer_controls[] = {
541 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_2) };
542
543static const struct snd_kcontrol_new quat_tdm_rx_3_mixer_controls[] = {
544 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_3) };
545
546static const struct snd_kcontrol_new quat_tdm_rx_4_mixer_controls[] = {
547 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_4) };
548
549static const struct snd_kcontrol_new quat_tdm_rx_5_mixer_controls[] = {
550 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_5) };
551
552static const struct snd_kcontrol_new quat_tdm_rx_6_mixer_controls[] = {
553 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_6) };
554
555static const struct snd_kcontrol_new quat_tdm_rx_7_mixer_controls[] = {
556 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_7) };
557
558static const struct snd_kcontrol_new quin_tdm_rx_0_mixer_controls[] = {
559 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_0) };
560
561static const struct snd_kcontrol_new quin_tdm_rx_1_mixer_controls[] = {
562 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_1) };
563
564static const struct snd_kcontrol_new quin_tdm_rx_2_mixer_controls[] = {
565 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_2) };
566
567static const struct snd_kcontrol_new quin_tdm_rx_3_mixer_controls[] = {
568 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_3) };
569
570static const struct snd_kcontrol_new quin_tdm_rx_4_mixer_controls[] = {
571 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_4) };
572
573static const struct snd_kcontrol_new quin_tdm_rx_5_mixer_controls[] = {
574 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_5) };
575
576static const struct snd_kcontrol_new quin_tdm_rx_6_mixer_controls[] = {
577 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_6) };
578
579static const struct snd_kcontrol_new quin_tdm_rx_7_mixer_controls[] = {
580 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_7) };
581
582
583static const struct snd_kcontrol_new mmul1_mixer_controls[] = {
584 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA1) };
585
586static const struct snd_kcontrol_new mmul2_mixer_controls[] = {
587 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA2) };
588
589static const struct snd_kcontrol_new mmul3_mixer_controls[] = {
590 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA3) };
591
592static const struct snd_kcontrol_new mmul4_mixer_controls[] = {
593 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA4) };
594
595static const struct snd_kcontrol_new mmul5_mixer_controls[] = {
596 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA5) };
597
598static const struct snd_kcontrol_new mmul6_mixer_controls[] = {
599 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA6) };
600
601static const struct snd_kcontrol_new mmul7_mixer_controls[] = {
602 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA7) };
603
604static const struct snd_kcontrol_new mmul8_mixer_controls[] = {
605 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA8) };
606
607static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
608
609 SND_SOC_DAPM_AIF_IN("MM_DL1", "MultiMedia1 Playback", 0, 0, 0, 0),
610 SND_SOC_DAPM_AIF_IN("MM_DL2", "MultiMedia2 Playback", 0, 0, 0, 0),
611 SND_SOC_DAPM_AIF_IN("MM_DL3", "MultiMedia3 Playback", 0, 0, 0, 0),
612 SND_SOC_DAPM_AIF_IN("MM_DL4", "MultiMedia4 Playback", 0, 0, 0, 0),
613 SND_SOC_DAPM_AIF_IN("MM_DL5", "MultiMedia5 Playback", 0, 0, 0, 0),
614 SND_SOC_DAPM_AIF_IN("MM_DL6", "MultiMedia6 Playback", 0, 0, 0, 0),
615 SND_SOC_DAPM_AIF_IN("MM_DL7", "MultiMedia7 Playback", 0, 0, 0, 0),
616 SND_SOC_DAPM_AIF_IN("MM_DL8", "MultiMedia8 Playback", 0, 0, 0, 0),
617 SND_SOC_DAPM_AIF_OUT("MM_UL1", "MultiMedia1 Capture", 0, 0, 0, 0),
618 SND_SOC_DAPM_AIF_OUT("MM_UL2", "MultiMedia2 Capture", 0, 0, 0, 0),
619 SND_SOC_DAPM_AIF_OUT("MM_UL3", "MultiMedia3 Capture", 0, 0, 0, 0),
620 SND_SOC_DAPM_AIF_OUT("MM_UL4", "MultiMedia4 Capture", 0, 0, 0, 0),
621 SND_SOC_DAPM_AIF_OUT("MM_UL5", "MultiMedia5 Capture", 0, 0, 0, 0),
622 SND_SOC_DAPM_AIF_OUT("MM_UL6", "MultiMedia6 Capture", 0, 0, 0, 0),
623 SND_SOC_DAPM_AIF_OUT("MM_UL7", "MultiMedia7 Capture", 0, 0, 0, 0),
624 SND_SOC_DAPM_AIF_OUT("MM_UL8", "MultiMedia8 Capture", 0, 0, 0, 0),
625
626
627 SND_SOC_DAPM_MIXER("HDMI Mixer", SND_SOC_NOPM, 0, 0,
628 hdmi_mixer_controls,
629 ARRAY_SIZE(hdmi_mixer_controls)),
630
631 SND_SOC_DAPM_MIXER("SLIMBUS_0_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
632 slimbus_rx_mixer_controls,
633 ARRAY_SIZE(slimbus_rx_mixer_controls)),
634 SND_SOC_DAPM_MIXER("SLIMBUS_1_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
635 slimbus_1_rx_mixer_controls,
636 ARRAY_SIZE(slimbus_1_rx_mixer_controls)),
637 SND_SOC_DAPM_MIXER("SLIMBUS_2_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
638 slimbus_2_rx_mixer_controls,
639 ARRAY_SIZE(slimbus_2_rx_mixer_controls)),
640 SND_SOC_DAPM_MIXER("SLIMBUS_3_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
641 slimbus_3_rx_mixer_controls,
642 ARRAY_SIZE(slimbus_3_rx_mixer_controls)),
643 SND_SOC_DAPM_MIXER("SLIMBUS_4_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
644 slimbus_4_rx_mixer_controls,
645 ARRAY_SIZE(slimbus_4_rx_mixer_controls)),
646 SND_SOC_DAPM_MIXER("SLIMBUS_5_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
647 slimbus_5_rx_mixer_controls,
648 ARRAY_SIZE(slimbus_5_rx_mixer_controls)),
649 SND_SOC_DAPM_MIXER("SLIMBUS_6_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
650 slimbus_6_rx_mixer_controls,
651 ARRAY_SIZE(slimbus_6_rx_mixer_controls)),
652 SND_SOC_DAPM_MIXER("PRI_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
653 primary_mi2s_rx_mixer_controls,
654 ARRAY_SIZE(primary_mi2s_rx_mixer_controls)),
655 SND_SOC_DAPM_MIXER("SEC_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
656 secondary_mi2s_rx_mixer_controls,
657 ARRAY_SIZE(secondary_mi2s_rx_mixer_controls)),
658 SND_SOC_DAPM_MIXER("QUAT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
659 quaternary_mi2s_rx_mixer_controls,
660 ARRAY_SIZE(quaternary_mi2s_rx_mixer_controls)),
661 SND_SOC_DAPM_MIXER("TERT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
662 tertiary_mi2s_rx_mixer_controls,
663 ARRAY_SIZE(tertiary_mi2s_rx_mixer_controls)),
664 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0,
665 pri_tdm_rx_0_mixer_controls,
666 ARRAY_SIZE(pri_tdm_rx_0_mixer_controls)),
667 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0,
668 pri_tdm_rx_1_mixer_controls,
669 ARRAY_SIZE(pri_tdm_rx_1_mixer_controls)),
670 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0,
671 pri_tdm_rx_2_mixer_controls,
672 ARRAY_SIZE(pri_tdm_rx_2_mixer_controls)),
673 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0,
674 pri_tdm_rx_3_mixer_controls,
675 ARRAY_SIZE(pri_tdm_rx_3_mixer_controls)),
676 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0,
677 pri_tdm_rx_4_mixer_controls,
678 ARRAY_SIZE(pri_tdm_rx_4_mixer_controls)),
679 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0,
680 pri_tdm_rx_5_mixer_controls,
681 ARRAY_SIZE(pri_tdm_rx_5_mixer_controls)),
682 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0,
683 pri_tdm_rx_6_mixer_controls,
684 ARRAY_SIZE(pri_tdm_rx_6_mixer_controls)),
685 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
686 pri_tdm_rx_7_mixer_controls,
687 ARRAY_SIZE(pri_tdm_rx_7_mixer_controls)),
688
689 SND_SOC_DAPM_MIXER("SEC_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0,
690 sec_tdm_rx_0_mixer_controls,
691 ARRAY_SIZE(sec_tdm_rx_0_mixer_controls)),
692 SND_SOC_DAPM_MIXER("SEC_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0,
693 sec_tdm_rx_1_mixer_controls,
694 ARRAY_SIZE(sec_tdm_rx_1_mixer_controls)),
695 SND_SOC_DAPM_MIXER("SEC_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0,
696 sec_tdm_rx_2_mixer_controls,
697 ARRAY_SIZE(sec_tdm_rx_2_mixer_controls)),
698 SND_SOC_DAPM_MIXER("SEC_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0,
699 sec_tdm_rx_3_mixer_controls,
700 ARRAY_SIZE(sec_tdm_rx_3_mixer_controls)),
701 SND_SOC_DAPM_MIXER("SEC_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0,
702 sec_tdm_rx_4_mixer_controls,
703 ARRAY_SIZE(sec_tdm_rx_4_mixer_controls)),
704 SND_SOC_DAPM_MIXER("SEC_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0,
705 sec_tdm_rx_5_mixer_controls,
706 ARRAY_SIZE(sec_tdm_rx_5_mixer_controls)),
707 SND_SOC_DAPM_MIXER("SEC_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0,
708 sec_tdm_rx_6_mixer_controls,
709 ARRAY_SIZE(sec_tdm_rx_6_mixer_controls)),
710 SND_SOC_DAPM_MIXER("SEC_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
711 sec_tdm_rx_7_mixer_controls,
712 ARRAY_SIZE(sec_tdm_rx_7_mixer_controls)),
713
714 SND_SOC_DAPM_MIXER("TERT_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0,
715 tert_tdm_rx_0_mixer_controls,
716 ARRAY_SIZE(tert_tdm_rx_0_mixer_controls)),
717 SND_SOC_DAPM_MIXER("TERT_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0,
718 tert_tdm_rx_1_mixer_controls,
719 ARRAY_SIZE(tert_tdm_rx_1_mixer_controls)),
720 SND_SOC_DAPM_MIXER("TERT_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0,
721 tert_tdm_rx_2_mixer_controls,
722 ARRAY_SIZE(tert_tdm_rx_2_mixer_controls)),
723 SND_SOC_DAPM_MIXER("TERT_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0,
724 tert_tdm_rx_3_mixer_controls,
725 ARRAY_SIZE(tert_tdm_rx_3_mixer_controls)),
726 SND_SOC_DAPM_MIXER("TERT_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0,
727 tert_tdm_rx_4_mixer_controls,
728 ARRAY_SIZE(tert_tdm_rx_4_mixer_controls)),
729 SND_SOC_DAPM_MIXER("TERT_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0,
730 tert_tdm_rx_5_mixer_controls,
731 ARRAY_SIZE(tert_tdm_rx_5_mixer_controls)),
732 SND_SOC_DAPM_MIXER("TERT_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0,
733 tert_tdm_rx_6_mixer_controls,
734 ARRAY_SIZE(tert_tdm_rx_6_mixer_controls)),
735 SND_SOC_DAPM_MIXER("TERT_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
736 tert_tdm_rx_7_mixer_controls,
737 ARRAY_SIZE(tert_tdm_rx_7_mixer_controls)),
738
739 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0,
740 quat_tdm_rx_0_mixer_controls,
741 ARRAY_SIZE(quat_tdm_rx_0_mixer_controls)),
742 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0,
743 quat_tdm_rx_1_mixer_controls,
744 ARRAY_SIZE(quat_tdm_rx_1_mixer_controls)),
745 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0,
746 quat_tdm_rx_2_mixer_controls,
747 ARRAY_SIZE(quat_tdm_rx_2_mixer_controls)),
748 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0,
749 quat_tdm_rx_3_mixer_controls,
750 ARRAY_SIZE(quat_tdm_rx_3_mixer_controls)),
751 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0,
752 quat_tdm_rx_4_mixer_controls,
753 ARRAY_SIZE(quat_tdm_rx_4_mixer_controls)),
754 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0,
755 quat_tdm_rx_5_mixer_controls,
756 ARRAY_SIZE(quat_tdm_rx_5_mixer_controls)),
757 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0,
758 quat_tdm_rx_6_mixer_controls,
759 ARRAY_SIZE(quat_tdm_rx_6_mixer_controls)),
760 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
761 quat_tdm_rx_7_mixer_controls,
762 ARRAY_SIZE(quat_tdm_rx_7_mixer_controls)),
763
764 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0,
765 quin_tdm_rx_0_mixer_controls,
766 ARRAY_SIZE(quin_tdm_rx_0_mixer_controls)),
767 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0,
768 quin_tdm_rx_1_mixer_controls,
769 ARRAY_SIZE(quin_tdm_rx_1_mixer_controls)),
770 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0,
771 quin_tdm_rx_2_mixer_controls,
772 ARRAY_SIZE(quin_tdm_rx_2_mixer_controls)),
773 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0,
774 quin_tdm_rx_3_mixer_controls,
775 ARRAY_SIZE(quin_tdm_rx_3_mixer_controls)),
776 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0,
777 quin_tdm_rx_4_mixer_controls,
778 ARRAY_SIZE(quin_tdm_rx_4_mixer_controls)),
779 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0,
780 quin_tdm_rx_5_mixer_controls,
781 ARRAY_SIZE(quin_tdm_rx_5_mixer_controls)),
782 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0,
783 quin_tdm_rx_6_mixer_controls,
784 ARRAY_SIZE(quin_tdm_rx_6_mixer_controls)),
785 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
786 quin_tdm_rx_7_mixer_controls,
787 ARRAY_SIZE(quin_tdm_rx_7_mixer_controls)),
788 SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0,
789 mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)),
790 SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0,
791 mmul2_mixer_controls, ARRAY_SIZE(mmul2_mixer_controls)),
792 SND_SOC_DAPM_MIXER("MultiMedia3 Mixer", SND_SOC_NOPM, 0, 0,
793 mmul3_mixer_controls, ARRAY_SIZE(mmul3_mixer_controls)),
794 SND_SOC_DAPM_MIXER("MultiMedia4 Mixer", SND_SOC_NOPM, 0, 0,
795 mmul4_mixer_controls, ARRAY_SIZE(mmul4_mixer_controls)),
796 SND_SOC_DAPM_MIXER("MultiMedia5 Mixer", SND_SOC_NOPM, 0, 0,
797 mmul5_mixer_controls, ARRAY_SIZE(mmul5_mixer_controls)),
798 SND_SOC_DAPM_MIXER("MultiMedia6 Mixer", SND_SOC_NOPM, 0, 0,
799 mmul6_mixer_controls, ARRAY_SIZE(mmul6_mixer_controls)),
800 SND_SOC_DAPM_MIXER("MultiMedia7 Mixer", SND_SOC_NOPM, 0, 0,
801 mmul7_mixer_controls, ARRAY_SIZE(mmul7_mixer_controls)),
802 SND_SOC_DAPM_MIXER("MultiMedia8 Mixer", SND_SOC_NOPM, 0, 0,
803 mmul8_mixer_controls, ARRAY_SIZE(mmul8_mixer_controls)),
804
805};
806
807static const struct snd_soc_dapm_route intercon[] = {
808 Q6ROUTING_RX_DAPM_ROUTE("HDMI Mixer", "HDMI_RX"),
809 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_0_RX Audio Mixer", "SLIMBUS_0_RX"),
810 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_1_RX Audio Mixer", "SLIMBUS_1_RX"),
811 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_2_RX Audio Mixer", "SLIMBUS_2_RX"),
812 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_3_RX Audio Mixer", "SLIMBUS_3_RX"),
813 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_4_RX Audio Mixer", "SLIMBUS_4_RX"),
814 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_5_RX Audio Mixer", "SLIMBUS_5_RX"),
815 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_6_RX Audio Mixer", "SLIMBUS_6_RX"),
816 Q6ROUTING_RX_DAPM_ROUTE("QUAT_MI2S_RX Audio Mixer", "QUAT_MI2S_RX"),
817 Q6ROUTING_RX_DAPM_ROUTE("TERT_MI2S_RX Audio Mixer", "TERT_MI2S_RX"),
818 Q6ROUTING_RX_DAPM_ROUTE("SEC_MI2S_RX Audio Mixer", "SEC_MI2S_RX"),
819 Q6ROUTING_RX_DAPM_ROUTE("PRI_MI2S_RX Audio Mixer", "PRI_MI2S_RX"),
820 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_0 Audio Mixer",
821 "PRIMARY_TDM_RX_0"),
822 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_1 Audio Mixer",
823 "PRIMARY_TDM_RX_1"),
824 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_2 Audio Mixer",
825 "PRIMARY_TDM_RX_2"),
826 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_3 Audio Mixer",
827 "PRIMARY_TDM_RX_3"),
828 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_4 Audio Mixer",
829 "PRIMARY_TDM_RX_4"),
830 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_5 Audio Mixer",
831 "PRIMARY_TDM_RX_5"),
832 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_6 Audio Mixer",
833 "PRIMARY_TDM_RX_6"),
834 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_7 Audio Mixer",
835 "PRIMARY_TDM_RX_7"),
836 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_0 Audio Mixer", "SEC_TDM_RX_0"),
837 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_1 Audio Mixer", "SEC_TDM_RX_1"),
838 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_2 Audio Mixer", "SEC_TDM_RX_2"),
839 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_3 Audio Mixer", "SEC_TDM_RX_3"),
840 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_4 Audio Mixer", "SEC_TDM_RX_4"),
841 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_5 Audio Mixer", "SEC_TDM_RX_5"),
842 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_6 Audio Mixer", "SEC_TDM_RX_6"),
843 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_7 Audio Mixer", "SEC_TDM_RX_7"),
844 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_0 Audio Mixer", "TERT_TDM_RX_0"),
845 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_1 Audio Mixer", "TERT_TDM_RX_1"),
846 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_2 Audio Mixer", "TERT_TDM_RX_2"),
847 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_3 Audio Mixer", "TERT_TDM_RX_3"),
848 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_4 Audio Mixer", "TERT_TDM_RX_4"),
849 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_5 Audio Mixer", "TERT_TDM_RX_5"),
850 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_6 Audio Mixer", "TERT_TDM_RX_6"),
851 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_7 Audio Mixer", "TERT_TDM_RX_7"),
852 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_0 Audio Mixer", "QUAT_TDM_RX_0"),
853 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_1 Audio Mixer", "QUAT_TDM_RX_1"),
854 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_2 Audio Mixer", "QUAT_TDM_RX_2"),
855 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_3 Audio Mixer", "QUAT_TDM_RX_3"),
856 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_4 Audio Mixer", "QUAT_TDM_RX_4"),
857 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_5 Audio Mixer", "QUAT_TDM_RX_5"),
858 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_6 Audio Mixer", "QUAT_TDM_RX_6"),
859 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_7 Audio Mixer", "QUAT_TDM_RX_7"),
860 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_0 Audio Mixer", "QUIN_TDM_RX_0"),
861 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_1 Audio Mixer", "QUIN_TDM_RX_1"),
862 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_2 Audio Mixer", "QUIN_TDM_RX_2"),
863 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_3 Audio Mixer", "QUIN_TDM_RX_3"),
864 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_4 Audio Mixer", "QUIN_TDM_RX_4"),
865 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_5 Audio Mixer", "QUIN_TDM_RX_5"),
866 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_6 Audio Mixer", "QUIN_TDM_RX_6"),
867 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_7 Audio Mixer", "QUIN_TDM_RX_7"),
868 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia1 Mixer"),
869 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia2 Mixer"),
870 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia3 Mixer"),
871 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia4 Mixer"),
872 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia5 Mixer"),
873 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia6 Mixer"),
874 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia7 Mixer"),
875 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia8 Mixer"),
876
877 {"MM_UL1", NULL, "MultiMedia1 Mixer"},
878 {"MM_UL2", NULL, "MultiMedia2 Mixer"},
879 {"MM_UL3", NULL, "MultiMedia3 Mixer"},
880 {"MM_UL4", NULL, "MultiMedia4 Mixer"},
881 {"MM_UL5", NULL, "MultiMedia5 Mixer"},
882 {"MM_UL6", NULL, "MultiMedia6 Mixer"},
883 {"MM_UL7", NULL, "MultiMedia7 Mixer"},
884 {"MM_UL8", NULL, "MultiMedia8 Mixer"},
885};
886
887static int routing_hw_params(struct snd_pcm_substream *substream,
888 struct snd_pcm_hw_params *params)
889{
890 struct snd_soc_pcm_runtime *rtd = substream->private_data;
891 struct snd_soc_component *c = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
892 struct msm_routing_data *data = dev_get_drvdata(c->dev);
893 unsigned int be_id = rtd->cpu_dai->id;
894 struct session_data *session;
895 int path_type;
896
897 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
898 path_type = ADM_PATH_PLAYBACK;
899 else
900 path_type = ADM_PATH_LIVE_REC;
901
902 if (be_id > AFE_MAX_PORTS)
903 return -EINVAL;
904
905 session = &data->port_data[be_id];
906
907 mutex_lock(&data->lock);
908
909 session->path_type = path_type;
910 session->sample_rate = params_rate(params);
911 session->channels = params_channels(params);
912
913 switch (params_format(params)) {
914 case SNDRV_PCM_FORMAT_S16_LE:
915 session->bits_per_sample = 16;
916 break;
917 case SNDRV_PCM_FORMAT_S24_LE:
918 session->bits_per_sample = 24;
919 break;
920 default:
921 break;
922 }
923
924 mutex_unlock(&data->lock);
925 return 0;
926}
927
928static struct snd_pcm_ops q6pcm_routing_ops = {
929 .hw_params = routing_hw_params,
930};
931
932static int msm_routing_probe(struct snd_soc_component *c)
933{
934 int i;
935
936 for (i = 0; i < MAX_SESSIONS; i++)
937 routing_data->sessions[i].port_id = -1;
938
939 return 0;
940}
941
942static const struct snd_soc_component_driver msm_soc_routing_component = {
943 .ops = &q6pcm_routing_ops,
944 .probe = msm_routing_probe,
945 .name = DRV_NAME,
946 .dapm_widgets = msm_qdsp6_widgets,
947 .num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets),
948 .dapm_routes = intercon,
949 .num_dapm_routes = ARRAY_SIZE(intercon),
950};
951
952static int q6routing_dai_bind(struct device *dev, struct device *master,
953 void *data)
954{
955 routing_data = kzalloc(sizeof(*routing_data), GFP_KERNEL);
956 if (!routing_data)
957 return -ENOMEM;
958
959 routing_data->dev = dev;
960
961 mutex_init(&routing_data->lock);
962 dev_set_drvdata(dev, routing_data);
963
964 return snd_soc_register_component(dev, &msm_soc_routing_component,
965 NULL, 0);
966}
967
968static void q6routing_dai_unbind(struct device *dev, struct device *master,
969 void *d)
970{
971 struct msm_routing_data *data = dev_get_drvdata(dev);
972
973 snd_soc_unregister_component(dev);
974
975 kfree(data);
976
977 routing_data = NULL;
978}
979
980static const struct component_ops q6routing_dai_comp_ops = {
981 .bind = q6routing_dai_bind,
982 .unbind = q6routing_dai_unbind,
983};
984
985static int q6pcm_routing_probe(struct platform_device *pdev)
986{
987 return component_add(&pdev->dev, &q6routing_dai_comp_ops);
988}
989
990static int q6pcm_routing_remove(struct platform_device *pdev)
991{
992 component_del(&pdev->dev, &q6routing_dai_comp_ops);
993 return 0;
994}
995
996static struct platform_driver q6pcm_routing_platform_driver = {
997 .driver = {
998 .name = "q6routing",
999 },
1000 .probe = q6pcm_routing_probe,
1001 .remove = q6pcm_routing_remove,
1002};
1003module_platform_driver(q6pcm_routing_platform_driver);
1004
1005MODULE_DESCRIPTION("Q6 Routing platform");
1006MODULE_LICENSE("GPL v2");
1007