[ALSA] hda - Fix mic input on HP2133
The mic pins are wrongly assigned on AD1884A mobile model. The mic handling is fixed for the automatic mic selection, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e48d6d97bb
commit
269ef19caa
@ -3644,33 +3644,17 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
|
|||||||
{ } /* end */
|
{ } /* end */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct hda_input_mux ad1884a_mobile_capture_source = {
|
|
||||||
.num_items = 2,
|
|
||||||
.items = {
|
|
||||||
{ "Mic", 0x1 }, /* port-C */
|
|
||||||
{ "Mix", 0x3 },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
|
static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
|
||||||
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
|
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
|
||||||
HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
|
HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
|
||||||
HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
|
HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
|
||||||
HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
|
HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
|
||||||
HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
|
|
||||||
HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT),
|
|
||||||
HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
|
HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
|
||||||
HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),
|
HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),
|
||||||
HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT),
|
HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT),
|
||||||
|
HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT),
|
||||||
HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
|
HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
|
||||||
HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
|
HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "Capture Source",
|
|
||||||
.info = ad198x_mux_enum_info,
|
|
||||||
.get = ad198x_mux_enum_get,
|
|
||||||
.put = ad198x_mux_enum_put,
|
|
||||||
},
|
|
||||||
{ } /* end */
|
{ } /* end */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3687,14 +3671,31 @@ static void ad1884a_hp_automute(struct hda_codec *codec)
|
|||||||
present ? 0x00 : 0x02);
|
present ? 0x00 : 0x02);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* switch to external mic if plugged */
|
||||||
|
static void ad1884a_hp_automic(struct hda_codec *codec)
|
||||||
|
{
|
||||||
|
unsigned int present;
|
||||||
|
|
||||||
|
present = snd_hda_codec_read(codec, 0x14, 0,
|
||||||
|
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
|
||||||
|
snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL,
|
||||||
|
present ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
#define AD1884A_HP_EVENT 0x37
|
#define AD1884A_HP_EVENT 0x37
|
||||||
|
#define AD1884A_MIC_EVENT 0x36
|
||||||
|
|
||||||
/* unsolicited event for HP jack sensing */
|
/* unsolicited event for HP jack sensing */
|
||||||
static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res)
|
static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res)
|
||||||
{
|
{
|
||||||
if ((res >> 26) != AD1884A_HP_EVENT)
|
switch (res >> 26) {
|
||||||
return;
|
case AD1884A_HP_EVENT:
|
||||||
ad1884a_hp_automute(codec);
|
ad1884a_hp_automute(codec);
|
||||||
|
break;
|
||||||
|
case AD1884A_MIC_EVENT:
|
||||||
|
ad1884a_hp_automic(codec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize jack-sensing, too */
|
/* initialize jack-sensing, too */
|
||||||
@ -3702,6 +3703,7 @@ static int ad1884a_hp_init(struct hda_codec *codec)
|
|||||||
{
|
{
|
||||||
ad198x_init(codec);
|
ad198x_init(codec);
|
||||||
ad1884a_hp_automute(codec);
|
ad1884a_hp_automute(codec);
|
||||||
|
ad1884a_hp_automic(codec);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3715,10 +3717,15 @@ static struct hda_verb ad1884a_laptop_verbs[] = {
|
|||||||
/* Port-F pin */
|
/* Port-F pin */
|
||||||
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
|
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
|
||||||
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
|
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
|
||||||
|
/* Port-C pin - internal mic-in */
|
||||||
|
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
|
||||||
|
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
|
||||||
|
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
|
||||||
/* analog mix */
|
/* analog mix */
|
||||||
{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
|
{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
|
||||||
/* unsolicited event for pin-sense */
|
/* unsolicited event for pin-sense */
|
||||||
{0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
|
{0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
|
||||||
|
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
|
||||||
{ } /* end */
|
{ } /* end */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3878,7 +3885,6 @@ static int patch_ad1884a(struct hda_codec *codec)
|
|||||||
spec->mixers[0] = ad1884a_mobile_mixers;
|
spec->mixers[0] = ad1884a_mobile_mixers;
|
||||||
spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs;
|
spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs;
|
||||||
spec->multiout.dig_out_nid = 0;
|
spec->multiout.dig_out_nid = 0;
|
||||||
spec->input_mux = &ad1884a_mobile_capture_source;
|
|
||||||
codec->patch_ops.unsol_event = ad1884a_hp_unsol_event;
|
codec->patch_ops.unsol_event = ad1884a_hp_unsol_event;
|
||||||
codec->patch_ops.init = ad1884a_hp_init;
|
codec->patch_ops.init = ad1884a_hp_init;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user