aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl4030.c377
-rw-r--r--sound/soc/codecs/twl4030.h7
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c4
-rw-r--r--sound/soc/soc-core.c46
-rw-r--r--sound/soc/soc-dapm.c10
5 files changed, 227 insertions, 217 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 =
298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =
299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); 299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
300 300
301static int outmixer_event(struct snd_soc_dapm_widget *w, 301/* Left analog microphone selection */
302static const char *twl4030_analoglmic_texts[] =
303 {"Off", "Main mic", "Headset mic", "Invalid", "AUXL",
304 "Invalid", "Invalid", "Invalid", "Carkit mic"};
305
306static 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
311static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control =
312SOC_DAPM_ENUM("Route", twl4030_analoglmic_enum);
313
314/* Right analog microphone selection */
315static const char *twl4030_analogrmic_texts[] =
316 {"Off", "Sub mic", "Invalid", "Invalid", "AUXR"};
317
318static 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
323static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control =
324SOC_DAPM_ENUM("Route", twl4030_analogrmic_enum);
325
326/* TX1 L/R Analog/Digital microphone selection */
327static const char *twl4030_micpathtx1_texts[] =
328 {"Analog", "Digimic0"};
329
330static 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
335static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control =
336SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum);
337
338/* TX2 L/R Analog/Digital microphone selection */
339static const char *twl4030_micpathtx2_texts[] =
340 {"Analog", "Digimic1"};
341
342static 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
347static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control =
348SOC_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 */
355static 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
372static 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
325static int handsfree_event(struct snd_soc_dapm_widget *w, 402static 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
506static 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
528static 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
577static 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
600static 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
640static const char *twl4030_left_in_sel[] = {
641 "None",
642 "Main Mic",
643 "Headset Mic",
644 "Line In",
645 "Carkit Mic",
646};
647
648static const char *twl4030_right_in_sel[] = {
649 "None",
650 "Sub Mic",
651 "Line In",
652};
653
654static 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
658static 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
774static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { 692static 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
844static const struct snd_soc_dapm_route intercon[] = { 814static 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
902static int twl4030_add_widgets(struct snd_soc_codec *codec) 902static 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 */
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 54615c76802b..442e5a828617 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -147,6 +147,13 @@
147#define TWL4030_AVADC_CLK_PRIORITY 0x04 147#define TWL4030_AVADC_CLK_PRIORITY 0x04
148#define TWL4030_ADCR_EN 0x02 148#define TWL4030_ADCR_EN 0x02
149 149
150/* TWL4030_REG_ADCMICSEL (0x08) Fields */
151
152#define TWL4030_DIGMIC1_EN 0x08
153#define TWL4030_TX2IN_SEL 0x04
154#define TWL4030_DIGMIC0_EN 0x02
155#define TWL4030_TX1IN_SEL 0x01
156
150/* AUDIO_IF (0x0E) Fields */ 157/* AUDIO_IF (0x0E) Fields */
151 158
152#define TWL4030_AIF_SLAVE_EN 0x80 159#define TWL4030_AIF_SLAVE_EN 0x80
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index c670d08e7c9e..53b9fb127a6d 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -61,9 +61,9 @@ static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream)
61 61
62 __pxa2xx_pcm_hw_free(substream); 62 __pxa2xx_pcm_hw_free(substream);
63 63
64 if (prtd->dma_ch) { 64 if (prtd->dma_ch >= 0) {
65 pxa_free_dma(prtd->dma_ch); 65 pxa_free_dma(prtd->dma_ch);
66 prtd->dma_ch = 0; 66 prtd->dma_ch = -1;
67 } 67 }
68 68
69 return 0; 69 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b098c0b4c584..f73c1341437c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits);
1300/** 1300/**
1301 * snd_soc_new_pcms - create new sound card and pcms 1301 * snd_soc_new_pcms - create new sound card and pcms
1302 * @socdev: the SoC audio device 1302 * @socdev: the SoC audio device
1303 * @idx: ALSA card index
1304 * @xid: card identification
1303 * 1305 *
1304 * Create a new sound card based upon the codec and interface pcms. 1306 * Create a new sound card based upon the codec and interface pcms.
1305 * 1307 *
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams);
1472 * snd_soc_cnew - create new control 1474 * snd_soc_cnew - create new control
1473 * @_template: control template 1475 * @_template: control template
1474 * @data: control private data 1476 * @data: control private data
1475 * @lnng_name: control long name 1477 * @long_name: control long name
1476 * 1478 *
1477 * Create a new mixer control from a template control. 1479 * Create a new mixer control from a template control.
1478 * 1480 *
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
1522/** 1524/**
1523 * snd_soc_get_enum_double - enumerated double mixer get callback 1525 * snd_soc_get_enum_double - enumerated double mixer get callback
1524 * @kcontrol: mixer control 1526 * @kcontrol: mixer control
1525 * @uinfo: control element information 1527 * @ucontrol: control element information
1526 * 1528 *
1527 * Callback to get the value of a double enumerated mixer. 1529 * Callback to get the value of a double enumerated mixer.
1528 * 1530 *
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double);
1551/** 1553/**
1552 * snd_soc_put_enum_double - enumerated double mixer put callback 1554 * snd_soc_put_enum_double - enumerated double mixer put callback
1553 * @kcontrol: mixer control 1555 * @kcontrol: mixer control
1554 * @uinfo: control element information 1556 * @ucontrol: control element information
1555 * 1557 *
1556 * Callback to set the value of a double enumerated mixer. 1558 * Callback to set the value of a double enumerated mixer.
1557 * 1559 *
@@ -1668,7 +1670,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
1668/** 1670/**
1669 * snd_soc_get_volsw - single mixer get callback 1671 * snd_soc_get_volsw - single mixer get callback
1670 * @kcontrol: mixer control 1672 * @kcontrol: mixer control
1671 * @uinfo: control element information 1673 * @ucontrol: control element information
1672 * 1674 *
1673 * Callback to get the value of a single mixer control. 1675 * Callback to get the value of a single mixer control.
1674 * 1676 *
@@ -1707,7 +1709,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
1707/** 1709/**
1708 * snd_soc_put_volsw - single mixer put callback 1710 * snd_soc_put_volsw - single mixer put callback
1709 * @kcontrol: mixer control 1711 * @kcontrol: mixer control
1710 * @uinfo: control element information 1712 * @ucontrol: control element information
1711 * 1713 *
1712 * Callback to set the value of a single mixer control. 1714 * Callback to set the value of a single mixer control.
1713 * 1715 *
@@ -1775,7 +1777,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r);
1775/** 1777/**
1776 * snd_soc_get_volsw_2r - double mixer get callback 1778 * snd_soc_get_volsw_2r - double mixer get callback
1777 * @kcontrol: mixer control 1779 * @kcontrol: mixer control
1778 * @uinfo: control element information 1780 * @ucontrol: control element information
1779 * 1781 *
1780 * Callback to get the value of a double mixer control that spans 2 registers. 1782 * Callback to get the value of a double mixer control that spans 2 registers.
1781 * 1783 *
@@ -1812,7 +1814,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r);
1812/** 1814/**
1813 * snd_soc_put_volsw_2r - double mixer set callback 1815 * snd_soc_put_volsw_2r - double mixer set callback
1814 * @kcontrol: mixer control 1816 * @kcontrol: mixer control
1815 * @uinfo: control element information 1817 * @ucontrol: control element information
1816 * 1818 *
1817 * Callback to set the value of a double mixer control that spans 2 registers. 1819 * Callback to set the value of a double mixer control that spans 2 registers.
1818 * 1820 *
@@ -1882,7 +1884,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8);
1882/** 1884/**
1883 * snd_soc_get_volsw_s8 - signed mixer get callback 1885 * snd_soc_get_volsw_s8 - signed mixer get callback
1884 * @kcontrol: mixer control 1886 * @kcontrol: mixer control
1885 * @uinfo: control element information 1887 * @ucontrol: control element information
1886 * 1888 *
1887 * Callback to get the value of a signed mixer control. 1889 * Callback to get the value of a signed mixer control.
1888 * 1890 *
@@ -1909,7 +1911,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8);
1909/** 1911/**
1910 * snd_soc_put_volsw_sgn - signed mixer put callback 1912 * snd_soc_put_volsw_sgn - signed mixer put callback
1911 * @kcontrol: mixer control 1913 * @kcontrol: mixer control
1912 * @uinfo: control element information 1914 * @ucontrol: control element information
1913 * 1915 *
1914 * Callback to set the value of a signed mixer control. 1916 * Callback to set the value of a signed mixer control.
1915 * 1917 *
@@ -1954,7 +1956,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
1954/** 1956/**
1955 * snd_soc_dai_set_clkdiv - configure DAI clock dividers. 1957 * snd_soc_dai_set_clkdiv - configure DAI clock dividers.
1956 * @dai: DAI 1958 * @dai: DAI
1957 * @clk_id: DAI specific clock divider ID 1959 * @div_id: DAI specific clock divider ID
1958 * @div: new clock divisor. 1960 * @div: new clock divisor.
1959 * 1961 *
1960 * Configures the clock dividers. This is used to derive the best DAI bit and 1962 * Configures the clock dividers. This is used to derive the best DAI bit and
@@ -2060,7 +2062,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute);
2060/** 2062/**
2061 * snd_soc_register_card - Register a card with the ASoC core 2063 * snd_soc_register_card - Register a card with the ASoC core
2062 * 2064 *
2063 * @param card Card to register 2065 * @card: Card to register
2064 * 2066 *
2065 * Note that currently this is an internal only function: it will be 2067 * Note that currently this is an internal only function: it will be
2066 * exposed to machine drivers after further backporting of ASoC v2 2068 * exposed to machine drivers after further backporting of ASoC v2
@@ -2087,7 +2089,7 @@ static int snd_soc_register_card(struct snd_soc_card *card)
2087/** 2089/**
2088 * snd_soc_unregister_card - Unregister a card with the ASoC core 2090 * snd_soc_unregister_card - Unregister a card with the ASoC core
2089 * 2091 *
2090 * @param card Card to unregister 2092 * @card: Card to unregister
2091 * 2093 *
2092 * Note that currently this is an internal only function: it will be 2094 * Note that currently this is an internal only function: it will be
2093 * exposed to machine drivers after further backporting of ASoC v2 2095 * exposed to machine drivers after further backporting of ASoC v2
@@ -2107,7 +2109,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card)
2107/** 2109/**
2108 * snd_soc_register_dai - Register a DAI with the ASoC core 2110 * snd_soc_register_dai - Register a DAI with the ASoC core
2109 * 2111 *
2110 * @param dai DAI to register 2112 * @dai: DAI to register
2111 */ 2113 */
2112int snd_soc_register_dai(struct snd_soc_dai *dai) 2114int snd_soc_register_dai(struct snd_soc_dai *dai)
2113{ 2115{
@@ -2134,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai);
2134/** 2136/**
2135 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core 2137 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core
2136 * 2138 *
2137 * @param dai DAI to unregister 2139 * @dai: DAI to unregister
2138 */ 2140 */
2139void snd_soc_unregister_dai(struct snd_soc_dai *dai) 2141void snd_soc_unregister_dai(struct snd_soc_dai *dai)
2140{ 2142{
@@ -2149,8 +2151,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai);
2149/** 2151/**
2150 * snd_soc_register_dais - Register multiple DAIs with the ASoC core 2152 * snd_soc_register_dais - Register multiple DAIs with the ASoC core
2151 * 2153 *
2152 * @param dai Array of DAIs to register 2154 * @dai: Array of DAIs to register
2153 * @param count Number of DAIs 2155 * @count: Number of DAIs
2154 */ 2156 */
2155int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) 2157int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
2156{ 2158{
@@ -2175,8 +2177,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais);
2175/** 2177/**
2176 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core 2178 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core
2177 * 2179 *
2178 * @param dai Array of DAIs to unregister 2180 * @dai: Array of DAIs to unregister
2179 * @param count Number of DAIs 2181 * @count: Number of DAIs
2180 */ 2182 */
2181void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) 2183void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count)
2182{ 2184{
@@ -2190,7 +2192,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);
2190/** 2192/**
2191 * snd_soc_register_platform - Register a platform with the ASoC core 2193 * snd_soc_register_platform - Register a platform with the ASoC core
2192 * 2194 *
2193 * @param platform platform to register 2195 * @platform: platform to register
2194 */ 2196 */
2195int snd_soc_register_platform(struct snd_soc_platform *platform) 2197int snd_soc_register_platform(struct snd_soc_platform *platform)
2196{ 2198{
@@ -2213,7 +2215,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform);
2213/** 2215/**
2214 * snd_soc_unregister_platform - Unregister a platform from the ASoC core 2216 * snd_soc_unregister_platform - Unregister a platform from the ASoC core
2215 * 2217 *
2216 * @param platform platform to unregister 2218 * @platform: platform to unregister
2217 */ 2219 */
2218void snd_soc_unregister_platform(struct snd_soc_platform *platform) 2220void snd_soc_unregister_platform(struct snd_soc_platform *platform)
2219{ 2221{
@@ -2228,7 +2230,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform);
2228/** 2230/**
2229 * snd_soc_register_codec - Register a codec with the ASoC core 2231 * snd_soc_register_codec - Register a codec with the ASoC core
2230 * 2232 *
2231 * @param codec codec to register 2233 * @codec: codec to register
2232 */ 2234 */
2233int snd_soc_register_codec(struct snd_soc_codec *codec) 2235int snd_soc_register_codec(struct snd_soc_codec *codec)
2234{ 2236{
@@ -2255,7 +2257,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec);
2255/** 2257/**
2256 * snd_soc_unregister_codec - Unregister a codec from the ASoC core 2258 * snd_soc_unregister_codec - Unregister a codec from the ASoC core
2257 * 2259 *
2258 * @param codec codec to unregister 2260 * @codec: codec to unregister
2259 */ 2261 */
2260void snd_soc_unregister_codec(struct snd_soc_codec *codec) 2262void snd_soc_unregister_codec(struct snd_soc_codec *codec)
2261{ 2263{
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8863eddbac02..6c79ca6df0bf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1077,7 +1077,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
1077/** 1077/**
1078 * snd_soc_dapm_get_volsw - dapm mixer get callback 1078 * snd_soc_dapm_get_volsw - dapm mixer get callback
1079 * @kcontrol: mixer control 1079 * @kcontrol: mixer control
1080 * @uinfo: control element information 1080 * @ucontrol: control element information
1081 * 1081 *
1082 * Callback to get the value of a dapm mixer control. 1082 * Callback to get the value of a dapm mixer control.
1083 * 1083 *
@@ -1122,7 +1122,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
1122/** 1122/**
1123 * snd_soc_dapm_put_volsw - dapm mixer set callback 1123 * snd_soc_dapm_put_volsw - dapm mixer set callback
1124 * @kcontrol: mixer control 1124 * @kcontrol: mixer control
1125 * @uinfo: control element information 1125 * @ucontrol: control element information
1126 * 1126 *
1127 * Callback to set the value of a dapm mixer control. 1127 * Callback to set the value of a dapm mixer control.
1128 * 1128 *
@@ -1193,7 +1193,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
1193/** 1193/**
1194 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback 1194 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback
1195 * @kcontrol: mixer control 1195 * @kcontrol: mixer control
1196 * @uinfo: control element information 1196 * @ucontrol: control element information
1197 * 1197 *
1198 * Callback to get the value of a dapm enumerated double mixer control. 1198 * Callback to get the value of a dapm enumerated double mixer control.
1199 * 1199 *
@@ -1221,7 +1221,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
1221/** 1221/**
1222 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback 1222 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback
1223 * @kcontrol: mixer control 1223 * @kcontrol: mixer control
1224 * @uinfo: control element information 1224 * @ucontrol: control element information
1225 * 1225 *
1226 * Callback to set the value of a dapm enumerated double mixer control. 1226 * Callback to set the value of a dapm enumerated double mixer control.
1227 * 1227 *
@@ -1419,7 +1419,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
1419 1419
1420/** 1420/**
1421 * snd_soc_dapm_enable_pin - enable pin. 1421 * snd_soc_dapm_enable_pin - enable pin.
1422 * @snd_soc_codec: SoC codec 1422 * @codec: SoC codec
1423 * @pin: pin name 1423 * @pin: pin name
1424 * 1424 *
1425 * Enables input/output pin and it's parents or children widgets iff there is 1425 * Enables input/output pin and it's parents or children widgets iff there is