aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_analog.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r--sound/pci/hda/patch_analog.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index e0a605adde42..a99e86d74278 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2858,6 +2858,7 @@ static const char *ad1988_models[AD1988_MODEL_LAST] = {
2858static struct snd_pci_quirk ad1988_cfg_tbl[] = { 2858static struct snd_pci_quirk ad1988_cfg_tbl[] = {
2859 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), 2859 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
2860 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), 2860 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
2861 SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
2861 {} 2862 {}
2862}; 2863};
2863 2864
@@ -3643,33 +3644,17 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3643 { } /* end */ 3644 { } /* end */
3644}; 3645};
3645 3646
3646static struct hda_input_mux ad1884a_mobile_capture_source = {
3647 .num_items = 2,
3648 .items = {
3649 { "Mic", 0x1 }, /* port-C */
3650 { "Mix", 0x3 },
3651 },
3652};
3653
3654static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { 3647static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3655 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3648 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3656 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3649 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
3657 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3650 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
3658 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3651 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
3659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
3660 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT),
3661 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3652 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
3662 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3653 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),
3663 HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), 3654 HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT),
3655 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT),
3664 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3656 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
3665 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3657 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
3666 {
3667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3668 .name = "Capture Source",
3669 .info = ad198x_mux_enum_info,
3670 .get = ad198x_mux_enum_get,
3671 .put = ad198x_mux_enum_put,
3672 },
3673 { } /* end */ 3658 { } /* end */
3674}; 3659};
3675 3660
@@ -3686,14 +3671,31 @@ static void ad1884a_hp_automute(struct hda_codec *codec)
3686 present ? 0x00 : 0x02); 3671 present ? 0x00 : 0x02);
3687} 3672}
3688 3673
3674/* switch to external mic if plugged */
3675static void ad1884a_hp_automic(struct hda_codec *codec)
3676{
3677 unsigned int present;
3678
3679 present = snd_hda_codec_read(codec, 0x14, 0,
3680 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
3681 snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL,
3682 present ? 0 : 1);
3683}
3684
3689#define AD1884A_HP_EVENT 0x37 3685#define AD1884A_HP_EVENT 0x37
3686#define AD1884A_MIC_EVENT 0x36
3690 3687
3691/* unsolicited event for HP jack sensing */ 3688/* unsolicited event for HP jack sensing */
3692static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res) 3689static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3693{ 3690{
3694 if ((res >> 26) != AD1884A_HP_EVENT) 3691 switch (res >> 26) {
3695 return; 3692 case AD1884A_HP_EVENT:
3696 ad1884a_hp_automute(codec); 3693 ad1884a_hp_automute(codec);
3694 break;
3695 case AD1884A_MIC_EVENT:
3696 ad1884a_hp_automic(codec);
3697 break;
3698 }
3697} 3699}
3698 3700
3699/* initialize jack-sensing, too */ 3701/* initialize jack-sensing, too */
@@ -3701,6 +3703,7 @@ static int ad1884a_hp_init(struct hda_codec *codec)
3701{ 3703{
3702 ad198x_init(codec); 3704 ad198x_init(codec);
3703 ad1884a_hp_automute(codec); 3705 ad1884a_hp_automute(codec);
3706 ad1884a_hp_automic(codec);
3704 return 0; 3707 return 0;
3705} 3708}
3706 3709
@@ -3714,10 +3717,15 @@ static struct hda_verb ad1884a_laptop_verbs[] = {
3714 /* Port-F pin */ 3717 /* Port-F pin */
3715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3720 /* Port-C pin - internal mic-in */
3721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3722 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
3723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
3717 /* analog mix */ 3724 /* analog mix */
3718 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 3725 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3719 /* unsolicited event for pin-sense */ 3726 /* unsolicited event for pin-sense */
3720 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, 3727 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
3728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
3721 { } /* end */ 3729 { } /* end */
3722}; 3730};
3723 3731
@@ -3877,7 +3885,6 @@ static int patch_ad1884a(struct hda_codec *codec)
3877 spec->mixers[0] = ad1884a_mobile_mixers; 3885 spec->mixers[0] = ad1884a_mobile_mixers;
3878 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; 3886 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs;
3879 spec->multiout.dig_out_nid = 0; 3887 spec->multiout.dig_out_nid = 0;
3880 spec->input_mux = &ad1884a_mobile_capture_source;
3881 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3888 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event;
3882 codec->patch_ops.init = ad1884a_hp_init; 3889 codec->patch_ops.init = ad1884a_hp_init;
3883 break; 3890 break;