blob: 8bf7794a8416ecc63092a414c42ebbd1c63c3fc7 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-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
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17#include <linux/delay.h>
18#include <linux/debugfs.h>
19#include <linux/mfd/pmic8058.h>
20#include <linux/pmic8058-othc.h>
21#include <linux/mfd/pmic8901.h>
22#include <linux/mfd/msm-adie-codec.h>
23#include <linux/regulator/pmic8058-regulator.h>
24#include <linux/regulator/pmic8901-regulator.h>
25#include <linux/regulator/consumer.h>
26#include <linux/regulator/machine.h>
27
28#include <mach/qdsp6v2/audio_dev_ctl.h>
29#include <mach/mpp.h>
30#include <sound/apr_audio.h>
31#include <asm/mach-types.h>
32#include <asm/uaccess.h>
33
34#include "snddev_icodec.h"
35#include "snddev_ecodec.h"
36#include "timpani_profile_8x60.h"
37#include "snddev_hdmi.h"
38#include "snddev_mi2s.h"
39#include "snddev_virtual.h"
40
41#ifdef CONFIG_DEBUG_FS
42static struct dentry *debugfs_hsed_config;
43static void snddev_hsed_config_modify_setting(int type);
44static void snddev_hsed_config_restore_setting(void);
45#endif
46
47/* GPIO_CLASS_D0_EN */
48#define SNDDEV_GPIO_CLASS_D0_EN 227
49
50/* GPIO_CLASS_D1_EN */
51#define SNDDEV_GPIO_CLASS_D1_EN 229
52
53#define SNDDEV_GPIO_MIC2_ANCR_SEL 294
54#define SNDDEV_GPIO_MIC1_ANCL_SEL 295
55
56static struct resource msm_cdcclk_ctl_resources[] = {
57 {
58 .name = "msm_snddev_tx_mclk",
59 .start = 108,
60 .end = 108,
61 .flags = IORESOURCE_IO,
62 },
63 {
64 .name = "msm_snddev_rx_mclk",
65 .start = 109,
66 .end = 109,
67 .flags = IORESOURCE_IO,
68 },
69};
70
71static struct platform_device msm_cdcclk_ctl_device = {
72 .name = "msm_cdcclk_ctl",
73 .num_resources = ARRAY_SIZE(msm_cdcclk_ctl_resources),
74 .resource = msm_cdcclk_ctl_resources,
75};
76
77static struct resource msm_aux_pcm_resources[] = {
78
79 {
80 .name = "aux_pcm_dout",
81 .start = 111,
82 .end = 111,
83 .flags = IORESOURCE_IO,
84 },
85 {
86 .name = "aux_pcm_din",
87 .start = 112,
88 .end = 112,
89 .flags = IORESOURCE_IO,
90 },
91 {
92 .name = "aux_pcm_syncout",
93 .start = 113,
94 .end = 113,
95 .flags = IORESOURCE_IO,
96 },
97 {
98 .name = "aux_pcm_clkin_a",
99 .start = 114,
100 .end = 114,
101 .flags = IORESOURCE_IO,
102 },
103};
104
105static struct platform_device msm_aux_pcm_device = {
106 .name = "msm_aux_pcm",
107 .num_resources = ARRAY_SIZE(msm_aux_pcm_resources),
108 .resource = msm_aux_pcm_resources,
109};
110
111static struct resource msm_mi2s_gpio_resources[] = {
112
113 {
114 .name = "mi2s_ws",
115 .start = 101,
116 .end = 101,
117 .flags = IORESOURCE_IO,
118 },
119 {
120 .name = "mi2s_sclk",
121 .start = 102,
122 .end = 102,
123 .flags = IORESOURCE_IO,
124 },
125 {
126 .name = "mi2s_mclk",
127 .start = 103,
128 .end = 103,
129 .flags = IORESOURCE_IO,
130 },
131 {
132 .name = "fm_mi2s_sd",
133 .start = 107,
134 .end = 107,
135 .flags = IORESOURCE_IO,
136 },
137};
138
139static struct platform_device msm_mi2s_device = {
140 .name = "msm_mi2s",
141 .num_resources = ARRAY_SIZE(msm_mi2s_gpio_resources),
142 .resource = msm_mi2s_gpio_resources,
143};
144
145/* Must be same size as msm_icodec_gpio_resources */
146static int msm_icodec_gpio_defaults[] = {
147 0,
148 0,
149};
150
151static struct resource msm_icodec_gpio_resources[] = {
152 {
153 .name = "msm_icodec_speaker_left",
154 .start = SNDDEV_GPIO_CLASS_D0_EN,
155 .end = SNDDEV_GPIO_CLASS_D0_EN,
156 .flags = IORESOURCE_IO,
157 },
158 {
159 .name = "msm_icodec_speaker_right",
160 .start = SNDDEV_GPIO_CLASS_D1_EN,
161 .end = SNDDEV_GPIO_CLASS_D1_EN,
162 .flags = IORESOURCE_IO,
163 },
164};
165
166static struct platform_device msm_icodec_gpio_device = {
167 .name = "msm_icodec_gpio",
168 .num_resources = ARRAY_SIZE(msm_icodec_gpio_resources),
169 .resource = msm_icodec_gpio_resources,
170 .dev = { .platform_data = &msm_icodec_gpio_defaults },
171};
172
173static struct regulator *s3;
174static struct regulator *mvs;
175
176static int msm_snddev_enable_dmic_power(void)
177{
178 int ret;
179
180 s3 = regulator_get(NULL, "8058_s3");
181 if (IS_ERR(s3)) {
182 ret = -EBUSY;
183 goto fail_get_s3;
184 }
185
186 ret = regulator_set_voltage(s3, 1800000, 1800000);
187 if (ret) {
188 pr_err("%s: error setting voltage\n", __func__);
189 goto fail_s3;
190 }
191
192 ret = regulator_enable(s3);
193 if (ret) {
194 pr_err("%s: error enabling regulator\n", __func__);
195 goto fail_s3;
196 }
197
198 mvs = regulator_get(NULL, "8901_mvs0");
199 if (IS_ERR(mvs))
200 goto fail_mvs0_get;
201
202 ret = regulator_enable(mvs);
203 if (ret) {
204 pr_err("%s: error setting regulator\n", __func__);
205 goto fail_mvs0_enable;
206 }
207 return ret;
208
209fail_mvs0_enable:
210 regulator_put(mvs);
211 mvs = NULL;
212fail_mvs0_get:
213 regulator_disable(s3);
214fail_s3:
215 regulator_put(s3);
216 s3 = NULL;
217fail_get_s3:
218 return ret;
219}
220
221static void msm_snddev_disable_dmic_power(void)
222{
223 int ret;
224
225 if (mvs) {
226 ret = regulator_disable(mvs);
227 if (ret < 0)
228 pr_err("%s: error disabling vreg mvs\n", __func__);
229 regulator_put(mvs);
230 mvs = NULL;
231 }
232
233 if (s3) {
234 ret = regulator_disable(s3);
235 if (ret < 0)
236 pr_err("%s: error disabling regulator s3\n", __func__);
237 regulator_put(s3);
238 s3 = NULL;
239 }
240}
241
242#define PM8901_MPP_3 (2) /* PM8901 MPP starts from 0 */
243
244static int config_class_d0_gpio(int enable)
245{
246 int rc;
247
248 if (enable) {
249 rc = pm8901_mpp_config_digital_out(PM8901_MPP_3,
250 PM8901_MPP_DIG_LEVEL_MSMIO, 1);
251
252 if (rc) {
253 pr_err("%s: CLASS_D0_EN failed\n", __func__);
254 return rc;
255 }
256
257 rc = gpio_request(SNDDEV_GPIO_CLASS_D0_EN, "CLASSD0_EN");
258
259 if (rc) {
260 pr_err("%s: spkr pamp gpio pm8901 mpp3 request"
261 "failed\n", __func__);
262 pm8901_mpp_config_digital_out(PM8901_MPP_3,
263 PM8901_MPP_DIG_LEVEL_MSMIO, 0);
264 return rc;
265 }
266
267 gpio_direction_output(SNDDEV_GPIO_CLASS_D0_EN, 1);
268 gpio_set_value(SNDDEV_GPIO_CLASS_D0_EN, 1);
269
270 } else {
271 pm8901_mpp_config_digital_out(PM8901_MPP_3,
272 PM8901_MPP_DIG_LEVEL_MSMIO, 0);
273 gpio_set_value(SNDDEV_GPIO_CLASS_D0_EN, 0);
274 gpio_free(SNDDEV_GPIO_CLASS_D0_EN);
275 }
276 return 0;
277}
278
279static atomic_t pamp_ref_cnt;
280
281static int msm_snddev_poweramp_on(void)
282{
283 int rc;
284
285 if (atomic_inc_return(&pamp_ref_cnt) > 1)
286 return 0;
287
288 pr_debug("%s: enable stereo spkr amp\n", __func__);
289 rc = config_class_d0_gpio(1);
290 if (rc) {
291 pr_err("%s: d0 gpio configuration failed\n", __func__);
292 goto config_gpio_fail;
293 }
294config_gpio_fail:
295 return rc;
296}
297
298static void msm_snddev_poweramp_off(void)
299{
300 if (atomic_dec_return(&pamp_ref_cnt) == 0) {
301 pr_debug("%s: disable stereo spkr amp\n", __func__);
302 config_class_d0_gpio(0);
303 msleep(30);
304 }
305}
306
307/* Regulator 8058_l10 supplies regulator 8058_ncp. */
308static struct regulator *snddev_reg_ncp;
309static struct regulator *snddev_reg_l10;
310
311static atomic_t preg_ref_cnt;
312
313static int msm_snddev_voltage_on(void)
314{
315 int rc;
316 pr_debug("%s\n", __func__);
317
318 if (atomic_inc_return(&preg_ref_cnt) > 1)
319 return 0;
320
321 snddev_reg_l10 = regulator_get(NULL, "8058_l10");
322 if (IS_ERR(snddev_reg_l10)) {
323 pr_err("%s: regulator_get(%s) failed (%ld)\n", __func__,
324 "l10", PTR_ERR(snddev_reg_l10));
325 return -EBUSY;
326 }
327
328 rc = regulator_set_voltage(snddev_reg_l10, 2600000, 2600000);
329 if (rc < 0)
330 pr_err("%s: regulator_set_voltage(l10) failed (%d)\n",
331 __func__, rc);
332
333 rc = regulator_enable(snddev_reg_l10);
334 if (rc < 0)
335 pr_err("%s: regulator_enable(l10) failed (%d)\n", __func__, rc);
336
337 snddev_reg_ncp = regulator_get(NULL, "8058_ncp");
338 if (IS_ERR(snddev_reg_ncp)) {
339 pr_err("%s: regulator_get(%s) failed (%ld)\n", __func__,
340 "ncp", PTR_ERR(snddev_reg_ncp));
341 return -EBUSY;
342 }
343
344 rc = regulator_set_voltage(snddev_reg_ncp, 1800000, 1800000);
345 if (rc < 0) {
346 pr_err("%s: regulator_set_voltage(ncp) failed (%d)\n",
347 __func__, rc);
348 goto regulator_fail;
349 }
350
351 rc = regulator_enable(snddev_reg_ncp);
352 if (rc < 0) {
353 pr_err("%s: regulator_enable(ncp) failed (%d)\n", __func__, rc);
354 goto regulator_fail;
355 }
356
357 return rc;
358
359regulator_fail:
360 regulator_put(snddev_reg_ncp);
361 snddev_reg_ncp = NULL;
362 return rc;
363}
364
365static void msm_snddev_voltage_off(void)
366{
367 int rc;
368 pr_debug("%s\n", __func__);
369
370 if (!snddev_reg_ncp)
371 goto done;
372
373 if (atomic_dec_return(&preg_ref_cnt) == 0) {
374 rc = regulator_disable(snddev_reg_ncp);
375 if (rc < 0)
376 pr_err("%s: regulator_disable(ncp) failed (%d)\n",
377 __func__, rc);
378 regulator_put(snddev_reg_ncp);
379
380 snddev_reg_ncp = NULL;
381 }
382
383done:
384 if (!snddev_reg_l10)
385 return;
386
387 rc = regulator_disable(snddev_reg_l10);
388 if (rc < 0)
389 pr_err("%s: regulator_disable(l10) failed (%d)\n",
390 __func__, rc);
391
392 regulator_put(snddev_reg_l10);
393
394 snddev_reg_l10 = NULL;
395}
396
397static int msm_snddev_enable_amic_power(void)
398{
399 int ret = 0;
400#ifdef CONFIG_PMIC8058_OTHC
401
402 if (machine_is_msm8x60_fluid()) {
403
404 ret = pm8058_micbias_enable(OTHC_MICBIAS_0,
405 OTHC_SIGNAL_ALWAYS_ON);
406 if (ret)
407 pr_err("%s: Enabling amic power failed\n", __func__);
408
409 ret = gpio_request(SNDDEV_GPIO_MIC2_ANCR_SEL, "MIC2_ANCR_SEL");
410 if (ret) {
411 pr_err("%s: spkr pamp gpio %d request failed\n",
412 __func__, SNDDEV_GPIO_MIC2_ANCR_SEL);
413 return ret;
414 }
415 gpio_direction_output(SNDDEV_GPIO_MIC2_ANCR_SEL, 0);
416
417 ret = gpio_request(SNDDEV_GPIO_MIC1_ANCL_SEL, "MIC1_ANCL_SEL");
418 if (ret) {
419 pr_err("%s: mic1 ancl gpio %d request failed\n",
420 __func__, SNDDEV_GPIO_MIC1_ANCL_SEL);
421 gpio_free(SNDDEV_GPIO_MIC2_ANCR_SEL);
422 return ret;
423 }
424 gpio_direction_output(SNDDEV_GPIO_MIC1_ANCL_SEL, 0);
425
426 } else {
427 ret = pm8058_micbias_enable(OTHC_MICBIAS_2,
428 OTHC_SIGNAL_ALWAYS_ON);
429 if (ret)
430 pr_err("%s: Enabling amic power failed\n", __func__);
431 }
432#endif
433 return ret;
434}
435
436static void msm_snddev_disable_amic_power(void)
437{
438#ifdef CONFIG_PMIC8058_OTHC
439 int ret;
440 if (machine_is_msm8x60_fluid()) {
441 ret = pm8058_micbias_enable(OTHC_MICBIAS_0,
442 OTHC_SIGNAL_OFF);
443 gpio_free(SNDDEV_GPIO_MIC1_ANCL_SEL);
444 gpio_free(SNDDEV_GPIO_MIC2_ANCR_SEL);
445 } else
446 ret = pm8058_micbias_enable(OTHC_MICBIAS_2, OTHC_SIGNAL_OFF);
447
448 if (ret)
449 pr_err("%s: Disabling amic power failed\n", __func__);
450#endif
451}
452
453static int msm_snddev_enable_anc_power(void)
454{
455 int ret = 0;
456#ifdef CONFIG_PMIC8058_OTHC
457 ret = pm8058_micbias_enable(OTHC_MICBIAS_2,
458 OTHC_SIGNAL_ALWAYS_ON);
459 if (ret)
460 pr_err("%s: Enabling anc micbias 2 failed\n", __func__);
461
462 if (machine_is_msm8x60_fluid()) {
463
464 ret = pm8058_micbias_enable(OTHC_MICBIAS_0,
465 OTHC_SIGNAL_ALWAYS_ON);
466 if (ret)
467 pr_err("%s: Enabling anc micbias 0 failed\n", __func__);
468
469 ret = gpio_request(SNDDEV_GPIO_MIC2_ANCR_SEL, "MIC2_ANCR_SEL");
470 if (ret) {
471 pr_err("%s: mic2 ancr gpio %d request failed\n",
472 __func__, SNDDEV_GPIO_MIC2_ANCR_SEL);
473 return ret;
474 }
475 gpio_direction_output(SNDDEV_GPIO_MIC2_ANCR_SEL, 1);
476
477 ret = gpio_request(SNDDEV_GPIO_MIC1_ANCL_SEL, "MIC1_ANCL_SEL");
478 if (ret) {
479 pr_err("%s: mic1 ancl gpio %d request failed\n",
480 __func__, SNDDEV_GPIO_MIC1_ANCL_SEL);
481 gpio_free(SNDDEV_GPIO_MIC2_ANCR_SEL);
482 return ret;
483 }
484 gpio_direction_output(SNDDEV_GPIO_MIC1_ANCL_SEL, 1);
485
486 }
487#endif
488 return ret;
489}
490
491static void msm_snddev_disable_anc_power(void)
492{
493#ifdef CONFIG_PMIC8058_OTHC
494 int ret;
495
496 ret = pm8058_micbias_enable(OTHC_MICBIAS_2, OTHC_SIGNAL_OFF);
497
498 if (machine_is_msm8x60_fluid()) {
499 ret |= pm8058_micbias_enable(OTHC_MICBIAS_0,
500 OTHC_SIGNAL_OFF);
501 gpio_free(SNDDEV_GPIO_MIC2_ANCR_SEL);
502 gpio_free(SNDDEV_GPIO_MIC1_ANCL_SEL);
503 }
504
505 if (ret)
506 pr_err("%s: Disabling anc power failed\n", __func__);
507#endif
508}
509
510static int msm_snddev_enable_dmic_sec_power(void)
511{
512 int ret;
513
514 ret = msm_snddev_enable_dmic_power();
515 if (ret) {
516 pr_err("%s: Error: Enabling dmic power failed\n", __func__);
517 return ret;
518 }
519#ifdef CONFIG_PMIC8058_OTHC
520 ret = pm8058_micbias_enable(OTHC_MICBIAS_2, OTHC_SIGNAL_ALWAYS_ON);
521 if (ret) {
522 pr_err("%s: Error: Enabling micbias failed\n", __func__);
523 msm_snddev_disable_dmic_power();
524 return ret;
525 }
526#endif
527 return 0;
528}
529
530static void msm_snddev_disable_dmic_sec_power(void)
531{
532 msm_snddev_disable_dmic_power();
533
534#ifdef CONFIG_PMIC8058_OTHC
535 pm8058_micbias_enable(OTHC_MICBIAS_2, OTHC_SIGNAL_OFF);
536#endif
537}
538
539static struct adie_codec_action_unit iearpiece_48KHz_osr256_actions[] =
540 EAR_PRI_MONO_8000_OSR_256;
541
542static struct adie_codec_hwsetting_entry iearpiece_settings[] = {
543 {
544 .freq_plan = 48000,
545 .osr = 256,
546 .actions = iearpiece_48KHz_osr256_actions,
547 .action_sz = ARRAY_SIZE(iearpiece_48KHz_osr256_actions),
548 }
549};
550
551static struct adie_codec_dev_profile iearpiece_profile = {
552 .path_type = ADIE_CODEC_RX,
553 .settings = iearpiece_settings,
554 .setting_sz = ARRAY_SIZE(iearpiece_settings),
555};
556
557static struct snddev_icodec_data snddev_iearpiece_data = {
558 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
559 .name = "handset_rx",
560 .copp_id = 0,
561 .profile = &iearpiece_profile,
562 .channel_mode = 1,
563 .default_sample_rate = 48000,
564};
565
566static struct platform_device msm_iearpiece_device = {
567 .name = "snddev_icodec",
568 .dev = { .platform_data = &snddev_iearpiece_data },
569};
570
571static struct adie_codec_action_unit imic_48KHz_osr256_actions[] =
572 AMIC_PRI_MONO_OSR_256;
573
574static struct adie_codec_hwsetting_entry imic_settings[] = {
575 {
576 .freq_plan = 48000,
577 .osr = 256,
578 .actions = imic_48KHz_osr256_actions,
579 .action_sz = ARRAY_SIZE(imic_48KHz_osr256_actions),
580 }
581};
582
583static struct adie_codec_dev_profile imic_profile = {
584 .path_type = ADIE_CODEC_TX,
585 .settings = imic_settings,
586 .setting_sz = ARRAY_SIZE(imic_settings),
587};
588
589static struct snddev_icodec_data snddev_imic_data = {
590 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
591 .name = "handset_tx",
592 .copp_id = 1,
593 .profile = &imic_profile,
594 .channel_mode = 1,
595 .default_sample_rate = 48000,
596 .pamp_on = msm_snddev_enable_amic_power,
597 .pamp_off = msm_snddev_disable_amic_power,
598};
599
600static struct platform_device msm_imic_device = {
601 .name = "snddev_icodec",
602 .dev = { .platform_data = &snddev_imic_data },
603};
604
605static struct snddev_icodec_data snddev_fluid_ispkr_mic_data = {
606 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
607 .name = "speaker_mono_tx",
608 .copp_id = PRIMARY_I2S_TX,
609 .profile = &imic_profile,
610 .channel_mode = 1,
611 .default_sample_rate = 48000,
612 .pamp_on = msm_snddev_enable_amic_power,
613 .pamp_off = msm_snddev_disable_amic_power,
614};
615
616static struct platform_device msm_fluid_ispkr_mic_device = {
617 .name = "snddev_icodec",
618 .dev = { .platform_data = &snddev_fluid_ispkr_mic_data },
619};
620
621
622static struct adie_codec_action_unit headset_ab_cpls_48KHz_osr256_actions[] =
623 HEADSET_AB_CPLS_48000_OSR_256;
624
625static struct adie_codec_hwsetting_entry headset_ab_cpls_settings[] = {
626 {
627 .freq_plan = 48000,
628 .osr = 256,
629 .actions = headset_ab_cpls_48KHz_osr256_actions,
630 .action_sz = ARRAY_SIZE(headset_ab_cpls_48KHz_osr256_actions),
631 }
632};
633
634static struct adie_codec_dev_profile headset_ab_cpls_profile = {
635 .path_type = ADIE_CODEC_RX,
636 .settings = headset_ab_cpls_settings,
637 .setting_sz = ARRAY_SIZE(headset_ab_cpls_settings),
638};
639
640static struct snddev_icodec_data snddev_ihs_stereo_rx_data = {
641 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
642 .name = "headset_stereo_rx",
643 .copp_id = 0,
644 .profile = &headset_ab_cpls_profile,
645 .channel_mode = 2,
646 .default_sample_rate = 48000,
647 .voltage_on = msm_snddev_voltage_on,
648 .voltage_off = msm_snddev_voltage_off,
649};
650
651static struct platform_device msm_headset_stereo_device = {
652 .name = "snddev_icodec",
653 .dev = { .platform_data = &snddev_ihs_stereo_rx_data },
654};
655
656static struct adie_codec_action_unit headset_anc_48KHz_osr256_actions[] =
657 ANC_HEADSET_CPLS_AMIC1_AUXL_RX1_48000_OSR_256;
658
659static struct adie_codec_hwsetting_entry headset_anc_settings[] = {
660 {
661 .freq_plan = 48000,
662 .osr = 256,
663 .actions = headset_anc_48KHz_osr256_actions,
664 .action_sz = ARRAY_SIZE(headset_anc_48KHz_osr256_actions),
665 }
666};
667
668static struct adie_codec_dev_profile headset_anc_profile = {
669 .path_type = ADIE_CODEC_RX,
670 .settings = headset_anc_settings,
671 .setting_sz = ARRAY_SIZE(headset_anc_settings),
672};
673
674static struct snddev_icodec_data snddev_anc_headset_data = {
675 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE | SNDDEV_CAP_ANC),
676 .name = "anc_headset_stereo_rx",
677 .copp_id = PRIMARY_I2S_RX,
678 .profile = &headset_anc_profile,
679 .channel_mode = 2,
680 .default_sample_rate = 48000,
681 .pamp_on = msm_snddev_enable_anc_power,
682 .pamp_off = msm_snddev_disable_anc_power,
683 .voltage_on = msm_snddev_voltage_on,
684 .voltage_off = msm_snddev_voltage_off,
685};
686
687static struct platform_device msm_anc_headset_device = {
688 .name = "snddev_icodec",
689 .dev = { .platform_data = &snddev_anc_headset_data },
690};
691
692static struct adie_codec_action_unit ispkr_stereo_48KHz_osr256_actions[] =
693 SPEAKER_PRI_STEREO_48000_OSR_256;
694
695static struct adie_codec_hwsetting_entry ispkr_stereo_settings[] = {
696 {
697 .freq_plan = 48000,
698 .osr = 256,
699 .actions = ispkr_stereo_48KHz_osr256_actions,
700 .action_sz = ARRAY_SIZE(ispkr_stereo_48KHz_osr256_actions),
701 }
702};
703
704static struct adie_codec_dev_profile ispkr_stereo_profile = {
705 .path_type = ADIE_CODEC_RX,
706 .settings = ispkr_stereo_settings,
707 .setting_sz = ARRAY_SIZE(ispkr_stereo_settings),
708};
709
710static struct snddev_icodec_data snddev_ispkr_stereo_data = {
711 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
712 .name = "speaker_stereo_rx",
713 .copp_id = 0,
714 .profile = &ispkr_stereo_profile,
715 .channel_mode = 2,
716 .default_sample_rate = 48000,
717 .pamp_on = msm_snddev_poweramp_on,
718 .pamp_off = msm_snddev_poweramp_off,
719};
720
721static struct platform_device msm_ispkr_stereo_device = {
722 .name = "snddev_icodec",
723 .dev = { .platform_data = &snddev_ispkr_stereo_data },
724};
725
726static struct adie_codec_action_unit idmic_mono_48KHz_osr256_actions[] =
727 DMIC1_PRI_MONO_OSR_256;
728
729static struct adie_codec_hwsetting_entry idmic_mono_settings[] = {
730 {
731 .freq_plan = 48000,
732 .osr = 256,
733 .actions = idmic_mono_48KHz_osr256_actions,
734 .action_sz = ARRAY_SIZE(idmic_mono_48KHz_osr256_actions),
735 }
736};
737
738static struct adie_codec_dev_profile idmic_mono_profile = {
739 .path_type = ADIE_CODEC_TX,
740 .settings = idmic_mono_settings,
741 .setting_sz = ARRAY_SIZE(idmic_mono_settings),
742};
743
744static struct snddev_icodec_data snddev_ispkr_mic_data = {
745 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
746 .name = "speaker_mono_tx",
747 .copp_id = PRIMARY_I2S_TX,
748 .profile = &idmic_mono_profile,
749 .channel_mode = 1,
750 .default_sample_rate = 48000,
751 .pamp_on = msm_snddev_enable_dmic_power,
752 .pamp_off = msm_snddev_disable_dmic_power,
753};
754
755static struct platform_device msm_ispkr_mic_device = {
756 .name = "snddev_icodec",
757 .dev = { .platform_data = &snddev_ispkr_mic_data },
758};
759
760static struct adie_codec_action_unit iearpiece_ffa_48KHz_osr256_actions[] =
761 EAR_PRI_MONO_8000_OSR_256;
762
763static struct adie_codec_hwsetting_entry iearpiece_ffa_settings[] = {
764 {
765 .freq_plan = 48000,
766 .osr = 256,
767 .actions = iearpiece_ffa_48KHz_osr256_actions,
768 .action_sz = ARRAY_SIZE(iearpiece_ffa_48KHz_osr256_actions),
769 }
770};
771
772static struct adie_codec_dev_profile iearpiece_ffa_profile = {
773 .path_type = ADIE_CODEC_RX,
774 .settings = iearpiece_ffa_settings,
775 .setting_sz = ARRAY_SIZE(iearpiece_ffa_settings),
776};
777
778static struct snddev_icodec_data snddev_iearpiece_ffa_data = {
779 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
780 .name = "handset_rx",
781 .copp_id = 0,
782 .profile = &iearpiece_ffa_profile,
783 .channel_mode = 1,
784 .default_sample_rate = 48000,
785};
786
787static struct platform_device msm_iearpiece_ffa_device = {
788 .name = "snddev_icodec",
789 .dev = { .platform_data = &snddev_iearpiece_ffa_data },
790};
791
792static struct snddev_icodec_data snddev_imic_ffa_data = {
793 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
794 .name = "handset_tx",
795 .copp_id = PRIMARY_I2S_TX,
796 .profile = &idmic_mono_profile,
797 .channel_mode = 1,
798 .default_sample_rate = 48000,
799 .pamp_on = msm_snddev_enable_dmic_power,
800 .pamp_off = msm_snddev_disable_dmic_power,
801};
802
803static struct platform_device msm_imic_ffa_device = {
804 .name = "snddev_icodec",
805 .dev = { .platform_data = &snddev_imic_ffa_data },
806};
807
808static struct adie_codec_action_unit dual_mic_endfire_8KHz_osr256_actions[] =
809 DMIC1_PRI_STEREO_OSR_256;
810
811static struct adie_codec_hwsetting_entry dual_mic_endfire_settings[] = {
812 {
813 .freq_plan = 48000,
814 .osr = 256,
815 .actions = dual_mic_endfire_8KHz_osr256_actions,
816 .action_sz = ARRAY_SIZE(dual_mic_endfire_8KHz_osr256_actions),
817 }
818};
819
820static struct adie_codec_dev_profile dual_mic_endfire_profile = {
821 .path_type = ADIE_CODEC_TX,
822 .settings = dual_mic_endfire_settings,
823 .setting_sz = ARRAY_SIZE(dual_mic_endfire_settings),
824};
825
826static struct snddev_icodec_data snddev_dual_mic_endfire_data = {
827 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
828 .name = "handset_dual_mic_endfire_tx",
829 .copp_id = PRIMARY_I2S_TX,
830 .profile = &dual_mic_endfire_profile,
831 .channel_mode = 2,
832 .default_sample_rate = 48000,
833 .pamp_on = msm_snddev_enable_dmic_power,
834 .pamp_off = msm_snddev_disable_dmic_power,
835};
836
837static struct platform_device msm_hs_dual_mic_endfire_device = {
838 .name = "snddev_icodec",
839 .dev = { .platform_data = &snddev_dual_mic_endfire_data },
840};
841
842static struct snddev_icodec_data snddev_dual_mic_spkr_endfire_data = {
843 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
844 .name = "speaker_dual_mic_endfire_tx",
845 .copp_id = PRIMARY_I2S_TX,
846 .profile = &dual_mic_endfire_profile,
847 .channel_mode = 2,
848 .default_sample_rate = 48000,
849 .pamp_on = msm_snddev_enable_dmic_power,
850 .pamp_off = msm_snddev_disable_dmic_power,
851};
852
853static struct platform_device msm_spkr_dual_mic_endfire_device = {
854 .name = "snddev_icodec",
855 .id = 15,
856 .dev = { .platform_data = &snddev_dual_mic_spkr_endfire_data },
857};
858
859static struct adie_codec_action_unit dual_mic_broadside_8osr256_actions[] =
860 HS_DMIC2_STEREO_OSR_256;
861
862static struct adie_codec_hwsetting_entry dual_mic_broadside_settings[] = {
863 {
864 .freq_plan = 48000,
865 .osr = 256,
866 .actions = dual_mic_broadside_8osr256_actions,
867 .action_sz = ARRAY_SIZE(dual_mic_broadside_8osr256_actions),
868 }
869};
870
871static struct adie_codec_dev_profile dual_mic_broadside_profile = {
872 .path_type = ADIE_CODEC_TX,
873 .settings = dual_mic_broadside_settings,
874 .setting_sz = ARRAY_SIZE(dual_mic_broadside_settings),
875};
876
877static struct snddev_icodec_data snddev_hs_dual_mic_broadside_data = {
878 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
879 .name = "handset_dual_mic_broadside_tx",
880 .copp_id = PRIMARY_I2S_TX,
881 .profile = &dual_mic_broadside_profile,
882 .channel_mode = 2,
883 .default_sample_rate = 48000,
884 .pamp_on = msm_snddev_enable_dmic_sec_power,
885 .pamp_off = msm_snddev_disable_dmic_sec_power,
886};
887
888static struct platform_device msm_hs_dual_mic_broadside_device = {
889 .name = "snddev_icodec",
890 .id = 21,
891 .dev = { .platform_data = &snddev_hs_dual_mic_broadside_data },
892};
893
894static struct snddev_icodec_data snddev_spkr_dual_mic_broadside_data = {
895 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
896 .name = "speaker_dual_mic_broadside_tx",
897 .copp_id = PRIMARY_I2S_TX,
898 .profile = &dual_mic_broadside_profile,
899 .channel_mode = 2,
900 .default_sample_rate = 48000,
901 .pamp_on = msm_snddev_enable_dmic_sec_power,
902 .pamp_off = msm_snddev_disable_dmic_sec_power,
903};
904
905static struct platform_device msm_spkr_dual_mic_broadside_device = {
906 .name = "snddev_icodec",
907 .id = 18,
908 .dev = { .platform_data = &snddev_spkr_dual_mic_broadside_data },
909};
910
911static struct snddev_hdmi_data snddev_hdmi_stereo_rx_data = {
912 .capability = SNDDEV_CAP_RX ,
913 .name = "hdmi_stereo_rx",
914 .copp_id = HDMI_RX,
915 .channel_mode = 0,
916 .default_sample_rate = 48000,
917};
918
919static struct platform_device msm_snddev_hdmi_stereo_rx_device = {
920 .name = "snddev_hdmi",
921 .dev = { .platform_data = &snddev_hdmi_stereo_rx_data },
922};
923
924static struct snddev_mi2s_data snddev_mi2s_fm_tx_data = {
925 .capability = SNDDEV_CAP_TX ,
926 .name = "fmradio_stereo_tx",
927 .copp_id = MI2S_TX,
928 .channel_mode = 2, /* stereo */
929 .sd_lines = MI2S_SD3, /* sd3 */
930 .sample_rate = 48000,
931};
932
933static struct platform_device msm_mi2s_fm_tx_device = {
934 .name = "snddev_mi2s",
935 .dev = { .platform_data = &snddev_mi2s_fm_tx_data },
936};
937
938static struct snddev_mi2s_data snddev_mi2s_fm_rx_data = {
939 .capability = SNDDEV_CAP_RX ,
940 .name = "fmradio_stereo_rx",
941 .copp_id = MI2S_RX,
942 .channel_mode = 2, /* stereo */
943 .sd_lines = MI2S_SD3, /* sd3 */
944 .sample_rate = 48000,
945};
946
947static struct platform_device msm_mi2s_fm_rx_device = {
948 .name = "snddev_mi2s",
949 .id = 1,
950 .dev = { .platform_data = &snddev_mi2s_fm_rx_data },
951};
952
953static struct adie_codec_action_unit iheadset_mic_tx_osr256_actions[] =
954 HEADSET_AMIC2_TX_MONO_PRI_OSR_256;
955
956static struct adie_codec_hwsetting_entry iheadset_mic_tx_settings[] = {
957 {
958 .freq_plan = 48000,
959 .osr = 256,
960 .actions = iheadset_mic_tx_osr256_actions,
961 .action_sz = ARRAY_SIZE(iheadset_mic_tx_osr256_actions),
962 }
963};
964
965static struct adie_codec_dev_profile iheadset_mic_profile = {
966 .path_type = ADIE_CODEC_TX,
967 .settings = iheadset_mic_tx_settings,
968 .setting_sz = ARRAY_SIZE(iheadset_mic_tx_settings),
969};
970
971static struct snddev_icodec_data snddev_headset_mic_data = {
972 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
973 .name = "headset_mono_tx",
974 .copp_id = PRIMARY_I2S_TX,
975 .profile = &iheadset_mic_profile,
976 .channel_mode = 1,
977 .default_sample_rate = 48000,
978};
979
980static struct platform_device msm_headset_mic_device = {
981 .name = "snddev_icodec",
982 .dev = { .platform_data = &snddev_headset_mic_data },
983};
984
985static struct adie_codec_action_unit
986 ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions[] =
987 SPEAKER_HPH_AB_CPL_PRI_STEREO_48000_OSR_256;
988
989static struct adie_codec_hwsetting_entry
990 ihs_stereo_speaker_stereo_rx_settings[] = {
991 {
992 .freq_plan = 48000,
993 .osr = 256,
994 .actions = ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions,
995 .action_sz =
996 ARRAY_SIZE(ihs_stereo_speaker_stereo_rx_48KHz_osr256_actions),
997 }
998};
999
1000static struct adie_codec_dev_profile ihs_stereo_speaker_stereo_rx_profile = {
1001 .path_type = ADIE_CODEC_RX,
1002 .settings = ihs_stereo_speaker_stereo_rx_settings,
1003 .setting_sz = ARRAY_SIZE(ihs_stereo_speaker_stereo_rx_settings),
1004};
1005
1006static struct snddev_icodec_data snddev_ihs_stereo_speaker_stereo_rx_data = {
1007 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1008 .name = "headset_stereo_speaker_stereo_rx",
1009 .copp_id = 0,
1010 .profile = &ihs_stereo_speaker_stereo_rx_profile,
1011 .channel_mode = 2,
1012 .default_sample_rate = 48000,
1013 .pamp_on = msm_snddev_poweramp_on,
1014 .pamp_off = msm_snddev_poweramp_off,
1015 .voltage_on = msm_snddev_voltage_on,
1016 .voltage_off = msm_snddev_voltage_off,
1017};
1018
1019static struct platform_device msm_ihs_stereo_speaker_stereo_rx_device = {
1020 .name = "snddev_icodec",
1021 .id = 22,
1022 .dev = { .platform_data = &snddev_ihs_stereo_speaker_stereo_rx_data },
1023};
1024
1025/* define the value for BT_SCO */
1026
1027static struct snddev_ecodec_data snddev_bt_sco_earpiece_data = {
1028 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1029 .name = "bt_sco_rx",
1030 .copp_id = PCM_RX,
1031 .channel_mode = 1,
1032};
1033
1034static struct snddev_ecodec_data snddev_bt_sco_mic_data = {
1035 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
1036 .name = "bt_sco_tx",
1037 .copp_id = PCM_TX,
1038 .channel_mode = 1,
1039};
1040
1041struct platform_device msm_bt_sco_earpiece_device = {
1042 .name = "msm_snddev_ecodec",
1043 .dev = { .platform_data = &snddev_bt_sco_earpiece_data },
1044};
1045
1046struct platform_device msm_bt_sco_mic_device = {
1047 .name = "msm_snddev_ecodec",
1048 .dev = { .platform_data = &snddev_bt_sco_mic_data },
1049};
1050
1051static struct adie_codec_action_unit itty_mono_tx_actions[] =
1052 TTY_HEADSET_MONO_TX_OSR_256;
1053
1054static struct adie_codec_hwsetting_entry itty_mono_tx_settings[] = {
1055 {
1056 .freq_plan = 48000,
1057 .osr = 256,
1058 .actions = itty_mono_tx_actions,
1059 .action_sz = ARRAY_SIZE(itty_mono_tx_actions),
1060 },
1061};
1062
1063static struct adie_codec_dev_profile itty_mono_tx_profile = {
1064 .path_type = ADIE_CODEC_TX,
1065 .settings = itty_mono_tx_settings,
1066 .setting_sz = ARRAY_SIZE(itty_mono_tx_settings),
1067};
1068
1069static struct snddev_icodec_data snddev_itty_mono_tx_data = {
1070 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE | SNDDEV_CAP_TTY),
1071 .name = "tty_headset_mono_tx",
1072 .copp_id = PRIMARY_I2S_TX,
1073 .profile = &itty_mono_tx_profile,
1074 .channel_mode = 1,
1075 .default_sample_rate = 48000,
1076};
1077
1078static struct platform_device msm_itty_mono_tx_device = {
1079 .name = "snddev_icodec",
1080 .dev = { .platform_data = &snddev_itty_mono_tx_data },
1081};
1082
1083static struct adie_codec_action_unit itty_mono_rx_actions[] =
1084 TTY_HEADSET_MONO_RX_8000_OSR_256;
1085
1086static struct adie_codec_hwsetting_entry itty_mono_rx_settings[] = {
1087 {
1088 .freq_plan = 48000,
1089 .osr = 256,
1090 .actions = itty_mono_rx_actions,
1091 .action_sz = ARRAY_SIZE(itty_mono_rx_actions),
1092 },
1093};
1094
1095static struct adie_codec_dev_profile itty_mono_rx_profile = {
1096 .path_type = ADIE_CODEC_RX,
1097 .settings = itty_mono_rx_settings,
1098 .setting_sz = ARRAY_SIZE(itty_mono_rx_settings),
1099};
1100
1101static struct snddev_icodec_data snddev_itty_mono_rx_data = {
1102 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE | SNDDEV_CAP_TTY),
1103 .name = "tty_headset_mono_rx",
1104 .copp_id = PRIMARY_I2S_RX,
1105 .profile = &itty_mono_rx_profile,
1106 .channel_mode = 1,
1107 .default_sample_rate = 48000,
1108 .voltage_on = msm_snddev_voltage_on,
1109 .voltage_off = msm_snddev_voltage_off,
1110};
1111
1112static struct platform_device msm_itty_mono_rx_device = {
1113 .name = "snddev_icodec",
1114 .dev = { .platform_data = &snddev_itty_mono_rx_data },
1115};
1116
1117static struct adie_codec_action_unit linein_pri_actions[] =
1118 LINEIN_PRI_STEREO_OSR_256;
1119
1120static struct adie_codec_hwsetting_entry linein_pri_settings[] = {
1121 {
1122 .freq_plan = 48000,
1123 .osr = 256,
1124 .actions = linein_pri_actions,
1125 .action_sz = ARRAY_SIZE(linein_pri_actions),
1126 },
1127};
1128
1129static struct adie_codec_dev_profile linein_pri_profile = {
1130 .path_type = ADIE_CODEC_TX,
1131 .settings = linein_pri_settings,
1132 .setting_sz = ARRAY_SIZE(linein_pri_settings),
1133};
1134
1135static struct snddev_icodec_data snddev_linein_pri_data = {
1136 .capability = SNDDEV_CAP_TX,
1137 .name = "linein_pri_tx",
1138 .copp_id = PRIMARY_I2S_TX,
1139 .profile = &linein_pri_profile,
1140 .channel_mode = 2,
1141 .default_sample_rate = 48000,
1142 .voltage_on = msm_snddev_voltage_on,
1143 .voltage_off = msm_snddev_voltage_off,
1144};
1145
1146static struct platform_device msm_linein_pri_device = {
1147 .name = "snddev_icodec",
1148 .dev = { .platform_data = &snddev_linein_pri_data },
1149};
1150
1151static struct adie_codec_action_unit auxpga_lp_lo_actions[] =
1152 LB_AUXPGA_LO_STEREO;
1153
1154static struct adie_codec_hwsetting_entry auxpga_lp_lo_settings[] = {
1155 {
1156 .freq_plan = 48000,
1157 .osr = 256,
1158 .actions = auxpga_lp_lo_actions,
1159 .action_sz = ARRAY_SIZE(auxpga_lp_lo_actions),
1160 },
1161};
1162
1163static struct adie_codec_dev_profile auxpga_lp_lo_profile = {
1164 .path_type = ADIE_CODEC_LB,
1165 .settings = auxpga_lp_lo_settings,
1166 .setting_sz = ARRAY_SIZE(auxpga_lp_lo_settings),
1167};
1168
1169static struct snddev_icodec_data snddev_auxpga_lp_lo_data = {
1170 .capability = SNDDEV_CAP_LB,
1171 .name = "speaker_stereo_lb",
1172 .copp_id = PRIMARY_I2S_RX,
1173 .profile = &auxpga_lp_lo_profile,
1174 .channel_mode = 2,
1175 .default_sample_rate = 48000,
1176 .pamp_on = msm_snddev_poweramp_on,
1177 .pamp_off = msm_snddev_poweramp_off,
1178 .dev_vol_type = SNDDEV_DEV_VOL_ANALOG,
1179};
1180
1181static struct platform_device msm_auxpga_lp_lo_device = {
1182 .name = "snddev_icodec",
1183 .dev = { .platform_data = &snddev_auxpga_lp_lo_data },
1184};
1185
1186static struct adie_codec_action_unit auxpga_lp_hs_actions[] =
1187 LB_AUXPGA_HPH_AB_CPLS_STEREO;
1188
1189static struct adie_codec_hwsetting_entry auxpga_lp_hs_settings[] = {
1190 {
1191 .freq_plan = 48000,
1192 .osr = 256,
1193 .actions = auxpga_lp_hs_actions,
1194 .action_sz = ARRAY_SIZE(auxpga_lp_hs_actions),
1195 },
1196};
1197
1198static struct adie_codec_dev_profile auxpga_lp_hs_profile = {
1199 .path_type = ADIE_CODEC_LB,
1200 .settings = auxpga_lp_hs_settings,
1201 .setting_sz = ARRAY_SIZE(auxpga_lp_hs_settings),
1202};
1203
1204static struct snddev_icodec_data snddev_auxpga_lp_hs_data = {
1205 .capability = SNDDEV_CAP_LB,
1206 .name = "hs_stereo_lb",
1207 .copp_id = PRIMARY_I2S_RX,
1208 .profile = &auxpga_lp_hs_profile,
1209 .channel_mode = 2,
1210 .default_sample_rate = 48000,
1211 .voltage_on = msm_snddev_voltage_on,
1212 .voltage_off = msm_snddev_voltage_off,
1213 .dev_vol_type = SNDDEV_DEV_VOL_ANALOG,
1214};
1215
1216static struct platform_device msm_auxpga_lp_hs_device = {
1217 .name = "snddev_icodec",
1218 .dev = { .platform_data = &snddev_auxpga_lp_hs_data },
1219};
1220
1221#ifdef CONFIG_MSM8X60_FTM_AUDIO_DEVICES
1222static struct adie_codec_action_unit ftm_headset_mono_rx_actions[] =
1223 HPH_PRI_AB_CPLS_MONO;
1224
1225static struct adie_codec_hwsetting_entry ftm_headset_mono_rx_settings[] = {
1226 {
1227 .freq_plan = 48000,
1228 .osr = 256,
1229 .actions = ftm_headset_mono_rx_actions,
1230 .action_sz = ARRAY_SIZE(ftm_headset_mono_rx_actions),
1231 },
1232};
1233
1234static struct adie_codec_dev_profile ftm_headset_mono_rx_profile = {
1235 .path_type = ADIE_CODEC_RX,
1236 .settings = ftm_headset_mono_rx_settings,
1237 .setting_sz = ARRAY_SIZE(ftm_headset_mono_rx_settings),
1238};
1239
1240static struct snddev_icodec_data ftm_headset_mono_rx_data = {
1241 .capability = SNDDEV_CAP_RX,
1242 .name = "ftm_headset_mono_rx",
1243 .copp_id = PRIMARY_I2S_RX,
1244 .profile = &ftm_headset_mono_rx_profile,
1245 .channel_mode = 1,
1246 .default_sample_rate = 48000,
1247 .voltage_on = msm_snddev_voltage_on,
1248 .voltage_off = msm_snddev_voltage_off,
1249 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1250};
1251
1252static struct platform_device ftm_headset_mono_rx_device = {
1253 .name = "snddev_icodec",
1254 .dev = { .platform_data = &ftm_headset_mono_rx_data},
1255};
1256
1257static struct adie_codec_action_unit ftm_headset_mono_diff_rx_actions[] =
1258 HEADSET_MONO_DIFF_RX;
1259
1260static struct adie_codec_hwsetting_entry ftm_headset_mono_diff_rx_settings[] = {
1261 {
1262 .freq_plan = 48000,
1263 .osr = 256,
1264 .actions = ftm_headset_mono_diff_rx_actions,
1265 .action_sz = ARRAY_SIZE(ftm_headset_mono_diff_rx_actions),
1266 },
1267};
1268
1269static struct adie_codec_dev_profile ftm_headset_mono_diff_rx_profile = {
1270 .path_type = ADIE_CODEC_RX,
1271 .settings = ftm_headset_mono_diff_rx_settings,
1272 .setting_sz = ARRAY_SIZE(ftm_headset_mono_diff_rx_settings),
1273};
1274
1275static struct snddev_icodec_data ftm_headset_mono_diff_rx_data = {
1276 .capability = SNDDEV_CAP_RX,
1277 .name = "ftm_headset_mono_diff_rx",
1278 .copp_id = PRIMARY_I2S_RX,
1279 .profile = &ftm_headset_mono_diff_rx_profile,
1280 .channel_mode = 1,
1281 .default_sample_rate = 48000,
1282 .voltage_on = msm_snddev_voltage_on,
1283 .voltage_off = msm_snddev_voltage_off,
1284 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1285};
1286
1287static struct platform_device ftm_headset_mono_diff_rx_device = {
1288 .name = "snddev_icodec",
1289 .dev = { .platform_data = &ftm_headset_mono_diff_rx_data},
1290};
1291
1292static struct adie_codec_action_unit ftm_spkr_mono_rx_actions[] =
1293 SPEAKER_PRI_STEREO_48000_OSR_256;
1294
1295static struct adie_codec_hwsetting_entry ftm_spkr_mono_rx_settings[] = {
1296 {
1297 .freq_plan = 48000,
1298 .osr = 256,
1299 .actions = ftm_spkr_mono_rx_actions,
1300 .action_sz = ARRAY_SIZE(ftm_spkr_mono_rx_actions),
1301 },
1302};
1303
1304static struct adie_codec_dev_profile ftm_spkr_mono_rx_profile = {
1305 .path_type = ADIE_CODEC_RX,
1306 .settings = ftm_spkr_mono_rx_settings,
1307 .setting_sz = ARRAY_SIZE(ftm_spkr_mono_rx_settings),
1308};
1309
1310static struct snddev_icodec_data ftm_spkr_mono_rx_data = {
1311 .capability = SNDDEV_CAP_RX,
1312 .name = "ftm_spkr_mono_rx",
1313 .copp_id = PRIMARY_I2S_RX,
1314 .profile = &ftm_spkr_mono_rx_profile,
1315 .channel_mode = 1,
1316 .default_sample_rate = 48000,
1317 .pamp_on = msm_snddev_poweramp_on,
1318 .pamp_off = msm_snddev_poweramp_off,
1319 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1320};
1321
1322static struct platform_device ftm_spkr_mono_rx_device = {
1323 .name = "snddev_icodec",
1324 .dev = { .platform_data = &ftm_spkr_mono_rx_data},
1325};
1326
1327static struct adie_codec_action_unit ftm_spkr_l_rx_actions[] =
1328 FTM_SPKR_L_RX;
1329
1330static struct adie_codec_hwsetting_entry ftm_spkr_l_rx_settings[] = {
1331 {
1332 .freq_plan = 48000,
1333 .osr = 256,
1334 .actions = ftm_spkr_l_rx_actions,
1335 .action_sz = ARRAY_SIZE(ftm_spkr_l_rx_actions),
1336 },
1337};
1338
1339static struct adie_codec_dev_profile ftm_spkr_l_rx_profile = {
1340 .path_type = ADIE_CODEC_RX,
1341 .settings = ftm_spkr_l_rx_settings,
1342 .setting_sz = ARRAY_SIZE(ftm_spkr_l_rx_settings),
1343};
1344
1345static struct snddev_icodec_data ftm_spkr_l_rx_data = {
1346 .capability = SNDDEV_CAP_RX,
1347 .name = "ftm_spkr_l_rx",
1348 .copp_id = PRIMARY_I2S_RX,
1349 .profile = &ftm_spkr_l_rx_profile,
1350 .channel_mode = 1,
1351 .default_sample_rate = 48000,
1352 .pamp_on = msm_snddev_poweramp_on,
1353 .pamp_off = msm_snddev_poweramp_off,
1354 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1355};
1356
1357static struct platform_device ftm_spkr_l_rx_device = {
1358 .name = "snddev_icodec",
1359 .dev = { .platform_data = &ftm_spkr_l_rx_data},
1360};
1361
1362static struct adie_codec_action_unit ftm_spkr_r_rx_actions[] =
1363 SPKR_R_RX;
1364
1365static struct adie_codec_hwsetting_entry ftm_spkr_r_rx_settings[] = {
1366 {
1367 .freq_plan = 48000,
1368 .osr = 256,
1369 .actions = ftm_spkr_r_rx_actions,
1370 .action_sz = ARRAY_SIZE(ftm_spkr_r_rx_actions),
1371 },
1372};
1373
1374static struct adie_codec_dev_profile ftm_spkr_r_rx_profile = {
1375 .path_type = ADIE_CODEC_RX,
1376 .settings = ftm_spkr_r_rx_settings,
1377 .setting_sz = ARRAY_SIZE(ftm_spkr_r_rx_settings),
1378};
1379
1380static struct snddev_icodec_data ftm_spkr_r_rx_data = {
1381 .capability = SNDDEV_CAP_RX,
1382 .name = "ftm_spkr_r_rx",
1383 .copp_id = PRIMARY_I2S_RX,
1384 .profile = &ftm_spkr_r_rx_profile,
1385 .channel_mode = 1,
1386 .default_sample_rate = 48000,
1387 .pamp_on = msm_snddev_poweramp_on,
1388 .pamp_off = msm_snddev_poweramp_off,
1389 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1390};
1391
1392static struct platform_device ftm_spkr_r_rx_device = {
1393 .name = "snddev_icodec",
1394 .dev = { .platform_data = &ftm_spkr_r_rx_data},
1395};
1396
1397static struct adie_codec_action_unit ftm_spkr_mono_diff_rx_actions[] =
1398 SPKR_MONO_DIFF_RX;
1399
1400static struct adie_codec_hwsetting_entry ftm_spkr_mono_diff_rx_settings[] = {
1401 {
1402 .freq_plan = 48000,
1403 .osr = 256,
1404 .actions = ftm_spkr_mono_diff_rx_actions,
1405 .action_sz = ARRAY_SIZE(ftm_spkr_mono_diff_rx_actions),
1406 },
1407};
1408
1409static struct adie_codec_dev_profile ftm_spkr_mono_diff_rx_profile = {
1410 .path_type = ADIE_CODEC_RX,
1411 .settings = ftm_spkr_mono_diff_rx_settings,
1412 .setting_sz = ARRAY_SIZE(ftm_spkr_mono_diff_rx_settings),
1413};
1414
1415static struct snddev_icodec_data ftm_spkr_mono_diff_rx_data = {
1416 .capability = SNDDEV_CAP_RX,
1417 .name = "ftm_spkr_mono_diff_rx",
1418 .copp_id = PRIMARY_I2S_RX,
1419 .profile = &ftm_spkr_mono_diff_rx_profile,
1420 .channel_mode = 1,
1421 .default_sample_rate = 48000,
1422 .pamp_on = msm_snddev_poweramp_on,
1423 .pamp_off = msm_snddev_poweramp_off,
1424 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1425};
1426
1427static struct platform_device ftm_spkr_mono_diff_rx_device = {
1428 .name = "snddev_icodec",
1429 .dev = { .platform_data = &ftm_spkr_mono_diff_rx_data},
1430};
1431
1432static struct adie_codec_action_unit ftm_headset_mono_l_rx_actions[] =
1433 HPH_PRI_AB_CPLS_MONO_LEFT;
1434
1435static struct adie_codec_hwsetting_entry ftm_headset_mono_l_rx_settings[] = {
1436 {
1437 .freq_plan = 48000,
1438 .osr = 256,
1439 .actions = ftm_headset_mono_l_rx_actions,
1440 .action_sz = ARRAY_SIZE(ftm_headset_mono_l_rx_actions),
1441 },
1442};
1443
1444static struct adie_codec_dev_profile ftm_headset_mono_l_rx_profile = {
1445 .path_type = ADIE_CODEC_RX,
1446 .settings = ftm_headset_mono_l_rx_settings,
1447 .setting_sz = ARRAY_SIZE(ftm_headset_mono_l_rx_settings),
1448};
1449
1450static struct snddev_icodec_data ftm_headset_mono_l_rx_data = {
1451 .capability = SNDDEV_CAP_RX,
1452 .name = "ftm_headset_mono_l_rx",
1453 .copp_id = PRIMARY_I2S_RX,
1454 .profile = &ftm_headset_mono_l_rx_profile,
1455 .channel_mode = 1,
1456 .default_sample_rate = 48000,
1457 .voltage_on = msm_snddev_voltage_on,
1458 .voltage_off = msm_snddev_voltage_off,
1459 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1460};
1461
1462static struct platform_device ftm_headset_mono_l_rx_device = {
1463 .name = "snddev_icodec",
1464 .dev = { .platform_data = &ftm_headset_mono_l_rx_data},
1465};
1466
1467static struct adie_codec_action_unit ftm_headset_mono_r_rx_actions[] =
1468 HPH_PRI_AB_CPLS_MONO_RIGHT;
1469
1470static struct adie_codec_hwsetting_entry ftm_headset_mono_r_rx_settings[] = {
1471 {
1472 .freq_plan = 48000,
1473 .osr = 256,
1474 .actions = ftm_headset_mono_r_rx_actions,
1475 .action_sz = ARRAY_SIZE(ftm_headset_mono_r_rx_actions),
1476 },
1477};
1478
1479static struct adie_codec_dev_profile ftm_headset_mono_r_rx_profile = {
1480 .path_type = ADIE_CODEC_RX,
1481 .settings = ftm_headset_mono_r_rx_settings,
1482 .setting_sz = ARRAY_SIZE(ftm_headset_mono_r_rx_settings),
1483};
1484
1485static struct snddev_icodec_data ftm_headset_mono_r_rx_data = {
1486 .capability = SNDDEV_CAP_RX,
1487 .name = "ftm_headset_mono_r_rx",
1488 .copp_id = PRIMARY_I2S_RX,
1489 .profile = &ftm_headset_mono_r_rx_profile,
1490 .channel_mode = 1,
1491 .default_sample_rate = 48000,
1492 .voltage_on = msm_snddev_voltage_on,
1493 .voltage_off = msm_snddev_voltage_off,
1494 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1495};
1496
1497static struct platform_device ftm_headset_mono_r_rx_device = {
1498 .name = "snddev_icodec",
1499 .dev = { .platform_data = &ftm_headset_mono_r_rx_data},
1500};
1501
1502static struct adie_codec_action_unit ftm_linein_l_tx_actions[] =
1503 LINEIN_MONO_L_TX;
1504
1505static struct adie_codec_hwsetting_entry ftm_linein_l_tx_settings[] = {
1506 {
1507 .freq_plan = 48000,
1508 .osr = 256,
1509 .actions = ftm_linein_l_tx_actions,
1510 .action_sz = ARRAY_SIZE(ftm_linein_l_tx_actions),
1511 },
1512};
1513
1514static struct adie_codec_dev_profile ftm_linein_l_tx_profile = {
1515 .path_type = ADIE_CODEC_TX,
1516 .settings = ftm_linein_l_tx_settings,
1517 .setting_sz = ARRAY_SIZE(ftm_linein_l_tx_settings),
1518};
1519
1520static struct snddev_icodec_data ftm_linein_l_tx_data = {
1521 .capability = SNDDEV_CAP_TX,
1522 .name = "ftm_linein_l_tx",
1523 .copp_id = PRIMARY_I2S_TX,
1524 .profile = &ftm_linein_l_tx_profile,
1525 .channel_mode = 1,
1526 .default_sample_rate = 48000,
1527 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1528};
1529
1530static struct platform_device ftm_linein_l_tx_device = {
1531 .name = "snddev_icodec",
1532 .dev = { .platform_data = &ftm_linein_l_tx_data },
1533};
1534
1535static struct adie_codec_action_unit ftm_linein_r_tx_actions[] =
1536 LINEIN_MONO_R_TX;
1537
1538static struct adie_codec_hwsetting_entry ftm_linein_r_tx_settings[] = {
1539 {
1540 .freq_plan = 48000,
1541 .osr = 256,
1542 .actions = ftm_linein_r_tx_actions,
1543 .action_sz = ARRAY_SIZE(ftm_linein_r_tx_actions),
1544 },
1545};
1546
1547static struct adie_codec_dev_profile ftm_linein_r_tx_profile = {
1548 .path_type = ADIE_CODEC_TX,
1549 .settings = ftm_linein_r_tx_settings,
1550 .setting_sz = ARRAY_SIZE(ftm_linein_r_tx_settings),
1551};
1552
1553static struct snddev_icodec_data ftm_linein_r_tx_data = {
1554 .capability = SNDDEV_CAP_TX,
1555 .name = "ftm_linein_r_tx",
1556 .copp_id = PRIMARY_I2S_TX,
1557 .profile = &ftm_linein_r_tx_profile,
1558 .channel_mode = 1,
1559 .default_sample_rate = 48000,
1560 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1561};
1562
1563static struct platform_device ftm_linein_r_tx_device = {
1564 .name = "snddev_icodec",
1565 .dev = { .platform_data = &ftm_linein_r_tx_data },
1566};
1567
1568static struct adie_codec_action_unit ftm_aux_out_rx_actions[] =
1569 AUX_OUT_RX;
1570
1571static struct adie_codec_hwsetting_entry ftm_aux_out_rx_settings[] = {
1572 {
1573 .freq_plan = 48000,
1574 .osr = 256,
1575 .actions = ftm_aux_out_rx_actions,
1576 .action_sz = ARRAY_SIZE(ftm_aux_out_rx_actions),
1577 },
1578};
1579
1580static struct adie_codec_dev_profile ftm_aux_out_rx_profile = {
1581 .path_type = ADIE_CODEC_RX,
1582 .settings = ftm_aux_out_rx_settings,
1583 .setting_sz = ARRAY_SIZE(ftm_aux_out_rx_settings),
1584};
1585
1586static struct snddev_icodec_data ftm_aux_out_rx_data = {
1587 .capability = SNDDEV_CAP_RX,
1588 .name = "ftm_aux_out_rx",
1589 .copp_id = PRIMARY_I2S_RX,
1590 .profile = &ftm_aux_out_rx_profile,
1591 .channel_mode = 2,
1592 .default_sample_rate = 48000,
1593 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1594};
1595
1596static struct platform_device ftm_aux_out_rx_device = {
1597 .name = "snddev_icodec",
1598 .dev = { .platform_data = &ftm_aux_out_rx_data},
1599};
1600
1601static struct adie_codec_action_unit ftm_dmic1_left_tx_actions[] =
1602 DMIC1_LEFT_TX;
1603
1604static struct adie_codec_hwsetting_entry ftm_dmic1_left_tx_settings[] = {
1605 {
1606 .freq_plan = 48000,
1607 .osr = 256,
1608 .actions = ftm_dmic1_left_tx_actions,
1609 .action_sz = ARRAY_SIZE(ftm_dmic1_left_tx_actions),
1610 },
1611};
1612
1613static struct adie_codec_dev_profile ftm_dmic1_left_tx_profile = {
1614 .path_type = ADIE_CODEC_TX,
1615 .settings = ftm_dmic1_left_tx_settings,
1616 .setting_sz = ARRAY_SIZE(ftm_dmic1_left_tx_settings),
1617};
1618
1619static struct snddev_icodec_data ftm_dmic1_left_tx_data = {
1620 .capability = SNDDEV_CAP_TX,
1621 .name = "ftm_dmic1_left_tx",
1622 .copp_id = PRIMARY_I2S_TX,
1623 .profile = &ftm_dmic1_left_tx_profile,
1624 .channel_mode = 1,
1625 .default_sample_rate = 48000,
1626 .pamp_on = msm_snddev_enable_dmic_power,
1627 .pamp_off = msm_snddev_disable_dmic_power,
1628 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1629};
1630
1631static struct platform_device ftm_dmic1_left_tx_device = {
1632 .name = "snddev_icodec",
1633 .dev = { .platform_data = &ftm_dmic1_left_tx_data},
1634};
1635
1636static struct adie_codec_action_unit ftm_dmic1_right_tx_actions[] =
1637 DMIC1_RIGHT_TX;
1638
1639static struct adie_codec_hwsetting_entry ftm_dmic1_right_tx_settings[] = {
1640 {
1641 .freq_plan = 48000,
1642 .osr = 256,
1643 .actions = ftm_dmic1_right_tx_actions,
1644 .action_sz = ARRAY_SIZE(ftm_dmic1_right_tx_actions),
1645 },
1646};
1647
1648static struct adie_codec_dev_profile ftm_dmic1_right_tx_profile = {
1649 .path_type = ADIE_CODEC_TX,
1650 .settings = ftm_dmic1_right_tx_settings,
1651 .setting_sz = ARRAY_SIZE(ftm_dmic1_right_tx_settings),
1652};
1653
1654static struct snddev_icodec_data ftm_dmic1_right_tx_data = {
1655 .capability = SNDDEV_CAP_TX,
1656 .name = "ftm_dmic1_right_tx",
1657 .copp_id = PRIMARY_I2S_TX,
1658 .profile = &ftm_dmic1_right_tx_profile,
1659 .channel_mode = 1,
1660 .default_sample_rate = 48000,
1661 .pamp_on = msm_snddev_enable_dmic_power,
1662 .pamp_off = msm_snddev_disable_dmic_power,
1663 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1664};
1665
1666static struct platform_device ftm_dmic1_right_tx_device = {
1667 .name = "snddev_icodec",
1668 .dev = { .platform_data = &ftm_dmic1_right_tx_data},
1669};
1670
1671static struct adie_codec_action_unit ftm_dmic1_l_and_r_tx_actions[] =
1672 DMIC1_LEFT_AND_RIGHT_TX;
1673
1674static struct adie_codec_hwsetting_entry ftm_dmic1_l_and_r_tx_settings[] = {
1675 {
1676 .freq_plan = 48000,
1677 .osr = 256,
1678 .actions = ftm_dmic1_l_and_r_tx_actions,
1679 .action_sz = ARRAY_SIZE(ftm_dmic1_l_and_r_tx_actions),
1680 },
1681};
1682
1683static struct adie_codec_dev_profile ftm_dmic1_l_and_r_tx_profile = {
1684 .path_type = ADIE_CODEC_TX,
1685 .settings = ftm_dmic1_l_and_r_tx_settings,
1686 .setting_sz = ARRAY_SIZE(ftm_dmic1_l_and_r_tx_settings),
1687};
1688
1689static struct snddev_icodec_data ftm_dmic1_l_and_r_tx_data = {
1690 .capability = SNDDEV_CAP_TX,
1691 .name = "ftm_dmic1_l_and_r_tx",
1692 .copp_id = PRIMARY_I2S_TX,
1693 .profile = &ftm_dmic1_l_and_r_tx_profile,
1694 .channel_mode = 2,
1695 .default_sample_rate = 48000,
1696 .pamp_on = msm_snddev_enable_dmic_power,
1697 .pamp_off = msm_snddev_disable_dmic_power,
1698 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1699};
1700
1701static struct platform_device ftm_dmic1_l_and_r_tx_device = {
1702 .name = "snddev_icodec",
1703 .dev = { .platform_data = &ftm_dmic1_l_and_r_tx_data},
1704};
1705
1706static struct adie_codec_action_unit ftm_dmic2_left_tx_actions[] =
1707 DMIC2_LEFT_TX;
1708
1709static struct adie_codec_hwsetting_entry ftm_dmic2_left_tx_settings[] = {
1710 {
1711 .freq_plan = 48000,
1712 .osr = 256,
1713 .actions = ftm_dmic2_left_tx_actions,
1714 .action_sz = ARRAY_SIZE(ftm_dmic2_left_tx_actions),
1715 },
1716};
1717
1718static struct adie_codec_dev_profile ftm_dmic2_left_tx_profile = {
1719 .path_type = ADIE_CODEC_TX,
1720 .settings = ftm_dmic2_left_tx_settings,
1721 .setting_sz = ARRAY_SIZE(ftm_dmic2_left_tx_settings),
1722};
1723
1724static struct snddev_icodec_data ftm_dmic2_left_tx_data = {
1725 .capability = SNDDEV_CAP_TX,
1726 .name = "ftm_dmic2_left_tx",
1727 .copp_id = PRIMARY_I2S_TX,
1728 .profile = &ftm_dmic2_left_tx_profile,
1729 .channel_mode = 1,
1730 .default_sample_rate = 48000,
1731 .pamp_on = msm_snddev_enable_dmic_power,
1732 .pamp_off = msm_snddev_disable_dmic_power,
1733 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1734};
1735
1736static struct platform_device ftm_dmic2_left_tx_device = {
1737 .name = "snddev_icodec",
1738 .dev = { .platform_data = &ftm_dmic2_left_tx_data },
1739};
1740
1741static struct adie_codec_action_unit ftm_dmic2_right_tx_actions[] =
1742 DMIC2_RIGHT_TX;
1743
1744static struct adie_codec_hwsetting_entry ftm_dmic2_right_tx_settings[] = {
1745 {
1746 .freq_plan = 48000,
1747 .osr = 256,
1748 .actions = ftm_dmic2_right_tx_actions,
1749 .action_sz = ARRAY_SIZE(ftm_dmic2_right_tx_actions),
1750 },
1751};
1752
1753static struct adie_codec_dev_profile ftm_dmic2_right_tx_profile = {
1754 .path_type = ADIE_CODEC_TX,
1755 .settings = ftm_dmic2_right_tx_settings,
1756 .setting_sz = ARRAY_SIZE(ftm_dmic2_right_tx_settings),
1757};
1758
1759static struct snddev_icodec_data ftm_dmic2_right_tx_data = {
1760 .capability = SNDDEV_CAP_TX,
1761 .name = "ftm_dmic2_right_tx",
1762 .copp_id = PRIMARY_I2S_TX,
1763 .profile = &ftm_dmic2_right_tx_profile,
1764 .channel_mode = 1,
1765 .default_sample_rate = 48000,
1766 .pamp_on = msm_snddev_enable_dmic_power,
1767 .pamp_off = msm_snddev_disable_dmic_power,
1768 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1769};
1770
1771static struct platform_device ftm_dmic2_right_tx_device = {
1772 .name = "snddev_icodec",
1773 .dev = { .platform_data = &ftm_dmic2_right_tx_data },
1774};
1775
1776static struct adie_codec_action_unit ftm_dmic2_l_and_r_tx_actions[] =
1777 DMIC2_LEFT_AND_RIGHT_TX;
1778
1779static struct adie_codec_hwsetting_entry ftm_dmic2_l_and_r_tx_settings[] = {
1780 {
1781 .freq_plan = 48000,
1782 .osr = 256,
1783 .actions = ftm_dmic2_l_and_r_tx_actions,
1784 .action_sz = ARRAY_SIZE(ftm_dmic2_l_and_r_tx_actions),
1785 },
1786};
1787
1788static struct adie_codec_dev_profile ftm_dmic2_l_and_r_tx_profile = {
1789 .path_type = ADIE_CODEC_TX,
1790 .settings = ftm_dmic2_l_and_r_tx_settings,
1791 .setting_sz = ARRAY_SIZE(ftm_dmic2_l_and_r_tx_settings),
1792};
1793
1794static struct snddev_icodec_data ftm_dmic2_l_and_r_tx_data = {
1795 .capability = SNDDEV_CAP_TX,
1796 .name = "ftm_dmic2_l_and_r_tx",
1797 .copp_id = PRIMARY_I2S_TX,
1798 .profile = &ftm_dmic2_l_and_r_tx_profile,
1799 .channel_mode = 2,
1800 .default_sample_rate = 48000,
1801 .pamp_on = msm_snddev_enable_dmic_power,
1802 .pamp_off = msm_snddev_disable_dmic_power,
1803 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1804};
1805
1806static struct platform_device ftm_dmic2_l_and_r_tx_device = {
1807 .name = "snddev_icodec",
1808 .dev = { .platform_data = &ftm_dmic2_l_and_r_tx_data},
1809};
1810
1811static struct adie_codec_action_unit ftm_handset_mic1_aux_in_actions[] =
1812 HANDSET_MIC1_AUX_IN;
1813
1814static struct adie_codec_hwsetting_entry ftm_handset_mic1_aux_in_settings[] = {
1815 {
1816 .freq_plan = 48000,
1817 .osr = 256,
1818 .actions = ftm_handset_mic1_aux_in_actions,
1819 .action_sz = ARRAY_SIZE(ftm_handset_mic1_aux_in_actions),
1820 },
1821};
1822
1823static struct adie_codec_dev_profile ftm_handset_mic1_aux_in_profile = {
1824 .path_type = ADIE_CODEC_TX,
1825 .settings = ftm_handset_mic1_aux_in_settings,
1826 .setting_sz = ARRAY_SIZE(ftm_handset_mic1_aux_in_settings),
1827};
1828
1829static struct snddev_icodec_data ftm_handset_mic1_aux_in_data = {
1830 .capability = SNDDEV_CAP_TX,
1831 .name = "ftm_handset_mic1_aux_in",
1832 .copp_id = PRIMARY_I2S_TX,
1833 .profile = &ftm_handset_mic1_aux_in_profile,
1834 .channel_mode = 2,
1835 .default_sample_rate = 48000,
1836 /* Assumption is that inputs are not tied to analog mic, so
1837 * no need to enable mic bias.
1838 */
1839 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1840};
1841
1842static struct platform_device ftm_handset_mic1_aux_in_device = {
1843 .name = "snddev_icodec",
1844 .dev = { .platform_data = &ftm_handset_mic1_aux_in_data},
1845};
1846
1847static struct snddev_mi2s_data snddev_mi2s_sd0_rx_data = {
1848 .capability = SNDDEV_CAP_RX ,
1849 .name = "mi2s_sd0_rx",
1850 .copp_id = MI2S_RX,
1851 .channel_mode = 2, /* stereo */
1852 .sd_lines = MI2S_SD0, /* sd0 */
1853 .sample_rate = 48000,
1854};
1855
1856static struct platform_device ftm_mi2s_sd0_rx_device = {
1857 .name = "snddev_mi2s",
1858 .dev = { .platform_data = &snddev_mi2s_sd0_rx_data },
1859};
1860
1861static struct snddev_mi2s_data snddev_mi2s_sd1_rx_data = {
1862 .capability = SNDDEV_CAP_RX ,
1863 .name = "mi2s_sd1_rx",
1864 .copp_id = MI2S_RX,
1865 .channel_mode = 2, /* stereo */
1866 .sd_lines = MI2S_SD1, /* sd1 */
1867 .sample_rate = 48000,
1868};
1869
1870static struct platform_device ftm_mi2s_sd1_rx_device = {
1871 .name = "snddev_mi2s",
1872 .dev = { .platform_data = &snddev_mi2s_sd1_rx_data },
1873};
1874
1875static struct snddev_mi2s_data snddev_mi2s_sd2_rx_data = {
1876 .capability = SNDDEV_CAP_RX ,
1877 .name = "mi2s_sd2_rx",
1878 .copp_id = MI2S_RX,
1879 .channel_mode = 2, /* stereo */
1880 .sd_lines = MI2S_SD2, /* sd2 */
1881 .sample_rate = 48000,
1882};
1883
1884static struct platform_device ftm_mi2s_sd2_rx_device = {
1885 .name = "snddev_mi2s",
1886 .dev = { .platform_data = &snddev_mi2s_sd2_rx_data },
1887};
1888
1889/* earpiece */
1890static struct adie_codec_action_unit ftm_handset_adie_lp_rx_actions[] =
1891 EAR_PRI_MONO_LB;
1892
1893static struct adie_codec_hwsetting_entry ftm_handset_adie_lp_rx_settings[] = {
1894 {
1895 .freq_plan = 48000,
1896 .osr = 256,
1897 .actions = ftm_handset_adie_lp_rx_actions,
1898 .action_sz = ARRAY_SIZE(ftm_handset_adie_lp_rx_actions),
1899 }
1900};
1901
1902static struct adie_codec_dev_profile ftm_handset_adie_lp_rx_profile = {
1903 .path_type = ADIE_CODEC_RX,
1904 .settings = ftm_handset_adie_lp_rx_settings,
1905 .setting_sz = ARRAY_SIZE(ftm_handset_adie_lp_rx_settings),
1906};
1907
1908static struct snddev_icodec_data ftm_handset_adie_lp_rx_data = {
1909 .capability = (SNDDEV_CAP_RX | SNDDEV_CAP_VOICE),
1910 .name = "ftm_handset_adie_lp_rx",
1911 .copp_id = 0,
1912 .profile = &ftm_handset_adie_lp_rx_profile,
1913 .channel_mode = 1,
1914 .default_sample_rate = 48000,
1915 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1916};
1917
1918static struct platform_device ftm_handset_adie_lp_rx_device = {
1919 .name = "snddev_icodec",
1920 .dev = { .platform_data = &ftm_handset_adie_lp_rx_data },
1921};
1922
1923static struct adie_codec_action_unit ftm_headset_l_adie_lp_rx_actions[] =
1924 FTM_HPH_PRI_AB_CPLS_MONO_LB_LEFT;
1925
1926static struct adie_codec_hwsetting_entry ftm_headset_l_adie_lp_rx_settings[] = {
1927 {
1928 .freq_plan = 48000,
1929 .osr = 256,
1930 .actions = ftm_headset_l_adie_lp_rx_actions,
1931 .action_sz = ARRAY_SIZE(ftm_headset_l_adie_lp_rx_actions),
1932 },
1933};
1934
1935static struct adie_codec_dev_profile ftm_headset_l_adie_lp_rx_profile = {
1936 .path_type = ADIE_CODEC_RX,
1937 .settings = ftm_headset_l_adie_lp_rx_settings,
1938 .setting_sz = ARRAY_SIZE(ftm_headset_l_adie_lp_rx_settings),
1939};
1940
1941static struct snddev_icodec_data ftm_headset_l_adie_lp_rx_data = {
1942 .capability = SNDDEV_CAP_RX,
1943 .name = "ftm_headset_l_adie_lp_rx",
1944 .copp_id = PRIMARY_I2S_RX,
1945 .profile = &ftm_headset_l_adie_lp_rx_profile,
1946 .channel_mode = 1,
1947 .default_sample_rate = 48000,
1948 .voltage_on = msm_snddev_voltage_on,
1949 .voltage_off = msm_snddev_voltage_off,
1950 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1951};
1952
1953static struct platform_device ftm_headset_l_adie_lp_rx_device = {
1954 .name = "snddev_icodec",
1955 .dev = { .platform_data = &ftm_headset_l_adie_lp_rx_data },
1956};
1957
1958static struct adie_codec_action_unit ftm_headset_r_adie_lp_rx_actions[] =
1959 FTM_HPH_PRI_AB_CPLS_MONO_LB_RIGHT;
1960
1961static struct adie_codec_hwsetting_entry ftm_headset_r_adie_lp_rx_settings[] = {
1962 {
1963 .freq_plan = 48000,
1964 .osr = 256,
1965 .actions = ftm_headset_r_adie_lp_rx_actions,
1966 .action_sz = ARRAY_SIZE(ftm_headset_r_adie_lp_rx_actions),
1967 },
1968};
1969
1970static struct adie_codec_dev_profile ftm_headset_r_adie_lp_rx_profile = {
1971 .path_type = ADIE_CODEC_RX,
1972 .settings = ftm_headset_r_adie_lp_rx_settings,
1973 .setting_sz = ARRAY_SIZE(ftm_headset_r_adie_lp_rx_settings),
1974};
1975
1976static struct snddev_icodec_data ftm_headset_r_adie_lp_rx_data = {
1977 .capability = SNDDEV_CAP_RX,
1978 .name = "ftm_headset_r_adie_lp_rx",
1979 .copp_id = PRIMARY_I2S_RX,
1980 .profile = &ftm_headset_r_adie_lp_rx_profile,
1981 .channel_mode = 1,
1982 .default_sample_rate = 48000,
1983 .voltage_on = msm_snddev_voltage_on,
1984 .voltage_off = msm_snddev_voltage_off,
1985 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
1986};
1987
1988static struct platform_device ftm_headset_r_adie_lp_rx_device = {
1989 .name = "snddev_icodec",
1990 .dev = { .platform_data = &ftm_headset_r_adie_lp_rx_data },
1991};
1992
1993static struct adie_codec_action_unit ftm_spkr_l_rx_lp_actions[] =
1994 FTM_SPKR_L_RX;
1995
1996static struct adie_codec_hwsetting_entry ftm_spkr_l_rx_lp_settings[] = {
1997 {
1998 .freq_plan = 48000,
1999 .osr = 256,
2000 .actions = ftm_spkr_l_rx_lp_actions,
2001 .action_sz = ARRAY_SIZE(ftm_spkr_l_rx_lp_actions),
2002 },
2003};
2004
2005static struct adie_codec_dev_profile ftm_spkr_l_rx_lp_profile = {
2006 .path_type = ADIE_CODEC_RX,
2007 .settings = ftm_spkr_l_rx_lp_settings,
2008 .setting_sz = ARRAY_SIZE(ftm_spkr_l_rx_lp_settings),
2009};
2010
2011static struct snddev_icodec_data ftm_spkr_l_rx_lp_data = {
2012 .capability = SNDDEV_CAP_RX,
2013 .name = "ftm_spk_l_adie_lp_rx",
2014 .copp_id = PRIMARY_I2S_RX,
2015 .profile = &ftm_spkr_l_rx_lp_profile,
2016 .channel_mode = 1,
2017 .default_sample_rate = 48000,
2018 .pamp_on = msm_snddev_poweramp_on,
2019 .pamp_off = msm_snddev_poweramp_off,
2020 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2021};
2022
2023static struct platform_device ftm_spk_l_adie_lp_rx_device = {
2024 .name = "snddev_icodec",
2025 .dev = { .platform_data = &ftm_spkr_l_rx_lp_data},
2026};
2027
2028static struct adie_codec_action_unit ftm_spkr_r_adie_lp_rx_actions[] =
2029 FTM_SPKR_RX_LB;
2030
2031static struct adie_codec_hwsetting_entry ftm_spkr_r_adie_lp_rx_settings[] = {
2032 {
2033 .freq_plan = 48000,
2034 .osr = 256,
2035 .actions = ftm_spkr_r_adie_lp_rx_actions,
2036 .action_sz = ARRAY_SIZE(ftm_spkr_r_adie_lp_rx_actions),
2037 },
2038};
2039
2040static struct adie_codec_dev_profile ftm_spkr_r_adie_lp_rx_profile = {
2041 .path_type = ADIE_CODEC_RX,
2042 .settings = ftm_spkr_r_adie_lp_rx_settings,
2043 .setting_sz = ARRAY_SIZE(ftm_spkr_r_adie_lp_rx_settings),
2044};
2045
2046static struct snddev_icodec_data ftm_spkr_r_adie_lp_rx_data = {
2047 .capability = SNDDEV_CAP_RX,
2048 .name = "ftm_spk_r_adie_lp_rx",
2049 .copp_id = PRIMARY_I2S_RX,
2050 .profile = &ftm_spkr_r_adie_lp_rx_profile,
2051 .channel_mode = 1,
2052 .default_sample_rate = 48000,
2053 .pamp_on = msm_snddev_poweramp_on,
2054 .pamp_off = msm_snddev_poweramp_off,
2055 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2056};
2057
2058static struct platform_device ftm_spk_r_adie_lp_rx_device = {
2059 .name = "snddev_icodec",
2060 .dev = { .platform_data = &ftm_spkr_r_adie_lp_rx_data},
2061};
2062
2063static struct adie_codec_action_unit ftm_spkr_adie_lp_rx_actions[] =
2064 FTM_SPKR_RX_LB;
2065
2066static struct adie_codec_hwsetting_entry ftm_spkr_adie_lp_rx_settings[] = {
2067 {
2068 .freq_plan = 48000,
2069 .osr = 256,
2070 .actions = ftm_spkr_adie_lp_rx_actions,
2071 .action_sz = ARRAY_SIZE(ftm_spkr_adie_lp_rx_actions),
2072 },
2073};
2074
2075static struct adie_codec_dev_profile ftm_spkr_adie_lp_rx_profile = {
2076 .path_type = ADIE_CODEC_RX,
2077 .settings = ftm_spkr_adie_lp_rx_settings,
2078 .setting_sz = ARRAY_SIZE(ftm_spkr_adie_lp_rx_settings),
2079};
2080
2081static struct snddev_icodec_data ftm_spkr_adie_lp_rx_data = {
2082 .capability = SNDDEV_CAP_RX,
2083 .name = "ftm_spk_adie_lp_rx",
2084 .copp_id = PRIMARY_I2S_RX,
2085 .profile = &ftm_spkr_adie_lp_rx_profile,
2086 .channel_mode = 1,
2087 .default_sample_rate = 48000,
2088 .pamp_on = msm_snddev_poweramp_on,
2089 .pamp_off = msm_snddev_poweramp_off,
2090 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2091};
2092
2093static struct platform_device ftm_spk_adie_lp_rx_device = {
2094 .name = "snddev_icodec",
2095 .dev = { .platform_data = &ftm_spkr_adie_lp_rx_data},
2096};
2097
2098static struct adie_codec_action_unit ftm_handset_dual_tx_lp_actions[] =
2099 FTM_AMIC_DUAL_HANDSET_TX_LB;
2100
2101static struct adie_codec_hwsetting_entry ftm_handset_dual_tx_lp_settings[] = {
2102 {
2103 .freq_plan = 48000,
2104 .osr = 256,
2105 .actions = ftm_handset_dual_tx_lp_actions,
2106 .action_sz = ARRAY_SIZE(ftm_handset_dual_tx_lp_actions),
2107 }
2108};
2109
2110static struct adie_codec_dev_profile ftm_handset_dual_tx_lp_profile = {
2111 .path_type = ADIE_CODEC_TX,
2112 .settings = ftm_handset_dual_tx_lp_settings,
2113 .setting_sz = ARRAY_SIZE(ftm_handset_dual_tx_lp_settings),
2114};
2115
2116static struct snddev_icodec_data ftm_handset_dual_tx_lp_data = {
2117 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
2118 .name = "handset_mic1_handset_mic2",
2119 .copp_id = 1,
2120 .profile = &ftm_handset_dual_tx_lp_profile,
2121 .channel_mode = 2,
2122 .default_sample_rate = 48000,
2123 .pamp_on = msm_snddev_enable_amic_power,
2124 .pamp_off = msm_snddev_disable_amic_power,
2125 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2126};
2127
2128static struct platform_device ftm_handset_dual_tx_lp_device = {
2129 .name = "snddev_icodec",
2130 .dev = { .platform_data = &ftm_handset_dual_tx_lp_data },
2131};
2132
2133static struct adie_codec_action_unit ftm_handset_mic_adie_lp_tx_actions[] =
2134 FTM_HANDSET_LB_TX;
2135
2136static struct adie_codec_hwsetting_entry
2137 ftm_handset_mic_adie_lp_tx_settings[] = {
2138 {
2139 .freq_plan = 48000,
2140 .osr = 256,
2141 .actions = ftm_handset_mic_adie_lp_tx_actions,
2142 .action_sz = ARRAY_SIZE(ftm_handset_mic_adie_lp_tx_actions),
2143 }
2144};
2145
2146static struct adie_codec_dev_profile ftm_handset_mic_adie_lp_tx_profile = {
2147 .path_type = ADIE_CODEC_TX,
2148 .settings = ftm_handset_mic_adie_lp_tx_settings,
2149 .setting_sz = ARRAY_SIZE(ftm_handset_mic_adie_lp_tx_settings),
2150};
2151
2152static struct snddev_icodec_data ftm_handset_mic_adie_lp_tx_data = {
2153 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
2154 .name = "ftm_handset_mic_adie_lp_tx",
2155 .copp_id = 1,
2156 .profile = &ftm_handset_mic_adie_lp_tx_profile,
2157 .channel_mode = 1,
2158 .default_sample_rate = 48000,
2159 .pamp_on = msm_snddev_enable_amic_power,
2160 .pamp_off = msm_snddev_disable_amic_power,
2161 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2162};
2163
2164static struct platform_device ftm_handset_mic_adie_lp_tx_device = {
2165 .name = "snddev_icodec",
2166 .dev = { .platform_data = &ftm_handset_mic_adie_lp_tx_data },
2167};
2168
2169static struct adie_codec_action_unit ftm_headset_mic_adie_lp_tx_actions[] =
2170 FTM_HEADSET_LB_TX;
2171
2172static struct adie_codec_hwsetting_entry
2173 ftm_headset_mic_adie_lp_tx_settings[] = {
2174 {
2175 .freq_plan = 48000,
2176 .osr = 256,
2177 .actions = ftm_headset_mic_adie_lp_tx_actions,
2178 .action_sz = ARRAY_SIZE(ftm_headset_mic_adie_lp_tx_actions),
2179 }
2180};
2181
2182static struct adie_codec_dev_profile ftm_headset_mic_adie_lp_tx_profile = {
2183 .path_type = ADIE_CODEC_TX,
2184 .settings = ftm_headset_mic_adie_lp_tx_settings,
2185 .setting_sz = ARRAY_SIZE(ftm_headset_mic_adie_lp_tx_settings),
2186};
2187
2188static struct snddev_icodec_data ftm_headset_mic_adie_lp_tx_data = {
2189 .capability = (SNDDEV_CAP_TX | SNDDEV_CAP_VOICE),
2190 .name = "ftm_headset_mic_adie_lp_tx",
2191 .copp_id = PRIMARY_I2S_TX,
2192 .profile = &ftm_headset_mic_adie_lp_tx_profile,
2193 .channel_mode = 1,
2194 .default_sample_rate = 48000,
2195 .dev_vol_type = SNDDEV_DEV_VOL_DIGITAL,
2196};
2197
2198static struct platform_device ftm_headset_mic_adie_lp_tx_device = {
2199 .name = "snddev_icodec",
2200 .dev = { .platform_data = &ftm_headset_mic_adie_lp_tx_data },
2201};
2202#endif /* CONFIG_MSM8X60_FTM_AUDIO_DEVICES */
2203
2204static struct snddev_virtual_data snddev_uplink_rx_data = {
2205 .capability = SNDDEV_CAP_RX,
2206 .name = "uplink_rx",
2207 .copp_id = VOICE_PLAYBACK_TX,
2208};
2209
2210static struct platform_device msm_uplink_rx_device = {
2211 .name = "snddev_virtual",
2212 .dev = { .platform_data = &snddev_uplink_rx_data },
2213};
2214
2215static struct snddev_hdmi_data snddev_hdmi_non_linear_pcm_rx_data = {
2216 .capability = SNDDEV_CAP_RX ,
2217 .name = "hdmi_pass_through",
2218 .default_sample_rate = 48000,
2219 .on_apps = 1,
2220};
2221
2222static struct platform_device msm_snddev_hdmi_non_linear_pcm_rx_device = {
2223 .name = "snddev_hdmi",
2224 .dev = { .platform_data = &snddev_hdmi_non_linear_pcm_rx_data },
2225};
2226
2227
2228#ifdef CONFIG_DEBUG_FS
2229static struct adie_codec_action_unit
2230 ihs_stereo_rx_class_d_legacy_48KHz_osr256_actions[] =
2231 HPH_PRI_D_LEG_STEREO;
2232
2233static struct adie_codec_hwsetting_entry
2234 ihs_stereo_rx_class_d_legacy_settings[] = {
2235 {
2236 .freq_plan = 48000,
2237 .osr = 256,
2238 .actions =
2239 ihs_stereo_rx_class_d_legacy_48KHz_osr256_actions,
2240 .action_sz = ARRAY_SIZE
2241 (ihs_stereo_rx_class_d_legacy_48KHz_osr256_actions),
2242 }
2243};
2244
2245static struct adie_codec_action_unit
2246 ihs_stereo_rx_class_ab_legacy_48KHz_osr256_actions[] =
2247 HPH_PRI_AB_LEG_STEREO;
2248
2249static struct adie_codec_hwsetting_entry
2250 ihs_stereo_rx_class_ab_legacy_settings[] = {
2251 {
2252 .freq_plan = 48000,
2253 .osr = 256,
2254 .actions =
2255 ihs_stereo_rx_class_ab_legacy_48KHz_osr256_actions,
2256 .action_sz = ARRAY_SIZE
2257 (ihs_stereo_rx_class_ab_legacy_48KHz_osr256_actions),
2258 }
2259};
2260
2261static void snddev_hsed_config_modify_setting(int type)
2262{
2263 struct platform_device *device;
2264 struct snddev_icodec_data *icodec_data;
2265
2266 device = &msm_headset_stereo_device;
2267 icodec_data = (struct snddev_icodec_data *)device->dev.platform_data;
2268
2269 if (icodec_data) {
2270 if (type == 1) {
2271 icodec_data->voltage_on = NULL;
2272 icodec_data->voltage_off = NULL;
2273 icodec_data->profile->settings =
2274 ihs_stereo_rx_class_d_legacy_settings;
2275 icodec_data->profile->setting_sz =
2276 ARRAY_SIZE(ihs_stereo_rx_class_d_legacy_settings);
2277 } else if (type == 2) {
2278 icodec_data->voltage_on = NULL;
2279 icodec_data->voltage_off = NULL;
2280 icodec_data->profile->settings =
2281 ihs_stereo_rx_class_ab_legacy_settings;
2282 icodec_data->profile->setting_sz =
2283 ARRAY_SIZE(ihs_stereo_rx_class_ab_legacy_settings);
2284 }
2285 }
2286}
2287
2288static void snddev_hsed_config_restore_setting(void)
2289{
2290 struct platform_device *device;
2291 struct snddev_icodec_data *icodec_data;
2292
2293 device = &msm_headset_stereo_device;
2294 icodec_data = (struct snddev_icodec_data *)device->dev.platform_data;
2295
2296 if (icodec_data) {
2297 icodec_data->voltage_on = msm_snddev_voltage_on;
2298 icodec_data->voltage_off = msm_snddev_voltage_off;
2299 icodec_data->profile->settings = headset_ab_cpls_settings;
2300 icodec_data->profile->setting_sz =
2301 ARRAY_SIZE(headset_ab_cpls_settings);
2302 }
2303}
2304
2305static ssize_t snddev_hsed_config_debug_write(struct file *filp,
2306 const char __user *ubuf, size_t cnt, loff_t *ppos)
2307{
2308 char *lb_str = filp->private_data;
2309 char cmd;
2310
2311 if (get_user(cmd, ubuf))
2312 return -EFAULT;
2313
2314 if (!strcmp(lb_str, "msm_hsed_config")) {
2315 switch (cmd) {
2316 case '0':
2317 snddev_hsed_config_restore_setting();
2318 break;
2319
2320 case '1':
2321 snddev_hsed_config_modify_setting(1);
2322 break;
2323
2324 case '2':
2325 snddev_hsed_config_modify_setting(2);
2326 break;
2327
2328 default:
2329 break;
2330 }
2331 }
2332 return cnt;
2333}
2334
2335static int snddev_hsed_config_debug_open(struct inode *inode, struct file *file)
2336{
2337 file->private_data = inode->i_private;
2338 return 0;
2339}
2340
2341static const struct file_operations snddev_hsed_config_debug_fops = {
2342 .open = snddev_hsed_config_debug_open,
2343 .write = snddev_hsed_config_debug_write
2344};
2345#endif
2346
2347static struct platform_device *snd_devices_ffa[] __initdata = {
2348 &msm_iearpiece_ffa_device,
2349 &msm_imic_ffa_device,
2350 &msm_ispkr_stereo_device,
2351 &msm_snddev_hdmi_stereo_rx_device,
2352 &msm_headset_mic_device,
2353 &msm_ispkr_mic_device,
2354 &msm_bt_sco_earpiece_device,
2355 &msm_bt_sco_mic_device,
2356 &msm_headset_stereo_device,
2357 &msm_itty_mono_tx_device,
2358 &msm_itty_mono_rx_device,
2359 &msm_mi2s_fm_tx_device,
2360 &msm_mi2s_fm_rx_device,
2361 &msm_hs_dual_mic_endfire_device,
2362 &msm_spkr_dual_mic_endfire_device,
2363 &msm_hs_dual_mic_broadside_device,
2364 &msm_spkr_dual_mic_broadside_device,
2365 &msm_ihs_stereo_speaker_stereo_rx_device,
2366 &msm_anc_headset_device,
2367 &msm_auxpga_lp_hs_device,
2368 &msm_auxpga_lp_lo_device,
2369 &msm_linein_pri_device,
2370 &msm_icodec_gpio_device,
2371 &msm_snddev_hdmi_non_linear_pcm_rx_device,
2372};
2373
2374static struct platform_device *snd_devices_surf[] __initdata = {
2375 &msm_iearpiece_device,
2376 &msm_imic_device,
2377 &msm_ispkr_stereo_device,
2378 &msm_snddev_hdmi_stereo_rx_device,
2379 &msm_headset_mic_device,
2380 &msm_ispkr_mic_device,
2381 &msm_bt_sco_earpiece_device,
2382 &msm_bt_sco_mic_device,
2383 &msm_headset_stereo_device,
2384 &msm_itty_mono_tx_device,
2385 &msm_itty_mono_rx_device,
2386 &msm_mi2s_fm_tx_device,
2387 &msm_mi2s_fm_rx_device,
2388 &msm_ihs_stereo_speaker_stereo_rx_device,
2389 &msm_auxpga_lp_hs_device,
2390 &msm_auxpga_lp_lo_device,
2391 &msm_linein_pri_device,
2392 &msm_icodec_gpio_device,
2393 &msm_snddev_hdmi_non_linear_pcm_rx_device,
2394};
2395
2396static struct platform_device *snd_devices_fluid[] __initdata = {
2397 &msm_iearpiece_device,
2398 &msm_imic_device,
2399 &msm_ispkr_stereo_device,
2400 &msm_snddev_hdmi_stereo_rx_device,
2401 &msm_headset_stereo_device,
2402 &msm_headset_mic_device,
2403 &msm_fluid_ispkr_mic_device,
2404 &msm_bt_sco_earpiece_device,
2405 &msm_bt_sco_mic_device,
2406 &msm_mi2s_fm_tx_device,
2407 &msm_mi2s_fm_rx_device,
2408 &msm_anc_headset_device,
2409 &msm_auxpga_lp_hs_device,
2410 &msm_auxpga_lp_lo_device,
2411 &msm_icodec_gpio_device,
2412 &msm_snddev_hdmi_non_linear_pcm_rx_device,
2413};
2414
2415static struct platform_device *snd_devices_common[] __initdata = {
2416 &msm_aux_pcm_device,
2417 &msm_cdcclk_ctl_device,
2418 &msm_mi2s_device,
2419 &msm_uplink_rx_device,
2420};
2421
2422#ifdef CONFIG_MSM8X60_FTM_AUDIO_DEVICES
2423static struct platform_device *snd_devices_ftm[] __initdata = {
2424 &ftm_headset_mono_rx_device,
2425 &ftm_headset_mono_l_rx_device,
2426 &ftm_headset_mono_r_rx_device,
2427 &ftm_headset_mono_diff_rx_device,
2428 &ftm_spkr_mono_rx_device,
2429 &ftm_spkr_l_rx_device,
2430 &ftm_spkr_r_rx_device,
2431 &ftm_spkr_mono_diff_rx_device,
2432 &ftm_linein_l_tx_device,
2433 &ftm_linein_r_tx_device,
2434 &ftm_aux_out_rx_device,
2435 &ftm_dmic1_left_tx_device,
2436 &ftm_dmic1_right_tx_device,
2437 &ftm_dmic1_l_and_r_tx_device,
2438 &ftm_dmic2_left_tx_device,
2439 &ftm_dmic2_right_tx_device,
2440 &ftm_dmic2_l_and_r_tx_device,
2441 &ftm_handset_mic1_aux_in_device,
2442 &ftm_mi2s_sd0_rx_device,
2443 &ftm_mi2s_sd1_rx_device,
2444 &ftm_mi2s_sd2_rx_device,
2445 &ftm_handset_mic_adie_lp_tx_device,
2446 &ftm_headset_mic_adie_lp_tx_device,
2447 &ftm_handset_adie_lp_rx_device,
2448 &ftm_headset_l_adie_lp_rx_device,
2449 &ftm_headset_r_adie_lp_rx_device,
2450 &ftm_spk_l_adie_lp_rx_device,
2451 &ftm_spk_r_adie_lp_rx_device,
2452 &ftm_spk_adie_lp_rx_device,
2453 &ftm_handset_dual_tx_lp_device,
2454};
2455#else
2456static struct platform_device *snd_devices_ftm[] __initdata = {};
2457#endif
2458
2459
2460void __init msm_snddev_init(void)
2461{
2462 int i;
2463 int dev_id;
2464
2465 atomic_set(&pamp_ref_cnt, 0);
2466 atomic_set(&preg_ref_cnt, 0);
2467
2468 for (i = 0, dev_id = 0; i < ARRAY_SIZE(snd_devices_common); i++)
2469 snd_devices_common[i]->id = dev_id++;
2470
2471 platform_add_devices(snd_devices_common,
2472 ARRAY_SIZE(snd_devices_common));
2473
2474 /* Auto detect device base on machine info */
2475 if (machine_is_msm8x60_surf() || machine_is_msm8x60_fusion()) {
2476 for (i = 0; i < ARRAY_SIZE(snd_devices_surf); i++)
2477 snd_devices_surf[i]->id = dev_id++;
2478
2479 platform_add_devices(snd_devices_surf,
2480 ARRAY_SIZE(snd_devices_surf));
2481 } else if (machine_is_msm8x60_ffa() ||
2482 machine_is_msm8x60_fusn_ffa()) {
2483 for (i = 0; i < ARRAY_SIZE(snd_devices_ffa); i++)
2484 snd_devices_ffa[i]->id = dev_id++;
2485
2486 platform_add_devices(snd_devices_ffa,
2487 ARRAY_SIZE(snd_devices_ffa));
2488 } else if (machine_is_msm8x60_fluid()) {
2489 for (i = 0; i < ARRAY_SIZE(snd_devices_fluid); i++)
2490 snd_devices_fluid[i]->id = dev_id++;
2491
2492 platform_add_devices(snd_devices_fluid,
2493 ARRAY_SIZE(snd_devices_fluid));
2494 } else if (machine_is_msm8x60_surf()) {
2495 for (i = 0; i < ARRAY_SIZE(snd_devices_ftm); i++)
2496 snd_devices_ftm[i]->id = dev_id++;
2497
2498 platform_add_devices(snd_devices_ftm,
2499 ARRAY_SIZE(snd_devices_ftm));
2500 }
2501
2502#ifdef CONFIG_DEBUG_FS
2503 debugfs_hsed_config = debugfs_create_file("msm_hsed_config",
2504 S_IFREG | S_IRUGO, NULL,
2505 (void *) "msm_hsed_config", &snddev_hsed_config_debug_fops);
2506#endif
2507}