diff options
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r-- | sound/pci/hda/patch_analog.c | 195 |
1 files changed, 112 insertions, 83 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e48612323aa0..5bb48ee8b6c6 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -27,11 +27,12 @@ | |||
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 29 | #include "hda_local.h" |
30 | #include "hda_beep.h" | ||
30 | 31 | ||
31 | struct ad198x_spec { | 32 | struct ad198x_spec { |
32 | struct snd_kcontrol_new *mixers[5]; | 33 | struct snd_kcontrol_new *mixers[5]; |
33 | int num_mixers; | 34 | int num_mixers; |
34 | 35 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | |
35 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 36 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
36 | * don't forget NULL termination! | 37 | * don't forget NULL termination! |
37 | */ | 38 | */ |
@@ -154,6 +155,16 @@ static const char *ad_slave_sws[] = { | |||
154 | 155 | ||
155 | static void ad198x_free_kctls(struct hda_codec *codec); | 156 | static void ad198x_free_kctls(struct hda_codec *codec); |
156 | 157 | ||
158 | /* additional beep mixers; the actual parameters are overwritten at build */ | ||
159 | static struct snd_kcontrol_new ad_beep_mixer[] = { | ||
160 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT), | ||
161 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_OUTPUT), | ||
162 | { } /* end */ | ||
163 | }; | ||
164 | |||
165 | #define set_beep_amp(spec, nid, idx, dir) \ | ||
166 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */ | ||
167 | |||
157 | static int ad198x_build_controls(struct hda_codec *codec) | 168 | static int ad198x_build_controls(struct hda_codec *codec) |
158 | { | 169 | { |
159 | struct ad198x_spec *spec = codec->spec; | 170 | struct ad198x_spec *spec = codec->spec; |
@@ -181,6 +192,21 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
181 | return err; | 192 | return err; |
182 | } | 193 | } |
183 | 194 | ||
195 | /* create beep controls if needed */ | ||
196 | if (spec->beep_amp) { | ||
197 | struct snd_kcontrol_new *knew; | ||
198 | for (knew = ad_beep_mixer; knew->name; knew++) { | ||
199 | struct snd_kcontrol *kctl; | ||
200 | kctl = snd_ctl_new1(knew, codec); | ||
201 | if (!kctl) | ||
202 | return -ENOMEM; | ||
203 | kctl->private_value = spec->beep_amp; | ||
204 | err = snd_hda_ctl_add(codec, kctl); | ||
205 | if (err < 0) | ||
206 | return err; | ||
207 | } | ||
208 | } | ||
209 | |||
184 | /* if we have no master control, let's create it */ | 210 | /* if we have no master control, let's create it */ |
185 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 211 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
186 | unsigned int vmaster_tlv[4]; | 212 | unsigned int vmaster_tlv[4]; |
@@ -406,7 +432,8 @@ static void ad198x_free(struct hda_codec *codec) | |||
406 | return; | 432 | return; |
407 | 433 | ||
408 | ad198x_free_kctls(codec); | 434 | ad198x_free_kctls(codec); |
409 | kfree(codec->spec); | 435 | kfree(spec); |
436 | snd_hda_detach_beep_device(codec); | ||
410 | } | 437 | } |
411 | 438 | ||
412 | static struct hda_codec_ops ad198x_patch_ops = { | 439 | static struct hda_codec_ops ad198x_patch_ops = { |
@@ -545,8 +572,6 @@ static struct snd_kcontrol_new ad1986a_mixers[] = { | |||
545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
547 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 574 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
548 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
549 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
550 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 575 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
551 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), | 576 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), |
552 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 577 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -610,8 +635,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { | |||
610 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
612 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 637 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
613 | /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | 638 | /* |
614 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
615 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 639 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
616 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ | 640 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ |
617 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 641 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -809,8 +833,6 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { | |||
809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
811 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 835 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
812 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
813 | HDA_CODEC_MUTE("Beep Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
814 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 836 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
815 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), | 837 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), |
816 | { | 838 | { |
@@ -1002,10 +1024,8 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { | |||
1002 | SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), | 1024 | SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), |
1003 | SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), | 1025 | SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), |
1004 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), | 1026 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), |
1005 | SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG), | ||
1006 | SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG), | ||
1007 | SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG), | ||
1008 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), | 1027 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), |
1028 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), | ||
1009 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), | 1029 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), |
1010 | SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), | 1030 | SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), |
1011 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), | 1031 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), |
@@ -1027,15 +1047,14 @@ static struct hda_amp_list ad1986a_loopbacks[] = { | |||
1027 | 1047 | ||
1028 | static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) | 1048 | static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) |
1029 | { | 1049 | { |
1030 | unsigned int conf = snd_hda_codec_read(codec, nid, 0, | 1050 | unsigned int conf = snd_hda_codec_get_pincfg(codec, nid); |
1031 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
1032 | return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; | 1051 | return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; |
1033 | } | 1052 | } |
1034 | 1053 | ||
1035 | static int patch_ad1986a(struct hda_codec *codec) | 1054 | static int patch_ad1986a(struct hda_codec *codec) |
1036 | { | 1055 | { |
1037 | struct ad198x_spec *spec; | 1056 | struct ad198x_spec *spec; |
1038 | int board_config; | 1057 | int err, board_config; |
1039 | 1058 | ||
1040 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1059 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1041 | if (spec == NULL) | 1060 | if (spec == NULL) |
@@ -1043,6 +1062,13 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1043 | 1062 | ||
1044 | codec->spec = spec; | 1063 | codec->spec = spec; |
1045 | 1064 | ||
1065 | err = snd_hda_attach_beep_device(codec, 0x19); | ||
1066 | if (err < 0) { | ||
1067 | ad198x_free(codec); | ||
1068 | return err; | ||
1069 | } | ||
1070 | set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); | ||
1071 | |||
1046 | spec->multiout.max_channels = 6; | 1072 | spec->multiout.max_channels = 6; |
1047 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); | 1073 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); |
1048 | spec->multiout.dac_nids = ad1986a_dac_nids; | 1074 | spec->multiout.dac_nids = ad1986a_dac_nids; |
@@ -1222,8 +1248,6 @@ static struct snd_kcontrol_new ad1983_mixers[] = { | |||
1222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 1248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
1223 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 1249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
1224 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 1250 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
1225 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1226 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1227 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), | 1251 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), |
1228 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1252 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
1229 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), | 1253 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), |
@@ -1294,6 +1318,7 @@ static struct hda_amp_list ad1983_loopbacks[] = { | |||
1294 | static int patch_ad1983(struct hda_codec *codec) | 1318 | static int patch_ad1983(struct hda_codec *codec) |
1295 | { | 1319 | { |
1296 | struct ad198x_spec *spec; | 1320 | struct ad198x_spec *spec; |
1321 | int err; | ||
1297 | 1322 | ||
1298 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1323 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1299 | if (spec == NULL) | 1324 | if (spec == NULL) |
@@ -1301,6 +1326,13 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1301 | 1326 | ||
1302 | codec->spec = spec; | 1327 | codec->spec = spec; |
1303 | 1328 | ||
1329 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1330 | if (err < 0) { | ||
1331 | ad198x_free(codec); | ||
1332 | return err; | ||
1333 | } | ||
1334 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
1335 | |||
1304 | spec->multiout.max_channels = 2; | 1336 | spec->multiout.max_channels = 2; |
1305 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); | 1337 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); |
1306 | spec->multiout.dac_nids = ad1983_dac_nids; | 1338 | spec->multiout.dac_nids = ad1983_dac_nids; |
@@ -1370,8 +1402,6 @@ static struct snd_kcontrol_new ad1981_mixers[] = { | |||
1370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), | 1402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), |
1371 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), | 1403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), |
1372 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), | 1404 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), |
1373 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1374 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1375 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), | 1405 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), |
1376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), | 1406 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), |
1377 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1407 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
@@ -1416,8 +1446,8 @@ static struct hda_verb ad1981_init_verbs[] = { | |||
1416 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1446 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
1417 | {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, | 1447 | {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, |
1418 | /* Mic boost: 0dB */ | 1448 | /* Mic boost: 0dB */ |
1419 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1449 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1420 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1450 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1421 | /* Record selector: Front mic */ | 1451 | /* Record selector: Front mic */ |
1422 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, | 1452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, |
1423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, | 1453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, |
@@ -1682,10 +1712,10 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1682 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), | 1712 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), |
1683 | SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), | 1713 | SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), |
1684 | /* All HP models */ | 1714 | /* All HP models */ |
1685 | SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), | 1715 | SND_PCI_QUIRK_VENDOR(0x103c, "HP nx", AD1981_HP), |
1686 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), | 1716 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), |
1687 | /* Lenovo Thinkpad T60/X60/Z6xx */ | 1717 | /* Lenovo Thinkpad T60/X60/Z6xx */ |
1688 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), | 1718 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1981_THINKPAD), |
1689 | /* HP nx6320 (reversed SSID, H/W bug) */ | 1719 | /* HP nx6320 (reversed SSID, H/W bug) */ |
1690 | SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), | 1720 | SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), |
1691 | {} | 1721 | {} |
@@ -1694,7 +1724,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1694 | static int patch_ad1981(struct hda_codec *codec) | 1724 | static int patch_ad1981(struct hda_codec *codec) |
1695 | { | 1725 | { |
1696 | struct ad198x_spec *spec; | 1726 | struct ad198x_spec *spec; |
1697 | int board_config; | 1727 | int err, board_config; |
1698 | 1728 | ||
1699 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1700 | if (spec == NULL) | 1730 | if (spec == NULL) |
@@ -1702,6 +1732,13 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1702 | 1732 | ||
1703 | codec->spec = spec; | 1733 | codec->spec = spec; |
1704 | 1734 | ||
1735 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1736 | if (err < 0) { | ||
1737 | ad198x_free(codec); | ||
1738 | return err; | ||
1739 | } | ||
1740 | set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); | ||
1741 | |||
1705 | spec->multiout.max_channels = 2; | 1742 | spec->multiout.max_channels = 2; |
1706 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); | 1743 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); |
1707 | spec->multiout.dac_nids = ad1981_dac_nids; | 1744 | spec->multiout.dac_nids = ad1981_dac_nids; |
@@ -1988,9 +2025,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | |||
1988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
1989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
1990 | 2027 | ||
1991 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
1992 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
1993 | |||
1994 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2028 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
1995 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2029 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
1996 | 2030 | ||
@@ -2034,9 +2068,6 @@ static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { | |||
2034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
2035 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
2036 | 2070 | ||
2037 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2038 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2039 | |||
2040 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2071 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2041 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2072 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2042 | 2073 | ||
@@ -2066,9 +2097,6 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = { | |||
2066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), | 2097 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), |
2067 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), | 2098 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), |
2068 | 2099 | ||
2069 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2070 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2071 | |||
2072 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2100 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2073 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2101 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2074 | 2102 | ||
@@ -2297,10 +2325,6 @@ static struct hda_verb ad1988_capture_init_verbs[] = { | |||
2297 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2325 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2298 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2326 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2299 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2327 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2300 | /* ADCs; muted */ | ||
2301 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2304 | 2328 | ||
2305 | { } | 2329 | { } |
2306 | }; | 2330 | }; |
@@ -2408,10 +2432,6 @@ static struct hda_verb ad1988_3stack_init_verbs[] = { | |||
2408 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2432 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2409 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2433 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2410 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2434 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2411 | /* ADCs; muted */ | ||
2412 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2413 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2415 | /* Analog Mix output amp */ | 2435 | /* Analog Mix output amp */ |
2416 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | 2436 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ |
2417 | { } | 2437 | { } |
@@ -2483,10 +2503,6 @@ static struct hda_verb ad1988_laptop_init_verbs[] = { | |||
2483 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2503 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2484 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2504 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2485 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2505 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2486 | /* ADCs; muted */ | ||
2487 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2489 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2490 | /* Analog Mix output amp */ | 2506 | /* Analog Mix output amp */ |
2491 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | 2507 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ |
2492 | { } | 2508 | { } |
@@ -2890,7 +2906,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) | |||
2890 | 2906 | ||
2891 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 2907 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2892 | 2908 | ||
2893 | if (spec->autocfg.dig_out_pin) | 2909 | if (spec->autocfg.dig_outs) |
2894 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; | 2910 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; |
2895 | if (spec->autocfg.dig_in_pin) | 2911 | if (spec->autocfg.dig_in_pin) |
2896 | spec->dig_in_nid = AD1988_SPDIF_IN; | 2912 | spec->dig_in_nid = AD1988_SPDIF_IN; |
@@ -2940,7 +2956,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = { | |||
2940 | static int patch_ad1988(struct hda_codec *codec) | 2956 | static int patch_ad1988(struct hda_codec *codec) |
2941 | { | 2957 | { |
2942 | struct ad198x_spec *spec; | 2958 | struct ad198x_spec *spec; |
2943 | int board_config; | 2959 | int err, board_config; |
2944 | 2960 | ||
2945 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 2961 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2946 | if (spec == NULL) | 2962 | if (spec == NULL) |
@@ -2960,7 +2976,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2960 | 2976 | ||
2961 | if (board_config == AD1988_AUTO) { | 2977 | if (board_config == AD1988_AUTO) { |
2962 | /* automatic parse from the BIOS config */ | 2978 | /* automatic parse from the BIOS config */ |
2963 | int err = ad1988_parse_auto_config(codec); | 2979 | err = ad1988_parse_auto_config(codec); |
2964 | if (err < 0) { | 2980 | if (err < 0) { |
2965 | ad198x_free(codec); | 2981 | ad198x_free(codec); |
2966 | return err; | 2982 | return err; |
@@ -2970,6 +2986,13 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2970 | } | 2986 | } |
2971 | } | 2987 | } |
2972 | 2988 | ||
2989 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
2990 | if (err < 0) { | ||
2991 | ad198x_free(codec); | ||
2992 | return err; | ||
2993 | } | ||
2994 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
2995 | |||
2973 | switch (board_config) { | 2996 | switch (board_config) { |
2974 | case AD1988_6STACK: | 2997 | case AD1988_6STACK: |
2975 | case AD1988_6STACK_DIG: | 2998 | case AD1988_6STACK_DIG: |
@@ -3126,12 +3149,6 @@ static struct snd_kcontrol_new ad1884_base_mixers[] = { | |||
3126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3128 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3151 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3129 | /* | ||
3130 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3131 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3132 | HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
3133 | HDA_CODEC_MUTE("Digital Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
3134 | */ | ||
3135 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), | 3152 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), |
3136 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3153 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3137 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3154 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3204,10 +3221,10 @@ static struct hda_verb ad1884_init_verbs[] = { | |||
3204 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 3221 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
3205 | /* Port-B (front mic) pin */ | 3222 | /* Port-B (front mic) pin */ |
3206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3208 | /* Port-C (rear mic) pin */ | 3225 | /* Port-C (rear mic) pin */ |
3209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3227 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3211 | /* Analog mixer; mute as default */ | 3228 | /* Analog mixer; mute as default */ |
3212 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 3229 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3213 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 3230 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
@@ -3240,7 +3257,7 @@ static const char *ad1884_slave_vols[] = { | |||
3240 | "CD Playback Volume", | 3257 | "CD Playback Volume", |
3241 | "Internal Mic Playback Volume", | 3258 | "Internal Mic Playback Volume", |
3242 | "Docking Mic Playback Volume" | 3259 | "Docking Mic Playback Volume" |
3243 | "Beep Playback Volume", | 3260 | /* "Beep Playback Volume", */ |
3244 | "IEC958 Playback Volume", | 3261 | "IEC958 Playback Volume", |
3245 | NULL | 3262 | NULL |
3246 | }; | 3263 | }; |
@@ -3248,6 +3265,7 @@ static const char *ad1884_slave_vols[] = { | |||
3248 | static int patch_ad1884(struct hda_codec *codec) | 3265 | static int patch_ad1884(struct hda_codec *codec) |
3249 | { | 3266 | { |
3250 | struct ad198x_spec *spec; | 3267 | struct ad198x_spec *spec; |
3268 | int err; | ||
3251 | 3269 | ||
3252 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3270 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3253 | if (spec == NULL) | 3271 | if (spec == NULL) |
@@ -3255,6 +3273,13 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3255 | 3273 | ||
3256 | codec->spec = spec; | 3274 | codec->spec = spec; |
3257 | 3275 | ||
3276 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3277 | if (err < 0) { | ||
3278 | ad198x_free(codec); | ||
3279 | return err; | ||
3280 | } | ||
3281 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3282 | |||
3258 | spec->multiout.max_channels = 2; | 3283 | spec->multiout.max_channels = 2; |
3259 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); | 3284 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); |
3260 | spec->multiout.dac_nids = ad1884_dac_nids; | 3285 | spec->multiout.dac_nids = ad1884_dac_nids; |
@@ -3321,8 +3346,6 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { | |||
3321 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3346 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3322 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3347 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3323 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3348 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
3324 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3325 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3326 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3349 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
3327 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | 3350 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), |
3328 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | 3351 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), |
@@ -3358,7 +3381,7 @@ static struct hda_verb ad1984_thinkpad_init_verbs[] = { | |||
3358 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3381 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3359 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3382 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3360 | /* docking mic boost */ | 3383 | /* docking mic boost */ |
3361 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3384 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
3362 | /* Analog mixer - docking mic; mute as default */ | 3385 | /* Analog mixer - docking mic; mute as default */ |
3363 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 3386 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
3364 | /* enable EAPD bit */ | 3387 | /* enable EAPD bit */ |
@@ -3379,10 +3402,6 @@ static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = { | |||
3379 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3402 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3380 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), | 3403 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), |
3381 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), | 3404 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), |
3382 | /* | ||
3383 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3384 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3385 | */ | ||
3386 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), | 3405 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), |
3387 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3406 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3388 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3407 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3468,7 +3487,7 @@ static const char *ad1984_models[AD1984_MODELS] = { | |||
3468 | 3487 | ||
3469 | static struct snd_pci_quirk ad1984_cfg_tbl[] = { | 3488 | static struct snd_pci_quirk ad1984_cfg_tbl[] = { |
3470 | /* Lenovo Thinkpad T61/X61 */ | 3489 | /* Lenovo Thinkpad T61/X61 */ |
3471 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1984_THINKPAD), | 3490 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD), |
3472 | SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), | 3491 | SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), |
3473 | {} | 3492 | {} |
3474 | }; | 3493 | }; |
@@ -3561,8 +3580,6 @@ static struct snd_kcontrol_new ad1884a_base_mixers[] = { | |||
3561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3563 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3582 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3564 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3565 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3566 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3583 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3567 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), | 3584 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), |
3568 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3585 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3622,10 +3639,10 @@ static struct hda_verb ad1884a_init_verbs[] = { | |||
3622 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3639 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3623 | /* Port-B (front mic) pin */ | 3640 | /* Port-B (front mic) pin */ |
3624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3625 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3642 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3626 | /* Port-C (rear line-in) pin */ | 3643 | /* Port-C (rear line-in) pin */ |
3627 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 3644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
3628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3629 | /* Port-E (rear mic) pin */ | 3646 | /* Port-E (rear mic) pin */ |
3630 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3647 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3631 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3648 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
@@ -3695,8 +3712,6 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | |||
3695 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3712 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3696 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | 3713 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), |
3697 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3714 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3698 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3699 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3700 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3715 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3701 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3716 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3702 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3717 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3724,8 +3739,6 @@ static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | |||
3724 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 3739 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
3725 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | 3740 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), |
3726 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3741 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3727 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3728 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3729 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), | 3742 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), |
3730 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), | 3743 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), |
3731 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3744 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3836,8 +3849,6 @@ static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { | |||
3836 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3849 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | 3850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), |
3838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3839 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3840 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3841 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3852 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3842 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), | 3853 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), |
3843 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3854 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3911,9 +3922,9 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
3911 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3922 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3912 | SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), | 3923 | SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), |
3913 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | 3924 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), |
3914 | SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), | 3925 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x3070, "HP", AD1884A_MOBILE), |
3915 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), | 3926 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), |
3916 | SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), | 3927 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), |
3917 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 3928 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
3918 | {} | 3929 | {} |
3919 | }; | 3930 | }; |
@@ -3921,7 +3932,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
3921 | static int patch_ad1884a(struct hda_codec *codec) | 3932 | static int patch_ad1884a(struct hda_codec *codec) |
3922 | { | 3933 | { |
3923 | struct ad198x_spec *spec; | 3934 | struct ad198x_spec *spec; |
3924 | int board_config; | 3935 | int err, board_config; |
3925 | 3936 | ||
3926 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3937 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3927 | if (spec == NULL) | 3938 | if (spec == NULL) |
@@ -3929,6 +3940,13 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3929 | 3940 | ||
3930 | codec->spec = spec; | 3941 | codec->spec = spec; |
3931 | 3942 | ||
3943 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3944 | if (err < 0) { | ||
3945 | ad198x_free(codec); | ||
3946 | return err; | ||
3947 | } | ||
3948 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3949 | |||
3932 | spec->multiout.max_channels = 2; | 3950 | spec->multiout.max_channels = 2; |
3933 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); | 3951 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); |
3934 | spec->multiout.dac_nids = ad1884a_dac_nids; | 3952 | spec->multiout.dac_nids = ad1884a_dac_nids; |
@@ -3966,6 +3984,14 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3966 | spec->multiout.dig_out_nid = 0; | 3984 | spec->multiout.dig_out_nid = 0; |
3967 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; | 3985 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; |
3968 | codec->patch_ops.init = ad1884a_hp_init; | 3986 | codec->patch_ops.init = ad1884a_hp_init; |
3987 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
3988 | * possible damage by overloading | ||
3989 | */ | ||
3990 | snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, | ||
3991 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
3992 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
3993 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
3994 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
3969 | break; | 3995 | break; |
3970 | case AD1884A_THINKPAD: | 3996 | case AD1884A_THINKPAD: |
3971 | spec->mixers[0] = ad1984a_thinkpad_mixers; | 3997 | spec->mixers[0] = ad1984a_thinkpad_mixers; |
@@ -4083,8 +4109,6 @@ static struct snd_kcontrol_new ad1882_loopback_mixers[] = { | |||
4083 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), | 4109 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), |
4084 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4085 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4111 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4086 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4087 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4088 | { } /* end */ | 4112 | { } /* end */ |
4089 | }; | 4113 | }; |
4090 | 4114 | ||
@@ -4097,8 +4121,6 @@ static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { | |||
4097 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), | 4121 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), |
4098 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4099 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4123 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4100 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4101 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4102 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), | 4124 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), |
4103 | { } /* end */ | 4125 | { } /* end */ |
4104 | }; | 4126 | }; |
@@ -4257,7 +4279,7 @@ static const char *ad1882_models[AD1986A_MODELS] = { | |||
4257 | static int patch_ad1882(struct hda_codec *codec) | 4279 | static int patch_ad1882(struct hda_codec *codec) |
4258 | { | 4280 | { |
4259 | struct ad198x_spec *spec; | 4281 | struct ad198x_spec *spec; |
4260 | int board_config; | 4282 | int err, board_config; |
4261 | 4283 | ||
4262 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4284 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4263 | if (spec == NULL) | 4285 | if (spec == NULL) |
@@ -4265,6 +4287,13 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4265 | 4287 | ||
4266 | codec->spec = spec; | 4288 | codec->spec = spec; |
4267 | 4289 | ||
4290 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
4291 | if (err < 0) { | ||
4292 | ad198x_free(codec); | ||
4293 | return err; | ||
4294 | } | ||
4295 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
4296 | |||
4268 | spec->multiout.max_channels = 6; | 4297 | spec->multiout.max_channels = 6; |
4269 | spec->multiout.num_dacs = 3; | 4298 | spec->multiout.num_dacs = 3; |
4270 | spec->multiout.dac_nids = ad1882_dac_nids; | 4299 | spec->multiout.dac_nids = ad1882_dac_nids; |