Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8718b700 authored by Herton Ronaldo Krzesinski's avatar Herton Ronaldo Krzesinski Committed by Takashi Iwai
Browse files

ALSA: hda - Add headphone automute support for 3stack-hp model (ALC888)



Mute speaker outputs on headphone insertion for machines that use
3stack-hp model.

Signed-off-by: default avatarHerton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3ea0d7cf
Loading
Loading
Loading
Loading
+33 −5
Original line number Diff line number Diff line
@@ -8056,16 +8056,42 @@ static struct hda_verb alc888_lenovo_sky_verbs[] = {
	{ } /* end */
};
static struct hda_verb alc888_6st_dell_verbs[] = {
	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
	{ }
};
static void alc888_3st_hp_front_automute(struct hda_codec *codec)
{
	unsigned int present, bits;
	present = snd_hda_codec_read(codec, 0x1b, 0,
			AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
				 HDA_AMP_MUTE, bits);
}
static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
				      unsigned int res)
{
	switch (res >> 26) {
	case ALC880_HP_EVENT:
		alc888_3st_hp_front_automute(codec);
		break;
	}
}
static struct hda_verb alc888_3st_hp_verbs[] = {
	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},	/* Front: output 0 (0x0c) */
	{0x16, AC_VERB_SET_CONNECT_SEL, 0x01},	/* Rear : output 1 (0x0d) */
	{0x18, AC_VERB_SET_CONNECT_SEL, 0x02},	/* CLFE : output 2 (0x0e) */
	{ }
};
static struct hda_verb alc888_6st_dell_verbs[] = {
	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
	{ }
	{ } /* end */
};
/*
@@ -8950,6 +8976,8 @@ static struct alc_config_preset alc883_presets[] = {
		.channel_mode = alc888_3st_hp_modes,
		.need_dac_fix = 1,
		.input_mux = &alc883_capture_source,
		.unsol_event = alc888_3st_hp_unsol_event,
		.init_hook = alc888_3st_hp_front_automute,
	},
	[ALC888_6ST_DELL] = {
		.mixers = { alc883_base_mixer, alc883_chmode_mixer },