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