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