35 static int snd_ac97_add_vmaster(
struct snd_ac97 *ac97,
char *
name,
36 const unsigned int *
tlv,
const char **slaves);
46 for (idx = 0; idx <
count; idx++)
47 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&controls[idx], ac97))) < 0)
53 static void reset_tlv(
struct snd_ac97 *ac97,
const char *
name,
54 const unsigned int *
tlv)
62 if (kctl && kctl->
tlv.
p)
67 static int ac97_update_bits_page(
struct snd_ac97 *ac97,
unsigned short reg,
unsigned short mask,
unsigned short value,
unsigned short page)
69 unsigned short page_save;
85 const char **texts,
unsigned int nums)
98 static const char *texts[] = {
"Shared",
"Independent" };
99 return ac97_enum_text_info(kcontrol, uinfo, texts, 2);
113 unsigned char indep = !!ucontrol->
value.enumerated.item[0];
126 static const char *texts[] = {
"2ch",
"4ch",
"6ch",
"8ch" };
127 return ac97_enum_text_info(kcontrol, uinfo, texts,
142 unsigned char mode = ucontrol->
value.enumerated.item[0];
156 #define AC97_SURROUND_JACK_MODE_CTL \
158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
159 .name = "Surround Jack Mode", \
160 .info = ac97_surround_jack_mode_info, \
161 .get = ac97_surround_jack_mode_get, \
162 .put = ac97_surround_jack_mode_put, \
165 #define AC97_CHANNEL_MODE_CTL \
167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
168 .name = "Channel Mode", \
169 .info = ac97_channel_mode_info, \
170 .get = ac97_channel_mode_get, \
171 .put = ac97_channel_mode_put, \
172 .private_value = 3, \
175 #define AC97_CHANNEL_MODE_4CH_CTL \
177 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
178 .name = "Channel Mode", \
179 .info = ac97_channel_mode_info, \
180 .get = ac97_channel_mode_get, \
181 .put = ac97_channel_mode_put, \
182 .private_value = 2, \
185 #define AC97_CHANNEL_MODE_8CH_CTL \
187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
188 .name = "Channel Mode", \
189 .info = ac97_channel_mode_info, \
190 .get = ac97_channel_mode_get, \
191 .put = ac97_channel_mode_put, \
192 .private_value = 4, \
195 static inline int is_surround_on(
struct snd_ac97 *ac97)
200 static inline int is_clfe_on(
struct snd_ac97 *ac97)
206 static inline int is_shared_surrout(
struct snd_ac97 *ac97)
212 static inline int is_shared_clfeout(
struct snd_ac97 *ac97)
218 static inline int is_shared_linein(
struct snd_ac97 *ac97)
224 static inline int is_shared_micin(
struct snd_ac97 *ac97)
229 static inline int alc850_is_aux_back_surround(
struct snd_ac97 *ac97)
231 return is_surround_on(ac97);
240 static int snd_ac97_ymf7x3_info_speaker(
struct snd_kcontrol *kcontrol,
243 static char *texts[3] = {
244 "Standard",
"Small",
"Smaller"
256 static int snd_ac97_ymf7x3_get_speaker(
struct snd_kcontrol *kcontrol,
263 val = (val >> 10) & 3;
266 ucontrol->
value.enumerated.item[0] =
val;
270 static int snd_ac97_ymf7x3_put_speaker(
struct snd_kcontrol *kcontrol,
276 if (ucontrol->
value.enumerated.item[0] > 2)
278 val = (ucontrol->
value.enumerated.item[0] + 1) << 10;
285 .name =
"3D Control - Speaker",
286 .info = snd_ac97_ymf7x3_info_speaker,
287 .get = snd_ac97_ymf7x3_get_speaker,
288 .put = snd_ac97_ymf7x3_put_speaker,
293 static int snd_ac97_ymf7x3_spdif_source_info(
struct snd_kcontrol *kcontrol,
296 static char *texts[2] = {
"AC-Link",
"A/D Converter" };
307 static int snd_ac97_ymf7x3_spdif_source_get(
struct snd_kcontrol *kcontrol,
314 ucontrol->
value.enumerated.item[0] = (val >> 1) & 1;
318 static int snd_ac97_ymf7x3_spdif_source_put(
struct snd_kcontrol *kcontrol,
324 if (ucontrol->
value.enumerated.item[0] > 1)
326 val = ucontrol->
value.enumerated.item[0] << 1;
330 static int patch_yamaha_ymf7x3_3d(
struct snd_ac97 *ac97)
335 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
339 strcpy(kctl->
id.name,
"3D Control - Wide");
343 snd_ac97_cnew(&snd_ac97_ymf7x3_controls_speaker,
351 static const struct snd_kcontrol_new snd_ac97_yamaha_ymf743_controls_spdif[3] =
358 .info = snd_ac97_ymf7x3_spdif_source_info,
359 .get = snd_ac97_ymf7x3_spdif_source_get,
360 .put = snd_ac97_ymf7x3_spdif_source_put,
366 static int patch_yamaha_ymf743_build_spdif(
struct snd_ac97 *ac97)
370 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3);
373 err = patch_build_controls(ac97,
374 snd_ac97_yamaha_ymf743_controls_spdif, 3);
384 .build_spdif = patch_yamaha_ymf743_build_spdif,
385 .build_3d = patch_yamaha_ymf7x3_3d,
388 static int patch_yamaha_ymf743(
struct snd_ac97 *ac97)
390 ac97->
build_ops = &patch_yamaha_ymf743_ops;
392 ac97->
caps |= 0x04 << 10;
404 static char *texts[3] = {
"Disabled",
"Pin 43",
"Pin 48" };
421 ucontrol->
value.enumerated.item[0] = (val & 0x0008) ? 2 : (val & 0x0020) ? 1 : 0;
430 if (ucontrol->
value.enumerated.item[0] > 2)
432 val = (ucontrol->
value.enumerated.item[0] == 2) ? 0x0008 :
433 (ucontrol->
value.enumerated.item[0] == 1) ? 0x0020 : 0;
443 .info = snd_ac97_ymf7x3_spdif_source_info,
444 .get = snd_ac97_ymf7x3_spdif_source_get,
445 .put = snd_ac97_ymf7x3_spdif_source_put,
450 .info = snd_ac97_ymf753_spdif_output_pin_info,
451 .get = snd_ac97_ymf753_spdif_output_pin_get,
452 .put = snd_ac97_ymf753_spdif_output_pin_put,
458 static int patch_yamaha_ymf753_post_spdif(
struct snd_ac97 * ac97)
462 if ((err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif,
ARRAY_SIZE(snd_ac97_ymf753_controls_spdif))) < 0)
468 .build_3d = patch_yamaha_ymf7x3_3d,
469 .build_post_spdif = patch_yamaha_ymf753_post_spdif
472 static int patch_yamaha_ymf753(
struct snd_ac97 * ac97)
481 ac97->
build_ops = &patch_yamaha_ymf753_ops;
483 ac97->
caps |= 0x04 << 10;
498 static int patch_wolfson_wm9703_specific(
struct snd_ac97 * ac97)
506 for (i = 0; i <
ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
507 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)
515 .build_specific = patch_wolfson_wm9703_specific,
518 static int patch_wolfson03(
struct snd_ac97 * ac97)
520 ac97->
build_ops = &patch_wolfson_wm9703_ops;
533 static int patch_wolfson_wm9704_specific(
struct snd_ac97 * ac97)
536 for (i = 0; i <
ARRAY_SIZE(wm9704_snd_ac97_controls); i++) {
537 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97))) < 0)
546 .build_specific = patch_wolfson_wm9704_specific,
549 static int patch_wolfson04(
struct snd_ac97 * ac97)
552 ac97->
build_ops = &patch_wolfson_wm9704_ops;
556 static int patch_wolfson05(
struct snd_ac97 * ac97)
559 ac97->
build_ops = &patch_wolfson_wm9703_ops;
560 #ifdef CONFIG_TOUCHSCREEN_WM9705
567 static const char* wm9711_alc_select[] = {
"None",
"Left",
"Right",
"Stereo"};
568 static const char* wm9711_alc_mix[] = {
"Stereo",
"Right",
"Left",
"None"};
569 static const char* wm9711_out3_src[] = {
"Left",
"VREF",
"Left + Right",
"Mono"};
570 static const char* wm9711_out3_lrsrc[] = {
"Master Mix",
"Headphone Mix"};
571 static const char* wm9711_rec_adc[] = {
"Stereo",
"Left",
"Right",
"Mute"};
572 static const char* wm9711_base[] = {
"Linear Control",
"Adaptive Boost"};
573 static const char* wm9711_rec_gain[] = {
"+1.5dB Steps",
"+0.75dB Steps"};
574 static const char* wm9711_mic[] = {
"Mic 1",
"Differential",
"Mic 2",
"Stereo"};
575 static const char* wm9711_rec_sel[] =
576 {
"Mic 1",
"NC",
"NC",
"Master Mix",
"Line",
"Headphone Mix",
"Phone Mix",
"Phone"};
577 static const char* wm9711_ng_type[] = {
"Constant Gain",
"Mute"};
579 static const struct ac97_enum wm9711_enum[] = {
597 AC97_ENUM(
"ALC Function", wm9711_enum[0]),
602 AC97_ENUM(
"ALC NG Type", wm9711_enum[9]),
607 AC97_ENUM(
"ALC Headphone Mux", wm9711_enum[1]),
613 AC97_ENUM(
"Out3 LR Mux", wm9711_enum[3]),
642 AC97_ENUM(
"Capture to Phone Mux", wm9711_enum[4]),
644 AC97_ENUM(
"Capture Select", wm9711_enum[8]),
649 AC97_ENUM(
"Bass Control", wm9711_enum[5]),
655 AC97_ENUM(
"Capture Volume Steps", wm9711_enum[6]),
661 AC97_ENUM(
"Mic Select Source", wm9711_enum[7]),
672 static int patch_wolfson_wm9711_specific(
struct snd_ac97 * ac97)
676 for (i = 0; i <
ARRAY_SIZE(wm9711_snd_ac97_controls); i++) {
677 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0)
690 .build_specific = patch_wolfson_wm9711_specific,
693 static int patch_wolfson11(
struct snd_ac97 * ac97)
696 ac97->
build_ops = &patch_wolfson_wm9711_ops;
704 static const char* wm9713_mic_mixer[] = {
"Stereo",
"Mic 1",
"Mic 2",
"Mute"};
705 static const char* wm9713_rec_mux[] = {
"Stereo",
"Left",
"Right",
"Mute"};
706 static const char* wm9713_rec_src[] =
707 {
"Mic 1",
"Mic 2",
"Line",
"Mono In",
"Headphone Mix",
"Master Mix",
709 static const char* wm9713_rec_gain[] = {
"+1.5dB Steps",
"+0.75dB Steps"};
710 static const char* wm9713_alc_select[] = {
"None",
"Left",
"Right",
"Stereo"};
711 static const char* wm9713_mono_pga[] = {
"Vmid",
"Zh",
"Mono Mix",
"Inv 1"};
712 static const char* wm9713_spk_pga[] =
713 {
"Vmid",
"Zh",
"Headphone Mix",
"Master Mix",
"Inv",
"NC",
"NC",
"NC"};
714 static const char* wm9713_hp_pga[] = {
"Vmid",
"Zh",
"Headphone Mix",
"NC"};
715 static const char* wm9713_out3_pga[] = {
"Vmid",
"Zh",
"Inv 1",
"NC"};
716 static const char* wm9713_out4_pga[] = {
"Vmid",
"Zh",
"Inv 2",
"NC"};
717 static const char* wm9713_dac_inv[] =
718 {
"Off",
"Mono Mix",
"Master Mix",
"Headphone Mix L",
"Headphone Mix R",
719 "Headphone Mix Mono",
"NC",
"Vmid"};
720 static const char* wm9713_base[] = {
"Linear Control",
"Adaptive Boost"};
721 static const char* wm9713_ng_type[] = {
"Constant Gain",
"Mute"};
723 static const struct ac97_enum wm9713_enum[] = {
756 AC97_ENUM(
"Mic to Headphone Mux", wm9713_enum[0]),
760 AC97_ENUM(
"Capture Volume Steps", wm9713_enum[4]),
764 AC97_ENUM(
"Capture to Headphone Mux", wm9713_enum[1]),
766 AC97_ENUM(
"Capture to Mono Mux", wm9713_enum[2]),
769 AC97_ENUM(
"Capture Select", wm9713_enum[3]),
775 AC97_ENUM(
"ALC Function", wm9713_enum[5]),
780 AC97_ENUM(
"ALC NG Type", wm9713_enum[13]),
818 AC97_ENUM(
"Mono Input Mux", wm9713_enum[6]),
819 AC97_ENUM(
"Master Input Mux", wm9713_enum[7]),
820 AC97_ENUM(
"Headphone Input Mux", wm9713_enum[8]),
821 AC97_ENUM(
"Out 3 Input Mux", wm9713_enum[9]),
822 AC97_ENUM(
"Out 4 Input Mux", wm9713_enum[10]),
824 AC97_ENUM(
"Bass Control", wm9713_enum[12]),
833 AC97_ENUM(
"Inv Input Mux", wm9713_enum[11]),
839 static int patch_wolfson_wm9713_3d (
struct snd_ac97 * ac97)
843 for (i = 0; i <
ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) {
844 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0)
850 static int patch_wolfson_wm9713_specific(
struct snd_ac97 * ac97)
854 for (i = 0; i <
ARRAY_SIZE(wm13_snd_ac97_controls); i++) {
855 if ((err =
snd_ctl_add(ac97->
bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0)
869 static void patch_wolfson_wm9713_suspend (
struct snd_ac97 * ac97)
875 static void patch_wolfson_wm9713_resume (
struct snd_ac97 * ac97)
884 .build_specific = patch_wolfson_wm9713_specific,
885 .build_3d = patch_wolfson_wm9713_3d,
887 .suspend = patch_wolfson_wm9713_suspend,
888 .resume = patch_wolfson_wm9713_resume
892 static int patch_wolfson13(
struct snd_ac97 * ac97)
895 ac97->
build_ops = &patch_wolfson_wm9713_ops;
912 static int patch_tritech_tr28028(
struct snd_ac97 * ac97)
924 static int patch_sigmatel_stac9700_3d(
struct snd_ac97 * ac97)
929 if ((err =
snd_ctl_add(ac97->
bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
931 strcpy(kctl->
id.name,
"3D Control Sigmatel - Depth");
937 static int patch_sigmatel_stac9708_3d(
struct snd_ac97 * ac97)
942 if ((err =
snd_ctl_add(ac97->
bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
944 strcpy(kctl->
id.name,
"3D Control Sigmatel - Depth");
946 if ((err =
snd_ctl_add(ac97->
bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
948 strcpy(kctl->
id.name,
"3D Control Sigmatel - Rear Depth");
955 AC97_SINGLE(
"Sigmatel 4-Speaker Stereo Playback Switch",
960 AC97_SINGLE(
"Surround Phase Inversion Playback Switch",
968 static int patch_sigmatel_stac97xx_specific(
struct snd_ac97 * ac97)
974 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1)) < 0)
977 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1)) < 0)
980 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1)) < 0)
983 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1)) < 0)
989 .build_3d = patch_sigmatel_stac9700_3d,
990 .build_specific = patch_sigmatel_stac97xx_specific
993 static int patch_sigmatel_stac9700(
struct snd_ac97 * ac97)
995 ac97->
build_ops = &patch_sigmatel_stac9700_ops;
1007 (ucontrol->
value.integer.value[0] & 1) << 4);
1015 .name =
"Sigmatel Output Bias Switch",
1016 .info = snd_ac97_info_volsw,
1017 .get = snd_ac97_get_volsw,
1018 .put = snd_ac97_stac9708_put_bias,
1022 static int patch_sigmatel_stac9708_specific(
struct snd_ac97 *ac97)
1027 snd_ac97_remove_ctl(ac97,
"PCM Out Path & Mute",
NULL);
1029 snd_ac97_rename_vol_ctl(ac97,
"Headphone Playback",
"Sigmatel Surround Playback");
1030 if ((err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1)) < 0)
1032 return patch_sigmatel_stac97xx_specific(ac97);
1036 .build_3d = patch_sigmatel_stac9708_3d,
1037 .build_specific = patch_sigmatel_stac9708_specific
1040 static int patch_sigmatel_stac9708(
struct snd_ac97 * ac97)
1042 unsigned int codec72, codec6c;
1044 ac97->
build_ops = &patch_sigmatel_stac9708_ops;
1050 if ((codec72==0) && (codec6c==0)) {
1055 }
else if ((codec72==0x8000) && (codec6c==0)) {
1059 }
else if ((codec72==0x8000) && (codec6c==0x0080)) {
1066 static int patch_sigmatel_stac9721(
struct snd_ac97 * ac97)
1068 ac97->
build_ops = &patch_sigmatel_stac9700_ops;
1080 static int patch_sigmatel_stac9744(
struct snd_ac97 * ac97)
1083 ac97->
build_ops = &patch_sigmatel_stac9700_ops;
1092 static int patch_sigmatel_stac9756(
struct snd_ac97 * ac97)
1095 ac97->
build_ops = &patch_sigmatel_stac9700_ops;
1106 static char *texts[5] = {
"Input/Disabled",
"Front Output",
1107 "Rear Output",
"Center/LFE Output",
"Mixer Output" };
1126 ucontrol->
value.enumerated.item[0] = 0;
1128 ucontrol->
value.enumerated.item[0] = 1 + (val & 3);
1138 if (ucontrol->
value.enumerated.item[0] > 4)
1140 if (ucontrol->
value.enumerated.item[0] == 0)
1143 val = 4 | (ucontrol->
value.enumerated.item[0] - 1);
1145 7 << shift, val << shift, 0);
1150 static char *texts[7] = {
"Mic2 Jack",
"Mic1 Jack",
"Line In Jack",
1151 "Front Jack",
"Rear Jack",
"Center/LFE Jack",
"Mute" };
1169 ucontrol->
value.enumerated.item[0] = (val >> shift) & 7;
1179 ucontrol->
value.enumerated.item[0] << shift, 0);
1184 static char *texts[3] = {
"None",
"Front Jack",
"Rear Jack" };
1208 ucontrol->
value.enumerated.item[0], 0);
1211 #define STAC9758_OUTPUT_JACK(xname, shift) \
1212 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
1213 .info = snd_ac97_stac9758_output_jack_info, \
1214 .get = snd_ac97_stac9758_output_jack_get, \
1215 .put = snd_ac97_stac9758_output_jack_put, \
1216 .private_value = shift }
1217 #define STAC9758_INPUT_JACK(xname, shift) \
1218 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
1219 .info = snd_ac97_stac9758_input_jack_info, \
1220 .get = snd_ac97_stac9758_input_jack_get, \
1221 .put = snd_ac97_stac9758_input_jack_put, \
1222 .private_value = shift }
1223 static const struct snd_kcontrol_new snd_ac97_sigmatel_stac9758_controls[] = {
1233 .name =
"Headphone Amp",
1234 .info = snd_ac97_stac9758_phonesel_info,
1235 .get = snd_ac97_stac9758_phonesel_get,
1236 .put = snd_ac97_stac9758_phonesel_put
1242 static int patch_sigmatel_stac9758_specific(
struct snd_ac97 *ac97)
1246 err = patch_sigmatel_stac97xx_specific(ac97);
1249 err = patch_build_controls(ac97, snd_ac97_sigmatel_stac9758_controls,
1250 ARRAY_SIZE(snd_ac97_sigmatel_stac9758_controls));
1254 snd_ac97_rename_vol_ctl(ac97,
"Headphone Playback",
"Front Playback");
1258 snd_ac97_rename_vol_ctl(ac97,
"Video Playback",
"Surround Mix Playback");
1265 .build_3d = patch_sigmatel_stac9700_3d,
1266 .build_specific = patch_sigmatel_stac9758_specific
1269 static int patch_sigmatel_stac9758(
struct snd_ac97 * ac97)
1271 static unsigned short regs[4] = {
1277 static unsigned short def_regs[4] = {
1283 static unsigned short m675_regs[4] = {
1289 unsigned short *pregs = def_regs;
1299 ac97->
build_ops = &patch_sigmatel_stac9758_ops;
1302 for (i = 0; i < 4; i++)
1317 static int patch_cirrus_build_spdif(
struct snd_ac97 * ac97)
1322 if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0)
1325 if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1)) < 0)
1329 if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1)) < 0)
1340 .build_spdif = patch_cirrus_build_spdif
1343 static int patch_cirrus_spdif(
struct snd_ac97 * ac97)
1364 static int patch_cirrus_cs4299(
struct snd_ac97 * ac97)
1369 return patch_cirrus_spdif(ac97);
1375 static const struct snd_kcontrol_new snd_ac97_conexant_controls_spdif[1] = {
1379 static int patch_conexant_build_spdif(
struct snd_ac97 * ac97)
1384 if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0)
1387 if ((err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1)) < 0)
1397 .build_spdif = patch_conexant_build_spdif
1400 static int patch_conexant(
struct snd_ac97 * ac97)
1409 static int patch_cx20551(
struct snd_ac97 *ac97)
1419 static void ad18xx_resume(
struct snd_ac97 *ac97)
1421 static unsigned short setup_regs[] = {
1427 unsigned short reg = setup_regs[
i];
1428 if (
test_bit(reg, ac97->reg_accessed)) {
1436 snd_ac97_restore_status(ac97);
1439 for (codec = 0; codec < 3; codec++) {
1451 for (i = 2; i < 0x7c ; i += 2) {
1454 if (
test_bit(i, ac97->reg_accessed)) {
1457 for (codec = 0; codec < 3; codec++) {
1479 snd_ac97_restore_iec958(ac97);
1482 static void ad1888_resume(
struct snd_ac97 *ac97)
1484 ad18xx_resume(ac97);
1501 static int patch_ad1819(
struct snd_ac97 * ac97)
1503 unsigned short scfg;
1512 static unsigned short patch_ad1881_unchained(
struct snd_ac97 * ac97,
int idx,
unsigned short mask)
1520 if ((val & 0xff40) != 0x5340)
1528 static int patch_ad1881_chained1(
struct snd_ac97 * ac97,
int idx,
unsigned short codec_bits)
1530 static int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 };
1536 if ((val & 0xff40) != 0x5340)
1542 ac97->
spec.
ad18xx.codec_cfg[
idx] = codec_bits ? codec_bits : 0x0004;
1546 static void patch_ad1881_chained(
struct snd_ac97 * ac97,
int unchained_idx,
int cidx1,
int cidx2)
1553 if (cidx1 < 0 && cidx2 < 0)
1559 ac97->
spec.
ad18xx.codec_cfg[unchained_idx] = 0x0002;
1562 patch_ad1881_chained1(ac97, cidx1, 0);
1563 else if (patch_ad1881_chained1(ac97, cidx1, 0x0006))
1564 patch_ad1881_chained1(ac97, cidx2, 0);
1565 else if (patch_ad1881_chained1(ac97, cidx2, 0x0006))
1566 patch_ad1881_chained1(ac97, cidx1, 0);
1567 }
else if (cidx2 >= 0) {
1568 patch_ad1881_chained1(ac97, cidx2, 0);
1574 .resume = ad18xx_resume
1578 static int patch_ad1881(
struct snd_ac97 * ac97)
1580 static const char cfg_idxs[3][2] = {
1587 unsigned short codecs[3];
1593 codecs[0] = patch_ad1881_unchained(ac97, 0, (1<<12));
1594 codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14));
1595 codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13));
1597 if (! (codecs[0] || codecs[1] || codecs[2]))
1600 for (idx = 0; idx < 3; idx++)
1602 patch_ad1881_chained(ac97, idx, cfg_idxs[idx][0], cfg_idxs[idx][1]);
1617 for (idx = num = 0; idx < 3; idx++)
1630 ac97->
id &= 0xffff0000;
1633 ac97->
build_ops = &patch_ad1881_build_ops;
1648 static int patch_ad1885_specific(
struct snd_ac97 * ac97)
1652 if ((err = patch_build_controls(ac97, snd_ac97_controls_ad1885,
ARRAY_SIZE(snd_ac97_controls_ad1885))) < 0)
1654 reset_tlv(ac97,
"Headphone Playback Volume",
1655 db_scale_6bit_6db_max);
1660 .build_specific = &patch_ad1885_specific,
1662 .resume = ad18xx_resume
1666 static int patch_ad1885(
struct snd_ac97 * ac97)
1675 ac97->
build_ops = &patch_ad1885_build_ops;
1679 static int patch_ad1886_specific(
struct snd_ac97 * ac97)
1681 reset_tlv(ac97,
"Headphone Playback Volume",
1682 db_scale_6bit_6db_max);
1687 .build_specific = &patch_ad1886_specific,
1689 .resume = ad18xx_resume
1693 static int patch_ad1886(
struct snd_ac97 * ac97)
1699 ac97->
build_ops = &patch_ad1886_build_ops;
1704 #define AC97_AD198X_MBC 0x0003
1705 #define AC97_AD198X_MBC_20 0x0000
1706 #define AC97_AD198X_MBC_10 0x0001
1707 #define AC97_AD198X_MBC_30 0x0002
1708 #define AC97_AD198X_VREFD 0x0004
1709 #define AC97_AD198X_VREFH 0x0008
1710 #define AC97_AD198X_VREF_0 0x000c
1711 #define AC97_AD198X_VREF_MASK (AC97_AD198X_VREFH | AC97_AD198X_VREFD)
1712 #define AC97_AD198X_VREF_SHIFT 2
1713 #define AC97_AD198X_SRU 0x0010
1714 #define AC97_AD198X_LOSEL 0x0020
1715 #define AC97_AD198X_2MIC 0x0040
1716 #define AC97_AD198X_SPRD 0x0080
1717 #define AC97_AD198X_DMIX0 0x0100
1719 #define AC97_AD198X_DMIX1 0x0200
1720 #define AC97_AD198X_HPSEL 0x0400
1721 #define AC97_AD198X_CLDIS 0x0800
1722 #define AC97_AD198X_LODIS 0x1000
1723 #define AC97_AD198X_MSPLT 0x2000
1724 #define AC97_AD198X_AC97NC 0x4000
1725 #define AC97_AD198X_DACZ 0x8000
1728 #define AC97_AD1986_MBC 0x0003
1729 #define AC97_AD1986_MBC_20 0x0000
1730 #define AC97_AD1986_MBC_10 0x0001
1731 #define AC97_AD1986_MBC_30 0x0002
1732 #define AC97_AD1986_LISEL0 0x0004
1733 #define AC97_AD1986_LISEL1 0x0008
1734 #define AC97_AD1986_LISEL_MASK (AC97_AD1986_LISEL1 | AC97_AD1986_LISEL0)
1735 #define AC97_AD1986_LISEL_LI 0x0000
1736 #define AC97_AD1986_LISEL_SURR 0x0004
1737 #define AC97_AD1986_LISEL_MIC 0x0008
1738 #define AC97_AD1986_SRU 0x0010
1739 #define AC97_AD1986_SOSEL 0x0020
1740 #define AC97_AD1986_2MIC 0x0040
1741 #define AC97_AD1986_SPRD 0x0080
1742 #define AC97_AD1986_DMIX0 0x0100
1744 #define AC97_AD1986_DMIX1 0x0200
1745 #define AC97_AD1986_CLDIS 0x0800
1746 #define AC97_AD1986_SODIS 0x1000
1747 #define AC97_AD1986_MSPLT 0x2000
1748 #define AC97_AD1986_AC97NC 0x4000
1749 #define AC97_AD1986_DACZ 0x8000
1752 #define AC97_AD_MISC2 0x70
1754 #define AC97_AD1986_CVREF0 0x0004
1755 #define AC97_AD1986_CVREF1 0x0008
1756 #define AC97_AD1986_CVREF2 0x0010
1757 #define AC97_AD1986_CVREF_MASK \
1758 (AC97_AD1986_CVREF2 | AC97_AD1986_CVREF1 | AC97_AD1986_CVREF0)
1759 #define AC97_AD1986_JSMAP 0x0020
1760 #define AC97_AD1986_MMDIS 0x0080
1761 #define AC97_AD1986_MVREF0 0x0400
1762 #define AC97_AD1986_MVREF1 0x0800
1763 #define AC97_AD1986_MVREF2 0x1000
1764 #define AC97_AD1986_MVREF_MASK \
1765 (AC97_AD1986_MVREF2 | AC97_AD1986_MVREF1 | AC97_AD1986_MVREF0)
1768 #define AC97_AD_MISC3 0x7a
1770 #define AC97_AD1986_MMIX 0x0004
1771 #define AC97_AD1986_GPO 0x0008
1772 #define AC97_AD1986_LOHPEN 0x0010
1773 #define AC97_AD1986_LVREF0 0x0100
1774 #define AC97_AD1986_LVREF1 0x0200
1775 #define AC97_AD1986_LVREF2 0x0400
1776 #define AC97_AD1986_LVREF_MASK \
1777 (AC97_AD1986_LVREF2 | AC97_AD1986_LVREF1 | AC97_AD1986_LVREF0)
1778 #define AC97_AD1986_JSINVA 0x0800
1779 #define AC97_AD1986_LOSEL 0x1000
1780 #define AC97_AD1986_HPSEL0 0x2000
1782 #define AC97_AD1986_HPSEL1 0x4000
1784 #define AC97_AD1986_JSINVB 0x8000
1787 #define AC97_AD1986_OMS0 0x0100
1788 #define AC97_AD1986_OMS1 0x0200
1789 #define AC97_AD1986_OMS2 0x0400
1790 #define AC97_AD1986_OMS_MASK \
1791 (AC97_AD1986_OMS2 | AC97_AD1986_OMS1 | AC97_AD1986_OMS0)
1792 #define AC97_AD1986_OMS_M 0x0000
1793 #define AC97_AD1986_OMS_L 0x0100
1794 #define AC97_AD1986_OMS_C 0x0200
1795 #define AC97_AD1986_OMS_MC 0x0400
1797 #define AC97_AD1986_OMS_ML 0x0500
1799 #define AC97_AD1986_OMS_LC 0x0600
1801 #define AC97_AD1986_OMS_MLC 0x0700
1807 static char *texts[2] = {
"AC-Link",
"A/D Converter" };
1824 ucontrol->
value.enumerated.item[0] = (val >> 2) & 1;
1833 if (ucontrol->
value.enumerated.item[0] > 1)
1835 val = ucontrol->
value.enumerated.item[0] << 2;
1842 .info = snd_ac97_ad198x_spdif_source_info,
1843 .get = snd_ac97_ad198x_spdif_source_get,
1844 .put = snd_ac97_ad198x_spdif_source_put,
1847 static int patch_ad198x_post_spdif(
struct snd_ac97 * ac97)
1849 return patch_build_controls(ac97, &snd_ac97_ad198x_spdif_source, 1);
1860 static unsigned int ad1981_jacks_blacklist[] = {
1876 static int check_list(
struct snd_ac97 *ac97,
const unsigned int *
list)
1879 for (; *
list; list++)
1885 static int patch_ad1981a_specific(
struct snd_ac97 * ac97)
1887 if (check_list(ac97, ad1981_jacks_blacklist))
1889 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
1894 .build_post_spdif = patch_ad198x_post_spdif,
1895 .build_specific = patch_ad1981a_specific,
1897 .resume = ad18xx_resume
1904 static unsigned int ad1981_jacks_whitelist[] = {
1917 static void check_ad1981_hp_jack_sense(
struct snd_ac97 *ac97)
1919 if (check_list(ac97, ad1981_jacks_whitelist))
1924 static int patch_ad1981a(
struct snd_ac97 *ac97)
1927 ac97->
build_ops = &patch_ad1981a_build_ops;
1930 check_ad1981_hp_jack_sense(ac97);
1937 static int patch_ad1981b_specific(
struct snd_ac97 *ac97)
1941 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
1943 if (check_list(ac97, ad1981_jacks_blacklist))
1945 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
1950 .build_post_spdif = patch_ad198x_post_spdif,
1951 .build_specific = patch_ad1981b_specific,
1953 .resume = ad18xx_resume
1957 static int patch_ad1981b(
struct snd_ac97 *ac97)
1960 ac97->
build_ops = &patch_ad1981b_build_ops;
1963 check_ad1981_hp_jack_sense(ac97);
1967 #define snd_ac97_ad1888_lohpsel_info snd_ctl_boolean_mono_info
1977 ucontrol->
value.integer.value[0] =
1978 !ucontrol->
value.integer.value[0];
1987 val = !ucontrol->
value.integer.value[0];
1997 static char *texts[3] = {
"Off",
"6 -> 4",
"6 -> 2"};
2015 ucontrol->
value.enumerated.item[0] = 0;
2017 ucontrol->
value.enumerated.item[0] = 1 + ((val >> 8) & 1);
2026 if (ucontrol->
value.enumerated.item[0] > 2)
2028 if (ucontrol->
value.enumerated.item[0] == 0)
2032 ((ucontrol->
value.enumerated.item[0] - 1) << 8);
2037 static void ad1888_update_jacks(
struct snd_ac97 *ac97)
2039 unsigned short val = 0;
2041 if (!ac97->
spec.
ad18xx.lo_as_master && is_shared_linein(ac97))
2044 if (is_shared_micin(ac97))
2053 .name =
"Exchange Front/Surround",
2055 .get = snd_ac97_ad1888_lohpsel_get,
2056 .put = snd_ac97_ad1888_lohpsel_put
2065 .info = snd_ac97_ad1888_downmix_info,
2066 .get = snd_ac97_ad1888_downmix_get,
2067 .put = snd_ac97_ad1888_downmix_put
2076 static int patch_ad1888_specific(
struct snd_ac97 *ac97)
2080 snd_ac97_rename_vol_ctl(ac97,
"Master Playback",
2081 "Master Surround Playback");
2082 snd_ac97_rename_vol_ctl(ac97,
"Headphone Playback",
2085 return patch_build_controls(ac97, snd_ac97_ad1888_controls,
ARRAY_SIZE(snd_ac97_ad1888_controls));
2089 .build_post_spdif = patch_ad198x_post_spdif,
2090 .build_specific = patch_ad1888_specific,
2092 .resume = ad1888_resume,
2094 .update_jacks = ad1888_update_jacks,
2097 static int patch_ad1888(
struct snd_ac97 * ac97)
2099 unsigned short misc;
2102 ac97->
build_ops = &patch_ad1888_build_ops;
2128 static int patch_ad1980_specific(
struct snd_ac97 *ac97)
2132 if ((err = patch_ad1888_specific(ac97)) < 0)
2134 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
2138 .build_post_spdif = patch_ad198x_post_spdif,
2139 .build_specific = patch_ad1980_specific,
2141 .resume = ad18xx_resume,
2143 .update_jacks = ad1888_update_jacks,
2146 static int patch_ad1980(
struct snd_ac97 * ac97)
2149 ac97->
build_ops = &patch_ad1980_build_ops;
2153 static int snd_ac97_ad1985_vrefout_info(
struct snd_kcontrol *kcontrol,
2156 static char *texts[4] = {
"High-Z",
"3.7 V",
"2.25 V",
"0 V"};
2168 static int snd_ac97_ad1985_vrefout_get(
struct snd_kcontrol *kcontrol,
2171 static const int reg2ctrl[4] = {2, 0, 1, 3};
2176 ucontrol->
value.enumerated.item[0] = reg2ctrl[
val];
2180 static int snd_ac97_ad1985_vrefout_put(
struct snd_kcontrol *kcontrol,
2183 static const int ctrl2reg[4] = {1, 2, 0, 3};
2187 if (ucontrol->
value.enumerated.item[0] > 3)
2189 val = ctrl2reg[ucontrol->
value.enumerated.item[0]]
2199 .name =
"Exchange Front/Surround",
2201 .get = snd_ac97_ad1888_lohpsel_get,
2202 .put = snd_ac97_ad1888_lohpsel_put
2205 AC97_SINGLE(
"Spread Front to Surround and Center/LFE",
2210 .info = snd_ac97_ad1888_downmix_info,
2211 .get = snd_ac97_ad1888_downmix_get,
2212 .put = snd_ac97_ad1888_downmix_put
2217 .info = snd_ac97_ad1985_vrefout_info,
2218 .get = snd_ac97_ad1985_vrefout_get,
2219 .put = snd_ac97_ad1985_vrefout_put
2228 static void ad1985_update_jacks(
struct snd_ac97 *ac97)
2230 ad1888_update_jacks(ac97);
2233 is_shared_micin(ac97) ? 1 << 9 : 0);
2236 static int patch_ad1985_specific(
struct snd_ac97 *ac97)
2241 snd_ac97_rename_vol_ctl(ac97,
"Master Playback",
2242 "Master Surround Playback");
2243 snd_ac97_rename_vol_ctl(ac97,
"Headphone Playback",
"Master Playback");
2245 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
2248 return patch_build_controls(ac97, snd_ac97_ad1985_controls,
2253 .build_post_spdif = patch_ad198x_post_spdif,
2254 .build_specific = patch_ad1985_specific,
2256 .resume = ad18xx_resume,
2258 .update_jacks = ad1985_update_jacks,
2261 static int patch_ad1985(
struct snd_ac97 * ac97)
2263 unsigned short misc;
2266 ac97->
build_ops = &patch_ad1985_build_ops;
2279 ad1985_update_jacks(ac97);
2286 #define snd_ac97_ad1986_bool_info snd_ctl_boolean_mono_info
2288 static int snd_ac97_ad1986_lososel_get(
struct snd_kcontrol *kcontrol,
2299 static int snd_ac97_ad1986_lososel_put(
struct snd_kcontrol *kcontrol,
2308 ucontrol->
value.integer.value[0] != 0
2315 (ucontrol->
value.integer.value[0] != 0
2321 return (ret0 > 0 || ret1 > 0) ? 1 : 0;
2324 static int snd_ac97_ad1986_spread_get(
struct snd_kcontrol *kcontrol,
2335 static int snd_ac97_ad1986_spread_put(
struct snd_kcontrol *kcontrol,
2344 ucontrol->
value.integer.value[0] != 0
2351 (ucontrol->
value.integer.value[0] != 0
2357 return (ret0 > 0 || ret1 > 0) ? 1 : 0;
2360 static int snd_ac97_ad1986_miclisel_get(
struct snd_kcontrol *kcontrol,
2369 static int snd_ac97_ad1986_miclisel_put(
struct snd_kcontrol *kcontrol,
2373 unsigned char swap = ucontrol->
value.integer.value[0] != 0;
2375 if (swap != ac97->
spec.
ad18xx.swap_mic_linein) {
2384 static int snd_ac97_ad1986_vrefout_get(
struct snd_kcontrol *kcontrol,
2399 ucontrol->
value.enumerated.item[0] =
val;
2403 static int snd_ac97_ad1986_vrefout_put(
struct snd_kcontrol *kcontrol,
2407 unsigned short cval;
2408 unsigned short lval;
2409 unsigned short mval;
2414 switch (ucontrol->
value.enumerated.item[0])
2453 return (cret > 0 || lret > 0 || mret > 0) ? 1 : 0;
2460 .name =
"Exchange Front/Surround",
2462 .get = snd_ac97_ad1986_lososel_get,
2463 .put = snd_ac97_ad1986_lososel_put
2467 .name =
"Exchange Mic/Line In",
2469 .get = snd_ac97_ad1986_miclisel_get,
2470 .put = snd_ac97_ad1986_miclisel_put
2474 .name =
"Spread Front to Surround and Center/LFE",
2476 .get = snd_ac97_ad1986_spread_get,
2477 .put = snd_ac97_ad1986_spread_put
2482 .info = snd_ac97_ad1888_downmix_info,
2483 .get = snd_ac97_ad1888_downmix_get,
2484 .put = snd_ac97_ad1888_downmix_put
2489 .info = snd_ac97_ad1985_vrefout_info,
2490 .get = snd_ac97_ad1986_vrefout_get,
2491 .put = snd_ac97_ad1986_vrefout_put
2500 static void ad1986_update_jacks(
struct snd_ac97 *ac97)
2502 unsigned short misc_val = 0;
2503 unsigned short ser_val;
2506 if (!is_surround_on(ac97))
2508 if (!is_clfe_on(ac97))
2512 if (is_shared_linein(ac97))
2514 else if (ac97->
spec.
ad18xx.swap_mic_linein != 0)
2522 if (is_shared_micin(ac97))
2524 else if (ac97->
spec.
ad18xx.swap_mic_linein != 0)
2533 static int patch_ad1986_specific(
struct snd_ac97 *ac97)
2537 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
2540 return patch_build_controls(ac97, snd_ac97_ad1986_controls,
2545 .build_post_spdif = patch_ad198x_post_spdif,
2546 .build_specific = patch_ad1986_specific,
2548 .resume = ad18xx_resume,
2550 .update_jacks = ad1986_update_jacks,
2553 static int patch_ad1986(
struct snd_ac97 * ac97)
2556 ac97->
build_ops = &patch_ad1986_build_ops;
2560 ad1986_update_jacks(ac97);
2568 static int patch_alc203(
struct snd_ac97 *ac97)
2577 static void alc650_update_jacks(
struct snd_ac97 *ac97)
2582 shared = is_shared_surrout(ac97);
2584 shared ? (1 << 9) : 0);
2586 shared = is_shared_clfeout(ac97);
2589 shared ? (1 << 12) : 0);
2592 shared ? (1 << 10) : 0);
2595 shared ? 0 : 0x100);
2598 static int alc650_swap_surround_put(
struct snd_kcontrol *kcontrol,
2605 if (ucontrol->
value.integer.value[0])
2610 return snd_ac97_put_volsw(kcontrol, ucontrol);
2628 .name =
"Swap Surround Slot",
2629 .info = snd_ac97_info_volsw,
2630 .get = snd_ac97_get_volsw,
2631 .put = alc650_swap_surround_put,
2655 static int patch_alc650_specific(
struct snd_ac97 * ac97)
2659 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc650,
ARRAY_SIZE(snd_ac97_controls_alc650))) < 0)
2662 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650,
ARRAY_SIZE(snd_ac97_spdif_controls_alc650))) < 0)
2666 reset_tlv(ac97,
"Master Playback Volume",
2667 db_scale_5bit_3db_max);
2672 .build_specific = patch_alc650_specific,
2673 .update_jacks = alc650_update_jacks
2676 static int patch_alc650(
struct snd_ac97 * ac97)
2685 ac97->
id = 0x414c4720;
2686 else if (val < 0x10)
2687 ac97->
id = 0x414c4721;
2688 else if (val < 0x20)
2689 ac97->
id = 0x414c4722;
2690 else if (val < 0x30)
2691 ac97->
id = 0x414c4723;
2696 ac97->
id == 0x414c4723);
2734 static void alc655_update_jacks(
struct snd_ac97 *ac97)
2739 shared = is_shared_surrout(ac97);
2741 shared ? (1 << 9) : 0, 0);
2743 shared = is_shared_clfeout(ac97);
2746 shared ? (1 << 12) : 0);
2748 shared ? (1 << 10) : 0, 0);
2759 static char *texts_655[3] = {
"PCM",
"Analog In",
"IEC958 In" };
2760 static char *texts_658[4] = {
"PCM",
"Analog1 In",
"Analog2 In",
"IEC958 In" };
2781 val = (val >> 12) & 3;
2784 ucontrol->
value.enumerated.item[0] =
val;
2793 (
unsigned short)ucontrol->
value.enumerated.item[0] << 12,
2804 .info = alc655_iec958_route_info,
2805 .get = alc655_iec958_route_get,
2806 .put = alc655_iec958_route_put,
2810 static int patch_alc655_specific(
struct snd_ac97 * ac97)
2814 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc655,
ARRAY_SIZE(snd_ac97_controls_alc655))) < 0)
2817 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655,
ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0)
2824 .build_specific = patch_alc655_specific,
2825 .update_jacks = alc655_update_jacks
2828 static int patch_alc655(
struct snd_ac97 * ac97)
2883 #define AC97_ALC850_JACK_SELECT 0x76
2884 #define AC97_ALC850_MISC1 0x7a
2885 #define AC97_ALC850_MULTICH 0x6a
2887 static void alc850_update_jacks(
struct snd_ac97 *ac97)
2890 int aux_is_back_surround;
2893 shared = is_shared_surrout(ac97);
2896 shared ? (1<<5) : (1<<4));
2899 shared ? (2<<12) : (0<<12));
2901 shared = is_shared_clfeout(ac97);
2904 shared ? (1<<12) : (1<<13));
2907 shared ? (5<<4) : (1<<4));
2909 aux_is_back_surround = alc850_is_aux_back_surround(ac97);
2912 aux_is_back_surround ? (1<<10) : (0<<10));
2922 static int patch_alc850_specific(
struct snd_ac97 *ac97)
2926 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc850,
ARRAY_SIZE(snd_ac97_controls_alc850))) < 0)
2929 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655,
ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0)
2936 .build_specific = patch_alc850_specific,
2937 .update_jacks = alc850_update_jacks
2940 static int patch_alc850(
struct snd_ac97 *ac97)
2962 (1<<7)|(0<<12)|(1<<13)|(0<<14));
2967 (1<<11)|(0<<12)|(1<<15));
2975 static int patch_aztech_azf3328_specific(
struct snd_ac97 *ac97)
2978 snd_ac97_find_mixer_ctl(ac97,
"3D Control - Center");
2980 snd_ac97_find_mixer_ctl(ac97,
"3D Control - Depth");
2986 if (kctl_3d_center) {
2989 snd_ac97_rename_vol_ctl(ac97,
2990 "3D Control - Center",
"3D Control - Width"
2999 snd_ac97_rename_vol_ctl(ac97,
3000 "Master Mono Playback",
"Modem Playback"
3002 snd_ac97_rename_vol_ctl(ac97,
3003 "Headphone Playback",
"FM Synth Playback"
3010 .build_specific = patch_aztech_azf3328_specific
3013 static int patch_aztech_azf3328(
struct snd_ac97 *ac97)
3015 ac97->
build_ops = &patch_aztech_azf3328_ops;
3022 static void cm9738_update_jacks(
struct snd_ac97 *ac97)
3026 is_shared_surrout(ac97) ? (1 << 10) : 0);
3035 static int patch_cm9738_specific(
struct snd_ac97 * ac97)
3037 return patch_build_controls(ac97, snd_ac97_cm9738_controls,
ARRAY_SIZE(snd_ac97_cm9738_controls));
3041 .build_specific = patch_cm9738_specific,
3042 .update_jacks = cm9738_update_jacks
3045 static int patch_cm9738(
struct snd_ac97 * ac97)
3058 static char *texts[] = {
"Analog",
"Digital" };
3075 ucontrol->
value.enumerated.item[0] = (val >> 1) & 0x01;
3085 (ucontrol->
value.enumerated.item[0] & 0x01) << 1);
3093 .info = snd_ac97_cmedia_spdif_playback_source_info,
3094 .get = snd_ac97_cmedia_spdif_playback_source_get,
3095 .put = snd_ac97_cmedia_spdif_playback_source_put,
3106 static void cm9739_update_jacks(
struct snd_ac97 *ac97)
3110 is_shared_surrout(ac97) ? (1 << 10) : 0);
3113 is_shared_clfeout(ac97) ? 0x1000 : 0x2000);
3121 static int patch_cm9739_specific(
struct snd_ac97 * ac97)
3123 return patch_build_controls(ac97, snd_ac97_cm9739_controls,
ARRAY_SIZE(snd_ac97_cm9739_controls));
3126 static int patch_cm9739_post_spdif(
struct snd_ac97 * ac97)
3128 return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif,
ARRAY_SIZE(snd_ac97_cm9739_controls_spdif));
3132 .build_specific = patch_cm9739_specific,
3133 .build_post_spdif = patch_cm9739_post_spdif,
3134 .update_jacks = cm9739_update_jacks
3137 static int patch_cm9739(
struct snd_ac97 * ac97)
3192 #define AC97_CM9761_MULTI_CHAN 0x64
3193 #define AC97_CM9761_FUNC 0x66
3194 #define AC97_CM9761_SPDIF_CTRL 0x6c
3196 static void cm9761_update_jacks(
struct snd_ac97 *ac97)
3201 static unsigned short surr_on[3][2] = {
3206 static unsigned short clfe_on[3][2] = {
3211 static unsigned short surr_shared[3][2] = {
3216 static unsigned short clfe_shared[3][2] = {
3221 unsigned short val = 0;
3225 val |= surr_shared[ac97->
spec.
dev_flags][is_shared_surrout(ac97)];
3226 val |= clfe_shared[ac97->
spec.
dev_flags][is_shared_clfeout(ac97)];
3238 static char *texts[] = {
"AC-Link",
"ADC",
"SPDIF-In" };
3254 ucontrol->
value.enumerated.item[0] = 2;
3256 ucontrol->
value.enumerated.item[0] = 1;
3258 ucontrol->
value.enumerated.item[0] = 0;
3266 if (ucontrol->
value.enumerated.item[0] == 2)
3270 ucontrol->
value.enumerated.item[0] == 1 ? 0x2 : 0);
3273 static const char *cm9761_dac_clock[] = {
"AC-Link",
"SPDIF-In",
"Both" };
3274 static const struct ac97_enum cm9761_dac_clock_enum =
3281 .info = cm9761_spdif_out_source_info,
3282 .get = cm9761_spdif_out_source_get,
3283 .put = cm9761_spdif_out_source_put,
3292 AC97_ENUM(
"DAC Clock Source", cm9761_dac_clock_enum),
3295 static int patch_cm9761_post_spdif(
struct snd_ac97 * ac97)
3297 return patch_build_controls(ac97, snd_ac97_cm9761_controls_spdif,
ARRAY_SIZE(snd_ac97_cm9761_controls_spdif));
3300 static int patch_cm9761_specific(
struct snd_ac97 * ac97)
3302 return patch_build_controls(ac97, snd_ac97_cm9761_controls,
ARRAY_SIZE(snd_ac97_cm9761_controls));
3306 .build_specific = patch_cm9761_specific,
3307 .build_post_spdif = patch_cm9761_post_spdif,
3308 .update_jacks = cm9761_update_jacks
3311 static int patch_cm9761(
struct snd_ac97 *ac97)
3381 #define AC97_CM9780_SIDE 0x60
3382 #define AC97_CM9780_JACK 0x62
3383 #define AC97_CM9780_MIXER 0x64
3384 #define AC97_CM9780_MULTI_CHAN 0x66
3385 #define AC97_CM9780_SPDIF 0x6c
3387 static const char *cm9780_ch_select[] = {
"Front",
"Side",
"Center/LFE",
"Rear" };
3388 static const struct ac97_enum cm9780_ch_select_enum =
3393 AC97_ENUM(
"Side Playback Route", cm9780_ch_select_enum),
3396 static int patch_cm9780_specific(
struct snd_ac97 *ac97)
3398 return patch_build_controls(ac97, cm9780_controls,
ARRAY_SIZE(cm9780_controls));
3402 .build_specific = patch_cm9780_specific,
3403 .build_post_spdif = patch_cm9761_post_spdif
3406 static int patch_cm9780(
struct snd_ac97 *ac97)
3428 AC97_SINGLE(
"Alternate Level to Surround Out", 0x5a, 15, 1, 0),
3429 AC97_SINGLE(
"Downmix LFE and Center to Front", 0x5a, 12, 1, 0),
3430 AC97_SINGLE(
"Downmix Surround to Front", 0x5a, 11, 1, 0),
3433 static const char *slave_vols_vt1616[] = {
3434 "Front Playback Volume",
3435 "Surround Playback Volume",
3436 "Center Playback Volume",
3437 "LFE Playback Volume",
3441 static const char *slave_sws_vt1616[] = {
3442 "Front Playback Switch",
3443 "Surround Playback Switch",
3444 "Center Playback Switch",
3445 "LFE Playback Switch",
3454 memset(&
id, 0,
sizeof(
id));
3461 static int snd_ac97_add_vmaster(
struct snd_ac97 *ac97,
char *name,
3462 const unsigned int *tlv,
const char **slaves)
3475 for (s = slaves; *
s; s++) {
3478 sctl = snd_ac97_find_mixer_ctl(ac97, *s);
3480 snd_printdd(
"Cannot find slave %s, skipped\n", *s);
3483 err = snd_ctl_add_slave(kctl, sctl);
3490 static int patch_vt1616_specific(
struct snd_ac97 * ac97)
3495 if (snd_ac97_try_bit(ac97, 0x5a, 9))
3496 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1)) < 0)
3498 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1],
ARRAY_SIZE(snd_ac97_controls_vt1616) - 1)) < 0)
3502 kctl = snd_ac97_find_mixer_ctl(ac97,
"Master Playback Volume");
3506 snd_ac97_rename_vol_ctl(ac97,
"Master Playback",
"Front Playback");
3508 err = snd_ac97_add_vmaster(ac97,
"Master Playback Volume",
3509 kctl->
tlv.
p, slave_vols_vt1616);
3513 err = snd_ac97_add_vmaster(ac97,
"Master Playback Switch",
3514 NULL, slave_sws_vt1616);
3522 .build_specific = patch_vt1616_specific
3525 static int patch_vt1616(
struct snd_ac97 * ac97)
3546 static int snd_ac97_vt1617a_smart51_info(
struct snd_kcontrol *kcontrol,
3554 static const char* texts[] = {
"LineIn Mic1",
"LineIn Mic1 Mic3",
3555 "Surr LFE/C Mic3",
"LineIn LFE/C Mic3",
3556 "LineIn Mic2",
"LineIn Mic2 Mic1",
3557 "Surr LFE Mic1",
"Surr LFE Mic1 Mic2"};
3558 return ac97_enum_text_info(kcontrol, uinfo, texts, 8);
3561 static int snd_ac97_vt1617a_smart51_get(
struct snd_kcontrol *kcontrol,
3576 ucontrol->
value.enumerated.item[0] = (usSM51 << 1) + usMS;
3581 static int snd_ac97_vt1617a_smart51_put(
struct snd_kcontrol *kcontrol,
3584 ushort usSM51, usMS, usReg;
3590 usSM51 = ucontrol->
value.enumerated.item[0] >> 1;
3591 usMS = ucontrol->
value.enumerated.item[0] & 1;
3606 AC97_SINGLE(
"Center/LFE Exchange", 0x5a, 8, 1, 0),
3613 .name =
"Smart 5.1 Select",
3614 .info = snd_ac97_vt1617a_smart51_info,
3615 .get = snd_ac97_vt1617a_smart51_get,
3616 .put = snd_ac97_vt1617a_smart51_put,
3620 static int patch_vt1617a(
struct snd_ac97 * ac97)
3628 err = patch_build_controls(ac97, &snd_ac97_controls_vt1617a[0],
3698 "Speaker Out",
"DAC Unmixed Out",
"Line In",
"Mic In"
3706 "Surround Out",
"DAC Unmixed Out",
"Line In",
"Mic In"
3714 "Center LFE Out",
"DAC Unmixed Out",
"Line In",
"Mic In"
3719 static int snd_ac97_vt1618_UAJ_info(
struct snd_kcontrol *kcontrol,
3722 return ac97_enum_text_info(kcontrol, uinfo,
3731 static int snd_ac97_vt1618_UAJ_get(
struct snd_kcontrol *kcontrol,
3734 unsigned short datpag, uaj;
3748 ucontrol->
value.enumerated.item[0] = uaj >>
3754 static int snd_ac97_vt1618_UAJ_put(
struct snd_kcontrol *kcontrol,
3759 ucontrol->
value.enumerated.item[0]<<
3766 static int snd_ac97_vt1618_aux_info(
struct snd_kcontrol *kcontrol,
3769 static const char *txt_aux[] = {
"Aux In",
"Back Surr Out"};
3771 return ac97_enum_text_info(kcontrol, uinfo, txt_aux, 2);
3774 static int snd_ac97_vt1618_aux_get(
struct snd_kcontrol *kcontrol,
3777 ucontrol->
value.enumerated.item[0] =
3782 static int snd_ac97_vt1618_aux_put(
struct snd_kcontrol *kcontrol,
3788 ucontrol->
value.enumerated.item[0] << 3);
3793 ucontrol->
value.enumerated.item[0] << 3);
3797 AC97_SINGLE(
"Exchange Center/LFE", 0x5a, 8, 1, 0),
3801 AC97_DOUBLE(
"Back Surr Volume", 0x5e, 8, 0, 31, 1),
3805 .name =
"Speaker Jack Mode",
3806 .info = snd_ac97_vt1618_UAJ_info,
3807 .get = snd_ac97_vt1618_UAJ_get,
3808 .put = snd_ac97_vt1618_UAJ_put,
3813 .name =
"Line Jack Mode",
3814 .info = snd_ac97_vt1618_UAJ_info,
3815 .get = snd_ac97_vt1618_UAJ_get,
3816 .put = snd_ac97_vt1618_UAJ_put,
3821 .name =
"Mic Jack Mode",
3822 .info = snd_ac97_vt1618_UAJ_info,
3823 .get = snd_ac97_vt1618_UAJ_get,
3824 .put = snd_ac97_vt1618_UAJ_put,
3829 .name =
"Aux Jack Mode",
3830 .info = snd_ac97_vt1618_aux_info,
3831 .get = snd_ac97_vt1618_aux_get,
3832 .put = snd_ac97_vt1618_aux_put,
3836 static int patch_vt1618(
struct snd_ac97 *ac97)
3838 return patch_build_controls(ac97, snd_ac97_controls_vt1618,
3844 static void it2646_update_jacks(
struct snd_ac97 *ac97)
3848 is_shared_surrout(ac97) ? (1<<9) : 0);
3851 is_shared_clfeout(ac97) ? (1<<10) : 0);
3861 AC97_SINGLE(
"Analog to IEC958 Output", 0x76, 12, 1, 0),
3862 AC97_SINGLE(
"IEC958 Input Monitor", 0x76, 13, 1, 0),
3865 static int patch_it2646_specific(
struct snd_ac97 * ac97)
3868 if ((err = patch_build_controls(ac97, snd_ac97_controls_it2646,
ARRAY_SIZE(snd_ac97_controls_it2646))) < 0)
3870 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646,
ARRAY_SIZE(snd_ac97_spdif_controls_it2646))) < 0)
3876 .build_specific = patch_it2646_specific,
3877 .update_jacks = it2646_update_jacks
3880 static int patch_it2646(
struct snd_ac97 * ac97)
3893 #define AC97_SI3036_CHIP_ID 0x5a
3894 #define AC97_SI3036_LINE_CFG 0x5c
3897 AC97_DOUBLE(
"Modem Speaker Volume", 0x5c, 14, 12, 3, 1)
3900 static int patch_si3036_specific(
struct snd_ac97 * ac97)
3903 for (idx = 0; idx <
ARRAY_SIZE(snd_ac97_controls_si3036); idx++)
3910 .build_specific = patch_si3036_specific,
3913 static int mpatch_si3036(
struct snd_ac97 * ac97)
3945 static int patch_lm4550(
struct snd_ac97 *ac97)
3964 AC97_SINGLE(
"Smart Low Power Mode", 0x6c, 4, 3, 0),
3967 static int patch_ucb1400_specific(
struct snd_ac97 * ac97)
3970 for (idx = 0; idx <
ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++)
3977 .build_specific = patch_ucb1400_specific,
3980 static int patch_ucb1400(
struct snd_ac97 * ac97)