blob: b15d4c461b75ab760a3fbc7bbfc9ab114c3f89e1 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/platform_device.h>
14#include <linux/debugfs.h>
15#include <linux/mfd/msm-adie-codec.h>
16#include <linux/uaccess.h>
17#include <mach/qdsp5v2/snddev_icodec.h>
18#include <mach/qdsp5v2/marimba_profile.h>
19#include <mach/qdsp5v2/aux_pcm.h>
20#include <mach/qdsp5v2/snddev_ecodec.h>
21#include <mach/qdsp5v2/audio_dev_ctl.h>
22#include <mach/qdsp5v2/snddev_virtual.h>
23#include <mach/board.h>
24#include <asm/mach-types.h>
25#include <mach/gpio.h>
26#include <mach/qdsp5v2/snddev_mi2s.h>
27#include <mach/qdsp5v2/mi2s.h>
28#include <mach/qdsp5v2/audio_acdb_def.h>
29
30/* define the value for BT_SCO */
31#define BT_SCO_PCM_CTL_VAL (PCM_CTL__RPCM_WIDTH__LINEAR_V |\
32 PCM_CTL__TPCM_WIDTH__LINEAR_V)
33#define BT_SCO_DATA_FORMAT_PADDING (DATA_FORMAT_PADDING_INFO__RPCM_FORMAT_V |\
34 DATA_FORMAT_PADDING_INFO__TPCM_FORMAT_V)
35#define BT_SCO_AUX_CODEC_INTF AUX_CODEC_INTF_CTL__PCMINTF_DATA_EN_V
36
37#ifdef CONFIG_DEBUG_FS
38static struct dentry *debugfs_hsed_config;
39static void snddev_hsed_config_modify_setting(int type);
40static void snddev_hsed_config_restore_setting(void);
41#endif
42
43static struct adie_codec_action_unit iearpiece_48KHz_osr256_actions[] =
44 HANDSET_RX_48000_OSR_256;
45
46static struct adie_codec_hwsetting_entry iearpiece_settings[] = {
47 {
48 .freq_plan = 48000,
49 .osr = 256,
50 .actions = iearpiece_48KHz_osr256_actions,
51 .action_sz = ARRAY_SIZE(iearpiece_48KHz_osr256_actions),
52 }
53};
54
55static struct adie_codec_dev_profile iearpiece_profile = {
56 .path_type = ADIE_CODEC_RX,
57 .settings = iearpiece_settings,
58 .setting_sz = ARRAY_SIZE(iearpiece_settings),
59};
60
61static struct snddev_icodec_data snddev_iearpiece_data = {
62 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
63 .name = "handset_rx",
64 .copp_id = 0,
65 .acdb_id = ACDB_ID_HANDSET_SPKR,
66 .profile = &iearpiece_profile,
67 .channel_mode = 1,
68 .pmctl_id = NULL,
69 .pmctl_id_sz = 0,
70 .default_sample_rate = 48000,
71 .pamp_on = NULL,
72 .pamp_off = NULL,
73 .property = SIDE_TONE_MASK,
74 .max_voice_rx_vol[VOC_NB_INDEX] = -200,
75 .min_voice_rx_vol[VOC_NB_INDEX] = -1700,
76 .max_voice_rx_vol[VOC_WB_INDEX] = -200,
77 .min_voice_rx_vol[VOC_WB_INDEX] = -1700
78};
79
80static struct platform_device msm_iearpiece_device = {
81 .name = "snddev_icodec",
82 .id = 0,
83 .dev = { .platform_data = &snddev_iearpiece_data },
84};
85
86static struct adie_codec_action_unit imic_8KHz_osr256_actions[] =
87 HANDSET_TX_8000_OSR_256;
88
89static struct adie_codec_action_unit imic_16KHz_osr256_actions[] =
90 HANDSET_TX_16000_OSR_256;
91
92static struct adie_codec_action_unit imic_48KHz_osr256_actions[] =
93 HANDSET_TX_48000_OSR_256;
94
95static struct adie_codec_hwsetting_entry imic_settings[] = {
96 {
97 .freq_plan = 8000,
98 .osr = 256,
99 .actions = imic_8KHz_osr256_actions,
100 .action_sz = ARRAY_SIZE(imic_8KHz_osr256_actions),
101 },
102 {
103 .freq_plan = 16000,
104 .osr = 256,
105 .actions = imic_16KHz_osr256_actions,
106 .action_sz = ARRAY_SIZE(imic_16KHz_osr256_actions),
107 },
108 {
109 .freq_plan = 48000,
110 .osr = 256,
111 .actions = imic_48KHz_osr256_actions,
112 .action_sz = ARRAY_SIZE(imic_48KHz_osr256_actions),
113 }
114};
115
116static struct adie_codec_dev_profile imic_profile = {
117 .path_type = ADIE_CODEC_TX,
118 .settings = imic_settings,
119 .setting_sz = ARRAY_SIZE(imic_settings),
120};
121
122static enum hsed_controller imic_pmctl_id[] = {PM_HSED_CONTROLLER_0};
123
124static struct snddev_icodec_data snddev_imic_data = {
125 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
126 .name = "handset_tx",
127 .copp_id = 0,
128 .acdb_id = ACDB_ID_HANDSET_MIC,
129 .profile = &imic_profile,
130 .channel_mode = 1,
131 .pmctl_id = imic_pmctl_id,
132 .pmctl_id_sz = ARRAY_SIZE(imic_pmctl_id),
133 .default_sample_rate = 48000,
134 .pamp_on = NULL,
135 .pamp_off = NULL,
136};
137
138static struct platform_device msm_imic_device = {
139 .name = "snddev_icodec",
140 .id = 1,
141 .dev = { .platform_data = &snddev_imic_data },
142};
143
144static struct adie_codec_action_unit ihs_stereo_rx_48KHz_osr256_actions[] =
145 HEADSET_STEREO_RX_LEGACY_48000_OSR_256;
146
147static struct adie_codec_hwsetting_entry ihs_stereo_rx_settings[] = {
148 {
149 .freq_plan = 48000,
150 .osr = 256,
151 .actions = ihs_stereo_rx_48KHz_osr256_actions,
152 .action_sz = ARRAY_SIZE(ihs_stereo_rx_48KHz_osr256_actions),
153 }
154};
155
156static struct adie_codec_dev_profile ihs_stereo_rx_profile = {
157 .path_type = ADIE_CODEC_RX,
158 .settings = ihs_stereo_rx_settings,
159 .setting_sz = ARRAY_SIZE(ihs_stereo_rx_settings),
160};
161
162static struct snddev_icodec_data snddev_ihs_stereo_rx_data = {
163 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
164 .name = "headset_stereo_rx",
165 .copp_id = 0,
166 .acdb_id = ACDB_ID_HEADSET_SPKR_STEREO,
167 .profile = &ihs_stereo_rx_profile,
168 .channel_mode = 2,
169 .default_sample_rate = 48000,
170 .pamp_on = NULL,
171 .pamp_off = NULL,
172 .property = SIDE_TONE_MASK,
173 .max_voice_rx_vol[VOC_NB_INDEX] = -700,
174 .min_voice_rx_vol[VOC_NB_INDEX] = -2200,
175 .max_voice_rx_vol[VOC_WB_INDEX] = -900,
176 .min_voice_rx_vol[VOC_WB_INDEX] = -2400
177};
178
179static struct platform_device msm_ihs_stereo_rx_device = {
180 .name = "snddev_icodec",
181 .id = 2,
182 .dev = { .platform_data = &snddev_ihs_stereo_rx_data },
183};
184
185static struct adie_codec_action_unit ihs_mono_rx_48KHz_osr256_actions[] =
186 HEADSET_RX_LEGACY_48000_OSR_256;
187
188static struct adie_codec_hwsetting_entry ihs_mono_rx_settings[] = {
189 {
190 .freq_plan = 48000,
191 .osr = 256,
192 .actions = ihs_mono_rx_48KHz_osr256_actions,
193 .action_sz = ARRAY_SIZE(ihs_mono_rx_48KHz_osr256_actions),
194 }
195};
196
197static struct adie_codec_dev_profile ihs_mono_rx_profile = {
198 .path_type = ADIE_CODEC_RX,
199 .settings = ihs_mono_rx_settings,
200 .setting_sz = ARRAY_SIZE(ihs_mono_rx_settings),
201};
202
203static struct snddev_icodec_data snddev_ihs_mono_rx_data = {
204 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
205 .name = "headset_mono_rx",
206 .copp_id = 0,
207 .acdb_id = ACDB_ID_HEADSET_SPKR_MONO,
208 .profile = &ihs_mono_rx_profile,
209 .channel_mode = 1,
210 .default_sample_rate = 48000,
211 .pamp_on = NULL,
212 .pamp_off = NULL,
213 .property = SIDE_TONE_MASK,
214 .max_voice_rx_vol[VOC_NB_INDEX] = -700,
215 .min_voice_rx_vol[VOC_NB_INDEX] = -2200,
216 .max_voice_rx_vol[VOC_WB_INDEX] = -900,
217 .min_voice_rx_vol[VOC_WB_INDEX] = -2400,
218
219};
220
221static struct platform_device msm_ihs_mono_rx_device = {
222 .name = "snddev_icodec",
223 .id = 3,
224 .dev = { .platform_data = &snddev_ihs_mono_rx_data },
225};
226
227static struct adie_codec_action_unit ihs_ffa_stereo_rx_48KHz_osr256_actions[] =
228 HEADSET_STEREO_RX_CAPLESS_48000_OSR_256;
229
230static struct adie_codec_hwsetting_entry ihs_ffa_stereo_rx_settings[] = {
231 {
232 .freq_plan = 48000,
233 .osr = 256,
234 .actions = ihs_ffa_stereo_rx_48KHz_osr256_actions,
235 .action_sz = ARRAY_SIZE(ihs_ffa_stereo_rx_48KHz_osr256_actions),
236 }
237};
238
239#ifdef CONFIG_DEBUG_FS
240static struct adie_codec_action_unit
241 ihs_ffa_stereo_rx_class_d_legacy_48KHz_osr256_actions[] =
242 HEADSET_STEREO_RX_CLASS_D_LEGACY_48000_OSR_256;
243
244static struct adie_codec_hwsetting_entry
245 ihs_ffa_stereo_rx_class_d_legacy_settings[] = {
246 {
247 .freq_plan = 48000,
248 .osr = 256,
249 .actions =
250 ihs_ffa_stereo_rx_class_d_legacy_48KHz_osr256_actions,
251 .action_sz = ARRAY_SIZE
252 (ihs_ffa_stereo_rx_class_d_legacy_48KHz_osr256_actions),
253 }
254};
255
256static struct adie_codec_action_unit
257 ihs_ffa_stereo_rx_class_ab_legacy_48KHz_osr256_actions[] =
258 HEADSET_STEREO_RX_LEGACY_48000_OSR_256;
259
260static struct adie_codec_hwsetting_entry
261 ihs_ffa_stereo_rx_class_ab_legacy_settings[] = {
262 {
263 .freq_plan = 48000,
264 .osr = 256,
265 .actions =
266 ihs_ffa_stereo_rx_class_ab_legacy_48KHz_osr256_actions,
267 .action_sz = ARRAY_SIZE
268 (ihs_ffa_stereo_rx_class_ab_legacy_48KHz_osr256_actions),
269 }
270};
271#endif
272
273static struct adie_codec_dev_profile ihs_ffa_stereo_rx_profile = {
274 .path_type = ADIE_CODEC_RX,
275 .settings = ihs_ffa_stereo_rx_settings,
276 .setting_sz = ARRAY_SIZE(ihs_ffa_stereo_rx_settings),
277};
278
279static struct snddev_icodec_data snddev_ihs_ffa_stereo_rx_data = {
280 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
281 .name = "headset_stereo_rx",
282 .copp_id = 0,
283 .acdb_id = ACDB_ID_HEADSET_SPKR_STEREO,
284 .profile = &ihs_ffa_stereo_rx_profile,
285 .channel_mode = 2,
286 .default_sample_rate = 48000,
287 .voltage_on = msm_snddev_hsed_voltage_on,
288 .voltage_off = msm_snddev_hsed_voltage_off,
289 .max_voice_rx_vol[VOC_NB_INDEX] = -700,
290 .min_voice_rx_vol[VOC_NB_INDEX] = -2200,
291 .max_voice_rx_vol[VOC_WB_INDEX] = -900,
292 .min_voice_rx_vol[VOC_WB_INDEX] = -2400,
293};
294
295static struct platform_device msm_ihs_ffa_stereo_rx_device = {
296 .name = "snddev_icodec",
297 .id = 4,
298 .dev = { .platform_data = &snddev_ihs_ffa_stereo_rx_data },
299};
300
301static struct adie_codec_action_unit ihs_ffa_mono_rx_48KHz_osr256_actions[] =
302 HEADSET_RX_CAPLESS_48000_OSR_256;
303
304static struct adie_codec_hwsetting_entry ihs_ffa_mono_rx_settings[] = {
305 {
306 .freq_plan = 48000,
307 .osr = 256,
308 .actions = ihs_ffa_mono_rx_48KHz_osr256_actions,
309 .action_sz = ARRAY_SIZE(ihs_ffa_mono_rx_48KHz_osr256_actions),
310 }
311};
312
313static struct adie_codec_dev_profile ihs_ffa_mono_rx_profile = {
314 .path_type = ADIE_CODEC_RX,
315 .settings = ihs_ffa_mono_rx_settings,
316 .setting_sz = ARRAY_SIZE(ihs_ffa_mono_rx_settings),
317};
318
319static struct snddev_icodec_data snddev_ihs_ffa_mono_rx_data = {
320 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
321 .name = "headset_mono_rx",
322 .copp_id = 0,
323 .acdb_id = ACDB_ID_HEADSET_SPKR_MONO,
324 .profile = &ihs_ffa_mono_rx_profile,
325 .channel_mode = 1,
326 .default_sample_rate = 48000,
327 .pamp_on = msm_snddev_hsed_voltage_on,
328 .pamp_off = msm_snddev_hsed_voltage_off,
329 .max_voice_rx_vol[VOC_NB_INDEX] = -700,
330 .min_voice_rx_vol[VOC_NB_INDEX] = -2200,
331 .max_voice_rx_vol[VOC_WB_INDEX] = -900,
332 .min_voice_rx_vol[VOC_WB_INDEX] = -2400,
333};
334
335static struct platform_device msm_ihs_ffa_mono_rx_device = {
336 .name = "snddev_icodec",
337 .id = 5,
338 .dev = { .platform_data = &snddev_ihs_ffa_mono_rx_data },
339};
340
341static struct adie_codec_action_unit ihs_mono_tx_8KHz_osr256_actions[] =
342 HEADSET_MONO_TX_8000_OSR_256;
343
344static struct adie_codec_action_unit ihs_mono_tx_16KHz_osr256_actions[] =
345 HEADSET_MONO_TX_16000_OSR_256;
346
347static struct adie_codec_action_unit ihs_mono_tx_48KHz_osr256_actions[] =
348 HEADSET_MONO_TX_48000_OSR_256;
349
350static struct adie_codec_hwsetting_entry ihs_mono_tx_settings[] = {
351 {
352 .freq_plan = 8000,
353 .osr = 256,
354 .actions = ihs_mono_tx_8KHz_osr256_actions,
355 .action_sz = ARRAY_SIZE(ihs_mono_tx_8KHz_osr256_actions),
356 },
357 {
358 .freq_plan = 16000,
359 .osr = 256,
360 .actions = ihs_mono_tx_16KHz_osr256_actions,
361 .action_sz = ARRAY_SIZE(ihs_mono_tx_16KHz_osr256_actions),
362 },
363 {
364 .freq_plan = 48000,
365 .osr = 256,
366 .actions = ihs_mono_tx_48KHz_osr256_actions,
367 .action_sz = ARRAY_SIZE(ihs_mono_tx_48KHz_osr256_actions),
368 }
369};
370
371static struct adie_codec_dev_profile ihs_mono_tx_profile = {
372 .path_type = ADIE_CODEC_TX,
373 .settings = ihs_mono_tx_settings,
374 .setting_sz = ARRAY_SIZE(ihs_mono_tx_settings),
375};
376
377static struct snddev_icodec_data snddev_ihs_mono_tx_data = {
378 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
379 .name = "headset_mono_tx",
380 .copp_id = 0,
381 .acdb_id = ACDB_ID_HEADSET_MIC,
382 .profile = &ihs_mono_tx_profile,
383 .channel_mode = 1,
384 .pmctl_id = NULL,
385 .pmctl_id_sz = 0,
386 .default_sample_rate = 48000,
387 .pamp_on = msm_snddev_tx_route_config,
388 .pamp_off = msm_snddev_tx_route_deconfig,
389};
390
391static struct platform_device msm_ihs_mono_tx_device = {
392 .name = "snddev_icodec",
393 .id = 6,
394 .dev = { .platform_data = &snddev_ihs_mono_tx_data },
395};
396
397static struct adie_codec_action_unit ifmradio_handset_osr64_actions[] =
398 FM_HANDSET_OSR_64;
399
400static struct adie_codec_hwsetting_entry ifmradio_handset_settings[] = {
401 {
402 .freq_plan = 8000,
403 .osr = 256,
404 .actions = ifmradio_handset_osr64_actions,
405 .action_sz = ARRAY_SIZE(ifmradio_handset_osr64_actions),
406 }
407};
408
409static struct adie_codec_dev_profile ifmradio_handset_profile = {
410 .path_type = ADIE_CODEC_RX,
411 .settings = ifmradio_handset_settings,
412 .setting_sz = ARRAY_SIZE(ifmradio_handset_settings),
413};
414
415static struct snddev_icodec_data snddev_ifmradio_handset_data = {
416 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_FM),
417 .name = "fmradio_handset_rx",
418 .copp_id = 0,
419 .acdb_id = ACDB_ID_LP_FM_SPKR_PHONE_STEREO_RX,
420 .profile = &ifmradio_handset_profile,
421 .channel_mode = 1,
422 .default_sample_rate = 8000,
423 .pamp_on = NULL,
424 .pamp_off = NULL,
425 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
426};
427
428static struct platform_device msm_ifmradio_handset_device = {
429 .name = "snddev_icodec",
430 .id = 7,
431 .dev = { .platform_data = &snddev_ifmradio_handset_data },
432};
433
434
435static struct adie_codec_action_unit ispeaker_rx_48KHz_osr256_actions[] =
436 SPEAKER_STEREO_RX_48000_OSR_256;
437
438static struct adie_codec_hwsetting_entry ispeaker_rx_settings[] = {
439 {
440 .freq_plan = 48000,
441 .osr = 256,
442 .actions = ispeaker_rx_48KHz_osr256_actions,
443 .action_sz = ARRAY_SIZE(ispeaker_rx_48KHz_osr256_actions),
444 }
445};
446
447static struct adie_codec_dev_profile ispeaker_rx_profile = {
448 .path_type = ADIE_CODEC_RX,
449 .settings = ispeaker_rx_settings,
450 .setting_sz = ARRAY_SIZE(ispeaker_rx_settings),
451};
452
453static struct snddev_icodec_data snddev_ispeaker_rx_data = {
454 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
455 .name = "speaker_stereo_rx",
456 .copp_id = 0,
457 .acdb_id = ACDB_ID_SPKR_PHONE_STEREO,
458 .profile = &ispeaker_rx_profile,
459 .channel_mode = 2,
460 .pmctl_id = NULL,
461 .pmctl_id_sz = 0,
462 .default_sample_rate = 48000,
463 .pamp_on = &msm_snddev_poweramp_on,
464 .pamp_off = &msm_snddev_poweramp_off,
465 .max_voice_rx_vol[VOC_NB_INDEX] = 1000,
466 .min_voice_rx_vol[VOC_NB_INDEX] = -500,
467 .max_voice_rx_vol[VOC_WB_INDEX] = 1000,
468 .min_voice_rx_vol[VOC_WB_INDEX] = -500,
469};
470
471static struct platform_device msm_ispeaker_rx_device = {
472 .name = "snddev_icodec",
473 .id = 8,
474 .dev = { .platform_data = &snddev_ispeaker_rx_data },
475
476};
477
478static struct adie_codec_action_unit ifmradio_speaker_osr64_actions[] =
479 FM_SPEAKER_OSR_64;
480
481static struct adie_codec_hwsetting_entry ifmradio_speaker_settings[] = {
482 {
483 .freq_plan = 8000,
484 .osr = 256,
485 .actions = ifmradio_speaker_osr64_actions,
486 .action_sz = ARRAY_SIZE(ifmradio_speaker_osr64_actions),
487 }
488};
489
490static struct adie_codec_dev_profile ifmradio_speaker_profile = {
491 .path_type = ADIE_CODEC_RX,
492 .settings = ifmradio_speaker_settings,
493 .setting_sz = ARRAY_SIZE(ifmradio_speaker_settings),
494};
495
496static struct snddev_icodec_data snddev_ifmradio_speaker_data = {
497 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_FM),
498 .name = "fmradio_speaker_rx",
499 .copp_id = 0,
500 .acdb_id = ACDB_ID_LP_FM_SPKR_PHONE_STEREO_RX,
501 .profile = &ifmradio_speaker_profile,
502 .channel_mode = 1,
503 .default_sample_rate = 8000,
504 .pamp_on = &msm_snddev_poweramp_on,
505 .pamp_off = &msm_snddev_poweramp_off,
506 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
507};
508
509static struct platform_device msm_ifmradio_speaker_device = {
510 .name = "snddev_icodec",
511 .id = 9,
512 .dev = { .platform_data = &snddev_ifmradio_speaker_data },
513};
514
515static struct adie_codec_action_unit ifmradio_headset_osr64_actions[] =
516 FM_HEADSET_STEREO_CLASS_D_LEGACY_OSR_64;
517
518static struct adie_codec_hwsetting_entry ifmradio_headset_settings[] = {
519 {
520 .freq_plan = 8000,
521 .osr = 256,
522 .actions = ifmradio_headset_osr64_actions,
523 .action_sz = ARRAY_SIZE(ifmradio_headset_osr64_actions),
524 }
525};
526
527static struct adie_codec_dev_profile ifmradio_headset_profile = {
528 .path_type = ADIE_CODEC_RX,
529 .settings = ifmradio_headset_settings,
530 .setting_sz = ARRAY_SIZE(ifmradio_headset_settings),
531};
532
533static struct snddev_icodec_data snddev_ifmradio_headset_data = {
534 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_FM),
535 .name = "fmradio_headset_rx",
536 .copp_id = 0,
537 .acdb_id = ACDB_ID_LP_FM_HEADSET_SPKR_STEREO_RX,
538 .profile = &ifmradio_headset_profile,
539 .channel_mode = 1,
540 .default_sample_rate = 8000,
541 .pamp_on = NULL,
542 .pamp_off = NULL,
543 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
544};
545
546static struct platform_device msm_ifmradio_headset_device = {
547 .name = "snddev_icodec",
548 .id = 10,
549 .dev = { .platform_data = &snddev_ifmradio_headset_data },
550};
551
552
553static struct adie_codec_action_unit ifmradio_ffa_headset_osr64_actions[] =
554 FM_HEADSET_CLASS_AB_STEREO_CAPLESS_OSR_64;
555
556static struct adie_codec_hwsetting_entry ifmradio_ffa_headset_settings[] = {
557 {
558 .freq_plan = 8000,
559 .osr = 256,
560 .actions = ifmradio_ffa_headset_osr64_actions,
561 .action_sz = ARRAY_SIZE(ifmradio_ffa_headset_osr64_actions),
562 }
563};
564
565static struct adie_codec_dev_profile ifmradio_ffa_headset_profile = {
566 .path_type = ADIE_CODEC_RX,
567 .settings = ifmradio_ffa_headset_settings,
568 .setting_sz = ARRAY_SIZE(ifmradio_ffa_headset_settings),
569};
570
571static struct snddev_icodec_data snddev_ifmradio_ffa_headset_data = {
572 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_FM),
573 .name = "fmradio_headset_rx",
574 .copp_id = 0,
575 .acdb_id = ACDB_ID_LP_FM_HEADSET_SPKR_STEREO_RX,
576 .profile = &ifmradio_ffa_headset_profile,
577 .channel_mode = 1,
578 .default_sample_rate = 8000,
579 .pamp_on = msm_snddev_hsed_voltage_on,
580 .pamp_off = msm_snddev_hsed_voltage_off,
581 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
582};
583
584static struct platform_device msm_ifmradio_ffa_headset_device = {
585 .name = "snddev_icodec",
586 .id = 11,
587 .dev = { .platform_data = &snddev_ifmradio_ffa_headset_data },
588};
589
590static struct snddev_ecodec_data snddev_bt_sco_earpiece_data = {
591 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
592 .name = "bt_sco_rx",
593 .copp_id = 1,
594 .acdb_id = ACDB_ID_BT_SCO_SPKR,
595 .channel_mode = 1,
596 .conf_pcm_ctl_val = BT_SCO_PCM_CTL_VAL,
597 .conf_aux_codec_intf = BT_SCO_AUX_CODEC_INTF,
598 .conf_data_format_padding_val = BT_SCO_DATA_FORMAT_PADDING,
599 .max_voice_rx_vol[VOC_NB_INDEX] = 400,
600 .min_voice_rx_vol[VOC_NB_INDEX] = -1100,
601 .max_voice_rx_vol[VOC_WB_INDEX] = 400,
602 .min_voice_rx_vol[VOC_WB_INDEX] = -1100,
603};
604
605static struct snddev_ecodec_data snddev_bt_sco_mic_data = {
606 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
607 .name = "bt_sco_tx",
608 .copp_id = 1,
609 .acdb_id = ACDB_ID_BT_SCO_MIC,
610 .channel_mode = 1,
611 .conf_pcm_ctl_val = BT_SCO_PCM_CTL_VAL,
612 .conf_aux_codec_intf = BT_SCO_AUX_CODEC_INTF,
613 .conf_data_format_padding_val = BT_SCO_DATA_FORMAT_PADDING,
614};
615
616struct platform_device msm_bt_sco_earpiece_device = {
617 .name = "msm_snddev_ecodec",
618 .id = 0,
619 .dev = { .platform_data = &snddev_bt_sco_earpiece_data },
620};
621
622struct platform_device msm_bt_sco_mic_device = {
623 .name = "msm_snddev_ecodec",
624 .id = 1,
625 .dev = { .platform_data = &snddev_bt_sco_mic_data },
626};
627
628static struct adie_codec_action_unit idual_mic_endfire_8KHz_osr256_actions[] =
629 MIC1_LEFT_LINE_IN_RIGHT_8000_OSR_256;
630
631static struct adie_codec_hwsetting_entry idual_mic_endfire_settings[] = {
632 {
633 .freq_plan = 8000,
634 .osr = 256,
635 .actions = idual_mic_endfire_8KHz_osr256_actions,
636 .action_sz = ARRAY_SIZE(idual_mic_endfire_8KHz_osr256_actions),
637 }, /* 8KHz profile can be used for 16KHz */
638 {
639 .freq_plan = 16000,
640 .osr = 256,
641 .actions = idual_mic_endfire_8KHz_osr256_actions,
642 .action_sz = ARRAY_SIZE(idual_mic_endfire_8KHz_osr256_actions),
643 }, /* 8KHz profile can be used for 48KHz */
644 {
645 .freq_plan = 48000,
646 .osr = 256,
647 .actions = idual_mic_endfire_8KHz_osr256_actions,
648 .action_sz = ARRAY_SIZE(idual_mic_endfire_8KHz_osr256_actions),
649 }
650};
651
652static struct adie_codec_dev_profile idual_mic_endfire_profile = {
653 .path_type = ADIE_CODEC_TX,
654 .settings = idual_mic_endfire_settings,
655 .setting_sz = ARRAY_SIZE(idual_mic_endfire_settings),
656};
657
658static enum hsed_controller idual_mic_endfire_pmctl_id[] = {
659 PM_HSED_CONTROLLER_0, PM_HSED_CONTROLLER_2
660};
661
662static struct snddev_icodec_data snddev_idual_mic_endfire_data = {
663 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
664 .name = "handset_dual_mic_endfire_tx",
665 .copp_id = 0,
666 .acdb_id = ACDB_ID_HANDSET_MIC_ENDFIRE,
667 .profile = &idual_mic_endfire_profile,
668 .channel_mode = 2,
669 .default_sample_rate = 48000,
670 .pmctl_id = idual_mic_endfire_pmctl_id,
671 .pmctl_id_sz = ARRAY_SIZE(idual_mic_endfire_pmctl_id),
672 .pamp_on = NULL,
673 .pamp_off = NULL,
674};
675
676static struct platform_device msm_idual_mic_endfire_device = {
677 .name = "snddev_icodec",
678 .id = 12,
679 .dev = { .platform_data = &snddev_idual_mic_endfire_data },
680};
681
682
683static struct snddev_icodec_data\
684 snddev_idual_mic_endfire_real_stereo_data = {
685 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
686 .name = "handset_dual_mic_endfire_tx_real_stereo",
687 .copp_id = 0,
688 .acdb_id = PSEUDO_ACDB_ID,
689 .profile = &idual_mic_endfire_profile,
690 .channel_mode = REAL_STEREO_CHANNEL_MODE,
691 .default_sample_rate = 48000,
692 .pmctl_id = idual_mic_endfire_pmctl_id,
693 .pmctl_id_sz = ARRAY_SIZE(idual_mic_endfire_pmctl_id),
694 .pamp_on = NULL,
695 .pamp_off = NULL,
696};
697
698static struct platform_device msm_real_stereo_tx_device = {
699 .name = "snddev_icodec",
700 .id = 26,
701 .dev = { .platform_data =
702 &snddev_idual_mic_endfire_real_stereo_data },
703};
704
705static struct adie_codec_action_unit idual_mic_bs_8KHz_osr256_actions[] =
706 MIC1_LEFT_AUX_IN_RIGHT_8000_OSR_256;
707
708static struct adie_codec_hwsetting_entry idual_mic_broadside_settings[] = {
709 {
710 .freq_plan = 8000,
711 .osr = 256,
712 .actions = idual_mic_bs_8KHz_osr256_actions,
713 .action_sz = ARRAY_SIZE(idual_mic_bs_8KHz_osr256_actions),
714 }, /* 8KHz profile can be used for 16KHz */
715 {
716 .freq_plan = 16000,
717 .osr = 256,
718 .actions = idual_mic_bs_8KHz_osr256_actions,
719 .action_sz = ARRAY_SIZE(idual_mic_bs_8KHz_osr256_actions),
720 }, /* 8KHz profile can be used for 16KHz */
721 {
722 .freq_plan = 48000,
723 .osr = 256,
724 .actions = idual_mic_bs_8KHz_osr256_actions,
725 .action_sz = ARRAY_SIZE(idual_mic_bs_8KHz_osr256_actions),
726 }
727};
728
729static struct adie_codec_dev_profile idual_mic_broadside_profile = {
730 .path_type = ADIE_CODEC_TX,
731 .settings = idual_mic_broadside_settings,
732 .setting_sz = ARRAY_SIZE(idual_mic_broadside_settings),
733};
734
735static enum hsed_controller idual_mic_broadside_pmctl_id[] = {
736 PM_HSED_CONTROLLER_0, PM_HSED_CONTROLLER_2
737};
738
739static struct snddev_icodec_data snddev_idual_mic_broadside_data = {
740 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
741 .name = "handset_dual_mic_broadside_tx",
742 .copp_id = 0,
743 .acdb_id = ACDB_ID_HANDSET_MIC_BROADSIDE,
744 .profile = &idual_mic_broadside_profile,
745 .channel_mode = 2,
746 .default_sample_rate = 48000,
747 .pmctl_id = idual_mic_broadside_pmctl_id,
748 .pmctl_id_sz = ARRAY_SIZE(idual_mic_broadside_pmctl_id),
749 .pamp_on = NULL,
750 .pamp_off = NULL,
751};
752
753static struct platform_device msm_idual_mic_broadside_device = {
754 .name = "snddev_icodec",
755 .id = 13,
756 .dev = { .platform_data = &snddev_idual_mic_broadside_data },
757};
758
759static struct adie_codec_action_unit ispk_dual_mic_ef_8KHz_osr256_actions[] =
760 SPEAKER_MIC1_LEFT_LINE_IN_RIGHT_8000_OSR_256;
761
762static struct adie_codec_hwsetting_entry ispk_dual_mic_ef_settings[] = {
763 {
764 .freq_plan = 8000,
765 .osr = 256,
766 .actions = ispk_dual_mic_ef_8KHz_osr256_actions,
767 .action_sz = ARRAY_SIZE(ispk_dual_mic_ef_8KHz_osr256_actions),
768 }, /* 8KHz profile can be used for 16Khz */
769 {
770 .freq_plan = 16000,
771 .osr = 256,
772 .actions = ispk_dual_mic_ef_8KHz_osr256_actions,
773 .action_sz = ARRAY_SIZE(ispk_dual_mic_ef_8KHz_osr256_actions),
774 }, /* 8KHz profile can be used for 48KHz */
775 {
776 .freq_plan = 48000,
777 .osr = 256,
778 .actions = ispk_dual_mic_ef_8KHz_osr256_actions,
779 .action_sz = ARRAY_SIZE(ispk_dual_mic_ef_8KHz_osr256_actions),
780 },
781};
782
783static struct adie_codec_dev_profile ispk_dual_mic_ef_profile = {
784 .path_type = ADIE_CODEC_TX,
785 .settings = ispk_dual_mic_ef_settings,
786 .setting_sz = ARRAY_SIZE(ispk_dual_mic_ef_settings),
787};
788
789static struct snddev_icodec_data snddev_spk_idual_mic_endfire_data = {
790 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
791 .name = "speaker_dual_mic_endfire_tx",
792 .copp_id = 0,
793 .acdb_id = ACDB_ID_SPKR_PHONE_MIC_ENDFIRE,
794 .profile = &ispk_dual_mic_ef_profile,
795 .channel_mode = 2,
796 .default_sample_rate = 48000,
797 .pmctl_id = idual_mic_endfire_pmctl_id,
798 .pmctl_id_sz = ARRAY_SIZE(idual_mic_endfire_pmctl_id),
799 .pamp_on = NULL,
800 .pamp_off = NULL,
801};
802
803static struct platform_device msm_spk_idual_mic_endfire_device = {
804 .name = "snddev_icodec",
805 .id = 14,
806 .dev = { .platform_data = &snddev_spk_idual_mic_endfire_data },
807};
808
809static struct adie_codec_action_unit ispk_dual_mic_bs_8KHz_osr256_actions[] =
810 SPEAKER_MIC1_LEFT_AUX_IN_RIGHT_8000_OSR_256;
811
812static struct adie_codec_hwsetting_entry ispk_dual_mic_bs_settings[] = {
813 {
814 .freq_plan = 8000,
815 .osr = 256,
816 .actions = ispk_dual_mic_bs_8KHz_osr256_actions,
817 .action_sz = ARRAY_SIZE(ispk_dual_mic_bs_8KHz_osr256_actions),
818 }, /* 8KHz profile can be used for 16Khz */
819 {
820 .freq_plan = 16000,
821 .osr = 256,
822 .actions = ispk_dual_mic_bs_8KHz_osr256_actions,
823 .action_sz = ARRAY_SIZE(ispk_dual_mic_bs_8KHz_osr256_actions),
824 }, /* 8KHz profile can be used for 48KHz */
825 {
826 .freq_plan = 48000,
827 .osr = 256,
828 .actions = ispk_dual_mic_bs_8KHz_osr256_actions,
829 .action_sz = ARRAY_SIZE(ispk_dual_mic_bs_8KHz_osr256_actions),
830 },
831};
832
833static struct adie_codec_dev_profile ispk_dual_mic_bs_profile = {
834 .path_type = ADIE_CODEC_TX,
835 .settings = ispk_dual_mic_bs_settings,
836 .setting_sz = ARRAY_SIZE(ispk_dual_mic_bs_settings),
837};
838static struct snddev_icodec_data snddev_spk_idual_mic_broadside_data = {
839 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
840 .name = "speaker_dual_mic_broadside_tx",
841 .copp_id = 0,
842 .acdb_id = ACDB_ID_SPKR_PHONE_MIC_BROADSIDE,
843 .profile = &ispk_dual_mic_bs_profile,
844 .channel_mode = 2,
845 .default_sample_rate = 48000,
846 .pmctl_id = idual_mic_broadside_pmctl_id,
847 .pmctl_id_sz = ARRAY_SIZE(idual_mic_broadside_pmctl_id),
848 .pamp_on = NULL,
849 .pamp_off = NULL,
850};
851
852static struct platform_device msm_spk_idual_mic_broadside_device = {
853 .name = "snddev_icodec",
854 .id = 15,
855 .dev = { .platform_data = &snddev_spk_idual_mic_broadside_data },
856};
857
858static struct adie_codec_action_unit itty_hs_mono_tx_8KHz_osr256_actions[] =
859 TTY_HEADSET_MONO_TX_8000_OSR_256;
860
861static struct adie_codec_hwsetting_entry itty_hs_mono_tx_settings[] = {
862 /* 8KHz, 16KHz, 48KHz TTY Tx devices can shared same set of actions */
863 {
864 .freq_plan = 8000,
865 .osr = 256,
866 .actions = itty_hs_mono_tx_8KHz_osr256_actions,
867 .action_sz = ARRAY_SIZE(itty_hs_mono_tx_8KHz_osr256_actions),
868 },
869 {
870 .freq_plan = 16000,
871 .osr = 256,
872 .actions = itty_hs_mono_tx_8KHz_osr256_actions,
873 .action_sz = ARRAY_SIZE(itty_hs_mono_tx_8KHz_osr256_actions),
874 },
875 {
876 .freq_plan = 48000,
877 .osr = 256,
878 .actions = itty_hs_mono_tx_8KHz_osr256_actions,
879 .action_sz = ARRAY_SIZE(itty_hs_mono_tx_8KHz_osr256_actions),
880 }
881};
882
883static struct adie_codec_dev_profile itty_hs_mono_tx_profile = {
884 .path_type = ADIE_CODEC_TX,
885 .settings = itty_hs_mono_tx_settings,
886 .setting_sz = ARRAY_SIZE(itty_hs_mono_tx_settings),
887};
888
889static struct snddev_icodec_data snddev_itty_hs_mono_tx_data = {
890 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE | SNDDEV_CAP_TTY),
891 .name = "tty_headset_mono_tx",
892 .copp_id = 0,
893 .acdb_id = ACDB_ID_TTY_HEADSET_MIC,
894 .profile = &itty_hs_mono_tx_profile,
895 .channel_mode = 1,
896 .default_sample_rate = 48000,
897 .pmctl_id = NULL,
898 .pmctl_id_sz = 0,
899 .pamp_on = NULL,
900 .pamp_off = NULL,
901};
902
903static struct platform_device msm_itty_hs_mono_tx_device = {
904 .name = "snddev_icodec",
905 .id = 16,
906 .dev = { .platform_data = &snddev_itty_hs_mono_tx_data },
907};
908
909static struct adie_codec_action_unit itty_hs_mono_rx_8KHz_osr256_actions[] =
910 TTY_HEADSET_MONO_RX_CLASS_D_8000_OSR_256;
911
912static struct adie_codec_action_unit itty_hs_mono_rx_16KHz_osr256_actions[] =
913 TTY_HEADSET_MONO_RX_CLASS_D_16000_OSR_256;
914
915static struct adie_codec_action_unit itty_hs_mono_rx_48KHz_osr256_actions[] =
916 TTY_HEADSET_MONO_RX_CLASS_D_48000_OSR_256;
917
918static struct adie_codec_hwsetting_entry itty_hs_mono_rx_settings[] = {
919 {
920 .freq_plan = 8000,
921 .osr = 256,
922 .actions = itty_hs_mono_rx_8KHz_osr256_actions,
923 .action_sz = ARRAY_SIZE(itty_hs_mono_rx_8KHz_osr256_actions),
924 },
925 {
926 .freq_plan = 16000,
927 .osr = 256,
928 .actions = itty_hs_mono_rx_16KHz_osr256_actions,
929 .action_sz = ARRAY_SIZE(itty_hs_mono_rx_16KHz_osr256_actions),
930 },
931 {
932 .freq_plan = 48000,
933 .osr = 256,
934 .actions = itty_hs_mono_rx_48KHz_osr256_actions,
935 .action_sz = ARRAY_SIZE(itty_hs_mono_rx_48KHz_osr256_actions),
936 }
937};
938
939static struct adie_codec_dev_profile itty_hs_mono_rx_profile = {
940 .path_type = ADIE_CODEC_RX,
941 .settings = itty_hs_mono_rx_settings,
942 .setting_sz = ARRAY_SIZE(itty_hs_mono_rx_settings),
943};
944
945static struct snddev_icodec_data snddev_itty_hs_mono_rx_data = {
946 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE | SNDDEV_CAP_TTY),
947 .name = "tty_headset_mono_rx",
948 .copp_id = 0,
949 .acdb_id = ACDB_ID_TTY_HEADSET_SPKR,
950 .profile = &itty_hs_mono_rx_profile,
951 .channel_mode = 1,
952 .default_sample_rate = 48000,
953 .pamp_on = NULL,
954 .pamp_off = NULL,
955 .max_voice_rx_vol[VOC_NB_INDEX] = 0,
956 .min_voice_rx_vol[VOC_NB_INDEX] = 0,
957 .max_voice_rx_vol[VOC_WB_INDEX] = 0,
958 .min_voice_rx_vol[VOC_WB_INDEX] = 0,
959};
960
961static struct platform_device msm_itty_hs_mono_rx_device = {
962 .name = "snddev_icodec",
963 .id = 17,
964 .dev = { .platform_data = &snddev_itty_hs_mono_rx_data },
965};
966
967static struct adie_codec_action_unit ispeaker_tx_8KHz_osr256_actions[] =
968 SPEAKER_TX_8000_OSR_256;
969
970static struct adie_codec_action_unit ispeaker_tx_48KHz_osr256_actions[] =
971 SPEAKER_TX_48000_OSR_256;
972
973static struct adie_codec_hwsetting_entry ispeaker_tx_settings[] = {
974 {
975 .freq_plan = 8000,
976 .osr = 256,
977 .actions = ispeaker_tx_8KHz_osr256_actions,
978 .action_sz = ARRAY_SIZE(ispeaker_tx_8KHz_osr256_actions),
979 },
980 { /* 8KHz profile is good for 16KHz */
981 .freq_plan = 16000,
982 .osr = 256,
983 .actions = ispeaker_tx_8KHz_osr256_actions,
984 .action_sz = ARRAY_SIZE(ispeaker_tx_8KHz_osr256_actions),
985 },
986 {
987 .freq_plan = 48000,
988 .osr = 256,
989 .actions = ispeaker_tx_48KHz_osr256_actions,
990 .action_sz = ARRAY_SIZE(ispeaker_tx_48KHz_osr256_actions),
991 }
992};
993
994static struct adie_codec_dev_profile ispeaker_tx_profile = {
995 .path_type = ADIE_CODEC_TX,
996 .settings = ispeaker_tx_settings,
997 .setting_sz = ARRAY_SIZE(ispeaker_tx_settings),
998};
999
1000static enum hsed_controller ispk_pmctl_id[] = {PM_HSED_CONTROLLER_0};
1001
1002static struct snddev_icodec_data snddev_ispeaker_tx_data = {
1003 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1004 .name = "speaker_mono_tx",
1005 .copp_id = 0,
1006 .acdb_id = ACDB_ID_SPKR_PHONE_MIC,
1007 .profile = &ispeaker_tx_profile,
1008 .channel_mode = 1,
1009 .pmctl_id = ispk_pmctl_id,
1010 .pmctl_id_sz = ARRAY_SIZE(ispk_pmctl_id),
1011 .default_sample_rate = 48000,
1012 .pamp_on = msm_snddev_tx_route_config,
1013 .pamp_off = msm_snddev_tx_route_deconfig,
1014};
1015
1016static struct platform_device msm_ispeaker_tx_device = {
1017 .name = "snddev_icodec",
1018 .id = 18,
1019 .dev = { .platform_data = &snddev_ispeaker_tx_data },
1020};
1021
1022static struct adie_codec_action_unit iearpiece_ffa_48KHz_osr256_actions[] =
1023 HANDSET_RX_48000_OSR_256_FFA;
1024
1025static struct adie_codec_hwsetting_entry iearpiece_ffa_settings[] = {
1026 {
1027 .freq_plan = 48000,
1028 .osr = 256,
1029 .actions = iearpiece_ffa_48KHz_osr256_actions,
1030 .action_sz = ARRAY_SIZE(iearpiece_ffa_48KHz_osr256_actions),
1031 }
1032};
1033
1034static struct adie_codec_dev_profile iearpiece_ffa_profile = {
1035 .path_type = ADIE_CODEC_RX,
1036 .settings = iearpiece_ffa_settings,
1037 .setting_sz = ARRAY_SIZE(iearpiece_ffa_settings),
1038};
1039
1040static struct snddev_icodec_data snddev_iearpiece_ffa_data = {
1041 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1042 .name = "handset_rx",
1043 .copp_id = 0,
1044 .acdb_id = ACDB_ID_HANDSET_SPKR,
1045 .profile = &iearpiece_ffa_profile,
1046 .channel_mode = 1,
1047 .pmctl_id = NULL,
1048 .pmctl_id_sz = 0,
1049 .default_sample_rate = 48000,
1050 .pamp_on = NULL,
1051 .pamp_off = NULL,
1052 .max_voice_rx_vol[VOC_NB_INDEX] = -700,
1053 .min_voice_rx_vol[VOC_NB_INDEX] = -2200,
1054 .max_voice_rx_vol[VOC_WB_INDEX] = -1400,
1055 .min_voice_rx_vol[VOC_WB_INDEX] = -2900,
1056};
1057
1058static struct platform_device msm_iearpiece_ffa_device = {
1059 .name = "snddev_icodec",
1060 .id = 19,
1061 .dev = { .platform_data = &snddev_iearpiece_ffa_data },
1062};
1063
1064static struct adie_codec_action_unit imic_ffa_8KHz_osr256_actions[] =
1065 HANDSET_TX_8000_OSR_256_FFA;
1066
1067static struct adie_codec_action_unit imic_ffa_16KHz_osr256_actions[] =
1068 HANDSET_TX_16000_OSR_256_FFA;
1069
1070static struct adie_codec_action_unit imic_ffa_48KHz_osr256_actions[] =
1071 HANDSET_TX_48000_OSR_256_FFA;
1072
1073static struct adie_codec_hwsetting_entry imic_ffa_settings[] = {
1074 {
1075 .freq_plan = 8000,
1076 .osr = 256,
1077 .actions = imic_ffa_8KHz_osr256_actions,
1078 .action_sz = ARRAY_SIZE(imic_ffa_8KHz_osr256_actions),
1079 },
1080 {
1081 .freq_plan = 16000,
1082 .osr = 256,
1083 .actions = imic_ffa_16KHz_osr256_actions,
1084 .action_sz = ARRAY_SIZE(imic_ffa_16KHz_osr256_actions),
1085 },
1086 {
1087 .freq_plan = 48000,
1088 .osr = 256,
1089 .actions = imic_ffa_48KHz_osr256_actions,
1090 .action_sz = ARRAY_SIZE(imic_ffa_48KHz_osr256_actions),
1091 }
1092};
1093
1094static struct adie_codec_dev_profile imic_ffa_profile = {
1095 .path_type = ADIE_CODEC_TX,
1096 .settings = imic_ffa_settings,
1097 .setting_sz = ARRAY_SIZE(imic_ffa_settings),
1098};
1099
1100static struct snddev_icodec_data snddev_imic_ffa_data = {
1101 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1102 .name = "handset_tx",
1103 .copp_id = 0,
1104 .acdb_id = ACDB_ID_HANDSET_MIC,
1105 .profile = &imic_ffa_profile,
1106 .channel_mode = 1,
1107 .pmctl_id = imic_pmctl_id,
1108 .pmctl_id_sz = ARRAY_SIZE(imic_pmctl_id),
1109 .default_sample_rate = 48000,
1110 .pamp_on = NULL,
1111 .pamp_off = NULL,
1112};
1113
1114static struct platform_device msm_imic_ffa_device = {
1115 .name = "snddev_icodec",
1116 .id = 20,
1117 .dev = { .platform_data = &snddev_imic_ffa_data },
1118};
1119
1120
1121static struct adie_codec_action_unit
1122 ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions[] =
1123 HEADSET_STEREO_SPEAKER_STEREO_RX_CAPLESS_48000_OSR_256;
1124
1125
1126static struct adie_codec_hwsetting_entry
1127 ihs_stereo_speaker_stereo_rx_settings[] = {
1128 {
1129 .freq_plan = 48000,
1130 .osr = 256,
1131 .actions = ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions,
1132 .action_sz =
1133 ARRAY_SIZE(ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions),
1134 }
1135};
1136
1137static struct adie_codec_dev_profile ihs_stereo_speaker_stereo_rx_profile = {
1138 .path_type = ADIE_CODEC_RX,
1139 .settings = ihs_stereo_speaker_stereo_rx_settings,
1140 .setting_sz = ARRAY_SIZE(ihs_stereo_speaker_stereo_rx_settings),
1141};
1142
1143static struct snddev_icodec_data snddev_ihs_stereo_speaker_stereo_rx_data = {
1144 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1145 .name = "headset_stereo_speaker_stereo_rx",
1146 .copp_id = 0,
1147 .acdb_id = ACDB_ID_HEADSET_STEREO_PLUS_SPKR_STEREO_RX,
1148 .profile = &ihs_stereo_speaker_stereo_rx_profile,
1149 .channel_mode = 2,
1150 .default_sample_rate = 48000,
1151 .pamp_on = msm_snddev_poweramp_on,
1152 .pamp_off = msm_snddev_poweramp_off,
1153 .voltage_on = msm_snddev_hsed_voltage_on,
1154 .voltage_off = msm_snddev_hsed_voltage_off,
1155 .max_voice_rx_vol[VOC_NB_INDEX] = -500,
1156 .min_voice_rx_vol[VOC_NB_INDEX] = -2000,
1157 .max_voice_rx_vol[VOC_WB_INDEX] = -500,
1158 .min_voice_rx_vol[VOC_WB_INDEX] = -2000,
1159};
1160
1161static struct platform_device msm_ihs_stereo_speaker_stereo_rx_device = {
1162 .name = "snddev_icodec",
1163 .id = 21,
1164 .dev = { .platform_data = &snddev_ihs_stereo_speaker_stereo_rx_data },
1165};
1166
1167static struct snddev_mi2s_data snddev_mi2s_stereo_rx_data = {
1168 .capability = SNDDEV_CAP_RX ,
1169 .name = "hdmi_stereo_rx",
1170 .copp_id = 3,
1171 .acdb_id = ACDB_ID_HDMI,
1172 .channel_mode = 2,
1173 .sd_lines = MI2S_SD_0,
1174 .route = msm_snddev_tx_route_config,
1175 .deroute = msm_snddev_tx_route_deconfig,
1176 .default_sample_rate = 48000,
1177};
1178
1179static struct platform_device msm_snddev_mi2s_stereo_rx_device = {
1180 .name = "snddev_mi2s",
1181 .id = 0,
1182 .dev = { .platform_data = &snddev_mi2s_stereo_rx_data },
1183};
1184
1185
1186static struct snddev_mi2s_data snddev_mi2s_fm_tx_data = {
1187 .capability = SNDDEV_CAP_TX ,
1188 .name = "fmradio_stereo_tx",
1189 .copp_id = 2,
1190 .acdb_id = ACDB_ID_FM_TX,
1191 .channel_mode = 2,
1192 .sd_lines = MI2S_SD_3,
1193 .route = NULL,
1194 .deroute = NULL,
1195 .default_sample_rate = 48000,
1196};
1197
1198static struct platform_device msm_snddev_mi2s_fm_tx_device = {
1199 .name = "snddev_mi2s",
1200 .id = 1,
1201 .dev = { .platform_data = &snddev_mi2s_fm_tx_data},
1202};
1203
1204static struct snddev_icodec_data snddev_fluid_imic_tx_data = {
1205 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1206 .name = "handset_tx",
1207 .copp_id = 0,
1208 .acdb_id = ACDB_ID_SPKR_PHONE_MIC,
1209 .profile = &ispeaker_tx_profile,
1210 .channel_mode = 1,
1211 .pmctl_id = ispk_pmctl_id,
1212 .pmctl_id_sz = ARRAY_SIZE(ispk_pmctl_id),
1213 .default_sample_rate = 48000,
1214 .pamp_on = msm_snddev_tx_route_config,
1215 .pamp_off = msm_snddev_tx_route_deconfig,
1216};
1217
1218static struct platform_device msm_fluid_imic_tx_device = {
1219 .name = "snddev_icodec",
1220 .id = 22,
1221 .dev = { .platform_data = &snddev_fluid_imic_tx_data },
1222};
1223
1224static struct snddev_icodec_data snddev_fluid_iearpiece_rx_data = {
1225 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1226 .name = "handset_rx",
1227 .copp_id = 0,
1228 .acdb_id = ACDB_ID_SPKR_PHONE_STEREO,
1229 .profile = &ispeaker_rx_profile,
1230 .channel_mode = 2,
1231 .pmctl_id = NULL,
1232 .pmctl_id_sz = 0,
1233 .default_sample_rate = 48000,
1234 .pamp_on = &msm_snddev_poweramp_on,
1235 .pamp_off = &msm_snddev_poweramp_off,
1236 .max_voice_rx_vol[VOC_NB_INDEX] = -500,
1237 .min_voice_rx_vol[VOC_NB_INDEX] = -1000,
1238 .max_voice_rx_vol[VOC_WB_INDEX] = -500,
1239 .min_voice_rx_vol[VOC_WB_INDEX] = -1000,
1240};
1241
1242static struct platform_device msm_fluid_iearpeice_rx_device = {
1243 .name = "snddev_icodec",
1244 .id = 23,
1245 .dev = { .platform_data = &snddev_fluid_iearpiece_rx_data },
1246};
1247
1248static struct adie_codec_action_unit fluid_idual_mic_ef_8KHz_osr256_actions[] =
1249 MIC1_LEFT_AUX_IN_RIGHT_8000_OSR_256;
1250
1251static struct adie_codec_hwsetting_entry fluid_idual_mic_endfire_settings[] = {
1252 {
1253 .freq_plan = 8000,
1254 .osr = 256,
1255 .actions = fluid_idual_mic_ef_8KHz_osr256_actions,
1256 .action_sz = ARRAY_SIZE(fluid_idual_mic_ef_8KHz_osr256_actions),
1257 }, /* 8KHz profile can be used for 16KHz */
1258 {
1259 .freq_plan = 16000,
1260 .osr = 256,
1261 .actions = fluid_idual_mic_ef_8KHz_osr256_actions,
1262 .action_sz = ARRAY_SIZE(fluid_idual_mic_ef_8KHz_osr256_actions),
1263 }, /* 8KHz profile can also be used for 48KHz */
1264 {
1265 .freq_plan = 48000,
1266 .osr = 256,
1267 .actions = fluid_idual_mic_ef_8KHz_osr256_actions,
1268 .action_sz = ARRAY_SIZE(fluid_idual_mic_ef_8KHz_osr256_actions),
1269 }
1270};
1271
1272static struct adie_codec_dev_profile fluid_idual_mic_endfire_profile = {
1273 .path_type = ADIE_CODEC_TX,
1274 .settings = fluid_idual_mic_endfire_settings,
1275 .setting_sz = ARRAY_SIZE(fluid_idual_mic_endfire_settings),
1276};
1277
1278static enum hsed_controller fluid_idual_mic_endfire_pmctl_id[] = {
1279 PM_HSED_CONTROLLER_0, PM_HSED_CONTROLLER_2
1280};
1281
1282static struct snddev_icodec_data snddev_fluid_idual_mic_endfire_data = {
1283 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1284 .name = "handset_dual_mic_endfire_tx",
1285 .copp_id = 0,
1286 .acdb_id = ACDB_ID_SPKR_PHONE_MIC_ENDFIRE,
1287 .profile = &fluid_idual_mic_endfire_profile,
1288 .channel_mode = 2,
1289 .default_sample_rate = 48000,
1290 .pmctl_id = fluid_idual_mic_endfire_pmctl_id,
1291 .pmctl_id_sz = ARRAY_SIZE(fluid_idual_mic_endfire_pmctl_id),
1292 .pamp_on = msm_snddev_tx_route_config,
1293 .pamp_off = msm_snddev_tx_route_deconfig,
1294};
1295
1296static struct platform_device msm_fluid_idual_mic_endfire_device = {
1297 .name = "snddev_icodec",
1298 .id = 24,
1299 .dev = { .platform_data = &snddev_fluid_idual_mic_endfire_data },
1300};
1301
1302static struct snddev_icodec_data snddev_fluid_spk_idual_mic_endfire_data = {
1303 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1304 .name = "speaker_dual_mic_endfire_tx",
1305 .copp_id = 0,
1306 .acdb_id = ACDB_ID_SPKR_PHONE_MIC_ENDFIRE,
1307 .profile = &fluid_idual_mic_endfire_profile,
1308 .channel_mode = 2,
1309 .default_sample_rate = 48000,
1310 .pmctl_id = fluid_idual_mic_endfire_pmctl_id,
1311 .pmctl_id_sz = ARRAY_SIZE(fluid_idual_mic_endfire_pmctl_id),
1312 .pamp_on = msm_snddev_tx_route_config,
1313 .pamp_off = msm_snddev_tx_route_deconfig,
1314};
1315
1316static struct platform_device msm_fluid_spk_idual_mic_endfire_device = {
1317 .name = "snddev_icodec",
1318 .id = 25,
1319 .dev = { .platform_data = &snddev_fluid_spk_idual_mic_endfire_data },
1320};
1321
1322static struct snddev_virtual_data snddev_a2dp_tx_data = {
1323 .capability = SNDDEV_CAP_TX,
1324 .name = "a2dp_tx",
1325 .copp_id = 5,
1326 .acdb_id = PSEUDO_ACDB_ID,
1327};
1328
1329static struct snddev_virtual_data snddev_a2dp_rx_data = {
1330 .capability = SNDDEV_CAP_RX,
1331 .name = "a2dp_rx",
1332 .copp_id = 2,
1333 .acdb_id = PSEUDO_ACDB_ID,
1334};
1335
1336static struct platform_device msm_a2dp_rx_device = {
1337 .name = "snddev_virtual",
1338 .id = 0,
1339 .dev = { .platform_data = &snddev_a2dp_rx_data },
1340};
1341
1342static struct platform_device msm_a2dp_tx_device = {
1343 .name = "snddev_virtual",
1344 .id = 1,
1345 .dev = { .platform_data = &snddev_a2dp_tx_data },
1346};
1347
1348static struct snddev_virtual_data snddev_uplink_rx_data = {
1349 .capability = SNDDEV_CAP_RX,
1350 .name = "uplink_rx",
1351 .copp_id = 5,
1352 .acdb_id = PSEUDO_ACDB_ID,
1353};
1354
1355static struct platform_device msm_uplink_rx_device = {
1356 .name = "snddev_virtual",
1357 .id = 2,
1358 .dev = { .platform_data = &snddev_uplink_rx_data },
1359};
1360
1361static struct platform_device *snd_devices_ffa[] __initdata = {
1362 &msm_iearpiece_ffa_device,
1363 &msm_imic_ffa_device,
1364 &msm_ifmradio_handset_device,
1365 &msm_ihs_ffa_stereo_rx_device,
1366 &msm_ihs_ffa_mono_rx_device,
1367 &msm_ihs_mono_tx_device,
1368 &msm_bt_sco_earpiece_device,
1369 &msm_bt_sco_mic_device,
1370 &msm_ispeaker_rx_device,
1371 &msm_ifmradio_speaker_device,
1372 &msm_ifmradio_ffa_headset_device,
1373 &msm_idual_mic_endfire_device,
1374 &msm_idual_mic_broadside_device,
1375 &msm_spk_idual_mic_endfire_device,
1376 &msm_spk_idual_mic_broadside_device,
1377 &msm_itty_hs_mono_tx_device,
1378 &msm_itty_hs_mono_rx_device,
1379 &msm_ispeaker_tx_device,
1380 &msm_ihs_stereo_speaker_stereo_rx_device,
1381 &msm_a2dp_rx_device,
1382 &msm_a2dp_tx_device,
1383 &msm_snddev_mi2s_stereo_rx_device,
1384 &msm_snddev_mi2s_fm_tx_device,
1385 &msm_uplink_rx_device,
1386 &msm_real_stereo_tx_device,
1387};
1388
1389static struct platform_device *snd_devices_surf[] __initdata = {
1390 &msm_iearpiece_device,
1391 &msm_imic_device,
1392 &msm_ihs_stereo_rx_device,
1393 &msm_ihs_mono_rx_device,
1394 &msm_ihs_mono_tx_device,
1395 &msm_bt_sco_earpiece_device,
1396 &msm_bt_sco_mic_device,
1397 &msm_ifmradio_handset_device,
1398 &msm_ispeaker_rx_device,
1399 &msm_ifmradio_speaker_device,
1400 &msm_ifmradio_headset_device,
1401 &msm_itty_hs_mono_tx_device,
1402 &msm_itty_hs_mono_rx_device,
1403 &msm_ispeaker_tx_device,
1404 &msm_ihs_stereo_speaker_stereo_rx_device,
1405 &msm_a2dp_rx_device,
1406 &msm_a2dp_tx_device,
1407 &msm_snddev_mi2s_stereo_rx_device,
1408 &msm_snddev_mi2s_fm_tx_device,
1409 &msm_uplink_rx_device,
1410};
1411
1412static struct platform_device *snd_devices_fluid[] __initdata = {
1413 &msm_ihs_stereo_rx_device,
1414 &msm_ihs_mono_rx_device,
1415 &msm_ihs_mono_tx_device,
1416 &msm_ispeaker_rx_device,
1417 &msm_ispeaker_tx_device,
1418 &msm_fluid_imic_tx_device,
1419 &msm_fluid_iearpeice_rx_device,
1420 &msm_fluid_idual_mic_endfire_device,
1421 &msm_fluid_spk_idual_mic_endfire_device,
1422 &msm_a2dp_rx_device,
1423 &msm_a2dp_tx_device,
1424 &msm_snddev_mi2s_stereo_rx_device,
1425 &msm_uplink_rx_device,
1426 &msm_ifmradio_speaker_device,
1427 &msm_ifmradio_headset_device,
1428};
1429
1430#ifdef CONFIG_DEBUG_FS
1431static void snddev_hsed_config_modify_setting(int type)
1432{
1433 struct platform_device *device;
1434 struct snddev_icodec_data *icodec_data;
1435
1436 device = &msm_ihs_ffa_stereo_rx_device;
1437 icodec_data = (struct snddev_icodec_data *)device->dev.platform_data;
1438
1439 if (icodec_data) {
1440 if (type == 1) {
1441 icodec_data->voltage_on = NULL;
1442 icodec_data->voltage_off = NULL;
1443 icodec_data->profile->settings =
1444 ihs_ffa_stereo_rx_class_d_legacy_settings;
1445 icodec_data->profile->setting_sz =
1446 ARRAY_SIZE(ihs_ffa_stereo_rx_class_d_legacy_settings);
1447 } else if (type == 2) {
1448 icodec_data->voltage_on = NULL;
1449 icodec_data->voltage_off = NULL;
1450 icodec_data->profile->settings =
1451 ihs_ffa_stereo_rx_class_ab_legacy_settings;
1452 icodec_data->profile->setting_sz =
1453 ARRAY_SIZE(ihs_ffa_stereo_rx_class_ab_legacy_settings);
1454 }
1455 }
1456}
1457
1458static void snddev_hsed_config_restore_setting(void)
1459{
1460 struct platform_device *device;
1461 struct snddev_icodec_data *icodec_data;
1462
1463 device = &msm_ihs_ffa_stereo_rx_device;
1464 icodec_data = (struct snddev_icodec_data *)device->dev.platform_data;
1465
1466 if (icodec_data) {
1467 icodec_data->voltage_on = msm_snddev_hsed_voltage_on;
1468 icodec_data->voltage_off = msm_snddev_hsed_voltage_off;
1469 icodec_data->profile->settings = ihs_ffa_stereo_rx_settings;
1470 icodec_data->profile->setting_sz =
1471 ARRAY_SIZE(ihs_ffa_stereo_rx_settings);
1472 }
1473}
1474
1475static ssize_t snddev_hsed_config_debug_write(struct file *filp,
1476 const char __user *ubuf, size_t cnt, loff_t *ppos)
1477{
1478 char *lb_str = filp->private_data;
1479 char cmd;
1480
1481 if (get_user(cmd, ubuf))
1482 return -EFAULT;
1483
1484 if (!strcmp(lb_str, "msm_hsed_config")) {
1485 switch (cmd) {
1486 case '0':
1487 snddev_hsed_config_restore_setting();
1488 break;
1489
1490 case '1':
1491 snddev_hsed_config_modify_setting(1);
1492 break;
1493
1494 case '2':
1495 snddev_hsed_config_modify_setting(2);
1496 break;
1497
1498 default:
1499 break;
1500 }
1501 }
1502 return cnt;
1503}
1504
1505static int snddev_hsed_config_debug_open(struct inode *inode, struct file *file)
1506{
1507 file->private_data = inode->i_private;
1508 return 0;
1509}
1510
1511static const struct file_operations snddev_hsed_config_debug_fops = {
1512 .open = snddev_hsed_config_debug_open,
1513 .write = snddev_hsed_config_debug_write
1514};
1515#endif
1516
1517void __ref msm_snddev_init(void)
1518{
1519 if (machine_is_msm7x30_ffa() || machine_is_msm8x55_ffa() ||
1520 machine_is_msm8x55_svlte_ffa()) {
1521 platform_add_devices(snd_devices_ffa,
1522 ARRAY_SIZE(snd_devices_ffa));
1523#ifdef CONFIG_DEBUG_FS
1524 debugfs_hsed_config = debugfs_create_file("msm_hsed_config",
1525 S_IFREG | S_IRUGO, NULL,
1526 (void *) "msm_hsed_config", &snddev_hsed_config_debug_fops);
1527#endif
1528 } else if (machine_is_msm7x30_surf() || machine_is_msm8x55_surf() ||
1529 machine_is_msm8x55_svlte_surf())
1530 platform_add_devices(snd_devices_surf,
1531 ARRAY_SIZE(snd_devices_surf));
1532 else if (machine_is_msm7x30_fluid())
1533 platform_add_devices(snd_devices_fluid,
1534 ARRAY_SIZE(snd_devices_fluid));
1535 else
1536 pr_err("%s: Unknown machine type\n", __func__);
1537}