aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-07-28 12:20:25 -0400
committerTakashi Iwai <tiwai@suse.de>2009-07-28 12:25:03 -0400
commit6479c63188290beae83ade3243b9d6eb47d394b6 (patch)
treed8901ee4f035518512e86ebb2f7955f5124b5dbf /sound/pci/hda/patch_sigmatel.c
parent4417932315d185b59c0089091de7fa509c59fd5a (diff)
ALSA: hda - Create Capture controls dynamically
Instead of static snd_kcontrol_new arrays, create "Capture Volume" and "Capture Switch" controls dynamically based on the mixer attr values (made via HDA_COMPOSE_AMP_VAL()). This reduces the code size and gives more flexibility to change the number of controls later. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c220
1 files changed, 125 insertions, 95 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4e3531b42e10..be6cf2cfb192 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -238,6 +238,11 @@ struct sigmatel_spec {
238 unsigned int num_dmuxes; 238 unsigned int num_dmuxes;
239 hda_nid_t *smux_nids; 239 hda_nid_t *smux_nids;
240 unsigned int num_smuxes; 240 unsigned int num_smuxes;
241
242 unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
243 unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
244 unsigned int num_caps; /* number of capture volume/switch elements */
245
241 const char **spdif_labels; 246 const char **spdif_labels;
242 247
243 hda_nid_t dig_in_nid; 248 hda_nid_t dig_in_nid;
@@ -334,6 +339,13 @@ static hda_nid_t stac92hd73xx_smux_nids[2] = {
334 0x22, 0x23, 339 0x22, 0x23,
335}; 340};
336 341
342#define STAC92HD73XX_NUM_CAPS 2
343static unsigned long stac92hd73xx_capvols[] = {
344 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
345 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
346};
347#define stac92hd73xx_capsws stac92hd73xx_capvols
348
337#define STAC92HD83XXX_NUM_DMICS 2 349#define STAC92HD83XXX_NUM_DMICS 2
338static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { 350static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
339 0x11, 0x12, 0 351 0x11, 0x12, 0
@@ -365,6 +377,13 @@ static hda_nid_t stac92hd83xxx_amp_nids[1] = {
365 0xc, 377 0xc,
366}; 378};
367 379
380#define STAC92HD83XXX_NUM_CAPS 2
381static unsigned long stac92hd83xxx_capvols[] = {
382 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
383 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_OUTPUT),
384};
385#define stac92hd83xxx_capsws stac92hd83xxx_capvols
386
368static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 387static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
369 0x0a, 0x0d, 0x0f 388 0x0a, 0x0d, 0x0f
370}; 389};
@@ -394,6 +413,13 @@ static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
394 0x22, 0 413 0x22, 0
395}; 414};
396 415
416#define STAC92HD71BXX_NUM_CAPS 2
417static unsigned long stac92hd71bxx_capvols[] = {
418 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
419 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
420};
421#define stac92hd71bxx_capsws stac92hd71bxx_capvols
422
397static hda_nid_t stac925x_adc_nids[1] = { 423static hda_nid_t stac925x_adc_nids[1] = {
398 0x03, 424 0x03,
399}; 425};
@@ -415,6 +441,13 @@ static hda_nid_t stac925x_dmux_nids[1] = {
415 0x14, 441 0x14,
416}; 442};
417 443
444static unsigned long stac925x_capvols[] = {
445 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
446};
447static unsigned long stac925x_capsws[] = {
448 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
449};
450
418static hda_nid_t stac922x_adc_nids[2] = { 451static hda_nid_t stac922x_adc_nids[2] = {
419 0x06, 0x07, 452 0x06, 0x07,
420}; 453};
@@ -423,6 +456,13 @@ static hda_nid_t stac922x_mux_nids[2] = {
423 0x12, 0x13, 456 0x12, 0x13,
424}; 457};
425 458
459#define STAC922X_NUM_CAPS 2
460static unsigned long stac922x_capvols[] = {
461 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
462 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
463};
464#define stac922x_capsws stac922x_capvols
465
426static hda_nid_t stac927x_slave_dig_outs[2] = { 466static hda_nid_t stac927x_slave_dig_outs[2] = {
427 0x1f, 0, 467 0x1f, 0,
428}; 468};
@@ -452,6 +492,18 @@ static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
452 0x13, 0x14, 0 492 0x13, 0x14, 0
453}; 493};
454 494
495#define STAC927X_NUM_CAPS 3
496static unsigned long stac927x_capvols[] = {
497 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
498 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
499 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
500};
501static unsigned long stac927x_capsws[] = {
502 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
503 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
504 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
505};
506
455static const char *stac927x_spdif_labels[5] = { 507static const char *stac927x_spdif_labels[5] = {
456 "Digital Playback", "ADAT", "Analog Mux 1", 508 "Digital Playback", "ADAT", "Analog Mux 1",
457 "Analog Mux 2", "Analog Mux 3" 509 "Analog Mux 2", "Analog Mux 3"
@@ -478,6 +530,16 @@ static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
478 0x17, 0x18, 0 530 0x17, 0x18, 0
479}; 531};
480 532
533#define STAC9205_NUM_CAPS 2
534static unsigned long stac9205_capvols[] = {
535 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
536 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
537};
538static unsigned long stac9205_capsws[] = {
539 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
540 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
541};
542
481static hda_nid_t stac9200_pin_nids[8] = { 543static hda_nid_t stac9200_pin_nids[8] = {
482 0x08, 0x09, 0x0d, 0x0e, 544 0x08, 0x09, 0x0d, 0x0e,
483 0x0f, 0x10, 0x11, 0x12, 545 0x0f, 0x10, 0x11, 0x12,
@@ -1069,12 +1131,6 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1069 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), 1131 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1070 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), 1132 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1071 1133
1072 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1073 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1074
1075 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1076 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1077
1078 { } /* end */ 1134 { } /* end */
1079}; 1135};
1080 1136
@@ -1094,12 +1150,6 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1094}; 1150};
1095 1151
1096static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { 1152static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1097 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1098 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1099
1100 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1101 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1102
1103 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), 1153 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1104 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), 1154 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1105 1155
@@ -1118,12 +1168,6 @@ static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1118}; 1168};
1119 1169
1120static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { 1170static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1121 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1122 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1123
1124 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1125 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1126
1127 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), 1171 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1128 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), 1172 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1129 1173
@@ -1143,12 +1187,6 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1143 1187
1144 1188
1145static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { 1189static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1146 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
1147 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
1148
1149 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
1150 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
1151
1152 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), 1190 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT),
1153 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), 1191 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT),
1154 1192
@@ -1169,17 +1207,6 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1169}; 1207};
1170 1208
1171static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { 1209static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
1172 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1173 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1174
1175 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1176 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1177 /* analog pc-beep replaced with digital beep support */
1178 /*
1179 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
1180 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
1181 */
1182
1183 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), 1210 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT),
1184 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), 1211 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT),
1185 1212
@@ -1198,29 +1225,9 @@ static struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1198 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) 1225 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1199}; 1226};
1200 1227
1201static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1202 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1203 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1204
1205 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1206 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1207 { } /* end */
1208};
1209
1210static struct snd_kcontrol_new stac925x_mixer[] = { 1228static struct snd_kcontrol_new stac925x_mixer[] = {
1211 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), 1229 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
1212 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), 1230 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1213 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
1214 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
1215 { } /* end */
1216};
1217
1218static struct snd_kcontrol_new stac9205_mixer[] = {
1219 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1220 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1221
1222 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1223 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1224 { } /* end */ 1231 { } /* end */
1225}; 1232};
1226 1233
@@ -1229,29 +1236,6 @@ static struct snd_kcontrol_new stac9205_loopback[] = {
1229 {} 1236 {}
1230}; 1237};
1231 1238
1232/* This needs to be generated dynamically based on sequence */
1233static struct snd_kcontrol_new stac922x_mixer[] = {
1234 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1235 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1236
1237 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1238 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1239 { } /* end */
1240};
1241
1242
1243static struct snd_kcontrol_new stac927x_mixer[] = {
1244 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1245 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1246
1247 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1248 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1249
1250 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1251 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1252 { } /* end */
1253};
1254
1255static struct snd_kcontrol_new stac927x_loopback[] = { 1239static struct snd_kcontrol_new stac927x_loopback[] = {
1256 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), 1240 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1257 {} 1241 {}
@@ -1309,9 +1293,11 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1309 int err; 1293 int err;
1310 int i; 1294 int i;
1311 1295
1312 err = snd_hda_add_new_ctls(codec, spec->mixer); 1296 if (spec->mixer) {
1313 if (err < 0) 1297 err = snd_hda_add_new_ctls(codec, spec->mixer);
1314 return err; 1298 if (err < 0)
1299 return err;
1300 }
1315 1301
1316 for (i = 0; i < spec->num_mixers; i++) { 1302 for (i = 0; i < spec->num_mixers; i++) {
1317 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); 1303 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
@@ -3317,6 +3303,21 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3317 return 0; 3303 return 0;
3318} 3304}
3319 3305
3306static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol,
3307 unsigned long sw, int idx)
3308{
3309 int err;
3310 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx,
3311 "Captuer Volume", vol);
3312 if (err < 0)
3313 return err;
3314 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx,
3315 "Captuer Switch", sw);
3316 if (err < 0)
3317 return err;
3318 return 0;
3319}
3320
3320/* add playback controls from the parsed DAC table */ 3321/* add playback controls from the parsed DAC table */
3321static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, 3322static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
3322 const struct auto_pin_cfg *cfg) 3323 const struct auto_pin_cfg *cfg)
@@ -3703,7 +3704,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3703{ 3704{
3704 struct sigmatel_spec *spec = codec->spec; 3705 struct sigmatel_spec *spec = codec->spec;
3705 int hp_swap = 0; 3706 int hp_swap = 0;
3706 int err; 3707 int i, err;
3707 3708
3708 if ((err = snd_hda_parse_pin_def_config(codec, 3709 if ((err = snd_hda_parse_pin_def_config(codec,
3709 &spec->autocfg, 3710 &spec->autocfg,
@@ -3837,6 +3838,13 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3837 spec->autocfg.line_outs = 0; 3838 spec->autocfg.line_outs = 0;
3838 } 3839 }
3839 3840
3841 for (i = 0; i < spec->num_caps; i++) {
3842 err = stac92xx_add_capvol_ctls(codec, spec->capvols[i],
3843 spec->capsws[i], i);
3844 if (err < 0)
3845 return err;
3846 }
3847
3840 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); 3848 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3841 if (err < 0) 3849 if (err < 0)
3842 return err; 3850 return err;
@@ -4898,6 +4906,9 @@ static int patch_stac925x(struct hda_codec *codec)
4898 4906
4899 spec->init = stac925x_core_init; 4907 spec->init = stac925x_core_init;
4900 spec->mixer = stac925x_mixer; 4908 spec->mixer = stac925x_mixer;
4909 spec->num_caps = 1;
4910 spec->capvols = stac925x_capvols;
4911 spec->capsws = stac925x_capsws;
4901 4912
4902 err = stac92xx_parse_auto_config(codec, 0x8, 0x7); 4913 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
4903 if (!err) { 4914 if (!err) {
@@ -5001,6 +5012,10 @@ again:
5001 memcpy(&spec->private_dimux, &stac92hd73xx_dmux, 5012 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
5002 sizeof(stac92hd73xx_dmux)); 5013 sizeof(stac92hd73xx_dmux));
5003 5014
5015 spec->num_caps = STAC92HD73XX_NUM_CAPS;
5016 spec->capvols = stac92hd73xx_capvols;
5017 spec->capsws = stac92hd73xx_capsws;
5018
5004 switch (spec->board_config) { 5019 switch (spec->board_config) {
5005 case STAC_DELL_EQ: 5020 case STAC_DELL_EQ:
5006 spec->init = dell_eq_core_init; 5021 spec->init = dell_eq_core_init;
@@ -5120,6 +5135,10 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5120 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 5135 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
5121 spec->dinput_mux = &stac92hd83xxx_dmux; 5136 spec->dinput_mux = &stac92hd83xxx_dmux;
5122 spec->pin_nids = stac92hd83xxx_pin_nids; 5137 spec->pin_nids = stac92hd83xxx_pin_nids;
5138 spec->num_caps = STAC92HD83XXX_NUM_CAPS;
5139 spec->capvols = stac92hd83xxx_capvols;
5140 spec->capsws = stac92hd83xxx_capsws;
5141
5123 spec->board_config = snd_hda_check_board_config(codec, 5142 spec->board_config = snd_hda_check_board_config(codec,
5124 STAC_92HD83XXX_MODELS, 5143 STAC_92HD83XXX_MODELS,
5125 stac92hd83xxx_models, 5144 stac92hd83xxx_models,
@@ -5308,6 +5327,10 @@ again:
5308 spec->dmic_nids = stac92hd71bxx_dmic_nids; 5327 spec->dmic_nids = stac92hd71bxx_dmic_nids;
5309 spec->dmux_nids = stac92hd71bxx_dmux_nids; 5328 spec->dmux_nids = stac92hd71bxx_dmux_nids;
5310 5329
5330 spec->num_caps = STAC92HD71BXX_NUM_CAPS;
5331 spec->capvols = stac92hd71bxx_capvols;
5332 spec->capsws = stac92hd71bxx_capsws;
5333
5311 switch (codec->vendor_id) { 5334 switch (codec->vendor_id) {
5312 case 0x111d76b6: /* 4 Port without Analog Mixer */ 5335 case 0x111d76b6: /* 4 Port without Analog Mixer */
5313 case 0x111d76b7: 5336 case 0x111d76b7:
@@ -5317,7 +5340,6 @@ again:
5317 case 0x111d76b5: 5340 case 0x111d76b5:
5318 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, 5341 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer,
5319 sizeof(stac92hd71bxx_dmux_nomixer)); 5342 sizeof(stac92hd71bxx_dmux_nomixer));
5320 spec->mixer = stac92hd71bxx_mixer;
5321 spec->init = stac92hd71bxx_core_init; 5343 spec->init = stac92hd71bxx_core_init;
5322 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; 5344 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5323 spec->num_dmics = stac92hd71bxx_connected_ports(codec, 5345 spec->num_dmics = stac92hd71bxx_connected_ports(codec,
@@ -5566,7 +5588,10 @@ static int patch_stac922x(struct hda_codec *codec)
5566 spec->num_pwrs = 0; 5588 spec->num_pwrs = 0;
5567 5589
5568 spec->init = stac922x_core_init; 5590 spec->init = stac922x_core_init;
5569 spec->mixer = stac922x_mixer; 5591
5592 spec->num_caps = STAC922X_NUM_CAPS;
5593 spec->capvols = stac922x_capvols;
5594 spec->capsws = stac922x_capsws;
5570 5595
5571 spec->multiout.dac_nids = spec->dac_nids; 5596 spec->multiout.dac_nids = spec->dac_nids;
5572 5597
@@ -5641,7 +5666,6 @@ static int patch_stac927x(struct hda_codec *codec)
5641 spec->num_dmics = 0; 5666 spec->num_dmics = 0;
5642 5667
5643 spec->init = d965_core_init; 5668 spec->init = d965_core_init;
5644 spec->mixer = stac927x_mixer;
5645 break; 5669 break;
5646 case STAC_DELL_BIOS: 5670 case STAC_DELL_BIOS:
5647 switch (codec->subsystem_id) { 5671 switch (codec->subsystem_id) {
@@ -5666,7 +5690,6 @@ static int patch_stac927x(struct hda_codec *codec)
5666 spec->num_dmics = STAC927X_NUM_DMICS; 5690 spec->num_dmics = STAC927X_NUM_DMICS;
5667 5691
5668 spec->init = d965_core_init; 5692 spec->init = d965_core_init;
5669 spec->mixer = stac927x_mixer;
5670 spec->dmux_nids = stac927x_dmux_nids; 5693 spec->dmux_nids = stac927x_dmux_nids;
5671 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); 5694 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5672 break; 5695 break;
@@ -5679,9 +5702,12 @@ static int patch_stac927x(struct hda_codec *codec)
5679 spec->num_dmics = 0; 5702 spec->num_dmics = 0;
5680 5703
5681 spec->init = stac927x_core_init; 5704 spec->init = stac927x_core_init;
5682 spec->mixer = stac927x_mixer;
5683 } 5705 }
5684 5706
5707 spec->num_caps = STAC927X_NUM_CAPS;
5708 spec->capvols = stac927x_capvols;
5709 spec->capsws = stac927x_capsws;
5710
5685 spec->num_pwrs = 0; 5711 spec->num_pwrs = 0;
5686 spec->aloopback_ctl = stac927x_loopback; 5712 spec->aloopback_ctl = stac927x_loopback;
5687 spec->aloopback_mask = 0x40; 5713 spec->aloopback_mask = 0x40;
@@ -5763,9 +5789,12 @@ static int patch_stac9205(struct hda_codec *codec)
5763 spec->num_pwrs = 0; 5789 spec->num_pwrs = 0;
5764 5790
5765 spec->init = stac9205_core_init; 5791 spec->init = stac9205_core_init;
5766 spec->mixer = stac9205_mixer;
5767 spec->aloopback_ctl = stac9205_loopback; 5792 spec->aloopback_ctl = stac9205_loopback;
5768 5793
5794 spec->num_caps = STAC9205_NUM_CAPS;
5795 spec->capvols = stac9205_capvols;
5796 spec->capsws = stac9205_capsws;
5797
5769 spec->aloopback_mask = 0x40; 5798 spec->aloopback_mask = 0x40;
5770 spec->aloopback_shift = 0; 5799 spec->aloopback_shift = 0;
5771 /* Turn on/off EAPD per HP plugging */ 5800 /* Turn on/off EAPD per HP plugging */
@@ -5840,12 +5869,6 @@ static struct hda_verb stac9872_core_init[] = {
5840 {} 5869 {}
5841}; 5870};
5842 5871
5843static struct snd_kcontrol_new stac9872_mixer[] = {
5844 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5845 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5846 { } /* end */
5847};
5848
5849static hda_nid_t stac9872_pin_nids[] = { 5872static hda_nid_t stac9872_pin_nids[] = {
5850 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 5873 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
5851 0x11, 0x13, 0x14, 5874 0x11, 0x13, 0x14,
@@ -5859,6 +5882,11 @@ static hda_nid_t stac9872_mux_nids[] = {
5859 0x15 5882 0x15
5860}; 5883};
5861 5884
5885static unsigned long stac9872_capvols[] = {
5886 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
5887};
5888#define stac9872_capsws stac9872_capvols
5889
5862static unsigned int stac9872_vaio_pin_configs[9] = { 5890static unsigned int stac9872_vaio_pin_configs[9] = {
5863 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, 5891 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
5864 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, 5892 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
@@ -5907,8 +5935,10 @@ static int patch_stac9872(struct hda_codec *codec)
5907 spec->adc_nids = stac9872_adc_nids; 5935 spec->adc_nids = stac9872_adc_nids;
5908 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); 5936 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
5909 spec->mux_nids = stac9872_mux_nids; 5937 spec->mux_nids = stac9872_mux_nids;
5910 spec->mixer = stac9872_mixer;
5911 spec->init = stac9872_core_init; 5938 spec->init = stac9872_core_init;
5939 spec->num_caps = 1;
5940 spec->capvols = stac9872_capvols;
5941 spec->capsws = stac9872_capsws;
5912 5942
5913 err = stac92xx_parse_auto_config(codec, 0x10, 0x12); 5943 err = stac92xx_parse_auto_config(codec, 0x10, 0x12);
5914 if (err < 0) { 5944 if (err < 0) {