From 9b65dd350b02a2c38030aee9774518ca7b8b4b00 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sat, 5 May 2007 12:18:40 +0200 Subject: [PATCH] --- yaml --- r: 56207 b: refs/heads/master c: 458a4fabf185d90234225d7e05d81188b4dad9f1 h: refs/heads/master i: 56205: f22f6d06e81d62d9f27df713f5cd8be96e37fef6 56203: 5ee0ac99d339a7c36a70a2e7dc3538987b12ca20 56199: 26ea07d48898176a6e3d006f7def22776387b5cf 56191: 94a04c7741bef8a6ee758f9407a53f904fcbea23 v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/patch_realtek.c | 33 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 20638d583063..07335ac2e6ea 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 35b26722a1716b45b5b92d5af2f1ea1fdd4d0a25 +refs/heads/master: 458a4fabf185d90234225d7e05d81188b4dad9f1 diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index d9213fa87437..8c0b4fbc1448 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -1487,7 +1487,7 @@ static struct hda_verb alc880_beep_init_verbs[] = { }; /* toggle speaker-output according to the hp-jack state */ -static void alc880_uniwill_automute(struct hda_codec *codec) +static void alc880_uniwill_hp_automute(struct hda_codec *codec) { unsigned int present; unsigned char bits; @@ -1503,11 +1503,27 @@ static void alc880_uniwill_automute(struct hda_codec *codec) 0x80, bits); snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, 0x80, bits); +} + +/* auto-toggle front mic */ +static void alc880_uniwill_mic_automute(struct hda_codec *codec) +{ + unsigned int present; + unsigned char bits; present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; - snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, - 0x7000 | (0x01 << 8) | bits); + bits = present ? 0x80 : 0; + snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, + 0x80, bits); + snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, + 0x80, bits); +} + +static void alc880_uniwill_automute(struct hda_codec *codec) +{ + alc880_uniwill_hp_automute(codec); + alc880_uniwill_mic_automute(codec); } static void alc880_uniwill_unsol_event(struct hda_codec *codec, @@ -1516,9 +1532,14 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec, /* Looks like the unsol event is incompatible with the standard * definition. 4bit tag is placed at 28 bit! */ - if ((res >> 28) == ALC880_HP_EVENT || - (res >> 28) == ALC880_MIC_EVENT) - alc880_uniwill_automute(codec); + switch (res >> 28) { + case ALC880_HP_EVENT: + alc880_uniwill_hp_automute(codec); + break; + case ALC880_MIC_EVENT: + alc880_uniwill_mic_automute(codec); + break; + } } static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)