2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for SigmaTel STAC92xx
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
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.
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.
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
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include <sound/asoundef.h>
33 #include "hda_codec.h"
34 #include "hda_local.h"
35 #include "hda_patch.h"
37 #define NUM_CONTROL_ALLOC 32
38 #define STAC_PWR_EVENT 0x20
39 #define STAC_HP_EVENT 0x30
96 /* for backward compatibility */
119 struct sigmatel_spec {
120 struct snd_kcontrol_new *mixers[4];
121 unsigned int num_mixers;
124 unsigned int surr_switch: 1;
125 unsigned int line_switch: 1;
126 unsigned int mic_switch: 1;
127 unsigned int alt_switch: 1;
128 unsigned int hp_detect: 1;
131 unsigned int gpio_mask;
132 unsigned int gpio_dir;
133 unsigned int gpio_data;
134 unsigned int gpio_mute;
136 /* analog loopback */
137 unsigned char aloopback_mask;
138 unsigned char aloopback_shift;
140 /* power management */
141 unsigned int num_pwrs;
146 struct hda_input_mux *mono_mux;
147 unsigned int cur_mmux;
148 struct hda_multi_out multiout;
149 hda_nid_t dac_nids[5];
153 unsigned int num_adcs;
155 unsigned int num_muxes;
156 hda_nid_t *dmic_nids;
157 unsigned int num_dmics;
158 hda_nid_t *dmux_nids;
159 unsigned int num_dmuxes;
160 hda_nid_t dig_in_nid;
165 unsigned int num_pins;
166 unsigned int *pin_configs;
167 unsigned int *bios_pin_configs;
169 /* codec specific stuff */
170 struct hda_verb *init;
171 struct snd_kcontrol_new *mixer;
174 struct hda_input_mux *dinput_mux;
175 unsigned int cur_dmux[2];
176 struct hda_input_mux *input_mux;
177 unsigned int cur_mux[3];
180 unsigned int io_switch[2];
181 unsigned int clfe_swap;
182 unsigned int aloopback;
184 struct hda_pcm pcm_rec[2]; /* PCM information */
186 /* dynamic controls and input_mux */
187 struct auto_pin_cfg autocfg;
188 unsigned int num_kctl_alloc, num_kctl_used;
189 struct snd_kcontrol_new *kctl_alloc;
190 struct hda_input_mux private_dimux;
191 struct hda_input_mux private_imux;
192 struct hda_input_mux private_mono_mux;
195 static hda_nid_t stac9200_adc_nids[1] = {
199 static hda_nid_t stac9200_mux_nids[1] = {
203 static hda_nid_t stac9200_dac_nids[1] = {
207 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
208 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
212 static hda_nid_t stac92hd73xx_adc_nids[2] = {
216 #define STAC92HD73XX_NUM_DMICS 2
217 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
221 #define STAC92HD73_DAC_COUNT 5
222 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
223 0x15, 0x16, 0x17, 0x18, 0x19,
226 static hda_nid_t stac92hd73xx_mux_nids[4] = {
227 0x28, 0x29, 0x2a, 0x2b,
230 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
234 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
238 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
242 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
246 static hda_nid_t stac92hd71bxx_dmux_nids[1] = {
250 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
254 #define STAC92HD71BXX_NUM_DMICS 2
255 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
259 static hda_nid_t stac925x_adc_nids[1] = {
263 static hda_nid_t stac925x_mux_nids[1] = {
267 static hda_nid_t stac925x_dac_nids[1] = {
271 #define STAC925X_NUM_DMICS 1
272 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
276 static hda_nid_t stac925x_dmux_nids[1] = {
280 static hda_nid_t stac922x_adc_nids[2] = {
284 static hda_nid_t stac922x_mux_nids[2] = {
288 static hda_nid_t stac927x_adc_nids[3] = {
292 static hda_nid_t stac927x_mux_nids[3] = {
296 static hda_nid_t stac927x_dac_nids[6] = {
297 0x02, 0x03, 0x04, 0x05, 0x06, 0
300 static hda_nid_t stac927x_dmux_nids[1] = {
304 #define STAC927X_NUM_DMICS 2
305 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
309 static hda_nid_t stac9205_adc_nids[2] = {
313 static hda_nid_t stac9205_mux_nids[2] = {
317 static hda_nid_t stac9205_dmux_nids[1] = {
321 #define STAC9205_NUM_DMICS 2
322 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
326 static hda_nid_t stac9200_pin_nids[8] = {
327 0x08, 0x09, 0x0d, 0x0e,
328 0x0f, 0x10, 0x11, 0x12,
331 static hda_nid_t stac925x_pin_nids[8] = {
332 0x07, 0x08, 0x0a, 0x0b,
333 0x0c, 0x0d, 0x10, 0x11,
336 static hda_nid_t stac922x_pin_nids[10] = {
337 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
338 0x0f, 0x10, 0x11, 0x15, 0x1b,
341 static hda_nid_t stac92hd73xx_pin_nids[13] = {
342 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
343 0x0f, 0x10, 0x11, 0x12, 0x13,
347 static hda_nid_t stac92hd71bxx_pin_nids[10] = {
348 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
349 0x0f, 0x14, 0x18, 0x19, 0x1e,
352 static hda_nid_t stac927x_pin_nids[14] = {
353 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
354 0x0f, 0x10, 0x11, 0x12, 0x13,
355 0x14, 0x21, 0x22, 0x23,
358 static hda_nid_t stac9205_pin_nids[12] = {
359 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
360 0x0f, 0x14, 0x16, 0x17, 0x18,
364 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_info *uinfo)
367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
368 struct sigmatel_spec *spec = codec->spec;
369 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
372 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
373 struct snd_ctl_elem_value *ucontrol)
375 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
376 struct sigmatel_spec *spec = codec->spec;
377 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
379 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
383 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
384 struct snd_ctl_elem_value *ucontrol)
386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
387 struct sigmatel_spec *spec = codec->spec;
388 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
390 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
391 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
394 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
397 struct sigmatel_spec *spec = codec->spec;
398 return snd_hda_input_mux_info(spec->input_mux, uinfo);
401 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
403 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
404 struct sigmatel_spec *spec = codec->spec;
405 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
407 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
411 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
413 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
414 struct sigmatel_spec *spec = codec->spec;
415 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
417 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
418 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
421 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
422 struct snd_ctl_elem_info *uinfo)
424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
425 struct sigmatel_spec *spec = codec->spec;
426 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
429 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
430 struct snd_ctl_elem_value *ucontrol)
432 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
433 struct sigmatel_spec *spec = codec->spec;
435 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
439 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
440 struct snd_ctl_elem_value *ucontrol)
442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
443 struct sigmatel_spec *spec = codec->spec;
445 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
446 spec->mono_nid, &spec->cur_mmux);
449 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
451 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
452 struct snd_ctl_elem_value *ucontrol)
454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
455 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
456 struct sigmatel_spec *spec = codec->spec;
458 ucontrol->value.integer.value[0] = !!(spec->aloopback &
459 (spec->aloopback_mask << idx));
463 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
464 struct snd_ctl_elem_value *ucontrol)
466 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
467 struct sigmatel_spec *spec = codec->spec;
468 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
469 unsigned int dac_mode;
470 unsigned int val, idx_val;
472 idx_val = spec->aloopback_mask << idx;
473 if (ucontrol->value.integer.value[0])
474 val = spec->aloopback | idx_val;
476 val = spec->aloopback & ~idx_val;
477 if (spec->aloopback == val)
480 spec->aloopback = val;
482 /* Only return the bits defined by the shift value of the
483 * first two bytes of the mask
485 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
486 kcontrol->private_value & 0xFFFF, 0x0);
487 dac_mode >>= spec->aloopback_shift;
489 if (spec->aloopback & idx_val) {
490 snd_hda_power_up(codec);
493 snd_hda_power_down(codec);
494 dac_mode &= ~idx_val;
497 snd_hda_codec_write_cache(codec, codec->afg, 0,
498 kcontrol->private_value >> 16, dac_mode);
503 static struct hda_verb stac9200_core_init[] = {
504 /* set dac0mux for dac converter */
505 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
509 static struct hda_verb stac9200_eapd_init[] = {
510 /* set dac0mux for dac converter */
511 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
512 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
516 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
517 /* set master volume and direct control */
518 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
519 /* setup audio connections */
520 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
521 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
522 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
523 /* setup adcs to point to mixer */
524 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
525 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
526 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
527 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
528 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
529 /* setup import muxs */
530 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
531 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
532 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
533 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
537 static struct hda_verb dell_m6_core_init[] = {
538 /* set master volume and direct control */
539 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
540 /* setup audio connections */
541 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
542 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
543 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
544 /* setup adcs to point to mixer */
545 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
546 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
547 /* setup import muxs */
548 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
549 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
550 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
551 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
555 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
556 /* set master volume and direct control */
557 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
558 /* setup audio connections */
559 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
560 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
561 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
562 /* connect hp ports to dac3 */
563 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
564 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
565 /* setup adcs to point to mixer */
566 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
567 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
568 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
569 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
570 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
571 /* setup import muxs */
572 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
573 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
574 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
575 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
579 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
580 /* set master volume and direct control */
581 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
582 /* setup audio connections */
583 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
584 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
585 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
586 /* dac3 is connected to import3 mux */
587 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
588 /* connect hp ports to dac4 */
589 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
590 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
591 /* setup adcs to point to mixer */
592 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
593 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
594 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
595 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
596 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
597 /* setup import muxs */
598 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
599 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
600 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
601 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
605 static struct hda_verb stac92hd71bxx_core_init[] = {
606 /* set master volume and direct control */
607 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
608 /* connect headphone jack to dac1 */
609 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
610 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
611 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
612 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
613 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
614 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
617 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
618 /* set master volume and direct control */
619 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
620 /* connect headphone jack to dac1 */
621 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
622 /* connect ports 0d and 0f to audio mixer */
623 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
624 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
625 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
626 /* unmute dac0 input in audio mixer */
627 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
628 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
629 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
630 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
631 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
635 static struct hda_verb stac925x_core_init[] = {
636 /* set dac0mux for dac converter */
637 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
641 static struct hda_verb stac922x_core_init[] = {
642 /* set master volume and direct control */
643 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
647 static struct hda_verb d965_core_init[] = {
648 /* set master volume and direct control */
649 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
650 /* unmute node 0x1b */
651 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
652 /* select node 0x03 as DAC */
653 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
657 static struct hda_verb stac927x_core_init[] = {
658 /* set master volume and direct control */
659 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
663 static struct hda_verb stac9205_core_init[] = {
664 /* set master volume and direct control */
665 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
669 #define STAC_MONO_MUX \
671 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
672 .name = "Mono Mux", \
674 .info = stac92xx_mono_mux_enum_info, \
675 .get = stac92xx_mono_mux_enum_get, \
676 .put = stac92xx_mono_mux_enum_put, \
679 #define STAC_INPUT_SOURCE(cnt) \
681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
682 .name = "Input Source", \
684 .info = stac92xx_mux_enum_info, \
685 .get = stac92xx_mux_enum_get, \
686 .put = stac92xx_mux_enum_put, \
689 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
692 .name = "Analog Loopback", \
694 .info = stac92xx_aloopback_info, \
695 .get = stac92xx_aloopback_get, \
696 .put = stac92xx_aloopback_put, \
697 .private_value = verb_read | (verb_write << 16), \
700 static struct snd_kcontrol_new stac9200_mixer[] = {
701 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
702 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
703 STAC_INPUT_SOURCE(1),
704 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
705 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
706 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
710 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
711 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
713 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
714 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
716 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
717 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
719 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
720 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
722 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
723 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
725 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
726 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
728 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
729 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
731 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
732 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
736 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
737 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
739 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
740 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
742 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
743 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
745 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
746 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
748 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
749 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
751 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
752 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
754 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
755 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
757 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
758 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
762 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
763 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
765 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
766 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
768 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
769 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
771 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
772 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
774 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
775 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
777 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
778 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
780 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
781 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
783 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
784 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
788 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
789 STAC_INPUT_SOURCE(2),
791 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
792 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
793 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
795 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
796 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
797 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
799 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
800 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
804 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
805 STAC_INPUT_SOURCE(2),
806 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
808 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
809 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
810 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
812 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
813 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
814 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
818 static struct snd_kcontrol_new stac925x_mixer[] = {
819 STAC_INPUT_SOURCE(1),
820 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
821 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
822 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
826 static struct snd_kcontrol_new stac9205_mixer[] = {
827 STAC_INPUT_SOURCE(2),
828 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
830 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
831 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
832 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
834 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
835 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
836 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
841 /* This needs to be generated dynamically based on sequence */
842 static struct snd_kcontrol_new stac922x_mixer[] = {
843 STAC_INPUT_SOURCE(2),
844 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
845 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
846 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
848 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
849 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
850 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
855 static struct snd_kcontrol_new stac927x_mixer[] = {
856 STAC_INPUT_SOURCE(3),
857 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
859 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
860 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
861 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
863 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
864 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
865 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
867 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
868 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
869 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
873 static struct snd_kcontrol_new stac_dmux_mixer = {
874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
875 .name = "Digital Input Source",
876 /* count set later */
877 .info = stac92xx_dmux_enum_info,
878 .get = stac92xx_dmux_enum_get,
879 .put = stac92xx_dmux_enum_put,
882 static const char *slave_vols[] = {
883 "Front Playback Volume",
884 "Surround Playback Volume",
885 "Center Playback Volume",
886 "LFE Playback Volume",
887 "Side Playback Volume",
888 "Headphone Playback Volume",
889 "Headphone Playback Volume",
890 "Speaker Playback Volume",
891 "External Speaker Playback Volume",
892 "Speaker2 Playback Volume",
896 static const char *slave_sws[] = {
897 "Front Playback Switch",
898 "Surround Playback Switch",
899 "Center Playback Switch",
900 "LFE Playback Switch",
901 "Side Playback Switch",
902 "Headphone Playback Switch",
903 "Headphone Playback Switch",
904 "Speaker Playback Switch",
905 "External Speaker Playback Switch",
906 "Speaker2 Playback Switch",
907 "IEC958 Playback Switch",
911 static int stac92xx_build_controls(struct hda_codec *codec)
913 struct sigmatel_spec *spec = codec->spec;
917 err = snd_hda_add_new_ctls(codec, spec->mixer);
921 for (i = 0; i < spec->num_mixers; i++) {
922 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
926 if (spec->num_dmuxes > 0) {
927 stac_dmux_mixer.count = spec->num_dmuxes;
928 err = snd_ctl_add(codec->bus->card,
929 snd_ctl_new1(&stac_dmux_mixer, codec));
934 if (spec->multiout.dig_out_nid) {
935 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
938 err = snd_hda_create_spdif_share_sw(codec,
942 spec->multiout.share_spdif = 1;
944 if (spec->dig_in_nid) {
945 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
950 /* if we have no master control, let's create it */
951 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
952 unsigned int vmaster_tlv[4];
953 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
954 HDA_OUTPUT, vmaster_tlv);
955 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
956 vmaster_tlv, slave_vols);
960 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
961 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
970 static unsigned int ref9200_pin_configs[8] = {
971 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
972 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
976 STAC 9200 pin configs for
981 static unsigned int dell9200_d21_pin_configs[8] = {
982 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
983 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
987 STAC 9200 pin configs for
991 static unsigned int dell9200_d22_pin_configs[8] = {
992 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
993 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
997 STAC 9200 pin configs for
998 102801C4 (Dell Dimension E310)
1005 static unsigned int dell9200_d23_pin_configs[8] = {
1006 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1007 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1012 STAC 9200-32 pin configs for
1013 102801B5 (Dell Inspiron 630m)
1014 102801D8 (Dell Inspiron 640m)
1016 static unsigned int dell9200_m21_pin_configs[8] = {
1017 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1018 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1022 STAC 9200-32 pin configs for
1023 102801C2 (Dell Latitude D620)
1025 102801CC (Dell Latitude D820)
1029 static unsigned int dell9200_m22_pin_configs[8] = {
1030 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1031 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1035 STAC 9200-32 pin configs for
1036 102801CE (Dell XPS M1710)
1037 102801CF (Dell Precision M90)
1039 static unsigned int dell9200_m23_pin_configs[8] = {
1040 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1041 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1045 STAC 9200-32 pin configs for
1048 102801CB (Dell Latitude 120L)
1051 static unsigned int dell9200_m24_pin_configs[8] = {
1052 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1053 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1057 STAC 9200-32 pin configs for
1058 102801BD (Dell Inspiron E1505n)
1062 static unsigned int dell9200_m25_pin_configs[8] = {
1063 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1064 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1068 STAC 9200-32 pin configs for
1069 102801F5 (Dell Inspiron 1501)
1072 static unsigned int dell9200_m26_pin_configs[8] = {
1073 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1074 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1079 102801CD (Dell Inspiron E1705/9400)
1081 static unsigned int dell9200_m27_pin_configs[8] = {
1082 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1083 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1086 static unsigned int oqo9200_pin_configs[8] = {
1087 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1088 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1092 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1093 [STAC_REF] = ref9200_pin_configs,
1094 [STAC_9200_OQO] = oqo9200_pin_configs,
1095 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1096 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1097 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1098 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1099 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1100 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1101 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1102 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1103 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1104 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1107 static const char *stac9200_models[STAC_9200_MODELS] = {
1109 [STAC_9200_OQO] = "oqo",
1110 [STAC_9200_DELL_D21] = "dell-d21",
1111 [STAC_9200_DELL_D22] = "dell-d22",
1112 [STAC_9200_DELL_D23] = "dell-d23",
1113 [STAC_9200_DELL_M21] = "dell-m21",
1114 [STAC_9200_DELL_M22] = "dell-m22",
1115 [STAC_9200_DELL_M23] = "dell-m23",
1116 [STAC_9200_DELL_M24] = "dell-m24",
1117 [STAC_9200_DELL_M25] = "dell-m25",
1118 [STAC_9200_DELL_M26] = "dell-m26",
1119 [STAC_9200_DELL_M27] = "dell-m27",
1120 [STAC_9200_GATEWAY] = "gateway",
1123 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1124 /* SigmaTel reference board */
1125 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1126 "DFI LanParty", STAC_REF),
1127 /* Dell laptops have BIOS problem */
1128 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1129 "unknown Dell", STAC_9200_DELL_D21),
1130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1131 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1133 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1134 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1135 "unknown Dell", STAC_9200_DELL_D22),
1136 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1137 "unknown Dell", STAC_9200_DELL_D22),
1138 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1139 "Dell Latitude D620", STAC_9200_DELL_M22),
1140 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1141 "unknown Dell", STAC_9200_DELL_D23),
1142 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1143 "unknown Dell", STAC_9200_DELL_D23),
1144 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1145 "unknown Dell", STAC_9200_DELL_M22),
1146 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1147 "unknown Dell", STAC_9200_DELL_M24),
1148 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1149 "unknown Dell", STAC_9200_DELL_M24),
1150 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1151 "Dell Latitude 120L", STAC_9200_DELL_M24),
1152 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1153 "Dell Latitude D820", STAC_9200_DELL_M22),
1154 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1155 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1156 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1157 "Dell XPS M1710", STAC_9200_DELL_M23),
1158 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1159 "Dell Precision M90", STAC_9200_DELL_M23),
1160 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1161 "unknown Dell", STAC_9200_DELL_M22),
1162 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1163 "unknown Dell", STAC_9200_DELL_M22),
1164 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1165 "unknown Dell", STAC_9200_DELL_M22),
1166 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1167 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1168 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1169 "unknown Dell", STAC_9200_DELL_D23),
1170 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1171 "unknown Dell", STAC_9200_DELL_D23),
1172 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1173 "unknown Dell", STAC_9200_DELL_D21),
1174 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1175 "unknown Dell", STAC_9200_DELL_D23),
1176 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1177 "unknown Dell", STAC_9200_DELL_D21),
1178 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1179 "unknown Dell", STAC_9200_DELL_M25),
1180 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1181 "unknown Dell", STAC_9200_DELL_M25),
1182 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1183 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1184 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1185 "unknown Dell", STAC_9200_DELL_M26),
1187 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
1188 /* Gateway machines needs EAPD to be set on resume */
1189 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1190 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1192 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1195 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1199 static unsigned int ref925x_pin_configs[8] = {
1200 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1201 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1204 static unsigned int stac925x_MA6_pin_configs[8] = {
1205 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1206 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1209 static unsigned int stac925x_PA6_pin_configs[8] = {
1210 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1211 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1214 static unsigned int stac925xM2_2_pin_configs[8] = {
1215 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1216 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1219 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1220 [STAC_REF] = ref925x_pin_configs,
1221 [STAC_M2_2] = stac925xM2_2_pin_configs,
1222 [STAC_MA6] = stac925x_MA6_pin_configs,
1223 [STAC_PA6] = stac925x_PA6_pin_configs,
1226 static const char *stac925x_models[STAC_925x_MODELS] = {
1228 [STAC_M2_2] = "m2-2",
1233 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1234 /* SigmaTel reference board */
1235 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1236 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1237 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1238 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1239 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1240 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1241 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1245 static unsigned int ref92hd73xx_pin_configs[13] = {
1246 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1247 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1248 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1252 static unsigned int dell_m6_pin_configs[13] = {
1253 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1254 0x03a11020, 0x03011050, 0x4f0000f0, 0x4f0000f0,
1255 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1259 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1260 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1261 [STAC_DELL_M6] = dell_m6_pin_configs,
1264 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1265 [STAC_92HD73XX_REF] = "ref",
1266 [STAC_DELL_M6] = "dell-m6",
1269 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1270 /* SigmaTel reference board */
1271 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1272 "DFI LanParty", STAC_92HD73XX_REF),
1273 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1274 "unknown Dell", STAC_DELL_M6),
1275 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1276 "unknown Dell", STAC_DELL_M6),
1277 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1278 "unknown Dell", STAC_DELL_M6),
1279 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1280 "unknown Dell", STAC_DELL_M6),
1281 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1282 "unknown Dell", STAC_DELL_M6),
1283 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1284 "unknown Dell", STAC_DELL_M6),
1285 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1286 "unknown Dell", STAC_DELL_M6),
1290 static unsigned int ref92hd71bxx_pin_configs[10] = {
1291 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1292 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1293 0x90a000f0, 0x01452050,
1296 static unsigned int dell_m4_1_pin_configs[13] = {
1297 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1298 0x23a1902e, 0x23014250, 0x40f000f0, 0x4f0000f0,
1299 0x40f000f0, 0x4f0000f0,
1302 static unsigned int dell_m4_2_pin_configs[13] = {
1303 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1304 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1305 0x40f000f0, 0x044413b0,
1308 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1309 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1310 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1311 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1314 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1315 [STAC_92HD71BXX_REF] = "ref",
1316 [STAC_DELL_M4_1] = "dell-m4-1",
1317 [STAC_DELL_M4_2] = "dell-m4-2",
1320 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1321 /* SigmaTel reference board */
1322 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1323 "DFI LanParty", STAC_92HD71BXX_REF),
1324 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1325 "unknown Dell", STAC_DELL_M4_1),
1326 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1327 "unknown Dell", STAC_DELL_M4_1),
1328 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1329 "unknown Dell", STAC_DELL_M4_1),
1330 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1331 "unknown Dell", STAC_DELL_M4_1),
1332 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1333 "unknown Dell", STAC_DELL_M4_1),
1334 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1335 "unknown Dell", STAC_DELL_M4_1),
1336 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1337 "unknown Dell", STAC_DELL_M4_1),
1338 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1339 "unknown Dell", STAC_DELL_M4_2),
1340 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1341 "unknown Dell", STAC_DELL_M4_2),
1342 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1343 "unknown Dell", STAC_DELL_M4_2),
1344 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1345 "unknown Dell", STAC_DELL_M4_2),
1349 static unsigned int ref922x_pin_configs[10] = {
1350 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1351 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1352 0x40000100, 0x40000100,
1356 STAC 922X pin configs for
1363 static unsigned int dell_922x_d81_pin_configs[10] = {
1364 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1365 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1366 0x01813122, 0x400001f2,
1370 STAC 922X pin configs for
1374 static unsigned int dell_922x_d82_pin_configs[10] = {
1375 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1376 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1377 0x01813122, 0x400001f1,
1381 STAC 922X pin configs for
1384 static unsigned int dell_922x_m81_pin_configs[10] = {
1385 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1386 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1387 0x40C003f1, 0x405003f0,
1391 STAC 9221 A1 pin configs for
1392 102801D7 (Dell XPS M1210)
1394 static unsigned int dell_922x_m82_pin_configs[10] = {
1395 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1396 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1397 0x508003f3, 0x405003f4,
1400 static unsigned int d945gtp3_pin_configs[10] = {
1401 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1402 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1403 0x02a19120, 0x40000100,
1406 static unsigned int d945gtp5_pin_configs[10] = {
1407 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1408 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1409 0x02a19320, 0x40000100,
1412 static unsigned int intel_mac_v1_pin_configs[10] = {
1413 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1414 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1415 0x400000fc, 0x400000fb,
1418 static unsigned int intel_mac_v2_pin_configs[10] = {
1419 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1420 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1421 0x400000fc, 0x400000fb,
1424 static unsigned int intel_mac_v3_pin_configs[10] = {
1425 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1426 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1427 0x400000fc, 0x400000fb,
1430 static unsigned int intel_mac_v4_pin_configs[10] = {
1431 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1432 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1433 0x400000fc, 0x400000fb,
1436 static unsigned int intel_mac_v5_pin_configs[10] = {
1437 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1438 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1439 0x400000fc, 0x400000fb,
1443 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1444 [STAC_D945_REF] = ref922x_pin_configs,
1445 [STAC_D945GTP3] = d945gtp3_pin_configs,
1446 [STAC_D945GTP5] = d945gtp5_pin_configs,
1447 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1448 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1449 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1450 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1451 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1452 /* for backward compatibility */
1453 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1454 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1455 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1456 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1457 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1458 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1459 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1460 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1461 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1462 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1465 static const char *stac922x_models[STAC_922X_MODELS] = {
1466 [STAC_D945_REF] = "ref",
1467 [STAC_D945GTP5] = "5stack",
1468 [STAC_D945GTP3] = "3stack",
1469 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1470 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1471 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1472 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1473 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1474 /* for backward compatibility */
1475 [STAC_MACMINI] = "macmini",
1476 [STAC_MACBOOK] = "macbook",
1477 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1478 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1479 [STAC_IMAC_INTEL] = "imac-intel",
1480 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1481 [STAC_922X_DELL_D81] = "dell-d81",
1482 [STAC_922X_DELL_D82] = "dell-d82",
1483 [STAC_922X_DELL_M81] = "dell-m81",
1484 [STAC_922X_DELL_M82] = "dell-m82",
1487 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1488 /* SigmaTel reference board */
1489 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1490 "DFI LanParty", STAC_D945_REF),
1491 /* Intel 945G based systems */
1492 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1493 "Intel D945G", STAC_D945GTP3),
1494 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1495 "Intel D945G", STAC_D945GTP3),
1496 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1497 "Intel D945G", STAC_D945GTP3),
1498 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1499 "Intel D945G", STAC_D945GTP3),
1500 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1501 "Intel D945G", STAC_D945GTP3),
1502 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1503 "Intel D945G", STAC_D945GTP3),
1504 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1505 "Intel D945G", STAC_D945GTP3),
1506 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1507 "Intel D945G", STAC_D945GTP3),
1508 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1509 "Intel D945G", STAC_D945GTP3),
1510 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1511 "Intel D945G", STAC_D945GTP3),
1512 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1513 "Intel D945G", STAC_D945GTP3),
1514 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1515 "Intel D945G", STAC_D945GTP3),
1516 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1517 "Intel D945G", STAC_D945GTP3),
1518 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1519 "Intel D945G", STAC_D945GTP3),
1520 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1521 "Intel D945G", STAC_D945GTP3),
1522 /* Intel D945G 5-stack systems */
1523 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1524 "Intel D945G", STAC_D945GTP5),
1525 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1526 "Intel D945G", STAC_D945GTP5),
1527 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1528 "Intel D945G", STAC_D945GTP5),
1529 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1530 "Intel D945G", STAC_D945GTP5),
1531 /* Intel 945P based systems */
1532 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1533 "Intel D945P", STAC_D945GTP3),
1534 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1535 "Intel D945P", STAC_D945GTP3),
1536 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1537 "Intel D945P", STAC_D945GTP3),
1538 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1539 "Intel D945P", STAC_D945GTP3),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1541 "Intel D945P", STAC_D945GTP3),
1542 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
1543 "Intel D945P", STAC_D945GTP5),
1545 /* Apple Mac Mini (early 2006) */
1546 SND_PCI_QUIRK(0x8384, 0x7680,
1547 "Mac Mini", STAC_INTEL_MAC_V3),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
1550 "unknown Dell", STAC_922X_DELL_D81),
1551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
1552 "unknown Dell", STAC_922X_DELL_D81),
1553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
1554 "unknown Dell", STAC_922X_DELL_D81),
1555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
1556 "unknown Dell", STAC_922X_DELL_D82),
1557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
1558 "unknown Dell", STAC_922X_DELL_M81),
1559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1560 "unknown Dell", STAC_922X_DELL_D82),
1561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1562 "unknown Dell", STAC_922X_DELL_D81),
1563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1564 "unknown Dell", STAC_922X_DELL_D81),
1565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1566 "Dell XPS M1210", STAC_922X_DELL_M82),
1570 static unsigned int ref927x_pin_configs[14] = {
1571 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1572 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1573 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1574 0x01c42190, 0x40000100,
1577 static unsigned int d965_3st_pin_configs[14] = {
1578 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1579 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1580 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1581 0x40000100, 0x40000100
1584 static unsigned int d965_5st_pin_configs[14] = {
1585 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1586 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1587 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1588 0x40000100, 0x40000100
1591 static unsigned int dell_3st_pin_configs[14] = {
1592 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1593 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1594 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1595 0x40c003fc, 0x40000100
1598 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1599 [STAC_D965_REF] = ref927x_pin_configs,
1600 [STAC_D965_3ST] = d965_3st_pin_configs,
1601 [STAC_D965_5ST] = d965_5st_pin_configs,
1602 [STAC_DELL_3ST] = dell_3st_pin_configs,
1603 [STAC_DELL_BIOS] = NULL,
1606 static const char *stac927x_models[STAC_927X_MODELS] = {
1607 [STAC_D965_REF] = "ref",
1608 [STAC_D965_3ST] = "3stack",
1609 [STAC_D965_5ST] = "5stack",
1610 [STAC_DELL_3ST] = "dell-3stack",
1611 [STAC_DELL_BIOS] = "dell-bios",
1614 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1615 /* SigmaTel reference board */
1616 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1617 "DFI LanParty", STAC_D965_REF),
1618 /* Intel 946 based systems */
1619 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1620 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1621 /* 965 based 3 stack systems */
1622 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1624 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1625 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1626 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1627 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1628 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1629 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1630 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1631 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1632 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1633 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1634 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1635 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1636 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1637 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1638 /* Dell 3 stack systems */
1639 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
1640 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1641 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1643 /* Dell 3 stack systems with verb table in BIOS */
1644 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1645 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS),
1647 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1648 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1649 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1650 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
1652 /* 965 based 5 stack systems */
1653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1654 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1656 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1658 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1660 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1665 static unsigned int ref9205_pin_configs[12] = {
1666 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1667 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1668 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1672 STAC 9205 pin configs for
1679 10280228 (Dell Vostro 1500)
1681 static unsigned int dell_9205_m42_pin_configs[12] = {
1682 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1683 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1684 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1688 STAC 9205 pin configs for
1692 102801FF (Dell Precision M4300)
1697 static unsigned int dell_9205_m43_pin_configs[12] = {
1698 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1699 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1700 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1703 static unsigned int dell_9205_m44_pin_configs[12] = {
1704 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1705 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1706 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1709 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1710 [STAC_9205_REF] = ref9205_pin_configs,
1711 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1712 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1713 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1716 static const char *stac9205_models[STAC_9205_MODELS] = {
1717 [STAC_9205_REF] = "ref",
1718 [STAC_9205_DELL_M42] = "dell-m42",
1719 [STAC_9205_DELL_M43] = "dell-m43",
1720 [STAC_9205_DELL_M44] = "dell-m44",
1723 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1724 /* SigmaTel reference board */
1725 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1726 "DFI LanParty", STAC_9205_REF),
1727 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1728 "unknown Dell", STAC_9205_DELL_M42),
1729 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1730 "unknown Dell", STAC_9205_DELL_M42),
1731 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1732 "Dell Precision", STAC_9205_DELL_M43),
1733 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1734 "Dell Precision", STAC_9205_DELL_M43),
1735 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1736 "Dell Precision", STAC_9205_DELL_M43),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1738 "Dell Precision", STAC_9205_DELL_M43),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1740 "Dell Precision", STAC_9205_DELL_M43),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1742 "unknown Dell", STAC_9205_DELL_M42),
1743 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1744 "unknown Dell", STAC_9205_DELL_M42),
1745 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1746 "Dell Precision", STAC_9205_DELL_M43),
1747 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1748 "Dell Precision M4300", STAC_9205_DELL_M43),
1749 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1750 "Dell Precision", STAC_9205_DELL_M43),
1751 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1752 "Dell Inspiron", STAC_9205_DELL_M44),
1753 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1754 "Dell Inspiron", STAC_9205_DELL_M44),
1755 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1756 "Dell Inspiron", STAC_9205_DELL_M44),
1757 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1758 "Dell Inspiron", STAC_9205_DELL_M44),
1759 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1760 "unknown Dell", STAC_9205_DELL_M42),
1761 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1762 "Dell Inspiron", STAC_9205_DELL_M44),
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
1764 "Dell Vostro 1500", STAC_9205_DELL_M42),
1768 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
1771 struct sigmatel_spec *spec = codec->spec;
1773 if (! spec->bios_pin_configs) {
1774 spec->bios_pin_configs = kcalloc(spec->num_pins,
1775 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
1776 if (! spec->bios_pin_configs)
1780 for (i = 0; i < spec->num_pins; i++) {
1781 hda_nid_t nid = spec->pin_nids[i];
1782 unsigned int pin_cfg;
1784 pin_cfg = snd_hda_codec_read(codec, nid, 0,
1785 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
1786 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1788 spec->bios_pin_configs[i] = pin_cfg;
1794 static void stac92xx_set_config_reg(struct hda_codec *codec,
1795 hda_nid_t pin_nid, unsigned int pin_config)
1798 snd_hda_codec_write(codec, pin_nid, 0,
1799 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
1800 pin_config & 0x000000ff);
1801 snd_hda_codec_write(codec, pin_nid, 0,
1802 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
1803 (pin_config & 0x0000ff00) >> 8);
1804 snd_hda_codec_write(codec, pin_nid, 0,
1805 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
1806 (pin_config & 0x00ff0000) >> 16);
1807 snd_hda_codec_write(codec, pin_nid, 0,
1808 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
1810 i = snd_hda_codec_read(codec, pin_nid, 0,
1811 AC_VERB_GET_CONFIG_DEFAULT,
1813 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
1817 static void stac92xx_set_config_regs(struct hda_codec *codec)
1820 struct sigmatel_spec *spec = codec->spec;
1822 if (!spec->pin_configs)
1825 for (i = 0; i < spec->num_pins; i++)
1826 stac92xx_set_config_reg(codec, spec->pin_nids[i],
1827 spec->pin_configs[i]);
1831 * Analog playback callbacks
1833 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
1834 struct hda_codec *codec,
1835 struct snd_pcm_substream *substream)
1837 struct sigmatel_spec *spec = codec->spec;
1838 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
1842 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1843 struct hda_codec *codec,
1844 unsigned int stream_tag,
1845 unsigned int format,
1846 struct snd_pcm_substream *substream)
1848 struct sigmatel_spec *spec = codec->spec;
1849 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
1852 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1853 struct hda_codec *codec,
1854 struct snd_pcm_substream *substream)
1856 struct sigmatel_spec *spec = codec->spec;
1857 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
1861 * Digital playback callbacks
1863 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
1864 struct hda_codec *codec,
1865 struct snd_pcm_substream *substream)
1867 struct sigmatel_spec *spec = codec->spec;
1868 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
1871 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
1872 struct hda_codec *codec,
1873 struct snd_pcm_substream *substream)
1875 struct sigmatel_spec *spec = codec->spec;
1876 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
1879 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1880 struct hda_codec *codec,
1881 unsigned int stream_tag,
1882 unsigned int format,
1883 struct snd_pcm_substream *substream)
1885 struct sigmatel_spec *spec = codec->spec;
1886 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
1887 stream_tag, format, substream);
1892 * Analog capture callbacks
1894 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
1895 struct hda_codec *codec,
1896 unsigned int stream_tag,
1897 unsigned int format,
1898 struct snd_pcm_substream *substream)
1900 struct sigmatel_spec *spec = codec->spec;
1902 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
1903 stream_tag, 0, format);
1907 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1908 struct hda_codec *codec,
1909 struct snd_pcm_substream *substream)
1911 struct sigmatel_spec *spec = codec->spec;
1913 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);
1917 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
1921 /* NID is set in stac92xx_build_pcms */
1923 .open = stac92xx_dig_playback_pcm_open,
1924 .close = stac92xx_dig_playback_pcm_close,
1925 .prepare = stac92xx_dig_playback_pcm_prepare
1929 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
1933 /* NID is set in stac92xx_build_pcms */
1936 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
1940 .nid = 0x02, /* NID to query formats and rates */
1942 .open = stac92xx_playback_pcm_open,
1943 .prepare = stac92xx_playback_pcm_prepare,
1944 .cleanup = stac92xx_playback_pcm_cleanup
1948 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
1952 .nid = 0x06, /* NID to query formats and rates */
1954 .open = stac92xx_playback_pcm_open,
1955 .prepare = stac92xx_playback_pcm_prepare,
1956 .cleanup = stac92xx_playback_pcm_cleanup
1960 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
1963 /* NID + .substreams is set in stac92xx_build_pcms */
1965 .prepare = stac92xx_capture_pcm_prepare,
1966 .cleanup = stac92xx_capture_pcm_cleanup
1970 static int stac92xx_build_pcms(struct hda_codec *codec)
1972 struct sigmatel_spec *spec = codec->spec;
1973 struct hda_pcm *info = spec->pcm_rec;
1975 codec->num_pcms = 1;
1976 codec->pcm_info = info;
1978 info->name = "STAC92xx Analog";
1979 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
1980 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
1981 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1982 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
1984 if (spec->alt_switch) {
1987 info->name = "STAC92xx Analog Alt";
1988 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
1991 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1994 info->name = "STAC92xx Digital";
1995 info->pcm_type = HDA_PCM_TYPE_SPDIF;
1996 if (spec->multiout.dig_out_nid) {
1997 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
1998 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2000 if (spec->dig_in_nid) {
2001 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2002 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2009 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2011 unsigned int pincap = snd_hda_param_read(codec, nid,
2013 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2014 if (pincap & AC_PINCAP_VREF_100)
2015 return AC_PINCTL_VREF_100;
2016 if (pincap & AC_PINCAP_VREF_80)
2017 return AC_PINCTL_VREF_80;
2018 if (pincap & AC_PINCAP_VREF_50)
2019 return AC_PINCTL_VREF_50;
2020 if (pincap & AC_PINCAP_VREF_GRD)
2021 return AC_PINCTL_VREF_GRD;
2025 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2028 snd_hda_codec_write_cache(codec, nid, 0,
2029 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2032 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2034 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2036 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2037 struct sigmatel_spec *spec = codec->spec;
2038 int io_idx = kcontrol-> private_value & 0xff;
2040 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2044 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2046 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2047 struct sigmatel_spec *spec = codec->spec;
2048 hda_nid_t nid = kcontrol->private_value >> 8;
2049 int io_idx = kcontrol-> private_value & 0xff;
2050 unsigned short val = !!ucontrol->value.integer.value[0];
2052 spec->io_switch[io_idx] = val;
2055 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2057 unsigned int pinctl = AC_PINCTL_IN_EN;
2058 if (io_idx) /* set VREF for mic */
2059 pinctl |= stac92xx_get_vref(codec, nid);
2060 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2063 /* check the auto-mute again: we need to mute/unmute the speaker
2064 * appropriately according to the pin direction
2066 if (spec->hp_detect)
2067 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2072 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2074 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2075 struct snd_ctl_elem_value *ucontrol)
2077 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2078 struct sigmatel_spec *spec = codec->spec;
2080 ucontrol->value.integer.value[0] = spec->clfe_swap;
2084 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2085 struct snd_ctl_elem_value *ucontrol)
2087 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2088 struct sigmatel_spec *spec = codec->spec;
2089 hda_nid_t nid = kcontrol->private_value & 0xff;
2090 unsigned int val = !!ucontrol->value.integer.value[0];
2092 if (spec->clfe_swap == val)
2095 spec->clfe_swap = val;
2097 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2098 spec->clfe_swap ? 0x4 : 0x0);
2103 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2104 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2107 .info = stac92xx_io_switch_info, \
2108 .get = stac92xx_io_switch_get, \
2109 .put = stac92xx_io_switch_put, \
2110 .private_value = xpval, \
2113 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2114 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2117 .info = stac92xx_clfe_switch_info, \
2118 .get = stac92xx_clfe_switch_get, \
2119 .put = stac92xx_clfe_switch_put, \
2120 .private_value = xpval, \
2124 STAC_CTL_WIDGET_VOL,
2125 STAC_CTL_WIDGET_MUTE,
2126 STAC_CTL_WIDGET_MONO_MUX,
2127 STAC_CTL_WIDGET_IO_SWITCH,
2128 STAC_CTL_WIDGET_CLFE_SWITCH
2131 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2132 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2133 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2135 STAC_CODEC_IO_SWITCH(NULL, 0),
2136 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2139 /* add dynamic controls */
2140 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
2142 struct snd_kcontrol_new *knew;
2144 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2145 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2147 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
2150 if (spec->kctl_alloc) {
2151 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
2152 kfree(spec->kctl_alloc);
2154 spec->kctl_alloc = knew;
2155 spec->num_kctl_alloc = num;
2158 knew = &spec->kctl_alloc[spec->num_kctl_used];
2159 *knew = stac92xx_control_templates[type];
2160 knew->name = kstrdup(name, GFP_KERNEL);
2163 knew->private_value = val;
2164 spec->num_kctl_used++;
2168 /* flag inputs as additional dynamic lineouts */
2169 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2171 struct sigmatel_spec *spec = codec->spec;
2172 unsigned int wcaps, wtype;
2173 int i, num_dacs = 0;
2175 /* use the wcaps cache to count all DACs available for line-outs */
2176 for (i = 0; i < codec->num_nodes; i++) {
2177 wcaps = codec->wcaps[i];
2178 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2180 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2184 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2186 switch (cfg->line_outs) {
2188 /* add line-in as side */
2189 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2190 cfg->line_out_pins[cfg->line_outs] =
2191 cfg->input_pins[AUTO_PIN_LINE];
2192 spec->line_switch = 1;
2197 /* add line-in as clfe and mic as side */
2198 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2199 cfg->line_out_pins[cfg->line_outs] =
2200 cfg->input_pins[AUTO_PIN_LINE];
2201 spec->line_switch = 1;
2204 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2205 cfg->line_out_pins[cfg->line_outs] =
2206 cfg->input_pins[AUTO_PIN_MIC];
2207 spec->mic_switch = 1;
2212 /* add line-in as surr and mic as clfe */
2213 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2214 cfg->line_out_pins[cfg->line_outs] =
2215 cfg->input_pins[AUTO_PIN_LINE];
2216 spec->line_switch = 1;
2219 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2220 cfg->line_out_pins[cfg->line_outs] =
2221 cfg->input_pins[AUTO_PIN_MIC];
2222 spec->mic_switch = 1;
2232 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2236 for (i = 0; i < spec->multiout.num_dacs; i++) {
2237 if (spec->multiout.dac_nids[i] == nid)
2245 * Fill in the dac_nids table from the parsed pin configuration
2246 * This function only works when every pin in line_out_pins[]
2247 * contains atleast one DAC in its connection list. Some 92xx
2248 * codecs are not connected directly to a DAC, such as the 9200
2249 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2251 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2252 struct auto_pin_cfg *cfg)
2254 struct sigmatel_spec *spec = codec->spec;
2255 int i, j, conn_len = 0;
2256 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2257 unsigned int wcaps, wtype;
2259 for (i = 0; i < cfg->line_outs; i++) {
2260 nid = cfg->line_out_pins[i];
2261 conn_len = snd_hda_get_connections(codec, nid, conn,
2262 HDA_MAX_CONNECTIONS);
2263 for (j = 0; j < conn_len; j++) {
2264 wcaps = snd_hda_param_read(codec, conn[j],
2265 AC_PAR_AUDIO_WIDGET_CAP);
2266 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2267 if (wtype != AC_WID_AUD_OUT ||
2268 (wcaps & AC_WCAP_DIGITAL))
2270 /* conn[j] is a DAC routed to this line-out */
2271 if (!is_in_dac_nids(spec, conn[j]))
2275 if (j == conn_len) {
2276 if (spec->multiout.num_dacs > 0) {
2277 /* we have already working output pins,
2278 * so let's drop the broken ones again
2280 cfg->line_outs = spec->multiout.num_dacs;
2283 /* error out, no available DAC found */
2285 "%s: No available DAC for pin 0x%x\n",
2290 spec->multiout.dac_nids[i] = conn[j];
2291 spec->multiout.num_dacs++;
2293 /* select this DAC in the pin's input mux */
2294 snd_hda_codec_write_cache(codec, nid, 0,
2295 AC_VERB_SET_CONNECT_SEL, j);
2300 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2301 spec->multiout.num_dacs,
2302 spec->multiout.dac_nids[0],
2303 spec->multiout.dac_nids[1],
2304 spec->multiout.dac_nids[2],
2305 spec->multiout.dac_nids[3],
2306 spec->multiout.dac_nids[4]);
2310 /* create volume control/switch for the given prefx type */
2311 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2316 sprintf(name, "%s Playback Volume", pfx);
2317 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2318 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2321 sprintf(name, "%s Playback Switch", pfx);
2322 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2323 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2329 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2331 if (!spec->multiout.hp_nid)
2332 spec->multiout.hp_nid = nid;
2333 else if (spec->multiout.num_dacs > 4) {
2334 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2337 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2338 spec->multiout.num_dacs++;
2343 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2345 if (is_in_dac_nids(spec, nid))
2347 if (spec->multiout.hp_nid == nid)
2352 /* add playback controls from the parsed DAC table */
2353 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2354 const struct auto_pin_cfg *cfg)
2356 static const char *chname[4] = {
2357 "Front", "Surround", NULL /*CLFE*/, "Side"
2362 struct sigmatel_spec *spec = codec->spec;
2363 unsigned int wid_caps, pincap;
2366 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2367 if (!spec->multiout.dac_nids[i])
2370 nid = spec->multiout.dac_nids[i];
2374 err = create_controls(spec, "Center", nid, 1);
2377 err = create_controls(spec, "LFE", nid, 2);
2381 wid_caps = get_wcaps(codec, nid);
2383 if (wid_caps & AC_WCAP_LR_SWAP) {
2384 err = stac92xx_add_control(spec,
2385 STAC_CTL_WIDGET_CLFE_SWITCH,
2386 "Swap Center/LFE Playback Switch", nid);
2393 err = create_controls(spec, chname[i], nid, 3);
2399 if (spec->line_switch) {
2400 nid = cfg->input_pins[AUTO_PIN_LINE];
2401 pincap = snd_hda_param_read(codec, nid,
2403 if (pincap & AC_PINCAP_OUT) {
2404 err = stac92xx_add_control(spec,
2405 STAC_CTL_WIDGET_IO_SWITCH,
2406 "Line In as Output Switch", nid << 8);
2412 if (spec->mic_switch) {
2413 unsigned int def_conf;
2414 unsigned int mic_pin = AUTO_PIN_MIC;
2416 nid = cfg->input_pins[mic_pin];
2417 def_conf = snd_hda_codec_read(codec, nid, 0,
2418 AC_VERB_GET_CONFIG_DEFAULT, 0);
2419 /* some laptops have an internal analog microphone
2420 * which can't be used as a output */
2421 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2422 pincap = snd_hda_param_read(codec, nid,
2424 if (pincap & AC_PINCAP_OUT) {
2425 err = stac92xx_add_control(spec,
2426 STAC_CTL_WIDGET_IO_SWITCH,
2427 "Mic as Output Switch", (nid << 8) | 1);
2428 nid = snd_hda_codec_read(codec, nid, 0,
2429 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2430 if (!check_in_dac_nids(spec, nid))
2431 add_spec_dacs(spec, nid);
2435 } else if (mic_pin == AUTO_PIN_MIC) {
2436 mic_pin = AUTO_PIN_FRONT_MIC;
2444 /* add playback controls for Speaker and HP outputs */
2445 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
2446 struct auto_pin_cfg *cfg)
2448 struct sigmatel_spec *spec = codec->spec;
2450 int i, old_num_dacs, err;
2452 old_num_dacs = spec->multiout.num_dacs;
2453 for (i = 0; i < cfg->hp_outs; i++) {
2454 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
2455 if (wid_caps & AC_WCAP_UNSOL_CAP)
2456 spec->hp_detect = 1;
2457 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
2458 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2459 if (check_in_dac_nids(spec, nid))
2463 add_spec_dacs(spec, nid);
2465 for (i = 0; i < cfg->speaker_outs; i++) {
2466 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
2467 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2468 if (check_in_dac_nids(spec, nid))
2472 add_spec_dacs(spec, nid);
2474 for (i = 0; i < cfg->line_outs; i++) {
2475 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
2476 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2477 if (check_in_dac_nids(spec, nid))
2481 add_spec_dacs(spec, nid);
2483 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
2484 static const char *pfxs[] = {
2485 "Speaker", "External Speaker", "Speaker2",
2487 err = create_controls(spec, pfxs[i - old_num_dacs],
2488 spec->multiout.dac_nids[i], 3);
2492 if (spec->multiout.hp_nid) {
2494 if (old_num_dacs == spec->multiout.num_dacs)
2498 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3);
2506 /* labels for mono mux outputs */
2507 static const char *stac92xx_mono_labels[3] = {
2508 "DAC0", "DAC1", "Mixer"
2511 /* create mono mux for mono out on capable codecs */
2512 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
2514 struct sigmatel_spec *spec = codec->spec;
2515 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
2517 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
2519 num_cons = snd_hda_get_connections(codec,
2522 HDA_MAX_NUM_INPUTS);
2523 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
2526 for (i = 0; i < num_cons; i++) {
2527 mono_mux->items[mono_mux->num_items].label =
2528 stac92xx_mono_labels[i];
2529 mono_mux->items[mono_mux->num_items].index = i;
2530 mono_mux->num_items++;
2533 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
2534 "Mono Mux", spec->mono_nid);
2537 /* labels for dmic mux inputs */
2538 static const char *stac92xx_dmic_labels[5] = {
2539 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2540 "Digital Mic 3", "Digital Mic 4"
2543 /* create playback/capture controls for input pins on dmic capable codecs */
2544 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2545 const struct auto_pin_cfg *cfg)
2547 struct sigmatel_spec *spec = codec->spec;
2548 struct hda_input_mux *dimux = &spec->private_dimux;
2549 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2553 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2554 dimux->items[dimux->num_items].index = 0;
2557 for (i = 0; i < spec->num_dmics; i++) {
2562 unsigned int def_conf;
2564 def_conf = snd_hda_codec_read(codec,
2567 AC_VERB_GET_CONFIG_DEFAULT,
2569 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2572 nid = spec->dmic_nids[i];
2573 num_cons = snd_hda_get_connections(codec,
2576 HDA_MAX_NUM_INPUTS);
2577 for (j = 0; j < num_cons; j++)
2578 if (con_lst[j] == nid) {
2584 wcaps = get_wcaps(codec, nid);
2586 if (wcaps & AC_WCAP_OUT_AMP) {
2587 sprintf(name, "%s Capture Volume",
2588 stac92xx_dmic_labels[dimux->num_items]);
2590 err = stac92xx_add_control(spec,
2591 STAC_CTL_WIDGET_VOL,
2593 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
2598 dimux->items[dimux->num_items].label =
2599 stac92xx_dmic_labels[dimux->num_items];
2600 dimux->items[dimux->num_items].index = index;
2607 /* create playback/capture controls for input pins */
2608 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
2610 struct sigmatel_spec *spec = codec->spec;
2611 struct hda_input_mux *imux = &spec->private_imux;
2612 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2615 for (i = 0; i < AUTO_PIN_LAST; i++) {
2618 if (!cfg->input_pins[i])
2621 for (j = 0; j < spec->num_muxes; j++) {
2623 num_cons = snd_hda_get_connections(codec,
2626 HDA_MAX_NUM_INPUTS);
2627 for (k = 0; k < num_cons; k++)
2628 if (con_lst[k] == cfg->input_pins[i]) {
2635 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
2636 imux->items[imux->num_items].index = index;
2640 if (imux->num_items) {
2642 * Set the current input for the muxes.
2643 * The STAC9221 has two input muxes with identical source
2644 * NID lists. Hopefully this won't get confused.
2646 for (i = 0; i < spec->num_muxes; i++) {
2647 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
2648 AC_VERB_SET_CONNECT_SEL,
2649 imux->items[0].index);
2656 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
2658 struct sigmatel_spec *spec = codec->spec;
2661 for (i = 0; i < spec->autocfg.line_outs; i++) {
2662 hda_nid_t nid = spec->autocfg.line_out_pins[i];
2663 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2667 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
2669 struct sigmatel_spec *spec = codec->spec;
2672 for (i = 0; i < spec->autocfg.hp_outs; i++) {
2674 pin = spec->autocfg.hp_pins[i];
2675 if (pin) /* connect to front */
2676 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
2678 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
2680 pin = spec->autocfg.speaker_pins[i];
2681 if (pin) /* connect to front */
2682 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
2686 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
2688 struct sigmatel_spec *spec = codec->spec;
2690 int hp_speaker_swap = 0;
2692 if ((err = snd_hda_parse_pin_def_config(codec,
2694 spec->dmic_nids)) < 0)
2696 if (! spec->autocfg.line_outs)
2697 return 0; /* can't find valid pin config */
2699 /* If we have no real line-out pin and multiple hp-outs, HPs should
2700 * be set up as multi-channel outputs.
2702 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2703 spec->autocfg.hp_outs > 1) {
2704 /* Copy hp_outs to line_outs, backup line_outs in
2705 * speaker_outs so that the following routines can handle
2706 * HP pins as primary outputs.
2708 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
2709 sizeof(spec->autocfg.line_out_pins));
2710 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
2711 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
2712 sizeof(spec->autocfg.hp_pins));
2713 spec->autocfg.line_outs = spec->autocfg.hp_outs;
2714 hp_speaker_swap = 1;
2716 if (spec->autocfg.mono_out_pin) {
2717 int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin)
2718 & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
2719 u32 caps = query_amp_caps(codec,
2720 spec->autocfg.mono_out_pin, dir);
2721 hda_nid_t conn_list[1];
2723 /* get the mixer node and then the mono mux if it exists */
2724 if (snd_hda_get_connections(codec,
2725 spec->autocfg.mono_out_pin, conn_list, 1) &&
2726 snd_hda_get_connections(codec, conn_list[0],
2729 int wcaps = get_wcaps(codec, conn_list[0]);
2730 int wid_type = (wcaps & AC_WCAP_TYPE)
2731 >> AC_WCAP_TYPE_SHIFT;
2732 /* LR swap check, some stac925x have a mux that
2733 * changes the DACs output path instead of the
2736 if (wid_type == AC_WID_AUD_SEL &&
2737 !(wcaps & AC_WCAP_LR_SWAP))
2738 spec->mono_nid = conn_list[0];
2740 /* all mono outs have a least a mute/unmute switch */
2741 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2742 "Mono Playback Switch",
2743 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2747 /* check to see if there is volume support for the amp */
2748 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
2749 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
2750 "Mono Playback Volume",
2751 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2757 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
2761 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
2763 if (spec->multiout.num_dacs == 0)
2764 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
2767 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
2772 if (hp_speaker_swap == 1) {
2773 /* Restore the hp_outs and line_outs */
2774 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
2775 sizeof(spec->autocfg.line_out_pins));
2776 spec->autocfg.hp_outs = spec->autocfg.line_outs;
2777 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
2778 sizeof(spec->autocfg.speaker_pins));
2779 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
2780 memset(spec->autocfg.speaker_pins, 0,
2781 sizeof(spec->autocfg.speaker_pins));
2782 spec->autocfg.speaker_outs = 0;
2785 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
2790 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
2795 if (spec->mono_nid > 0) {
2796 err = stac92xx_auto_create_mono_output_ctls(codec);
2801 if (spec->num_dmics > 0)
2802 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
2803 &spec->autocfg)) < 0)
2806 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
2807 if (spec->multiout.max_channels > 2)
2808 spec->surr_switch = 1;
2810 if (spec->autocfg.dig_out_pin)
2811 spec->multiout.dig_out_nid = dig_out;
2812 if (spec->autocfg.dig_in_pin)
2813 spec->dig_in_nid = dig_in;
2815 if (spec->kctl_alloc)
2816 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2818 spec->input_mux = &spec->private_imux;
2819 if (!spec->dinput_mux)
2820 spec->dinput_mux = &spec->private_dimux;
2821 spec->mono_mux = &spec->private_mono_mux;
2826 /* add playback controls for HP output */
2827 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
2828 struct auto_pin_cfg *cfg)
2830 struct sigmatel_spec *spec = codec->spec;
2831 hda_nid_t pin = cfg->hp_pins[0];
2832 unsigned int wid_caps;
2837 wid_caps = get_wcaps(codec, pin);
2838 if (wid_caps & AC_WCAP_UNSOL_CAP)
2839 spec->hp_detect = 1;
2844 /* add playback controls for LFE output */
2845 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
2846 struct auto_pin_cfg *cfg)
2848 struct sigmatel_spec *spec = codec->spec;
2850 hda_nid_t lfe_pin = 0x0;
2854 * search speaker outs and line outs for a mono speaker pin
2855 * with an amp. If one is found, add LFE controls
2858 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
2859 hda_nid_t pin = spec->autocfg.speaker_pins[i];
2860 unsigned int wcaps = get_wcaps(codec, pin);
2861 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2862 if (wcaps == AC_WCAP_OUT_AMP)
2863 /* found a mono speaker with an amp, must be lfe */
2867 /* if speaker_outs is 0, then speakers may be in line_outs */
2868 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
2869 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
2870 hda_nid_t pin = spec->autocfg.line_out_pins[i];
2871 unsigned int defcfg;
2872 defcfg = snd_hda_codec_read(codec, pin, 0,
2873 AC_VERB_GET_CONFIG_DEFAULT,
2875 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
2876 unsigned int wcaps = get_wcaps(codec, pin);
2877 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2878 if (wcaps == AC_WCAP_OUT_AMP)
2879 /* found a mono speaker with an amp,
2887 err = create_controls(spec, "LFE", lfe_pin, 1);
2895 static int stac9200_parse_auto_config(struct hda_codec *codec)
2897 struct sigmatel_spec *spec = codec->spec;
2900 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
2903 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
2906 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
2909 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
2912 if (spec->autocfg.dig_out_pin)
2913 spec->multiout.dig_out_nid = 0x05;
2914 if (spec->autocfg.dig_in_pin)
2915 spec->dig_in_nid = 0x04;
2917 if (spec->kctl_alloc)
2918 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2920 spec->input_mux = &spec->private_imux;
2921 spec->dinput_mux = &spec->private_dimux;
2927 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
2928 * funky external mute control using GPIO pins.
2931 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
2932 unsigned int dir_mask, unsigned int data)
2934 unsigned int gpiostate, gpiomask, gpiodir;
2936 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
2937 AC_VERB_GET_GPIO_DATA, 0);
2938 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
2940 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
2941 AC_VERB_GET_GPIO_MASK, 0);
2944 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
2945 AC_VERB_GET_GPIO_DIRECTION, 0);
2946 gpiodir |= dir_mask;
2948 /* Configure GPIOx as CMOS */
2949 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
2951 snd_hda_codec_write(codec, codec->afg, 0,
2952 AC_VERB_SET_GPIO_MASK, gpiomask);
2953 snd_hda_codec_read(codec, codec->afg, 0,
2954 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
2958 snd_hda_codec_read(codec, codec->afg, 0,
2959 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
2962 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
2965 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
2966 snd_hda_codec_write_cache(codec, nid, 0,
2967 AC_VERB_SET_UNSOLICITED_ENABLE,
2968 (AC_USRSP_EN | event));
2971 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
2974 for (i = 0; i < cfg->hp_outs; i++)
2975 if (cfg->hp_pins[i] == nid)
2976 return 1; /* nid is a HP-Out */
2978 return 0; /* nid is not a HP-Out */
2981 static void stac92xx_power_down(struct hda_codec *codec)
2983 struct sigmatel_spec *spec = codec->spec;
2985 /* power down inactive DACs */
2987 for (dac = spec->dac_list; *dac; dac++)
2988 if (!is_in_dac_nids(spec, *dac) &&
2989 spec->multiout.hp_nid != *dac)
2990 snd_hda_codec_write_cache(codec, *dac, 0,
2991 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2994 static int stac92xx_init(struct hda_codec *codec)
2996 struct sigmatel_spec *spec = codec->spec;
2997 struct auto_pin_cfg *cfg = &spec->autocfg;
3000 snd_hda_sequence_write(codec, spec->init);
3003 if (spec->hp_detect) {
3004 /* Enable unsolicited responses on the HP widget */
3005 for (i = 0; i < cfg->hp_outs; i++)
3006 enable_pin_detect(codec, cfg->hp_pins[i],
3008 /* force to enable the first line-out; the others are set up
3011 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3013 stac92xx_auto_init_hp_out(codec);
3014 /* fake event to set up pins */
3015 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3017 stac92xx_auto_init_multi_out(codec);
3018 stac92xx_auto_init_hp_out(codec);
3020 for (i = 0; i < AUTO_PIN_LAST; i++) {
3021 hda_nid_t nid = cfg->input_pins[i];
3023 unsigned int pinctl = AC_PINCTL_IN_EN;
3024 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
3025 pinctl |= stac92xx_get_vref(codec, nid);
3026 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3029 for (i = 0; i < spec->num_dmics; i++)
3030 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3032 for (i = 0; i < spec->num_pwrs; i++) {
3033 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i])
3034 ? STAC_HP_EVENT : STAC_PWR_EVENT;
3035 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i],
3036 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3037 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i],
3038 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3039 /* outputs are only ports capable of power management
3040 * any attempts on powering down a input port cause the
3041 * referenced VREF to act quirky.
3043 if (pinctl & AC_PINCTL_IN_EN)
3045 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED)
3047 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3048 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3051 stac92xx_power_down(codec);
3052 if (cfg->dig_out_pin)
3053 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3055 if (cfg->dig_in_pin)
3056 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3059 stac_gpio_set(codec, spec->gpio_mask,
3060 spec->gpio_dir, spec->gpio_data);
3065 static void stac92xx_free(struct hda_codec *codec)
3067 struct sigmatel_spec *spec = codec->spec;
3073 if (spec->kctl_alloc) {
3074 for (i = 0; i < spec->num_kctl_used; i++)
3075 kfree(spec->kctl_alloc[i].name);
3076 kfree(spec->kctl_alloc);
3079 if (spec->bios_pin_configs)
3080 kfree(spec->bios_pin_configs);
3085 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
3088 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3089 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3091 if (pin_ctl & AC_PINCTL_IN_EN) {
3093 * we need to check the current set-up direction of
3094 * shared input pins since they can be switched via
3095 * "xxx as Output" mixer switch
3097 struct sigmatel_spec *spec = codec->spec;
3098 struct auto_pin_cfg *cfg = &spec->autocfg;
3099 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
3100 spec->line_switch) ||
3101 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
3106 /* if setting pin direction bits, clear the current
3107 direction bits first */
3108 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
3109 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
3111 snd_hda_codec_write_cache(codec, nid, 0,
3112 AC_VERB_SET_PIN_WIDGET_CONTROL,
3116 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
3119 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3120 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3121 snd_hda_codec_write_cache(codec, nid, 0,
3122 AC_VERB_SET_PIN_WIDGET_CONTROL,
3126 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
3130 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
3132 unsigned int pinctl;
3133 pinctl = snd_hda_codec_read(codec, nid, 0,
3134 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3135 if (pinctl & AC_PINCTL_IN_EN)
3136 return 0; /* mic- or line-input */
3138 return 1; /* HP-output */
3143 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3145 struct sigmatel_spec *spec = codec->spec;
3146 struct auto_pin_cfg *cfg = &spec->autocfg;
3150 if (spec->gpio_mute)
3151 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
3152 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
3154 for (i = 0; i < cfg->hp_outs; i++) {
3157 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
3161 /* disable lineouts, enable hp */
3162 for (i = 0; i < cfg->line_outs; i++)
3163 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
3165 for (i = 0; i < cfg->speaker_outs; i++)
3166 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3169 /* enable lineouts, disable hp */
3170 for (i = 0; i < cfg->line_outs; i++)
3171 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
3173 for (i = 0; i < cfg->speaker_outs; i++)
3174 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3179 static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3181 struct sigmatel_spec *spec = codec->spec;
3182 hda_nid_t nid = spec->pwr_nids[idx];
3184 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0)
3186 presence = get_hp_pin_presence(codec, nid);
3194 /* power down unused output ports */
3195 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3198 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3200 struct sigmatel_spec *spec = codec->spec;
3201 int idx = res >> 26 & 0x0f;
3203 switch ((res >> 26) & 0x30) {
3205 stac92xx_hp_detect(codec, res);
3207 case STAC_PWR_EVENT:
3208 if (spec->num_pwrs > 0)
3209 stac92xx_pin_sense(codec, idx);
3213 #ifdef SND_HDA_NEEDS_RESUME
3214 static int stac92xx_resume(struct hda_codec *codec)
3216 struct sigmatel_spec *spec = codec->spec;
3218 stac92xx_set_config_regs(codec);
3219 snd_hda_sequence_write(codec, spec->init);
3220 stac_gpio_set(codec, spec->gpio_mask,
3221 spec->gpio_dir, spec->gpio_data);
3222 snd_hda_codec_resume_amp(codec);
3223 snd_hda_codec_resume_cache(codec);
3224 /* power down inactive DACs */
3226 stac92xx_power_down(codec);
3227 /* invoke unsolicited event to reset the HP state */
3228 if (spec->hp_detect)
3229 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3234 static struct hda_codec_ops stac92xx_patch_ops = {
3235 .build_controls = stac92xx_build_controls,
3236 .build_pcms = stac92xx_build_pcms,
3237 .init = stac92xx_init,
3238 .free = stac92xx_free,
3239 .unsol_event = stac92xx_unsol_event,
3240 #ifdef SND_HDA_NEEDS_RESUME
3241 .resume = stac92xx_resume,
3245 static int patch_stac9200(struct hda_codec *codec)
3247 struct sigmatel_spec *spec;
3250 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3255 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
3256 spec->pin_nids = stac9200_pin_nids;
3257 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
3260 if (spec->board_config < 0) {
3261 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3262 err = stac92xx_save_bios_config_regs(codec);
3264 stac92xx_free(codec);
3267 spec->pin_configs = spec->bios_pin_configs;
3269 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
3270 stac92xx_set_config_regs(codec);
3273 spec->multiout.max_channels = 2;
3274 spec->multiout.num_dacs = 1;
3275 spec->multiout.dac_nids = stac9200_dac_nids;
3276 spec->adc_nids = stac9200_adc_nids;
3277 spec->mux_nids = stac9200_mux_nids;
3278 spec->num_muxes = 1;
3279 spec->num_dmics = 0;
3283 if (spec->board_config == STAC_9200_GATEWAY ||
3284 spec->board_config == STAC_9200_OQO)
3285 spec->init = stac9200_eapd_init;
3287 spec->init = stac9200_core_init;
3288 spec->mixer = stac9200_mixer;
3290 err = stac9200_parse_auto_config(codec);
3292 stac92xx_free(codec);
3296 codec->patch_ops = stac92xx_patch_ops;
3301 static int patch_stac925x(struct hda_codec *codec)
3303 struct sigmatel_spec *spec;
3306 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3311 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
3312 spec->pin_nids = stac925x_pin_nids;
3313 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
3317 if (spec->board_config < 0) {
3318 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
3319 "using BIOS defaults\n");
3320 err = stac92xx_save_bios_config_regs(codec);
3322 stac92xx_free(codec);
3325 spec->pin_configs = spec->bios_pin_configs;
3326 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
3327 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
3328 stac92xx_set_config_regs(codec);
3331 spec->multiout.max_channels = 2;
3332 spec->multiout.num_dacs = 1;
3333 spec->multiout.dac_nids = stac925x_dac_nids;
3334 spec->adc_nids = stac925x_adc_nids;
3335 spec->mux_nids = stac925x_mux_nids;
3336 spec->num_muxes = 1;
3339 switch (codec->vendor_id) {
3340 case 0x83847632: /* STAC9202 */
3341 case 0x83847633: /* STAC9202D */
3342 case 0x83847636: /* STAC9251 */
3343 case 0x83847637: /* STAC9251D */
3344 spec->num_dmics = STAC925X_NUM_DMICS;
3345 spec->dmic_nids = stac925x_dmic_nids;
3346 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
3347 spec->dmux_nids = stac925x_dmux_nids;
3350 spec->num_dmics = 0;
3354 spec->init = stac925x_core_init;
3355 spec->mixer = stac925x_mixer;
3357 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
3359 if (spec->board_config < 0) {
3360 printk(KERN_WARNING "hda_codec: No auto-config is "
3361 "available, default to model=ref\n");
3362 spec->board_config = STAC_925x_REF;
3368 stac92xx_free(codec);
3372 codec->patch_ops = stac92xx_patch_ops;
3377 static struct hda_input_mux stac92hd73xx_dmux = {
3380 { "Analog Inputs", 0x0b },
3382 { "Digital Mic 1", 0x09 },
3383 { "Digital Mic 2", 0x0a },
3387 static int patch_stac92hd73xx(struct hda_codec *codec)
3389 struct sigmatel_spec *spec;
3390 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
3393 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3398 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
3399 spec->pin_nids = stac92hd73xx_pin_nids;
3400 spec->board_config = snd_hda_check_board_config(codec,
3401 STAC_92HD73XX_MODELS,
3402 stac92hd73xx_models,
3403 stac92hd73xx_cfg_tbl);
3405 if (spec->board_config < 0) {
3406 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3407 " STAC92HD73XX, using BIOS defaults\n");
3408 err = stac92xx_save_bios_config_regs(codec);
3410 stac92xx_free(codec);
3413 spec->pin_configs = spec->bios_pin_configs;
3415 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
3416 stac92xx_set_config_regs(codec);
3419 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
3420 conn, STAC92HD73_DAC_COUNT + 2) - 1;
3422 if (spec->multiout.num_dacs < 0) {
3423 printk(KERN_WARNING "hda_codec: Could not determine "
3424 "number of channels defaulting to DAC count\n");
3425 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
3428 switch (spec->multiout.num_dacs) {
3429 case 0x3: /* 6 Channel */
3430 spec->mixer = stac92hd73xx_6ch_mixer;
3431 spec->init = stac92hd73xx_6ch_core_init;
3433 case 0x4: /* 8 Channel */
3434 spec->multiout.hp_nid = 0x18;
3435 spec->mixer = stac92hd73xx_8ch_mixer;
3436 spec->init = stac92hd73xx_8ch_core_init;
3438 case 0x5: /* 10 Channel */
3439 spec->multiout.hp_nid = 0x19;
3440 spec->mixer = stac92hd73xx_10ch_mixer;
3441 spec->init = stac92hd73xx_10ch_core_init;
3444 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
3445 spec->aloopback_mask = 0x01;
3446 spec->aloopback_shift = 8;
3448 spec->mux_nids = stac92hd73xx_mux_nids;
3449 spec->adc_nids = stac92hd73xx_adc_nids;
3450 spec->dmic_nids = stac92hd73xx_dmic_nids;
3451 spec->dmux_nids = stac92hd73xx_dmux_nids;
3453 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
3454 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
3455 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3456 spec->dinput_mux = &stac92hd73xx_dmux;
3457 /* GPIO0 High = Enable EAPD */
3458 spec->gpio_mask = spec->gpio_dir = 0x1;
3459 spec->gpio_data = 0x01;
3461 switch (spec->board_config) {
3463 spec->init = dell_m6_core_init;
3464 switch (codec->subsystem_id) {
3465 case 0x1028025e: /* Analog Mics */
3467 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3468 spec->num_dmics = 0;
3470 case 0x10280254: /* Digital Mics */
3474 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3475 spec->num_dmics = 1;
3477 case 0x10280256: /* Both */
3479 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3480 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3481 spec->num_dmics = 1;
3486 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
3489 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3490 spec->pwr_nids = stac92hd73xx_pwr_nids;
3492 err = stac92xx_parse_auto_config(codec, 0x22, 0x24);
3495 if (spec->board_config < 0) {
3496 printk(KERN_WARNING "hda_codec: No auto-config is "
3497 "available, default to model=ref\n");
3498 spec->board_config = STAC_92HD73XX_REF;
3505 stac92xx_free(codec);
3509 codec->patch_ops = stac92xx_patch_ops;
3514 static int patch_stac92hd71bxx(struct hda_codec *codec)
3516 struct sigmatel_spec *spec;
3519 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3524 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
3525 spec->pin_nids = stac92hd71bxx_pin_nids;
3526 spec->board_config = snd_hda_check_board_config(codec,
3527 STAC_92HD71BXX_MODELS,
3528 stac92hd71bxx_models,
3529 stac92hd71bxx_cfg_tbl);
3531 if (spec->board_config < 0) {
3532 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3533 " STAC92HD71BXX, using BIOS defaults\n");
3534 err = stac92xx_save_bios_config_regs(codec);
3536 stac92xx_free(codec);
3539 spec->pin_configs = spec->bios_pin_configs;
3541 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
3542 stac92xx_set_config_regs(codec);
3545 switch (codec->vendor_id) {
3546 case 0x111d76b6: /* 4 Port without Analog Mixer */
3548 case 0x111d76b4: /* 6 Port without Analog Mixer */
3550 spec->mixer = stac92hd71bxx_mixer;
3551 spec->init = stac92hd71bxx_core_init;
3554 spec->mixer = stac92hd71bxx_analog_mixer;
3555 spec->init = stac92hd71bxx_analog_core_init;
3558 spec->aloopback_mask = 0x20;
3559 spec->aloopback_shift = 0;
3561 /* GPIO0 High = EAPD */
3562 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1;
3564 spec->mux_nids = stac92hd71bxx_mux_nids;
3565 spec->adc_nids = stac92hd71bxx_adc_nids;
3566 spec->dmic_nids = stac92hd71bxx_dmic_nids;
3567 spec->dmux_nids = stac92hd71bxx_dmux_nids;
3569 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
3570 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
3571 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
3572 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
3574 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
3575 spec->pwr_nids = stac92hd71bxx_pwr_nids;
3577 spec->multiout.num_dacs = 1;
3578 spec->multiout.hp_nid = 0x11;
3579 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
3581 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
3583 if (spec->board_config < 0) {
3584 printk(KERN_WARNING "hda_codec: No auto-config is "
3585 "available, default to model=ref\n");
3586 spec->board_config = STAC_92HD71BXX_REF;
3593 stac92xx_free(codec);
3597 codec->patch_ops = stac92xx_patch_ops;
3602 static int patch_stac922x(struct hda_codec *codec)
3604 struct sigmatel_spec *spec;
3607 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3612 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
3613 spec->pin_nids = stac922x_pin_nids;
3614 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
3617 if (spec->board_config == STAC_INTEL_MAC_V3) {
3618 spec->gpio_mask = spec->gpio_dir = 0x03;
3619 spec->gpio_data = 0x03;
3620 /* Intel Macs have all same PCI SSID, so we need to check
3621 * codec SSID to distinguish the exact models
3623 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
3624 switch (codec->subsystem_id) {
3627 spec->board_config = STAC_INTEL_MAC_V1;
3631 spec->board_config = STAC_INTEL_MAC_V2;
3639 spec->board_config = STAC_INTEL_MAC_V3;
3643 spec->board_config = STAC_INTEL_MAC_V4;
3647 spec->board_config = STAC_INTEL_MAC_V5;
3653 if (spec->board_config < 0) {
3654 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
3655 "using BIOS defaults\n");
3656 err = stac92xx_save_bios_config_regs(codec);
3658 stac92xx_free(codec);
3661 spec->pin_configs = spec->bios_pin_configs;
3662 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
3663 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
3664 stac92xx_set_config_regs(codec);
3667 spec->adc_nids = stac922x_adc_nids;
3668 spec->mux_nids = stac922x_mux_nids;
3669 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
3670 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
3671 spec->num_dmics = 0;
3674 spec->init = stac922x_core_init;
3675 spec->mixer = stac922x_mixer;
3677 spec->multiout.dac_nids = spec->dac_nids;
3679 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
3681 if (spec->board_config < 0) {
3682 printk(KERN_WARNING "hda_codec: No auto-config is "
3683 "available, default to model=ref\n");
3684 spec->board_config = STAC_D945_REF;
3690 stac92xx_free(codec);
3694 codec->patch_ops = stac92xx_patch_ops;
3696 /* Fix Mux capture level; max to 2 */
3697 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
3698 (0 << AC_AMPCAP_OFFSET_SHIFT) |
3699 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
3700 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3701 (0 << AC_AMPCAP_MUTE_SHIFT));
3706 static int patch_stac927x(struct hda_codec *codec)
3708 struct sigmatel_spec *spec;
3711 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3716 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
3717 spec->pin_nids = stac927x_pin_nids;
3718 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
3722 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
3723 if (spec->board_config < 0)
3724 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3725 "STAC927x, using BIOS defaults\n");
3726 err = stac92xx_save_bios_config_regs(codec);
3728 stac92xx_free(codec);
3731 spec->pin_configs = spec->bios_pin_configs;
3733 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
3734 stac92xx_set_config_regs(codec);
3737 spec->adc_nids = stac927x_adc_nids;
3738 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
3739 spec->mux_nids = stac927x_mux_nids;
3740 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
3741 spec->dac_list = stac927x_dac_nids;
3742 spec->multiout.dac_nids = spec->dac_nids;
3744 switch (spec->board_config) {
3747 /* GPIO0 High = Enable EAPD */
3748 spec->gpio_mask = spec->gpio_dir = 0x01;
3749 spec->gpio_data = 0x01;
3750 spec->num_dmics = 0;
3752 spec->init = d965_core_init;
3753 spec->mixer = stac927x_mixer;
3755 case STAC_DELL_BIOS:
3756 /* configure the analog microphone on some laptops */
3757 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130);
3758 /* correct the front output jack as a hp out */
3759 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f);
3760 /* correct the front input jack as a mic */
3761 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
3764 /* GPIO2 High = Enable EAPD */
3765 spec->gpio_mask = spec->gpio_dir = 0x04;
3766 spec->gpio_data = 0x04;
3767 spec->dmic_nids = stac927x_dmic_nids;
3768 spec->num_dmics = STAC927X_NUM_DMICS;
3770 spec->init = d965_core_init;
3771 spec->mixer = stac927x_mixer;
3772 spec->dmux_nids = stac927x_dmux_nids;
3773 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
3776 /* GPIO0 High = Enable EAPD */
3777 spec->gpio_mask = spec->gpio_dir = 0x1;
3778 spec->gpio_data = 0x01;
3779 spec->num_dmics = 0;
3781 spec->init = stac927x_core_init;
3782 spec->mixer = stac927x_mixer;
3786 spec->aloopback_mask = 0x40;
3787 spec->aloopback_shift = 0;
3789 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
3791 if (spec->board_config < 0) {
3792 printk(KERN_WARNING "hda_codec: No auto-config is "
3793 "available, default to model=ref\n");
3794 spec->board_config = STAC_D965_REF;
3800 stac92xx_free(codec);
3804 codec->patch_ops = stac92xx_patch_ops;
3808 * The STAC927x seem to require fairly long delays for certain
3809 * command sequences. With too short delays (even if the answer
3810 * is set to RIRB properly), it results in the silence output
3811 * on some hardwares like Dell.
3813 * The below flag enables the longer delay (see get_response
3816 codec->bus->needs_damn_long_delay = 1;
3821 static int patch_stac9205(struct hda_codec *codec)
3823 struct sigmatel_spec *spec;
3826 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3831 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
3832 spec->pin_nids = stac9205_pin_nids;
3833 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
3837 if (spec->board_config < 0) {
3838 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
3839 err = stac92xx_save_bios_config_regs(codec);
3841 stac92xx_free(codec);
3844 spec->pin_configs = spec->bios_pin_configs;
3846 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
3847 stac92xx_set_config_regs(codec);
3850 spec->adc_nids = stac9205_adc_nids;
3851 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
3852 spec->mux_nids = stac9205_mux_nids;
3853 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
3854 spec->dmic_nids = stac9205_dmic_nids;
3855 spec->num_dmics = STAC9205_NUM_DMICS;
3856 spec->dmux_nids = stac9205_dmux_nids;
3857 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
3860 spec->init = stac9205_core_init;
3861 spec->mixer = stac9205_mixer;
3863 spec->aloopback_mask = 0x40;
3864 spec->aloopback_shift = 0;
3865 spec->multiout.dac_nids = spec->dac_nids;
3867 switch (spec->board_config){
3868 case STAC_9205_DELL_M43:
3869 /* Enable SPDIF in/out */
3870 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
3871 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
3873 /* Enable unsol response for GPIO4/Dock HP connection */
3874 snd_hda_codec_write(codec, codec->afg, 0,
3875 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
3876 snd_hda_codec_write_cache(codec, codec->afg, 0,
3877 AC_VERB_SET_UNSOLICITED_ENABLE,
3878 (AC_USRSP_EN | STAC_HP_EVENT));
3880 spec->gpio_dir = 0x0b;
3881 spec->gpio_mask = 0x1b;
3882 spec->gpio_mute = 0x10;
3883 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3886 spec->gpio_data = 0x01;
3889 /* GPIO0 High = EAPD */
3890 spec->gpio_mask = spec->gpio_dir = 0x1;
3891 spec->gpio_data = 0x01;
3895 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
3897 if (spec->board_config < 0) {
3898 printk(KERN_WARNING "hda_codec: No auto-config is "
3899 "available, default to model=ref\n");
3900 spec->board_config = STAC_9205_REF;
3906 stac92xx_free(codec);
3910 codec->patch_ops = stac92xx_patch_ops;
3919 /* static config for Sony VAIO FE550G and Sony VAIO AR */
3920 static hda_nid_t vaio_dacs[] = { 0x2 };
3921 #define VAIO_HP_DAC 0x5
3922 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
3923 static hda_nid_t vaio_mux_nids[] = { 0x15 };
3925 static struct hda_input_mux vaio_mux = {
3928 /* { "HP", 0x0 }, */
3929 { "Mic Jack", 0x1 },
3930 { "Internal Mic", 0x2 },
3935 static struct hda_verb vaio_init[] = {
3936 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3937 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
3938 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3939 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3940 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3943 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3944 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3945 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
3951 static struct hda_verb vaio_ar_init[] = {
3952 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3953 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3954 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3955 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3956 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
3957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3958 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3959 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3960 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3961 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
3962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3963 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
3968 /* bind volumes of both NID 0x02 and 0x05 */
3969 static struct hda_bind_ctls vaio_bind_master_vol = {
3970 .ops = &snd_hda_bind_vol,
3972 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
3973 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
3978 /* bind volumes of both NID 0x02 and 0x05 */
3979 static struct hda_bind_ctls vaio_bind_master_sw = {
3980 .ops = &snd_hda_bind_sw,
3982 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
3983 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
3988 static struct snd_kcontrol_new vaio_mixer[] = {
3989 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
3990 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
3991 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
3992 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
3993 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
3995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3996 .name = "Capture Source",
3998 .info = stac92xx_mux_enum_info,
3999 .get = stac92xx_mux_enum_get,
4000 .put = stac92xx_mux_enum_put,
4005 static struct snd_kcontrol_new vaio_ar_mixer[] = {
4006 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4007 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4008 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4009 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4010 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4011 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4012 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4015 .name = "Capture Source",
4017 .info = stac92xx_mux_enum_info,
4018 .get = stac92xx_mux_enum_get,
4019 .put = stac92xx_mux_enum_put,
4024 static struct hda_codec_ops stac9872_patch_ops = {
4025 .build_controls = stac92xx_build_controls,
4026 .build_pcms = stac92xx_build_pcms,
4027 .init = stac92xx_init,
4028 .free = stac92xx_free,
4029 #ifdef SND_HDA_NEEDS_RESUME
4030 .resume = stac92xx_resume,
4034 static int stac9872_vaio_init(struct hda_codec *codec)
4038 err = stac92xx_init(codec);
4041 if (codec->patch_ops.unsol_event)
4042 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
4046 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
4048 if (get_hp_pin_presence(codec, 0x0a)) {
4049 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4050 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4052 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4053 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4057 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
4059 switch (res >> 26) {
4061 stac9872_vaio_hp_detect(codec, res);
4066 static struct hda_codec_ops stac9872_vaio_patch_ops = {
4067 .build_controls = stac92xx_build_controls,
4068 .build_pcms = stac92xx_build_pcms,
4069 .init = stac9872_vaio_init,
4070 .free = stac92xx_free,
4071 .unsol_event = stac9872_vaio_unsol_event,
4073 .resume = stac92xx_resume,
4077 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4079 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4081 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4083 /* AR Series. id=0x83847664 and subsys=104D1300 */
4088 static const char *stac9872_models[STAC_9872_MODELS] = {
4089 [CXD9872RD_VAIO] = "vaio",
4090 [CXD9872AKD_VAIO] = "vaio-ar",
4093 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
4094 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
4095 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
4096 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
4097 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
4101 static int patch_stac9872(struct hda_codec *codec)
4103 struct sigmatel_spec *spec;
4106 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
4109 if (board_config < 0)
4110 /* unknown config, let generic-parser do its job... */
4111 return snd_hda_parse_generic_codec(codec);
4113 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4118 switch (board_config) {
4119 case CXD9872RD_VAIO:
4120 case STAC9872AK_VAIO:
4121 case STAC9872K_VAIO:
4122 spec->mixer = vaio_mixer;
4123 spec->init = vaio_init;
4124 spec->multiout.max_channels = 2;
4125 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4126 spec->multiout.dac_nids = vaio_dacs;
4127 spec->multiout.hp_nid = VAIO_HP_DAC;
4128 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4129 spec->adc_nids = vaio_adcs;
4131 spec->input_mux = &vaio_mux;
4132 spec->mux_nids = vaio_mux_nids;
4133 codec->patch_ops = stac9872_vaio_patch_ops;
4136 case CXD9872AKD_VAIO:
4137 spec->mixer = vaio_ar_mixer;
4138 spec->init = vaio_ar_init;
4139 spec->multiout.max_channels = 2;
4140 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4141 spec->multiout.dac_nids = vaio_dacs;
4142 spec->multiout.hp_nid = VAIO_HP_DAC;
4143 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4145 spec->adc_nids = vaio_adcs;
4146 spec->input_mux = &vaio_mux;
4147 spec->mux_nids = vaio_mux_nids;
4148 codec->patch_ops = stac9872_patch_ops;
4159 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
4160 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4161 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4162 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4163 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4164 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4165 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4166 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
4167 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4168 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4169 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4170 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4171 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4172 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
4173 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4174 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4175 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4176 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4177 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4178 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4179 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4180 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4181 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4182 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
4183 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4184 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4185 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4186 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4187 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4188 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
4189 /* The following does not take into account .id=0x83847661 when subsys =
4190 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4191 * currently not fully supported.
4193 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4194 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4195 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
4196 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4197 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4198 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4199 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4200 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4201 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4202 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4203 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
4204 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4205 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
4206 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4207 { .id = 0x111d7608, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },
4208 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4209 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4210 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4211 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4212 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4213 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4214 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4215 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },