diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-02-06 11:22:05 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-06 11:22:05 -0500 |
commit | c5a4bcd0cac546c5d776af881c5e913ba4a9922d (patch) | |
tree | d97b42df2b146a667128403d2d11818967451691 /sound/pci/hda/patch_analog.c | |
parent | a4ddeba9c8896cba8c6ce7a98c0b5c755c15a746 (diff) |
ALSA: hda - Use digital beep for AD codecs
Use digital beep instead of analog pc-beep for AD codecs.
Create the beep mixer controls dynamically on demand.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r-- | sound/pci/hda/patch_analog.c | 140 |
1 files changed, 88 insertions, 52 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 30399cbf8193..cc02f2df2510 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]; |
@@ -397,7 +423,8 @@ static void ad198x_free(struct hda_codec *codec) | |||
397 | return; | 423 | return; |
398 | 424 | ||
399 | ad198x_free_kctls(codec); | 425 | ad198x_free_kctls(codec); |
400 | kfree(codec->spec); | 426 | kfree(spec); |
427 | snd_hda_detach_beep_device(codec); | ||
401 | } | 428 | } |
402 | 429 | ||
403 | static struct hda_codec_ops ad198x_patch_ops = { | 430 | static struct hda_codec_ops ad198x_patch_ops = { |
@@ -536,8 +563,6 @@ static struct snd_kcontrol_new ad1986a_mixers[] = { | |||
536 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 563 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
538 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 565 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
539 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
540 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
541 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 566 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
542 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), | 567 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), |
543 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 568 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -601,8 +626,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { | |||
601 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
602 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
603 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 628 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
604 | /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | 629 | /* |
605 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
606 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 630 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
607 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ | 631 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ |
608 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 632 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -800,8 +824,6 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { | |||
800 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
801 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
802 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 826 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
803 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
804 | HDA_CODEC_MUTE("Beep Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
805 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 827 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
806 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), | 828 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), |
807 | { | 829 | { |
@@ -1026,7 +1048,7 @@ static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) | |||
1026 | static int patch_ad1986a(struct hda_codec *codec) | 1048 | static int patch_ad1986a(struct hda_codec *codec) |
1027 | { | 1049 | { |
1028 | struct ad198x_spec *spec; | 1050 | struct ad198x_spec *spec; |
1029 | int board_config; | 1051 | int err, board_config; |
1030 | 1052 | ||
1031 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1053 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1032 | if (spec == NULL) | 1054 | if (spec == NULL) |
@@ -1034,6 +1056,13 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1034 | 1056 | ||
1035 | codec->spec = spec; | 1057 | codec->spec = spec; |
1036 | 1058 | ||
1059 | err = snd_hda_attach_beep_device(codec, 0x19); | ||
1060 | if (err < 0) { | ||
1061 | ad198x_free(codec); | ||
1062 | return err; | ||
1063 | } | ||
1064 | set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); | ||
1065 | |||
1037 | spec->multiout.max_channels = 6; | 1066 | spec->multiout.max_channels = 6; |
1038 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); | 1067 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); |
1039 | spec->multiout.dac_nids = ad1986a_dac_nids; | 1068 | spec->multiout.dac_nids = ad1986a_dac_nids; |
@@ -1213,8 +1242,6 @@ static struct snd_kcontrol_new ad1983_mixers[] = { | |||
1213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 1242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
1214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 1243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
1215 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 1244 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
1216 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1217 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1218 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), | 1245 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), |
1219 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1246 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
1220 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), | 1247 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), |
@@ -1285,6 +1312,7 @@ static struct hda_amp_list ad1983_loopbacks[] = { | |||
1285 | static int patch_ad1983(struct hda_codec *codec) | 1312 | static int patch_ad1983(struct hda_codec *codec) |
1286 | { | 1313 | { |
1287 | struct ad198x_spec *spec; | 1314 | struct ad198x_spec *spec; |
1315 | int err; | ||
1288 | 1316 | ||
1289 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1317 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1290 | if (spec == NULL) | 1318 | if (spec == NULL) |
@@ -1292,6 +1320,13 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1292 | 1320 | ||
1293 | codec->spec = spec; | 1321 | codec->spec = spec; |
1294 | 1322 | ||
1323 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1324 | if (err < 0) { | ||
1325 | ad198x_free(codec); | ||
1326 | return err; | ||
1327 | } | ||
1328 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
1329 | |||
1295 | spec->multiout.max_channels = 2; | 1330 | spec->multiout.max_channels = 2; |
1296 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); | 1331 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); |
1297 | spec->multiout.dac_nids = ad1983_dac_nids; | 1332 | spec->multiout.dac_nids = ad1983_dac_nids; |
@@ -1361,8 +1396,6 @@ static struct snd_kcontrol_new ad1981_mixers[] = { | |||
1361 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), | 1396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), |
1362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), | 1397 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), |
1363 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), | 1398 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), |
1364 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1365 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1366 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), | 1399 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), |
1367 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), | 1400 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), |
1368 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1401 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
@@ -1685,7 +1718,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1685 | static int patch_ad1981(struct hda_codec *codec) | 1718 | static int patch_ad1981(struct hda_codec *codec) |
1686 | { | 1719 | { |
1687 | struct ad198x_spec *spec; | 1720 | struct ad198x_spec *spec; |
1688 | int board_config; | 1721 | int err, board_config; |
1689 | 1722 | ||
1690 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1723 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1691 | if (spec == NULL) | 1724 | if (spec == NULL) |
@@ -1693,6 +1726,13 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1693 | 1726 | ||
1694 | codec->spec = spec; | 1727 | codec->spec = spec; |
1695 | 1728 | ||
1729 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1730 | if (err < 0) { | ||
1731 | ad198x_free(codec); | ||
1732 | return err; | ||
1733 | } | ||
1734 | set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); | ||
1735 | |||
1696 | spec->multiout.max_channels = 2; | 1736 | spec->multiout.max_channels = 2; |
1697 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); | 1737 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); |
1698 | spec->multiout.dac_nids = ad1981_dac_nids; | 1738 | spec->multiout.dac_nids = ad1981_dac_nids; |
@@ -1979,9 +2019,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | |||
1979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
1980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
1981 | 2021 | ||
1982 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
1983 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
1984 | |||
1985 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2022 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
1986 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2023 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
1987 | 2024 | ||
@@ -2025,9 +2062,6 @@ static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { | |||
2025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
2026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
2027 | 2064 | ||
2028 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2029 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2030 | |||
2031 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2065 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2032 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2066 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2033 | 2067 | ||
@@ -2057,9 +2091,6 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = { | |||
2057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), | 2091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), |
2058 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), | 2092 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), |
2059 | 2093 | ||
2060 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2061 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2062 | |||
2063 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2094 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2064 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2095 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2065 | 2096 | ||
@@ -2919,7 +2950,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = { | |||
2919 | static int patch_ad1988(struct hda_codec *codec) | 2950 | static int patch_ad1988(struct hda_codec *codec) |
2920 | { | 2951 | { |
2921 | struct ad198x_spec *spec; | 2952 | struct ad198x_spec *spec; |
2922 | int board_config; | 2953 | int err, board_config; |
2923 | 2954 | ||
2924 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 2955 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2925 | if (spec == NULL) | 2956 | if (spec == NULL) |
@@ -2939,7 +2970,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2939 | 2970 | ||
2940 | if (board_config == AD1988_AUTO) { | 2971 | if (board_config == AD1988_AUTO) { |
2941 | /* automatic parse from the BIOS config */ | 2972 | /* automatic parse from the BIOS config */ |
2942 | int err = ad1988_parse_auto_config(codec); | 2973 | err = ad1988_parse_auto_config(codec); |
2943 | if (err < 0) { | 2974 | if (err < 0) { |
2944 | ad198x_free(codec); | 2975 | ad198x_free(codec); |
2945 | return err; | 2976 | return err; |
@@ -2949,6 +2980,13 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2949 | } | 2980 | } |
2950 | } | 2981 | } |
2951 | 2982 | ||
2983 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
2984 | if (err < 0) { | ||
2985 | ad198x_free(codec); | ||
2986 | return err; | ||
2987 | } | ||
2988 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
2989 | |||
2952 | switch (board_config) { | 2990 | switch (board_config) { |
2953 | case AD1988_6STACK: | 2991 | case AD1988_6STACK: |
2954 | case AD1988_6STACK_DIG: | 2992 | case AD1988_6STACK_DIG: |
@@ -3105,12 +3143,6 @@ static struct snd_kcontrol_new ad1884_base_mixers[] = { | |||
3105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3144 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3107 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3145 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3108 | /* | ||
3109 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3110 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3111 | HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
3112 | HDA_CODEC_MUTE("Digital Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
3113 | */ | ||
3114 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), | 3146 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), |
3115 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3147 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3116 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3148 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3219,7 +3251,7 @@ static const char *ad1884_slave_vols[] = { | |||
3219 | "CD Playback Volume", | 3251 | "CD Playback Volume", |
3220 | "Internal Mic Playback Volume", | 3252 | "Internal Mic Playback Volume", |
3221 | "Docking Mic Playback Volume" | 3253 | "Docking Mic Playback Volume" |
3222 | "Beep Playback Volume", | 3254 | /* "Beep Playback Volume", */ |
3223 | "IEC958 Playback Volume", | 3255 | "IEC958 Playback Volume", |
3224 | NULL | 3256 | NULL |
3225 | }; | 3257 | }; |
@@ -3227,6 +3259,7 @@ static const char *ad1884_slave_vols[] = { | |||
3227 | static int patch_ad1884(struct hda_codec *codec) | 3259 | static int patch_ad1884(struct hda_codec *codec) |
3228 | { | 3260 | { |
3229 | struct ad198x_spec *spec; | 3261 | struct ad198x_spec *spec; |
3262 | int err; | ||
3230 | 3263 | ||
3231 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3264 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3232 | if (spec == NULL) | 3265 | if (spec == NULL) |
@@ -3234,6 +3267,13 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3234 | 3267 | ||
3235 | codec->spec = spec; | 3268 | codec->spec = spec; |
3236 | 3269 | ||
3270 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3271 | if (err < 0) { | ||
3272 | ad198x_free(codec); | ||
3273 | return err; | ||
3274 | } | ||
3275 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3276 | |||
3237 | spec->multiout.max_channels = 2; | 3277 | spec->multiout.max_channels = 2; |
3238 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); | 3278 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); |
3239 | spec->multiout.dac_nids = ad1884_dac_nids; | 3279 | spec->multiout.dac_nids = ad1884_dac_nids; |
@@ -3300,8 +3340,6 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { | |||
3300 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3340 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3301 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3341 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3302 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3342 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
3303 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3304 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3305 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3343 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
3306 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | 3344 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), |
3307 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | 3345 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), |
@@ -3358,10 +3396,6 @@ static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = { | |||
3358 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3396 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3359 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), | 3397 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), |
3360 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), | 3398 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), |
3361 | /* | ||
3362 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3363 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3364 | */ | ||
3365 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), | 3399 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), |
3366 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3400 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3367 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3401 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3540,8 +3574,6 @@ static struct snd_kcontrol_new ad1884a_base_mixers[] = { | |||
3540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3574 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3575 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3542 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3576 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3543 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3544 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3545 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3577 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3546 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), | 3578 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), |
3547 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3579 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3674,8 +3706,6 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | |||
3674 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3706 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3675 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | 3707 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), |
3676 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3708 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3677 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3678 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3679 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3709 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3680 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3710 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3681 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3711 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3703,8 +3733,6 @@ static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | |||
3703 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 3733 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
3704 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | 3734 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), |
3705 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3735 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3706 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3707 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3708 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), | 3736 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), |
3709 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), | 3737 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), |
3710 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3738 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3815,8 +3843,6 @@ static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { | |||
3815 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3843 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3816 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | 3844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), |
3817 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3818 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3819 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3820 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3846 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3821 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), | 3847 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), |
3822 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3848 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3902,7 +3928,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
3902 | static int patch_ad1884a(struct hda_codec *codec) | 3928 | static int patch_ad1884a(struct hda_codec *codec) |
3903 | { | 3929 | { |
3904 | struct ad198x_spec *spec; | 3930 | struct ad198x_spec *spec; |
3905 | int board_config; | 3931 | int err, board_config; |
3906 | 3932 | ||
3907 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3933 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3908 | if (spec == NULL) | 3934 | if (spec == NULL) |
@@ -3910,6 +3936,13 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3910 | 3936 | ||
3911 | codec->spec = spec; | 3937 | codec->spec = spec; |
3912 | 3938 | ||
3939 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3940 | if (err < 0) { | ||
3941 | ad198x_free(codec); | ||
3942 | return err; | ||
3943 | } | ||
3944 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3945 | |||
3913 | spec->multiout.max_channels = 2; | 3946 | spec->multiout.max_channels = 2; |
3914 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); | 3947 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); |
3915 | spec->multiout.dac_nids = ad1884a_dac_nids; | 3948 | spec->multiout.dac_nids = ad1884a_dac_nids; |
@@ -4064,8 +4097,6 @@ static struct snd_kcontrol_new ad1882_loopback_mixers[] = { | |||
4064 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), | 4097 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), |
4065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4098 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4066 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4099 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4067 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4068 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4069 | { } /* end */ | 4100 | { } /* end */ |
4070 | }; | 4101 | }; |
4071 | 4102 | ||
@@ -4078,8 +4109,6 @@ static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { | |||
4078 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), | 4109 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), |
4079 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4080 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4111 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4081 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4082 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4083 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), | 4112 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), |
4084 | { } /* end */ | 4113 | { } /* end */ |
4085 | }; | 4114 | }; |
@@ -4238,7 +4267,7 @@ static const char *ad1882_models[AD1986A_MODELS] = { | |||
4238 | static int patch_ad1882(struct hda_codec *codec) | 4267 | static int patch_ad1882(struct hda_codec *codec) |
4239 | { | 4268 | { |
4240 | struct ad198x_spec *spec; | 4269 | struct ad198x_spec *spec; |
4241 | int board_config; | 4270 | int err, board_config; |
4242 | 4271 | ||
4243 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4272 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4244 | if (spec == NULL) | 4273 | if (spec == NULL) |
@@ -4246,6 +4275,13 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4246 | 4275 | ||
4247 | codec->spec = spec; | 4276 | codec->spec = spec; |
4248 | 4277 | ||
4278 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
4279 | if (err < 0) { | ||
4280 | ad198x_free(codec); | ||
4281 | return err; | ||
4282 | } | ||
4283 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
4284 | |||
4249 | spec->multiout.max_channels = 6; | 4285 | spec->multiout.max_channels = 6; |
4250 | spec->multiout.num_dacs = 3; | 4286 | spec->multiout.num_dacs = 3; |
4251 | spec->multiout.dac_nids = ad1882_dac_nids; | 4287 | spec->multiout.dac_nids = ad1882_dac_nids; |