aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-05-20 03:23:05 -0400
committerTakashi Iwai <tiwai@suse.de>2008-05-20 05:56:33 -0400
commitebc7a406633acefc6d12c1ccc9441bfef69e0f33 (patch)
treec9d51a0c3f5f6c8aa0405b242df787dac33a427a /sound/pci
parent4b7afb0d0d23b298a7e6d30eaba0679449542d2e (diff)
[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>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6d4df45e81e0..ad2763c86bf5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8757,35 +8757,39 @@ static struct hda_input_mux alc262_HP_D7000_capture_source = {
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 */
8761static void alc262_fujitsu_automute(struct hda_codec *codec, int force) 8761static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8762{ 8762{
8763 struct alc_spec *spec = codec->spec; 8763 struct alc_spec *spec = codec->spec;
8764 unsigned int mute; 8764 unsigned int mute;
8765 8765
8766 if (force || !spec->sense_updated) { 8766 if (force || !spec->sense_updated) {
8767 unsigned int present_int_hp, present_dock_hp; 8767 unsigned int present;
8768 /* need to execute and sync at first */ 8768 /* need to execute and sync at first */
8769 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); 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, 8770 /* check laptop HP jack */
8771 AC_VERB_GET_PIN_SENSE, 0); 8771 present = snd_hda_codec_read(codec, 0x14, 0,
8772 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); 8772 AC_VERB_GET_PIN_SENSE, 0);
8773 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, 8773 /* need to execute and sync at first */
8774 AC_VERB_GET_PIN_SENSE, 0); 8774 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8775 spec->jack_present = (present_int_hp & 0x80000000) != 0; 8775 /* check docking HP jack */
8776 spec->jack_present |= (present_dock_hp & 0x80000000) != 0; 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 spec->sense_updated = 1; 8782 spec->sense_updated = 1;
8778 } 8783 }
8779 if (spec->jack_present) { 8784 /* unmute internal speaker only if both HPs are unplugged and
8780 /* mute internal speaker */ 8785 * master switch is on
8781 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8786 */
8782 HDA_AMP_MUTE, HDA_AMP_MUTE); 8787 if (spec->jack_present)
8783 } else { 8788 mute = HDA_AMP_MUTE;
8784 /* unmute internal speaker if necessary */ 8789 else
8785 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 8790 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8786 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8791 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8787 HDA_AMP_MUTE, mute); 8792 HDA_AMP_MUTE, mute);
8788 }
8789} 8793}
8790 8794
8791/* unsolicited event for HP jack sensing */ 8795/* unsolicited event for HP jack sensing */
@@ -8797,6 +8801,11 @@ static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8797 alc262_fujitsu_automute(codec, 1); 8801 alc262_fujitsu_automute(codec, 1);
8798} 8802}
8799 8803
8804static void alc262_fujitsu_init_hook(struct hda_codec *codec)
8805{
8806 alc262_fujitsu_automute(codec, 1);
8807}
8808
8800/* bind volumes of both NID 0x0c and 0x0d */ 8809/* bind volumes of both NID 0x0c and 0x0d */
8801static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { 8810static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8802 .ops = &snd_hda_bind_vol, 8811 .ops = &snd_hda_bind_vol,
@@ -9570,6 +9579,7 @@ static struct alc_config_preset alc262_presets[] = {
9570 .channel_mode = alc262_modes, 9579 .channel_mode = alc262_modes,
9571 .input_mux = &alc262_fujitsu_capture_source, 9580 .input_mux = &alc262_fujitsu_capture_source,
9572 .unsol_event = alc262_fujitsu_unsol_event, 9581 .unsol_event = alc262_fujitsu_unsol_event,
9582 .init_hook = alc262_fujitsu_init_hook,
9573 }, 9583 },
9574 [ALC262_HP_BPC] = { 9584 [ALC262_HP_BPC] = {
9575 .mixers = { alc262_HP_BPC_mixer }, 9585 .mixers = { alc262_HP_BPC_mixer },