aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-05-05 06:18:40 -0400
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:56:15 -0400
commit458a4fabf185d90234225d7e05d81188b4dad9f1 (patch)
treee2c0ca6f7a2900ec2b38d5aeb401950920a9e386
parent35b26722a1716b45b5b92d5af2f1ea1fdd4d0a25 (diff)
[ALSA] hda-codec - Fix ALC880 uniwill auto-mutes
Fix the auto-mute controls of ALC880 uniwill model. Split to two individual functions to handle HP and front-mic mutes. For front-mic mute, use snd_hda_codec_amp_update() to be consistent with mixer. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--sound/pci/hda/patch_realtek.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d9213fa87437..8c0b4fbc1448 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1487,7 +1487,7 @@ static struct hda_verb alc880_beep_init_verbs[] = {
1487}; 1487};
1488 1488
1489/* toggle speaker-output according to the hp-jack state */ 1489/* toggle speaker-output according to the hp-jack state */
1490static void alc880_uniwill_automute(struct hda_codec *codec) 1490static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1491{ 1491{
1492 unsigned int present; 1492 unsigned int present;
1493 unsigned char bits; 1493 unsigned char bits;
@@ -1503,11 +1503,27 @@ static void alc880_uniwill_automute(struct hda_codec *codec)
1503 0x80, bits); 1503 0x80, bits);
1504 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, 1504 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0,
1505 0x80, bits); 1505 0x80, bits);
1506}
1507
1508/* auto-toggle front mic */
1509static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1510{
1511 unsigned int present;
1512 unsigned char bits;
1506 1513
1507 present = snd_hda_codec_read(codec, 0x18, 0, 1514 present = snd_hda_codec_read(codec, 0x18, 0,
1508 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1515 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1509 snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 1516 bits = present ? 0x80 : 0;
1510 0x7000 | (0x01 << 8) | bits); 1517 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1,
1518 0x80, bits);
1519 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
1520 0x80, bits);
1521}
1522
1523static void alc880_uniwill_automute(struct hda_codec *codec)
1524{
1525 alc880_uniwill_hp_automute(codec);
1526 alc880_uniwill_mic_automute(codec);
1511} 1527}
1512 1528
1513static void alc880_uniwill_unsol_event(struct hda_codec *codec, 1529static void alc880_uniwill_unsol_event(struct hda_codec *codec,
@@ -1516,9 +1532,14 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1516 /* Looks like the unsol event is incompatible with the standard 1532 /* Looks like the unsol event is incompatible with the standard
1517 * definition. 4bit tag is placed at 28 bit! 1533 * definition. 4bit tag is placed at 28 bit!
1518 */ 1534 */
1519 if ((res >> 28) == ALC880_HP_EVENT || 1535 switch (res >> 28) {
1520 (res >> 28) == ALC880_MIC_EVENT) 1536 case ALC880_HP_EVENT:
1521 alc880_uniwill_automute(codec); 1537 alc880_uniwill_hp_automute(codec);
1538 break;
1539 case ALC880_MIC_EVENT:
1540 alc880_uniwill_mic_automute(codec);
1541 break;
1542 }
1522} 1543}
1523 1544
1524static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) 1545static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)