ALSA: hda: Add support for ECS/PC Chips boards with Sigmatel codecs
[deliverable/linux.git] / sound / pci / hda / patch_sigmatel.c
1 /*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * HD audio interface patch for SigmaTel STAC92xx
5 *
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
8 *
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
11 *
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include <sound/asoundef.h>
33 #include "hda_codec.h"
34 #include "hda_local.h"
35 #include "hda_patch.h"
36 #include "hda_beep.h"
37
38 #define NUM_CONTROL_ALLOC 32
39 #define STAC_PWR_EVENT 0x20
40 #define STAC_HP_EVENT 0x30
41
42 enum {
43 STAC_REF,
44 STAC_9200_OQO,
45 STAC_9200_DELL_D21,
46 STAC_9200_DELL_D22,
47 STAC_9200_DELL_D23,
48 STAC_9200_DELL_M21,
49 STAC_9200_DELL_M22,
50 STAC_9200_DELL_M23,
51 STAC_9200_DELL_M24,
52 STAC_9200_DELL_M25,
53 STAC_9200_DELL_M26,
54 STAC_9200_DELL_M27,
55 STAC_9200_GATEWAY,
56 STAC_9200_PANASONIC,
57 STAC_9200_MODELS
58 };
59
60 enum {
61 STAC_9205_REF,
62 STAC_9205_DELL_M42,
63 STAC_9205_DELL_M43,
64 STAC_9205_DELL_M44,
65 STAC_9205_MODELS
66 };
67
68 enum {
69 STAC_92HD73XX_REF,
70 STAC_DELL_M6,
71 STAC_92HD73XX_MODELS
72 };
73
74 enum {
75 STAC_92HD83XXX_REF,
76 STAC_92HD83XXX_MODELS
77 };
78
79 enum {
80 STAC_92HD71BXX_REF,
81 STAC_DELL_M4_1,
82 STAC_DELL_M4_2,
83 STAC_92HD71BXX_MODELS
84 };
85
86 enum {
87 STAC_925x_REF,
88 STAC_M2_2,
89 STAC_MA6,
90 STAC_PA6,
91 STAC_925x_MODELS
92 };
93
94 enum {
95 STAC_D945_REF,
96 STAC_D945GTP3,
97 STAC_D945GTP5,
98 STAC_INTEL_MAC_V1,
99 STAC_INTEL_MAC_V2,
100 STAC_INTEL_MAC_V3,
101 STAC_INTEL_MAC_V4,
102 STAC_INTEL_MAC_V5,
103 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
104 * is given, one of the above models will be
105 * chosen according to the subsystem id. */
106 /* for backward compatibility */
107 STAC_MACMINI,
108 STAC_MACBOOK,
109 STAC_MACBOOK_PRO_V1,
110 STAC_MACBOOK_PRO_V2,
111 STAC_IMAC_INTEL,
112 STAC_IMAC_INTEL_20,
113 STAC_ECS_202,
114 STAC_922X_DELL_D81,
115 STAC_922X_DELL_D82,
116 STAC_922X_DELL_M81,
117 STAC_922X_DELL_M82,
118 STAC_922X_MODELS
119 };
120
121 enum {
122 STAC_D965_REF,
123 STAC_D965_3ST,
124 STAC_D965_5ST,
125 STAC_DELL_3ST,
126 STAC_DELL_BIOS,
127 STAC_927X_MODELS
128 };
129
130 struct sigmatel_spec {
131 struct snd_kcontrol_new *mixers[4];
132 unsigned int num_mixers;
133
134 int board_config;
135 unsigned int surr_switch: 1;
136 unsigned int line_switch: 1;
137 unsigned int mic_switch: 1;
138 unsigned int alt_switch: 1;
139 unsigned int hp_detect: 1;
140
141 /* gpio lines */
142 unsigned int eapd_mask;
143 unsigned int gpio_mask;
144 unsigned int gpio_dir;
145 unsigned int gpio_data;
146 unsigned int gpio_mute;
147
148 /* analog loopback */
149 unsigned char aloopback_mask;
150 unsigned char aloopback_shift;
151
152 /* power management */
153 unsigned int num_pwrs;
154 unsigned int *pwr_mapping;
155 hda_nid_t *pwr_nids;
156 hda_nid_t *dac_list;
157
158 /* playback */
159 struct hda_input_mux *mono_mux;
160 unsigned int cur_mmux;
161 struct hda_multi_out multiout;
162 hda_nid_t dac_nids[5];
163
164 /* capture */
165 hda_nid_t *adc_nids;
166 unsigned int num_adcs;
167 hda_nid_t *mux_nids;
168 unsigned int num_muxes;
169 hda_nid_t *dmic_nids;
170 unsigned int num_dmics;
171 hda_nid_t *dmux_nids;
172 unsigned int num_dmuxes;
173 hda_nid_t dig_in_nid;
174 hda_nid_t mono_nid;
175 hda_nid_t anabeep_nid;
176 hda_nid_t digbeep_nid;
177
178 /* pin widgets */
179 hda_nid_t *pin_nids;
180 unsigned int num_pins;
181 unsigned int *pin_configs;
182 unsigned int *bios_pin_configs;
183
184 /* codec specific stuff */
185 struct hda_verb *init;
186 struct snd_kcontrol_new *mixer;
187
188 /* capture source */
189 struct hda_input_mux *dinput_mux;
190 unsigned int cur_dmux[2];
191 struct hda_input_mux *input_mux;
192 unsigned int cur_mux[3];
193
194 /* i/o switches */
195 unsigned int io_switch[2];
196 unsigned int clfe_swap;
197 unsigned int hp_switch;
198 unsigned int aloopback;
199
200 struct hda_pcm pcm_rec[2]; /* PCM information */
201
202 /* dynamic controls and input_mux */
203 struct auto_pin_cfg autocfg;
204 unsigned int num_kctl_alloc, num_kctl_used;
205 struct snd_kcontrol_new *kctl_alloc;
206 struct hda_input_mux private_dimux;
207 struct hda_input_mux private_imux;
208 struct hda_input_mux private_mono_mux;
209 };
210
211 static hda_nid_t stac9200_adc_nids[1] = {
212 0x03,
213 };
214
215 static hda_nid_t stac9200_mux_nids[1] = {
216 0x0c,
217 };
218
219 static hda_nid_t stac9200_dac_nids[1] = {
220 0x02,
221 };
222
223 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
224 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
225 0x0f, 0x10, 0x11
226 };
227
228 static hda_nid_t stac92hd73xx_adc_nids[2] = {
229 0x1a, 0x1b
230 };
231
232 #define STAC92HD73XX_NUM_DMICS 2
233 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
234 0x13, 0x14, 0
235 };
236
237 #define STAC92HD73_DAC_COUNT 5
238 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
239 0x15, 0x16, 0x17, 0x18, 0x19,
240 };
241
242 static hda_nid_t stac92hd73xx_mux_nids[4] = {
243 0x28, 0x29, 0x2a, 0x2b,
244 };
245
246 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
247 0x20, 0x21,
248 };
249
250 #define STAC92HD83XXX_NUM_DMICS 2
251 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
252 0x11, 0x12, 0
253 };
254
255 #define STAC92HD81_DAC_COUNT 2
256 #define STAC92HD83_DAC_COUNT 3
257 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {
258 0x13, 0x14, 0x22,
259 };
260
261 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
262 0x17, 0x18,
263 };
264
265 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
266 0x15, 0x16,
267 };
268
269 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
270 0xa, 0xb, 0xd, 0xe,
271 };
272
273 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
274 0x03, 0x0c, 0x10, 0x40,
275 };
276
277 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
278 0x0a, 0x0d, 0x0f
279 };
280
281 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
282 0x12, 0x13,
283 };
284
285 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
286 0x1a, 0x1b
287 };
288
289 static hda_nid_t stac92hd71bxx_dmux_nids[1] = {
290 0x1c,
291 };
292
293 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
294 0x10, /*0x11, */
295 };
296
297 #define STAC92HD71BXX_NUM_DMICS 2
298 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
299 0x18, 0x19, 0
300 };
301
302 static hda_nid_t stac925x_adc_nids[1] = {
303 0x03,
304 };
305
306 static hda_nid_t stac925x_mux_nids[1] = {
307 0x0f,
308 };
309
310 static hda_nid_t stac925x_dac_nids[1] = {
311 0x02,
312 };
313
314 #define STAC925X_NUM_DMICS 1
315 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
316 0x15, 0
317 };
318
319 static hda_nid_t stac925x_dmux_nids[1] = {
320 0x14,
321 };
322
323 static hda_nid_t stac922x_adc_nids[2] = {
324 0x06, 0x07,
325 };
326
327 static hda_nid_t stac922x_mux_nids[2] = {
328 0x12, 0x13,
329 };
330
331 static hda_nid_t stac927x_adc_nids[3] = {
332 0x07, 0x08, 0x09
333 };
334
335 static hda_nid_t stac927x_mux_nids[3] = {
336 0x15, 0x16, 0x17
337 };
338
339 static hda_nid_t stac927x_dac_nids[6] = {
340 0x02, 0x03, 0x04, 0x05, 0x06, 0
341 };
342
343 static hda_nid_t stac927x_dmux_nids[1] = {
344 0x1b,
345 };
346
347 #define STAC927X_NUM_DMICS 2
348 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
349 0x13, 0x14, 0
350 };
351
352 static hda_nid_t stac9205_adc_nids[2] = {
353 0x12, 0x13
354 };
355
356 static hda_nid_t stac9205_mux_nids[2] = {
357 0x19, 0x1a
358 };
359
360 static hda_nid_t stac9205_dmux_nids[1] = {
361 0x1d,
362 };
363
364 #define STAC9205_NUM_DMICS 2
365 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
366 0x17, 0x18, 0
367 };
368
369 static hda_nid_t stac9200_pin_nids[8] = {
370 0x08, 0x09, 0x0d, 0x0e,
371 0x0f, 0x10, 0x11, 0x12,
372 };
373
374 static hda_nid_t stac925x_pin_nids[8] = {
375 0x07, 0x08, 0x0a, 0x0b,
376 0x0c, 0x0d, 0x10, 0x11,
377 };
378
379 static hda_nid_t stac922x_pin_nids[10] = {
380 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
381 0x0f, 0x10, 0x11, 0x15, 0x1b,
382 };
383
384 static hda_nid_t stac92hd73xx_pin_nids[13] = {
385 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
386 0x0f, 0x10, 0x11, 0x12, 0x13,
387 0x14, 0x1e, 0x22
388 };
389
390 static hda_nid_t stac92hd83xxx_pin_nids[14] = {
391 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
392 0x0f, 0x10, 0x11, 0x12, 0x13,
393 0x1d, 0x1e, 0x1f, 0x20
394 };
395 static hda_nid_t stac92hd71bxx_pin_nids[10] = {
396 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
397 0x0f, 0x14, 0x18, 0x19, 0x1e,
398 };
399
400 static hda_nid_t stac927x_pin_nids[14] = {
401 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
402 0x0f, 0x10, 0x11, 0x12, 0x13,
403 0x14, 0x21, 0x22, 0x23,
404 };
405
406 static hda_nid_t stac9205_pin_nids[12] = {
407 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
408 0x0f, 0x14, 0x16, 0x17, 0x18,
409 0x21, 0x22,
410 };
411
412 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
413 struct snd_ctl_elem_info *uinfo)
414 {
415 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
416 struct sigmatel_spec *spec = codec->spec;
417 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
418 }
419
420 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol)
422 {
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct sigmatel_spec *spec = codec->spec;
425 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
426
427 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
428 return 0;
429 }
430
431 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
432 struct snd_ctl_elem_value *ucontrol)
433 {
434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
435 struct sigmatel_spec *spec = codec->spec;
436 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
437
438 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
439 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
440 }
441
442 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
443 {
444 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
445 struct sigmatel_spec *spec = codec->spec;
446 return snd_hda_input_mux_info(spec->input_mux, uinfo);
447 }
448
449 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
450 {
451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
452 struct sigmatel_spec *spec = codec->spec;
453 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
454
455 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
456 return 0;
457 }
458
459 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
460 {
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct sigmatel_spec *spec = codec->spec;
463 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
464
465 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
466 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
467 }
468
469 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
470 struct snd_ctl_elem_info *uinfo)
471 {
472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
473 struct sigmatel_spec *spec = codec->spec;
474 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
475 }
476
477 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
479 {
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct sigmatel_spec *spec = codec->spec;
482
483 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
484 return 0;
485 }
486
487 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
489 {
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct sigmatel_spec *spec = codec->spec;
492
493 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
494 spec->mono_nid, &spec->cur_mmux);
495 }
496
497 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
498
499 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
500 struct snd_ctl_elem_value *ucontrol)
501 {
502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
503 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
504 struct sigmatel_spec *spec = codec->spec;
505
506 ucontrol->value.integer.value[0] = !!(spec->aloopback &
507 (spec->aloopback_mask << idx));
508 return 0;
509 }
510
511 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
512 struct snd_ctl_elem_value *ucontrol)
513 {
514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
515 struct sigmatel_spec *spec = codec->spec;
516 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
517 unsigned int dac_mode;
518 unsigned int val, idx_val;
519
520 idx_val = spec->aloopback_mask << idx;
521 if (ucontrol->value.integer.value[0])
522 val = spec->aloopback | idx_val;
523 else
524 val = spec->aloopback & ~idx_val;
525 if (spec->aloopback == val)
526 return 0;
527
528 spec->aloopback = val;
529
530 /* Only return the bits defined by the shift value of the
531 * first two bytes of the mask
532 */
533 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
534 kcontrol->private_value & 0xFFFF, 0x0);
535 dac_mode >>= spec->aloopback_shift;
536
537 if (spec->aloopback & idx_val) {
538 snd_hda_power_up(codec);
539 dac_mode |= idx_val;
540 } else {
541 snd_hda_power_down(codec);
542 dac_mode &= ~idx_val;
543 }
544
545 snd_hda_codec_write_cache(codec, codec->afg, 0,
546 kcontrol->private_value >> 16, dac_mode);
547
548 return 1;
549 }
550
551 static struct hda_verb stac9200_core_init[] = {
552 /* set dac0mux for dac converter */
553 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
554 {}
555 };
556
557 static struct hda_verb stac9200_eapd_init[] = {
558 /* set dac0mux for dac converter */
559 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
560 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
561 {}
562 };
563
564 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
565 /* set master volume and direct control */
566 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
567 /* setup audio connections */
568 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
569 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
570 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
571 /* setup adcs to point to mixer */
572 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
573 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
574 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
575 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
576 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
577 /* setup import muxs */
578 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
579 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
580 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
581 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
582 {}
583 };
584
585 static struct hda_verb dell_eq_core_init[] = {
586 /* set master volume to max value without distortion
587 * and direct control */
588 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
589 /* setup audio connections */
590 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
591 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
592 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
593 /* setup adcs to point to mixer */
594 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
595 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
596 /* setup import muxs */
597 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
598 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
599 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
600 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
601 {}
602 };
603
604 static struct hda_verb dell_m6_core_init[] = {
605 /* set master volume to max value without distortion
606 * and direct control */
607 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
608 /* setup audio connections */
609 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
610 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
611 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
612 /* setup adcs to point to mixer */
613 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
614 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
615 /* setup import muxs */
616 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
617 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
618 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
619 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
620 {}
621 };
622
623 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
624 /* set master volume and direct control */
625 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
626 /* setup audio connections */
627 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
628 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
629 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
630 /* connect hp ports to dac3 */
631 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
632 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
633 /* setup adcs to point to mixer */
634 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
635 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
636 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
637 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
638 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
639 /* setup import muxs */
640 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
641 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
642 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
643 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
644 {}
645 };
646
647 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
648 /* set master volume and direct control */
649 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
650 /* setup audio connections */
651 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
652 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
653 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
654 /* dac3 is connected to import3 mux */
655 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
656 /* connect hp ports to dac4 */
657 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
658 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
659 /* setup adcs to point to mixer */
660 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
661 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
662 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
663 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
664 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
665 /* setup import muxs */
666 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
667 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
668 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
669 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
670 {}
671 };
672
673 static struct hda_verb stac92hd83xxx_core_init[] = {
674 /* start of config #1 */
675 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
676
677 /* start of config #2 */
678 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
679 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
680 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
681
682 /* power state controls amps */
683 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
684 };
685
686 static struct hda_verb stac92hd71bxx_core_init[] = {
687 /* set master volume and direct control */
688 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
689 /* connect headphone jack to dac1 */
690 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
691 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
692 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
693 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
695 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
696 };
697
698 #define HD_DISABLE_PORTF 3
699 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
700 /* start of config #1 */
701
702 /* connect port 0f to audio mixer */
703 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
704 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
705 /* unmute right and left channels for node 0x0f */
706 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
707 /* start of config #2 */
708
709 /* set master volume and direct control */
710 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
711 /* connect headphone jack to dac1 */
712 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
713 /* connect port 0d to audio mixer */
714 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
715 /* unmute dac0 input in audio mixer */
716 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
717 /* unmute right and left channels for nodes 0x0a, 0xd */
718 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
719 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
720 {}
721 };
722
723 static struct hda_verb stac925x_core_init[] = {
724 /* set dac0mux for dac converter */
725 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
726 {}
727 };
728
729 static struct hda_verb stac922x_core_init[] = {
730 /* set master volume and direct control */
731 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
732 {}
733 };
734
735 static struct hda_verb d965_core_init[] = {
736 /* set master volume and direct control */
737 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
738 /* unmute node 0x1b */
739 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
740 /* select node 0x03 as DAC */
741 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
742 {}
743 };
744
745 static struct hda_verb stac927x_core_init[] = {
746 /* set master volume and direct control */
747 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
748 /* enable analog pc beep path */
749 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
750 {}
751 };
752
753 static struct hda_verb stac9205_core_init[] = {
754 /* set master volume and direct control */
755 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
756 /* enable analog pc beep path */
757 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
758 {}
759 };
760
761 #define STAC_MONO_MUX \
762 { \
763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
764 .name = "Mono Mux", \
765 .count = 1, \
766 .info = stac92xx_mono_mux_enum_info, \
767 .get = stac92xx_mono_mux_enum_get, \
768 .put = stac92xx_mono_mux_enum_put, \
769 }
770
771 #define STAC_INPUT_SOURCE(cnt) \
772 { \
773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
774 .name = "Input Source", \
775 .count = cnt, \
776 .info = stac92xx_mux_enum_info, \
777 .get = stac92xx_mux_enum_get, \
778 .put = stac92xx_mux_enum_put, \
779 }
780
781 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
782 { \
783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
784 .name = "Analog Loopback", \
785 .count = cnt, \
786 .info = stac92xx_aloopback_info, \
787 .get = stac92xx_aloopback_get, \
788 .put = stac92xx_aloopback_put, \
789 .private_value = verb_read | (verb_write << 16), \
790 }
791
792 static struct snd_kcontrol_new stac9200_mixer[] = {
793 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
794 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
795 STAC_INPUT_SOURCE(1),
796 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
797 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
798 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
799 { } /* end */
800 };
801
802 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
803 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
804
805 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
806 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
807
808 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
809 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
810
811 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
812 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
813
814 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
815 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
816
817 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
818 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
819
820 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
821 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
822
823 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
824 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
825 { } /* end */
826 };
827
828 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
829 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
830
831 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
832 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
833
834 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
835 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
836
837 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
838 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
839
840 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
841 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
842
843 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
844 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
845
846 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
847 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
848
849 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
850 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
851 { } /* end */
852 };
853
854 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
855 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
856
857 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
858 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
859
860 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
861 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
862
863 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
864 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
865
866 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
867 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
868
869 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
870 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
871
872 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
873 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
874
875 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
876 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
877 { } /* end */
878 };
879
880
881 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
882 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
883 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
884
885 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
886 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
887
888 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT),
889 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT),
890
891 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT),
892 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT),
893
894 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT),
895 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT),
896
897 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT),
898 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT),
899
900 /*
901 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
902 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
903 */
904 { } /* end */
905 };
906
907 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
908 STAC_INPUT_SOURCE(2),
909
910 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
911 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
912 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
913
914 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
915 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
916 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
917
918 /* analog pc-beep replaced with digital beep support */
919 /*
920 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
921 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
922 */
923
924 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
925 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
926 { } /* end */
927 };
928
929 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
930 STAC_INPUT_SOURCE(2),
931 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
932
933 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
934 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
935 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
936
937 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
938 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
939 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
940 { } /* end */
941 };
942
943 static struct snd_kcontrol_new stac925x_mixer[] = {
944 STAC_INPUT_SOURCE(1),
945 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
946 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
947 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
948 { } /* end */
949 };
950
951 static struct snd_kcontrol_new stac9205_mixer[] = {
952 STAC_INPUT_SOURCE(2),
953 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
954
955 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
956 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
957 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
958
959 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
960 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
961 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
962
963 { } /* end */
964 };
965
966 /* This needs to be generated dynamically based on sequence */
967 static struct snd_kcontrol_new stac922x_mixer[] = {
968 STAC_INPUT_SOURCE(2),
969 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
970 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
971 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
972
973 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
974 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
975 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
976 { } /* end */
977 };
978
979
980 static struct snd_kcontrol_new stac927x_mixer[] = {
981 STAC_INPUT_SOURCE(3),
982 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
983
984 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
985 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
986 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
987
988 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
989 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
990 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
991
992 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
993 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
994 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
995 { } /* end */
996 };
997
998 static struct snd_kcontrol_new stac_dmux_mixer = {
999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1000 .name = "Digital Input Source",
1001 /* count set later */
1002 .info = stac92xx_dmux_enum_info,
1003 .get = stac92xx_dmux_enum_get,
1004 .put = stac92xx_dmux_enum_put,
1005 };
1006
1007 static const char *slave_vols[] = {
1008 "Front Playback Volume",
1009 "Surround Playback Volume",
1010 "Center Playback Volume",
1011 "LFE Playback Volume",
1012 "Side Playback Volume",
1013 "Headphone Playback Volume",
1014 "Headphone Playback Volume",
1015 "Speaker Playback Volume",
1016 "External Speaker Playback Volume",
1017 "Speaker2 Playback Volume",
1018 NULL
1019 };
1020
1021 static const char *slave_sws[] = {
1022 "Front Playback Switch",
1023 "Surround Playback Switch",
1024 "Center Playback Switch",
1025 "LFE Playback Switch",
1026 "Side Playback Switch",
1027 "Headphone Playback Switch",
1028 "Headphone Playback Switch",
1029 "Speaker Playback Switch",
1030 "External Speaker Playback Switch",
1031 "Speaker2 Playback Switch",
1032 "IEC958 Playback Switch",
1033 NULL
1034 };
1035
1036 static int stac92xx_build_controls(struct hda_codec *codec)
1037 {
1038 struct sigmatel_spec *spec = codec->spec;
1039 int err;
1040 int i;
1041
1042 err = snd_hda_add_new_ctls(codec, spec->mixer);
1043 if (err < 0)
1044 return err;
1045
1046 for (i = 0; i < spec->num_mixers; i++) {
1047 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1048 if (err < 0)
1049 return err;
1050 }
1051 if (spec->num_dmuxes > 0) {
1052 stac_dmux_mixer.count = spec->num_dmuxes;
1053 err = snd_ctl_add(codec->bus->card,
1054 snd_ctl_new1(&stac_dmux_mixer, codec));
1055 if (err < 0)
1056 return err;
1057 }
1058
1059 if (spec->multiout.dig_out_nid) {
1060 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1061 if (err < 0)
1062 return err;
1063 err = snd_hda_create_spdif_share_sw(codec,
1064 &spec->multiout);
1065 if (err < 0)
1066 return err;
1067 spec->multiout.share_spdif = 1;
1068 }
1069 if (spec->dig_in_nid) {
1070 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1071 if (err < 0)
1072 return err;
1073 }
1074
1075 /* if we have no master control, let's create it */
1076 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1077 unsigned int vmaster_tlv[4];
1078 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1079 HDA_OUTPUT, vmaster_tlv);
1080 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1081 vmaster_tlv, slave_vols);
1082 if (err < 0)
1083 return err;
1084 }
1085 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1086 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1087 NULL, slave_sws);
1088 if (err < 0)
1089 return err;
1090 }
1091
1092 return 0;
1093 }
1094
1095 static unsigned int ref9200_pin_configs[8] = {
1096 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1097 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1098 };
1099
1100 /*
1101 STAC 9200 pin configs for
1102 102801A8
1103 102801DE
1104 102801E8
1105 */
1106 static unsigned int dell9200_d21_pin_configs[8] = {
1107 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1108 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1109 };
1110
1111 /*
1112 STAC 9200 pin configs for
1113 102801C0
1114 102801C1
1115 */
1116 static unsigned int dell9200_d22_pin_configs[8] = {
1117 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1118 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1119 };
1120
1121 /*
1122 STAC 9200 pin configs for
1123 102801C4 (Dell Dimension E310)
1124 102801C5
1125 102801C7
1126 102801D9
1127 102801DA
1128 102801E3
1129 */
1130 static unsigned int dell9200_d23_pin_configs[8] = {
1131 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1132 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1133 };
1134
1135
1136 /*
1137 STAC 9200-32 pin configs for
1138 102801B5 (Dell Inspiron 630m)
1139 102801D8 (Dell Inspiron 640m)
1140 */
1141 static unsigned int dell9200_m21_pin_configs[8] = {
1142 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1143 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1144 };
1145
1146 /*
1147 STAC 9200-32 pin configs for
1148 102801C2 (Dell Latitude D620)
1149 102801C8
1150 102801CC (Dell Latitude D820)
1151 102801D4
1152 102801D6
1153 */
1154 static unsigned int dell9200_m22_pin_configs[8] = {
1155 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1156 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1157 };
1158
1159 /*
1160 STAC 9200-32 pin configs for
1161 102801CE (Dell XPS M1710)
1162 102801CF (Dell Precision M90)
1163 */
1164 static unsigned int dell9200_m23_pin_configs[8] = {
1165 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1166 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1167 };
1168
1169 /*
1170 STAC 9200-32 pin configs for
1171 102801C9
1172 102801CA
1173 102801CB (Dell Latitude 120L)
1174 102801D3
1175 */
1176 static unsigned int dell9200_m24_pin_configs[8] = {
1177 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1178 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1179 };
1180
1181 /*
1182 STAC 9200-32 pin configs for
1183 102801BD (Dell Inspiron E1505n)
1184 102801EE
1185 102801EF
1186 */
1187 static unsigned int dell9200_m25_pin_configs[8] = {
1188 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1189 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1190 };
1191
1192 /*
1193 STAC 9200-32 pin configs for
1194 102801F5 (Dell Inspiron 1501)
1195 102801F6
1196 */
1197 static unsigned int dell9200_m26_pin_configs[8] = {
1198 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1199 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1200 };
1201
1202 /*
1203 STAC 9200-32
1204 102801CD (Dell Inspiron E1705/9400)
1205 */
1206 static unsigned int dell9200_m27_pin_configs[8] = {
1207 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1208 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1209 };
1210
1211 static unsigned int oqo9200_pin_configs[8] = {
1212 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1213 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1214 };
1215
1216
1217 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1218 [STAC_REF] = ref9200_pin_configs,
1219 [STAC_9200_OQO] = oqo9200_pin_configs,
1220 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1221 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1222 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1223 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1224 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1225 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1226 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1227 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1228 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1229 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1230 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1231 };
1232
1233 static const char *stac9200_models[STAC_9200_MODELS] = {
1234 [STAC_REF] = "ref",
1235 [STAC_9200_OQO] = "oqo",
1236 [STAC_9200_DELL_D21] = "dell-d21",
1237 [STAC_9200_DELL_D22] = "dell-d22",
1238 [STAC_9200_DELL_D23] = "dell-d23",
1239 [STAC_9200_DELL_M21] = "dell-m21",
1240 [STAC_9200_DELL_M22] = "dell-m22",
1241 [STAC_9200_DELL_M23] = "dell-m23",
1242 [STAC_9200_DELL_M24] = "dell-m24",
1243 [STAC_9200_DELL_M25] = "dell-m25",
1244 [STAC_9200_DELL_M26] = "dell-m26",
1245 [STAC_9200_DELL_M27] = "dell-m27",
1246 [STAC_9200_GATEWAY] = "gateway",
1247 [STAC_9200_PANASONIC] = "panasonic",
1248 };
1249
1250 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1251 /* SigmaTel reference board */
1252 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1253 "DFI LanParty", STAC_REF),
1254 /* Dell laptops have BIOS problem */
1255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1256 "unknown Dell", STAC_9200_DELL_D21),
1257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1258 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1260 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1262 "unknown Dell", STAC_9200_DELL_D22),
1263 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1264 "unknown Dell", STAC_9200_DELL_D22),
1265 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1266 "Dell Latitude D620", STAC_9200_DELL_M22),
1267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1268 "unknown Dell", STAC_9200_DELL_D23),
1269 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1270 "unknown Dell", STAC_9200_DELL_D23),
1271 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1272 "unknown Dell", STAC_9200_DELL_M22),
1273 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1274 "unknown Dell", STAC_9200_DELL_M24),
1275 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1276 "unknown Dell", STAC_9200_DELL_M24),
1277 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1278 "Dell Latitude 120L", STAC_9200_DELL_M24),
1279 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1280 "Dell Latitude D820", STAC_9200_DELL_M22),
1281 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1282 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1283 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1284 "Dell XPS M1710", STAC_9200_DELL_M23),
1285 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1286 "Dell Precision M90", STAC_9200_DELL_M23),
1287 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1288 "unknown Dell", STAC_9200_DELL_M22),
1289 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1290 "unknown Dell", STAC_9200_DELL_M22),
1291 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1292 "unknown Dell", STAC_9200_DELL_M22),
1293 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1294 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1295 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1296 "unknown Dell", STAC_9200_DELL_D23),
1297 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1298 "unknown Dell", STAC_9200_DELL_D23),
1299 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1300 "unknown Dell", STAC_9200_DELL_D21),
1301 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1302 "unknown Dell", STAC_9200_DELL_D23),
1303 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1304 "unknown Dell", STAC_9200_DELL_D21),
1305 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1306 "unknown Dell", STAC_9200_DELL_M25),
1307 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1308 "unknown Dell", STAC_9200_DELL_M25),
1309 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1310 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1311 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1312 "unknown Dell", STAC_9200_DELL_M26),
1313 /* Panasonic */
1314 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1315 /* Gateway machines needs EAPD to be set on resume */
1316 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1317 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1318 STAC_9200_GATEWAY),
1319 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1320 STAC_9200_GATEWAY),
1321 /* OQO Mobile */
1322 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1323 {} /* terminator */
1324 };
1325
1326 static unsigned int ref925x_pin_configs[8] = {
1327 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1328 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1329 };
1330
1331 static unsigned int stac925x_MA6_pin_configs[8] = {
1332 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1333 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1334 };
1335
1336 static unsigned int stac925x_PA6_pin_configs[8] = {
1337 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1338 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1339 };
1340
1341 static unsigned int stac925xM2_2_pin_configs[8] = {
1342 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1343 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1344 };
1345
1346 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1347 [STAC_REF] = ref925x_pin_configs,
1348 [STAC_M2_2] = stac925xM2_2_pin_configs,
1349 [STAC_MA6] = stac925x_MA6_pin_configs,
1350 [STAC_PA6] = stac925x_PA6_pin_configs,
1351 };
1352
1353 static const char *stac925x_models[STAC_925x_MODELS] = {
1354 [STAC_REF] = "ref",
1355 [STAC_M2_2] = "m2-2",
1356 [STAC_MA6] = "m6",
1357 [STAC_PA6] = "pa6",
1358 };
1359
1360 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1361 /* SigmaTel reference board */
1362 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1363 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1364 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1365 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1366 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1367 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1368 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1369 {} /* terminator */
1370 };
1371
1372 static unsigned int ref92hd73xx_pin_configs[13] = {
1373 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1374 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1375 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1376 0x01452050,
1377 };
1378
1379 static unsigned int dell_m6_pin_configs[13] = {
1380 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1381 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1382 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1383 0x4f0000f0,
1384 };
1385
1386 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1387 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1388 [STAC_DELL_M6] = dell_m6_pin_configs,
1389 };
1390
1391 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1392 [STAC_92HD73XX_REF] = "ref",
1393 [STAC_DELL_M6] = "dell-m6",
1394 };
1395
1396 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1397 /* SigmaTel reference board */
1398 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1399 "DFI LanParty", STAC_92HD73XX_REF),
1400 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1401 "unknown Dell", STAC_DELL_M6),
1402 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1403 "unknown Dell", STAC_DELL_M6),
1404 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1405 "unknown Dell", STAC_DELL_M6),
1406 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1407 "unknown Dell", STAC_DELL_M6),
1408 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1409 "unknown Dell", STAC_DELL_M6),
1410 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1411 "unknown Dell", STAC_DELL_M6),
1412 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1413 "unknown Dell", STAC_DELL_M6),
1414 {} /* terminator */
1415 };
1416
1417 static unsigned int ref92hd83xxx_pin_configs[14] = {
1418 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1419 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1420 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1421 0x01451160, 0x98560170,
1422 };
1423
1424 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1425 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1426 };
1427
1428 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1429 [STAC_92HD83XXX_REF] = "ref",
1430 };
1431
1432 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1433 /* SigmaTel reference board */
1434 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1435 "DFI LanParty", STAC_92HD71BXX_REF),
1436 };
1437
1438 static unsigned int ref92hd71bxx_pin_configs[10] = {
1439 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1440 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1441 0x90a000f0, 0x01452050,
1442 };
1443
1444 static unsigned int dell_m4_1_pin_configs[10] = {
1445 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1446 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1447 0x40f000f0, 0x4f0000f0,
1448 };
1449
1450 static unsigned int dell_m4_2_pin_configs[10] = {
1451 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1452 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1453 0x40f000f0, 0x044413b0,
1454 };
1455
1456 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1457 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1458 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1459 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1460 };
1461
1462 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1463 [STAC_92HD71BXX_REF] = "ref",
1464 [STAC_DELL_M4_1] = "dell-m4-1",
1465 [STAC_DELL_M4_2] = "dell-m4-2",
1466 };
1467
1468 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1469 /* SigmaTel reference board */
1470 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1471 "DFI LanParty", STAC_92HD71BXX_REF),
1472 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1473 "unknown Dell", STAC_DELL_M4_1),
1474 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1475 "unknown Dell", STAC_DELL_M4_1),
1476 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1477 "unknown Dell", STAC_DELL_M4_1),
1478 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1479 "unknown Dell", STAC_DELL_M4_1),
1480 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1481 "unknown Dell", STAC_DELL_M4_1),
1482 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1483 "unknown Dell", STAC_DELL_M4_1),
1484 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1485 "unknown Dell", STAC_DELL_M4_1),
1486 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1487 "unknown Dell", STAC_DELL_M4_2),
1488 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1489 "unknown Dell", STAC_DELL_M4_2),
1490 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1491 "unknown Dell", STAC_DELL_M4_2),
1492 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1493 "unknown Dell", STAC_DELL_M4_2),
1494 {} /* terminator */
1495 };
1496
1497 static unsigned int ref922x_pin_configs[10] = {
1498 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1499 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1500 0x40000100, 0x40000100,
1501 };
1502
1503 /*
1504 STAC 922X pin configs for
1505 102801A7
1506 102801AB
1507 102801A9
1508 102801D1
1509 102801D2
1510 */
1511 static unsigned int dell_922x_d81_pin_configs[10] = {
1512 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1513 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1514 0x01813122, 0x400001f2,
1515 };
1516
1517 /*
1518 STAC 922X pin configs for
1519 102801AC
1520 102801D0
1521 */
1522 static unsigned int dell_922x_d82_pin_configs[10] = {
1523 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1524 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1525 0x01813122, 0x400001f1,
1526 };
1527
1528 /*
1529 STAC 922X pin configs for
1530 102801BF
1531 */
1532 static unsigned int dell_922x_m81_pin_configs[10] = {
1533 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1534 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1535 0x40C003f1, 0x405003f0,
1536 };
1537
1538 /*
1539 STAC 9221 A1 pin configs for
1540 102801D7 (Dell XPS M1210)
1541 */
1542 static unsigned int dell_922x_m82_pin_configs[10] = {
1543 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1544 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1545 0x508003f3, 0x405003f4,
1546 };
1547
1548 static unsigned int d945gtp3_pin_configs[10] = {
1549 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1550 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1551 0x02a19120, 0x40000100,
1552 };
1553
1554 static unsigned int d945gtp5_pin_configs[10] = {
1555 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1556 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1557 0x02a19320, 0x40000100,
1558 };
1559
1560 static unsigned int intel_mac_v1_pin_configs[10] = {
1561 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1562 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1563 0x400000fc, 0x400000fb,
1564 };
1565
1566 static unsigned int intel_mac_v2_pin_configs[10] = {
1567 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1568 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1569 0x400000fc, 0x400000fb,
1570 };
1571
1572 static unsigned int intel_mac_v3_pin_configs[10] = {
1573 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1574 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1575 0x400000fc, 0x400000fb,
1576 };
1577
1578 static unsigned int intel_mac_v4_pin_configs[10] = {
1579 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1580 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1581 0x400000fc, 0x400000fb,
1582 };
1583
1584 static unsigned int intel_mac_v5_pin_configs[10] = {
1585 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1586 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1587 0x400000fc, 0x400000fb,
1588 };
1589
1590 static unsigned int ecs202_pin_configs[10] = {
1591 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1592 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1593 0x9037012e, 0x40e000f2,
1594 };
1595
1596 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1597 [STAC_D945_REF] = ref922x_pin_configs,
1598 [STAC_D945GTP3] = d945gtp3_pin_configs,
1599 [STAC_D945GTP5] = d945gtp5_pin_configs,
1600 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1601 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1602 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1603 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1604 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1605 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1606 /* for backward compatibility */
1607 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1608 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1609 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1610 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1611 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1612 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1613 [STAC_ECS_202] = ecs202_pin_configs,
1614 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1615 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1616 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1617 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1618 };
1619
1620 static const char *stac922x_models[STAC_922X_MODELS] = {
1621 [STAC_D945_REF] = "ref",
1622 [STAC_D945GTP5] = "5stack",
1623 [STAC_D945GTP3] = "3stack",
1624 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1625 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1626 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1627 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1628 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1629 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1630 /* for backward compatibility */
1631 [STAC_MACMINI] = "macmini",
1632 [STAC_MACBOOK] = "macbook",
1633 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1634 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1635 [STAC_IMAC_INTEL] = "imac-intel",
1636 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1637 [STAC_ECS_202] = "ecs202",
1638 [STAC_922X_DELL_D81] = "dell-d81",
1639 [STAC_922X_DELL_D82] = "dell-d82",
1640 [STAC_922X_DELL_M81] = "dell-m81",
1641 [STAC_922X_DELL_M82] = "dell-m82",
1642 };
1643
1644 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1645 /* SigmaTel reference board */
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1647 "DFI LanParty", STAC_D945_REF),
1648 /* Intel 945G based systems */
1649 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1650 "Intel D945G", STAC_D945GTP3),
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1652 "Intel D945G", STAC_D945GTP3),
1653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1654 "Intel D945G", STAC_D945GTP3),
1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1656 "Intel D945G", STAC_D945GTP3),
1657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1658 "Intel D945G", STAC_D945GTP3),
1659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1660 "Intel D945G", STAC_D945GTP3),
1661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1662 "Intel D945G", STAC_D945GTP3),
1663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1664 "Intel D945G", STAC_D945GTP3),
1665 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1666 "Intel D945G", STAC_D945GTP3),
1667 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1668 "Intel D945G", STAC_D945GTP3),
1669 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1670 "Intel D945G", STAC_D945GTP3),
1671 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1672 "Intel D945G", STAC_D945GTP3),
1673 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1674 "Intel D945G", STAC_D945GTP3),
1675 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1676 "Intel D945G", STAC_D945GTP3),
1677 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1678 "Intel D945G", STAC_D945GTP3),
1679 /* Intel D945G 5-stack systems */
1680 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1681 "Intel D945G", STAC_D945GTP5),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1683 "Intel D945G", STAC_D945GTP5),
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1685 "Intel D945G", STAC_D945GTP5),
1686 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1687 "Intel D945G", STAC_D945GTP5),
1688 /* Intel 945P based systems */
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1690 "Intel D945P", STAC_D945GTP3),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1692 "Intel D945P", STAC_D945GTP3),
1693 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1694 "Intel D945P", STAC_D945GTP3),
1695 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1696 "Intel D945P", STAC_D945GTP3),
1697 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1698 "Intel D945P", STAC_D945GTP3),
1699 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
1700 "Intel D945P", STAC_D945GTP5),
1701 /* other systems */
1702 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1703 SND_PCI_QUIRK(0x8384, 0x7680,
1704 "Mac", STAC_INTEL_MAC_AUTO),
1705 /* Dell systems */
1706 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
1707 "unknown Dell", STAC_922X_DELL_D81),
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
1709 "unknown Dell", STAC_922X_DELL_D81),
1710 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
1711 "unknown Dell", STAC_922X_DELL_D81),
1712 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
1713 "unknown Dell", STAC_922X_DELL_D82),
1714 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
1715 "unknown Dell", STAC_922X_DELL_M81),
1716 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1717 "unknown Dell", STAC_922X_DELL_D82),
1718 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1719 "unknown Dell", STAC_922X_DELL_D81),
1720 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1721 "unknown Dell", STAC_922X_DELL_D81),
1722 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1723 "Dell XPS M1210", STAC_922X_DELL_M82),
1724 /* ECS/PC Chips boards */
1725 SND_PCI_QUIRK(0x1019, 0x2144,
1726 "ECS/PC chips", STAC_ECS_202),
1727 SND_PCI_QUIRK(0x1019, 0x2608,
1728 "ECS/PC chips", STAC_ECS_202),
1729 SND_PCI_QUIRK(0x1019, 0x2633,
1730 "ECS/PC chips P17G/1333", STAC_ECS_202),
1731 SND_PCI_QUIRK(0x1019, 0x2811,
1732 "ECS/PC chips", STAC_ECS_202),
1733 SND_PCI_QUIRK(0x1019, 0x2812,
1734 "ECS/PC chips", STAC_ECS_202),
1735 SND_PCI_QUIRK(0x1019, 0x2813,
1736 "ECS/PC chips", STAC_ECS_202),
1737 SND_PCI_QUIRK(0x1019, 0x2814,
1738 "ECS/PC chips", STAC_ECS_202),
1739 SND_PCI_QUIRK(0x1019, 0x2815,
1740 "ECS/PC chips", STAC_ECS_202),
1741 SND_PCI_QUIRK(0x1019, 0x2816,
1742 "ECS/PC chips", STAC_ECS_202),
1743 SND_PCI_QUIRK(0x1019, 0x2817,
1744 "ECS/PC chips", STAC_ECS_202),
1745 SND_PCI_QUIRK(0x1019, 0x2818,
1746 "ECS/PC chips", STAC_ECS_202),
1747 SND_PCI_QUIRK(0x1019, 0x2819,
1748 "ECS/PC chips", STAC_ECS_202),
1749 SND_PCI_QUIRK(0x1019, 0x2820,
1750 "ECS/PC chips", STAC_ECS_202),
1751 {} /* terminator */
1752 };
1753
1754 static unsigned int ref927x_pin_configs[14] = {
1755 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1756 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1757 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1758 0x01c42190, 0x40000100,
1759 };
1760
1761 static unsigned int d965_3st_pin_configs[14] = {
1762 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1763 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1764 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1765 0x40000100, 0x40000100
1766 };
1767
1768 static unsigned int d965_5st_pin_configs[14] = {
1769 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1770 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1771 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1772 0x40000100, 0x40000100
1773 };
1774
1775 static unsigned int dell_3st_pin_configs[14] = {
1776 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1777 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1778 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1779 0x40c003fc, 0x40000100
1780 };
1781
1782 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1783 [STAC_D965_REF] = ref927x_pin_configs,
1784 [STAC_D965_3ST] = d965_3st_pin_configs,
1785 [STAC_D965_5ST] = d965_5st_pin_configs,
1786 [STAC_DELL_3ST] = dell_3st_pin_configs,
1787 [STAC_DELL_BIOS] = NULL,
1788 };
1789
1790 static const char *stac927x_models[STAC_927X_MODELS] = {
1791 [STAC_D965_REF] = "ref",
1792 [STAC_D965_3ST] = "3stack",
1793 [STAC_D965_5ST] = "5stack",
1794 [STAC_DELL_3ST] = "dell-3stack",
1795 [STAC_DELL_BIOS] = "dell-bios",
1796 };
1797
1798 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1799 /* SigmaTel reference board */
1800 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1801 "DFI LanParty", STAC_D965_REF),
1802 /* Intel 946 based systems */
1803 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1805 /* 965 based 3 stack systems */
1806 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1807 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1808 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1809 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1810 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1811 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1812 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1813 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1814 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1815 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1816 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1817 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1818 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1819 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1820 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1821 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1822 /* Dell 3 stack systems */
1823 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
1824 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1825 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1826 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1827 /* Dell 3 stack systems with verb table in BIOS */
1828 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1829 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1830 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1831 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
1832 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1833 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1834 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
1835 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
1836 /* 965 based 5 stack systems */
1837 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1838 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1839 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1840 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1841 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1842 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1843 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1844 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1845 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1846 {} /* terminator */
1847 };
1848
1849 static unsigned int ref9205_pin_configs[12] = {
1850 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1851 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1852 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1853 };
1854
1855 /*
1856 STAC 9205 pin configs for
1857 102801F1
1858 102801F2
1859 102801FC
1860 102801FD
1861 10280204
1862 1028021F
1863 10280228 (Dell Vostro 1500)
1864 */
1865 static unsigned int dell_9205_m42_pin_configs[12] = {
1866 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1867 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1868 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1869 };
1870
1871 /*
1872 STAC 9205 pin configs for
1873 102801F9
1874 102801FA
1875 102801FE
1876 102801FF (Dell Precision M4300)
1877 10280206
1878 10280200
1879 10280201
1880 */
1881 static unsigned int dell_9205_m43_pin_configs[12] = {
1882 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1883 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1884 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1885 };
1886
1887 static unsigned int dell_9205_m44_pin_configs[12] = {
1888 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1889 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1890 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1891 };
1892
1893 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1894 [STAC_9205_REF] = ref9205_pin_configs,
1895 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1896 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1897 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1898 };
1899
1900 static const char *stac9205_models[STAC_9205_MODELS] = {
1901 [STAC_9205_REF] = "ref",
1902 [STAC_9205_DELL_M42] = "dell-m42",
1903 [STAC_9205_DELL_M43] = "dell-m43",
1904 [STAC_9205_DELL_M44] = "dell-m44",
1905 };
1906
1907 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1908 /* SigmaTel reference board */
1909 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1910 "DFI LanParty", STAC_9205_REF),
1911 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1912 "unknown Dell", STAC_9205_DELL_M42),
1913 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1914 "unknown Dell", STAC_9205_DELL_M42),
1915 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1916 "Dell Precision", STAC_9205_DELL_M43),
1917 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1918 "Dell Precision", STAC_9205_DELL_M43),
1919 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1920 "Dell Precision", STAC_9205_DELL_M43),
1921 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1922 "unknown Dell", STAC_9205_DELL_M42),
1923 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1924 "unknown Dell", STAC_9205_DELL_M42),
1925 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1926 "Dell Precision", STAC_9205_DELL_M43),
1927 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1928 "Dell Precision M4300", STAC_9205_DELL_M43),
1929 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1930 "unknown Dell", STAC_9205_DELL_M42),
1931 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1932 "Dell Precision", STAC_9205_DELL_M43),
1933 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1934 "Dell Precision", STAC_9205_DELL_M43),
1935 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1936 "Dell Precision", STAC_9205_DELL_M43),
1937 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1938 "Dell Inspiron", STAC_9205_DELL_M44),
1939 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
1940 "Dell Vostro 1500", STAC_9205_DELL_M42),
1941 {} /* terminator */
1942 };
1943
1944 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
1945 {
1946 int i;
1947 struct sigmatel_spec *spec = codec->spec;
1948
1949 if (! spec->bios_pin_configs) {
1950 spec->bios_pin_configs = kcalloc(spec->num_pins,
1951 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
1952 if (! spec->bios_pin_configs)
1953 return -ENOMEM;
1954 }
1955
1956 for (i = 0; i < spec->num_pins; i++) {
1957 hda_nid_t nid = spec->pin_nids[i];
1958 unsigned int pin_cfg;
1959
1960 pin_cfg = snd_hda_codec_read(codec, nid, 0,
1961 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
1962 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1963 nid, pin_cfg);
1964 spec->bios_pin_configs[i] = pin_cfg;
1965 }
1966
1967 return 0;
1968 }
1969
1970 static void stac92xx_set_config_reg(struct hda_codec *codec,
1971 hda_nid_t pin_nid, unsigned int pin_config)
1972 {
1973 int i;
1974 snd_hda_codec_write(codec, pin_nid, 0,
1975 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
1976 pin_config & 0x000000ff);
1977 snd_hda_codec_write(codec, pin_nid, 0,
1978 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
1979 (pin_config & 0x0000ff00) >> 8);
1980 snd_hda_codec_write(codec, pin_nid, 0,
1981 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
1982 (pin_config & 0x00ff0000) >> 16);
1983 snd_hda_codec_write(codec, pin_nid, 0,
1984 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
1985 pin_config >> 24);
1986 i = snd_hda_codec_read(codec, pin_nid, 0,
1987 AC_VERB_GET_CONFIG_DEFAULT,
1988 0x00);
1989 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
1990 pin_nid, i);
1991 }
1992
1993 static void stac92xx_set_config_regs(struct hda_codec *codec)
1994 {
1995 int i;
1996 struct sigmatel_spec *spec = codec->spec;
1997
1998 if (!spec->pin_configs)
1999 return;
2000
2001 for (i = 0; i < spec->num_pins; i++)
2002 stac92xx_set_config_reg(codec, spec->pin_nids[i],
2003 spec->pin_configs[i]);
2004 }
2005
2006 /*
2007 * Analog playback callbacks
2008 */
2009 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2010 struct hda_codec *codec,
2011 struct snd_pcm_substream *substream)
2012 {
2013 struct sigmatel_spec *spec = codec->spec;
2014 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2015 hinfo);
2016 }
2017
2018 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2019 struct hda_codec *codec,
2020 unsigned int stream_tag,
2021 unsigned int format,
2022 struct snd_pcm_substream *substream)
2023 {
2024 struct sigmatel_spec *spec = codec->spec;
2025 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2026 }
2027
2028 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2029 struct hda_codec *codec,
2030 struct snd_pcm_substream *substream)
2031 {
2032 struct sigmatel_spec *spec = codec->spec;
2033 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2034 }
2035
2036 /*
2037 * Digital playback callbacks
2038 */
2039 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2040 struct hda_codec *codec,
2041 struct snd_pcm_substream *substream)
2042 {
2043 struct sigmatel_spec *spec = codec->spec;
2044 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2045 }
2046
2047 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2048 struct hda_codec *codec,
2049 struct snd_pcm_substream *substream)
2050 {
2051 struct sigmatel_spec *spec = codec->spec;
2052 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2053 }
2054
2055 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2056 struct hda_codec *codec,
2057 unsigned int stream_tag,
2058 unsigned int format,
2059 struct snd_pcm_substream *substream)
2060 {
2061 struct sigmatel_spec *spec = codec->spec;
2062 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2063 stream_tag, format, substream);
2064 }
2065
2066
2067 /*
2068 * Analog capture callbacks
2069 */
2070 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2071 struct hda_codec *codec,
2072 unsigned int stream_tag,
2073 unsigned int format,
2074 struct snd_pcm_substream *substream)
2075 {
2076 struct sigmatel_spec *spec = codec->spec;
2077
2078 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2079 stream_tag, 0, format);
2080 return 0;
2081 }
2082
2083 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2084 struct hda_codec *codec,
2085 struct snd_pcm_substream *substream)
2086 {
2087 struct sigmatel_spec *spec = codec->spec;
2088
2089 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
2090 return 0;
2091 }
2092
2093 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2094 .substreams = 1,
2095 .channels_min = 2,
2096 .channels_max = 2,
2097 /* NID is set in stac92xx_build_pcms */
2098 .ops = {
2099 .open = stac92xx_dig_playback_pcm_open,
2100 .close = stac92xx_dig_playback_pcm_close,
2101 .prepare = stac92xx_dig_playback_pcm_prepare
2102 },
2103 };
2104
2105 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2106 .substreams = 1,
2107 .channels_min = 2,
2108 .channels_max = 2,
2109 /* NID is set in stac92xx_build_pcms */
2110 };
2111
2112 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2113 .substreams = 1,
2114 .channels_min = 2,
2115 .channels_max = 8,
2116 .nid = 0x02, /* NID to query formats and rates */
2117 .ops = {
2118 .open = stac92xx_playback_pcm_open,
2119 .prepare = stac92xx_playback_pcm_prepare,
2120 .cleanup = stac92xx_playback_pcm_cleanup
2121 },
2122 };
2123
2124 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2125 .substreams = 1,
2126 .channels_min = 2,
2127 .channels_max = 2,
2128 .nid = 0x06, /* NID to query formats and rates */
2129 .ops = {
2130 .open = stac92xx_playback_pcm_open,
2131 .prepare = stac92xx_playback_pcm_prepare,
2132 .cleanup = stac92xx_playback_pcm_cleanup
2133 },
2134 };
2135
2136 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2137 .channels_min = 2,
2138 .channels_max = 2,
2139 /* NID + .substreams is set in stac92xx_build_pcms */
2140 .ops = {
2141 .prepare = stac92xx_capture_pcm_prepare,
2142 .cleanup = stac92xx_capture_pcm_cleanup
2143 },
2144 };
2145
2146 static int stac92xx_build_pcms(struct hda_codec *codec)
2147 {
2148 struct sigmatel_spec *spec = codec->spec;
2149 struct hda_pcm *info = spec->pcm_rec;
2150
2151 codec->num_pcms = 1;
2152 codec->pcm_info = info;
2153
2154 info->name = "STAC92xx Analog";
2155 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2156 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2157 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2158 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2159
2160 if (spec->alt_switch) {
2161 codec->num_pcms++;
2162 info++;
2163 info->name = "STAC92xx Analog Alt";
2164 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2165 }
2166
2167 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2168 codec->num_pcms++;
2169 info++;
2170 info->name = "STAC92xx Digital";
2171 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2172 if (spec->multiout.dig_out_nid) {
2173 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2174 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2175 }
2176 if (spec->dig_in_nid) {
2177 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2178 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2179 }
2180 }
2181
2182 return 0;
2183 }
2184
2185 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2186 {
2187 unsigned int pincap = snd_hda_param_read(codec, nid,
2188 AC_PAR_PIN_CAP);
2189 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2190 if (pincap & AC_PINCAP_VREF_100)
2191 return AC_PINCTL_VREF_100;
2192 if (pincap & AC_PINCAP_VREF_80)
2193 return AC_PINCTL_VREF_80;
2194 if (pincap & AC_PINCAP_VREF_50)
2195 return AC_PINCTL_VREF_50;
2196 if (pincap & AC_PINCAP_VREF_GRD)
2197 return AC_PINCTL_VREF_GRD;
2198 return 0;
2199 }
2200
2201 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2202
2203 {
2204 snd_hda_codec_write_cache(codec, nid, 0,
2205 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2206 }
2207
2208 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2209
2210 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2211 struct snd_ctl_elem_value *ucontrol)
2212 {
2213 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2214 struct sigmatel_spec *spec = codec->spec;
2215
2216 ucontrol->value.integer.value[0] = spec->hp_switch;
2217 return 0;
2218 }
2219
2220 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2221 struct snd_ctl_elem_value *ucontrol)
2222 {
2223 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2224 struct sigmatel_spec *spec = codec->spec;
2225
2226 spec->hp_switch = ucontrol->value.integer.value[0];
2227
2228 /* check to be sure that the ports are upto date with
2229 * switch changes
2230 */
2231 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2232
2233 return 1;
2234 }
2235
2236 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2237
2238 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2239 {
2240 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2241 struct sigmatel_spec *spec = codec->spec;
2242 int io_idx = kcontrol-> private_value & 0xff;
2243
2244 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2245 return 0;
2246 }
2247
2248 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2249 {
2250 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2251 struct sigmatel_spec *spec = codec->spec;
2252 hda_nid_t nid = kcontrol->private_value >> 8;
2253 int io_idx = kcontrol-> private_value & 0xff;
2254 unsigned short val = !!ucontrol->value.integer.value[0];
2255
2256 spec->io_switch[io_idx] = val;
2257
2258 if (val)
2259 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2260 else {
2261 unsigned int pinctl = AC_PINCTL_IN_EN;
2262 if (io_idx) /* set VREF for mic */
2263 pinctl |= stac92xx_get_vref(codec, nid);
2264 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2265 }
2266
2267 /* check the auto-mute again: we need to mute/unmute the speaker
2268 * appropriately according to the pin direction
2269 */
2270 if (spec->hp_detect)
2271 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2272
2273 return 1;
2274 }
2275
2276 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2277
2278 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2279 struct snd_ctl_elem_value *ucontrol)
2280 {
2281 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2282 struct sigmatel_spec *spec = codec->spec;
2283
2284 ucontrol->value.integer.value[0] = spec->clfe_swap;
2285 return 0;
2286 }
2287
2288 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2289 struct snd_ctl_elem_value *ucontrol)
2290 {
2291 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2292 struct sigmatel_spec *spec = codec->spec;
2293 hda_nid_t nid = kcontrol->private_value & 0xff;
2294 unsigned int val = !!ucontrol->value.integer.value[0];
2295
2296 if (spec->clfe_swap == val)
2297 return 0;
2298
2299 spec->clfe_swap = val;
2300
2301 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2302 spec->clfe_swap ? 0x4 : 0x0);
2303
2304 return 1;
2305 }
2306
2307 #define STAC_CODEC_HP_SWITCH(xname) \
2308 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2309 .name = xname, \
2310 .index = 0, \
2311 .info = stac92xx_hp_switch_info, \
2312 .get = stac92xx_hp_switch_get, \
2313 .put = stac92xx_hp_switch_put, \
2314 }
2315
2316 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2317 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2318 .name = xname, \
2319 .index = 0, \
2320 .info = stac92xx_io_switch_info, \
2321 .get = stac92xx_io_switch_get, \
2322 .put = stac92xx_io_switch_put, \
2323 .private_value = xpval, \
2324 }
2325
2326 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2327 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2328 .name = xname, \
2329 .index = 0, \
2330 .info = stac92xx_clfe_switch_info, \
2331 .get = stac92xx_clfe_switch_get, \
2332 .put = stac92xx_clfe_switch_put, \
2333 .private_value = xpval, \
2334 }
2335
2336 enum {
2337 STAC_CTL_WIDGET_VOL,
2338 STAC_CTL_WIDGET_MUTE,
2339 STAC_CTL_WIDGET_MONO_MUX,
2340 STAC_CTL_WIDGET_HP_SWITCH,
2341 STAC_CTL_WIDGET_IO_SWITCH,
2342 STAC_CTL_WIDGET_CLFE_SWITCH
2343 };
2344
2345 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2346 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2347 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2348 STAC_MONO_MUX,
2349 STAC_CODEC_HP_SWITCH(NULL),
2350 STAC_CODEC_IO_SWITCH(NULL, 0),
2351 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2352 };
2353
2354 /* add dynamic controls */
2355 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
2356 {
2357 struct snd_kcontrol_new *knew;
2358
2359 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2360 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2361
2362 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
2363 if (! knew)
2364 return -ENOMEM;
2365 if (spec->kctl_alloc) {
2366 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
2367 kfree(spec->kctl_alloc);
2368 }
2369 spec->kctl_alloc = knew;
2370 spec->num_kctl_alloc = num;
2371 }
2372
2373 knew = &spec->kctl_alloc[spec->num_kctl_used];
2374 *knew = stac92xx_control_templates[type];
2375 knew->name = kstrdup(name, GFP_KERNEL);
2376 if (! knew->name)
2377 return -ENOMEM;
2378 knew->private_value = val;
2379 spec->num_kctl_used++;
2380 return 0;
2381 }
2382
2383 /* flag inputs as additional dynamic lineouts */
2384 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2385 {
2386 struct sigmatel_spec *spec = codec->spec;
2387 unsigned int wcaps, wtype;
2388 int i, num_dacs = 0;
2389
2390 /* use the wcaps cache to count all DACs available for line-outs */
2391 for (i = 0; i < codec->num_nodes; i++) {
2392 wcaps = codec->wcaps[i];
2393 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2394
2395 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2396 num_dacs++;
2397 }
2398
2399 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2400
2401 switch (cfg->line_outs) {
2402 case 3:
2403 /* add line-in as side */
2404 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2405 cfg->line_out_pins[cfg->line_outs] =
2406 cfg->input_pins[AUTO_PIN_LINE];
2407 spec->line_switch = 1;
2408 cfg->line_outs++;
2409 }
2410 break;
2411 case 2:
2412 /* add line-in as clfe and mic as side */
2413 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2414 cfg->line_out_pins[cfg->line_outs] =
2415 cfg->input_pins[AUTO_PIN_LINE];
2416 spec->line_switch = 1;
2417 cfg->line_outs++;
2418 }
2419 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2420 cfg->line_out_pins[cfg->line_outs] =
2421 cfg->input_pins[AUTO_PIN_MIC];
2422 spec->mic_switch = 1;
2423 cfg->line_outs++;
2424 }
2425 break;
2426 case 1:
2427 /* add line-in as surr and mic as clfe */
2428 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2429 cfg->line_out_pins[cfg->line_outs] =
2430 cfg->input_pins[AUTO_PIN_LINE];
2431 spec->line_switch = 1;
2432 cfg->line_outs++;
2433 }
2434 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2435 cfg->line_out_pins[cfg->line_outs] =
2436 cfg->input_pins[AUTO_PIN_MIC];
2437 spec->mic_switch = 1;
2438 cfg->line_outs++;
2439 }
2440 break;
2441 }
2442
2443 return 0;
2444 }
2445
2446
2447 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2448 {
2449 int i;
2450
2451 for (i = 0; i < spec->multiout.num_dacs; i++) {
2452 if (spec->multiout.dac_nids[i] == nid)
2453 return 1;
2454 }
2455
2456 return 0;
2457 }
2458
2459 /*
2460 * Fill in the dac_nids table from the parsed pin configuration
2461 * This function only works when every pin in line_out_pins[]
2462 * contains atleast one DAC in its connection list. Some 92xx
2463 * codecs are not connected directly to a DAC, such as the 9200
2464 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2465 */
2466 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2467 struct auto_pin_cfg *cfg)
2468 {
2469 struct sigmatel_spec *spec = codec->spec;
2470 int i, j, conn_len = 0;
2471 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2472 unsigned int wcaps, wtype;
2473
2474 for (i = 0; i < cfg->line_outs; i++) {
2475 nid = cfg->line_out_pins[i];
2476 conn_len = snd_hda_get_connections(codec, nid, conn,
2477 HDA_MAX_CONNECTIONS);
2478 for (j = 0; j < conn_len; j++) {
2479 wcaps = snd_hda_param_read(codec, conn[j],
2480 AC_PAR_AUDIO_WIDGET_CAP);
2481 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2482 if (wtype != AC_WID_AUD_OUT ||
2483 (wcaps & AC_WCAP_DIGITAL))
2484 continue;
2485 /* conn[j] is a DAC routed to this line-out */
2486 if (!is_in_dac_nids(spec, conn[j]))
2487 break;
2488 }
2489
2490 if (j == conn_len) {
2491 if (spec->multiout.num_dacs > 0) {
2492 /* we have already working output pins,
2493 * so let's drop the broken ones again
2494 */
2495 cfg->line_outs = spec->multiout.num_dacs;
2496 break;
2497 }
2498 /* error out, no available DAC found */
2499 snd_printk(KERN_ERR
2500 "%s: No available DAC for pin 0x%x\n",
2501 __func__, nid);
2502 return -ENODEV;
2503 }
2504
2505 spec->multiout.dac_nids[i] = conn[j];
2506 spec->multiout.num_dacs++;
2507 if (conn_len > 1) {
2508 /* select this DAC in the pin's input mux */
2509 snd_hda_codec_write_cache(codec, nid, 0,
2510 AC_VERB_SET_CONNECT_SEL, j);
2511
2512 }
2513 }
2514
2515 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2516 spec->multiout.num_dacs,
2517 spec->multiout.dac_nids[0],
2518 spec->multiout.dac_nids[1],
2519 spec->multiout.dac_nids[2],
2520 spec->multiout.dac_nids[3],
2521 spec->multiout.dac_nids[4]);
2522 return 0;
2523 }
2524
2525 /* create volume control/switch for the given prefx type */
2526 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2527 {
2528 char name[32];
2529 int err;
2530
2531 sprintf(name, "%s Playback Volume", pfx);
2532 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2533 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2534 if (err < 0)
2535 return err;
2536 sprintf(name, "%s Playback Switch", pfx);
2537 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2538 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2539 if (err < 0)
2540 return err;
2541 return 0;
2542 }
2543
2544 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2545 {
2546 if (!spec->multiout.hp_nid)
2547 spec->multiout.hp_nid = nid;
2548 else if (spec->multiout.num_dacs > 4) {
2549 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2550 return 1;
2551 } else {
2552 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2553 spec->multiout.num_dacs++;
2554 }
2555 return 0;
2556 }
2557
2558 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2559 {
2560 if (is_in_dac_nids(spec, nid))
2561 return 1;
2562 if (spec->multiout.hp_nid == nid)
2563 return 1;
2564 return 0;
2565 }
2566
2567 /* add playback controls from the parsed DAC table */
2568 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2569 const struct auto_pin_cfg *cfg)
2570 {
2571 static const char *chname[4] = {
2572 "Front", "Surround", NULL /*CLFE*/, "Side"
2573 };
2574 hda_nid_t nid;
2575 int i, err;
2576
2577 struct sigmatel_spec *spec = codec->spec;
2578 unsigned int wid_caps, pincap;
2579
2580
2581 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2582 if (!spec->multiout.dac_nids[i])
2583 continue;
2584
2585 nid = spec->multiout.dac_nids[i];
2586
2587 if (i == 2) {
2588 /* Center/LFE */
2589 err = create_controls(spec, "Center", nid, 1);
2590 if (err < 0)
2591 return err;
2592 err = create_controls(spec, "LFE", nid, 2);
2593 if (err < 0)
2594 return err;
2595
2596 wid_caps = get_wcaps(codec, nid);
2597
2598 if (wid_caps & AC_WCAP_LR_SWAP) {
2599 err = stac92xx_add_control(spec,
2600 STAC_CTL_WIDGET_CLFE_SWITCH,
2601 "Swap Center/LFE Playback Switch", nid);
2602
2603 if (err < 0)
2604 return err;
2605 }
2606
2607 } else {
2608 err = create_controls(spec, chname[i], nid, 3);
2609 if (err < 0)
2610 return err;
2611 }
2612 }
2613
2614 if (cfg->hp_outs > 1) {
2615 err = stac92xx_add_control(spec,
2616 STAC_CTL_WIDGET_HP_SWITCH,
2617 "Headphone as Line Out Switch", 0);
2618 if (err < 0)
2619 return err;
2620 }
2621
2622 if (spec->line_switch) {
2623 nid = cfg->input_pins[AUTO_PIN_LINE];
2624 pincap = snd_hda_param_read(codec, nid,
2625 AC_PAR_PIN_CAP);
2626 if (pincap & AC_PINCAP_OUT) {
2627 err = stac92xx_add_control(spec,
2628 STAC_CTL_WIDGET_IO_SWITCH,
2629 "Line In as Output Switch", nid << 8);
2630 if (err < 0)
2631 return err;
2632 }
2633 }
2634
2635 if (spec->mic_switch) {
2636 unsigned int def_conf;
2637 unsigned int mic_pin = AUTO_PIN_MIC;
2638 again:
2639 nid = cfg->input_pins[mic_pin];
2640 def_conf = snd_hda_codec_read(codec, nid, 0,
2641 AC_VERB_GET_CONFIG_DEFAULT, 0);
2642 /* some laptops have an internal analog microphone
2643 * which can't be used as a output */
2644 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2645 pincap = snd_hda_param_read(codec, nid,
2646 AC_PAR_PIN_CAP);
2647 if (pincap & AC_PINCAP_OUT) {
2648 err = stac92xx_add_control(spec,
2649 STAC_CTL_WIDGET_IO_SWITCH,
2650 "Mic as Output Switch", (nid << 8) | 1);
2651 nid = snd_hda_codec_read(codec, nid, 0,
2652 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2653 if (!check_in_dac_nids(spec, nid))
2654 add_spec_dacs(spec, nid);
2655 if (err < 0)
2656 return err;
2657 }
2658 } else if (mic_pin == AUTO_PIN_MIC) {
2659 mic_pin = AUTO_PIN_FRONT_MIC;
2660 goto again;
2661 }
2662 }
2663
2664 return 0;
2665 }
2666
2667 /* add playback controls for Speaker and HP outputs */
2668 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
2669 struct auto_pin_cfg *cfg)
2670 {
2671 struct sigmatel_spec *spec = codec->spec;
2672 hda_nid_t nid;
2673 int i, old_num_dacs, err;
2674
2675 old_num_dacs = spec->multiout.num_dacs;
2676 for (i = 0; i < cfg->hp_outs; i++) {
2677 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
2678 if (wid_caps & AC_WCAP_UNSOL_CAP)
2679 spec->hp_detect = 1;
2680 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
2681 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2682 if (check_in_dac_nids(spec, nid))
2683 nid = 0;
2684 if (! nid)
2685 continue;
2686 add_spec_dacs(spec, nid);
2687 }
2688 for (i = 0; i < cfg->speaker_outs; i++) {
2689 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
2690 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2691 if (check_in_dac_nids(spec, nid))
2692 nid = 0;
2693 if (! nid)
2694 continue;
2695 add_spec_dacs(spec, nid);
2696 }
2697 for (i = 0; i < cfg->line_outs; i++) {
2698 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
2699 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2700 if (check_in_dac_nids(spec, nid))
2701 nid = 0;
2702 if (! nid)
2703 continue;
2704 add_spec_dacs(spec, nid);
2705 }
2706 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
2707 static const char *pfxs[] = {
2708 "Speaker", "External Speaker", "Speaker2",
2709 };
2710 err = create_controls(spec, pfxs[i - old_num_dacs],
2711 spec->multiout.dac_nids[i], 3);
2712 if (err < 0)
2713 return err;
2714 }
2715 if (spec->multiout.hp_nid) {
2716 err = create_controls(spec, "Headphone",
2717 spec->multiout.hp_nid, 3);
2718 if (err < 0)
2719 return err;
2720 }
2721
2722 return 0;
2723 }
2724
2725 /* labels for mono mux outputs */
2726 static const char *stac92xx_mono_labels[4] = {
2727 "DAC0", "DAC1", "Mixer", "DAC2"
2728 };
2729
2730 /* create mono mux for mono out on capable codecs */
2731 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
2732 {
2733 struct sigmatel_spec *spec = codec->spec;
2734 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
2735 int i, num_cons;
2736 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
2737
2738 num_cons = snd_hda_get_connections(codec,
2739 spec->mono_nid,
2740 con_lst,
2741 HDA_MAX_NUM_INPUTS);
2742 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
2743 return -EINVAL;
2744
2745 for (i = 0; i < num_cons; i++) {
2746 mono_mux->items[mono_mux->num_items].label =
2747 stac92xx_mono_labels[i];
2748 mono_mux->items[mono_mux->num_items].index = i;
2749 mono_mux->num_items++;
2750 }
2751
2752 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
2753 "Mono Mux", spec->mono_nid);
2754 }
2755
2756 /* create PC beep volume controls */
2757 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
2758 hda_nid_t nid)
2759 {
2760 struct sigmatel_spec *spec = codec->spec;
2761 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
2762 int err;
2763
2764 /* check for mute support for the the amp */
2765 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
2766 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2767 "PC Beep Playback Switch",
2768 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
2769 if (err < 0)
2770 return err;
2771 }
2772
2773 /* check to see if there is volume support for the amp */
2774 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
2775 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
2776 "PC Beep Playback Volume",
2777 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
2778 if (err < 0)
2779 return err;
2780 }
2781 return 0;
2782 }
2783
2784 /* labels for dmic mux inputs */
2785 static const char *stac92xx_dmic_labels[5] = {
2786 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2787 "Digital Mic 3", "Digital Mic 4"
2788 };
2789
2790 /* create playback/capture controls for input pins on dmic capable codecs */
2791 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2792 const struct auto_pin_cfg *cfg)
2793 {
2794 struct sigmatel_spec *spec = codec->spec;
2795 struct hda_input_mux *dimux = &spec->private_dimux;
2796 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2797 int err, i, j;
2798 char name[32];
2799
2800 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2801 dimux->items[dimux->num_items].index = 0;
2802 dimux->num_items++;
2803
2804 for (i = 0; i < spec->num_dmics; i++) {
2805 hda_nid_t nid;
2806 int index;
2807 int num_cons;
2808 unsigned int wcaps;
2809 unsigned int def_conf;
2810
2811 def_conf = snd_hda_codec_read(codec,
2812 spec->dmic_nids[i],
2813 0,
2814 AC_VERB_GET_CONFIG_DEFAULT,
2815 0);
2816 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2817 continue;
2818
2819 nid = spec->dmic_nids[i];
2820 num_cons = snd_hda_get_connections(codec,
2821 spec->dmux_nids[0],
2822 con_lst,
2823 HDA_MAX_NUM_INPUTS);
2824 for (j = 0; j < num_cons; j++)
2825 if (con_lst[j] == nid) {
2826 index = j;
2827 goto found;
2828 }
2829 continue;
2830 found:
2831 wcaps = get_wcaps(codec, nid) &
2832 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
2833
2834 if (wcaps) {
2835 sprintf(name, "%s Capture Volume",
2836 stac92xx_dmic_labels[dimux->num_items]);
2837
2838 err = stac92xx_add_control(spec,
2839 STAC_CTL_WIDGET_VOL,
2840 name,
2841 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
2842 (wcaps & AC_WCAP_OUT_AMP) ?
2843 HDA_OUTPUT : HDA_INPUT));
2844 if (err < 0)
2845 return err;
2846 }
2847
2848 dimux->items[dimux->num_items].label =
2849 stac92xx_dmic_labels[dimux->num_items];
2850 dimux->items[dimux->num_items].index = index;
2851 dimux->num_items++;
2852 }
2853
2854 return 0;
2855 }
2856
2857 /* create playback/capture controls for input pins */
2858 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
2859 {
2860 struct sigmatel_spec *spec = codec->spec;
2861 struct hda_input_mux *imux = &spec->private_imux;
2862 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2863 int i, j, k;
2864
2865 for (i = 0; i < AUTO_PIN_LAST; i++) {
2866 int index;
2867
2868 if (!cfg->input_pins[i])
2869 continue;
2870 index = -1;
2871 for (j = 0; j < spec->num_muxes; j++) {
2872 int num_cons;
2873 num_cons = snd_hda_get_connections(codec,
2874 spec->mux_nids[j],
2875 con_lst,
2876 HDA_MAX_NUM_INPUTS);
2877 for (k = 0; k < num_cons; k++)
2878 if (con_lst[k] == cfg->input_pins[i]) {
2879 index = k;
2880 goto found;
2881 }
2882 }
2883 continue;
2884 found:
2885 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
2886 imux->items[imux->num_items].index = index;
2887 imux->num_items++;
2888 }
2889
2890 if (imux->num_items) {
2891 /*
2892 * Set the current input for the muxes.
2893 * The STAC9221 has two input muxes with identical source
2894 * NID lists. Hopefully this won't get confused.
2895 */
2896 for (i = 0; i < spec->num_muxes; i++) {
2897 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
2898 AC_VERB_SET_CONNECT_SEL,
2899 imux->items[0].index);
2900 }
2901 }
2902
2903 return 0;
2904 }
2905
2906 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
2907 {
2908 struct sigmatel_spec *spec = codec->spec;
2909 int i;
2910
2911 for (i = 0; i < spec->autocfg.line_outs; i++) {
2912 hda_nid_t nid = spec->autocfg.line_out_pins[i];
2913 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2914 }
2915 }
2916
2917 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
2918 {
2919 struct sigmatel_spec *spec = codec->spec;
2920 int i;
2921
2922 for (i = 0; i < spec->autocfg.hp_outs; i++) {
2923 hda_nid_t pin;
2924 pin = spec->autocfg.hp_pins[i];
2925 if (pin) /* connect to front */
2926 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
2927 }
2928 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
2929 hda_nid_t pin;
2930 pin = spec->autocfg.speaker_pins[i];
2931 if (pin) /* connect to front */
2932 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
2933 }
2934 }
2935
2936 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
2937 {
2938 struct sigmatel_spec *spec = codec->spec;
2939 int err;
2940 int hp_speaker_swap = 0;
2941
2942 if ((err = snd_hda_parse_pin_def_config(codec,
2943 &spec->autocfg,
2944 spec->dmic_nids)) < 0)
2945 return err;
2946 if (! spec->autocfg.line_outs)
2947 return 0; /* can't find valid pin config */
2948
2949 /* If we have no real line-out pin and multiple hp-outs, HPs should
2950 * be set up as multi-channel outputs.
2951 */
2952 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2953 spec->autocfg.hp_outs > 1) {
2954 /* Copy hp_outs to line_outs, backup line_outs in
2955 * speaker_outs so that the following routines can handle
2956 * HP pins as primary outputs.
2957 */
2958 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
2959 sizeof(spec->autocfg.line_out_pins));
2960 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
2961 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
2962 sizeof(spec->autocfg.hp_pins));
2963 spec->autocfg.line_outs = spec->autocfg.hp_outs;
2964 hp_speaker_swap = 1;
2965 }
2966 if (spec->autocfg.mono_out_pin) {
2967 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
2968 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
2969 u32 caps = query_amp_caps(codec,
2970 spec->autocfg.mono_out_pin, dir);
2971 hda_nid_t conn_list[1];
2972
2973 /* get the mixer node and then the mono mux if it exists */
2974 if (snd_hda_get_connections(codec,
2975 spec->autocfg.mono_out_pin, conn_list, 1) &&
2976 snd_hda_get_connections(codec, conn_list[0],
2977 conn_list, 1)) {
2978
2979 int wcaps = get_wcaps(codec, conn_list[0]);
2980 int wid_type = (wcaps & AC_WCAP_TYPE)
2981 >> AC_WCAP_TYPE_SHIFT;
2982 /* LR swap check, some stac925x have a mux that
2983 * changes the DACs output path instead of the
2984 * mono-mux path.
2985 */
2986 if (wid_type == AC_WID_AUD_SEL &&
2987 !(wcaps & AC_WCAP_LR_SWAP))
2988 spec->mono_nid = conn_list[0];
2989 }
2990 if (dir) {
2991 hda_nid_t nid = spec->autocfg.mono_out_pin;
2992
2993 /* most mono outs have a least a mute/unmute switch */
2994 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
2995 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2996 "Mono Playback Switch",
2997 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
2998 if (err < 0)
2999 return err;
3000 /* check for volume support for the amp */
3001 if ((caps & AC_AMPCAP_NUM_STEPS)
3002 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3003 err = stac92xx_add_control(spec,
3004 STAC_CTL_WIDGET_VOL,
3005 "Mono Playback Volume",
3006 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3007 if (err < 0)
3008 return err;
3009 }
3010 }
3011
3012 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3013 AC_PINCTL_OUT_EN);
3014 }
3015
3016 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
3017 return err;
3018 if (spec->multiout.num_dacs == 0)
3019 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
3020 return err;
3021
3022 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3023
3024 if (err < 0)
3025 return err;
3026
3027 /* setup analog beep controls */
3028 if (spec->anabeep_nid > 0) {
3029 err = stac92xx_auto_create_beep_ctls(codec,
3030 spec->anabeep_nid);
3031 if (err < 0)
3032 return err;
3033 }
3034
3035 /* setup digital beep controls and input device */
3036 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3037 if (spec->digbeep_nid > 0) {
3038 hda_nid_t nid = spec->digbeep_nid;
3039
3040 err = stac92xx_auto_create_beep_ctls(codec, nid);
3041 if (err < 0)
3042 return err;
3043 err = snd_hda_attach_beep_device(codec, nid);
3044 if (err < 0)
3045 return err;
3046 }
3047 #endif
3048
3049 if (hp_speaker_swap == 1) {
3050 /* Restore the hp_outs and line_outs */
3051 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3052 sizeof(spec->autocfg.line_out_pins));
3053 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3054 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
3055 sizeof(spec->autocfg.speaker_pins));
3056 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
3057 memset(spec->autocfg.speaker_pins, 0,
3058 sizeof(spec->autocfg.speaker_pins));
3059 spec->autocfg.speaker_outs = 0;
3060 }
3061
3062 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3063
3064 if (err < 0)
3065 return err;
3066
3067 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3068
3069 if (err < 0)
3070 return err;
3071
3072 if (spec->mono_nid > 0) {
3073 err = stac92xx_auto_create_mono_output_ctls(codec);
3074 if (err < 0)
3075 return err;
3076 }
3077
3078 if (spec->num_dmics > 0)
3079 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3080 &spec->autocfg)) < 0)
3081 return err;
3082
3083 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3084 if (spec->multiout.max_channels > 2)
3085 spec->surr_switch = 1;
3086
3087 if (spec->autocfg.dig_out_pin)
3088 spec->multiout.dig_out_nid = dig_out;
3089 if (dig_in && spec->autocfg.dig_in_pin)
3090 spec->dig_in_nid = dig_in;
3091
3092 if (spec->kctl_alloc)
3093 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3094
3095 spec->input_mux = &spec->private_imux;
3096 if (!spec->dinput_mux)
3097 spec->dinput_mux = &spec->private_dimux;
3098 spec->mono_mux = &spec->private_mono_mux;
3099
3100 return 1;
3101 }
3102
3103 /* add playback controls for HP output */
3104 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3105 struct auto_pin_cfg *cfg)
3106 {
3107 struct sigmatel_spec *spec = codec->spec;
3108 hda_nid_t pin = cfg->hp_pins[0];
3109 unsigned int wid_caps;
3110
3111 if (! pin)
3112 return 0;
3113
3114 wid_caps = get_wcaps(codec, pin);
3115 if (wid_caps & AC_WCAP_UNSOL_CAP)
3116 spec->hp_detect = 1;
3117
3118 return 0;
3119 }
3120
3121 /* add playback controls for LFE output */
3122 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3123 struct auto_pin_cfg *cfg)
3124 {
3125 struct sigmatel_spec *spec = codec->spec;
3126 int err;
3127 hda_nid_t lfe_pin = 0x0;
3128 int i;
3129
3130 /*
3131 * search speaker outs and line outs for a mono speaker pin
3132 * with an amp. If one is found, add LFE controls
3133 * for it.
3134 */
3135 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3136 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3137 unsigned int wcaps = get_wcaps(codec, pin);
3138 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3139 if (wcaps == AC_WCAP_OUT_AMP)
3140 /* found a mono speaker with an amp, must be lfe */
3141 lfe_pin = pin;
3142 }
3143
3144 /* if speaker_outs is 0, then speakers may be in line_outs */
3145 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3146 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3147 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3148 unsigned int defcfg;
3149 defcfg = snd_hda_codec_read(codec, pin, 0,
3150 AC_VERB_GET_CONFIG_DEFAULT,
3151 0x00);
3152 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3153 unsigned int wcaps = get_wcaps(codec, pin);
3154 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3155 if (wcaps == AC_WCAP_OUT_AMP)
3156 /* found a mono speaker with an amp,
3157 must be lfe */
3158 lfe_pin = pin;
3159 }
3160 }
3161 }
3162
3163 if (lfe_pin) {
3164 err = create_controls(spec, "LFE", lfe_pin, 1);
3165 if (err < 0)
3166 return err;
3167 }
3168
3169 return 0;
3170 }
3171
3172 static int stac9200_parse_auto_config(struct hda_codec *codec)
3173 {
3174 struct sigmatel_spec *spec = codec->spec;
3175 int err;
3176
3177 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3178 return err;
3179
3180 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3181 return err;
3182
3183 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3184 return err;
3185
3186 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3187 return err;
3188
3189 if (spec->autocfg.dig_out_pin)
3190 spec->multiout.dig_out_nid = 0x05;
3191 if (spec->autocfg.dig_in_pin)
3192 spec->dig_in_nid = 0x04;
3193
3194 if (spec->kctl_alloc)
3195 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3196
3197 spec->input_mux = &spec->private_imux;
3198 spec->dinput_mux = &spec->private_dimux;
3199
3200 return 1;
3201 }
3202
3203 /*
3204 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3205 * funky external mute control using GPIO pins.
3206 */
3207
3208 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3209 unsigned int dir_mask, unsigned int data)
3210 {
3211 unsigned int gpiostate, gpiomask, gpiodir;
3212
3213 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3214 AC_VERB_GET_GPIO_DATA, 0);
3215 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3216
3217 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3218 AC_VERB_GET_GPIO_MASK, 0);
3219 gpiomask |= mask;
3220
3221 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3222 AC_VERB_GET_GPIO_DIRECTION, 0);
3223 gpiodir |= dir_mask;
3224
3225 /* Configure GPIOx as CMOS */
3226 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3227
3228 snd_hda_codec_write(codec, codec->afg, 0,
3229 AC_VERB_SET_GPIO_MASK, gpiomask);
3230 snd_hda_codec_read(codec, codec->afg, 0,
3231 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3232
3233 msleep(1);
3234
3235 snd_hda_codec_read(codec, codec->afg, 0,
3236 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3237 }
3238
3239 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3240 unsigned int event)
3241 {
3242 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
3243 snd_hda_codec_write_cache(codec, nid, 0,
3244 AC_VERB_SET_UNSOLICITED_ENABLE,
3245 (AC_USRSP_EN | event));
3246 }
3247
3248 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3249 {
3250 int i;
3251 for (i = 0; i < cfg->hp_outs; i++)
3252 if (cfg->hp_pins[i] == nid)
3253 return 1; /* nid is a HP-Out */
3254
3255 return 0; /* nid is not a HP-Out */
3256 };
3257
3258 static void stac92xx_power_down(struct hda_codec *codec)
3259 {
3260 struct sigmatel_spec *spec = codec->spec;
3261
3262 /* power down inactive DACs */
3263 hda_nid_t *dac;
3264 for (dac = spec->dac_list; *dac; dac++)
3265 if (!is_in_dac_nids(spec, *dac) &&
3266 spec->multiout.hp_nid != *dac)
3267 snd_hda_codec_write_cache(codec, *dac, 0,
3268 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3269 }
3270
3271 static int stac92xx_init(struct hda_codec *codec)
3272 {
3273 struct sigmatel_spec *spec = codec->spec;
3274 struct auto_pin_cfg *cfg = &spec->autocfg;
3275 int i;
3276
3277 snd_hda_sequence_write(codec, spec->init);
3278
3279 /* set up pins */
3280 if (spec->hp_detect) {
3281 /* Enable unsolicited responses on the HP widget */
3282 for (i = 0; i < cfg->hp_outs; i++)
3283 enable_pin_detect(codec, cfg->hp_pins[i],
3284 STAC_HP_EVENT);
3285 /* force to enable the first line-out; the others are set up
3286 * in unsol_event
3287 */
3288 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3289 AC_PINCTL_OUT_EN);
3290 stac92xx_auto_init_hp_out(codec);
3291 /* fake event to set up pins */
3292 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3293 } else {
3294 stac92xx_auto_init_multi_out(codec);
3295 stac92xx_auto_init_hp_out(codec);
3296 }
3297 for (i = 0; i < AUTO_PIN_LAST; i++) {
3298 hda_nid_t nid = cfg->input_pins[i];
3299 if (nid) {
3300 unsigned int pinctl = AC_PINCTL_IN_EN;
3301 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
3302 pinctl |= stac92xx_get_vref(codec, nid);
3303 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3304 }
3305 }
3306 for (i = 0; i < spec->num_dmics; i++)
3307 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3308 AC_PINCTL_IN_EN);
3309 for (i = 0; i < spec->num_pwrs; i++) {
3310 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i])
3311 ? STAC_HP_EVENT : STAC_PWR_EVENT;
3312 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i],
3313 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3314 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i],
3315 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3316 def_conf = get_defcfg_connect(def_conf);
3317 /* outputs are only ports capable of power management
3318 * any attempts on powering down a input port cause the
3319 * referenced VREF to act quirky.
3320 */
3321 if (pinctl & AC_PINCTL_IN_EN)
3322 continue;
3323 /* skip any ports that don't have jacks since presence
3324 * detection is useless */
3325 if (def_conf && def_conf != AC_JACK_PORT_FIXED)
3326 continue;
3327 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3328 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3329 }
3330 if (spec->dac_list)
3331 stac92xx_power_down(codec);
3332 if (cfg->dig_out_pin)
3333 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3334 AC_PINCTL_OUT_EN);
3335 if (cfg->dig_in_pin)
3336 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3337 AC_PINCTL_IN_EN);
3338
3339 stac_gpio_set(codec, spec->gpio_mask,
3340 spec->gpio_dir, spec->gpio_data);
3341
3342 return 0;
3343 }
3344
3345 static void stac92xx_free(struct hda_codec *codec)
3346 {
3347 struct sigmatel_spec *spec = codec->spec;
3348 int i;
3349
3350 if (! spec)
3351 return;
3352
3353 if (spec->kctl_alloc) {
3354 for (i = 0; i < spec->num_kctl_used; i++)
3355 kfree(spec->kctl_alloc[i].name);
3356 kfree(spec->kctl_alloc);
3357 }
3358
3359 if (spec->bios_pin_configs)
3360 kfree(spec->bios_pin_configs);
3361
3362 kfree(spec);
3363 snd_hda_detach_beep_device(codec);
3364 }
3365
3366 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
3367 unsigned int flag)
3368 {
3369 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3370 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3371
3372 if (pin_ctl & AC_PINCTL_IN_EN) {
3373 /*
3374 * we need to check the current set-up direction of
3375 * shared input pins since they can be switched via
3376 * "xxx as Output" mixer switch
3377 */
3378 struct sigmatel_spec *spec = codec->spec;
3379 struct auto_pin_cfg *cfg = &spec->autocfg;
3380 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
3381 spec->line_switch) ||
3382 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
3383 spec->mic_switch))
3384 return;
3385 }
3386
3387 /* if setting pin direction bits, clear the current
3388 direction bits first */
3389 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
3390 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
3391
3392 snd_hda_codec_write_cache(codec, nid, 0,
3393 AC_VERB_SET_PIN_WIDGET_CONTROL,
3394 pin_ctl | flag);
3395 }
3396
3397 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
3398 unsigned int flag)
3399 {
3400 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3401 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3402 snd_hda_codec_write_cache(codec, nid, 0,
3403 AC_VERB_SET_PIN_WIDGET_CONTROL,
3404 pin_ctl & ~flag);
3405 }
3406
3407 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
3408 {
3409 if (!nid)
3410 return 0;
3411 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
3412 & (1 << 31)) {
3413 unsigned int pinctl;
3414 pinctl = snd_hda_codec_read(codec, nid, 0,
3415 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3416 if (pinctl & AC_PINCTL_IN_EN)
3417 return 0; /* mic- or line-input */
3418 else
3419 return 1; /* HP-output */
3420 }
3421 return 0;
3422 }
3423
3424 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3425 {
3426 struct sigmatel_spec *spec = codec->spec;
3427 struct auto_pin_cfg *cfg = &spec->autocfg;
3428 int nid = cfg->hp_pins[cfg->hp_outs - 1];
3429 int i, presence;
3430
3431 presence = 0;
3432 if (spec->gpio_mute)
3433 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
3434 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
3435
3436 for (i = 0; i < cfg->hp_outs; i++) {
3437 if (presence)
3438 break;
3439 if (spec->hp_switch && cfg->hp_pins[i] == nid)
3440 break;
3441 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
3442 }
3443
3444 if (presence) {
3445 /* disable lineouts, enable hp */
3446 if (spec->hp_switch)
3447 stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3448 for (i = 0; i < cfg->line_outs; i++)
3449 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
3450 AC_PINCTL_OUT_EN);
3451 for (i = 0; i < cfg->speaker_outs; i++)
3452 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3453 AC_PINCTL_OUT_EN);
3454 if (spec->eapd_mask)
3455 stac_gpio_set(codec, spec->gpio_mask,
3456 spec->gpio_dir, spec->gpio_data &
3457 ~spec->eapd_mask);
3458 } else {
3459 /* enable lineouts, disable hp */
3460 if (spec->hp_switch)
3461 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3462 for (i = 0; i < cfg->line_outs; i++)
3463 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
3464 AC_PINCTL_OUT_EN);
3465 for (i = 0; i < cfg->speaker_outs; i++)
3466 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3467 AC_PINCTL_OUT_EN);
3468 if (spec->eapd_mask)
3469 stac_gpio_set(codec, spec->gpio_mask,
3470 spec->gpio_dir, spec->gpio_data |
3471 spec->eapd_mask);
3472 }
3473 if (!spec->hp_switch && cfg->hp_outs > 1 && presence)
3474 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3475 }
3476
3477 static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3478 {
3479 struct sigmatel_spec *spec = codec->spec;
3480 hda_nid_t nid = spec->pwr_nids[idx];
3481 int presence, val;
3482 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0)
3483 & 0x000000ff;
3484 presence = get_hp_pin_presence(codec, nid);
3485
3486 /* several codecs have two power down bits */
3487 if (spec->pwr_mapping)
3488 idx = spec->pwr_mapping[idx];
3489 else
3490 idx = 1 << idx;
3491
3492 if (presence)
3493 val &= ~idx;
3494 else
3495 val |= idx;
3496
3497 /* power down unused output ports */
3498 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3499 };
3500
3501 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3502 {
3503 struct sigmatel_spec *spec = codec->spec;
3504 int idx = res >> 26 & 0x0f;
3505
3506 switch ((res >> 26) & 0x30) {
3507 case STAC_HP_EVENT:
3508 stac92xx_hp_detect(codec, res);
3509 /* fallthru */
3510 case STAC_PWR_EVENT:
3511 if (spec->num_pwrs > 0)
3512 stac92xx_pin_sense(codec, idx);
3513 }
3514 }
3515
3516 #ifdef SND_HDA_NEEDS_RESUME
3517 static int stac92xx_resume(struct hda_codec *codec)
3518 {
3519 struct sigmatel_spec *spec = codec->spec;
3520
3521 stac92xx_set_config_regs(codec);
3522 snd_hda_sequence_write(codec, spec->init);
3523 stac_gpio_set(codec, spec->gpio_mask,
3524 spec->gpio_dir, spec->gpio_data);
3525 snd_hda_codec_resume_amp(codec);
3526 snd_hda_codec_resume_cache(codec);
3527 /* power down inactive DACs */
3528 if (spec->dac_list)
3529 stac92xx_power_down(codec);
3530 /* invoke unsolicited event to reset the HP state */
3531 if (spec->hp_detect)
3532 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3533 return 0;
3534 }
3535 #endif
3536
3537 static struct hda_codec_ops stac92xx_patch_ops = {
3538 .build_controls = stac92xx_build_controls,
3539 .build_pcms = stac92xx_build_pcms,
3540 .init = stac92xx_init,
3541 .free = stac92xx_free,
3542 .unsol_event = stac92xx_unsol_event,
3543 #ifdef SND_HDA_NEEDS_RESUME
3544 .resume = stac92xx_resume,
3545 #endif
3546 };
3547
3548 static int patch_stac9200(struct hda_codec *codec)
3549 {
3550 struct sigmatel_spec *spec;
3551 int err;
3552
3553 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3554 if (spec == NULL)
3555 return -ENOMEM;
3556
3557 codec->spec = spec;
3558 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
3559 spec->pin_nids = stac9200_pin_nids;
3560 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
3561 stac9200_models,
3562 stac9200_cfg_tbl);
3563 if (spec->board_config < 0) {
3564 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3565 err = stac92xx_save_bios_config_regs(codec);
3566 if (err < 0) {
3567 stac92xx_free(codec);
3568 return err;
3569 }
3570 spec->pin_configs = spec->bios_pin_configs;
3571 } else {
3572 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
3573 stac92xx_set_config_regs(codec);
3574 }
3575
3576 spec->multiout.max_channels = 2;
3577 spec->multiout.num_dacs = 1;
3578 spec->multiout.dac_nids = stac9200_dac_nids;
3579 spec->adc_nids = stac9200_adc_nids;
3580 spec->mux_nids = stac9200_mux_nids;
3581 spec->num_muxes = 1;
3582 spec->num_dmics = 0;
3583 spec->num_adcs = 1;
3584 spec->num_pwrs = 0;
3585
3586 if (spec->board_config == STAC_9200_GATEWAY ||
3587 spec->board_config == STAC_9200_OQO)
3588 spec->init = stac9200_eapd_init;
3589 else
3590 spec->init = stac9200_core_init;
3591 spec->mixer = stac9200_mixer;
3592
3593 if (spec->board_config == STAC_9200_PANASONIC) {
3594 spec->gpio_mask = spec->gpio_dir = 0x09;
3595 spec->gpio_data = 0x00;
3596 }
3597
3598 err = stac9200_parse_auto_config(codec);
3599 if (err < 0) {
3600 stac92xx_free(codec);
3601 return err;
3602 }
3603
3604 codec->patch_ops = stac92xx_patch_ops;
3605
3606 return 0;
3607 }
3608
3609 static int patch_stac925x(struct hda_codec *codec)
3610 {
3611 struct sigmatel_spec *spec;
3612 int err;
3613
3614 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3615 if (spec == NULL)
3616 return -ENOMEM;
3617
3618 codec->spec = spec;
3619 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
3620 spec->pin_nids = stac925x_pin_nids;
3621 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
3622 stac925x_models,
3623 stac925x_cfg_tbl);
3624 again:
3625 if (spec->board_config < 0) {
3626 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
3627 "using BIOS defaults\n");
3628 err = stac92xx_save_bios_config_regs(codec);
3629 if (err < 0) {
3630 stac92xx_free(codec);
3631 return err;
3632 }
3633 spec->pin_configs = spec->bios_pin_configs;
3634 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
3635 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
3636 stac92xx_set_config_regs(codec);
3637 }
3638
3639 spec->multiout.max_channels = 2;
3640 spec->multiout.num_dacs = 1;
3641 spec->multiout.dac_nids = stac925x_dac_nids;
3642 spec->adc_nids = stac925x_adc_nids;
3643 spec->mux_nids = stac925x_mux_nids;
3644 spec->num_muxes = 1;
3645 spec->num_adcs = 1;
3646 spec->num_pwrs = 0;
3647 switch (codec->vendor_id) {
3648 case 0x83847632: /* STAC9202 */
3649 case 0x83847633: /* STAC9202D */
3650 case 0x83847636: /* STAC9251 */
3651 case 0x83847637: /* STAC9251D */
3652 spec->num_dmics = STAC925X_NUM_DMICS;
3653 spec->dmic_nids = stac925x_dmic_nids;
3654 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
3655 spec->dmux_nids = stac925x_dmux_nids;
3656 break;
3657 default:
3658 spec->num_dmics = 0;
3659 break;
3660 }
3661
3662 spec->init = stac925x_core_init;
3663 spec->mixer = stac925x_mixer;
3664
3665 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
3666 if (!err) {
3667 if (spec->board_config < 0) {
3668 printk(KERN_WARNING "hda_codec: No auto-config is "
3669 "available, default to model=ref\n");
3670 spec->board_config = STAC_925x_REF;
3671 goto again;
3672 }
3673 err = -EINVAL;
3674 }
3675 if (err < 0) {
3676 stac92xx_free(codec);
3677 return err;
3678 }
3679
3680 codec->patch_ops = stac92xx_patch_ops;
3681
3682 return 0;
3683 }
3684
3685 static struct hda_input_mux stac92hd73xx_dmux = {
3686 .num_items = 4,
3687 .items = {
3688 { "Analog Inputs", 0x0b },
3689 { "CD", 0x08 },
3690 { "Digital Mic 1", 0x09 },
3691 { "Digital Mic 2", 0x0a },
3692 }
3693 };
3694
3695 static int patch_stac92hd73xx(struct hda_codec *codec)
3696 {
3697 struct sigmatel_spec *spec;
3698 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
3699 int err = 0;
3700
3701 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3702 if (spec == NULL)
3703 return -ENOMEM;
3704
3705 codec->spec = spec;
3706 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
3707 spec->pin_nids = stac92hd73xx_pin_nids;
3708 spec->board_config = snd_hda_check_board_config(codec,
3709 STAC_92HD73XX_MODELS,
3710 stac92hd73xx_models,
3711 stac92hd73xx_cfg_tbl);
3712 again:
3713 if (spec->board_config < 0) {
3714 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3715 " STAC92HD73XX, using BIOS defaults\n");
3716 err = stac92xx_save_bios_config_regs(codec);
3717 if (err < 0) {
3718 stac92xx_free(codec);
3719 return err;
3720 }
3721 spec->pin_configs = spec->bios_pin_configs;
3722 } else {
3723 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
3724 stac92xx_set_config_regs(codec);
3725 }
3726
3727 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
3728 conn, STAC92HD73_DAC_COUNT + 2) - 1;
3729
3730 if (spec->multiout.num_dacs < 0) {
3731 printk(KERN_WARNING "hda_codec: Could not determine "
3732 "number of channels defaulting to DAC count\n");
3733 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
3734 }
3735
3736 switch (spec->multiout.num_dacs) {
3737 case 0x3: /* 6 Channel */
3738 spec->multiout.hp_nid = 0x17;
3739 spec->mixer = stac92hd73xx_6ch_mixer;
3740 spec->init = stac92hd73xx_6ch_core_init;
3741 break;
3742 case 0x4: /* 8 Channel */
3743 spec->multiout.hp_nid = 0x18;
3744 spec->mixer = stac92hd73xx_8ch_mixer;
3745 spec->init = stac92hd73xx_8ch_core_init;
3746 break;
3747 case 0x5: /* 10 Channel */
3748 spec->multiout.hp_nid = 0x19;
3749 spec->mixer = stac92hd73xx_10ch_mixer;
3750 spec->init = stac92hd73xx_10ch_core_init;
3751 };
3752
3753 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
3754 spec->aloopback_mask = 0x01;
3755 spec->aloopback_shift = 8;
3756
3757 spec->digbeep_nid = 0x1c;
3758 spec->mux_nids = stac92hd73xx_mux_nids;
3759 spec->adc_nids = stac92hd73xx_adc_nids;
3760 spec->dmic_nids = stac92hd73xx_dmic_nids;
3761 spec->dmux_nids = stac92hd73xx_dmux_nids;
3762
3763 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
3764 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
3765 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3766 spec->dinput_mux = &stac92hd73xx_dmux;
3767 /* GPIO0 High = Enable EAPD */
3768 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3769 spec->gpio_data = 0x01;
3770
3771 switch (spec->board_config) {
3772 case STAC_DELL_M6:
3773 spec->init = dell_eq_core_init;
3774 switch (codec->subsystem_id) {
3775 case 0x1028025e: /* Analog Mics */
3776 case 0x1028025f:
3777 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3778 spec->num_dmics = 0;
3779 break;
3780 case 0x10280271: /* Digital Mics */
3781 case 0x10280272:
3782 spec->init = dell_m6_core_init;
3783 /* fall-through */
3784 case 0x10280254:
3785 case 0x10280255:
3786 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3787 spec->num_dmics = 1;
3788 break;
3789 case 0x10280256: /* Both */
3790 case 0x10280057:
3791 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3792 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3793 spec->num_dmics = 1;
3794 break;
3795 }
3796 break;
3797 default:
3798 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
3799 }
3800
3801 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3802 spec->pwr_nids = stac92hd73xx_pwr_nids;
3803
3804 err = stac92xx_parse_auto_config(codec, 0x22, 0x24);
3805
3806 if (!err) {
3807 if (spec->board_config < 0) {
3808 printk(KERN_WARNING "hda_codec: No auto-config is "
3809 "available, default to model=ref\n");
3810 spec->board_config = STAC_92HD73XX_REF;
3811 goto again;
3812 }
3813 err = -EINVAL;
3814 }
3815
3816 if (err < 0) {
3817 stac92xx_free(codec);
3818 return err;
3819 }
3820
3821 codec->patch_ops = stac92xx_patch_ops;
3822
3823 return 0;
3824 }
3825
3826 static struct hda_input_mux stac92hd83xxx_dmux = {
3827 .num_items = 3,
3828 .items = {
3829 { "Analog Inputs", 0x03 },
3830 { "Digital Mic 1", 0x04 },
3831 { "Digital Mic 2", 0x05 },
3832 }
3833 };
3834
3835 static int patch_stac92hd83xxx(struct hda_codec *codec)
3836 {
3837 struct sigmatel_spec *spec;
3838 int err;
3839
3840 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3841 if (spec == NULL)
3842 return -ENOMEM;
3843
3844 codec->spec = spec;
3845 spec->mono_nid = 0x19;
3846 spec->digbeep_nid = 0x21;
3847 spec->dmic_nids = stac92hd83xxx_dmic_nids;
3848 spec->dmux_nids = stac92hd83xxx_dmux_nids;
3849 spec->adc_nids = stac92hd83xxx_adc_nids;
3850 spec->pwr_nids = stac92hd83xxx_pwr_nids;
3851 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
3852 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
3853 spec->multiout.dac_nids = stac92hd83xxx_dac_nids;
3854
3855 spec->init = stac92hd83xxx_core_init;
3856 switch (codec->vendor_id) {
3857 case 0x111d7605:
3858 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;
3859 break;
3860 default:
3861 spec->num_pwrs--;
3862 spec->init++; /* switch to config #2 */
3863 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;
3864 }
3865
3866 spec->mixer = stac92hd83xxx_mixer;
3867 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
3868 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
3869 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
3870 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
3871 spec->dinput_mux = &stac92hd83xxx_dmux;
3872 spec->pin_nids = stac92hd83xxx_pin_nids;
3873 spec->board_config = snd_hda_check_board_config(codec,
3874 STAC_92HD83XXX_MODELS,
3875 stac92hd83xxx_models,
3876 stac92hd83xxx_cfg_tbl);
3877 again:
3878 if (spec->board_config < 0) {
3879 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3880 " STAC92HD83XXX, using BIOS defaults\n");
3881 err = stac92xx_save_bios_config_regs(codec);
3882 if (err < 0) {
3883 stac92xx_free(codec);
3884 return err;
3885 }
3886 spec->pin_configs = spec->bios_pin_configs;
3887 } else {
3888 spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config];
3889 stac92xx_set_config_regs(codec);
3890 }
3891
3892 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
3893 if (!err) {
3894 if (spec->board_config < 0) {
3895 printk(KERN_WARNING "hda_codec: No auto-config is "
3896 "available, default to model=ref\n");
3897 spec->board_config = STAC_92HD83XXX_REF;
3898 goto again;
3899 }
3900 err = -EINVAL;
3901 }
3902
3903 if (err < 0) {
3904 stac92xx_free(codec);
3905 return err;
3906 }
3907
3908 codec->patch_ops = stac92xx_patch_ops;
3909
3910 return 0;
3911 }
3912
3913
3914 static int patch_stac92hd71bxx(struct hda_codec *codec)
3915 {
3916 struct sigmatel_spec *spec;
3917 int err = 0;
3918
3919 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3920 if (spec == NULL)
3921 return -ENOMEM;
3922
3923 codec->spec = spec;
3924 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
3925 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
3926 spec->pin_nids = stac92hd71bxx_pin_nids;
3927 spec->board_config = snd_hda_check_board_config(codec,
3928 STAC_92HD71BXX_MODELS,
3929 stac92hd71bxx_models,
3930 stac92hd71bxx_cfg_tbl);
3931 again:
3932 if (spec->board_config < 0) {
3933 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3934 " STAC92HD71BXX, using BIOS defaults\n");
3935 err = stac92xx_save_bios_config_regs(codec);
3936 if (err < 0) {
3937 stac92xx_free(codec);
3938 return err;
3939 }
3940 spec->pin_configs = spec->bios_pin_configs;
3941 } else {
3942 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
3943 stac92xx_set_config_regs(codec);
3944 }
3945
3946 switch (codec->vendor_id) {
3947 case 0x111d76b6: /* 4 Port without Analog Mixer */
3948 case 0x111d76b7:
3949 case 0x111d76b4: /* 6 Port without Analog Mixer */
3950 case 0x111d76b5:
3951 spec->mixer = stac92hd71bxx_mixer;
3952 spec->init = stac92hd71bxx_core_init;
3953 break;
3954 case 0x111d7608: /* 5 Port with Analog Mixer */
3955 /* no output amps */
3956 spec->num_pwrs = 0;
3957 spec->mixer = stac92hd71bxx_analog_mixer;
3958
3959 /* disable VSW */
3960 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
3961 stac92xx_set_config_reg(codec, 0xf, 0x40f000f0);
3962 break;
3963 case 0x111d7603: /* 6 Port with Analog Mixer */
3964 /* no output amps */
3965 spec->num_pwrs = 0;
3966 /* fallthru */
3967 default:
3968 spec->mixer = stac92hd71bxx_analog_mixer;
3969 spec->init = stac92hd71bxx_analog_core_init;
3970 }
3971
3972 spec->aloopback_mask = 0x20;
3973 spec->aloopback_shift = 0;
3974
3975 /* GPIO0 High = EAPD */
3976 spec->gpio_mask = 0x01;
3977 spec->gpio_dir = 0x01;
3978 spec->gpio_data = 0x01;
3979
3980 spec->digbeep_nid = 0x26;
3981 spec->mux_nids = stac92hd71bxx_mux_nids;
3982 spec->adc_nids = stac92hd71bxx_adc_nids;
3983 spec->dmic_nids = stac92hd71bxx_dmic_nids;
3984 spec->dmux_nids = stac92hd71bxx_dmux_nids;
3985 spec->pwr_nids = stac92hd71bxx_pwr_nids;
3986
3987 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
3988 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
3989 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
3990 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
3991
3992 spec->multiout.num_dacs = 1;
3993 spec->multiout.hp_nid = 0x11;
3994 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
3995
3996 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
3997 if (!err) {
3998 if (spec->board_config < 0) {
3999 printk(KERN_WARNING "hda_codec: No auto-config is "
4000 "available, default to model=ref\n");
4001 spec->board_config = STAC_92HD71BXX_REF;
4002 goto again;
4003 }
4004 err = -EINVAL;
4005 }
4006
4007 if (err < 0) {
4008 stac92xx_free(codec);
4009 return err;
4010 }
4011
4012 codec->patch_ops = stac92xx_patch_ops;
4013
4014 return 0;
4015 };
4016
4017 static int patch_stac922x(struct hda_codec *codec)
4018 {
4019 struct sigmatel_spec *spec;
4020 int err;
4021
4022 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4023 if (spec == NULL)
4024 return -ENOMEM;
4025
4026 codec->spec = spec;
4027 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
4028 spec->pin_nids = stac922x_pin_nids;
4029 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
4030 stac922x_models,
4031 stac922x_cfg_tbl);
4032 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
4033 spec->gpio_mask = spec->gpio_dir = 0x03;
4034 spec->gpio_data = 0x03;
4035 /* Intel Macs have all same PCI SSID, so we need to check
4036 * codec SSID to distinguish the exact models
4037 */
4038 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
4039 switch (codec->subsystem_id) {
4040
4041 case 0x106b0800:
4042 spec->board_config = STAC_INTEL_MAC_V1;
4043 break;
4044 case 0x106b0600:
4045 case 0x106b0700:
4046 spec->board_config = STAC_INTEL_MAC_V2;
4047 break;
4048 case 0x106b0e00:
4049 case 0x106b0f00:
4050 case 0x106b1600:
4051 case 0x106b1700:
4052 case 0x106b0200:
4053 case 0x106b1e00:
4054 spec->board_config = STAC_INTEL_MAC_V3;
4055 break;
4056 case 0x106b1a00:
4057 case 0x00000100:
4058 spec->board_config = STAC_INTEL_MAC_V4;
4059 break;
4060 case 0x106b0a00:
4061 case 0x106b2200:
4062 spec->board_config = STAC_INTEL_MAC_V5;
4063 break;
4064 default:
4065 spec->board_config = STAC_INTEL_MAC_V3;
4066 break;
4067 }
4068 }
4069
4070 again:
4071 if (spec->board_config < 0) {
4072 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
4073 "using BIOS defaults\n");
4074 err = stac92xx_save_bios_config_regs(codec);
4075 if (err < 0) {
4076 stac92xx_free(codec);
4077 return err;
4078 }
4079 spec->pin_configs = spec->bios_pin_configs;
4080 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
4081 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
4082 stac92xx_set_config_regs(codec);
4083 }
4084
4085 spec->adc_nids = stac922x_adc_nids;
4086 spec->mux_nids = stac922x_mux_nids;
4087 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
4088 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
4089 spec->num_dmics = 0;
4090 spec->num_pwrs = 0;
4091
4092 spec->init = stac922x_core_init;
4093 spec->mixer = stac922x_mixer;
4094
4095 spec->multiout.dac_nids = spec->dac_nids;
4096
4097 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
4098 if (!err) {
4099 if (spec->board_config < 0) {
4100 printk(KERN_WARNING "hda_codec: No auto-config is "
4101 "available, default to model=ref\n");
4102 spec->board_config = STAC_D945_REF;
4103 goto again;
4104 }
4105 err = -EINVAL;
4106 }
4107 if (err < 0) {
4108 stac92xx_free(codec);
4109 return err;
4110 }
4111
4112 codec->patch_ops = stac92xx_patch_ops;
4113
4114 /* Fix Mux capture level; max to 2 */
4115 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4116 (0 << AC_AMPCAP_OFFSET_SHIFT) |
4117 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4118 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4119 (0 << AC_AMPCAP_MUTE_SHIFT));
4120
4121 return 0;
4122 }
4123
4124 static int patch_stac927x(struct hda_codec *codec)
4125 {
4126 struct sigmatel_spec *spec;
4127 int err;
4128
4129 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4130 if (spec == NULL)
4131 return -ENOMEM;
4132
4133 codec->spec = spec;
4134 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
4135 spec->pin_nids = stac927x_pin_nids;
4136 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
4137 stac927x_models,
4138 stac927x_cfg_tbl);
4139 again:
4140 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
4141 if (spec->board_config < 0)
4142 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4143 "STAC927x, using BIOS defaults\n");
4144 err = stac92xx_save_bios_config_regs(codec);
4145 if (err < 0) {
4146 stac92xx_free(codec);
4147 return err;
4148 }
4149 spec->pin_configs = spec->bios_pin_configs;
4150 } else {
4151 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
4152 stac92xx_set_config_regs(codec);
4153 }
4154
4155 spec->digbeep_nid = 0x23;
4156 spec->adc_nids = stac927x_adc_nids;
4157 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
4158 spec->mux_nids = stac927x_mux_nids;
4159 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
4160 spec->dac_list = stac927x_dac_nids;
4161 spec->multiout.dac_nids = spec->dac_nids;
4162
4163 switch (spec->board_config) {
4164 case STAC_D965_3ST:
4165 case STAC_D965_5ST:
4166 /* GPIO0 High = Enable EAPD */
4167 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
4168 spec->gpio_data = 0x01;
4169 spec->num_dmics = 0;
4170
4171 spec->init = d965_core_init;
4172 spec->mixer = stac927x_mixer;
4173 break;
4174 case STAC_DELL_BIOS:
4175 switch (codec->subsystem_id) {
4176 case 0x10280209:
4177 case 0x1028022e:
4178 /* correct the device field to SPDIF out */
4179 stac92xx_set_config_reg(codec, 0x21, 0x01442070);
4180 break;
4181 };
4182 /* configure the analog microphone on some laptops */
4183 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130);
4184 /* correct the front output jack as a hp out */
4185 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f);
4186 /* correct the front input jack as a mic */
4187 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
4188 /* fallthru */
4189 case STAC_DELL_3ST:
4190 /* GPIO2 High = Enable EAPD */
4191 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
4192 spec->gpio_data = 0x04;
4193 spec->dmic_nids = stac927x_dmic_nids;
4194 spec->num_dmics = STAC927X_NUM_DMICS;
4195
4196 spec->init = d965_core_init;
4197 spec->mixer = stac927x_mixer;
4198 spec->dmux_nids = stac927x_dmux_nids;
4199 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
4200 break;
4201 default:
4202 /* GPIO0 High = Enable EAPD */
4203 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4204 spec->gpio_data = 0x01;
4205 spec->num_dmics = 0;
4206
4207 spec->init = stac927x_core_init;
4208 spec->mixer = stac927x_mixer;
4209 }
4210
4211 spec->num_pwrs = 0;
4212 spec->aloopback_mask = 0x40;
4213 spec->aloopback_shift = 0;
4214
4215 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
4216 if (!err) {
4217 if (spec->board_config < 0) {
4218 printk(KERN_WARNING "hda_codec: No auto-config is "
4219 "available, default to model=ref\n");
4220 spec->board_config = STAC_D965_REF;
4221 goto again;
4222 }
4223 err = -EINVAL;
4224 }
4225 if (err < 0) {
4226 stac92xx_free(codec);
4227 return err;
4228 }
4229
4230 codec->patch_ops = stac92xx_patch_ops;
4231
4232 /*
4233 * !!FIXME!!
4234 * The STAC927x seem to require fairly long delays for certain
4235 * command sequences. With too short delays (even if the answer
4236 * is set to RIRB properly), it results in the silence output
4237 * on some hardwares like Dell.
4238 *
4239 * The below flag enables the longer delay (see get_response
4240 * in hda_intel.c).
4241 */
4242 codec->bus->needs_damn_long_delay = 1;
4243
4244 return 0;
4245 }
4246
4247 static int patch_stac9205(struct hda_codec *codec)
4248 {
4249 struct sigmatel_spec *spec;
4250 int err;
4251
4252 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4253 if (spec == NULL)
4254 return -ENOMEM;
4255
4256 codec->spec = spec;
4257 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
4258 spec->pin_nids = stac9205_pin_nids;
4259 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
4260 stac9205_models,
4261 stac9205_cfg_tbl);
4262 again:
4263 if (spec->board_config < 0) {
4264 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
4265 err = stac92xx_save_bios_config_regs(codec);
4266 if (err < 0) {
4267 stac92xx_free(codec);
4268 return err;
4269 }
4270 spec->pin_configs = spec->bios_pin_configs;
4271 } else {
4272 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
4273 stac92xx_set_config_regs(codec);
4274 }
4275
4276 spec->digbeep_nid = 0x23;
4277 spec->adc_nids = stac9205_adc_nids;
4278 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
4279 spec->mux_nids = stac9205_mux_nids;
4280 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
4281 spec->dmic_nids = stac9205_dmic_nids;
4282 spec->num_dmics = STAC9205_NUM_DMICS;
4283 spec->dmux_nids = stac9205_dmux_nids;
4284 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
4285 spec->num_pwrs = 0;
4286
4287 spec->init = stac9205_core_init;
4288 spec->mixer = stac9205_mixer;
4289
4290 spec->aloopback_mask = 0x40;
4291 spec->aloopback_shift = 0;
4292 spec->multiout.dac_nids = spec->dac_nids;
4293
4294 switch (spec->board_config){
4295 case STAC_9205_DELL_M43:
4296 /* Enable SPDIF in/out */
4297 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
4298 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
4299
4300 /* Enable unsol response for GPIO4/Dock HP connection */
4301 snd_hda_codec_write(codec, codec->afg, 0,
4302 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
4303 snd_hda_codec_write_cache(codec, codec->afg, 0,
4304 AC_VERB_SET_UNSOLICITED_ENABLE,
4305 (AC_USRSP_EN | STAC_HP_EVENT));
4306
4307 spec->gpio_dir = 0x0b;
4308 spec->eapd_mask = 0x01;
4309 spec->gpio_mask = 0x1b;
4310 spec->gpio_mute = 0x10;
4311 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4312 * GPIO3 Low = DRM
4313 */
4314 spec->gpio_data = 0x01;
4315 break;
4316 default:
4317 /* GPIO0 High = EAPD */
4318 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4319 spec->gpio_data = 0x01;
4320 break;
4321 }
4322
4323 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
4324 if (!err) {
4325 if (spec->board_config < 0) {
4326 printk(KERN_WARNING "hda_codec: No auto-config is "
4327 "available, default to model=ref\n");
4328 spec->board_config = STAC_9205_REF;
4329 goto again;
4330 }
4331 err = -EINVAL;
4332 }
4333 if (err < 0) {
4334 stac92xx_free(codec);
4335 return err;
4336 }
4337
4338 codec->patch_ops = stac92xx_patch_ops;
4339
4340 return 0;
4341 }
4342
4343 /*
4344 * STAC9872 hack
4345 */
4346
4347 /* static config for Sony VAIO FE550G and Sony VAIO AR */
4348 static hda_nid_t vaio_dacs[] = { 0x2 };
4349 #define VAIO_HP_DAC 0x5
4350 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
4351 static hda_nid_t vaio_mux_nids[] = { 0x15 };
4352
4353 static struct hda_input_mux vaio_mux = {
4354 .num_items = 3,
4355 .items = {
4356 /* { "HP", 0x0 }, */
4357 { "Mic Jack", 0x1 },
4358 { "Internal Mic", 0x2 },
4359 { "PCM", 0x3 },
4360 }
4361 };
4362
4363 static struct hda_verb vaio_init[] = {
4364 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
4365 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
4366 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
4367 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
4368 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
4369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
4370 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
4371 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
4372 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
4373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4376 {}
4377 };
4378
4379 static struct hda_verb vaio_ar_init[] = {
4380 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
4381 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
4382 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
4383 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
4384 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
4385 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
4386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
4387 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
4388 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
4389 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
4390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4393 {}
4394 };
4395
4396 /* bind volumes of both NID 0x02 and 0x05 */
4397 static struct hda_bind_ctls vaio_bind_master_vol = {
4398 .ops = &snd_hda_bind_vol,
4399 .values = {
4400 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4401 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4402 0
4403 },
4404 };
4405
4406 /* bind volumes of both NID 0x02 and 0x05 */
4407 static struct hda_bind_ctls vaio_bind_master_sw = {
4408 .ops = &snd_hda_bind_sw,
4409 .values = {
4410 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4411 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4412 0,
4413 },
4414 };
4415
4416 static struct snd_kcontrol_new vaio_mixer[] = {
4417 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4418 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4419 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4420 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4421 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4422 {
4423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4424 .name = "Capture Source",
4425 .count = 1,
4426 .info = stac92xx_mux_enum_info,
4427 .get = stac92xx_mux_enum_get,
4428 .put = stac92xx_mux_enum_put,
4429 },
4430 {}
4431 };
4432
4433 static struct snd_kcontrol_new vaio_ar_mixer[] = {
4434 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4435 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4436 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4437 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4438 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4439 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4440 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4441 {
4442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4443 .name = "Capture Source",
4444 .count = 1,
4445 .info = stac92xx_mux_enum_info,
4446 .get = stac92xx_mux_enum_get,
4447 .put = stac92xx_mux_enum_put,
4448 },
4449 {}
4450 };
4451
4452 static struct hda_codec_ops stac9872_patch_ops = {
4453 .build_controls = stac92xx_build_controls,
4454 .build_pcms = stac92xx_build_pcms,
4455 .init = stac92xx_init,
4456 .free = stac92xx_free,
4457 #ifdef SND_HDA_NEEDS_RESUME
4458 .resume = stac92xx_resume,
4459 #endif
4460 };
4461
4462 static int stac9872_vaio_init(struct hda_codec *codec)
4463 {
4464 int err;
4465
4466 err = stac92xx_init(codec);
4467 if (err < 0)
4468 return err;
4469 if (codec->patch_ops.unsol_event)
4470 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
4471 return 0;
4472 }
4473
4474 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
4475 {
4476 if (get_hp_pin_presence(codec, 0x0a)) {
4477 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4478 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4479 } else {
4480 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4481 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4482 }
4483 }
4484
4485 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
4486 {
4487 switch (res >> 26) {
4488 case STAC_HP_EVENT:
4489 stac9872_vaio_hp_detect(codec, res);
4490 break;
4491 }
4492 }
4493
4494 static struct hda_codec_ops stac9872_vaio_patch_ops = {
4495 .build_controls = stac92xx_build_controls,
4496 .build_pcms = stac92xx_build_pcms,
4497 .init = stac9872_vaio_init,
4498 .free = stac92xx_free,
4499 .unsol_event = stac9872_vaio_unsol_event,
4500 #ifdef CONFIG_PM
4501 .resume = stac92xx_resume,
4502 #endif
4503 };
4504
4505 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4506 CXD9872RD_VAIO,
4507 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4508 STAC9872AK_VAIO,
4509 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4510 STAC9872K_VAIO,
4511 /* AR Series. id=0x83847664 and subsys=104D1300 */
4512 CXD9872AKD_VAIO,
4513 STAC_9872_MODELS,
4514 };
4515
4516 static const char *stac9872_models[STAC_9872_MODELS] = {
4517 [CXD9872RD_VAIO] = "vaio",
4518 [CXD9872AKD_VAIO] = "vaio-ar",
4519 };
4520
4521 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
4522 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
4523 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
4524 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
4525 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
4526 {}
4527 };
4528
4529 static int patch_stac9872(struct hda_codec *codec)
4530 {
4531 struct sigmatel_spec *spec;
4532 int board_config;
4533
4534 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
4535 stac9872_models,
4536 stac9872_cfg_tbl);
4537 if (board_config < 0)
4538 /* unknown config, let generic-parser do its job... */
4539 return snd_hda_parse_generic_codec(codec);
4540
4541 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4542 if (spec == NULL)
4543 return -ENOMEM;
4544
4545 codec->spec = spec;
4546 switch (board_config) {
4547 case CXD9872RD_VAIO:
4548 case STAC9872AK_VAIO:
4549 case STAC9872K_VAIO:
4550 spec->mixer = vaio_mixer;
4551 spec->init = vaio_init;
4552 spec->multiout.max_channels = 2;
4553 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4554 spec->multiout.dac_nids = vaio_dacs;
4555 spec->multiout.hp_nid = VAIO_HP_DAC;
4556 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4557 spec->adc_nids = vaio_adcs;
4558 spec->num_pwrs = 0;
4559 spec->input_mux = &vaio_mux;
4560 spec->mux_nids = vaio_mux_nids;
4561 codec->patch_ops = stac9872_vaio_patch_ops;
4562 break;
4563
4564 case CXD9872AKD_VAIO:
4565 spec->mixer = vaio_ar_mixer;
4566 spec->init = vaio_ar_init;
4567 spec->multiout.max_channels = 2;
4568 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4569 spec->multiout.dac_nids = vaio_dacs;
4570 spec->multiout.hp_nid = VAIO_HP_DAC;
4571 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4572 spec->num_pwrs = 0;
4573 spec->adc_nids = vaio_adcs;
4574 spec->input_mux = &vaio_mux;
4575 spec->mux_nids = vaio_mux_nids;
4576 codec->patch_ops = stac9872_patch_ops;
4577 break;
4578 }
4579
4580 return 0;
4581 }
4582
4583
4584 /*
4585 * patch entries
4586 */
4587 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
4588 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4589 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4590 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4591 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4592 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4593 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4594 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
4595 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4596 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4597 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4598 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4599 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4600 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
4601 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4602 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4603 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4604 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4605 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4606 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4607 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4608 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4609 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4610 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
4611 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4612 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4613 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4614 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4615 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4616 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
4617 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
4618 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
4619 /* The following does not take into account .id=0x83847661 when subsys =
4620 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4621 * currently not fully supported.
4622 */
4623 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4624 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4625 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
4626 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4627 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4628 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4629 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4630 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4631 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4632 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4633 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
4634 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
4635 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
4636 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
4637 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
4638 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4639 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
4640 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4641 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4642 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4643 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4644 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4645 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4646 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4647 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4648 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4649 {} /* terminator */
4650 };
This page took 0.405821 seconds and 5 git commands to generate.