aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-23 12:56:52 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:26 -0400
commit889c43955115ea7412d71335e3ceff6bad118dce (patch)
tree0e3678250f092f3182dbdd65c198c0490b395cbf /sound/pci/hda/patch_realtek.c
parent0724ea2a85a804e151d960359b599ae8a7c1cad1 (diff)
[ALSA] hda-codec - Fix ALC268 unsol event
The unsol event of ALC268 is in the standard bit 26. Also, fixed the Acer master controls, and added Extensa 5210 to the quirk list. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c55
1 files changed, 50 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4cbd0e6e849d..b108ea3d99b3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8500,7 +8500,7 @@ static struct hda_verb alc268_toshiba_verbs[] = {
8500}; 8500};
8501 8501
8502/* Acer specific */ 8502/* Acer specific */
8503/* bind volumes of both NID 0x0c and 0x0d */ 8503/* bind volumes of both NID 0x02 and 0x03 */
8504static struct hda_bind_ctls alc268_acer_bind_master_vol = { 8504static struct hda_bind_ctls alc268_acer_bind_master_vol = {
8505 .ops = &snd_hda_bind_vol, 8505 .ops = &snd_hda_bind_vol,
8506 .values = { 8506 .values = {
@@ -8510,8 +8510,46 @@ static struct hda_bind_ctls alc268_acer_bind_master_vol = {
8510 }, 8510 },
8511}; 8511};
8512 8512
8513#define alc268_acer_master_sw_put alc262_fujitsu_master_sw_put 8513/* mute/unmute internal speaker according to the hp jack and mute state */
8514#define alc268_acer_automute alc262_fujitsu_automute 8514static void alc268_acer_automute(struct hda_codec *codec, int force)
8515{
8516 struct alc_spec *spec = codec->spec;
8517 unsigned int mute;
8518
8519 if (force || !spec->sense_updated) {
8520 unsigned int present;
8521 present = snd_hda_codec_read(codec, 0x14, 0,
8522 AC_VERB_GET_PIN_SENSE, 0);
8523 spec->jack_present = (present & 0x80000000) != 0;
8524 spec->sense_updated = 1;
8525 }
8526 if (spec->jack_present)
8527 mute = HDA_AMP_MUTE; /* mute internal speaker */
8528 else /* unmute internal speaker if necessary */
8529 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8530 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8531 HDA_AMP_MUTE, mute);
8532}
8533
8534
8535/* bind hp and internal speaker mute (with plug check) */
8536static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
8537 struct snd_ctl_elem_value *ucontrol)
8538{
8539 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8540 long *valp = ucontrol->value.integer.value;
8541 int change;
8542
8543 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8544 HDA_AMP_MUTE,
8545 valp[0] ? 0 : HDA_AMP_MUTE);
8546 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8547 HDA_AMP_MUTE,
8548 valp[1] ? 0 : HDA_AMP_MUTE);
8549 if (change)
8550 alc268_acer_automute(codec, 0);
8551 return change;
8552}
8515 8553
8516static struct snd_kcontrol_new alc268_acer_mixer[] = { 8554static struct snd_kcontrol_new alc268_acer_mixer[] = {
8517 /* output mixer control */ 8555 /* output mixer control */
@@ -8542,7 +8580,7 @@ static struct hda_verb alc268_acer_verbs[] = {
8542static void alc268_toshiba_unsol_event(struct hda_codec *codec, 8580static void alc268_toshiba_unsol_event(struct hda_codec *codec,
8543 unsigned int res) 8581 unsigned int res)
8544{ 8582{
8545 if ((res >> 28) != ALC880_HP_EVENT) 8583 if ((res >> 26) != ALC880_HP_EVENT)
8546 return; 8584 return;
8547 alc268_toshiba_automute(codec); 8585 alc268_toshiba_automute(codec);
8548} 8586}
@@ -8550,11 +8588,16 @@ static void alc268_toshiba_unsol_event(struct hda_codec *codec,
8550static void alc268_acer_unsol_event(struct hda_codec *codec, 8588static void alc268_acer_unsol_event(struct hda_codec *codec,
8551 unsigned int res) 8589 unsigned int res)
8552{ 8590{
8553 if ((res >> 28) != ALC880_HP_EVENT) 8591 if ((res >> 26) != ALC880_HP_EVENT)
8554 return; 8592 return;
8555 alc268_acer_automute(codec, 1); 8593 alc268_acer_automute(codec, 1);
8556} 8594}
8557 8595
8596static void alc268_acer_init_hook(struct hda_codec *codec)
8597{
8598 alc268_acer_automute(codec, 1);
8599}
8600
8558/* 8601/*
8559 * generic initialization of ADC, input mixers and output mixers 8602 * generic initialization of ADC, input mixers and output mixers
8560 */ 8603 */
@@ -8945,6 +8988,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
8945 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 8988 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
8946 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 8989 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
8947 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), 8990 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
8991 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
8948 {} 8992 {}
8949}; 8993};
8950 8994
@@ -8991,6 +9035,7 @@ static struct alc_config_preset alc268_presets[] = {
8991 .channel_mode = alc268_modes, 9035 .channel_mode = alc268_modes,
8992 .input_mux = &alc268_capture_source, 9036 .input_mux = &alc268_capture_source,
8993 .unsol_event = alc268_acer_unsol_event, 9037 .unsol_event = alc268_acer_unsol_event,
9038 .init_hook = alc268_acer_init_hook,
8994 }, 9039 },
8995}; 9040};
8996 9041