GNU Linux-libre 4.14.257-gnu1
[releases.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 <linux/dmi.h>
32 #include <linux/module.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
38 #include "hda_beep.h"
39 #include "hda_jack.h"
40 #include "hda_generic.h"
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_M4,
56         STAC_9200_M4_2,
57         STAC_9200_PANASONIC,
58         STAC_9200_EAPD_INIT,
59         STAC_9200_MODELS
60 };
61
62 enum {
63         STAC_9205_REF,
64         STAC_9205_DELL_M42,
65         STAC_9205_DELL_M43,
66         STAC_9205_DELL_M44,
67         STAC_9205_EAPD,
68         STAC_9205_MODELS
69 };
70
71 enum {
72         STAC_92HD73XX_NO_JD, /* no jack-detection */
73         STAC_92HD73XX_REF,
74         STAC_92HD73XX_INTEL,
75         STAC_DELL_M6_AMIC,
76         STAC_DELL_M6_DMIC,
77         STAC_DELL_M6_BOTH,
78         STAC_DELL_EQ,
79         STAC_ALIENWARE_M17X,
80         STAC_ELO_VUPOINT_15MX,
81         STAC_92HD89XX_HP_FRONT_JACK,
82         STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
83         STAC_92HD73XX_ASUS_MOBO,
84         STAC_92HD73XX_MODELS
85 };
86
87 enum {
88         STAC_92HD83XXX_REF,
89         STAC_92HD83XXX_PWR_REF,
90         STAC_DELL_S14,
91         STAC_DELL_VOSTRO_3500,
92         STAC_92HD83XXX_HP_cNB11_INTQUAD,
93         STAC_HP_DV7_4000,
94         STAC_HP_ZEPHYR,
95         STAC_92HD83XXX_HP_LED,
96         STAC_92HD83XXX_HP_INV_LED,
97         STAC_92HD83XXX_HP_MIC_LED,
98         STAC_HP_LED_GPIO10,
99         STAC_92HD83XXX_HEADSET_JACK,
100         STAC_92HD83XXX_HP,
101         STAC_HP_ENVY_BASS,
102         STAC_HP_BNB13_EQ,
103         STAC_HP_ENVY_TS_BASS,
104         STAC_HP_ENVY_TS_DAC_BIND,
105         STAC_92HD83XXX_GPIO10_EAPD,
106         STAC_92HD83XXX_MODELS
107 };
108
109 enum {
110         STAC_92HD71BXX_REF,
111         STAC_DELL_M4_1,
112         STAC_DELL_M4_2,
113         STAC_DELL_M4_3,
114         STAC_HP_M4,
115         STAC_HP_DV4,
116         STAC_HP_DV5,
117         STAC_HP_HDX,
118         STAC_92HD71BXX_HP,
119         STAC_92HD71BXX_NO_DMIC,
120         STAC_92HD71BXX_NO_SMUX,
121         STAC_92HD71BXX_MODELS
122 };
123
124 enum {
125         STAC_92HD95_HP_LED,
126         STAC_92HD95_HP_BASS,
127         STAC_92HD95_MODELS
128 };
129
130 enum {
131         STAC_925x_REF,
132         STAC_M1,
133         STAC_M1_2,
134         STAC_M2,
135         STAC_M2_2,
136         STAC_M3,
137         STAC_M5,
138         STAC_M6,
139         STAC_925x_MODELS
140 };
141
142 enum {
143         STAC_D945_REF,
144         STAC_D945GTP3,
145         STAC_D945GTP5,
146         STAC_INTEL_MAC_V1,
147         STAC_INTEL_MAC_V2,
148         STAC_INTEL_MAC_V3,
149         STAC_INTEL_MAC_V4,
150         STAC_INTEL_MAC_V5,
151         STAC_INTEL_MAC_AUTO,
152         STAC_ECS_202,
153         STAC_922X_DELL_D81,
154         STAC_922X_DELL_D82,
155         STAC_922X_DELL_M81,
156         STAC_922X_DELL_M82,
157         STAC_922X_INTEL_MAC_GPIO,
158         STAC_922X_MODELS
159 };
160
161 enum {
162         STAC_D965_REF_NO_JD, /* no jack-detection */
163         STAC_D965_REF,
164         STAC_D965_3ST,
165         STAC_D965_5ST,
166         STAC_D965_5ST_NO_FP,
167         STAC_D965_VERBS,
168         STAC_DELL_3ST,
169         STAC_DELL_BIOS,
170         STAC_NEMO_DEFAULT,
171         STAC_DELL_BIOS_AMIC,
172         STAC_DELL_BIOS_SPDIF,
173         STAC_927X_DELL_DMIC,
174         STAC_927X_VOLKNOB,
175         STAC_927X_MODELS
176 };
177
178 enum {
179         STAC_9872_VAIO,
180         STAC_9872_MODELS
181 };
182
183 struct sigmatel_spec {
184         struct hda_gen_spec gen;
185
186         unsigned int eapd_switch: 1;
187         unsigned int linear_tone_beep:1;
188         unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
189         unsigned int volknob_init:1; /* special volume-knob initialization */
190         unsigned int powerdown_adcs:1;
191         unsigned int have_spdif_mux:1;
192
193         /* gpio lines */
194         unsigned int eapd_mask;
195         unsigned int gpio_mask;
196         unsigned int gpio_dir;
197         unsigned int gpio_data;
198         unsigned int gpio_mute;
199         unsigned int gpio_led;
200         unsigned int gpio_led_polarity;
201         unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
202         unsigned int vref_led;
203         int default_polarity;
204
205         unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
206         unsigned int mic_enabled; /* current mic mute state (bitmask) */
207
208         /* stream */
209         unsigned int stream_delay;
210
211         /* analog loopback */
212         const struct snd_kcontrol_new *aloopback_ctl;
213         unsigned int aloopback;
214         unsigned char aloopback_mask;
215         unsigned char aloopback_shift;
216
217         /* power management */
218         unsigned int power_map_bits;
219         unsigned int num_pwrs;
220         const hda_nid_t *pwr_nids;
221         unsigned int active_adcs;
222
223         /* beep widgets */
224         hda_nid_t anabeep_nid;
225
226         /* SPDIF-out mux */
227         const char * const *spdif_labels;
228         struct hda_input_mux spdif_mux;
229         unsigned int cur_smux[2];
230 };
231
232 #define AC_VERB_IDT_SET_POWER_MAP       0x7ec
233 #define AC_VERB_IDT_GET_POWER_MAP       0xfec
234
235 static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
236         0x0a, 0x0b, 0x0c, 0xd, 0x0e,
237         0x0f, 0x10, 0x11
238 };
239
240 static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
241         0x0a, 0x0b, 0x0c, 0xd, 0x0e,
242         0x0f, 0x10
243 };
244
245 static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
246         0x0a, 0x0d, 0x0f
247 };
248
249
250 /*
251  * PCM hooks
252  */
253 static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
254                                    struct hda_codec *codec,
255                                    struct snd_pcm_substream *substream,
256                                    int action)
257 {
258         struct sigmatel_spec *spec = codec->spec;
259         if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
260                 msleep(spec->stream_delay);
261 }
262
263 static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
264                                   struct hda_codec *codec,
265                                   struct snd_pcm_substream *substream,
266                                   int action)
267 {
268         struct sigmatel_spec *spec = codec->spec;
269         int i, idx = 0;
270
271         if (!spec->powerdown_adcs)
272                 return;
273
274         for (i = 0; i < spec->gen.num_all_adcs; i++) {
275                 if (spec->gen.all_adcs[i] == hinfo->nid) {
276                         idx = i;
277                         break;
278                 }
279         }
280
281         switch (action) {
282         case HDA_GEN_PCM_ACT_OPEN:
283                 msleep(40);
284                 snd_hda_codec_write(codec, hinfo->nid, 0,
285                                     AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
286                 spec->active_adcs |= (1 << idx);
287                 break;
288         case HDA_GEN_PCM_ACT_CLOSE:
289                 snd_hda_codec_write(codec, hinfo->nid, 0,
290                                     AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
291                 spec->active_adcs &= ~(1 << idx);
292                 break;
293         }
294 }
295
296 /*
297  * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
298  * funky external mute control using GPIO pins.
299  */
300
301 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
302                           unsigned int dir_mask, unsigned int data)
303 {
304         unsigned int gpiostate, gpiomask, gpiodir;
305         hda_nid_t fg = codec->core.afg;
306
307         codec_dbg(codec, "%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
308
309         gpiostate = snd_hda_codec_read(codec, fg, 0,
310                                        AC_VERB_GET_GPIO_DATA, 0);
311         gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
312
313         gpiomask = snd_hda_codec_read(codec, fg, 0,
314                                       AC_VERB_GET_GPIO_MASK, 0);
315         gpiomask |= mask;
316
317         gpiodir = snd_hda_codec_read(codec, fg, 0,
318                                      AC_VERB_GET_GPIO_DIRECTION, 0);
319         gpiodir |= dir_mask;
320
321         /* Configure GPIOx as CMOS */
322         snd_hda_codec_write(codec, fg, 0, 0x7e7, 0);
323
324         snd_hda_codec_write(codec, fg, 0,
325                             AC_VERB_SET_GPIO_MASK, gpiomask);
326         snd_hda_codec_read(codec, fg, 0,
327                            AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
328
329         msleep(1);
330
331         snd_hda_codec_read(codec, fg, 0,
332                            AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
333 }
334
335 /* hook for controlling mic-mute LED GPIO */
336 static void stac_capture_led_hook(struct hda_codec *codec,
337                                   struct snd_kcontrol *kcontrol,
338                                   struct snd_ctl_elem_value *ucontrol)
339 {
340         struct sigmatel_spec *spec = codec->spec;
341         unsigned int mask;
342         bool cur_mute, prev_mute;
343
344         if (!kcontrol || !ucontrol)
345                 return;
346
347         mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
348         prev_mute = !spec->mic_enabled;
349         if (ucontrol->value.integer.value[0] ||
350             ucontrol->value.integer.value[1])
351                 spec->mic_enabled |= mask;
352         else
353                 spec->mic_enabled &= ~mask;
354         cur_mute = !spec->mic_enabled;
355         if (cur_mute != prev_mute) {
356                 if (cur_mute)
357                         spec->gpio_data |= spec->mic_mute_led_gpio;
358                 else
359                         spec->gpio_data &= ~spec->mic_mute_led_gpio;
360                 stac_gpio_set(codec, spec->gpio_mask,
361                               spec->gpio_dir, spec->gpio_data);
362         }
363 }
364
365 static int stac_vrefout_set(struct hda_codec *codec,
366                                         hda_nid_t nid, unsigned int new_vref)
367 {
368         int error, pinctl;
369
370         codec_dbg(codec, "%s, nid %x ctl %x\n", __func__, nid, new_vref);
371         pinctl = snd_hda_codec_read(codec, nid, 0,
372                                 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
373
374         if (pinctl < 0)
375                 return pinctl;
376
377         pinctl &= 0xff;
378         pinctl &= ~AC_PINCTL_VREFEN;
379         pinctl |= (new_vref & AC_PINCTL_VREFEN);
380
381         error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
382         if (error < 0)
383                 return error;
384
385         return 1;
386 }
387
388 /* prevent codec AFG to D3 state when vref-out pin is used for mute LED */
389 /* this hook is set in stac_setup_gpio() */
390 static unsigned int stac_vref_led_power_filter(struct hda_codec *codec,
391                                                hda_nid_t nid,
392                                                unsigned int power_state)
393 {
394         if (nid == codec->core.afg && power_state == AC_PWRST_D3)
395                 return AC_PWRST_D1;
396         return snd_hda_gen_path_power_filter(codec, nid, power_state);
397 }
398
399 /* update mute-LED accoring to the master switch */
400 static void stac_update_led_status(struct hda_codec *codec, int enabled)
401 {
402         struct sigmatel_spec *spec = codec->spec;
403         int muted = !enabled;
404
405         if (!spec->gpio_led)
406                 return;
407
408         /* LED state is inverted on these systems */
409         if (spec->gpio_led_polarity)
410                 muted = !muted;
411
412         if (!spec->vref_mute_led_nid) {
413                 if (muted)
414                         spec->gpio_data |= spec->gpio_led;
415                 else
416                         spec->gpio_data &= ~spec->gpio_led;
417                 stac_gpio_set(codec, spec->gpio_mask,
418                                 spec->gpio_dir, spec->gpio_data);
419         } else {
420                 spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
421                 stac_vrefout_set(codec, spec->vref_mute_led_nid,
422                                  spec->vref_led);
423         }
424 }
425
426 /* vmaster hook to update mute LED */
427 static void stac_vmaster_hook(void *private_data, int val)
428 {
429         stac_update_led_status(private_data, val);
430 }
431
432 /* automute hook to handle GPIO mute and EAPD updates */
433 static void stac_update_outputs(struct hda_codec *codec)
434 {
435         struct sigmatel_spec *spec = codec->spec;
436
437         if (spec->gpio_mute)
438                 spec->gen.master_mute =
439                         !(snd_hda_codec_read(codec, codec->core.afg, 0,
440                                 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
441
442         snd_hda_gen_update_outputs(codec);
443
444         if (spec->eapd_mask && spec->eapd_switch) {
445                 unsigned int val = spec->gpio_data;
446                 if (spec->gen.speaker_muted)
447                         val &= ~spec->eapd_mask;
448                 else
449                         val |= spec->eapd_mask;
450                 if (spec->gpio_data != val) {
451                         spec->gpio_data = val;
452                         stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
453                                       val);
454                 }
455         }
456 }
457
458 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
459                                   bool enable, bool do_write)
460 {
461         struct sigmatel_spec *spec = codec->spec;
462         unsigned int idx, val;
463
464         for (idx = 0; idx < spec->num_pwrs; idx++) {
465                 if (spec->pwr_nids[idx] == nid)
466                         break;
467         }
468         if (idx >= spec->num_pwrs)
469                 return;
470
471         idx = 1 << idx;
472
473         val = spec->power_map_bits;
474         if (enable)
475                 val &= ~idx;
476         else
477                 val |= idx;
478
479         /* power down unused output ports */
480         if (val != spec->power_map_bits) {
481                 spec->power_map_bits = val;
482                 if (do_write)
483                         snd_hda_codec_write(codec, codec->core.afg, 0,
484                                             AC_VERB_IDT_SET_POWER_MAP, val);
485         }
486 }
487
488 /* update power bit per jack plug/unplug */
489 static void jack_update_power(struct hda_codec *codec,
490                               struct hda_jack_callback *jack)
491 {
492         struct sigmatel_spec *spec = codec->spec;
493         int i;
494
495         if (!spec->num_pwrs)
496                 return;
497
498         if (jack && jack->nid) {
499                 stac_toggle_power_map(codec, jack->nid,
500                                       snd_hda_jack_detect(codec, jack->nid),
501                                       true);
502                 return;
503         }
504
505         /* update all jacks */
506         for (i = 0; i < spec->num_pwrs; i++) {
507                 hda_nid_t nid = spec->pwr_nids[i];
508                 if (!snd_hda_jack_tbl_get(codec, nid))
509                         continue;
510                 stac_toggle_power_map(codec, nid,
511                                       snd_hda_jack_detect(codec, nid),
512                                       false);
513         }
514
515         snd_hda_codec_write(codec, codec->core.afg, 0,
516                             AC_VERB_IDT_SET_POWER_MAP,
517                             spec->power_map_bits);
518 }
519
520 static void stac_vref_event(struct hda_codec *codec,
521                             struct hda_jack_callback *event)
522 {
523         unsigned int data;
524
525         data = snd_hda_codec_read(codec, codec->core.afg, 0,
526                                   AC_VERB_GET_GPIO_DATA, 0);
527         /* toggle VREF state based on GPIOx status */
528         snd_hda_codec_write(codec, codec->core.afg, 0, 0x7e0,
529                             !!(data & (1 << event->private_data)));
530 }
531
532 /* initialize the power map and enable the power event to jacks that
533  * haven't been assigned to automute
534  */
535 static void stac_init_power_map(struct hda_codec *codec)
536 {
537         struct sigmatel_spec *spec = codec->spec;
538         int i;
539
540         for (i = 0; i < spec->num_pwrs; i++)  {
541                 hda_nid_t nid = spec->pwr_nids[i];
542                 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
543                 def_conf = get_defcfg_connect(def_conf);
544                 if (def_conf == AC_JACK_PORT_COMPLEX &&
545                     spec->vref_mute_led_nid != nid &&
546                     is_jack_detectable(codec, nid)) {
547                         snd_hda_jack_detect_enable_callback(codec, nid,
548                                                             jack_update_power);
549                 } else {
550                         if (def_conf == AC_JACK_PORT_NONE)
551                                 stac_toggle_power_map(codec, nid, false, false);
552                         else
553                                 stac_toggle_power_map(codec, nid, true, false);
554                 }
555         }
556 }
557
558 /*
559  */
560
561 static inline bool get_int_hint(struct hda_codec *codec, const char *key,
562                                 int *valp)
563 {
564         return !snd_hda_get_int_hint(codec, key, valp);
565 }
566
567 /* override some hints from the hwdep entry */
568 static void stac_store_hints(struct hda_codec *codec)
569 {
570         struct sigmatel_spec *spec = codec->spec;
571         int val;
572
573         if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
574                 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
575                         spec->gpio_mask;
576         }
577         if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
578                 spec->gpio_dir &= spec->gpio_mask;
579         if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
580                 spec->gpio_data &= spec->gpio_mask;
581         if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
582                 spec->eapd_mask &= spec->gpio_mask;
583         if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
584                 spec->gpio_mute &= spec->gpio_mask;
585         val = snd_hda_get_bool_hint(codec, "eapd_switch");
586         if (val >= 0)
587                 spec->eapd_switch = val;
588 }
589
590 /*
591  * loopback controls
592  */
593
594 #define stac_aloopback_info snd_ctl_boolean_mono_info
595
596 static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
597                               struct snd_ctl_elem_value *ucontrol)
598 {
599         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
600         unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
601         struct sigmatel_spec *spec = codec->spec;
602
603         ucontrol->value.integer.value[0] = !!(spec->aloopback &
604                                               (spec->aloopback_mask << idx));
605         return 0;
606 }
607
608 static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
609                               struct snd_ctl_elem_value *ucontrol)
610 {
611         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
612         struct sigmatel_spec *spec = codec->spec;
613         unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
614         unsigned int dac_mode;
615         unsigned int val, idx_val;
616
617         idx_val = spec->aloopback_mask << idx;
618         if (ucontrol->value.integer.value[0])
619                 val = spec->aloopback | idx_val;
620         else
621                 val = spec->aloopback & ~idx_val;
622         if (spec->aloopback == val)
623                 return 0;
624
625         spec->aloopback = val;
626
627         /* Only return the bits defined by the shift value of the
628          * first two bytes of the mask
629          */
630         dac_mode = snd_hda_codec_read(codec, codec->core.afg, 0,
631                                       kcontrol->private_value & 0xFFFF, 0x0);
632         dac_mode >>= spec->aloopback_shift;
633
634         if (spec->aloopback & idx_val) {
635                 snd_hda_power_up(codec);
636                 dac_mode |= idx_val;
637         } else {
638                 snd_hda_power_down(codec);
639                 dac_mode &= ~idx_val;
640         }
641
642         snd_hda_codec_write_cache(codec, codec->core.afg, 0,
643                 kcontrol->private_value >> 16, dac_mode);
644
645         return 1;
646 }
647
648 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
649         { \
650                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
651                 .name  = "Analog Loopback", \
652                 .count = cnt, \
653                 .info  = stac_aloopback_info, \
654                 .get   = stac_aloopback_get, \
655                 .put   = stac_aloopback_put, \
656                 .private_value = verb_read | (verb_write << 16), \
657         }
658
659 /*
660  * Mute LED handling on HP laptops
661  */
662
663 /* check whether it's a HP laptop with a docking port */
664 static bool hp_bnb2011_with_dock(struct hda_codec *codec)
665 {
666         if (codec->core.vendor_id != 0x111d7605 &&
667             codec->core.vendor_id != 0x111d76d1)
668                 return false;
669
670         switch (codec->core.subsystem_id) {
671         case 0x103c1618:
672         case 0x103c1619:
673         case 0x103c161a:
674         case 0x103c161b:
675         case 0x103c161c:
676         case 0x103c161d:
677         case 0x103c161e:
678         case 0x103c161f:
679
680         case 0x103c162a:
681         case 0x103c162b:
682
683         case 0x103c1630:
684         case 0x103c1631:
685
686         case 0x103c1633:
687         case 0x103c1634:
688         case 0x103c1635:
689
690         case 0x103c3587:
691         case 0x103c3588:
692         case 0x103c3589:
693         case 0x103c358a:
694
695         case 0x103c3667:
696         case 0x103c3668:
697         case 0x103c3669:
698
699                 return true;
700         }
701         return false;
702 }
703
704 static bool hp_blike_system(u32 subsystem_id)
705 {
706         switch (subsystem_id) {
707         case 0x103c1473: /* HP ProBook 6550b */
708         case 0x103c1520:
709         case 0x103c1521:
710         case 0x103c1523:
711         case 0x103c1524:
712         case 0x103c1525:
713         case 0x103c1722:
714         case 0x103c1723:
715         case 0x103c1724:
716         case 0x103c1725:
717         case 0x103c1726:
718         case 0x103c1727:
719         case 0x103c1728:
720         case 0x103c1729:
721         case 0x103c172a:
722         case 0x103c172b:
723         case 0x103c307e:
724         case 0x103c307f:
725         case 0x103c3080:
726         case 0x103c3081:
727         case 0x103c7007:
728         case 0x103c7008:
729                 return true;
730         }
731         return false;
732 }
733
734 static void set_hp_led_gpio(struct hda_codec *codec)
735 {
736         struct sigmatel_spec *spec = codec->spec;
737         unsigned int gpio;
738
739         if (spec->gpio_led)
740                 return;
741
742         gpio = snd_hda_param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP);
743         gpio &= AC_GPIO_IO_COUNT;
744         if (gpio > 3)
745                 spec->gpio_led = 0x08; /* GPIO 3 */
746         else
747                 spec->gpio_led = 0x01; /* GPIO 0 */
748 }
749
750 /*
751  * This method searches for the mute LED GPIO configuration
752  * provided as OEM string in SMBIOS. The format of that string
753  * is HP_Mute_LED_P_G or HP_Mute_LED_P
754  * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
755  * that corresponds to the NOT muted state of the master volume
756  * and G is the index of the GPIO to use as the mute LED control (0..9)
757  * If _G portion is missing it is assigned based on the codec ID
758  *
759  * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
760  * or  HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
761  *
762  *
763  * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
764  * SMBIOS - at least the ones I have seen do not have them - which include
765  * my own system (HP Pavilion dv6-1110ax) and my cousin's
766  * HP Pavilion dv9500t CTO.
767  * Need more information on whether it is true across the entire series.
768  * -- kunal
769  */
770 static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
771 {
772         struct sigmatel_spec *spec = codec->spec;
773         const struct dmi_device *dev = NULL;
774
775         if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
776                 get_int_hint(codec, "gpio_led_polarity",
777                              &spec->gpio_led_polarity);
778                 return 1;
779         }
780
781         while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
782                 if (sscanf(dev->name, "HP_Mute_LED_%u_%x",
783                            &spec->gpio_led_polarity,
784                            &spec->gpio_led) == 2) {
785                         unsigned int max_gpio;
786                         max_gpio = snd_hda_param_read(codec, codec->core.afg,
787                                                       AC_PAR_GPIO_CAP);
788                         max_gpio &= AC_GPIO_IO_COUNT;
789                         if (spec->gpio_led < max_gpio)
790                                 spec->gpio_led = 1 << spec->gpio_led;
791                         else
792                                 spec->vref_mute_led_nid = spec->gpio_led;
793                         return 1;
794                 }
795                 if (sscanf(dev->name, "HP_Mute_LED_%u",
796                            &spec->gpio_led_polarity) == 1) {
797                         set_hp_led_gpio(codec);
798                         return 1;
799                 }
800                 /* BIOS bug: unfilled OEM string */
801                 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
802                         set_hp_led_gpio(codec);
803                         if (default_polarity >= 0)
804                                 spec->gpio_led_polarity = default_polarity;
805                         else
806                                 spec->gpio_led_polarity = 1;
807                         return 1;
808                 }
809         }
810
811         /*
812          * Fallback case - if we don't find the DMI strings,
813          * we statically set the GPIO - if not a B-series system
814          * and default polarity is provided
815          */
816         if (!hp_blike_system(codec->core.subsystem_id) &&
817             (default_polarity == 0 || default_polarity == 1)) {
818                 set_hp_led_gpio(codec);
819                 spec->gpio_led_polarity = default_polarity;
820                 return 1;
821         }
822         return 0;
823 }
824
825 /* check whether a built-in speaker is included in parsed pins */
826 static bool has_builtin_speaker(struct hda_codec *codec)
827 {
828         struct sigmatel_spec *spec = codec->spec;
829         hda_nid_t *nid_pin;
830         int nids, i;
831
832         if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
833                 nid_pin = spec->gen.autocfg.line_out_pins;
834                 nids = spec->gen.autocfg.line_outs;
835         } else {
836                 nid_pin = spec->gen.autocfg.speaker_pins;
837                 nids = spec->gen.autocfg.speaker_outs;
838         }
839
840         for (i = 0; i < nids; i++) {
841                 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
842                 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
843                         return true;
844         }
845         return false;
846 }
847
848 /*
849  * PC beep controls
850  */
851
852 /* create PC beep volume controls */
853 static int stac_auto_create_beep_ctls(struct hda_codec *codec,
854                                                 hda_nid_t nid)
855 {
856         struct sigmatel_spec *spec = codec->spec;
857         u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
858         struct snd_kcontrol_new *knew;
859         static struct snd_kcontrol_new abeep_mute_ctl =
860                 HDA_CODEC_MUTE(NULL, 0, 0, 0);
861         static struct snd_kcontrol_new dbeep_mute_ctl =
862                 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
863         static struct snd_kcontrol_new beep_vol_ctl =
864                 HDA_CODEC_VOLUME(NULL, 0, 0, 0);
865
866         /* check for mute support for the amp */
867         if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
868                 const struct snd_kcontrol_new *temp;
869                 if (spec->anabeep_nid == nid)
870                         temp = &abeep_mute_ctl;
871                 else
872                         temp = &dbeep_mute_ctl;
873                 knew = snd_hda_gen_add_kctl(&spec->gen,
874                                             "Beep Playback Switch", temp);
875                 if (!knew)
876                         return -ENOMEM;
877                 knew->private_value =
878                         HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
879         }
880
881         /* check to see if there is volume support for the amp */
882         if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
883                 knew = snd_hda_gen_add_kctl(&spec->gen,
884                                             "Beep Playback Volume",
885                                             &beep_vol_ctl);
886                 if (!knew)
887                         return -ENOMEM;
888                 knew->private_value =
889                         HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
890         }
891         return 0;
892 }
893
894 #ifdef CONFIG_SND_HDA_INPUT_BEEP
895 #define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
896
897 static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
898                                     struct snd_ctl_elem_value *ucontrol)
899 {
900         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
901         ucontrol->value.integer.value[0] = codec->beep->enabled;
902         return 0;
903 }
904
905 static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
906                                     struct snd_ctl_elem_value *ucontrol)
907 {
908         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
909         return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
910 }
911
912 static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
913         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
914         .name = "Beep Playback Switch",
915         .info = stac_dig_beep_switch_info,
916         .get = stac_dig_beep_switch_get,
917         .put = stac_dig_beep_switch_put,
918 };
919
920 static int stac_beep_switch_ctl(struct hda_codec *codec)
921 {
922         struct sigmatel_spec *spec = codec->spec;
923
924         if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
925                 return -ENOMEM;
926         return 0;
927 }
928 #endif
929
930 /*
931  * SPDIF-out mux controls
932  */
933
934 static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
935                                struct snd_ctl_elem_info *uinfo)
936 {
937         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
938         struct sigmatel_spec *spec = codec->spec;
939         return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
940 }
941
942 static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
943                               struct snd_ctl_elem_value *ucontrol)
944 {
945         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
946         struct sigmatel_spec *spec = codec->spec;
947         unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
948
949         ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
950         return 0;
951 }
952
953 static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
954                               struct snd_ctl_elem_value *ucontrol)
955 {
956         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
957         struct sigmatel_spec *spec = codec->spec;
958         unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
959
960         return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
961                                      spec->gen.autocfg.dig_out_pins[smux_idx],
962                                      &spec->cur_smux[smux_idx]);
963 }
964
965 static const struct snd_kcontrol_new stac_smux_mixer = {
966         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
967         .name = "IEC958 Playback Source",
968         /* count set later */
969         .info = stac_smux_enum_info,
970         .get = stac_smux_enum_get,
971         .put = stac_smux_enum_put,
972 };
973
974 static const char * const stac_spdif_labels[] = {
975         "Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
976 };
977
978 static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
979 {
980         struct sigmatel_spec *spec = codec->spec;
981         struct auto_pin_cfg *cfg = &spec->gen.autocfg;
982         const char * const *labels = spec->spdif_labels;
983         struct snd_kcontrol_new *kctl;
984         int i, num_cons;
985
986         if (cfg->dig_outs < 1)
987                 return 0;
988
989         num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
990         if (num_cons <= 1)
991                 return 0;
992
993         if (!labels)
994                 labels = stac_spdif_labels;
995         for (i = 0; i < num_cons; i++) {
996                 if (snd_BUG_ON(!labels[i]))
997                         return -EINVAL;
998                 snd_hda_add_imux_item(codec, &spec->spdif_mux, labels[i], i, NULL);
999         }
1000
1001         kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
1002         if (!kctl)
1003                 return -ENOMEM;
1004         kctl->count = cfg->dig_outs;
1005
1006         return 0;
1007 }
1008
1009 /*
1010  */
1011
1012 static const struct hda_verb stac9200_core_init[] = {
1013         /* set dac0mux for dac converter */
1014         { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1015         {}
1016 };
1017
1018 static const struct hda_verb stac9200_eapd_init[] = {
1019         /* set dac0mux for dac converter */
1020         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1021         {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1022         {}
1023 };
1024
1025 static const struct hda_verb dell_eq_core_init[] = {
1026         /* set master volume to max value without distortion
1027          * and direct control */
1028         { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
1029         {}
1030 };
1031
1032 static const struct hda_verb stac92hd73xx_core_init[] = {
1033         /* set master volume and direct control */
1034         { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1035         {}
1036 };
1037
1038 static const struct hda_verb stac92hd83xxx_core_init[] = {
1039         /* power state controls amps */
1040         { 0x01, AC_VERB_SET_EAPD, 1 << 2},
1041         {}
1042 };
1043
1044 static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
1045         { 0x22, 0x785, 0x43 },
1046         { 0x22, 0x782, 0xe0 },
1047         { 0x22, 0x795, 0x00 },
1048         {}
1049 };
1050
1051 static const struct hda_verb stac92hd71bxx_core_init[] = {
1052         /* set master volume and direct control */
1053         { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1054         {}
1055 };
1056
1057 static const hda_nid_t stac92hd71bxx_unmute_nids[] = {
1058         /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
1059         0x0f, 0x0a, 0x0d, 0
1060 };
1061
1062 static const struct hda_verb stac925x_core_init[] = {
1063         /* set dac0mux for dac converter */
1064         { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
1065         /* mute the master volume */
1066         { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1067         {}
1068 };
1069
1070 static const struct hda_verb stac922x_core_init[] = {
1071         /* set master volume and direct control */
1072         { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1073         {}
1074 };
1075
1076 static const struct hda_verb d965_core_init[] = {
1077         /* unmute node 0x1b */
1078         { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1079         /* select node 0x03 as DAC */
1080         { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1081         {}
1082 };
1083
1084 static const struct hda_verb dell_3st_core_init[] = {
1085         /* don't set delta bit */
1086         {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1087         /* unmute node 0x1b */
1088         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1089         /* select node 0x03 as DAC */
1090         {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1091         {}
1092 };
1093
1094 static const struct hda_verb stac927x_core_init[] = {
1095         /* set master volume and direct control */
1096         { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1097         /* enable analog pc beep path */
1098         { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1099         {}
1100 };
1101
1102 static const struct hda_verb stac927x_volknob_core_init[] = {
1103         /* don't set delta bit */
1104         {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1105         /* enable analog pc beep path */
1106         {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1107         {}
1108 };
1109
1110 static const struct hda_verb stac9205_core_init[] = {
1111         /* set master volume and direct control */
1112         { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1113         /* enable analog pc beep path */
1114         { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1115         {}
1116 };
1117
1118 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
1119         STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
1120
1121 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
1122         STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
1123
1124 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
1125         STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
1126
1127 static const struct snd_kcontrol_new stac92hd71bxx_loopback =
1128         STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
1129
1130 static const struct snd_kcontrol_new stac9205_loopback =
1131         STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
1132
1133 static const struct snd_kcontrol_new stac927x_loopback =
1134         STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
1135
1136 static const struct hda_pintbl ref9200_pin_configs[] = {
1137         { 0x08, 0x01c47010 },
1138         { 0x09, 0x01447010 },
1139         { 0x0d, 0x0221401f },
1140         { 0x0e, 0x01114010 },
1141         { 0x0f, 0x02a19020 },
1142         { 0x10, 0x01a19021 },
1143         { 0x11, 0x90100140 },
1144         { 0x12, 0x01813122 },
1145         {}
1146 };
1147
1148 static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
1149         { 0x08, 0x400000fe },
1150         { 0x09, 0x404500f4 },
1151         { 0x0d, 0x400100f0 },
1152         { 0x0e, 0x90110010 },
1153         { 0x0f, 0x400100f1 },
1154         { 0x10, 0x02a1902e },
1155         { 0x11, 0x500000f2 },
1156         { 0x12, 0x500000f3 },
1157         {}
1158 };
1159
1160 static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
1161         { 0x08, 0x400000fe },
1162         { 0x09, 0x404500f4 },
1163         { 0x0d, 0x400100f0 },
1164         { 0x0e, 0x90110010 },
1165         { 0x0f, 0x400100f1 },
1166         { 0x10, 0x02a1902e },
1167         { 0x11, 0x500000f2 },
1168         { 0x12, 0x500000f3 },
1169         {}
1170 };
1171
1172 /*
1173     STAC 9200 pin configs for
1174     102801A8
1175     102801DE
1176     102801E8
1177 */
1178 static const struct hda_pintbl dell9200_d21_pin_configs[] = {
1179         { 0x08, 0x400001f0 },
1180         { 0x09, 0x400001f1 },
1181         { 0x0d, 0x02214030 },
1182         { 0x0e, 0x01014010 },
1183         { 0x0f, 0x02a19020 },
1184         { 0x10, 0x01a19021 },
1185         { 0x11, 0x90100140 },
1186         { 0x12, 0x01813122 },
1187         {}
1188 };
1189
1190 /*
1191     STAC 9200 pin configs for
1192     102801C0
1193     102801C1
1194 */
1195 static const struct hda_pintbl dell9200_d22_pin_configs[] = {
1196         { 0x08, 0x400001f0 },
1197         { 0x09, 0x400001f1 },
1198         { 0x0d, 0x0221401f },
1199         { 0x0e, 0x01014010 },
1200         { 0x0f, 0x01813020 },
1201         { 0x10, 0x02a19021 },
1202         { 0x11, 0x90100140 },
1203         { 0x12, 0x400001f2 },
1204         {}
1205 };
1206
1207 /*
1208     STAC 9200 pin configs for
1209     102801C4 (Dell Dimension E310)
1210     102801C5
1211     102801C7
1212     102801D9
1213     102801DA
1214     102801E3
1215 */
1216 static const struct hda_pintbl dell9200_d23_pin_configs[] = {
1217         { 0x08, 0x400001f0 },
1218         { 0x09, 0x400001f1 },
1219         { 0x0d, 0x0221401f },
1220         { 0x0e, 0x01014010 },
1221         { 0x0f, 0x01813020 },
1222         { 0x10, 0x01a19021 },
1223         { 0x11, 0x90100140 },
1224         { 0x12, 0x400001f2 },
1225         {}
1226 };
1227
1228
1229 /* 
1230     STAC 9200-32 pin configs for
1231     102801B5 (Dell Inspiron 630m)
1232     102801D8 (Dell Inspiron 640m)
1233 */
1234 static const struct hda_pintbl dell9200_m21_pin_configs[] = {
1235         { 0x08, 0x40c003fa },
1236         { 0x09, 0x03441340 },
1237         { 0x0d, 0x0321121f },
1238         { 0x0e, 0x90170310 },
1239         { 0x0f, 0x408003fb },
1240         { 0x10, 0x03a11020 },
1241         { 0x11, 0x401003fc },
1242         { 0x12, 0x403003fd },
1243         {}
1244 };
1245
1246 /* 
1247     STAC 9200-32 pin configs for
1248     102801C2 (Dell Latitude D620)
1249     102801C8 
1250     102801CC (Dell Latitude D820)
1251     102801D4 
1252     102801D6 
1253 */
1254 static const struct hda_pintbl dell9200_m22_pin_configs[] = {
1255         { 0x08, 0x40c003fa },
1256         { 0x09, 0x0144131f },
1257         { 0x0d, 0x0321121f },
1258         { 0x0e, 0x90170310 },
1259         { 0x0f, 0x90a70321 },
1260         { 0x10, 0x03a11020 },
1261         { 0x11, 0x401003fb },
1262         { 0x12, 0x40f000fc },
1263         {}
1264 };
1265
1266 /* 
1267     STAC 9200-32 pin configs for
1268     102801CE (Dell XPS M1710)
1269     102801CF (Dell Precision M90)
1270 */
1271 static const struct hda_pintbl dell9200_m23_pin_configs[] = {
1272         { 0x08, 0x40c003fa },
1273         { 0x09, 0x01441340 },
1274         { 0x0d, 0x0421421f },
1275         { 0x0e, 0x90170310 },
1276         { 0x0f, 0x408003fb },
1277         { 0x10, 0x04a1102e },
1278         { 0x11, 0x90170311 },
1279         { 0x12, 0x403003fc },
1280         {}
1281 };
1282
1283 /*
1284     STAC 9200-32 pin configs for 
1285     102801C9
1286     102801CA
1287     102801CB (Dell Latitude 120L)
1288     102801D3
1289 */
1290 static const struct hda_pintbl dell9200_m24_pin_configs[] = {
1291         { 0x08, 0x40c003fa },
1292         { 0x09, 0x404003fb },
1293         { 0x0d, 0x0321121f },
1294         { 0x0e, 0x90170310 },
1295         { 0x0f, 0x408003fc },
1296         { 0x10, 0x03a11020 },
1297         { 0x11, 0x401003fd },
1298         { 0x12, 0x403003fe },
1299         {}
1300 };
1301
1302 /*
1303     STAC 9200-32 pin configs for
1304     102801BD (Dell Inspiron E1505n)
1305     102801EE
1306     102801EF
1307 */
1308 static const struct hda_pintbl dell9200_m25_pin_configs[] = {
1309         { 0x08, 0x40c003fa },
1310         { 0x09, 0x01441340 },
1311         { 0x0d, 0x0421121f },
1312         { 0x0e, 0x90170310 },
1313         { 0x0f, 0x408003fb },
1314         { 0x10, 0x04a11020 },
1315         { 0x11, 0x401003fc },
1316         { 0x12, 0x403003fd },
1317         {}
1318 };
1319
1320 /*
1321     STAC 9200-32 pin configs for
1322     102801F5 (Dell Inspiron 1501)
1323     102801F6
1324 */
1325 static const struct hda_pintbl dell9200_m26_pin_configs[] = {
1326         { 0x08, 0x40c003fa },
1327         { 0x09, 0x404003fb },
1328         { 0x0d, 0x0421121f },
1329         { 0x0e, 0x90170310 },
1330         { 0x0f, 0x408003fc },
1331         { 0x10, 0x04a11020 },
1332         { 0x11, 0x401003fd },
1333         { 0x12, 0x403003fe },
1334         {}
1335 };
1336
1337 /*
1338     STAC 9200-32
1339     102801CD (Dell Inspiron E1705/9400)
1340 */
1341 static const struct hda_pintbl dell9200_m27_pin_configs[] = {
1342         { 0x08, 0x40c003fa },
1343         { 0x09, 0x01441340 },
1344         { 0x0d, 0x0421121f },
1345         { 0x0e, 0x90170310 },
1346         { 0x0f, 0x90170310 },
1347         { 0x10, 0x04a11020 },
1348         { 0x11, 0x90170310 },
1349         { 0x12, 0x40f003fc },
1350         {}
1351 };
1352
1353 static const struct hda_pintbl oqo9200_pin_configs[] = {
1354         { 0x08, 0x40c000f0 },
1355         { 0x09, 0x404000f1 },
1356         { 0x0d, 0x0221121f },
1357         { 0x0e, 0x02211210 },
1358         { 0x0f, 0x90170111 },
1359         { 0x10, 0x90a70120 },
1360         { 0x11, 0x400000f2 },
1361         { 0x12, 0x400000f3 },
1362         {}
1363 };
1364
1365 /*
1366  *  STAC 92HD700
1367  *  18881000 Amigaone X1000
1368  */
1369 static const struct hda_pintbl nemo_pin_configs[] = {
1370         { 0x0a, 0x02214020 },   /* Front panel HP socket */
1371         { 0x0b, 0x02a19080 },   /* Front Mic */
1372         { 0x0c, 0x0181304e },   /* Line in */
1373         { 0x0d, 0x01014010 },   /* Line out */
1374         { 0x0e, 0x01a19040 },   /* Rear Mic */
1375         { 0x0f, 0x01011012 },   /* Rear speakers */
1376         { 0x10, 0x01016011 },   /* Center speaker */
1377         { 0x11, 0x01012014 },   /* Side speakers (7.1) */
1378         { 0x12, 0x103301f0 },   /* Motherboard CD line in connector */
1379         { 0x13, 0x411111f0 },   /* Unused */
1380         { 0x14, 0x411111f0 },   /* Unused */
1381         { 0x21, 0x01442170 },   /* S/PDIF line out */
1382         { 0x22, 0x411111f0 },   /* Unused */
1383         { 0x23, 0x411111f0 },   /* Unused */
1384         {}
1385 };
1386
1387 static void stac9200_fixup_panasonic(struct hda_codec *codec,
1388                                      const struct hda_fixup *fix, int action)
1389 {
1390         struct sigmatel_spec *spec = codec->spec;
1391
1392         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1393                 spec->gpio_mask = spec->gpio_dir = 0x09;
1394                 spec->gpio_data = 0x00;
1395                 /* CF-74 has no headphone detection, and the driver should *NOT*
1396                  * do detection and HP/speaker toggle because the hardware does it.
1397                  */
1398                 spec->gen.suppress_auto_mute = 1;
1399         }
1400 }
1401
1402
1403 static const struct hda_fixup stac9200_fixups[] = {
1404         [STAC_REF] = {
1405                 .type = HDA_FIXUP_PINS,
1406                 .v.pins = ref9200_pin_configs,
1407         },
1408         [STAC_9200_OQO] = {
1409                 .type = HDA_FIXUP_PINS,
1410                 .v.pins = oqo9200_pin_configs,
1411                 .chained = true,
1412                 .chain_id = STAC_9200_EAPD_INIT,
1413         },
1414         [STAC_9200_DELL_D21] = {
1415                 .type = HDA_FIXUP_PINS,
1416                 .v.pins = dell9200_d21_pin_configs,
1417         },
1418         [STAC_9200_DELL_D22] = {
1419                 .type = HDA_FIXUP_PINS,
1420                 .v.pins = dell9200_d22_pin_configs,
1421         },
1422         [STAC_9200_DELL_D23] = {
1423                 .type = HDA_FIXUP_PINS,
1424                 .v.pins = dell9200_d23_pin_configs,
1425         },
1426         [STAC_9200_DELL_M21] = {
1427                 .type = HDA_FIXUP_PINS,
1428                 .v.pins = dell9200_m21_pin_configs,
1429         },
1430         [STAC_9200_DELL_M22] = {
1431                 .type = HDA_FIXUP_PINS,
1432                 .v.pins = dell9200_m22_pin_configs,
1433         },
1434         [STAC_9200_DELL_M23] = {
1435                 .type = HDA_FIXUP_PINS,
1436                 .v.pins = dell9200_m23_pin_configs,
1437         },
1438         [STAC_9200_DELL_M24] = {
1439                 .type = HDA_FIXUP_PINS,
1440                 .v.pins = dell9200_m24_pin_configs,
1441         },
1442         [STAC_9200_DELL_M25] = {
1443                 .type = HDA_FIXUP_PINS,
1444                 .v.pins = dell9200_m25_pin_configs,
1445         },
1446         [STAC_9200_DELL_M26] = {
1447                 .type = HDA_FIXUP_PINS,
1448                 .v.pins = dell9200_m26_pin_configs,
1449         },
1450         [STAC_9200_DELL_M27] = {
1451                 .type = HDA_FIXUP_PINS,
1452                 .v.pins = dell9200_m27_pin_configs,
1453         },
1454         [STAC_9200_M4] = {
1455                 .type = HDA_FIXUP_PINS,
1456                 .v.pins = gateway9200_m4_pin_configs,
1457                 .chained = true,
1458                 .chain_id = STAC_9200_EAPD_INIT,
1459         },
1460         [STAC_9200_M4_2] = {
1461                 .type = HDA_FIXUP_PINS,
1462                 .v.pins = gateway9200_m4_2_pin_configs,
1463                 .chained = true,
1464                 .chain_id = STAC_9200_EAPD_INIT,
1465         },
1466         [STAC_9200_PANASONIC] = {
1467                 .type = HDA_FIXUP_FUNC,
1468                 .v.func = stac9200_fixup_panasonic,
1469         },
1470         [STAC_9200_EAPD_INIT] = {
1471                 .type = HDA_FIXUP_VERBS,
1472                 .v.verbs = (const struct hda_verb[]) {
1473                         {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1474                         {}
1475                 },
1476         },
1477 };
1478
1479 static const struct hda_model_fixup stac9200_models[] = {
1480         { .id = STAC_REF, .name = "ref" },
1481         { .id = STAC_9200_OQO, .name = "oqo" },
1482         { .id = STAC_9200_DELL_D21, .name = "dell-d21" },
1483         { .id = STAC_9200_DELL_D22, .name = "dell-d22" },
1484         { .id = STAC_9200_DELL_D23, .name = "dell-d23" },
1485         { .id = STAC_9200_DELL_M21, .name = "dell-m21" },
1486         { .id = STAC_9200_DELL_M22, .name = "dell-m22" },
1487         { .id = STAC_9200_DELL_M23, .name = "dell-m23" },
1488         { .id = STAC_9200_DELL_M24, .name = "dell-m24" },
1489         { .id = STAC_9200_DELL_M25, .name = "dell-m25" },
1490         { .id = STAC_9200_DELL_M26, .name = "dell-m26" },
1491         { .id = STAC_9200_DELL_M27, .name = "dell-m27" },
1492         { .id = STAC_9200_M4, .name = "gateway-m4" },
1493         { .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
1494         { .id = STAC_9200_PANASONIC, .name = "panasonic" },
1495         {}
1496 };
1497
1498 static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
1499         /* SigmaTel reference board */
1500         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1501                       "DFI LanParty", STAC_REF),
1502         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1503                       "DFI LanParty", STAC_REF),
1504         /* Dell laptops have BIOS problem */
1505         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1506                       "unknown Dell", STAC_9200_DELL_D21),
1507         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1508                       "Dell Inspiron 630m", STAC_9200_DELL_M21),
1509         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1510                       "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1511         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1512                       "unknown Dell", STAC_9200_DELL_D22),
1513         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1514                       "unknown Dell", STAC_9200_DELL_D22),
1515         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1516                       "Dell Latitude D620", STAC_9200_DELL_M22),
1517         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1518                       "unknown Dell", STAC_9200_DELL_D23),
1519         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1520                       "unknown Dell", STAC_9200_DELL_D23),
1521         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1522                       "unknown Dell", STAC_9200_DELL_M22),
1523         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1524                       "unknown Dell", STAC_9200_DELL_M24),
1525         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1526                       "unknown Dell", STAC_9200_DELL_M24),
1527         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1528                       "Dell Latitude 120L", STAC_9200_DELL_M24),
1529         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1530                       "Dell Latitude D820", STAC_9200_DELL_M22),
1531         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1532                       "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1533         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1534                       "Dell XPS M1710", STAC_9200_DELL_M23),
1535         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1536                       "Dell Precision M90", STAC_9200_DELL_M23),
1537         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1538                       "unknown Dell", STAC_9200_DELL_M22),
1539         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1540                       "unknown Dell", STAC_9200_DELL_M22),
1541         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1542                       "unknown Dell", STAC_9200_DELL_M22),
1543         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1544                       "Dell Inspiron 640m", STAC_9200_DELL_M21),
1545         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1546                       "unknown Dell", STAC_9200_DELL_D23),
1547         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1548                       "unknown Dell", STAC_9200_DELL_D23),
1549         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1550                       "unknown Dell", STAC_9200_DELL_D21),
1551         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1552                       "unknown Dell", STAC_9200_DELL_D23),
1553         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1554                       "unknown Dell", STAC_9200_DELL_D21),
1555         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1556                       "unknown Dell", STAC_9200_DELL_M25),
1557         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1558                       "unknown Dell", STAC_9200_DELL_M25),
1559         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1560                       "Dell Inspiron 1501", STAC_9200_DELL_M26),
1561         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1562                       "unknown Dell", STAC_9200_DELL_M26),
1563         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0201,
1564                       "Dell Latitude D430", STAC_9200_DELL_M22),
1565         /* Panasonic */
1566         SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1567         /* Gateway machines needs EAPD to be set on resume */
1568         SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1569         SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1570         SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1571         /* OQO Mobile */
1572         SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1573         {} /* terminator */
1574 };
1575
1576 static const struct hda_pintbl ref925x_pin_configs[] = {
1577         { 0x07, 0x40c003f0 },
1578         { 0x08, 0x424503f2 },
1579         { 0x0a, 0x01813022 },
1580         { 0x0b, 0x02a19021 },
1581         { 0x0c, 0x90a70320 },
1582         { 0x0d, 0x02214210 },
1583         { 0x10, 0x01019020 },
1584         { 0x11, 0x9033032e },
1585         {}
1586 };
1587
1588 static const struct hda_pintbl stac925xM1_pin_configs[] = {
1589         { 0x07, 0x40c003f4 },
1590         { 0x08, 0x424503f2 },
1591         { 0x0a, 0x400000f3 },
1592         { 0x0b, 0x02a19020 },
1593         { 0x0c, 0x40a000f0 },
1594         { 0x0d, 0x90100210 },
1595         { 0x10, 0x400003f1 },
1596         { 0x11, 0x9033032e },
1597         {}
1598 };
1599
1600 static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
1601         { 0x07, 0x40c003f4 },
1602         { 0x08, 0x424503f2 },
1603         { 0x0a, 0x400000f3 },
1604         { 0x0b, 0x02a19020 },
1605         { 0x0c, 0x40a000f0 },
1606         { 0x0d, 0x90100210 },
1607         { 0x10, 0x400003f1 },
1608         { 0x11, 0x9033032e },
1609         {}
1610 };
1611
1612 static const struct hda_pintbl stac925xM2_pin_configs[] = {
1613         { 0x07, 0x40c003f4 },
1614         { 0x08, 0x424503f2 },
1615         { 0x0a, 0x400000f3 },
1616         { 0x0b, 0x02a19020 },
1617         { 0x0c, 0x40a000f0 },
1618         { 0x0d, 0x90100210 },
1619         { 0x10, 0x400003f1 },
1620         { 0x11, 0x9033032e },
1621         {}
1622 };
1623
1624 static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
1625         { 0x07, 0x40c003f4 },
1626         { 0x08, 0x424503f2 },
1627         { 0x0a, 0x400000f3 },
1628         { 0x0b, 0x02a19020 },
1629         { 0x0c, 0x40a000f0 },
1630         { 0x0d, 0x90100210 },
1631         { 0x10, 0x400003f1 },
1632         { 0x11, 0x9033032e },
1633         {}
1634 };
1635
1636 static const struct hda_pintbl stac925xM3_pin_configs[] = {
1637         { 0x07, 0x40c003f4 },
1638         { 0x08, 0x424503f2 },
1639         { 0x0a, 0x400000f3 },
1640         { 0x0b, 0x02a19020 },
1641         { 0x0c, 0x40a000f0 },
1642         { 0x0d, 0x90100210 },
1643         { 0x10, 0x400003f1 },
1644         { 0x11, 0x503303f3 },
1645         {}
1646 };
1647
1648 static const struct hda_pintbl stac925xM5_pin_configs[] = {
1649         { 0x07, 0x40c003f4 },
1650         { 0x08, 0x424503f2 },
1651         { 0x0a, 0x400000f3 },
1652         { 0x0b, 0x02a19020 },
1653         { 0x0c, 0x40a000f0 },
1654         { 0x0d, 0x90100210 },
1655         { 0x10, 0x400003f1 },
1656         { 0x11, 0x9033032e },
1657         {}
1658 };
1659
1660 static const struct hda_pintbl stac925xM6_pin_configs[] = {
1661         { 0x07, 0x40c003f4 },
1662         { 0x08, 0x424503f2 },
1663         { 0x0a, 0x400000f3 },
1664         { 0x0b, 0x02a19020 },
1665         { 0x0c, 0x40a000f0 },
1666         { 0x0d, 0x90100210 },
1667         { 0x10, 0x400003f1 },
1668         { 0x11, 0x90330320 },
1669         {}
1670 };
1671
1672 static const struct hda_fixup stac925x_fixups[] = {
1673         [STAC_REF] = {
1674                 .type = HDA_FIXUP_PINS,
1675                 .v.pins = ref925x_pin_configs,
1676         },
1677         [STAC_M1] = {
1678                 .type = HDA_FIXUP_PINS,
1679                 .v.pins = stac925xM1_pin_configs,
1680         },
1681         [STAC_M1_2] = {
1682                 .type = HDA_FIXUP_PINS,
1683                 .v.pins = stac925xM1_2_pin_configs,
1684         },
1685         [STAC_M2] = {
1686                 .type = HDA_FIXUP_PINS,
1687                 .v.pins = stac925xM2_pin_configs,
1688         },
1689         [STAC_M2_2] = {
1690                 .type = HDA_FIXUP_PINS,
1691                 .v.pins = stac925xM2_2_pin_configs,
1692         },
1693         [STAC_M3] = {
1694                 .type = HDA_FIXUP_PINS,
1695                 .v.pins = stac925xM3_pin_configs,
1696         },
1697         [STAC_M5] = {
1698                 .type = HDA_FIXUP_PINS,
1699                 .v.pins = stac925xM5_pin_configs,
1700         },
1701         [STAC_M6] = {
1702                 .type = HDA_FIXUP_PINS,
1703                 .v.pins = stac925xM6_pin_configs,
1704         },
1705 };
1706
1707 static const struct hda_model_fixup stac925x_models[] = {
1708         { .id = STAC_REF, .name = "ref" },
1709         { .id = STAC_M1, .name = "m1" },
1710         { .id = STAC_M1_2, .name = "m1-2" },
1711         { .id = STAC_M2, .name = "m2" },
1712         { .id = STAC_M2_2, .name = "m2-2" },
1713         { .id = STAC_M3, .name = "m3" },
1714         { .id = STAC_M5, .name = "m5" },
1715         { .id = STAC_M6, .name = "m6" },
1716         {}
1717 };
1718
1719 static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
1720         /* SigmaTel reference board */
1721         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1722         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1723         SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1724
1725         /* Default table for unknown ID */
1726         SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1727
1728         /* gateway machines are checked via codec ssid */
1729         SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1730         SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1731         SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1732         SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1733         SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1734         /* Not sure about the brand name for those */
1735         SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1736         SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1737         SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1738         SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1739         {} /* terminator */
1740 };
1741
1742 static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
1743         { 0x0a, 0x02214030 },
1744         { 0x0b, 0x02a19040 },
1745         { 0x0c, 0x01a19020 },
1746         { 0x0d, 0x02214030 },
1747         { 0x0e, 0x0181302e },
1748         { 0x0f, 0x01014010 },
1749         { 0x10, 0x01014020 },
1750         { 0x11, 0x01014030 },
1751         { 0x12, 0x02319040 },
1752         { 0x13, 0x90a000f0 },
1753         { 0x14, 0x90a000f0 },
1754         { 0x22, 0x01452050 },
1755         { 0x23, 0x01452050 },
1756         {}
1757 };
1758
1759 static const struct hda_pintbl dell_m6_pin_configs[] = {
1760         { 0x0a, 0x0321101f },
1761         { 0x0b, 0x4f00000f },
1762         { 0x0c, 0x4f0000f0 },
1763         { 0x0d, 0x90170110 },
1764         { 0x0e, 0x03a11020 },
1765         { 0x0f, 0x0321101f },
1766         { 0x10, 0x4f0000f0 },
1767         { 0x11, 0x4f0000f0 },
1768         { 0x12, 0x4f0000f0 },
1769         { 0x13, 0x90a60160 },
1770         { 0x14, 0x4f0000f0 },
1771         { 0x22, 0x4f0000f0 },
1772         { 0x23, 0x4f0000f0 },
1773         {}
1774 };
1775
1776 static const struct hda_pintbl alienware_m17x_pin_configs[] = {
1777         { 0x0a, 0x0321101f },
1778         { 0x0b, 0x0321101f },
1779         { 0x0c, 0x03a11020 },
1780         { 0x0d, 0x03014020 },
1781         { 0x0e, 0x90170110 },
1782         { 0x0f, 0x4f0000f0 },
1783         { 0x10, 0x4f0000f0 },
1784         { 0x11, 0x4f0000f0 },
1785         { 0x12, 0x4f0000f0 },
1786         { 0x13, 0x90a60160 },
1787         { 0x14, 0x4f0000f0 },
1788         { 0x22, 0x4f0000f0 },
1789         { 0x23, 0x904601b0 },
1790         {}
1791 };
1792
1793 static const struct hda_pintbl intel_dg45id_pin_configs[] = {
1794         { 0x0a, 0x02214230 },
1795         { 0x0b, 0x02A19240 },
1796         { 0x0c, 0x01013214 },
1797         { 0x0d, 0x01014210 },
1798         { 0x0e, 0x01A19250 },
1799         { 0x0f, 0x01011212 },
1800         { 0x10, 0x01016211 },
1801         {}
1802 };
1803
1804 static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
1805         { 0x0a, 0x02214030 },
1806         { 0x0b, 0x02A19010 },
1807         {}
1808 };
1809
1810 static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = {
1811         { 0x0e, 0x400000f0 },
1812         {}
1813 };
1814
1815 static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
1816                                    const struct hda_fixup *fix, int action)
1817 {
1818         struct sigmatel_spec *spec = codec->spec;
1819
1820         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1821                 return;
1822
1823         snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
1824         spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
1825 }
1826
1827 static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
1828 {
1829         struct sigmatel_spec *spec = codec->spec;
1830
1831         snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
1832         spec->eapd_switch = 0;
1833 }
1834
1835 static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
1836                                        const struct hda_fixup *fix, int action)
1837 {
1838         struct sigmatel_spec *spec = codec->spec;
1839
1840         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1841                 return;
1842
1843         stac92hd73xx_fixup_dell(codec);
1844         snd_hda_add_verbs(codec, dell_eq_core_init);
1845         spec->volknob_init = 1;
1846 }
1847
1848 /* Analog Mics */
1849 static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
1850                                     const struct hda_fixup *fix, int action)
1851 {
1852         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1853                 return;
1854
1855         stac92hd73xx_fixup_dell(codec);
1856         snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1857 }
1858
1859 /* Digital Mics */
1860 static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
1861                                     const struct hda_fixup *fix, int action)
1862 {
1863         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1864                 return;
1865
1866         stac92hd73xx_fixup_dell(codec);
1867         snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1868 }
1869
1870 /* Both */
1871 static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
1872                                     const struct hda_fixup *fix, int action)
1873 {
1874         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1875                 return;
1876
1877         stac92hd73xx_fixup_dell(codec);
1878         snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1879         snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1880 }
1881
1882 static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
1883                                     const struct hda_fixup *fix, int action)
1884 {
1885         struct sigmatel_spec *spec = codec->spec;
1886
1887         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1888                 return;
1889
1890         snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
1891         spec->eapd_switch = 0;
1892 }
1893
1894 static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
1895                                      const struct hda_fixup *fix, int action)
1896 {
1897         if (action == HDA_FIXUP_ACT_PRE_PROBE)
1898                 codec->no_jack_detect = 1;
1899 }
1900
1901
1902 static void stac92hd73xx_disable_automute(struct hda_codec *codec,
1903                                      const struct hda_fixup *fix, int action)
1904 {
1905         struct sigmatel_spec *spec = codec->spec;
1906
1907         if (action != HDA_FIXUP_ACT_PRE_PROBE)
1908                 return;
1909
1910         spec->gen.suppress_auto_mute = 1;
1911 }
1912
1913 static const struct hda_fixup stac92hd73xx_fixups[] = {
1914         [STAC_92HD73XX_REF] = {
1915                 .type = HDA_FIXUP_FUNC,
1916                 .v.func = stac92hd73xx_fixup_ref,
1917         },
1918         [STAC_DELL_M6_AMIC] = {
1919                 .type = HDA_FIXUP_FUNC,
1920                 .v.func = stac92hd73xx_fixup_dell_m6_amic,
1921         },
1922         [STAC_DELL_M6_DMIC] = {
1923                 .type = HDA_FIXUP_FUNC,
1924                 .v.func = stac92hd73xx_fixup_dell_m6_dmic,
1925         },
1926         [STAC_DELL_M6_BOTH] = {
1927                 .type = HDA_FIXUP_FUNC,
1928                 .v.func = stac92hd73xx_fixup_dell_m6_both,
1929         },
1930         [STAC_DELL_EQ]  = {
1931                 .type = HDA_FIXUP_FUNC,
1932                 .v.func = stac92hd73xx_fixup_dell_eq,
1933         },
1934         [STAC_ALIENWARE_M17X] = {
1935                 .type = HDA_FIXUP_FUNC,
1936                 .v.func = stac92hd73xx_fixup_alienware_m17x,
1937         },
1938         [STAC_ELO_VUPOINT_15MX] = {
1939                 .type = HDA_FIXUP_FUNC,
1940                 .v.func = stac92hd73xx_disable_automute,
1941         },
1942         [STAC_92HD73XX_INTEL] = {
1943                 .type = HDA_FIXUP_PINS,
1944                 .v.pins = intel_dg45id_pin_configs,
1945         },
1946         [STAC_92HD73XX_NO_JD] = {
1947                 .type = HDA_FIXUP_FUNC,
1948                 .v.func = stac92hd73xx_fixup_no_jd,
1949         },
1950         [STAC_92HD89XX_HP_FRONT_JACK] = {
1951                 .type = HDA_FIXUP_PINS,
1952                 .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
1953         },
1954         [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
1955                 .type = HDA_FIXUP_PINS,
1956                 .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
1957         },
1958         [STAC_92HD73XX_ASUS_MOBO] = {
1959                 .type = HDA_FIXUP_PINS,
1960                 .v.pins = (const struct hda_pintbl[]) {
1961                         /* enable 5.1 and SPDIF out */
1962                         { 0x0c, 0x01014411 },
1963                         { 0x0d, 0x01014410 },
1964                         { 0x0e, 0x01014412 },
1965                         { 0x22, 0x014b1180 },
1966                         { }
1967                 }
1968         },
1969 };
1970
1971 static const struct hda_model_fixup stac92hd73xx_models[] = {
1972         { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
1973         { .id = STAC_92HD73XX_REF, .name = "ref" },
1974         { .id = STAC_92HD73XX_INTEL, .name = "intel" },
1975         { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
1976         { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
1977         { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
1978         { .id = STAC_DELL_EQ, .name = "dell-eq" },
1979         { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
1980         { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" },
1981         { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" },
1982         {}
1983 };
1984
1985 static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
1986         /* SigmaTel reference board */
1987         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1988                                 "DFI LanParty", STAC_92HD73XX_REF),
1989         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1990                                 "DFI LanParty", STAC_92HD73XX_REF),
1991         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1992                                 "Intel DG45ID", STAC_92HD73XX_INTEL),
1993         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1994                                 "Intel DG45FC", STAC_92HD73XX_INTEL),
1995         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1996                                 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1997         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1998                                 "unknown Dell", STAC_DELL_M6_DMIC),
1999         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
2000                                 "unknown Dell", STAC_DELL_M6_BOTH),
2001         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
2002                                 "unknown Dell", STAC_DELL_M6_BOTH),
2003         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
2004                                 "unknown Dell", STAC_DELL_M6_AMIC),
2005         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
2006                                 "unknown Dell", STAC_DELL_M6_AMIC),
2007         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
2008                                 "unknown Dell", STAC_DELL_M6_DMIC),
2009         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
2010                                 "unknown Dell", STAC_DELL_M6_DMIC),
2011         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
2012                                 "Dell Studio 1537", STAC_DELL_M6_DMIC),
2013         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
2014                                 "Dell Studio 17", STAC_DELL_M6_DMIC),
2015         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
2016                                 "Dell Studio 1555", STAC_DELL_M6_DMIC),
2017         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
2018                                 "Dell Studio 1557", STAC_DELL_M6_DMIC),
2019         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
2020                                 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
2021         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
2022                                 "Dell Studio 1558", STAC_DELL_M6_DMIC),
2023         /* codec SSID matching */
2024         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
2025                       "Alienware M17x", STAC_ALIENWARE_M17X),
2026         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
2027                       "Alienware M17x", STAC_ALIENWARE_M17X),
2028         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
2029                       "Alienware M17x R3", STAC_DELL_EQ),
2030         SND_PCI_QUIRK(0x1059, 0x1011,
2031                       "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX),
2032         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
2033                                 "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
2034         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
2035                                 "unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
2036         SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10",
2037                       STAC_92HD73XX_ASUS_MOBO),
2038         {} /* terminator */
2039 };
2040
2041 static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
2042         { 0x0a, 0x02214030 },
2043         { 0x0b, 0x02211010 },
2044         { 0x0c, 0x02a19020 },
2045         { 0x0d, 0x02170130 },
2046         { 0x0e, 0x01014050 },
2047         { 0x0f, 0x01819040 },
2048         { 0x10, 0x01014020 },
2049         { 0x11, 0x90a3014e },
2050         { 0x1f, 0x01451160 },
2051         { 0x20, 0x98560170 },
2052         {}
2053 };
2054
2055 static const struct hda_pintbl dell_s14_pin_configs[] = {
2056         { 0x0a, 0x0221403f },
2057         { 0x0b, 0x0221101f },
2058         { 0x0c, 0x02a19020 },
2059         { 0x0d, 0x90170110 },
2060         { 0x0e, 0x40f000f0 },
2061         { 0x0f, 0x40f000f0 },
2062         { 0x10, 0x40f000f0 },
2063         { 0x11, 0x90a60160 },
2064         { 0x1f, 0x40f000f0 },
2065         { 0x20, 0x40f000f0 },
2066         {}
2067 };
2068
2069 static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
2070         { 0x0a, 0x02a11020 },
2071         { 0x0b, 0x0221101f },
2072         { 0x0c, 0x400000f0 },
2073         { 0x0d, 0x90170110 },
2074         { 0x0e, 0x400000f1 },
2075         { 0x0f, 0x400000f2 },
2076         { 0x10, 0x400000f3 },
2077         { 0x11, 0x90a60160 },
2078         { 0x1f, 0x400000f4 },
2079         { 0x20, 0x400000f5 },
2080         {}
2081 };
2082
2083 static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
2084         { 0x0a, 0x03a12050 },
2085         { 0x0b, 0x0321201f },
2086         { 0x0c, 0x40f000f0 },
2087         { 0x0d, 0x90170110 },
2088         { 0x0e, 0x40f000f0 },
2089         { 0x0f, 0x40f000f0 },
2090         { 0x10, 0x90170110 },
2091         { 0x11, 0xd5a30140 },
2092         { 0x1f, 0x40f000f0 },
2093         { 0x20, 0x40f000f0 },
2094         {}
2095 };
2096
2097 static const struct hda_pintbl hp_zephyr_pin_configs[] = {
2098         { 0x0a, 0x01813050 },
2099         { 0x0b, 0x0421201f },
2100         { 0x0c, 0x04a1205e },
2101         { 0x0d, 0x96130310 },
2102         { 0x0e, 0x96130310 },
2103         { 0x0f, 0x0101401f },
2104         { 0x10, 0x1111611f },
2105         { 0x11, 0xd5a30130 },
2106         {}
2107 };
2108
2109 static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
2110         { 0x0a, 0x40f000f0 },
2111         { 0x0b, 0x0221101f },
2112         { 0x0c, 0x02a11020 },
2113         { 0x0d, 0x92170110 },
2114         { 0x0e, 0x40f000f0 },
2115         { 0x0f, 0x92170110 },
2116         { 0x10, 0x40f000f0 },
2117         { 0x11, 0xd5a30130 },
2118         { 0x1f, 0x40f000f0 },
2119         { 0x20, 0x40f000f0 },
2120         {}
2121 };
2122
2123 static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
2124                                    const struct hda_fixup *fix, int action)
2125 {
2126         struct sigmatel_spec *spec = codec->spec;
2127
2128         if (action != HDA_FIXUP_ACT_PRE_PROBE)
2129                 return;
2130
2131         if (hp_bnb2011_with_dock(codec)) {
2132                 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
2133                 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
2134         }
2135
2136         if (find_mute_led_cfg(codec, spec->default_polarity))
2137                 codec_dbg(codec, "mute LED gpio %d polarity %d\n",
2138                                 spec->gpio_led,
2139                                 spec->gpio_led_polarity);
2140
2141         /* allow auto-switching of dock line-in */
2142         spec->gen.line_in_auto_switch = true;
2143 }
2144
2145 static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
2146                                    const struct hda_fixup *fix, int action)
2147 {
2148         if (action != HDA_FIXUP_ACT_PRE_PROBE)
2149                 return;
2150
2151         snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
2152         snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
2153 }
2154
2155 static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
2156                                    const struct hda_fixup *fix, int action)
2157 {
2158         struct sigmatel_spec *spec = codec->spec;
2159
2160         if (action == HDA_FIXUP_ACT_PRE_PROBE)
2161                 spec->default_polarity = 0;
2162 }
2163
2164 static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
2165                                    const struct hda_fixup *fix, int action)
2166 {
2167         struct sigmatel_spec *spec = codec->spec;
2168
2169         if (action == HDA_FIXUP_ACT_PRE_PROBE)
2170                 spec->default_polarity = 1;
2171 }
2172
2173 static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
2174                                    const struct hda_fixup *fix, int action)
2175 {
2176         struct sigmatel_spec *spec = codec->spec;
2177
2178         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2179                 spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
2180 #ifdef CONFIG_PM
2181                 /* resetting controller clears GPIO, so we need to keep on */
2182                 codec->core.power_caps &= ~AC_PWRST_CLKSTOP;
2183 #endif
2184         }
2185 }
2186
2187 static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec,
2188                                    const struct hda_fixup *fix, int action)
2189 {
2190         struct sigmatel_spec *spec = codec->spec;
2191
2192         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2193                 spec->gpio_led = 0x10; /* GPIO4 */
2194                 spec->default_polarity = 0;
2195         }
2196 }
2197
2198 static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
2199                                    const struct hda_fixup *fix, int action)
2200 {
2201         struct sigmatel_spec *spec = codec->spec;
2202
2203         if (action == HDA_FIXUP_ACT_PRE_PROBE)
2204                 spec->headset_jack = 1;
2205 }
2206
2207 static void stac92hd83xxx_fixup_gpio10_eapd(struct hda_codec *codec,
2208                                             const struct hda_fixup *fix,
2209                                             int action)
2210 {
2211         struct sigmatel_spec *spec = codec->spec;
2212
2213         if (action != HDA_FIXUP_ACT_PRE_PROBE)
2214                 return;
2215         spec->eapd_mask = spec->gpio_mask = spec->gpio_dir =
2216                 spec->gpio_data = 0x10;
2217         spec->eapd_switch = 0;
2218 }
2219
2220 static void hp_envy_ts_fixup_dac_bind(struct hda_codec *codec,
2221                                             const struct hda_fixup *fix,
2222                                             int action)
2223 {
2224         struct sigmatel_spec *spec = codec->spec;
2225         static hda_nid_t preferred_pairs[] = {
2226                 0xd, 0x13,
2227                 0
2228         };
2229
2230         if (action != HDA_FIXUP_ACT_PRE_PROBE)
2231                 return;
2232
2233         spec->gen.preferred_dacs = preferred_pairs;
2234 }
2235
2236 static const struct hda_verb hp_bnb13_eq_verbs[] = {
2237         /* 44.1KHz base */
2238         { 0x22, 0x7A6, 0x3E },
2239         { 0x22, 0x7A7, 0x68 },
2240         { 0x22, 0x7A8, 0x17 },
2241         { 0x22, 0x7A9, 0x3E },
2242         { 0x22, 0x7AA, 0x68 },
2243         { 0x22, 0x7AB, 0x17 },
2244         { 0x22, 0x7AC, 0x00 },
2245         { 0x22, 0x7AD, 0x80 },
2246         { 0x22, 0x7A6, 0x83 },
2247         { 0x22, 0x7A7, 0x2F },
2248         { 0x22, 0x7A8, 0xD1 },
2249         { 0x22, 0x7A9, 0x83 },
2250         { 0x22, 0x7AA, 0x2F },
2251         { 0x22, 0x7AB, 0xD1 },
2252         { 0x22, 0x7AC, 0x01 },
2253         { 0x22, 0x7AD, 0x80 },
2254         { 0x22, 0x7A6, 0x3E },
2255         { 0x22, 0x7A7, 0x68 },
2256         { 0x22, 0x7A8, 0x17 },
2257         { 0x22, 0x7A9, 0x3E },
2258         { 0x22, 0x7AA, 0x68 },
2259         { 0x22, 0x7AB, 0x17 },
2260         { 0x22, 0x7AC, 0x02 },
2261         { 0x22, 0x7AD, 0x80 },
2262         { 0x22, 0x7A6, 0x7C },
2263         { 0x22, 0x7A7, 0xC6 },
2264         { 0x22, 0x7A8, 0x0C },
2265         { 0x22, 0x7A9, 0x7C },
2266         { 0x22, 0x7AA, 0xC6 },
2267         { 0x22, 0x7AB, 0x0C },
2268         { 0x22, 0x7AC, 0x03 },
2269         { 0x22, 0x7AD, 0x80 },
2270         { 0x22, 0x7A6, 0xC3 },
2271         { 0x22, 0x7A7, 0x25 },
2272         { 0x22, 0x7A8, 0xAF },
2273         { 0x22, 0x7A9, 0xC3 },
2274         { 0x22, 0x7AA, 0x25 },
2275         { 0x22, 0x7AB, 0xAF },
2276         { 0x22, 0x7AC, 0x04 },
2277         { 0x22, 0x7AD, 0x80 },
2278         { 0x22, 0x7A6, 0x3E },
2279         { 0x22, 0x7A7, 0x85 },
2280         { 0x22, 0x7A8, 0x73 },
2281         { 0x22, 0x7A9, 0x3E },
2282         { 0x22, 0x7AA, 0x85 },
2283         { 0x22, 0x7AB, 0x73 },
2284         { 0x22, 0x7AC, 0x05 },
2285         { 0x22, 0x7AD, 0x80 },
2286         { 0x22, 0x7A6, 0x85 },
2287         { 0x22, 0x7A7, 0x39 },
2288         { 0x22, 0x7A8, 0xC7 },
2289         { 0x22, 0x7A9, 0x85 },
2290         { 0x22, 0x7AA, 0x39 },
2291         { 0x22, 0x7AB, 0xC7 },
2292         { 0x22, 0x7AC, 0x06 },
2293         { 0x22, 0x7AD, 0x80 },
2294         { 0x22, 0x7A6, 0x3C },
2295         { 0x22, 0x7A7, 0x90 },
2296         { 0x22, 0x7A8, 0xB0 },
2297         { 0x22, 0x7A9, 0x3C },
2298         { 0x22, 0x7AA, 0x90 },
2299         { 0x22, 0x7AB, 0xB0 },
2300         { 0x22, 0x7AC, 0x07 },
2301         { 0x22, 0x7AD, 0x80 },
2302         { 0x22, 0x7A6, 0x7A },
2303         { 0x22, 0x7A7, 0xC6 },
2304         { 0x22, 0x7A8, 0x39 },
2305         { 0x22, 0x7A9, 0x7A },
2306         { 0x22, 0x7AA, 0xC6 },
2307         { 0x22, 0x7AB, 0x39 },
2308         { 0x22, 0x7AC, 0x08 },
2309         { 0x22, 0x7AD, 0x80 },
2310         { 0x22, 0x7A6, 0xC4 },
2311         { 0x22, 0x7A7, 0xE9 },
2312         { 0x22, 0x7A8, 0xDC },
2313         { 0x22, 0x7A9, 0xC4 },
2314         { 0x22, 0x7AA, 0xE9 },
2315         { 0x22, 0x7AB, 0xDC },
2316         { 0x22, 0x7AC, 0x09 },
2317         { 0x22, 0x7AD, 0x80 },
2318         { 0x22, 0x7A6, 0x3D },
2319         { 0x22, 0x7A7, 0xE1 },
2320         { 0x22, 0x7A8, 0x0D },
2321         { 0x22, 0x7A9, 0x3D },
2322         { 0x22, 0x7AA, 0xE1 },
2323         { 0x22, 0x7AB, 0x0D },
2324         { 0x22, 0x7AC, 0x0A },
2325         { 0x22, 0x7AD, 0x80 },
2326         { 0x22, 0x7A6, 0x89 },
2327         { 0x22, 0x7A7, 0xB6 },
2328         { 0x22, 0x7A8, 0xEB },
2329         { 0x22, 0x7A9, 0x89 },
2330         { 0x22, 0x7AA, 0xB6 },
2331         { 0x22, 0x7AB, 0xEB },
2332         { 0x22, 0x7AC, 0x0B },
2333         { 0x22, 0x7AD, 0x80 },
2334         { 0x22, 0x7A6, 0x39 },
2335         { 0x22, 0x7A7, 0x9D },
2336         { 0x22, 0x7A8, 0xFE },
2337         { 0x22, 0x7A9, 0x39 },
2338         { 0x22, 0x7AA, 0x9D },
2339         { 0x22, 0x7AB, 0xFE },
2340         { 0x22, 0x7AC, 0x0C },
2341         { 0x22, 0x7AD, 0x80 },
2342         { 0x22, 0x7A6, 0x76 },
2343         { 0x22, 0x7A7, 0x49 },
2344         { 0x22, 0x7A8, 0x15 },
2345         { 0x22, 0x7A9, 0x76 },
2346         { 0x22, 0x7AA, 0x49 },
2347         { 0x22, 0x7AB, 0x15 },
2348         { 0x22, 0x7AC, 0x0D },
2349         { 0x22, 0x7AD, 0x80 },
2350         { 0x22, 0x7A6, 0xC8 },
2351         { 0x22, 0x7A7, 0x80 },
2352         { 0x22, 0x7A8, 0xF5 },
2353         { 0x22, 0x7A9, 0xC8 },
2354         { 0x22, 0x7AA, 0x80 },
2355         { 0x22, 0x7AB, 0xF5 },
2356         { 0x22, 0x7AC, 0x0E },
2357         { 0x22, 0x7AD, 0x80 },
2358         { 0x22, 0x7A6, 0x40 },
2359         { 0x22, 0x7A7, 0x00 },
2360         { 0x22, 0x7A8, 0x00 },
2361         { 0x22, 0x7A9, 0x40 },
2362         { 0x22, 0x7AA, 0x00 },
2363         { 0x22, 0x7AB, 0x00 },
2364         { 0x22, 0x7AC, 0x0F },
2365         { 0x22, 0x7AD, 0x80 },
2366         { 0x22, 0x7A6, 0x90 },
2367         { 0x22, 0x7A7, 0x68 },
2368         { 0x22, 0x7A8, 0xF1 },
2369         { 0x22, 0x7A9, 0x90 },
2370         { 0x22, 0x7AA, 0x68 },
2371         { 0x22, 0x7AB, 0xF1 },
2372         { 0x22, 0x7AC, 0x10 },
2373         { 0x22, 0x7AD, 0x80 },
2374         { 0x22, 0x7A6, 0x34 },
2375         { 0x22, 0x7A7, 0x47 },
2376         { 0x22, 0x7A8, 0x6C },
2377         { 0x22, 0x7A9, 0x34 },
2378         { 0x22, 0x7AA, 0x47 },
2379         { 0x22, 0x7AB, 0x6C },
2380         { 0x22, 0x7AC, 0x11 },
2381         { 0x22, 0x7AD, 0x80 },
2382         { 0x22, 0x7A6, 0x6F },
2383         { 0x22, 0x7A7, 0x97 },
2384         { 0x22, 0x7A8, 0x0F },
2385         { 0x22, 0x7A9, 0x6F },
2386         { 0x22, 0x7AA, 0x97 },
2387         { 0x22, 0x7AB, 0x0F },
2388         { 0x22, 0x7AC, 0x12 },
2389         { 0x22, 0x7AD, 0x80 },
2390         { 0x22, 0x7A6, 0xCB },
2391         { 0x22, 0x7A7, 0xB8 },
2392         { 0x22, 0x7A8, 0x94 },
2393         { 0x22, 0x7A9, 0xCB },
2394         { 0x22, 0x7AA, 0xB8 },
2395         { 0x22, 0x7AB, 0x94 },
2396         { 0x22, 0x7AC, 0x13 },
2397         { 0x22, 0x7AD, 0x80 },
2398         { 0x22, 0x7A6, 0x40 },
2399         { 0x22, 0x7A7, 0x00 },
2400         { 0x22, 0x7A8, 0x00 },
2401         { 0x22, 0x7A9, 0x40 },
2402         { 0x22, 0x7AA, 0x00 },
2403         { 0x22, 0x7AB, 0x00 },
2404         { 0x22, 0x7AC, 0x14 },
2405         { 0x22, 0x7AD, 0x80 },
2406         { 0x22, 0x7A6, 0x95 },
2407         { 0x22, 0x7A7, 0x76 },
2408         { 0x22, 0x7A8, 0x5B },
2409         { 0x22, 0x7A9, 0x95 },
2410         { 0x22, 0x7AA, 0x76 },
2411         { 0x22, 0x7AB, 0x5B },
2412         { 0x22, 0x7AC, 0x15 },
2413         { 0x22, 0x7AD, 0x80 },
2414         { 0x22, 0x7A6, 0x31 },
2415         { 0x22, 0x7A7, 0xAC },
2416         { 0x22, 0x7A8, 0x31 },
2417         { 0x22, 0x7A9, 0x31 },
2418         { 0x22, 0x7AA, 0xAC },
2419         { 0x22, 0x7AB, 0x31 },
2420         { 0x22, 0x7AC, 0x16 },
2421         { 0x22, 0x7AD, 0x80 },
2422         { 0x22, 0x7A6, 0x6A },
2423         { 0x22, 0x7A7, 0x89 },
2424         { 0x22, 0x7A8, 0xA5 },
2425         { 0x22, 0x7A9, 0x6A },
2426         { 0x22, 0x7AA, 0x89 },
2427         { 0x22, 0x7AB, 0xA5 },
2428         { 0x22, 0x7AC, 0x17 },
2429         { 0x22, 0x7AD, 0x80 },
2430         { 0x22, 0x7A6, 0xCE },
2431         { 0x22, 0x7A7, 0x53 },
2432         { 0x22, 0x7A8, 0xCF },
2433         { 0x22, 0x7A9, 0xCE },
2434         { 0x22, 0x7AA, 0x53 },
2435         { 0x22, 0x7AB, 0xCF },
2436         { 0x22, 0x7AC, 0x18 },
2437         { 0x22, 0x7AD, 0x80 },
2438         { 0x22, 0x7A6, 0x40 },
2439         { 0x22, 0x7A7, 0x00 },
2440         { 0x22, 0x7A8, 0x00 },
2441         { 0x22, 0x7A9, 0x40 },
2442         { 0x22, 0x7AA, 0x00 },
2443         { 0x22, 0x7AB, 0x00 },
2444         { 0x22, 0x7AC, 0x19 },
2445         { 0x22, 0x7AD, 0x80 },
2446         /* 48KHz base */
2447         { 0x22, 0x7A6, 0x3E },
2448         { 0x22, 0x7A7, 0x88 },
2449         { 0x22, 0x7A8, 0xDC },
2450         { 0x22, 0x7A9, 0x3E },
2451         { 0x22, 0x7AA, 0x88 },
2452         { 0x22, 0x7AB, 0xDC },
2453         { 0x22, 0x7AC, 0x1A },
2454         { 0x22, 0x7AD, 0x80 },
2455         { 0x22, 0x7A6, 0x82 },
2456         { 0x22, 0x7A7, 0xEE },
2457         { 0x22, 0x7A8, 0x46 },
2458         { 0x22, 0x7A9, 0x82 },
2459         { 0x22, 0x7AA, 0xEE },
2460         { 0x22, 0x7AB, 0x46 },
2461         { 0x22, 0x7AC, 0x1B },
2462         { 0x22, 0x7AD, 0x80 },
2463         { 0x22, 0x7A6, 0x3E },
2464         { 0x22, 0x7A7, 0x88 },
2465         { 0x22, 0x7A8, 0xDC },
2466         { 0x22, 0x7A9, 0x3E },
2467         { 0x22, 0x7AA, 0x88 },
2468         { 0x22, 0x7AB, 0xDC },
2469         { 0x22, 0x7AC, 0x1C },
2470         { 0x22, 0x7AD, 0x80 },
2471         { 0x22, 0x7A6, 0x7D },
2472         { 0x22, 0x7A7, 0x09 },
2473         { 0x22, 0x7A8, 0x28 },
2474         { 0x22, 0x7A9, 0x7D },
2475         { 0x22, 0x7AA, 0x09 },
2476         { 0x22, 0x7AB, 0x28 },
2477         { 0x22, 0x7AC, 0x1D },
2478         { 0x22, 0x7AD, 0x80 },
2479         { 0x22, 0x7A6, 0xC2 },
2480         { 0x22, 0x7A7, 0xE5 },
2481         { 0x22, 0x7A8, 0xB4 },
2482         { 0x22, 0x7A9, 0xC2 },
2483         { 0x22, 0x7AA, 0xE5 },
2484         { 0x22, 0x7AB, 0xB4 },
2485         { 0x22, 0x7AC, 0x1E },
2486         { 0x22, 0x7AD, 0x80 },
2487         { 0x22, 0x7A6, 0x3E },
2488         { 0x22, 0x7A7, 0xA3 },
2489         { 0x22, 0x7A8, 0x1F },
2490         { 0x22, 0x7A9, 0x3E },
2491         { 0x22, 0x7AA, 0xA3 },
2492         { 0x22, 0x7AB, 0x1F },
2493         { 0x22, 0x7AC, 0x1F },
2494         { 0x22, 0x7AD, 0x80 },
2495         { 0x22, 0x7A6, 0x84 },
2496         { 0x22, 0x7A7, 0xCA },
2497         { 0x22, 0x7A8, 0xF1 },
2498         { 0x22, 0x7A9, 0x84 },
2499         { 0x22, 0x7AA, 0xCA },
2500         { 0x22, 0x7AB, 0xF1 },
2501         { 0x22, 0x7AC, 0x20 },
2502         { 0x22, 0x7AD, 0x80 },
2503         { 0x22, 0x7A6, 0x3C },
2504         { 0x22, 0x7A7, 0xD5 },
2505         { 0x22, 0x7A8, 0x9C },
2506         { 0x22, 0x7A9, 0x3C },
2507         { 0x22, 0x7AA, 0xD5 },
2508         { 0x22, 0x7AB, 0x9C },
2509         { 0x22, 0x7AC, 0x21 },
2510         { 0x22, 0x7AD, 0x80 },
2511         { 0x22, 0x7A6, 0x7B },
2512         { 0x22, 0x7A7, 0x35 },
2513         { 0x22, 0x7A8, 0x0F },
2514         { 0x22, 0x7A9, 0x7B },
2515         { 0x22, 0x7AA, 0x35 },
2516         { 0x22, 0x7AB, 0x0F },
2517         { 0x22, 0x7AC, 0x22 },
2518         { 0x22, 0x7AD, 0x80 },
2519         { 0x22, 0x7A6, 0xC4 },
2520         { 0x22, 0x7A7, 0x87 },
2521         { 0x22, 0x7A8, 0x45 },
2522         { 0x22, 0x7A9, 0xC4 },
2523         { 0x22, 0x7AA, 0x87 },
2524         { 0x22, 0x7AB, 0x45 },
2525         { 0x22, 0x7AC, 0x23 },
2526         { 0x22, 0x7AD, 0x80 },
2527         { 0x22, 0x7A6, 0x3E },
2528         { 0x22, 0x7A7, 0x0A },
2529         { 0x22, 0x7A8, 0x78 },
2530         { 0x22, 0x7A9, 0x3E },
2531         { 0x22, 0x7AA, 0x0A },
2532         { 0x22, 0x7AB, 0x78 },
2533         { 0x22, 0x7AC, 0x24 },
2534         { 0x22, 0x7AD, 0x80 },
2535         { 0x22, 0x7A6, 0x88 },
2536         { 0x22, 0x7A7, 0xE2 },
2537         { 0x22, 0x7A8, 0x05 },
2538         { 0x22, 0x7A9, 0x88 },
2539         { 0x22, 0x7AA, 0xE2 },
2540         { 0x22, 0x7AB, 0x05 },
2541         { 0x22, 0x7AC, 0x25 },
2542         { 0x22, 0x7AD, 0x80 },
2543         { 0x22, 0x7A6, 0x3A },
2544         { 0x22, 0x7A7, 0x1A },
2545         { 0x22, 0x7A8, 0xA3 },
2546         { 0x22, 0x7A9, 0x3A },
2547         { 0x22, 0x7AA, 0x1A },
2548         { 0x22, 0x7AB, 0xA3 },
2549         { 0x22, 0x7AC, 0x26 },
2550         { 0x22, 0x7AD, 0x80 },
2551         { 0x22, 0x7A6, 0x77 },
2552         { 0x22, 0x7A7, 0x1D },
2553         { 0x22, 0x7A8, 0xFB },
2554         { 0x22, 0x7A9, 0x77 },
2555         { 0x22, 0x7AA, 0x1D },
2556         { 0x22, 0x7AB, 0xFB },
2557         { 0x22, 0x7AC, 0x27 },
2558         { 0x22, 0x7AD, 0x80 },
2559         { 0x22, 0x7A6, 0xC7 },
2560         { 0x22, 0x7A7, 0xDA },
2561         { 0x22, 0x7A8, 0xE5 },
2562         { 0x22, 0x7A9, 0xC7 },
2563         { 0x22, 0x7AA, 0xDA },
2564         { 0x22, 0x7AB, 0xE5 },
2565         { 0x22, 0x7AC, 0x28 },
2566         { 0x22, 0x7AD, 0x80 },
2567         { 0x22, 0x7A6, 0x40 },
2568         { 0x22, 0x7A7, 0x00 },
2569         { 0x22, 0x7A8, 0x00 },
2570         { 0x22, 0x7A9, 0x40 },
2571         { 0x22, 0x7AA, 0x00 },
2572         { 0x22, 0x7AB, 0x00 },
2573         { 0x22, 0x7AC, 0x29 },
2574         { 0x22, 0x7AD, 0x80 },
2575         { 0x22, 0x7A6, 0x8E },
2576         { 0x22, 0x7A7, 0xD7 },
2577         { 0x22, 0x7A8, 0x22 },
2578         { 0x22, 0x7A9, 0x8E },
2579         { 0x22, 0x7AA, 0xD7 },
2580         { 0x22, 0x7AB, 0x22 },
2581         { 0x22, 0x7AC, 0x2A },
2582         { 0x22, 0x7AD, 0x80 },
2583         { 0x22, 0x7A6, 0x35 },
2584         { 0x22, 0x7A7, 0x26 },
2585         { 0x22, 0x7A8, 0xC6 },
2586         { 0x22, 0x7A9, 0x35 },
2587         { 0x22, 0x7AA, 0x26 },
2588         { 0x22, 0x7AB, 0xC6 },
2589         { 0x22, 0x7AC, 0x2B },
2590         { 0x22, 0x7AD, 0x80 },
2591         { 0x22, 0x7A6, 0x71 },
2592         { 0x22, 0x7A7, 0x28 },
2593         { 0x22, 0x7A8, 0xDE },
2594         { 0x22, 0x7A9, 0x71 },
2595         { 0x22, 0x7AA, 0x28 },
2596         { 0x22, 0x7AB, 0xDE },
2597         { 0x22, 0x7AC, 0x2C },
2598         { 0x22, 0x7AD, 0x80 },
2599         { 0x22, 0x7A6, 0xCA },
2600         { 0x22, 0x7A7, 0xD9 },
2601         { 0x22, 0x7A8, 0x3A },
2602         { 0x22, 0x7A9, 0xCA },
2603         { 0x22, 0x7AA, 0xD9 },
2604         { 0x22, 0x7AB, 0x3A },
2605         { 0x22, 0x7AC, 0x2D },
2606         { 0x22, 0x7AD, 0x80 },
2607         { 0x22, 0x7A6, 0x40 },
2608         { 0x22, 0x7A7, 0x00 },
2609         { 0x22, 0x7A8, 0x00 },
2610         { 0x22, 0x7A9, 0x40 },
2611         { 0x22, 0x7AA, 0x00 },
2612         { 0x22, 0x7AB, 0x00 },
2613         { 0x22, 0x7AC, 0x2E },
2614         { 0x22, 0x7AD, 0x80 },
2615         { 0x22, 0x7A6, 0x93 },
2616         { 0x22, 0x7A7, 0x5E },
2617         { 0x22, 0x7A8, 0xD8 },
2618         { 0x22, 0x7A9, 0x93 },
2619         { 0x22, 0x7AA, 0x5E },
2620         { 0x22, 0x7AB, 0xD8 },
2621         { 0x22, 0x7AC, 0x2F },
2622         { 0x22, 0x7AD, 0x80 },
2623         { 0x22, 0x7A6, 0x32 },
2624         { 0x22, 0x7A7, 0xB7 },
2625         { 0x22, 0x7A8, 0xB1 },
2626         { 0x22, 0x7A9, 0x32 },
2627         { 0x22, 0x7AA, 0xB7 },
2628         { 0x22, 0x7AB, 0xB1 },
2629         { 0x22, 0x7AC, 0x30 },
2630         { 0x22, 0x7AD, 0x80 },
2631         { 0x22, 0x7A6, 0x6C },
2632         { 0x22, 0x7A7, 0xA1 },
2633         { 0x22, 0x7A8, 0x28 },
2634         { 0x22, 0x7A9, 0x6C },
2635         { 0x22, 0x7AA, 0xA1 },
2636         { 0x22, 0x7AB, 0x28 },
2637         { 0x22, 0x7AC, 0x31 },
2638         { 0x22, 0x7AD, 0x80 },
2639         { 0x22, 0x7A6, 0xCD },
2640         { 0x22, 0x7A7, 0x48 },
2641         { 0x22, 0x7A8, 0x4F },
2642         { 0x22, 0x7A9, 0xCD },
2643         { 0x22, 0x7AA, 0x48 },
2644         { 0x22, 0x7AB, 0x4F },
2645         { 0x22, 0x7AC, 0x32 },
2646         { 0x22, 0x7AD, 0x80 },
2647         { 0x22, 0x7A6, 0x40 },
2648         { 0x22, 0x7A7, 0x00 },
2649         { 0x22, 0x7A8, 0x00 },
2650         { 0x22, 0x7A9, 0x40 },
2651         { 0x22, 0x7AA, 0x00 },
2652         { 0x22, 0x7AB, 0x00 },
2653         { 0x22, 0x7AC, 0x33 },
2654         { 0x22, 0x7AD, 0x80 },
2655         /* common */
2656         { 0x22, 0x782, 0xC1 },
2657         { 0x22, 0x771, 0x2C },
2658         { 0x22, 0x772, 0x2C },
2659         { 0x22, 0x788, 0x04 },
2660         { 0x01, 0x7B0, 0x08 },
2661         {}
2662 };
2663
2664 static const struct hda_fixup stac92hd83xxx_fixups[] = {
2665         [STAC_92HD83XXX_REF] = {
2666                 .type = HDA_FIXUP_PINS,
2667                 .v.pins = ref92hd83xxx_pin_configs,
2668         },
2669         [STAC_92HD83XXX_PWR_REF] = {
2670                 .type = HDA_FIXUP_PINS,
2671                 .v.pins = ref92hd83xxx_pin_configs,
2672         },
2673         [STAC_DELL_S14] = {
2674                 .type = HDA_FIXUP_PINS,
2675                 .v.pins = dell_s14_pin_configs,
2676         },
2677         [STAC_DELL_VOSTRO_3500] = {
2678                 .type = HDA_FIXUP_PINS,
2679                 .v.pins = dell_vostro_3500_pin_configs,
2680         },
2681         [STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
2682                 .type = HDA_FIXUP_PINS,
2683                 .v.pins = hp_cNB11_intquad_pin_configs,
2684                 .chained = true,
2685                 .chain_id = STAC_92HD83XXX_HP,
2686         },
2687         [STAC_92HD83XXX_HP] = {
2688                 .type = HDA_FIXUP_FUNC,
2689                 .v.func = stac92hd83xxx_fixup_hp,
2690         },
2691         [STAC_HP_DV7_4000] = {
2692                 .type = HDA_FIXUP_PINS,
2693                 .v.pins = hp_dv7_4000_pin_configs,
2694                 .chained = true,
2695                 .chain_id = STAC_92HD83XXX_HP,
2696         },
2697         [STAC_HP_ZEPHYR] = {
2698                 .type = HDA_FIXUP_FUNC,
2699                 .v.func = stac92hd83xxx_fixup_hp_zephyr,
2700                 .chained = true,
2701                 .chain_id = STAC_92HD83XXX_HP,
2702         },
2703         [STAC_92HD83XXX_HP_LED] = {
2704                 .type = HDA_FIXUP_FUNC,
2705                 .v.func = stac92hd83xxx_fixup_hp_led,
2706                 .chained = true,
2707                 .chain_id = STAC_92HD83XXX_HP,
2708         },
2709         [STAC_92HD83XXX_HP_INV_LED] = {
2710                 .type = HDA_FIXUP_FUNC,
2711                 .v.func = stac92hd83xxx_fixup_hp_inv_led,
2712                 .chained = true,
2713                 .chain_id = STAC_92HD83XXX_HP,
2714         },
2715         [STAC_92HD83XXX_HP_MIC_LED] = {
2716                 .type = HDA_FIXUP_FUNC,
2717                 .v.func = stac92hd83xxx_fixup_hp_mic_led,
2718                 .chained = true,
2719                 .chain_id = STAC_92HD83XXX_HP,
2720         },
2721         [STAC_HP_LED_GPIO10] = {
2722                 .type = HDA_FIXUP_FUNC,
2723                 .v.func = stac92hd83xxx_fixup_hp_led_gpio10,
2724                 .chained = true,
2725                 .chain_id = STAC_92HD83XXX_HP,
2726         },
2727         [STAC_92HD83XXX_HEADSET_JACK] = {
2728                 .type = HDA_FIXUP_FUNC,
2729                 .v.func = stac92hd83xxx_fixup_headset_jack,
2730         },
2731         [STAC_HP_ENVY_BASS] = {
2732                 .type = HDA_FIXUP_PINS,
2733                 .v.pins = (const struct hda_pintbl[]) {
2734                         { 0x0f, 0x90170111 },
2735                         {}
2736                 },
2737         },
2738         [STAC_HP_BNB13_EQ] = {
2739                 .type = HDA_FIXUP_VERBS,
2740                 .v.verbs = hp_bnb13_eq_verbs,
2741                 .chained = true,
2742                 .chain_id = STAC_92HD83XXX_HP_MIC_LED,
2743         },
2744         [STAC_HP_ENVY_TS_BASS] = {
2745                 .type = HDA_FIXUP_PINS,
2746                 .v.pins = (const struct hda_pintbl[]) {
2747                         { 0x10, 0x92170111 },
2748                         {}
2749                 },
2750         },
2751         [STAC_HP_ENVY_TS_DAC_BIND] = {
2752                 .type = HDA_FIXUP_FUNC,
2753                 .v.func = hp_envy_ts_fixup_dac_bind,
2754                 .chained = true,
2755                 .chain_id = STAC_HP_ENVY_TS_BASS,
2756         },
2757         [STAC_92HD83XXX_GPIO10_EAPD] = {
2758                 .type = HDA_FIXUP_FUNC,
2759                 .v.func = stac92hd83xxx_fixup_gpio10_eapd,
2760         },
2761 };
2762
2763 static const struct hda_model_fixup stac92hd83xxx_models[] = {
2764         { .id = STAC_92HD83XXX_REF, .name = "ref" },
2765         { .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
2766         { .id = STAC_DELL_S14, .name = "dell-s14" },
2767         { .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
2768         { .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
2769         { .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
2770         { .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
2771         { .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
2772         { .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
2773         { .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
2774         { .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
2775         { .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
2776         { .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
2777         { .id = STAC_HP_ENVY_TS_BASS, .name = "hp-envy-ts-bass" },
2778         {}
2779 };
2780
2781 static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
2782         /* SigmaTel reference board */
2783         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2784                       "DFI LanParty", STAC_92HD83XXX_REF),
2785         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2786                       "DFI LanParty", STAC_92HD83XXX_REF),
2787         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
2788                       "unknown Dell", STAC_DELL_S14),
2789         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
2790                       "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
2791         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
2792                       "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
2793         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
2794                       "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
2795         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
2796                       "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
2797         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
2798                       "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2799         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
2800                       "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
2801         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
2802                       "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2803         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
2804                       "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
2805         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
2806                       "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
2807         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
2808                       "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
2809         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
2810                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2811         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
2812                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2813         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
2814                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2815         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
2816                           "HP Pavilion dv7", STAC_HP_DV7_4000),
2817         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
2818                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2819         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
2820                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2821         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
2822                           "HP Envy Spectre", STAC_HP_ENVY_BASS),
2823         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899,
2824                           "HP Folio 13", STAC_HP_LED_GPIO10),
2825         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
2826                           "HP Folio", STAC_HP_BNB13_EQ),
2827         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
2828                           "HP bNB13", STAC_HP_BNB13_EQ),
2829         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909,
2830                           "HP bNB13", STAC_HP_BNB13_EQ),
2831         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
2832                           "HP bNB13", STAC_HP_BNB13_EQ),
2833         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190e,
2834                           "HP ENVY TS", STAC_HP_ENVY_TS_BASS),
2835         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1967,
2836                           "HP ENVY TS", STAC_HP_ENVY_TS_DAC_BIND),
2837         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
2838                           "HP bNB13", STAC_HP_BNB13_EQ),
2839         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
2840                           "HP bNB13", STAC_HP_BNB13_EQ),
2841         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942,
2842                           "HP bNB13", STAC_HP_BNB13_EQ),
2843         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943,
2844                           "HP bNB13", STAC_HP_BNB13_EQ),
2845         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944,
2846                           "HP bNB13", STAC_HP_BNB13_EQ),
2847         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945,
2848                           "HP bNB13", STAC_HP_BNB13_EQ),
2849         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946,
2850                           "HP bNB13", STAC_HP_BNB13_EQ),
2851         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948,
2852                           "HP bNB13", STAC_HP_BNB13_EQ),
2853         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949,
2854                           "HP bNB13", STAC_HP_BNB13_EQ),
2855         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A,
2856                           "HP bNB13", STAC_HP_BNB13_EQ),
2857         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B,
2858                           "HP bNB13", STAC_HP_BNB13_EQ),
2859         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C,
2860                           "HP bNB13", STAC_HP_BNB13_EQ),
2861         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E,
2862                           "HP bNB13", STAC_HP_BNB13_EQ),
2863         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F,
2864                           "HP bNB13", STAC_HP_BNB13_EQ),
2865         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950,
2866                           "HP bNB13", STAC_HP_BNB13_EQ),
2867         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951,
2868                           "HP bNB13", STAC_HP_BNB13_EQ),
2869         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A,
2870                           "HP bNB13", STAC_HP_BNB13_EQ),
2871         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B,
2872                           "HP bNB13", STAC_HP_BNB13_EQ),
2873         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C,
2874                           "HP bNB13", STAC_HP_BNB13_EQ),
2875         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991,
2876                           "HP bNB13", STAC_HP_BNB13_EQ),
2877         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103,
2878                           "HP bNB13", STAC_HP_BNB13_EQ),
2879         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104,
2880                           "HP bNB13", STAC_HP_BNB13_EQ),
2881         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105,
2882                           "HP bNB13", STAC_HP_BNB13_EQ),
2883         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106,
2884                           "HP bNB13", STAC_HP_BNB13_EQ),
2885         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107,
2886                           "HP bNB13", STAC_HP_BNB13_EQ),
2887         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108,
2888                           "HP bNB13", STAC_HP_BNB13_EQ),
2889         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109,
2890                           "HP bNB13", STAC_HP_BNB13_EQ),
2891         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A,
2892                           "HP bNB13", STAC_HP_BNB13_EQ),
2893         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B,
2894                           "HP bNB13", STAC_HP_BNB13_EQ),
2895         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C,
2896                           "HP bNB13", STAC_HP_BNB13_EQ),
2897         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D,
2898                           "HP bNB13", STAC_HP_BNB13_EQ),
2899         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E,
2900                           "HP bNB13", STAC_HP_BNB13_EQ),
2901         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F,
2902                           "HP bNB13", STAC_HP_BNB13_EQ),
2903         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120,
2904                           "HP bNB13", STAC_HP_BNB13_EQ),
2905         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121,
2906                           "HP bNB13", STAC_HP_BNB13_EQ),
2907         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122,
2908                           "HP bNB13", STAC_HP_BNB13_EQ),
2909         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123,
2910                           "HP bNB13", STAC_HP_BNB13_EQ),
2911         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E,
2912                           "HP bNB13", STAC_HP_BNB13_EQ),
2913         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F,
2914                           "HP bNB13", STAC_HP_BNB13_EQ),
2915         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140,
2916                           "HP bNB13", STAC_HP_BNB13_EQ),
2917         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2,
2918                           "HP bNB13", STAC_HP_BNB13_EQ),
2919         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3,
2920                           "HP bNB13", STAC_HP_BNB13_EQ),
2921         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5,
2922                           "HP bNB13", STAC_HP_BNB13_EQ),
2923         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6,
2924                           "HP bNB13", STAC_HP_BNB13_EQ),
2925         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
2926                           "HP", STAC_92HD83XXX_HP_MIC_LED),
2927         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
2928                           "HP", STAC_92HD83XXX_HP_MIC_LED),
2929         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
2930                           "HP", STAC_92HD83XXX_HP_MIC_LED),
2931         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
2932                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2933         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
2934                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2935         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
2936                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2937         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
2938                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2939         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
2940                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2941         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
2942                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2943         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
2944                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2945         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
2946                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2947         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
2948                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2949         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
2950                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2951         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
2952                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2953         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
2954                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2955         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
2956                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2957         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
2958                           "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2959         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
2960                           "HP", STAC_HP_ZEPHYR),
2961         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
2962                           "HP Mini", STAC_92HD83XXX_HP_LED),
2963         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
2964                           "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
2965         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
2966                       "HP Mini", STAC_92HD83XXX_HP_LED),
2967         SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
2968         /* match both for 0xfa91 and 0xfa93 */
2969         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_TOSHIBA, 0xfffd, 0xfa91,
2970                       "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD),
2971         {} /* terminator */
2972 };
2973
2974 /* HP dv7 bass switch - GPIO5 */
2975 #define stac_hp_bass_gpio_info  snd_ctl_boolean_mono_info
2976 static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
2977                                  struct snd_ctl_elem_value *ucontrol)
2978 {
2979         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2980         struct sigmatel_spec *spec = codec->spec;
2981         ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
2982         return 0;
2983 }
2984
2985 static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
2986                                  struct snd_ctl_elem_value *ucontrol)
2987 {
2988         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2989         struct sigmatel_spec *spec = codec->spec;
2990         unsigned int gpio_data;
2991
2992         gpio_data = (spec->gpio_data & ~0x20) |
2993                 (ucontrol->value.integer.value[0] ? 0x20 : 0);
2994         if (gpio_data == spec->gpio_data)
2995                 return 0;
2996         spec->gpio_data = gpio_data;
2997         stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
2998         return 1;
2999 }
3000
3001 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
3002         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3003         .info = stac_hp_bass_gpio_info,
3004         .get = stac_hp_bass_gpio_get,
3005         .put = stac_hp_bass_gpio_put,
3006 };
3007
3008 static int stac_add_hp_bass_switch(struct hda_codec *codec)
3009 {
3010         struct sigmatel_spec *spec = codec->spec;
3011
3012         if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
3013                                   &stac_hp_bass_sw_ctrl))
3014                 return -ENOMEM;
3015
3016         spec->gpio_mask |= 0x20;
3017         spec->gpio_dir |= 0x20;
3018         spec->gpio_data |= 0x20;
3019         return 0;
3020 }
3021
3022 static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
3023         { 0x0a, 0x02214030 },
3024         { 0x0b, 0x02a19040 },
3025         { 0x0c, 0x01a19020 },
3026         { 0x0d, 0x01014010 },
3027         { 0x0e, 0x0181302e },
3028         { 0x0f, 0x01014010 },
3029         { 0x14, 0x01019020 },
3030         { 0x18, 0x90a000f0 },
3031         { 0x19, 0x90a000f0 },
3032         { 0x1e, 0x01452050 },
3033         { 0x1f, 0x01452050 },
3034         {}
3035 };
3036
3037 static const struct hda_pintbl dell_m4_1_pin_configs[] = {
3038         { 0x0a, 0x0421101f },
3039         { 0x0b, 0x04a11221 },
3040         { 0x0c, 0x40f000f0 },
3041         { 0x0d, 0x90170110 },
3042         { 0x0e, 0x23a1902e },
3043         { 0x0f, 0x23014250 },
3044         { 0x14, 0x40f000f0 },
3045         { 0x18, 0x90a000f0 },
3046         { 0x19, 0x40f000f0 },
3047         { 0x1e, 0x4f0000f0 },
3048         { 0x1f, 0x4f0000f0 },
3049         {}
3050 };
3051
3052 static const struct hda_pintbl dell_m4_2_pin_configs[] = {
3053         { 0x0a, 0x0421101f },
3054         { 0x0b, 0x04a11221 },
3055         { 0x0c, 0x90a70330 },
3056         { 0x0d, 0x90170110 },
3057         { 0x0e, 0x23a1902e },
3058         { 0x0f, 0x23014250 },
3059         { 0x14, 0x40f000f0 },
3060         { 0x18, 0x40f000f0 },
3061         { 0x19, 0x40f000f0 },
3062         { 0x1e, 0x044413b0 },
3063         { 0x1f, 0x044413b0 },
3064         {}
3065 };
3066
3067 static const struct hda_pintbl dell_m4_3_pin_configs[] = {
3068         { 0x0a, 0x0421101f },
3069         { 0x0b, 0x04a11221 },
3070         { 0x0c, 0x90a70330 },
3071         { 0x0d, 0x90170110 },
3072         { 0x0e, 0x40f000f0 },
3073         { 0x0f, 0x40f000f0 },
3074         { 0x14, 0x40f000f0 },
3075         { 0x18, 0x90a000f0 },
3076         { 0x19, 0x40f000f0 },
3077         { 0x1e, 0x044413b0 },
3078         { 0x1f, 0x044413b0 },
3079         {}
3080 };
3081
3082 static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
3083                                     const struct hda_fixup *fix, int action)
3084 {
3085         struct sigmatel_spec *spec = codec->spec;
3086
3087         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3088                 return;
3089
3090         snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
3091         spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
3092 }
3093
3094 static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
3095                                       const struct hda_fixup *fix, int action)
3096 {
3097         struct sigmatel_spec *spec = codec->spec;
3098         struct hda_jack_callback *jack;
3099
3100         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3101                 return;
3102
3103         /* Enable VREF power saving on GPIO1 detect */
3104         snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3105                                   AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
3106         jack = snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3107                                                    stac_vref_event);
3108         if (!IS_ERR(jack))
3109                 jack->private_data = 0x02;
3110
3111         spec->gpio_mask |= 0x02;
3112
3113         /* enable internal microphone */
3114         snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
3115 }
3116
3117 static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
3118                                        const struct hda_fixup *fix, int action)
3119 {
3120         struct sigmatel_spec *spec = codec->spec;
3121
3122         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3123                 return;
3124         spec->gpio_led = 0x01;
3125 }
3126
3127 static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
3128                                        const struct hda_fixup *fix, int action)
3129 {
3130         unsigned int cap;
3131
3132         switch (action) {
3133         case HDA_FIXUP_ACT_PRE_PROBE:
3134                 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
3135                 break;
3136
3137         case HDA_FIXUP_ACT_PROBE:
3138                 /* enable bass on HP dv7 */
3139                 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
3140                 cap &= AC_GPIO_IO_COUNT;
3141                 if (cap >= 6)
3142                         stac_add_hp_bass_switch(codec);
3143                 break;
3144         }
3145 }
3146
3147 static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
3148                                        const struct hda_fixup *fix, int action)
3149 {
3150         struct sigmatel_spec *spec = codec->spec;
3151
3152         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3153                 return;
3154         spec->gpio_led = 0x08;
3155 }
3156
3157 static bool is_hp_output(struct hda_codec *codec, hda_nid_t pin)
3158 {
3159         unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3160
3161         /* count line-out, too, as BIOS sets often so */
3162         return get_defcfg_connect(pin_cfg) != AC_JACK_PORT_NONE &&
3163                 (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
3164                  get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT);
3165 }
3166
3167 static void fixup_hp_headphone(struct hda_codec *codec, hda_nid_t pin)
3168 {
3169         unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3170
3171         /* It was changed in the BIOS to just satisfy MS DTM.
3172          * Lets turn it back into slaved HP
3173          */
3174         pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
3175                 (AC_JACK_HP_OUT << AC_DEFCFG_DEVICE_SHIFT);
3176         pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | AC_DEFCFG_SEQUENCE))) |
3177                 0x1f;
3178         snd_hda_codec_set_pincfg(codec, pin, pin_cfg);
3179 }
3180
3181 static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
3182                                    const struct hda_fixup *fix, int action)
3183 {
3184         struct sigmatel_spec *spec = codec->spec;
3185
3186         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3187                 return;
3188
3189         /* when both output A and F are assigned, these are supposedly
3190          * dock and built-in headphones; fix both pin configs
3191          */
3192         if (is_hp_output(codec, 0x0a) && is_hp_output(codec, 0x0f)) {
3193                 fixup_hp_headphone(codec, 0x0a);
3194                 fixup_hp_headphone(codec, 0x0f);
3195         }
3196
3197         if (find_mute_led_cfg(codec, 1))
3198                 codec_dbg(codec, "mute LED gpio %d polarity %d\n",
3199                                 spec->gpio_led,
3200                                 spec->gpio_led_polarity);
3201
3202 }
3203
3204 static const struct hda_fixup stac92hd71bxx_fixups[] = {
3205         [STAC_92HD71BXX_REF] = {
3206                 .type = HDA_FIXUP_FUNC,
3207                 .v.func = stac92hd71bxx_fixup_ref,
3208         },
3209         [STAC_DELL_M4_1] = {
3210                 .type = HDA_FIXUP_PINS,
3211                 .v.pins = dell_m4_1_pin_configs,
3212         },
3213         [STAC_DELL_M4_2] = {
3214                 .type = HDA_FIXUP_PINS,
3215                 .v.pins = dell_m4_2_pin_configs,
3216         },
3217         [STAC_DELL_M4_3] = {
3218                 .type = HDA_FIXUP_PINS,
3219                 .v.pins = dell_m4_3_pin_configs,
3220         },
3221         [STAC_HP_M4] = {
3222                 .type = HDA_FIXUP_FUNC,
3223                 .v.func = stac92hd71bxx_fixup_hp_m4,
3224                 .chained = true,
3225                 .chain_id = STAC_92HD71BXX_HP,
3226         },
3227         [STAC_HP_DV4] = {
3228                 .type = HDA_FIXUP_FUNC,
3229                 .v.func = stac92hd71bxx_fixup_hp_dv4,
3230                 .chained = true,
3231                 .chain_id = STAC_HP_DV5,
3232         },
3233         [STAC_HP_DV5] = {
3234                 .type = HDA_FIXUP_FUNC,
3235                 .v.func = stac92hd71bxx_fixup_hp_dv5,
3236                 .chained = true,
3237                 .chain_id = STAC_92HD71BXX_HP,
3238         },
3239         [STAC_HP_HDX] = {
3240                 .type = HDA_FIXUP_FUNC,
3241                 .v.func = stac92hd71bxx_fixup_hp_hdx,
3242                 .chained = true,
3243                 .chain_id = STAC_92HD71BXX_HP,
3244         },
3245         [STAC_92HD71BXX_HP] = {
3246                 .type = HDA_FIXUP_FUNC,
3247                 .v.func = stac92hd71bxx_fixup_hp,
3248         },
3249 };
3250
3251 static const struct hda_model_fixup stac92hd71bxx_models[] = {
3252         { .id = STAC_92HD71BXX_REF, .name = "ref" },
3253         { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
3254         { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
3255         { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
3256         { .id = STAC_HP_M4, .name = "hp-m4" },
3257         { .id = STAC_HP_DV4, .name = "hp-dv4" },
3258         { .id = STAC_HP_DV5, .name = "hp-dv5" },
3259         { .id = STAC_HP_HDX, .name = "hp-hdx" },
3260         { .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
3261         {}
3262 };
3263
3264 static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
3265         /* SigmaTel reference board */
3266         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3267                       "DFI LanParty", STAC_92HD71BXX_REF),
3268         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3269                       "DFI LanParty", STAC_92HD71BXX_REF),
3270         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
3271                           "HP", STAC_HP_DV5),
3272         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
3273                       "HP", STAC_HP_DV5),
3274         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
3275                       "HP dv4-7", STAC_HP_DV4),
3276         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
3277                       "HP dv4-7", STAC_HP_DV5),
3278         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
3279                       "HP HDX", STAC_HP_HDX),  /* HDX18 */
3280         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
3281                       "HP mini 1000", STAC_HP_M4),
3282         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
3283                       "HP HDX", STAC_HP_HDX),  /* HDX16 */
3284         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
3285                       "HP dv6", STAC_HP_DV5),
3286         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
3287                       "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
3288         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
3289                       "HP DV6", STAC_HP_DV5),
3290         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
3291                       "HP", STAC_HP_DV5),
3292         SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
3293         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
3294                                 "unknown Dell", STAC_DELL_M4_1),
3295         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
3296                                 "unknown Dell", STAC_DELL_M4_1),
3297         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
3298                                 "unknown Dell", STAC_DELL_M4_1),
3299         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
3300                                 "unknown Dell", STAC_DELL_M4_1),
3301         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
3302                                 "unknown Dell", STAC_DELL_M4_1),
3303         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
3304                                 "unknown Dell", STAC_DELL_M4_1),
3305         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
3306                                 "unknown Dell", STAC_DELL_M4_1),
3307         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
3308                                 "unknown Dell", STAC_DELL_M4_2),
3309         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
3310                                 "unknown Dell", STAC_DELL_M4_2),
3311         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
3312                                 "unknown Dell", STAC_DELL_M4_2),
3313         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
3314                                 "unknown Dell", STAC_DELL_M4_2),
3315         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
3316                                 "unknown Dell", STAC_DELL_M4_3),
3317         {} /* terminator */
3318 };
3319
3320 static const struct hda_pintbl ref922x_pin_configs[] = {
3321         { 0x0a, 0x01014010 },
3322         { 0x0b, 0x01016011 },
3323         { 0x0c, 0x01012012 },
3324         { 0x0d, 0x0221401f },
3325         { 0x0e, 0x01813122 },
3326         { 0x0f, 0x01011014 },
3327         { 0x10, 0x01441030 },
3328         { 0x11, 0x01c41030 },
3329         { 0x15, 0x40000100 },
3330         { 0x1b, 0x40000100 },
3331         {}
3332 };
3333
3334 /*
3335     STAC 922X pin configs for
3336     102801A7
3337     102801AB
3338     102801A9
3339     102801D1
3340     102801D2
3341 */
3342 static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
3343         { 0x0a, 0x02214030 },
3344         { 0x0b, 0x01a19021 },
3345         { 0x0c, 0x01111012 },
3346         { 0x0d, 0x01114010 },
3347         { 0x0e, 0x02a19020 },
3348         { 0x0f, 0x01117011 },
3349         { 0x10, 0x400001f0 },
3350         { 0x11, 0x400001f1 },
3351         { 0x15, 0x01813122 },
3352         { 0x1b, 0x400001f2 },
3353         {}
3354 };
3355
3356 /*
3357     STAC 922X pin configs for
3358     102801AC
3359     102801D0
3360 */
3361 static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
3362         { 0x0a, 0x02214030 },
3363         { 0x0b, 0x01a19021 },
3364         { 0x0c, 0x01111012 },
3365         { 0x0d, 0x01114010 },
3366         { 0x0e, 0x02a19020 },
3367         { 0x0f, 0x01117011 },
3368         { 0x10, 0x01451140 },
3369         { 0x11, 0x400001f0 },
3370         { 0x15, 0x01813122 },
3371         { 0x1b, 0x400001f1 },
3372         {}
3373 };
3374
3375 /*
3376     STAC 922X pin configs for
3377     102801BF
3378 */
3379 static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
3380         { 0x0a, 0x0321101f },
3381         { 0x0b, 0x01112024 },
3382         { 0x0c, 0x01111222 },
3383         { 0x0d, 0x91174220 },
3384         { 0x0e, 0x03a11050 },
3385         { 0x0f, 0x01116221 },
3386         { 0x10, 0x90a70330 },
3387         { 0x11, 0x01452340 },
3388         { 0x15, 0x40C003f1 },
3389         { 0x1b, 0x405003f0 },
3390         {}
3391 };
3392
3393 /*
3394     STAC 9221 A1 pin configs for
3395     102801D7 (Dell XPS M1210)
3396 */
3397 static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
3398         { 0x0a, 0x02211211 },
3399         { 0x0b, 0x408103ff },
3400         { 0x0c, 0x02a1123e },
3401         { 0x0d, 0x90100310 },
3402         { 0x0e, 0x408003f1 },
3403         { 0x0f, 0x0221121f },
3404         { 0x10, 0x03451340 },
3405         { 0x11, 0x40c003f2 },
3406         { 0x15, 0x508003f3 },
3407         { 0x1b, 0x405003f4 },
3408         {}
3409 };
3410
3411 static const struct hda_pintbl d945gtp3_pin_configs[] = {
3412         { 0x0a, 0x0221401f },
3413         { 0x0b, 0x01a19022 },
3414         { 0x0c, 0x01813021 },
3415         { 0x0d, 0x01014010 },
3416         { 0x0e, 0x40000100 },
3417         { 0x0f, 0x40000100 },
3418         { 0x10, 0x40000100 },
3419         { 0x11, 0x40000100 },
3420         { 0x15, 0x02a19120 },
3421         { 0x1b, 0x40000100 },
3422         {}
3423 };
3424
3425 static const struct hda_pintbl d945gtp5_pin_configs[] = {
3426         { 0x0a, 0x0221401f },
3427         { 0x0b, 0x01011012 },
3428         { 0x0c, 0x01813024 },
3429         { 0x0d, 0x01014010 },
3430         { 0x0e, 0x01a19021 },
3431         { 0x0f, 0x01016011 },
3432         { 0x10, 0x01452130 },
3433         { 0x11, 0x40000100 },
3434         { 0x15, 0x02a19320 },
3435         { 0x1b, 0x40000100 },
3436         {}
3437 };
3438
3439 static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
3440         { 0x0a, 0x0121e21f },
3441         { 0x0b, 0x400000ff },
3442         { 0x0c, 0x9017e110 },
3443         { 0x0d, 0x400000fd },
3444         { 0x0e, 0x400000fe },
3445         { 0x0f, 0x0181e020 },
3446         { 0x10, 0x1145e030 },
3447         { 0x11, 0x11c5e240 },
3448         { 0x15, 0x400000fc },
3449         { 0x1b, 0x400000fb },
3450         {}
3451 };
3452
3453 static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
3454         { 0x0a, 0x0121e21f },
3455         { 0x0b, 0x90a7012e },
3456         { 0x0c, 0x9017e110 },
3457         { 0x0d, 0x400000fd },
3458         { 0x0e, 0x400000fe },
3459         { 0x0f, 0x0181e020 },
3460         { 0x10, 0x1145e230 },
3461         { 0x11, 0x500000fa },
3462         { 0x15, 0x400000fc },
3463         { 0x1b, 0x400000fb },
3464         {}
3465 };
3466
3467 static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
3468         { 0x0a, 0x0121e21f },
3469         { 0x0b, 0x90a7012e },
3470         { 0x0c, 0x9017e110 },
3471         { 0x0d, 0x400000fd },
3472         { 0x0e, 0x400000fe },
3473         { 0x0f, 0x0181e020 },
3474         { 0x10, 0x1145e230 },
3475         { 0x11, 0x11c5e240 },
3476         { 0x15, 0x400000fc },
3477         { 0x1b, 0x400000fb },
3478         {}
3479 };
3480
3481 static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
3482         { 0x0a, 0x0321e21f },
3483         { 0x0b, 0x03a1e02e },
3484         { 0x0c, 0x9017e110 },
3485         { 0x0d, 0x9017e11f },
3486         { 0x0e, 0x400000fe },
3487         { 0x0f, 0x0381e020 },
3488         { 0x10, 0x1345e230 },
3489         { 0x11, 0x13c5e240 },
3490         { 0x15, 0x400000fc },
3491         { 0x1b, 0x400000fb },
3492         {}
3493 };
3494
3495 static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
3496         { 0x0a, 0x0321e21f },
3497         { 0x0b, 0x03a1e02e },
3498         { 0x0c, 0x9017e110 },
3499         { 0x0d, 0x9017e11f },
3500         { 0x0e, 0x400000fe },
3501         { 0x0f, 0x0381e020 },
3502         { 0x10, 0x1345e230 },
3503         { 0x11, 0x13c5e240 },
3504         { 0x15, 0x400000fc },
3505         { 0x1b, 0x400000fb },
3506         {}
3507 };
3508
3509 static const struct hda_pintbl ecs202_pin_configs[] = {
3510         { 0x0a, 0x0221401f },
3511         { 0x0b, 0x02a19020 },
3512         { 0x0c, 0x01a19020 },
3513         { 0x0d, 0x01114010 },
3514         { 0x0e, 0x408000f0 },
3515         { 0x0f, 0x01813022 },
3516         { 0x10, 0x074510a0 },
3517         { 0x11, 0x40c400f1 },
3518         { 0x15, 0x9037012e },
3519         { 0x1b, 0x40e000f2 },
3520         {}
3521 };
3522
3523 /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
3524 static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
3525         SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
3526         SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
3527         SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
3528         SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
3529         SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
3530         SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
3531         SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
3532         SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
3533         SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
3534         SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
3535         SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
3536         SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
3537         SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
3538         {}
3539 };
3540
3541 static const struct hda_fixup stac922x_fixups[];
3542
3543 /* remap the fixup from codec SSID and apply it */
3544 static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
3545                                           const struct hda_fixup *fix,
3546                                           int action)
3547 {
3548         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3549                 return;
3550
3551         codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
3552         snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
3553                            stac922x_fixups);
3554         if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
3555                 snd_hda_apply_fixup(codec, action);
3556 }
3557
3558 static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
3559                                           const struct hda_fixup *fix,
3560                                           int action)
3561 {
3562         struct sigmatel_spec *spec = codec->spec;
3563
3564         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3565                 spec->gpio_mask = spec->gpio_dir = 0x03;
3566                 spec->gpio_data = 0x03;
3567         }
3568 }
3569
3570 static const struct hda_fixup stac922x_fixups[] = {
3571         [STAC_D945_REF] = {
3572                 .type = HDA_FIXUP_PINS,
3573                 .v.pins = ref922x_pin_configs,
3574         },
3575         [STAC_D945GTP3] = {
3576                 .type = HDA_FIXUP_PINS,
3577                 .v.pins = d945gtp3_pin_configs,
3578         },
3579         [STAC_D945GTP5] = {
3580                 .type = HDA_FIXUP_PINS,
3581                 .v.pins = d945gtp5_pin_configs,
3582         },
3583         [STAC_INTEL_MAC_AUTO] = {
3584                 .type = HDA_FIXUP_FUNC,
3585                 .v.func = stac922x_fixup_intel_mac_auto,
3586         },
3587         [STAC_INTEL_MAC_V1] = {
3588                 .type = HDA_FIXUP_PINS,
3589                 .v.pins = intel_mac_v1_pin_configs,
3590                 .chained = true,
3591                 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3592         },
3593         [STAC_INTEL_MAC_V2] = {
3594                 .type = HDA_FIXUP_PINS,
3595                 .v.pins = intel_mac_v2_pin_configs,
3596                 .chained = true,
3597                 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3598         },
3599         [STAC_INTEL_MAC_V3] = {
3600                 .type = HDA_FIXUP_PINS,
3601                 .v.pins = intel_mac_v3_pin_configs,
3602                 .chained = true,
3603                 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3604         },
3605         [STAC_INTEL_MAC_V4] = {
3606                 .type = HDA_FIXUP_PINS,
3607                 .v.pins = intel_mac_v4_pin_configs,
3608                 .chained = true,
3609                 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3610         },
3611         [STAC_INTEL_MAC_V5] = {
3612                 .type = HDA_FIXUP_PINS,
3613                 .v.pins = intel_mac_v5_pin_configs,
3614                 .chained = true,
3615                 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3616         },
3617         [STAC_922X_INTEL_MAC_GPIO] = {
3618                 .type = HDA_FIXUP_FUNC,
3619                 .v.func = stac922x_fixup_intel_mac_gpio,
3620         },
3621         [STAC_ECS_202] = {
3622                 .type = HDA_FIXUP_PINS,
3623                 .v.pins = ecs202_pin_configs,
3624         },
3625         [STAC_922X_DELL_D81] = {
3626                 .type = HDA_FIXUP_PINS,
3627                 .v.pins = dell_922x_d81_pin_configs,
3628         },
3629         [STAC_922X_DELL_D82] = {
3630                 .type = HDA_FIXUP_PINS,
3631                 .v.pins = dell_922x_d82_pin_configs,
3632         },
3633         [STAC_922X_DELL_M81] = {
3634                 .type = HDA_FIXUP_PINS,
3635                 .v.pins = dell_922x_m81_pin_configs,
3636         },
3637         [STAC_922X_DELL_M82] = {
3638                 .type = HDA_FIXUP_PINS,
3639                 .v.pins = dell_922x_m82_pin_configs,
3640         },
3641 };
3642
3643 static const struct hda_model_fixup stac922x_models[] = {
3644         { .id = STAC_D945_REF, .name = "ref" },
3645         { .id = STAC_D945GTP5, .name = "5stack" },
3646         { .id = STAC_D945GTP3, .name = "3stack" },
3647         { .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
3648         { .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
3649         { .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
3650         { .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
3651         { .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
3652         { .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
3653         { .id = STAC_ECS_202, .name = "ecs202" },
3654         { .id = STAC_922X_DELL_D81, .name = "dell-d81" },
3655         { .id = STAC_922X_DELL_D82, .name = "dell-d82" },
3656         { .id = STAC_922X_DELL_M81, .name = "dell-m81" },
3657         { .id = STAC_922X_DELL_M82, .name = "dell-m82" },
3658         /* for backward compatibility */
3659         { .id = STAC_INTEL_MAC_V3, .name = "macmini" },
3660         { .id = STAC_INTEL_MAC_V5, .name = "macbook" },
3661         { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
3662         { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
3663         { .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
3664         { .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
3665         {}
3666 };
3667
3668 static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
3669         /* SigmaTel reference board */
3670         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3671                       "DFI LanParty", STAC_D945_REF),
3672         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3673                       "DFI LanParty", STAC_D945_REF),
3674         /* Intel 945G based systems */
3675         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
3676                       "Intel D945G", STAC_D945GTP3),
3677         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
3678                       "Intel D945G", STAC_D945GTP3),
3679         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
3680                       "Intel D945G", STAC_D945GTP3),
3681         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
3682                       "Intel D945G", STAC_D945GTP3),
3683         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
3684                       "Intel D945G", STAC_D945GTP3),
3685         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
3686                       "Intel D945G", STAC_D945GTP3),
3687         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
3688                       "Intel D945G", STAC_D945GTP3),
3689         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
3690                       "Intel D945G", STAC_D945GTP3),
3691         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
3692                       "Intel D945G", STAC_D945GTP3),
3693         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
3694                       "Intel D945G", STAC_D945GTP3),
3695         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
3696                       "Intel D945G", STAC_D945GTP3),
3697         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
3698                       "Intel D945G", STAC_D945GTP3),
3699         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
3700                       "Intel D945G", STAC_D945GTP3),
3701         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
3702                       "Intel D945G", STAC_D945GTP3),
3703         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
3704                       "Intel D945G", STAC_D945GTP3),
3705         /* Intel D945G 5-stack systems */
3706         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
3707                       "Intel D945G", STAC_D945GTP5),
3708         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
3709                       "Intel D945G", STAC_D945GTP5),
3710         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
3711                       "Intel D945G", STAC_D945GTP5),
3712         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
3713                       "Intel D945G", STAC_D945GTP5),
3714         /* Intel 945P based systems */
3715         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
3716                       "Intel D945P", STAC_D945GTP3),
3717         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
3718                       "Intel D945P", STAC_D945GTP3),
3719         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
3720                       "Intel D945P", STAC_D945GTP3),
3721         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
3722                       "Intel D945P", STAC_D945GTP3),
3723         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
3724                       "Intel D945P", STAC_D945GTP3),
3725         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
3726                       "Intel D945P", STAC_D945GTP5),
3727         /* other intel */
3728         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
3729                       "Intel D945", STAC_D945_REF),
3730         /* other systems  */
3731
3732         /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
3733         SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
3734
3735         /* Dell systems  */
3736         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
3737                       "unknown Dell", STAC_922X_DELL_D81),
3738         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
3739                       "unknown Dell", STAC_922X_DELL_D81),
3740         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
3741                       "unknown Dell", STAC_922X_DELL_D81),
3742         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
3743                       "unknown Dell", STAC_922X_DELL_D82),
3744         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
3745                       "unknown Dell", STAC_922X_DELL_M81),
3746         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
3747                       "unknown Dell", STAC_922X_DELL_D82),
3748         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
3749                       "unknown Dell", STAC_922X_DELL_D81),
3750         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
3751                       "unknown Dell", STAC_922X_DELL_D81),
3752         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
3753                       "Dell XPS M1210", STAC_922X_DELL_M82),
3754         /* ECS/PC Chips boards */
3755         SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
3756                       "ECS/PC chips", STAC_ECS_202),
3757         {} /* terminator */
3758 };
3759
3760 static const struct hda_pintbl ref927x_pin_configs[] = {
3761         { 0x0a, 0x02214020 },
3762         { 0x0b, 0x02a19080 },
3763         { 0x0c, 0x0181304e },
3764         { 0x0d, 0x01014010 },
3765         { 0x0e, 0x01a19040 },
3766         { 0x0f, 0x01011012 },
3767         { 0x10, 0x01016011 },
3768         { 0x11, 0x0101201f },
3769         { 0x12, 0x183301f0 },
3770         { 0x13, 0x18a001f0 },
3771         { 0x14, 0x18a001f0 },
3772         { 0x21, 0x01442070 },
3773         { 0x22, 0x01c42190 },
3774         { 0x23, 0x40000100 },
3775         {}
3776 };
3777
3778 static const struct hda_pintbl d965_3st_pin_configs[] = {
3779         { 0x0a, 0x0221401f },
3780         { 0x0b, 0x02a19120 },
3781         { 0x0c, 0x40000100 },
3782         { 0x0d, 0x01014011 },
3783         { 0x0e, 0x01a19021 },
3784         { 0x0f, 0x01813024 },
3785         { 0x10, 0x40000100 },
3786         { 0x11, 0x40000100 },
3787         { 0x12, 0x40000100 },
3788         { 0x13, 0x40000100 },
3789         { 0x14, 0x40000100 },
3790         { 0x21, 0x40000100 },
3791         { 0x22, 0x40000100 },
3792         { 0x23, 0x40000100 },
3793         {}
3794 };
3795
3796 static const struct hda_pintbl d965_5st_pin_configs[] = {
3797         { 0x0a, 0x02214020 },
3798         { 0x0b, 0x02a19080 },
3799         { 0x0c, 0x0181304e },
3800         { 0x0d, 0x01014010 },
3801         { 0x0e, 0x01a19040 },
3802         { 0x0f, 0x01011012 },
3803         { 0x10, 0x01016011 },
3804         { 0x11, 0x40000100 },
3805         { 0x12, 0x40000100 },
3806         { 0x13, 0x40000100 },
3807         { 0x14, 0x40000100 },
3808         { 0x21, 0x01442070 },
3809         { 0x22, 0x40000100 },
3810         { 0x23, 0x40000100 },
3811         {}
3812 };
3813
3814 static const struct hda_pintbl d965_5st_no_fp_pin_configs[] = {
3815         { 0x0a, 0x40000100 },
3816         { 0x0b, 0x40000100 },
3817         { 0x0c, 0x0181304e },
3818         { 0x0d, 0x01014010 },
3819         { 0x0e, 0x01a19040 },
3820         { 0x0f, 0x01011012 },
3821         { 0x10, 0x01016011 },
3822         { 0x11, 0x40000100 },
3823         { 0x12, 0x40000100 },
3824         { 0x13, 0x40000100 },
3825         { 0x14, 0x40000100 },
3826         { 0x21, 0x01442070 },
3827         { 0x22, 0x40000100 },
3828         { 0x23, 0x40000100 },
3829         {}
3830 };
3831
3832 static const struct hda_pintbl dell_3st_pin_configs[] = {
3833         { 0x0a, 0x02211230 },
3834         { 0x0b, 0x02a11220 },
3835         { 0x0c, 0x01a19040 },
3836         { 0x0d, 0x01114210 },
3837         { 0x0e, 0x01111212 },
3838         { 0x0f, 0x01116211 },
3839         { 0x10, 0x01813050 },
3840         { 0x11, 0x01112214 },
3841         { 0x12, 0x403003fa },
3842         { 0x13, 0x90a60040 },
3843         { 0x14, 0x90a60040 },
3844         { 0x21, 0x404003fb },
3845         { 0x22, 0x40c003fc },
3846         { 0x23, 0x40000100 },
3847         {}
3848 };
3849
3850 static void stac927x_fixup_ref_no_jd(struct hda_codec *codec,
3851                                      const struct hda_fixup *fix, int action)
3852 {
3853         /* no jack detecion for ref-no-jd model */
3854         if (action == HDA_FIXUP_ACT_PRE_PROBE)
3855                 codec->no_jack_detect = 1;
3856 }
3857
3858 static void stac927x_fixup_ref(struct hda_codec *codec,
3859                                const struct hda_fixup *fix, int action)
3860 {
3861         struct sigmatel_spec *spec = codec->spec;
3862
3863         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3864                 snd_hda_apply_pincfgs(codec, ref927x_pin_configs);
3865                 spec->eapd_mask = spec->gpio_mask = 0;
3866                 spec->gpio_dir = spec->gpio_data = 0;
3867         }
3868 }
3869
3870 static void stac927x_fixup_dell_dmic(struct hda_codec *codec,
3871                                      const struct hda_fixup *fix, int action)
3872 {
3873         struct sigmatel_spec *spec = codec->spec;
3874
3875         if (action != HDA_FIXUP_ACT_PRE_PROBE)
3876                 return;
3877
3878         if (codec->core.subsystem_id != 0x1028022f) {
3879                 /* GPIO2 High = Enable EAPD */
3880                 spec->eapd_mask = spec->gpio_mask = 0x04;
3881                 spec->gpio_dir = spec->gpio_data = 0x04;
3882         }
3883
3884         snd_hda_add_verbs(codec, dell_3st_core_init);
3885         spec->volknob_init = 1;
3886 }
3887
3888 static void stac927x_fixup_volknob(struct hda_codec *codec,
3889                                    const struct hda_fixup *fix, int action)
3890 {
3891         struct sigmatel_spec *spec = codec->spec;
3892
3893         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3894                 snd_hda_add_verbs(codec, stac927x_volknob_core_init);
3895                 spec->volknob_init = 1;
3896         }
3897 }
3898
3899 static const struct hda_fixup stac927x_fixups[] = {
3900         [STAC_D965_REF_NO_JD] = {
3901                 .type = HDA_FIXUP_FUNC,
3902                 .v.func = stac927x_fixup_ref_no_jd,
3903                 .chained = true,
3904                 .chain_id = STAC_D965_REF,
3905         },
3906         [STAC_D965_REF] = {
3907                 .type = HDA_FIXUP_FUNC,
3908                 .v.func = stac927x_fixup_ref,
3909         },
3910         [STAC_D965_3ST] = {
3911                 .type = HDA_FIXUP_PINS,
3912                 .v.pins = d965_3st_pin_configs,
3913                 .chained = true,
3914                 .chain_id = STAC_D965_VERBS,
3915         },
3916         [STAC_D965_5ST] = {
3917                 .type = HDA_FIXUP_PINS,
3918                 .v.pins = d965_5st_pin_configs,
3919                 .chained = true,
3920                 .chain_id = STAC_D965_VERBS,
3921         },
3922         [STAC_D965_VERBS] = {
3923                 .type = HDA_FIXUP_VERBS,
3924                 .v.verbs = d965_core_init,
3925         },
3926         [STAC_D965_5ST_NO_FP] = {
3927                 .type = HDA_FIXUP_PINS,
3928                 .v.pins = d965_5st_no_fp_pin_configs,
3929         },
3930         [STAC_NEMO_DEFAULT] = {
3931                 .type = HDA_FIXUP_PINS,
3932                 .v.pins = nemo_pin_configs,
3933         },
3934         [STAC_DELL_3ST] = {
3935                 .type = HDA_FIXUP_PINS,
3936                 .v.pins = dell_3st_pin_configs,
3937                 .chained = true,
3938                 .chain_id = STAC_927X_DELL_DMIC,
3939         },
3940         [STAC_DELL_BIOS] = {
3941                 .type = HDA_FIXUP_PINS,
3942                 .v.pins = (const struct hda_pintbl[]) {
3943                         /* correct the front output jack as a hp out */
3944                         { 0x0f, 0x0221101f },
3945                         /* correct the front input jack as a mic */
3946                         { 0x0e, 0x02a79130 },
3947                         {}
3948                 },
3949                 .chained = true,
3950                 .chain_id = STAC_927X_DELL_DMIC,
3951         },
3952         [STAC_DELL_BIOS_AMIC] = {
3953                 .type = HDA_FIXUP_PINS,
3954                 .v.pins = (const struct hda_pintbl[]) {
3955                         /* configure the analog microphone on some laptops */
3956                         { 0x0c, 0x90a79130 },
3957                         {}
3958                 },
3959                 .chained = true,
3960                 .chain_id = STAC_DELL_BIOS,
3961         },
3962         [STAC_DELL_BIOS_SPDIF] = {
3963                 .type = HDA_FIXUP_PINS,
3964                 .v.pins = (const struct hda_pintbl[]) {
3965                         /* correct the device field to SPDIF out */
3966                         { 0x21, 0x01442070 },
3967                         {}
3968                 },
3969                 .chained = true,
3970                 .chain_id = STAC_DELL_BIOS,
3971         },
3972         [STAC_927X_DELL_DMIC] = {
3973                 .type = HDA_FIXUP_FUNC,
3974                 .v.func = stac927x_fixup_dell_dmic,
3975         },
3976         [STAC_927X_VOLKNOB] = {
3977                 .type = HDA_FIXUP_FUNC,
3978                 .v.func = stac927x_fixup_volknob,
3979         },
3980 };
3981
3982 static const struct hda_model_fixup stac927x_models[] = {
3983         { .id = STAC_D965_REF_NO_JD, .name = "ref-no-jd" },
3984         { .id = STAC_D965_REF, .name = "ref" },
3985         { .id = STAC_D965_3ST, .name = "3stack" },
3986         { .id = STAC_D965_5ST, .name = "5stack" },
3987         { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
3988         { .id = STAC_DELL_3ST, .name = "dell-3stack" },
3989         { .id = STAC_DELL_BIOS, .name = "dell-bios" },
3990         { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
3991         { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
3992         { .id = STAC_927X_VOLKNOB, .name = "volknob" },
3993         {}
3994 };
3995
3996 static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
3997         /* SigmaTel reference board */
3998         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3999                       "DFI LanParty", STAC_D965_REF),
4000         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
4001                       "DFI LanParty", STAC_D965_REF),
4002          /* Intel 946 based systems */
4003         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
4004         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
4005         /* 965 based 3 stack systems */
4006         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
4007                            "Intel D965", STAC_D965_3ST),
4008         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
4009                            "Intel D965", STAC_D965_3ST),
4010         /* Dell 3 stack systems */
4011         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
4012         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01ed, "Dell     ", STAC_DELL_3ST),
4013         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f4, "Dell     ", STAC_DELL_3ST),
4014         /* Dell 3 stack systems with verb table in BIOS */
4015         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
4016         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
4017         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0227, "Dell Vostro 1400  ", STAC_DELL_BIOS),
4018         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022e, "Dell     ", STAC_DELL_BIOS_SPDIF),
4019         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
4020         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0242, "Dell     ", STAC_DELL_BIOS),
4021         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0243, "Dell     ", STAC_DELL_BIOS),
4022         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x02ff, "Dell     ", STAC_DELL_BIOS),
4023         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF),
4024         /* 965 based 5 stack systems */
4025         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
4026                            "Intel D965", STAC_D965_5ST),
4027         SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
4028                            "Intel D965", STAC_D965_5ST),
4029         /* Nemo */
4030         SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
4031         /* volume-knob fixes */
4032         SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
4033         {} /* terminator */
4034 };
4035
4036 static const struct hda_pintbl ref9205_pin_configs[] = {
4037         { 0x0a, 0x40000100 },
4038         { 0x0b, 0x40000100 },
4039         { 0x0c, 0x01016011 },
4040         { 0x0d, 0x01014010 },
4041         { 0x0e, 0x01813122 },
4042         { 0x0f, 0x01a19021 },
4043         { 0x14, 0x01019020 },
4044         { 0x16, 0x40000100 },
4045         { 0x17, 0x90a000f0 },
4046         { 0x18, 0x90a000f0 },
4047         { 0x21, 0x01441030 },
4048         { 0x22, 0x01c41030 },
4049         {}
4050 };
4051
4052 /*
4053     STAC 9205 pin configs for
4054     102801F1
4055     102801F2
4056     102801FC
4057     102801FD
4058     10280204
4059     1028021F
4060     10280228 (Dell Vostro 1500)
4061     10280229 (Dell Vostro 1700)
4062 */
4063 static const struct hda_pintbl dell_9205_m42_pin_configs[] = {
4064         { 0x0a, 0x0321101F },
4065         { 0x0b, 0x03A11020 },
4066         { 0x0c, 0x400003FA },
4067         { 0x0d, 0x90170310 },
4068         { 0x0e, 0x400003FB },
4069         { 0x0f, 0x400003FC },
4070         { 0x14, 0x400003FD },
4071         { 0x16, 0x40F000F9 },
4072         { 0x17, 0x90A60330 },
4073         { 0x18, 0x400003FF },
4074         { 0x21, 0x0144131F },
4075         { 0x22, 0x40C003FE },
4076         {}
4077 };
4078
4079 /*
4080     STAC 9205 pin configs for
4081     102801F9
4082     102801FA
4083     102801FE
4084     102801FF (Dell Precision M4300)
4085     10280206
4086     10280200
4087     10280201
4088 */
4089 static const struct hda_pintbl dell_9205_m43_pin_configs[] = {
4090         { 0x0a, 0x0321101f },
4091         { 0x0b, 0x03a11020 },
4092         { 0x0c, 0x90a70330 },
4093         { 0x0d, 0x90170310 },
4094         { 0x0e, 0x400000fe },
4095         { 0x0f, 0x400000ff },
4096         { 0x14, 0x400000fd },
4097         { 0x16, 0x40f000f9 },
4098         { 0x17, 0x400000fa },
4099         { 0x18, 0x400000fc },
4100         { 0x21, 0x0144131f },
4101         { 0x22, 0x40c003f8 },
4102         /* Enable SPDIF in/out */
4103         { 0x1f, 0x01441030 },
4104         { 0x20, 0x1c410030 },
4105         {}
4106 };
4107
4108 static const struct hda_pintbl dell_9205_m44_pin_configs[] = {
4109         { 0x0a, 0x0421101f },
4110         { 0x0b, 0x04a11020 },
4111         { 0x0c, 0x400003fa },
4112         { 0x0d, 0x90170310 },
4113         { 0x0e, 0x400003fb },
4114         { 0x0f, 0x400003fc },
4115         { 0x14, 0x400003fd },
4116         { 0x16, 0x400003f9 },
4117         { 0x17, 0x90a60330 },
4118         { 0x18, 0x400003ff },
4119         { 0x21, 0x01441340 },
4120         { 0x22, 0x40c003fe },
4121         {}
4122 };
4123
4124 static void stac9205_fixup_ref(struct hda_codec *codec,
4125                                const struct hda_fixup *fix, int action)
4126 {
4127         struct sigmatel_spec *spec = codec->spec;
4128
4129         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4130                 snd_hda_apply_pincfgs(codec, ref9205_pin_configs);
4131                 /* SPDIF-In enabled */
4132                 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0;
4133         }
4134 }
4135
4136 static void stac9205_fixup_dell_m43(struct hda_codec *codec,
4137                                     const struct hda_fixup *fix, int action)
4138 {
4139         struct sigmatel_spec *spec = codec->spec;
4140         struct hda_jack_callback *jack;
4141
4142         if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4143                 snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs);
4144
4145                 /* Enable unsol response for GPIO4/Dock HP connection */
4146                 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4147                         AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
4148                 jack = snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4149                                                            stac_vref_event);
4150                 if (!IS_ERR(jack))
4151                         jack->private_data = 0x01;
4152
4153                 spec->gpio_dir = 0x0b;
4154                 spec->eapd_mask = 0x01;
4155                 spec->gpio_mask = 0x1b;
4156                 spec->gpio_mute = 0x10;
4157                 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4158                  * GPIO3 Low = DRM
4159                  */
4160                 spec->gpio_data = 0x01;
4161         }
4162 }
4163
4164 static void stac9205_fixup_eapd(struct hda_codec *codec,
4165                                 const struct hda_fixup *fix, int action)
4166 {
4167         struct sigmatel_spec *spec = codec->spec;
4168
4169         if (action == HDA_FIXUP_ACT_PRE_PROBE)
4170                 spec->eapd_switch = 0;
4171 }
4172
4173 static const struct hda_fixup stac9205_fixups[] = {
4174         [STAC_9205_REF] = {
4175                 .type = HDA_FIXUP_FUNC,
4176                 .v.func = stac9205_fixup_ref,
4177         },
4178         [STAC_9205_DELL_M42] = {
4179                 .type = HDA_FIXUP_PINS,
4180                 .v.pins = dell_9205_m42_pin_configs,
4181         },
4182         [STAC_9205_DELL_M43] = {
4183                 .type = HDA_FIXUP_FUNC,
4184                 .v.func = stac9205_fixup_dell_m43,
4185         },
4186         [STAC_9205_DELL_M44] = {
4187                 .type = HDA_FIXUP_PINS,
4188                 .v.pins = dell_9205_m44_pin_configs,
4189         },
4190         [STAC_9205_EAPD] = {
4191                 .type = HDA_FIXUP_FUNC,
4192                 .v.func = stac9205_fixup_eapd,
4193         },
4194         {}
4195 };
4196
4197 static const struct hda_model_fixup stac9205_models[] = {
4198         { .id = STAC_9205_REF, .name = "ref" },
4199         { .id = STAC_9205_DELL_M42, .name = "dell-m42" },
4200         { .id = STAC_9205_DELL_M43, .name = "dell-m43" },
4201         { .id = STAC_9205_DELL_M44, .name = "dell-m44" },
4202         { .id = STAC_9205_EAPD, .name = "eapd" },
4203         {}
4204 };
4205
4206 static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
4207         /* SigmaTel reference board */
4208         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
4209                       "DFI LanParty", STAC_9205_REF),
4210         SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
4211                       "SigmaTel", STAC_9205_REF),
4212         SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
4213                       "DFI LanParty", STAC_9205_REF),
4214         /* Dell */
4215         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
4216                       "unknown Dell", STAC_9205_DELL_M42),
4217         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
4218                       "unknown Dell", STAC_9205_DELL_M42),
4219         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
4220                       "Dell Precision", STAC_9205_DELL_M43),
4221         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
4222                       "Dell Precision", STAC_9205_DELL_M43),
4223         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
4224                       "Dell Precision", STAC_9205_DELL_M43),
4225         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
4226                       "unknown Dell", STAC_9205_DELL_M42),
4227         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
4228                       "unknown Dell", STAC_9205_DELL_M42),
4229         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
4230                       "Dell Precision", STAC_9205_DELL_M43),
4231         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
4232                       "Dell Precision M4300", STAC_9205_DELL_M43),
4233         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
4234                       "unknown Dell", STAC_9205_DELL_M42),
4235         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
4236                       "Dell Precision", STAC_9205_DELL_M43),
4237         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
4238                       "Dell Precision", STAC_9205_DELL_M43),
4239         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
4240                       "Dell Precision", STAC_9205_DELL_M43),
4241         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
4242                       "Dell Inspiron", STAC_9205_DELL_M44),
4243         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
4244                       "Dell Vostro 1500", STAC_9205_DELL_M42),
4245         SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
4246                       "Dell Vostro 1700", STAC_9205_DELL_M42),
4247         /* Gateway */
4248         SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
4249         SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
4250         {} /* terminator */
4251 };
4252
4253 static void stac92hd95_fixup_hp_led(struct hda_codec *codec,
4254                                     const struct hda_fixup *fix, int action)
4255 {
4256         struct sigmatel_spec *spec = codec->spec;
4257
4258         if (action != HDA_FIXUP_ACT_PRE_PROBE)
4259                 return;
4260
4261         if (find_mute_led_cfg(codec, spec->default_polarity))
4262                 codec_dbg(codec, "mute LED gpio %d polarity %d\n",
4263                                 spec->gpio_led,
4264                                 spec->gpio_led_polarity);
4265 }
4266
4267 static const struct hda_fixup stac92hd95_fixups[] = {
4268         [STAC_92HD95_HP_LED] = {
4269                 .type = HDA_FIXUP_FUNC,
4270                 .v.func = stac92hd95_fixup_hp_led,
4271         },
4272         [STAC_92HD95_HP_BASS] = {
4273                 .type = HDA_FIXUP_VERBS,
4274                 .v.verbs = (const struct hda_verb[]) {
4275                         {0x1a, 0x795, 0x00}, /* HPF to 100Hz */
4276                         {}
4277                 },
4278                 .chained = true,
4279                 .chain_id = STAC_92HD95_HP_LED,
4280         },
4281 };
4282
4283 static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = {
4284         SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS),
4285         {} /* terminator */
4286 };
4287
4288 static const struct hda_model_fixup stac92hd95_models[] = {
4289         { .id = STAC_92HD95_HP_LED, .name = "hp-led" },
4290         { .id = STAC_92HD95_HP_BASS, .name = "hp-bass" },
4291         {}
4292 };
4293
4294
4295 static int stac_parse_auto_config(struct hda_codec *codec)
4296 {
4297         struct sigmatel_spec *spec = codec->spec;
4298         int err;
4299         int flags = 0;
4300
4301         if (spec->headset_jack)
4302                 flags |= HDA_PINCFG_HEADSET_MIC;
4303
4304         err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, flags);
4305         if (err < 0)
4306                 return err;
4307
4308         /* add hooks */
4309         spec->gen.pcm_playback_hook = stac_playback_pcm_hook;
4310         spec->gen.pcm_capture_hook = stac_capture_pcm_hook;
4311
4312         spec->gen.automute_hook = stac_update_outputs;
4313
4314         err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
4315         if (err < 0)
4316                 return err;
4317
4318         if (spec->vref_mute_led_nid) {
4319                 err = snd_hda_gen_fix_pin_power(codec, spec->vref_mute_led_nid);
4320                 if (err < 0)
4321                         return err;
4322         }
4323
4324         /* setup analog beep controls */
4325         if (spec->anabeep_nid > 0) {
4326                 err = stac_auto_create_beep_ctls(codec,
4327                                                  spec->anabeep_nid);
4328                 if (err < 0)
4329                         return err;
4330         }
4331
4332         /* setup digital beep controls and input device */
4333 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4334         if (spec->gen.beep_nid) {
4335                 hda_nid_t nid = spec->gen.beep_nid;
4336                 unsigned int caps;
4337
4338                 err = stac_auto_create_beep_ctls(codec, nid);
4339                 if (err < 0)
4340                         return err;
4341                 if (codec->beep) {
4342                         /* IDT/STAC codecs have linear beep tone parameter */
4343                         codec->beep->linear_tone = spec->linear_tone_beep;
4344                         /* if no beep switch is available, make its own one */
4345                         caps = query_amp_caps(codec, nid, HDA_OUTPUT);
4346                         if (!(caps & AC_AMPCAP_MUTE)) {
4347                                 err = stac_beep_switch_ctl(codec);
4348                                 if (err < 0)
4349                                         return err;
4350                         }
4351                 }
4352         }
4353 #endif
4354
4355         if (spec->gpio_led)
4356                 spec->gen.vmaster_mute.hook = stac_vmaster_hook;
4357
4358         if (spec->aloopback_ctl &&
4359             snd_hda_get_bool_hint(codec, "loopback") == 1) {
4360                 unsigned int wr_verb =
4361                         spec->aloopback_ctl->private_value >> 16;
4362                 if (snd_hdac_regmap_add_vendor_verb(&codec->core, wr_verb))
4363                         return -ENOMEM;
4364                 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, spec->aloopback_ctl))
4365                         return -ENOMEM;
4366         }
4367
4368         if (spec->have_spdif_mux) {
4369                 err = stac_create_spdif_mux_ctls(codec);
4370                 if (err < 0)
4371                         return err;
4372         }
4373
4374         stac_init_power_map(codec);
4375
4376         return 0;
4377 }
4378
4379 static int stac_init(struct hda_codec *codec)
4380 {
4381         struct sigmatel_spec *spec = codec->spec;
4382         int i;
4383
4384         /* override some hints */
4385         stac_store_hints(codec);
4386
4387         /* set up GPIO */
4388         /* turn on EAPD statically when spec->eapd_switch isn't set.
4389          * otherwise, unsol event will turn it on/off dynamically
4390          */
4391         if (!spec->eapd_switch)
4392                 spec->gpio_data |= spec->eapd_mask;
4393         stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
4394
4395         snd_hda_gen_init(codec);
4396
4397         /* sync the power-map */
4398         if (spec->num_pwrs)
4399                 snd_hda_codec_write(codec, codec->core.afg, 0,
4400                                     AC_VERB_IDT_SET_POWER_MAP,
4401                                     spec->power_map_bits);
4402
4403         /* power down inactive ADCs */
4404         if (spec->powerdown_adcs) {
4405                 for (i = 0; i < spec->gen.num_all_adcs; i++) {
4406                         if (spec->active_adcs & (1 << i))
4407                                 continue;
4408                         snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0,
4409                                             AC_VERB_SET_POWER_STATE,
4410                                             AC_PWRST_D3);
4411                 }
4412         }
4413
4414         return 0;
4415 }
4416
4417 static void stac_shutup(struct hda_codec *codec)
4418 {
4419         struct sigmatel_spec *spec = codec->spec;
4420
4421         snd_hda_shutup_pins(codec);
4422
4423         if (spec->eapd_mask)
4424                 stac_gpio_set(codec, spec->gpio_mask,
4425                                 spec->gpio_dir, spec->gpio_data &
4426                                 ~spec->eapd_mask);
4427 }
4428
4429 #define stac_free       snd_hda_gen_free
4430
4431 #ifdef CONFIG_SND_PROC_FS
4432 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4433                                struct hda_codec *codec, hda_nid_t nid)
4434 {
4435         if (nid == codec->core.afg)
4436                 snd_iprintf(buffer, "Power-Map: 0x%02x\n", 
4437                             snd_hda_codec_read(codec, nid, 0,
4438                                                AC_VERB_IDT_GET_POWER_MAP, 0));
4439 }
4440
4441 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4442                                   struct hda_codec *codec,
4443                                   unsigned int verb)
4444 {
4445         snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4446                     snd_hda_codec_read(codec, codec->core.afg, 0, verb, 0));
4447 }
4448
4449 /* stac92hd71bxx, stac92hd73xx */
4450 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4451                                  struct hda_codec *codec, hda_nid_t nid)
4452 {
4453         stac92hd_proc_hook(buffer, codec, nid);
4454         if (nid == codec->core.afg)
4455                 analog_loop_proc_hook(buffer, codec, 0xfa0);
4456 }
4457
4458 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4459                                struct hda_codec *codec, hda_nid_t nid)
4460 {
4461         if (nid == codec->core.afg)
4462                 analog_loop_proc_hook(buffer, codec, 0xfe0);
4463 }
4464
4465 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4466                                struct hda_codec *codec, hda_nid_t nid)
4467 {
4468         if (nid == codec->core.afg)
4469                 analog_loop_proc_hook(buffer, codec, 0xfeb);
4470 }
4471 #else
4472 #define stac92hd_proc_hook      NULL
4473 #define stac92hd7x_proc_hook    NULL
4474 #define stac9205_proc_hook      NULL
4475 #define stac927x_proc_hook      NULL
4476 #endif
4477
4478 #ifdef CONFIG_PM
4479 static int stac_suspend(struct hda_codec *codec)
4480 {
4481         stac_shutup(codec);
4482         return 0;
4483 }
4484 #else
4485 #define stac_suspend            NULL
4486 #endif /* CONFIG_PM */
4487
4488 static const struct hda_codec_ops stac_patch_ops = {
4489         .build_controls = snd_hda_gen_build_controls,
4490         .build_pcms = snd_hda_gen_build_pcms,
4491         .init = stac_init,
4492         .free = stac_free,
4493         .unsol_event = snd_hda_jack_unsol_event,
4494 #ifdef CONFIG_PM
4495         .suspend = stac_suspend,
4496 #endif
4497         .reboot_notify = stac_shutup,
4498 };
4499
4500 static int alloc_stac_spec(struct hda_codec *codec)
4501 {
4502         struct sigmatel_spec *spec;
4503
4504         spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4505         if (!spec)
4506                 return -ENOMEM;
4507         snd_hda_gen_spec_init(&spec->gen);
4508         codec->spec = spec;
4509         codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
4510         spec->gen.dac_min_mute = true;
4511         codec->patch_ops = stac_patch_ops;
4512         return 0;
4513 }
4514
4515 static int patch_stac9200(struct hda_codec *codec)
4516 {
4517         struct sigmatel_spec *spec;
4518         int err;
4519
4520         err = alloc_stac_spec(codec);
4521         if (err < 0)
4522                 return err;
4523
4524         spec = codec->spec;
4525         spec->linear_tone_beep = 1;
4526         spec->gen.own_eapd_ctl = 1;
4527
4528         codec->power_filter = snd_hda_codec_eapd_power_filter;
4529
4530         snd_hda_add_verbs(codec, stac9200_eapd_init);
4531
4532         snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
4533                            stac9200_fixups);
4534         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4535
4536         err = stac_parse_auto_config(codec);
4537         if (err < 0) {
4538                 stac_free(codec);
4539                 return err;
4540         }
4541
4542         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4543
4544         return 0;
4545 }
4546
4547 static int patch_stac925x(struct hda_codec *codec)
4548 {
4549         struct sigmatel_spec *spec;
4550         int err;
4551
4552         err = alloc_stac_spec(codec);
4553         if (err < 0)
4554                 return err;
4555
4556         spec = codec->spec;
4557         spec->linear_tone_beep = 1;
4558         spec->gen.own_eapd_ctl = 1;
4559
4560         snd_hda_add_verbs(codec, stac925x_core_init);
4561
4562         snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
4563                            stac925x_fixups);
4564         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4565
4566         err = stac_parse_auto_config(codec);
4567         if (err < 0) {
4568                 stac_free(codec);
4569                 return err;
4570         }
4571
4572         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4573
4574         return 0;
4575 }
4576
4577 static int patch_stac92hd73xx(struct hda_codec *codec)
4578 {
4579         struct sigmatel_spec *spec;
4580         int err;
4581         int num_dacs;
4582
4583         err = alloc_stac_spec(codec);
4584         if (err < 0)
4585                 return err;
4586
4587         spec = codec->spec;
4588         /* enable power_save_node only for new 92HD89xx chips, as it causes
4589          * click noises on old 92HD73xx chips.
4590          */
4591         if ((codec->core.vendor_id & 0xfffffff0) != 0x111d7670)
4592                 codec->power_save_node = 1;
4593         spec->linear_tone_beep = 0;
4594         spec->gen.mixer_nid = 0x1d;
4595         spec->have_spdif_mux = 1;
4596
4597         num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
4598         if (num_dacs < 3 || num_dacs > 5) {
4599                 codec_warn(codec,
4600                            "Could not determine number of channels defaulting to DAC count\n");
4601                 num_dacs = 5;
4602         }
4603
4604         switch (num_dacs) {
4605         case 0x3: /* 6 Channel */
4606                 spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
4607                 break;
4608         case 0x4: /* 8 Channel */
4609                 spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
4610                 break;
4611         case 0x5: /* 10 Channel */
4612                 spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
4613                 break;
4614         }
4615
4616         spec->aloopback_mask = 0x01;
4617         spec->aloopback_shift = 8;
4618
4619         spec->gen.beep_nid = 0x1c; /* digital beep */
4620
4621         /* GPIO0 High = Enable EAPD */
4622         spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4623         spec->gpio_data = 0x01;
4624
4625         spec->eapd_switch = 1;
4626
4627         spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4628         spec->pwr_nids = stac92hd73xx_pwr_nids;
4629
4630         spec->gen.own_eapd_ctl = 1;
4631         spec->gen.power_down_unused = 1;
4632
4633         snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
4634                            stac92hd73xx_fixups);
4635         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4636
4637         if (!spec->volknob_init)
4638                 snd_hda_add_verbs(codec, stac92hd73xx_core_init);
4639
4640         err = stac_parse_auto_config(codec);
4641         if (err < 0) {
4642                 stac_free(codec);
4643                 return err;
4644         }
4645
4646         /* Don't GPIO-mute speakers if there are no internal speakers, because
4647          * the GPIO might be necessary for Headphone
4648          */
4649         if (spec->eapd_switch && !has_builtin_speaker(codec))
4650                 spec->eapd_switch = 0;
4651
4652         codec->proc_widget_hook = stac92hd7x_proc_hook;
4653
4654         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4655
4656         return 0;
4657 }
4658
4659 static void stac_setup_gpio(struct hda_codec *codec)
4660 {
4661         struct sigmatel_spec *spec = codec->spec;
4662
4663         spec->gpio_mask |= spec->eapd_mask;
4664         if (spec->gpio_led) {
4665                 if (!spec->vref_mute_led_nid) {
4666                         spec->gpio_mask |= spec->gpio_led;
4667                         spec->gpio_dir |= spec->gpio_led;
4668                         spec->gpio_data |= spec->gpio_led;
4669                 } else {
4670                         codec->power_filter = stac_vref_led_power_filter;
4671                 }
4672         }
4673
4674         if (spec->mic_mute_led_gpio) {
4675                 spec->gpio_mask |= spec->mic_mute_led_gpio;
4676                 spec->gpio_dir |= spec->mic_mute_led_gpio;
4677                 spec->mic_enabled = 0;
4678                 spec->gpio_data |= spec->mic_mute_led_gpio;
4679
4680                 spec->gen.cap_sync_hook = stac_capture_led_hook;
4681         }
4682 }
4683
4684 static int patch_stac92hd83xxx(struct hda_codec *codec)
4685 {
4686         struct sigmatel_spec *spec;
4687         int err;
4688
4689         err = alloc_stac_spec(codec);
4690         if (err < 0)
4691                 return err;
4692
4693         /* longer delay needed for D3 */
4694         codec->core.power_caps &= ~AC_PWRST_EPSS;
4695
4696         spec = codec->spec;
4697         codec->power_save_node = 1;
4698         spec->linear_tone_beep = 0;
4699         spec->gen.own_eapd_ctl = 1;
4700         spec->gen.power_down_unused = 1;
4701         spec->gen.mixer_nid = 0x1b;
4702
4703         spec->gen.beep_nid = 0x21; /* digital beep */
4704         spec->pwr_nids = stac92hd83xxx_pwr_nids;
4705         spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4706         spec->default_polarity = -1; /* no default cfg */
4707
4708         snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
4709
4710         snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
4711                            stac92hd83xxx_fixups);
4712         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4713
4714         stac_setup_gpio(codec);
4715
4716         err = stac_parse_auto_config(codec);
4717         if (err < 0) {
4718                 stac_free(codec);
4719                 return err;
4720         }
4721
4722         codec->proc_widget_hook = stac92hd_proc_hook;
4723
4724         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4725
4726         return 0;
4727 }
4728
4729 static const hda_nid_t stac92hd95_pwr_nids[] = {
4730         0x0a, 0x0b, 0x0c, 0x0d
4731 };
4732
4733 static int patch_stac92hd95(struct hda_codec *codec)
4734 {
4735         struct sigmatel_spec *spec;
4736         int err;
4737
4738         err = alloc_stac_spec(codec);
4739         if (err < 0)
4740                 return err;
4741
4742         /* longer delay needed for D3 */
4743         codec->core.power_caps &= ~AC_PWRST_EPSS;
4744
4745         spec = codec->spec;
4746         codec->power_save_node = 1;
4747         spec->linear_tone_beep = 0;
4748         spec->gen.own_eapd_ctl = 1;
4749         spec->gen.power_down_unused = 1;
4750
4751         spec->gen.beep_nid = 0x19; /* digital beep */
4752         spec->pwr_nids = stac92hd95_pwr_nids;
4753         spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
4754         spec->default_polarity = 0;
4755
4756         snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl,
4757                            stac92hd95_fixups);
4758         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4759
4760         stac_setup_gpio(codec);
4761
4762         err = stac_parse_auto_config(codec);
4763         if (err < 0) {
4764                 stac_free(codec);
4765                 return err;
4766         }
4767
4768         codec->proc_widget_hook = stac92hd_proc_hook;
4769
4770         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4771
4772         return 0;
4773 }
4774
4775 static int patch_stac92hd71bxx(struct hda_codec *codec)
4776 {
4777         struct sigmatel_spec *spec;
4778         const hda_nid_t *unmute_nids = stac92hd71bxx_unmute_nids;
4779         int err;
4780
4781         err = alloc_stac_spec(codec);
4782         if (err < 0)
4783                 return err;
4784
4785         spec = codec->spec;
4786         /* disabled power_save_node since it causes noises on a Dell machine */
4787         /* codec->power_save_node = 1; */
4788         spec->linear_tone_beep = 0;
4789         spec->gen.own_eapd_ctl = 1;
4790         spec->gen.power_down_unused = 1;
4791         spec->gen.mixer_nid = 0x17;
4792         spec->have_spdif_mux = 1;
4793
4794         /* GPIO0 = EAPD */
4795         spec->gpio_mask = 0x01;
4796         spec->gpio_dir = 0x01;
4797         spec->gpio_data = 0x01;
4798
4799         switch (codec->core.vendor_id) {
4800         case 0x111d76b6: /* 4 Port without Analog Mixer */
4801         case 0x111d76b7:
4802                 unmute_nids++;
4803                 break;
4804         case 0x111d7608: /* 5 Port with Analog Mixer */
4805                 if ((codec->core.revision_id & 0xf) == 0 ||
4806                     (codec->core.revision_id & 0xf) == 1)
4807                         spec->stream_delay = 40; /* 40 milliseconds */
4808
4809                 /* disable VSW */
4810                 unmute_nids++;
4811                 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
4812                 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
4813                 break;
4814         case 0x111d7603: /* 6 Port with Analog Mixer */
4815                 if ((codec->core.revision_id & 0xf) == 1)
4816                         spec->stream_delay = 40; /* 40 milliseconds */
4817
4818                 break;
4819         }
4820
4821         if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
4822                 snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
4823
4824         if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) {
4825                 const hda_nid_t *p;
4826                 for (p = unmute_nids; *p; p++)
4827                         snd_hda_codec_amp_init_stereo(codec, *p, HDA_INPUT, 0,
4828                                                       0xff, 0x00);
4829         }
4830
4831         spec->aloopback_ctl = &stac92hd71bxx_loopback;
4832         spec->aloopback_mask = 0x50;
4833         spec->aloopback_shift = 0;
4834
4835         spec->powerdown_adcs = 1;
4836         spec->gen.beep_nid = 0x26; /* digital beep */
4837         spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4838         spec->pwr_nids = stac92hd71bxx_pwr_nids;
4839
4840         snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
4841                            stac92hd71bxx_fixups);
4842         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4843
4844         stac_setup_gpio(codec);
4845
4846         err = stac_parse_auto_config(codec);
4847         if (err < 0) {
4848                 stac_free(codec);
4849                 return err;
4850         }
4851
4852         codec->proc_widget_hook = stac92hd7x_proc_hook;
4853
4854         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4855
4856         return 0;
4857 }
4858
4859 static int patch_stac922x(struct hda_codec *codec)
4860 {
4861         struct sigmatel_spec *spec;
4862         int err;
4863
4864         err = alloc_stac_spec(codec);
4865         if (err < 0)
4866                 return err;
4867
4868         spec = codec->spec;
4869         spec->linear_tone_beep = 1;
4870         spec->gen.own_eapd_ctl = 1;
4871
4872         snd_hda_add_verbs(codec, stac922x_core_init);
4873
4874         /* Fix Mux capture level; max to 2 */
4875         snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4876                                   (0 << AC_AMPCAP_OFFSET_SHIFT) |
4877                                   (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4878                                   (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4879                                   (0 << AC_AMPCAP_MUTE_SHIFT));
4880
4881         snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
4882                            stac922x_fixups);
4883         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4884
4885         err = stac_parse_auto_config(codec);
4886         if (err < 0) {
4887                 stac_free(codec);
4888                 return err;
4889         }
4890
4891         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4892
4893         return 0;
4894 }
4895
4896 static const char * const stac927x_spdif_labels[] = {
4897         "Digital Playback", "ADAT", "Analog Mux 1",
4898         "Analog Mux 2", "Analog Mux 3", NULL
4899 };
4900
4901 static int patch_stac927x(struct hda_codec *codec)
4902 {
4903         struct sigmatel_spec *spec;
4904         int err;
4905
4906         err = alloc_stac_spec(codec);
4907         if (err < 0)
4908                 return err;
4909
4910         spec = codec->spec;
4911         spec->linear_tone_beep = 1;
4912         spec->gen.own_eapd_ctl = 1;
4913         spec->have_spdif_mux = 1;
4914         spec->spdif_labels = stac927x_spdif_labels;
4915
4916         spec->gen.beep_nid = 0x23; /* digital beep */
4917
4918         /* GPIO0 High = Enable EAPD */
4919         spec->eapd_mask = spec->gpio_mask = 0x01;
4920         spec->gpio_dir = spec->gpio_data = 0x01;
4921
4922         spec->aloopback_ctl = &stac927x_loopback;
4923         spec->aloopback_mask = 0x40;
4924         spec->aloopback_shift = 0;
4925         spec->eapd_switch = 1;
4926
4927         snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
4928                            stac927x_fixups);
4929         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4930
4931         if (!spec->volknob_init)
4932                 snd_hda_add_verbs(codec, stac927x_core_init);
4933
4934         err = stac_parse_auto_config(codec);
4935         if (err < 0) {
4936                 stac_free(codec);
4937                 return err;
4938         }
4939
4940         codec->proc_widget_hook = stac927x_proc_hook;
4941
4942         /*
4943          * !!FIXME!!
4944          * The STAC927x seem to require fairly long delays for certain
4945          * command sequences.  With too short delays (even if the answer
4946          * is set to RIRB properly), it results in the silence output
4947          * on some hardwares like Dell.
4948          *
4949          * The below flag enables the longer delay (see get_response
4950          * in hda_intel.c).
4951          */
4952         codec->bus->needs_damn_long_delay = 1;
4953
4954         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4955
4956         return 0;
4957 }
4958
4959 static int patch_stac9205(struct hda_codec *codec)
4960 {
4961         struct sigmatel_spec *spec;
4962         int err;
4963
4964         err = alloc_stac_spec(codec);
4965         if (err < 0)
4966                 return err;
4967
4968         spec = codec->spec;
4969         spec->linear_tone_beep = 1;
4970         spec->gen.own_eapd_ctl = 1;
4971         spec->have_spdif_mux = 1;
4972
4973         spec->gen.beep_nid = 0x23; /* digital beep */
4974
4975         snd_hda_add_verbs(codec, stac9205_core_init);
4976         spec->aloopback_ctl = &stac9205_loopback;
4977
4978         spec->aloopback_mask = 0x40;
4979         spec->aloopback_shift = 0;
4980         
4981         /* GPIO0 High = EAPD */
4982         spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4983         spec->gpio_data = 0x01;
4984
4985         /* Turn on/off EAPD per HP plugging */
4986         spec->eapd_switch = 1;
4987
4988         snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
4989                            stac9205_fixups);
4990         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4991
4992         err = stac_parse_auto_config(codec);
4993         if (err < 0) {
4994                 stac_free(codec);
4995                 return err;
4996         }
4997
4998         codec->proc_widget_hook = stac9205_proc_hook;
4999
5000         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5001
5002         return 0;
5003 }
5004
5005 /*
5006  * STAC9872 hack
5007  */
5008
5009 static const struct hda_verb stac9872_core_init[] = {
5010         {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5011         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5012         {}
5013 };
5014
5015 static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
5016         { 0x0a, 0x03211020 },
5017         { 0x0b, 0x411111f0 },
5018         { 0x0c, 0x411111f0 },
5019         { 0x0d, 0x03a15030 },
5020         { 0x0e, 0x411111f0 },
5021         { 0x0f, 0x90170110 },
5022         { 0x11, 0x411111f0 },
5023         { 0x13, 0x411111f0 },
5024         { 0x14, 0x90a7013e },
5025         {}
5026 };
5027
5028 static const struct hda_model_fixup stac9872_models[] = {
5029         { .id = STAC_9872_VAIO, .name = "vaio" },
5030         {}
5031 };
5032
5033 static const struct hda_fixup stac9872_fixups[] = {
5034         [STAC_9872_VAIO] = {
5035                 .type = HDA_FIXUP_PINS,
5036                 .v.pins = stac9872_vaio_pin_configs,
5037         },
5038 };
5039
5040 static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
5041         SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
5042                            "Sony VAIO F/S", STAC_9872_VAIO),
5043         {} /* terminator */
5044 };
5045
5046 static int patch_stac9872(struct hda_codec *codec)
5047 {
5048         struct sigmatel_spec *spec;
5049         int err;
5050
5051         err = alloc_stac_spec(codec);
5052         if (err < 0)
5053                 return err;
5054
5055         spec = codec->spec;
5056         spec->linear_tone_beep = 1;
5057         spec->gen.own_eapd_ctl = 1;
5058
5059         snd_hda_add_verbs(codec, stac9872_core_init);
5060
5061         snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
5062                            stac9872_fixups);
5063         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5064
5065         err = stac_parse_auto_config(codec);
5066         if (err < 0) {
5067                 stac_free(codec);
5068                 return -EINVAL;
5069         }
5070
5071         snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5072
5073         return 0;
5074 }
5075
5076
5077 /*
5078  * patch entries
5079  */
5080 static const struct hda_device_id snd_hda_id_sigmatel[] = {
5081         HDA_CODEC_ENTRY(0x83847690, "STAC9200", patch_stac9200),
5082         HDA_CODEC_ENTRY(0x83847882, "STAC9220 A1", patch_stac922x),
5083         HDA_CODEC_ENTRY(0x83847680, "STAC9221 A1", patch_stac922x),
5084         HDA_CODEC_ENTRY(0x83847880, "STAC9220 A2", patch_stac922x),
5085         HDA_CODEC_ENTRY(0x83847681, "STAC9220D/9223D A2", patch_stac922x),
5086         HDA_CODEC_ENTRY(0x83847682, "STAC9221 A2", patch_stac922x),
5087         HDA_CODEC_ENTRY(0x83847683, "STAC9221D A2", patch_stac922x),
5088         HDA_CODEC_ENTRY(0x83847618, "STAC9227", patch_stac927x),
5089         HDA_CODEC_ENTRY(0x83847619, "STAC9227", patch_stac927x),
5090         HDA_CODEC_ENTRY(0x83847638, "STAC92HD700", patch_stac927x),
5091         HDA_CODEC_ENTRY(0x83847616, "STAC9228", patch_stac927x),
5092         HDA_CODEC_ENTRY(0x83847617, "STAC9228", patch_stac927x),
5093         HDA_CODEC_ENTRY(0x83847614, "STAC9229", patch_stac927x),
5094         HDA_CODEC_ENTRY(0x83847615, "STAC9229", patch_stac927x),
5095         HDA_CODEC_ENTRY(0x83847620, "STAC9274", patch_stac927x),
5096         HDA_CODEC_ENTRY(0x83847621, "STAC9274D", patch_stac927x),
5097         HDA_CODEC_ENTRY(0x83847622, "STAC9273X", patch_stac927x),
5098         HDA_CODEC_ENTRY(0x83847623, "STAC9273D", patch_stac927x),
5099         HDA_CODEC_ENTRY(0x83847624, "STAC9272X", patch_stac927x),
5100         HDA_CODEC_ENTRY(0x83847625, "STAC9272D", patch_stac927x),
5101         HDA_CODEC_ENTRY(0x83847626, "STAC9271X", patch_stac927x),
5102         HDA_CODEC_ENTRY(0x83847627, "STAC9271D", patch_stac927x),
5103         HDA_CODEC_ENTRY(0x83847628, "STAC9274X5NH", patch_stac927x),
5104         HDA_CODEC_ENTRY(0x83847629, "STAC9274D5NH", patch_stac927x),
5105         HDA_CODEC_ENTRY(0x83847632, "STAC9202",  patch_stac925x),
5106         HDA_CODEC_ENTRY(0x83847633, "STAC9202D", patch_stac925x),
5107         HDA_CODEC_ENTRY(0x83847634, "STAC9250", patch_stac925x),
5108         HDA_CODEC_ENTRY(0x83847635, "STAC9250D", patch_stac925x),
5109         HDA_CODEC_ENTRY(0x83847636, "STAC9251", patch_stac925x),
5110         HDA_CODEC_ENTRY(0x83847637, "STAC9250D", patch_stac925x),
5111         HDA_CODEC_ENTRY(0x83847645, "92HD206X", patch_stac927x),
5112         HDA_CODEC_ENTRY(0x83847646, "92HD206D", patch_stac927x),
5113         /* The following does not take into account .id=0x83847661 when subsys =
5114          * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
5115          * currently not fully supported.
5116          */
5117         HDA_CODEC_ENTRY(0x83847661, "CXD9872RD/K", patch_stac9872),
5118         HDA_CODEC_ENTRY(0x83847662, "STAC9872AK", patch_stac9872),
5119         HDA_CODEC_ENTRY(0x83847664, "CXD9872AKD", patch_stac9872),
5120         HDA_CODEC_ENTRY(0x83847698, "STAC9205", patch_stac9205),
5121         HDA_CODEC_ENTRY(0x838476a0, "STAC9205", patch_stac9205),
5122         HDA_CODEC_ENTRY(0x838476a1, "STAC9205D", patch_stac9205),
5123         HDA_CODEC_ENTRY(0x838476a2, "STAC9204", patch_stac9205),
5124         HDA_CODEC_ENTRY(0x838476a3, "STAC9204D", patch_stac9205),
5125         HDA_CODEC_ENTRY(0x838476a4, "STAC9255", patch_stac9205),
5126         HDA_CODEC_ENTRY(0x838476a5, "STAC9255D", patch_stac9205),
5127         HDA_CODEC_ENTRY(0x838476a6, "STAC9254", patch_stac9205),
5128         HDA_CODEC_ENTRY(0x838476a7, "STAC9254D", patch_stac9205),
5129         HDA_CODEC_ENTRY(0x111d7603, "92HD75B3X5", patch_stac92hd71bxx),
5130         HDA_CODEC_ENTRY(0x111d7604, "92HD83C1X5", patch_stac92hd83xxx),
5131         HDA_CODEC_ENTRY(0x111d76d4, "92HD83C1C5", patch_stac92hd83xxx),
5132         HDA_CODEC_ENTRY(0x111d7605, "92HD81B1X5", patch_stac92hd83xxx),
5133         HDA_CODEC_ENTRY(0x111d76d5, "92HD81B1C5", patch_stac92hd83xxx),
5134         HDA_CODEC_ENTRY(0x111d76d1, "92HD87B1/3", patch_stac92hd83xxx),
5135         HDA_CODEC_ENTRY(0x111d76d9, "92HD87B2/4", patch_stac92hd83xxx),
5136         HDA_CODEC_ENTRY(0x111d7666, "92HD88B3", patch_stac92hd83xxx),
5137         HDA_CODEC_ENTRY(0x111d7667, "92HD88B1", patch_stac92hd83xxx),
5138         HDA_CODEC_ENTRY(0x111d7668, "92HD88B2", patch_stac92hd83xxx),
5139         HDA_CODEC_ENTRY(0x111d7669, "92HD88B4", patch_stac92hd83xxx),
5140         HDA_CODEC_ENTRY(0x111d7608, "92HD75B2X5", patch_stac92hd71bxx),
5141         HDA_CODEC_ENTRY(0x111d7674, "92HD73D1X5", patch_stac92hd73xx),
5142         HDA_CODEC_ENTRY(0x111d7675, "92HD73C1X5", patch_stac92hd73xx),
5143         HDA_CODEC_ENTRY(0x111d7676, "92HD73E1X5", patch_stac92hd73xx),
5144         HDA_CODEC_ENTRY(0x111d7695, "92HD95", patch_stac92hd95),
5145         HDA_CODEC_ENTRY(0x111d76b0, "92HD71B8X", patch_stac92hd71bxx),
5146         HDA_CODEC_ENTRY(0x111d76b1, "92HD71B8X", patch_stac92hd71bxx),
5147         HDA_CODEC_ENTRY(0x111d76b2, "92HD71B7X", patch_stac92hd71bxx),
5148         HDA_CODEC_ENTRY(0x111d76b3, "92HD71B7X", patch_stac92hd71bxx),
5149         HDA_CODEC_ENTRY(0x111d76b4, "92HD71B6X", patch_stac92hd71bxx),
5150         HDA_CODEC_ENTRY(0x111d76b5, "92HD71B6X", patch_stac92hd71bxx),
5151         HDA_CODEC_ENTRY(0x111d76b6, "92HD71B5X", patch_stac92hd71bxx),
5152         HDA_CODEC_ENTRY(0x111d76b7, "92HD71B5X", patch_stac92hd71bxx),
5153         HDA_CODEC_ENTRY(0x111d76c0, "92HD89C3", patch_stac92hd73xx),
5154         HDA_CODEC_ENTRY(0x111d76c1, "92HD89C2", patch_stac92hd73xx),
5155         HDA_CODEC_ENTRY(0x111d76c2, "92HD89C1", patch_stac92hd73xx),
5156         HDA_CODEC_ENTRY(0x111d76c3, "92HD89B3", patch_stac92hd73xx),
5157         HDA_CODEC_ENTRY(0x111d76c4, "92HD89B2", patch_stac92hd73xx),
5158         HDA_CODEC_ENTRY(0x111d76c5, "92HD89B1", patch_stac92hd73xx),
5159         HDA_CODEC_ENTRY(0x111d76c6, "92HD89E3", patch_stac92hd73xx),
5160         HDA_CODEC_ENTRY(0x111d76c7, "92HD89E2", patch_stac92hd73xx),
5161         HDA_CODEC_ENTRY(0x111d76c8, "92HD89E1", patch_stac92hd73xx),
5162         HDA_CODEC_ENTRY(0x111d76c9, "92HD89D3", patch_stac92hd73xx),
5163         HDA_CODEC_ENTRY(0x111d76ca, "92HD89D2", patch_stac92hd73xx),
5164         HDA_CODEC_ENTRY(0x111d76cb, "92HD89D1", patch_stac92hd73xx),
5165         HDA_CODEC_ENTRY(0x111d76cc, "92HD89F3", patch_stac92hd73xx),
5166         HDA_CODEC_ENTRY(0x111d76cd, "92HD89F2", patch_stac92hd73xx),
5167         HDA_CODEC_ENTRY(0x111d76ce, "92HD89F1", patch_stac92hd73xx),
5168         HDA_CODEC_ENTRY(0x111d76df, "92HD93BXX", patch_stac92hd83xxx),
5169         HDA_CODEC_ENTRY(0x111d76e0, "92HD91BXX", patch_stac92hd83xxx),
5170         HDA_CODEC_ENTRY(0x111d76e3, "92HD98BXX", patch_stac92hd83xxx),
5171         HDA_CODEC_ENTRY(0x111d76e5, "92HD99BXX", patch_stac92hd83xxx),
5172         HDA_CODEC_ENTRY(0x111d76e7, "92HD90BXX", patch_stac92hd83xxx),
5173         HDA_CODEC_ENTRY(0x111d76e8, "92HD66B1X5", patch_stac92hd83xxx),
5174         HDA_CODEC_ENTRY(0x111d76e9, "92HD66B2X5", patch_stac92hd83xxx),
5175         HDA_CODEC_ENTRY(0x111d76ea, "92HD66B3X5", patch_stac92hd83xxx),
5176         HDA_CODEC_ENTRY(0x111d76eb, "92HD66C1X5", patch_stac92hd83xxx),
5177         HDA_CODEC_ENTRY(0x111d76ec, "92HD66C2X5", patch_stac92hd83xxx),
5178         HDA_CODEC_ENTRY(0x111d76ed, "92HD66C3X5", patch_stac92hd83xxx),
5179         HDA_CODEC_ENTRY(0x111d76ee, "92HD66B1X3", patch_stac92hd83xxx),
5180         HDA_CODEC_ENTRY(0x111d76ef, "92HD66B2X3", patch_stac92hd83xxx),
5181         HDA_CODEC_ENTRY(0x111d76f0, "92HD66B3X3", patch_stac92hd83xxx),
5182         HDA_CODEC_ENTRY(0x111d76f1, "92HD66C1X3", patch_stac92hd83xxx),
5183         HDA_CODEC_ENTRY(0x111d76f2, "92HD66C2X3", patch_stac92hd83xxx),
5184         HDA_CODEC_ENTRY(0x111d76f3, "92HD66C3/65", patch_stac92hd83xxx),
5185         {} /* terminator */
5186 };
5187 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_sigmatel);
5188
5189 MODULE_LICENSE("GPL");
5190 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5191
5192 static struct hda_codec_driver sigmatel_driver = {
5193         .id = snd_hda_id_sigmatel,
5194 };
5195
5196 module_hda_codec_driver(sigmatel_driver);