Commit ebc7a406 authored by Takashi Iwai's avatar Takashi Iwai

[ALSA] hda - Fix ALC262 fujitsu model

Fixed the speaker auto-mute with two laptop and docking headphones.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Acked-by: default avatarTony Vroon <tony@linx.net>
parent 4b7afb0d
...@@ -8757,35 +8757,39 @@ static struct hda_input_mux alc262_HP_D7000_capture_source = { ...@@ -8757,35 +8757,39 @@ static struct hda_input_mux alc262_HP_D7000_capture_source = {
}, },
}; };
/* mute/unmute internal speaker according to the hp jack and mute state */ /* mute/unmute internal speaker according to the hp jacks and mute state */
static void alc262_fujitsu_automute(struct hda_codec *codec, int force) static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
unsigned int mute; unsigned int mute;
if (force || !spec->sense_updated) { if (force || !spec->sense_updated) {
unsigned int present_int_hp, present_dock_hp; unsigned int present;
/* need to execute and sync at first */ /* need to execute and sync at first */
snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
present_int_hp = snd_hda_codec_read(codec, 0x14, 0, /* check laptop HP jack */
AC_VERB_GET_PIN_SENSE, 0); present = snd_hda_codec_read(codec, 0x14, 0,
snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); AC_VERB_GET_PIN_SENSE, 0);
present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, /* need to execute and sync at first */
AC_VERB_GET_PIN_SENSE, 0); snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
spec->jack_present = (present_int_hp & 0x80000000) != 0; /* check docking HP jack */
spec->jack_present |= (present_dock_hp & 0x80000000) != 0; present |= snd_hda_codec_read(codec, 0x1b, 0,
AC_VERB_GET_PIN_SENSE, 0);
if (present & AC_PINSENSE_PRESENCE)
spec->jack_present = 1;
else
spec->jack_present = 0;
spec->sense_updated = 1; spec->sense_updated = 1;
} }
if (spec->jack_present) { /* unmute internal speaker only if both HPs are unplugged and
/* mute internal speaker */ * master switch is on
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, */
HDA_AMP_MUTE, HDA_AMP_MUTE); if (spec->jack_present)
} else { mute = HDA_AMP_MUTE;
/* unmute internal speaker if necessary */ else
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
HDA_AMP_MUTE, mute); HDA_AMP_MUTE, mute);
}
} }
/* unsolicited event for HP jack sensing */ /* unsolicited event for HP jack sensing */
...@@ -8797,6 +8801,11 @@ static void alc262_fujitsu_unsol_event(struct hda_codec *codec, ...@@ -8797,6 +8801,11 @@ static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
alc262_fujitsu_automute(codec, 1); alc262_fujitsu_automute(codec, 1);
} }
static void alc262_fujitsu_init_hook(struct hda_codec *codec)
{
alc262_fujitsu_automute(codec, 1);
}
/* bind volumes of both NID 0x0c and 0x0d */ /* bind volumes of both NID 0x0c and 0x0d */
static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
.ops = &snd_hda_bind_vol, .ops = &snd_hda_bind_vol,
...@@ -9570,6 +9579,7 @@ static struct alc_config_preset alc262_presets[] = { ...@@ -9570,6 +9579,7 @@ static struct alc_config_preset alc262_presets[] = {
.channel_mode = alc262_modes, .channel_mode = alc262_modes,
.input_mux = &alc262_fujitsu_capture_source, .input_mux = &alc262_fujitsu_capture_source,
.unsol_event = alc262_fujitsu_unsol_event, .unsol_event = alc262_fujitsu_unsol_event,
.init_hook = alc262_fujitsu_init_hook,
}, },
[ALC262_HP_BPC] = { [ALC262_HP_BPC] = {
.mixers = { alc262_HP_BPC_mixer }, .mixers = { alc262_HP_BPC_mixer },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment