Commit ebc7a406633acefc6d12c1ccc9441bfef69e0f33
1 parent
4b7afb0d0d
Exists in
master
and in
20 other branches
[ALSA] hda - Fix ALC262 fujitsu model
Fixed the speaker auto-mute with two laptop and docking headphones. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Tony Vroon <tony@linx.net>
Showing 1 changed file with 28 additions and 18 deletions Side-by-side Diff
sound/pci/hda/patch_realtek.c
... | ... | @@ -8757,35 +8757,39 @@ |
8757 | 8757 | }, |
8758 | 8758 | }; |
8759 | 8759 | |
8760 | -/* mute/unmute internal speaker according to the hp jack and mute state */ | |
8760 | +/* mute/unmute internal speaker according to the hp jacks and mute state */ | |
8761 | 8761 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
8762 | 8762 | { |
8763 | 8763 | struct alc_spec *spec = codec->spec; |
8764 | 8764 | unsigned int mute; |
8765 | 8765 | |
8766 | 8766 | if (force || !spec->sense_updated) { |
8767 | - unsigned int present_int_hp, present_dock_hp; | |
8767 | + unsigned int present; | |
8768 | 8768 | /* need to execute and sync at first */ |
8769 | 8769 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
8770 | - present_int_hp = snd_hda_codec_read(codec, 0x14, 0, | |
8771 | - AC_VERB_GET_PIN_SENSE, 0); | |
8772 | - snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8773 | - present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, | |
8774 | - AC_VERB_GET_PIN_SENSE, 0); | |
8775 | - spec->jack_present = (present_int_hp & 0x80000000) != 0; | |
8776 | - spec->jack_present |= (present_dock_hp & 0x80000000) != 0; | |
8770 | + /* check laptop HP jack */ | |
8771 | + present = snd_hda_codec_read(codec, 0x14, 0, | |
8772 | + AC_VERB_GET_PIN_SENSE, 0); | |
8773 | + /* need to execute and sync at first */ | |
8774 | + snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8775 | + /* check docking HP jack */ | |
8776 | + present |= snd_hda_codec_read(codec, 0x1b, 0, | |
8777 | + AC_VERB_GET_PIN_SENSE, 0); | |
8778 | + if (present & AC_PINSENSE_PRESENCE) | |
8779 | + spec->jack_present = 1; | |
8780 | + else | |
8781 | + spec->jack_present = 0; | |
8777 | 8782 | spec->sense_updated = 1; |
8778 | 8783 | } |
8779 | - if (spec->jack_present) { | |
8780 | - /* mute internal speaker */ | |
8781 | - snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8782 | - HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8783 | - } else { | |
8784 | - /* unmute internal speaker if necessary */ | |
8784 | + /* unmute internal speaker only if both HPs are unplugged and | |
8785 | + * master switch is on | |
8786 | + */ | |
8787 | + if (spec->jack_present) | |
8788 | + mute = HDA_AMP_MUTE; | |
8789 | + else | |
8785 | 8790 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
8786 | - snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8787 | - HDA_AMP_MUTE, mute); | |
8788 | - } | |
8791 | + snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8792 | + HDA_AMP_MUTE, mute); | |
8789 | 8793 | } |
8790 | 8794 | |
8791 | 8795 | /* unsolicited event for HP jack sensing */ |
... | ... | @@ -8797,6 +8801,11 @@ |
8797 | 8801 | alc262_fujitsu_automute(codec, 1); |
8798 | 8802 | } |
8799 | 8803 | |
8804 | +static void alc262_fujitsu_init_hook(struct hda_codec *codec) | |
8805 | +{ | |
8806 | + alc262_fujitsu_automute(codec, 1); | |
8807 | +} | |
8808 | + | |
8800 | 8809 | /* bind volumes of both NID 0x0c and 0x0d */ |
8801 | 8810 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
8802 | 8811 | .ops = &snd_hda_bind_vol, |
... | ... | @@ -9570,6 +9579,7 @@ |
9570 | 9579 | .channel_mode = alc262_modes, |
9571 | 9580 | .input_mux = &alc262_fujitsu_capture_source, |
9572 | 9581 | .unsol_event = alc262_fujitsu_unsol_event, |
9582 | + .init_hook = alc262_fujitsu_init_hook, | |
9573 | 9583 | }, |
9574 | 9584 | [ALC262_HP_BPC] = { |
9575 | 9585 | .mixers = { alc262_HP_BPC_mixer }, |