aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_analog.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 9d0d2a1bbd64..266c35e32b64 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -612,13 +612,19 @@ static struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
612 }, 612 },
613}; 613};
614 614
615static struct hda_input_mux ad1986a_automic_capture_source = {
616 .num_items = 2,
617 .items = {
618 { "Mic", 0x0 },
619 { "Mix", 0x5 },
620 },
621};
622
615static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 623static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
616 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 624 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
617 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), 625 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
618 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 626 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
619 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 627 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
620 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT),
621 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT),
622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
623 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 629 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
624 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), 630 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
@@ -642,6 +648,33 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
642 { } /* end */ 648 { } /* end */
643}; 649};
644 650
651/* re-connect the mic boost input according to the jack sensing */
652static void ad1986a_automic(struct hda_codec *codec)
653{
654 unsigned int present;
655 present = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_PIN_SENSE, 0);
656 /* 0 = 0x1f, 2 = 0x1d, 4 = mixed */
657 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_CONNECT_SEL,
658 (present & AC_PINSENSE_PRESENCE) ? 0 : 2);
659}
660
661#define AD1986A_MIC_EVENT 0x36
662
663static void ad1986a_automic_unsol_event(struct hda_codec *codec,
664 unsigned int res)
665{
666 if ((res >> 26) != AD1986A_MIC_EVENT)
667 return;
668 ad1986a_automic(codec);
669}
670
671static int ad1986a_automic_init(struct hda_codec *codec)
672{
673 ad198x_init(codec);
674 ad1986a_automic(codec);
675 return 0;
676}
677
645/* laptop-automute - 2ch only */ 678/* laptop-automute - 2ch only */
646 679
647static void ad1986a_update_hp(struct hda_codec *codec) 680static void ad1986a_update_hp(struct hda_codec *codec)
@@ -845,6 +878,15 @@ static struct hda_verb ad1986a_eapd_init_verbs[] = {
845 {} 878 {}
846}; 879};
847 880
881static struct hda_verb ad1986a_automic_verbs[] = {
882 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
883 {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
884 /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/
885 {0x0f, AC_VERB_SET_CONNECT_SEL, 0x0},
886 {0x1f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_MIC_EVENT},
887 {}
888};
889
848/* Ultra initialization */ 890/* Ultra initialization */
849static struct hda_verb ad1986a_ultra_init[] = { 891static struct hda_verb ad1986a_ultra_init[] = {
850 /* eapd initialization */ 892 /* eapd initialization */
@@ -987,14 +1029,17 @@ static int patch_ad1986a(struct hda_codec *codec)
987 break; 1029 break;
988 case AD1986A_LAPTOP_EAPD: 1030 case AD1986A_LAPTOP_EAPD:
989 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 1031 spec->mixers[0] = ad1986a_laptop_eapd_mixers;
990 spec->num_init_verbs = 2; 1032 spec->num_init_verbs = 3;
991 spec->init_verbs[1] = ad1986a_eapd_init_verbs; 1033 spec->init_verbs[1] = ad1986a_eapd_init_verbs;
1034 spec->init_verbs[2] = ad1986a_automic_verbs;
992 spec->multiout.max_channels = 2; 1035 spec->multiout.max_channels = 2;
993 spec->multiout.num_dacs = 1; 1036 spec->multiout.num_dacs = 1;
994 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 1037 spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
995 if (!is_jack_available(codec, 0x25)) 1038 if (!is_jack_available(codec, 0x25))
996 spec->multiout.dig_out_nid = 0; 1039 spec->multiout.dig_out_nid = 0;
997 spec->input_mux = &ad1986a_laptop_eapd_capture_source; 1040 spec->input_mux = &ad1986a_automic_capture_source;
1041 codec->patch_ops.unsol_event = ad1986a_automic_unsol_event;
1042 codec->patch_ops.init = ad1986a_automic_init;
998 break; 1043 break;
999 case AD1986A_LAPTOP_AUTOMUTE: 1044 case AD1986A_LAPTOP_AUTOMUTE:
1000 spec->mixers[0] = ad1986a_laptop_automute_mixers; 1045 spec->mixers[0] = ad1986a_laptop_automute_mixers;