diff options
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 377 |
1 files changed, 189 insertions, 188 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 51848880504a..31e44e346dc8 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -298,30 +298,107 @@ static const struct soc_enum twl4030_handsfreer_enum = | |||
298 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = | 298 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = |
299 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); | 299 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); |
300 | 300 | ||
301 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 301 | /* Left analog microphone selection */ |
302 | static const char *twl4030_analoglmic_texts[] = | ||
303 | {"Off", "Main mic", "Headset mic", "Invalid", "AUXL", | ||
304 | "Invalid", "Invalid", "Invalid", "Carkit mic"}; | ||
305 | |||
306 | static const struct soc_enum twl4030_analoglmic_enum = | ||
307 | SOC_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0, | ||
308 | ARRAY_SIZE(twl4030_analoglmic_texts), | ||
309 | twl4030_analoglmic_texts); | ||
310 | |||
311 | static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = | ||
312 | SOC_DAPM_ENUM("Route", twl4030_analoglmic_enum); | ||
313 | |||
314 | /* Right analog microphone selection */ | ||
315 | static const char *twl4030_analogrmic_texts[] = | ||
316 | {"Off", "Sub mic", "Invalid", "Invalid", "AUXR"}; | ||
317 | |||
318 | static const struct soc_enum twl4030_analogrmic_enum = | ||
319 | SOC_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0, | ||
320 | ARRAY_SIZE(twl4030_analogrmic_texts), | ||
321 | twl4030_analogrmic_texts); | ||
322 | |||
323 | static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = | ||
324 | SOC_DAPM_ENUM("Route", twl4030_analogrmic_enum); | ||
325 | |||
326 | /* TX1 L/R Analog/Digital microphone selection */ | ||
327 | static const char *twl4030_micpathtx1_texts[] = | ||
328 | {"Analog", "Digimic0"}; | ||
329 | |||
330 | static const struct soc_enum twl4030_micpathtx1_enum = | ||
331 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0, | ||
332 | ARRAY_SIZE(twl4030_micpathtx1_texts), | ||
333 | twl4030_micpathtx1_texts); | ||
334 | |||
335 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = | ||
336 | SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); | ||
337 | |||
338 | /* TX2 L/R Analog/Digital microphone selection */ | ||
339 | static const char *twl4030_micpathtx2_texts[] = | ||
340 | {"Analog", "Digimic1"}; | ||
341 | |||
342 | static const struct soc_enum twl4030_micpathtx2_enum = | ||
343 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2, | ||
344 | ARRAY_SIZE(twl4030_micpathtx2_texts), | ||
345 | twl4030_micpathtx2_texts); | ||
346 | |||
347 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = | ||
348 | SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); | ||
349 | |||
350 | /* | ||
351 | * This function filters out the non valid mux settings, named as "Invalid" | ||
352 | * in the enum texts. | ||
353 | * Just refuse to set an invalid mux mode. | ||
354 | */ | ||
355 | static int twl4030_enum_event(struct snd_soc_dapm_widget *w, | ||
302 | struct snd_kcontrol *kcontrol, int event) | 356 | struct snd_kcontrol *kcontrol, int event) |
303 | { | 357 | { |
304 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 358 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
305 | int ret = 0; | 359 | int ret = 0; |
306 | int val; | 360 | int val; |
307 | 361 | ||
308 | switch (e->reg) { | 362 | val = w->value >> e->shift_l; |
309 | case TWL4030_REG_PREDL_CTL: | 363 | if (!strcmp("Invalid", e->texts[val])) { |
310 | case TWL4030_REG_PREDR_CTL: | 364 | printk(KERN_WARNING "Invalid MUX setting on 0x%02x (%d)\n", |
311 | case TWL4030_REG_EAR_CTL: | 365 | e->reg, val); |
312 | val = w->value >> e->shift_l; | 366 | ret = -1; |
313 | if (val == 3) { | ||
314 | printk(KERN_WARNING | ||
315 | "Invalid MUX setting for register 0x%02x (%d)\n", | ||
316 | e->reg, val); | ||
317 | ret = -1; | ||
318 | } | ||
319 | break; | ||
320 | } | 367 | } |
321 | 368 | ||
322 | return ret; | 369 | return ret; |
323 | } | 370 | } |
324 | 371 | ||
372 | static int micpath_event(struct snd_soc_dapm_widget *w, | ||
373 | struct snd_kcontrol *kcontrol, int event) | ||
374 | { | ||
375 | struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value; | ||
376 | unsigned char adcmicsel, micbias_ctl; | ||
377 | |||
378 | adcmicsel = twl4030_read_reg_cache(w->codec, TWL4030_REG_ADCMICSEL); | ||
379 | micbias_ctl = twl4030_read_reg_cache(w->codec, TWL4030_REG_MICBIAS_CTL); | ||
380 | /* Prepare the bits for the given TX path: | ||
381 | * shift_l == 0: TX1 microphone path | ||
382 | * shift_l == 2: TX2 microphone path */ | ||
383 | if (e->shift_l) { | ||
384 | /* TX2 microphone path */ | ||
385 | if (adcmicsel & TWL4030_TX2IN_SEL) | ||
386 | micbias_ctl |= TWL4030_MICBIAS2_CTL; /* digimic */ | ||
387 | else | ||
388 | micbias_ctl &= ~TWL4030_MICBIAS2_CTL; | ||
389 | } else { | ||
390 | /* TX1 microphone path */ | ||
391 | if (adcmicsel & TWL4030_TX1IN_SEL) | ||
392 | micbias_ctl |= TWL4030_MICBIAS1_CTL; /* digimic */ | ||
393 | else | ||
394 | micbias_ctl &= ~TWL4030_MICBIAS1_CTL; | ||
395 | } | ||
396 | |||
397 | twl4030_write(w->codec, TWL4030_REG_MICBIAS_CTL, micbias_ctl); | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
325 | static int handsfree_event(struct snd_soc_dapm_widget *w, | 402 | static int handsfree_event(struct snd_soc_dapm_widget *w, |
326 | struct snd_kcontrol *kcontrol, int event) | 403 | struct snd_kcontrol *kcontrol, int event) |
327 | { | 404 | { |
@@ -503,162 +580,6 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol, | |||
503 | return err; | 580 | return err; |
504 | } | 581 | } |
505 | 582 | ||
506 | static int twl4030_get_left_input(struct snd_kcontrol *kcontrol, | ||
507 | struct snd_ctl_elem_value *ucontrol) | ||
508 | { | ||
509 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
510 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
511 | int result = 0; | ||
512 | |||
513 | /* one bit must be set a time */ | ||
514 | reg &= TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
515 | | TWL4030_MAINMIC_EN; | ||
516 | if (reg != 0) { | ||
517 | result++; | ||
518 | while ((reg & 1) == 0) { | ||
519 | result++; | ||
520 | reg >>= 1; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | ucontrol->value.integer.value[0] = result; | ||
525 | return 0; | ||
526 | } | ||
527 | |||
528 | static int twl4030_put_left_input(struct snd_kcontrol *kcontrol, | ||
529 | struct snd_ctl_elem_value *ucontrol) | ||
530 | { | ||
531 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
532 | int value = ucontrol->value.integer.value[0]; | ||
533 | u8 anamicl, micbias, avadc_ctl; | ||
534 | |||
535 | anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
536 | anamicl &= ~(TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
537 | | TWL4030_MAINMIC_EN); | ||
538 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
539 | micbias &= ~(TWL4030_HSMICBIAS_EN | TWL4030_MICBIAS1_EN); | ||
540 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
541 | |||
542 | switch (value) { | ||
543 | case 1: | ||
544 | anamicl |= TWL4030_MAINMIC_EN; | ||
545 | micbias |= TWL4030_MICBIAS1_EN; | ||
546 | break; | ||
547 | case 2: | ||
548 | anamicl |= TWL4030_HSMIC_EN; | ||
549 | micbias |= TWL4030_HSMICBIAS_EN; | ||
550 | break; | ||
551 | case 3: | ||
552 | anamicl |= TWL4030_AUXL_EN; | ||
553 | break; | ||
554 | case 4: | ||
555 | anamicl |= TWL4030_CKMIC_EN; | ||
556 | break; | ||
557 | default: | ||
558 | break; | ||
559 | } | ||
560 | |||
561 | /* If some input is selected, enable amp and ADC */ | ||
562 | if (value != 0) { | ||
563 | anamicl |= TWL4030_MICAMPL_EN; | ||
564 | avadc_ctl |= TWL4030_ADCL_EN; | ||
565 | } else { | ||
566 | anamicl &= ~TWL4030_MICAMPL_EN; | ||
567 | avadc_ctl &= ~TWL4030_ADCL_EN; | ||
568 | } | ||
569 | |||
570 | twl4030_write(codec, TWL4030_REG_ANAMICL, anamicl); | ||
571 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
572 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
573 | |||
574 | return 1; | ||
575 | } | ||
576 | |||
577 | static int twl4030_get_right_input(struct snd_kcontrol *kcontrol, | ||
578 | struct snd_ctl_elem_value *ucontrol) | ||
579 | { | ||
580 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
581 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
582 | int value = 0; | ||
583 | |||
584 | reg &= TWL4030_SUBMIC_EN|TWL4030_AUXR_EN; | ||
585 | switch (reg) { | ||
586 | case TWL4030_SUBMIC_EN: | ||
587 | value = 1; | ||
588 | break; | ||
589 | case TWL4030_AUXR_EN: | ||
590 | value = 2; | ||
591 | break; | ||
592 | default: | ||
593 | break; | ||
594 | } | ||
595 | |||
596 | ucontrol->value.integer.value[0] = value; | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static int twl4030_put_right_input(struct snd_kcontrol *kcontrol, | ||
601 | struct snd_ctl_elem_value *ucontrol) | ||
602 | { | ||
603 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
604 | int value = ucontrol->value.integer.value[0]; | ||
605 | u8 anamicr, micbias, avadc_ctl; | ||
606 | |||
607 | anamicr = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
608 | anamicr &= ~(TWL4030_SUBMIC_EN|TWL4030_AUXR_EN); | ||
609 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
610 | micbias &= ~TWL4030_MICBIAS2_EN; | ||
611 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
612 | |||
613 | switch (value) { | ||
614 | case 1: | ||
615 | anamicr |= TWL4030_SUBMIC_EN; | ||
616 | micbias |= TWL4030_MICBIAS2_EN; | ||
617 | break; | ||
618 | case 2: | ||
619 | anamicr |= TWL4030_AUXR_EN; | ||
620 | break; | ||
621 | default: | ||
622 | break; | ||
623 | } | ||
624 | |||
625 | if (value != 0) { | ||
626 | anamicr |= TWL4030_MICAMPR_EN; | ||
627 | avadc_ctl |= TWL4030_ADCR_EN; | ||
628 | } else { | ||
629 | anamicr &= ~TWL4030_MICAMPR_EN; | ||
630 | avadc_ctl &= ~TWL4030_ADCR_EN; | ||
631 | } | ||
632 | |||
633 | twl4030_write(codec, TWL4030_REG_ANAMICR, anamicr); | ||
634 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
635 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
636 | |||
637 | return 1; | ||
638 | } | ||
639 | |||
640 | static const char *twl4030_left_in_sel[] = { | ||
641 | "None", | ||
642 | "Main Mic", | ||
643 | "Headset Mic", | ||
644 | "Line In", | ||
645 | "Carkit Mic", | ||
646 | }; | ||
647 | |||
648 | static const char *twl4030_right_in_sel[] = { | ||
649 | "None", | ||
650 | "Sub Mic", | ||
651 | "Line In", | ||
652 | }; | ||
653 | |||
654 | static const struct soc_enum twl4030_left_input_mux = | ||
655 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_left_in_sel), | ||
656 | twl4030_left_in_sel); | ||
657 | |||
658 | static const struct soc_enum twl4030_right_input_mux = | ||
659 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_right_in_sel), | ||
660 | twl4030_right_in_sel); | ||
661 | |||
662 | /* | 583 | /* |
663 | * FGAIN volume control: | 584 | * FGAIN volume control: |
664 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) | 585 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) |
@@ -741,18 +662,15 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = { | |||
741 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), | 662 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), |
742 | 663 | ||
743 | /* Common capture gain controls */ | 664 | /* Common capture gain controls */ |
744 | SOC_DOUBLE_R_TLV("Capture Volume", | 665 | SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", |
745 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, | 666 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, |
746 | 0, 0x1f, 0, digital_capture_tlv), | 667 | 0, 0x1f, 0, digital_capture_tlv), |
668 | SOC_DOUBLE_R_TLV("TX2 Digital Capture Volume", | ||
669 | TWL4030_REG_AVTXL2PGA, TWL4030_REG_AVTXR2PGA, | ||
670 | 0, 0x1f, 0, digital_capture_tlv), | ||
747 | 671 | ||
748 | SOC_DOUBLE_TLV("Input Boost Volume", TWL4030_REG_ANAMIC_GAIN, | 672 | SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN, |
749 | 0, 3, 5, 0, input_gain_tlv), | 673 | 0, 3, 5, 0, input_gain_tlv), |
750 | |||
751 | /* Input source controls */ | ||
752 | SOC_ENUM_EXT("Left Input Source", twl4030_left_input_mux, | ||
753 | twl4030_get_left_input, twl4030_put_left_input), | ||
754 | SOC_ENUM_EXT("Right Input Source", twl4030_right_input_mux, | ||
755 | twl4030_get_right_input, twl4030_put_right_input), | ||
756 | }; | 674 | }; |
757 | 675 | ||
758 | /* add non dapm controls */ | 676 | /* add non dapm controls */ |
@@ -772,9 +690,19 @@ static int twl4030_add_controls(struct snd_soc_codec *codec) | |||
772 | } | 690 | } |
773 | 691 | ||
774 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | 692 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { |
775 | SND_SOC_DAPM_INPUT("INL"), | 693 | /* Left channel inputs */ |
776 | SND_SOC_DAPM_INPUT("INR"), | 694 | SND_SOC_DAPM_INPUT("MAINMIC"), |
777 | 695 | SND_SOC_DAPM_INPUT("HSMIC"), | |
696 | SND_SOC_DAPM_INPUT("AUXL"), | ||
697 | SND_SOC_DAPM_INPUT("CARKITMIC"), | ||
698 | /* Right channel inputs */ | ||
699 | SND_SOC_DAPM_INPUT("SUBMIC"), | ||
700 | SND_SOC_DAPM_INPUT("AUXR"), | ||
701 | /* Digital microphones (Stereo) */ | ||
702 | SND_SOC_DAPM_INPUT("DIGIMIC0"), | ||
703 | SND_SOC_DAPM_INPUT("DIGIMIC1"), | ||
704 | |||
705 | /* Outputs */ | ||
778 | SND_SOC_DAPM_OUTPUT("OUTL"), | 706 | SND_SOC_DAPM_OUTPUT("OUTL"), |
779 | SND_SOC_DAPM_OUTPUT("OUTR"), | 707 | SND_SOC_DAPM_OUTPUT("OUTR"), |
780 | SND_SOC_DAPM_OUTPUT("EARPIECE"), | 708 | SND_SOC_DAPM_OUTPUT("EARPIECE"), |
@@ -810,14 +738,14 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
810 | /* Output MUX controls */ | 738 | /* Output MUX controls */ |
811 | /* Earpiece */ | 739 | /* Earpiece */ |
812 | SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, | 740 | SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, |
813 | &twl4030_dapm_earpiece_control, outmixer_event, | 741 | &twl4030_dapm_earpiece_control, twl4030_enum_event, |
814 | SND_SOC_DAPM_PRE_REG), | 742 | SND_SOC_DAPM_PRE_REG), |
815 | /* PreDrivL/R */ | 743 | /* PreDrivL/R */ |
816 | SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, | 744 | SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, |
817 | &twl4030_dapm_predrivel_control, outmixer_event, | 745 | &twl4030_dapm_predrivel_control, twl4030_enum_event, |
818 | SND_SOC_DAPM_PRE_REG), | 746 | SND_SOC_DAPM_PRE_REG), |
819 | SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, | 747 | SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, |
820 | &twl4030_dapm_predriver_control, outmixer_event, | 748 | &twl4030_dapm_predriver_control, twl4030_enum_event, |
821 | SND_SOC_DAPM_PRE_REG), | 749 | SND_SOC_DAPM_PRE_REG), |
822 | /* HeadsetL/R */ | 750 | /* HeadsetL/R */ |
823 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, | 751 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, |
@@ -837,8 +765,50 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
837 | &twl4030_dapm_handsfreer_control, handsfree_event, | 765 | &twl4030_dapm_handsfreer_control, handsfree_event, |
838 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), | 766 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), |
839 | 767 | ||
840 | SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), | 768 | /* Introducing four virtual ADC, since TWL4030 have four channel for |
841 | SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), | 769 | capture */ |
770 | SND_SOC_DAPM_ADC("ADC Virtual Left1", "Left Front Capture", | ||
771 | SND_SOC_NOPM, 0, 0), | ||
772 | SND_SOC_DAPM_ADC("ADC Virtual Right1", "Right Front Capture", | ||
773 | SND_SOC_NOPM, 0, 0), | ||
774 | SND_SOC_DAPM_ADC("ADC Virtual Left2", "Left Rear Capture", | ||
775 | SND_SOC_NOPM, 0, 0), | ||
776 | SND_SOC_DAPM_ADC("ADC Virtual Right2", "Right Rear Capture", | ||
777 | SND_SOC_NOPM, 0, 0), | ||
778 | |||
779 | /* Analog/Digital mic path selection. | ||
780 | TX1 Left/Right: either analog Left/Right or Digimic0 | ||
781 | TX2 Left/Right: either analog Left/Right or Digimic1 */ | ||
782 | SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0, | ||
783 | &twl4030_dapm_micpathtx1_control, micpath_event, | ||
784 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
785 | SND_SOC_DAPM_POST_REG), | ||
786 | SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0, | ||
787 | &twl4030_dapm_micpathtx2_control, micpath_event, | ||
788 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
789 | SND_SOC_DAPM_POST_REG), | ||
790 | |||
791 | /* Analog input muxes with power switch for the physical ADCL/R */ | ||
792 | SND_SOC_DAPM_MUX_E("Analog Left Capture Route", | ||
793 | TWL4030_REG_AVADC_CTL, 3, 0, &twl4030_dapm_analoglmic_control, | ||
794 | twl4030_enum_event, SND_SOC_DAPM_PRE_REG), | ||
795 | SND_SOC_DAPM_MUX_E("Analog Right Capture Route", | ||
796 | TWL4030_REG_AVADC_CTL, 1, 0, &twl4030_dapm_analogrmic_control, | ||
797 | twl4030_enum_event, SND_SOC_DAPM_PRE_REG), | ||
798 | |||
799 | SND_SOC_DAPM_PGA("Analog Left Amplifier", | ||
800 | TWL4030_REG_ANAMICL, 4, 0, NULL, 0), | ||
801 | SND_SOC_DAPM_PGA("Analog Right Amplifier", | ||
802 | TWL4030_REG_ANAMICR, 4, 0, NULL, 0), | ||
803 | |||
804 | SND_SOC_DAPM_PGA("Digimic0 Enable", | ||
805 | TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), | ||
806 | SND_SOC_DAPM_PGA("Digimic1 Enable", | ||
807 | TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), | ||
808 | |||
809 | SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), | ||
810 | SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0), | ||
811 | SND_SOC_DAPM_MICBIAS("Headset Mic Bias", TWL4030_REG_MICBIAS_CTL, 2, 0), | ||
842 | }; | 812 | }; |
843 | 813 | ||
844 | static const struct snd_soc_dapm_route intercon[] = { | 814 | static const struct snd_soc_dapm_route intercon[] = { |
@@ -894,9 +864,39 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
894 | {"HFL", NULL, "HandsfreeL Mux"}, | 864 | {"HFL", NULL, "HandsfreeL Mux"}, |
895 | {"HFR", NULL, "HandsfreeR Mux"}, | 865 | {"HFR", NULL, "HandsfreeR Mux"}, |
896 | 866 | ||
897 | /* inputs */ | 867 | /* Capture path */ |
898 | {"ADCL", NULL, "INL"}, | 868 | {"Analog Left Capture Route", "Main mic", "MAINMIC"}, |
899 | {"ADCR", NULL, "INR"}, | 869 | {"Analog Left Capture Route", "Headset mic", "HSMIC"}, |
870 | {"Analog Left Capture Route", "AUXL", "AUXL"}, | ||
871 | {"Analog Left Capture Route", "Carkit mic", "CARKITMIC"}, | ||
872 | |||
873 | {"Analog Right Capture Route", "Sub mic", "SUBMIC"}, | ||
874 | {"Analog Right Capture Route", "AUXR", "AUXR"}, | ||
875 | |||
876 | {"Analog Left Amplifier", NULL, "Analog Left Capture Route"}, | ||
877 | {"Analog Right Amplifier", NULL, "Analog Right Capture Route"}, | ||
878 | |||
879 | {"Digimic0 Enable", NULL, "DIGIMIC0"}, | ||
880 | {"Digimic1 Enable", NULL, "DIGIMIC1"}, | ||
881 | |||
882 | /* TX1 Left capture path */ | ||
883 | {"TX1 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
884 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
885 | /* TX1 Right capture path */ | ||
886 | {"TX1 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
887 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
888 | /* TX2 Left capture path */ | ||
889 | {"TX2 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
890 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
891 | /* TX2 Right capture path */ | ||
892 | {"TX2 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
893 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
894 | |||
895 | {"ADC Virtual Left1", NULL, "TX1 Capture Route"}, | ||
896 | {"ADC Virtual Right1", NULL, "TX1 Capture Route"}, | ||
897 | {"ADC Virtual Left2", NULL, "TX2 Capture Route"}, | ||
898 | {"ADC Virtual Right2", NULL, "TX2 Capture Route"}, | ||
899 | |||
900 | }; | 900 | }; |
901 | 901 | ||
902 | static int twl4030_add_widgets(struct snd_soc_codec *codec) | 902 | static int twl4030_add_widgets(struct snd_soc_codec *codec) |
@@ -923,6 +923,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec) | |||
923 | twl4030_write(codec, TWL4030_REG_ANAMICL, | 923 | twl4030_write(codec, TWL4030_REG_ANAMICL, |
924 | anamicl | TWL4030_CNCL_OFFSET_START); | 924 | anamicl | TWL4030_CNCL_OFFSET_START); |
925 | 925 | ||
926 | |||
926 | /* wait for offset cancellation to complete */ | 927 | /* wait for offset cancellation to complete */ |
927 | do { | 928 | do { |
928 | /* this takes a little while, so don't slam i2c */ | 929 | /* this takes a little while, so don't slam i2c */ |