]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.drivers/alsa-post-ga-hda-stac-92hd73-fixes
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / alsa-post-ga-hda-stac-92hd73-fixes
1 From: Takashi Iwai <tiwai@suse.de>
2 Subject: ALSA: Regression fixes of broken recording with IDT 92HD73xx codecs
3 Patch-mainline:
4 References: bnc#531533
5
6 The IDT/STAC auto-mic patch also regressed the input source selection of
7 IDT 92HD73xx codecs. The fix is backported from the usptream tree,
8 together with the clean up of dead codes.
9
10 Signed-off-by: Takashi Iwai <tiwai@suse.de>
11
12 ---
13 sound/pci/hda/patch_sigmatel.c | 355 ++++++-----------------------------------
14 1 file changed, 60 insertions(+), 295 deletions(-)
15
16 --- a/sound/pci/hda/patch_sigmatel.c
17 +++ b/sound/pci/hda/patch_sigmatel.c
18 @@ -78,10 +78,12 @@
19 STAC_92HD73XX_AUTO,
20 STAC_92HD73XX_NO_JD, /* no jack-detection */
21 STAC_92HD73XX_REF,
22 + STAC_92HD73XX_INTEL,
23 STAC_DELL_M6_AMIC,
24 STAC_DELL_M6_DMIC,
25 STAC_DELL_M6_BOTH,
26 STAC_DELL_EQ,
27 + STAC_ALIENWARE_M17X,
28 STAC_92HD73XX_MODELS
29 };
30
31 @@ -216,7 +218,6 @@
32
33 /* playback */
34 struct hda_input_mux *mono_mux;
35 - struct hda_input_mux *amp_mux;
36 unsigned int cur_mmux;
37 struct hda_multi_out multiout;
38 hda_nid_t dac_nids[5];
39 @@ -271,7 +272,6 @@
40 unsigned int cur_smux[2];
41 unsigned int cur_amux;
42 hda_nid_t *amp_nids;
43 - unsigned int num_amps;
44 unsigned int powerdown_adcs;
45
46 /* i/o switches */
47 @@ -289,7 +289,6 @@
48 struct hda_input_mux private_dimux;
49 struct hda_input_mux private_imux;
50 struct hda_input_mux private_smux;
51 - struct hda_input_mux private_amp_mux;
52 struct hda_input_mux private_mono_mux;
53 };
54
55 @@ -318,11 +317,6 @@
56 0x1a, 0x1b
57 };
58
59 -#define DELL_M6_AMP 2
60 -static hda_nid_t stac92hd73xx_amp_nids[3] = {
61 - 0x0b, 0x0c, 0x0e
62 -};
63 -
64 #define STAC92HD73XX_NUM_DMICS 2
65 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
66 0x13, 0x14, 0
67 @@ -330,8 +324,8 @@
68
69 #define STAC92HD73_DAC_COUNT 5
70
71 -static hda_nid_t stac92hd73xx_mux_nids[4] = {
72 - 0x28, 0x29, 0x2a, 0x2b,
73 +static hda_nid_t stac92hd73xx_mux_nids[2] = {
74 + 0x20, 0x21,
75 };
76
77 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
78 @@ -584,34 +578,6 @@
79 0x21, 0x22,
80 };
81
82 -#define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
83 -
84 -static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol,
85 - struct snd_ctl_elem_value *ucontrol)
86 -{
87 - struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
88 - struct sigmatel_spec *spec = codec->spec;
89 - hda_nid_t nid = spec->amp_nids[spec->cur_amux];
90 -
91 - kcontrol->private_value ^= get_amp_nid(kcontrol);
92 - kcontrol->private_value |= nid;
93 -
94 - return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
95 -}
96 -
97 -static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
98 - struct snd_ctl_elem_value *ucontrol)
99 -{
100 - struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
101 - struct sigmatel_spec *spec = codec->spec;
102 - hda_nid_t nid = spec->amp_nids[spec->cur_amux];
103 -
104 - kcontrol->private_value ^= get_amp_nid(kcontrol);
105 - kcontrol->private_value |= nid;
106 -
107 - return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
108 -}
109 -
110 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
111 struct snd_ctl_elem_info *uinfo)
112 {
113 @@ -777,41 +743,6 @@
114 spec->mono_nid, &spec->cur_mmux);
115 }
116
117 -static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
118 - struct snd_ctl_elem_info *uinfo)
119 -{
120 - struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
121 - struct sigmatel_spec *spec = codec->spec;
122 - return snd_hda_input_mux_info(spec->amp_mux, uinfo);
123 -}
124 -
125 -static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
126 - struct snd_ctl_elem_value *ucontrol)
127 -{
128 - struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
129 - struct sigmatel_spec *spec = codec->spec;
130 -
131 - ucontrol->value.enumerated.item[0] = spec->cur_amux;
132 - return 0;
133 -}
134 -
135 -static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
136 - struct snd_ctl_elem_value *ucontrol)
137 -{
138 - struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
139 - struct sigmatel_spec *spec = codec->spec;
140 - struct snd_kcontrol *ctl =
141 - snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
142 - if (!ctl)
143 - return -EINVAL;
144 -
145 - snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
146 - SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
147 -
148 - return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
149 - 0, &spec->cur_amux);
150 -}
151 -
152 static struct hda_verb stac9200_core_init[] = {
153 /* set dac0mux for dac converter */
154 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
155 @@ -825,84 +756,16 @@
156 {}
157 };
158
159 -static struct hda_verb stac92hd73xx_6ch_core_init[] = {
160 - /* set master volume and direct control */
161 - { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
162 - /* setup adcs to point to mixer */
163 - { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
164 - { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
165 - { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
166 - { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
167 - { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
168 - /* setup import muxs */
169 - { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
170 - { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
171 - { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
172 - { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
173 - {}
174 -};
175 -
176 static struct hda_verb dell_eq_core_init[] = {
177 /* set master volume to max value without distortion
178 * and direct control */
179 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
180 - /* setup adcs to point to mixer */
181 - { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
182 - { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
183 - /* setup import muxs */
184 - { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
185 - { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
186 - { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
187 - { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
188 {}
189 };
190
191 -static struct hda_verb dell_m6_core_init[] = {
192 - { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
193 - /* setup adcs to point to mixer */
194 - { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
195 - { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
196 - /* setup import muxs */
197 - { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
198 - { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
199 - { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
200 - { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
201 - {}
202 -};
203 -
204 -static struct hda_verb stac92hd73xx_8ch_core_init[] = {
205 - /* set master volume and direct control */
206 - { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
207 - /* setup adcs to point to mixer */
208 - { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
209 - { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
210 - { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
211 - { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
212 - { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
213 - /* setup import muxs */
214 - { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
215 - { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
216 - { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
217 - { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
218 - {}
219 -};
220 -
221 -static struct hda_verb stac92hd73xx_10ch_core_init[] = {
222 +static struct hda_verb stac92hd73xx_core_init[] = {
223 /* set master volume and direct control */
224 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
225 - /* dac3 is connected to import3 mux */
226 - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
227 - /* setup adcs to point to mixer */
228 - { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
229 - { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
230 - { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
231 - { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
232 - { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
233 - /* setup import muxs */
234 - { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
235 - { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
236 - { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
237 - { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
238 {}
239 };
240
241 @@ -980,31 +843,6 @@
242 .put = stac92xx_mono_mux_enum_put, \
243 }
244
245 -#define STAC_AMP_MUX \
246 - { \
247 - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
248 - .name = "Amp Selector Capture Switch", \
249 - .count = 1, \
250 - .info = stac92xx_amp_mux_enum_info, \
251 - .get = stac92xx_amp_mux_enum_get, \
252 - .put = stac92xx_amp_mux_enum_put, \
253 - }
254 -
255 -#define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
256 - { \
257 - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
258 - .name = xname, \
259 - .index = 0, \
260 - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
261 - SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
262 - SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
263 - .info = stac92xx_amp_volume_info, \
264 - .get = stac92xx_amp_volume_get, \
265 - .put = stac92xx_amp_volume_put, \
266 - .tlv = { .c = snd_hda_mixer_amp_tlv }, \
267 - .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
268 - }
269 -
270 #define DC_BIAS(xname, idx, nid) \
271 { \
272 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
273 @@ -1024,65 +862,6 @@
274 { } /* end */
275 };
276
277 -#define DELL_M6_MIXER 6
278 -static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
279 - /* start of config #1 */
280 - HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
281 - HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
282 -
283 - HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
284 - HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
285 -
286 - HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
287 - HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
288 -
289 - /* start of config #2 */
290 - HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
291 - HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
292 -
293 - HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
294 - HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
295 -
296 - { } /* end */
297 -};
298 -
299 -static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
300 - HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
301 - HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
302 -
303 - HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
304 - HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
305 -
306 - HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
307 - HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
308 -
309 - HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
310 - HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
311 -
312 - HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
313 - HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
314 - { } /* end */
315 -};
316 -
317 -static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
318 - HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
319 - HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
320 -
321 - HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
322 - HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
323 -
324 - HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
325 - HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
326 -
327 - HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
328 - HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
329 -
330 - HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
331 - HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
332 - { } /* end */
333 -};
334 -
335 -
336 static struct snd_kcontrol_new stac925x_mixer[] = {
337 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
338 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
339 @@ -1548,22 +1327,32 @@
340 0x4f0000f0,
341 };
342
343 +static unsigned int alienware_m17x_pin_configs[13] = {
344 + 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
345 + 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
346 + 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
347 + 0x904601b0,
348 +};
349 +
350 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
351 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
352 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
353 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
354 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
355 [STAC_DELL_EQ] = dell_m6_pin_configs,
356 + [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs,
357 };
358
359 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
360 [STAC_92HD73XX_AUTO] = "auto",
361 [STAC_92HD73XX_NO_JD] = "no-jd",
362 [STAC_92HD73XX_REF] = "ref",
363 + [STAC_92HD73XX_INTEL] = "intel",
364 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
365 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
366 [STAC_DELL_M6_BOTH] = "dell-m6",
367 [STAC_DELL_EQ] = "dell-eq",
368 + [STAC_ALIENWARE_M17X] = "alienware",
369 };
370
371 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
372 @@ -1572,6 +1361,10 @@
373 "DFI LanParty", STAC_92HD73XX_REF),
374 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
375 "DFI LanParty", STAC_92HD73XX_REF),
376 + SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
377 + "Intel DG45ID", STAC_92HD73XX_INTEL),
378 + SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
379 + "Intel DG45FC", STAC_92HD73XX_INTEL),
380 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
381 "Dell Studio 1535", STAC_DELL_M6_DMIC),
382 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
383 @@ -1597,6 +1390,12 @@
384 {} /* terminator */
385 };
386
387 +static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
388 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
389 + "Alienware M17x", STAC_ALIENWARE_M17X),
390 + {} /* terminator */
391 +};
392 +
393 static unsigned int ref92hd83xxx_pin_configs[10] = {
394 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
395 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
396 @@ -2682,8 +2481,6 @@
397 STAC_CTL_WIDGET_VOL,
398 STAC_CTL_WIDGET_MUTE,
399 STAC_CTL_WIDGET_MONO_MUX,
400 - STAC_CTL_WIDGET_AMP_MUX,
401 - STAC_CTL_WIDGET_AMP_VOL,
402 STAC_CTL_WIDGET_HP_SWITCH,
403 STAC_CTL_WIDGET_IO_SWITCH,
404 STAC_CTL_WIDGET_CLFE_SWITCH,
405 @@ -2694,8 +2491,6 @@
406 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
407 HDA_CODEC_MUTE(NULL, 0, 0, 0),
408 STAC_MONO_MUX,
409 - STAC_AMP_MUX,
410 - STAC_AMP_VOL(NULL, 0, 0, 0, 0),
411 STAC_CODEC_HP_SWITCH(NULL),
412 STAC_CODEC_IO_SWITCH(NULL, 0),
413 STAC_CODEC_CLFE_SWITCH(NULL, 0),
414 @@ -3252,37 +3047,6 @@
415 "Mono Mux", spec->mono_nid);
416 }
417
418 -/* labels for amp mux outputs */
419 -static const char *stac92xx_amp_labels[3] = {
420 - "Front Microphone", "Microphone", "Line In",
421 -};
422 -
423 -/* create amp out controls mux on capable codecs */
424 -static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
425 -{
426 - struct sigmatel_spec *spec = codec->spec;
427 - struct hda_input_mux *amp_mux = &spec->private_amp_mux;
428 - int i, err;
429 -
430 - for (i = 0; i < spec->num_amps; i++) {
431 - amp_mux->items[amp_mux->num_items].label =
432 - stac92xx_amp_labels[i];
433 - amp_mux->items[amp_mux->num_items].index = i;
434 - amp_mux->num_items++;
435 - }
436 -
437 - if (spec->num_amps > 1) {
438 - err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
439 - "Amp Selector Capture Switch", 0);
440 - if (err < 0)
441 - return err;
442 - }
443 - return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
444 - "Amp Capture Volume",
445 - HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
446 -}
447 -
448 -
449 /* create PC beep volume controls */
450 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
451 hda_nid_t nid)
452 @@ -3433,21 +3197,30 @@
453 }
454
455 /* create a volume assigned to the given pin (only if supported) */
456 +/* return 1 if the volume control is created */
457 static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid,
458 - const char *label)
459 + const char *label, int direction)
460 {
461 unsigned int caps, nums;
462 char name[32];
463 + int err;
464
465 - if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP))
466 + if (direction == HDA_OUTPUT)
467 + caps = AC_WCAP_OUT_AMP;
468 + else
469 + caps = AC_WCAP_IN_AMP;
470 + if (!(get_wcaps(codec, nid) & caps))
471 return 0;
472 - caps = query_amp_caps(codec, nid, HDA_OUTPUT);
473 + caps = query_amp_caps(codec, nid, direction);
474 nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;
475 if (!nums)
476 return 0;
477 snprintf(name, sizeof(name), "%s Capture Volume", label);
478 - return stac92xx_add_control(codec->spec, STAC_CTL_WIDGET_VOL, name,
479 - HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
480 + err = stac92xx_add_control(codec->spec, STAC_CTL_WIDGET_VOL, name,
481 + HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction));
482 + if (err < 0)
483 + return err;
484 + return 1;
485 }
486
487 /* create playback/capture controls for input pins on dmic capable codecs */
488 @@ -3496,9 +3269,15 @@
489 else
490 label = stac92xx_dmic_labels[dimux->num_items];
491
492 - err = create_elem_capture_vol(codec, nid, label);
493 + err = create_elem_capture_vol(codec, nid, label, HDA_INPUT);
494 if (err < 0)
495 return err;
496 + if (!err) {
497 + err = create_elem_capture_vol(codec, nid, label,
498 + HDA_OUTPUT);
499 + if (err < 0)
500 + return err;
501 + }
502
503 dimux->items[dimux->num_items].label = label;
504 dimux->items[dimux->num_items].index = index;
505 @@ -3618,7 +3397,8 @@
506 continue;
507
508 err = create_elem_capture_vol(codec, nid,
509 - auto_pin_cfg_labels[i]);
510 + auto_pin_cfg_labels[i],
511 + HDA_INPUT);
512 if (err < 0)
513 return err;
514
515 @@ -3836,11 +3616,6 @@
516 if (err < 0)
517 return err;
518 }
519 - if (spec->num_amps > 0) {
520 - err = stac92xx_auto_create_amp_output_ctls(codec);
521 - if (err < 0)
522 - return err;
523 - }
524 if (spec->num_dmics > 0 && !spec->dinput_mux)
525 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
526 &spec->autocfg)) < 0)
527 @@ -3877,7 +3652,6 @@
528 spec->dinput_mux = &spec->private_dimux;
529 spec->sinput_mux = &spec->private_smux;
530 spec->mono_mux = &spec->private_mono_mux;
531 - spec->amp_mux = &spec->private_amp_mux;
532 return 1;
533 }
534
535 @@ -4850,6 +4624,12 @@
536 STAC_92HD73XX_MODELS,
537 stac92hd73xx_models,
538 stac92hd73xx_cfg_tbl);
539 + /* check codec subsystem id if not found */
540 + if (spec->board_config < 0)
541 + spec->board_config =
542 + snd_hda_check_board_codec_sid_config(codec,
543 + STAC_92HD73XX_MODELS, stac92hd73xx_models,
544 + stac92hd73xx_codec_id_cfg_tbl);
545 again:
546 if (spec->board_config < 0) {
547 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
548 @@ -4873,20 +4653,7 @@
549 "number of channels defaulting to DAC count\n");
550 num_dacs = STAC92HD73_DAC_COUNT;
551 }
552 - switch (num_dacs) {
553 - case 0x3: /* 6 Channel */
554 - spec->mixer = stac92hd73xx_6ch_mixer;
555 - spec->init = stac92hd73xx_6ch_core_init;
556 - break;
557 - case 0x4: /* 8 Channel */
558 - spec->mixer = stac92hd73xx_8ch_mixer;
559 - spec->init = stac92hd73xx_8ch_core_init;
560 - break;
561 - case 0x5: /* 10 Channel */
562 - spec->mixer = stac92hd73xx_10ch_mixer;
563 - spec->init = stac92hd73xx_10ch_core_init;
564 - break;
565 - }
566 + spec->init = stac92hd73xx_core_init;
567 spec->multiout.dac_nids = spec->dac_nids;
568
569 spec->digbeep_nid = 0x1c;
570 @@ -4895,8 +4662,6 @@
571 spec->dmic_nids = stac92hd73xx_dmic_nids;
572 spec->dmux_nids = stac92hd73xx_dmux_nids;
573 spec->smux_nids = stac92hd73xx_smux_nids;
574 - spec->amp_nids = stac92hd73xx_amp_nids;
575 - spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
576
577 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
578 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
579 @@ -4914,13 +4679,8 @@
580 case STAC_DELL_M6_DMIC:
581 case STAC_DELL_M6_BOTH:
582 spec->num_smuxes = 0;
583 - spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
584 - spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
585 spec->eapd_switch = 0;
586 - spec->num_amps = 1;
587
588 - if (spec->board_config != STAC_DELL_EQ)
589 - spec->init = dell_m6_core_init;
590 switch (spec->board_config) {
591 case STAC_DELL_M6_AMIC: /* Analog Mics */
592 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
593 @@ -4937,6 +4697,11 @@
594 break;
595 }
596 break;
597 + case STAC_ALIENWARE_M17X:
598 + spec->num_dmics = STAC92HD73XX_NUM_DMICS;
599 + spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
600 + spec->eapd_switch = 0;
601 + break;
602 default:
603 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
604 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);