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 stac92hd73xx_8ch_core_init[] = {
538 /* set master volume and direct control */
539 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
540 /* setup audio connections */
541 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
542 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
543 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
544 /* connect hp ports to dac3 */
545 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
546 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
547 /* setup adcs to point to mixer */
548 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
549 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
550 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
551 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
552 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
553 /* setup import muxs */
554 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
555 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
556 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
557 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
561 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
562 /* set master volume and direct control */
563 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
564 /* setup audio connections */
565 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
566 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
567 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
568 /* dac3 is connected to import3 mux */
569 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
570 /* connect hp ports to dac4 */
571 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
572 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
573 /* setup adcs to point to mixer */
574 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
575 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
576 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
577 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
578 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
579 /* setup import muxs */
580 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
581 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
582 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
583 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
587 static struct hda_verb stac92hd71bxx_core_init[] = {
588 /* set master volume and direct control */
589 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
590 /* connect headphone jack to dac1 */
591 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
592 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
593 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
594 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
595 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
596 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
599 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
600 /* set master volume and direct control */
601 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
602 /* connect headphone jack to dac1 */
603 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
604 /* connect ports 0d and 0f to audio mixer */
605 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
606 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
607 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
608 /* unmute dac0 input in audio mixer */
609 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
610 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
611 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
612 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
613 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
617 static struct hda_verb stac925x_core_init[] = {
618 /* set dac0mux for dac converter */
619 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
623 static struct hda_verb stac922x_core_init[] = {
624 /* set master volume and direct control */
625 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
629 static struct hda_verb d965_core_init[] = {
630 /* set master volume and direct control */
631 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
632 /* unmute node 0x1b */
633 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
634 /* select node 0x03 as DAC */
635 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
639 static struct hda_verb stac927x_core_init[] = {
640 /* set master volume and direct control */
641 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
645 static struct hda_verb stac9205_core_init[] = {
646 /* set master volume and direct control */
647 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
651 #define STAC_MONO_MUX \
653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
654 .name = "Mono Mux", \
656 .info = stac92xx_mono_mux_enum_info, \
657 .get = stac92xx_mono_mux_enum_get, \
658 .put = stac92xx_mono_mux_enum_put, \
661 #define STAC_INPUT_SOURCE(cnt) \
663 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
664 .name = "Input Source", \
666 .info = stac92xx_mux_enum_info, \
667 .get = stac92xx_mux_enum_get, \
668 .put = stac92xx_mux_enum_put, \
671 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
673 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
674 .name = "Analog Loopback", \
676 .info = stac92xx_aloopback_info, \
677 .get = stac92xx_aloopback_get, \
678 .put = stac92xx_aloopback_put, \
679 .private_value = verb_read | (verb_write << 16), \
682 static struct snd_kcontrol_new stac9200_mixer[] = {
683 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
684 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
685 STAC_INPUT_SOURCE(1),
686 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
687 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
688 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
692 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
693 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
695 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
696 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
698 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
699 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
701 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
702 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
704 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
705 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
707 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
708 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
710 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
711 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
713 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
714 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
718 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
719 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
721 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
722 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
724 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
725 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
727 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
728 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
730 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
731 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
733 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
734 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
736 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
737 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
739 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
740 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
744 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
745 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
747 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
748 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
750 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
751 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
753 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
754 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
756 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
757 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
759 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
760 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
762 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
763 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
765 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
766 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
770 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
771 STAC_INPUT_SOURCE(2),
773 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
774 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
775 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
777 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
778 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
779 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
781 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
782 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
786 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
787 STAC_INPUT_SOURCE(2),
788 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
790 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
791 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
792 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
794 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
795 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
796 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
800 static struct snd_kcontrol_new stac925x_mixer[] = {
801 STAC_INPUT_SOURCE(1),
802 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
803 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
804 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
808 static struct snd_kcontrol_new stac9205_mixer[] = {
809 STAC_INPUT_SOURCE(2),
810 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
812 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
813 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
814 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
816 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
817 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
818 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
823 /* This needs to be generated dynamically based on sequence */
824 static struct snd_kcontrol_new stac922x_mixer[] = {
825 STAC_INPUT_SOURCE(2),
826 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
827 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
828 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
830 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
831 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
832 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
837 static struct snd_kcontrol_new stac927x_mixer[] = {
838 STAC_INPUT_SOURCE(3),
839 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
841 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
842 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
843 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
845 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
846 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
847 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
849 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
850 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
851 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
855 static struct snd_kcontrol_new stac_dmux_mixer = {
856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
857 .name = "Digital Input Source",
858 /* count set later */
859 .info = stac92xx_dmux_enum_info,
860 .get = stac92xx_dmux_enum_get,
861 .put = stac92xx_dmux_enum_put,
864 static const char *slave_vols[] = {
865 "Front Playback Volume",
866 "Surround Playback Volume",
867 "Center Playback Volume",
868 "LFE Playback Volume",
869 "Side Playback Volume",
870 "Headphone Playback Volume",
871 "Headphone Playback Volume",
872 "Speaker Playback Volume",
873 "External Speaker Playback Volume",
874 "Speaker2 Playback Volume",
878 static const char *slave_sws[] = {
879 "Front Playback Switch",
880 "Surround Playback Switch",
881 "Center Playback Switch",
882 "LFE Playback Switch",
883 "Side Playback Switch",
884 "Headphone Playback Switch",
885 "Headphone Playback Switch",
886 "Speaker Playback Switch",
887 "External Speaker Playback Switch",
888 "Speaker2 Playback Switch",
889 "IEC958 Playback Switch",
893 static int stac92xx_build_controls(struct hda_codec *codec)
895 struct sigmatel_spec *spec = codec->spec;
899 err = snd_hda_add_new_ctls(codec, spec->mixer);
903 for (i = 0; i < spec->num_mixers; i++) {
904 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
908 if (spec->num_dmuxes > 0) {
909 stac_dmux_mixer.count = spec->num_dmuxes;
910 err = snd_ctl_add(codec->bus->card,
911 snd_ctl_new1(&stac_dmux_mixer, codec));
916 if (spec->multiout.dig_out_nid) {
917 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
920 err = snd_hda_create_spdif_share_sw(codec,
924 spec->multiout.share_spdif = 1;
926 if (spec->dig_in_nid) {
927 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
932 /* if we have no master control, let's create it */
933 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
934 unsigned int vmaster_tlv[4];
935 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
936 HDA_OUTPUT, vmaster_tlv);
937 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
938 vmaster_tlv, slave_vols);
942 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
943 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
952 static unsigned int ref9200_pin_configs[8] = {
953 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
954 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
958 STAC 9200 pin configs for
963 static unsigned int dell9200_d21_pin_configs[8] = {
964 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
965 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
969 STAC 9200 pin configs for
973 static unsigned int dell9200_d22_pin_configs[8] = {
974 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
975 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
979 STAC 9200 pin configs for
980 102801C4 (Dell Dimension E310)
987 static unsigned int dell9200_d23_pin_configs[8] = {
988 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
989 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
994 STAC 9200-32 pin configs for
995 102801B5 (Dell Inspiron 630m)
996 102801D8 (Dell Inspiron 640m)
998 static unsigned int dell9200_m21_pin_configs[8] = {
999 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1000 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1004 STAC 9200-32 pin configs for
1005 102801C2 (Dell Latitude D620)
1007 102801CC (Dell Latitude D820)
1011 static unsigned int dell9200_m22_pin_configs[8] = {
1012 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1013 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1017 STAC 9200-32 pin configs for
1018 102801CE (Dell XPS M1710)
1019 102801CF (Dell Precision M90)
1021 static unsigned int dell9200_m23_pin_configs[8] = {
1022 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1023 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1027 STAC 9200-32 pin configs for
1030 102801CB (Dell Latitude 120L)
1033 static unsigned int dell9200_m24_pin_configs[8] = {
1034 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1035 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1039 STAC 9200-32 pin configs for
1040 102801BD (Dell Inspiron E1505n)
1044 static unsigned int dell9200_m25_pin_configs[8] = {
1045 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1046 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1050 STAC 9200-32 pin configs for
1051 102801F5 (Dell Inspiron 1501)
1054 static unsigned int dell9200_m26_pin_configs[8] = {
1055 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1056 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1061 102801CD (Dell Inspiron E1705/9400)
1063 static unsigned int dell9200_m27_pin_configs[8] = {
1064 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1065 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1068 static unsigned int oqo9200_pin_configs[8] = {
1069 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1070 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1074 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1075 [STAC_REF] = ref9200_pin_configs,
1076 [STAC_9200_OQO] = oqo9200_pin_configs,
1077 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1078 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1079 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1080 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1081 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1082 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1083 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1084 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1085 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1086 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1089 static const char *stac9200_models[STAC_9200_MODELS] = {
1091 [STAC_9200_OQO] = "oqo",
1092 [STAC_9200_DELL_D21] = "dell-d21",
1093 [STAC_9200_DELL_D22] = "dell-d22",
1094 [STAC_9200_DELL_D23] = "dell-d23",
1095 [STAC_9200_DELL_M21] = "dell-m21",
1096 [STAC_9200_DELL_M22] = "dell-m22",
1097 [STAC_9200_DELL_M23] = "dell-m23",
1098 [STAC_9200_DELL_M24] = "dell-m24",
1099 [STAC_9200_DELL_M25] = "dell-m25",
1100 [STAC_9200_DELL_M26] = "dell-m26",
1101 [STAC_9200_DELL_M27] = "dell-m27",
1102 [STAC_9200_GATEWAY] = "gateway",
1105 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1106 /* SigmaTel reference board */
1107 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1108 "DFI LanParty", STAC_REF),
1109 /* Dell laptops have BIOS problem */
1110 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1111 "unknown Dell", STAC_9200_DELL_D21),
1112 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1113 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1114 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1115 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1116 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1117 "unknown Dell", STAC_9200_DELL_D22),
1118 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1119 "unknown Dell", STAC_9200_DELL_D22),
1120 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1121 "Dell Latitude D620", STAC_9200_DELL_M22),
1122 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1123 "unknown Dell", STAC_9200_DELL_D23),
1124 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1125 "unknown Dell", STAC_9200_DELL_D23),
1126 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1127 "unknown Dell", STAC_9200_DELL_M22),
1128 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1129 "unknown Dell", STAC_9200_DELL_M24),
1130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1131 "unknown Dell", STAC_9200_DELL_M24),
1132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1133 "Dell Latitude 120L", STAC_9200_DELL_M24),
1134 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1135 "Dell Latitude D820", STAC_9200_DELL_M22),
1136 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1137 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1138 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1139 "Dell XPS M1710", STAC_9200_DELL_M23),
1140 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1141 "Dell Precision M90", STAC_9200_DELL_M23),
1142 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1143 "unknown Dell", STAC_9200_DELL_M22),
1144 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1145 "unknown Dell", STAC_9200_DELL_M22),
1146 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1147 "unknown Dell", STAC_9200_DELL_M22),
1148 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1149 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1150 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1151 "unknown Dell", STAC_9200_DELL_D23),
1152 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1153 "unknown Dell", STAC_9200_DELL_D23),
1154 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1155 "unknown Dell", STAC_9200_DELL_D21),
1156 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1157 "unknown Dell", STAC_9200_DELL_D23),
1158 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1159 "unknown Dell", STAC_9200_DELL_D21),
1160 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1161 "unknown Dell", STAC_9200_DELL_M25),
1162 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1163 "unknown Dell", STAC_9200_DELL_M25),
1164 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1165 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1166 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1167 "unknown Dell", STAC_9200_DELL_M26),
1169 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
1170 /* Gateway machines needs EAPD to be set on resume */
1171 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1172 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1174 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1177 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1181 static unsigned int ref925x_pin_configs[8] = {
1182 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1183 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1186 static unsigned int stac925x_MA6_pin_configs[8] = {
1187 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1188 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1191 static unsigned int stac925x_PA6_pin_configs[8] = {
1192 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1193 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1196 static unsigned int stac925xM2_2_pin_configs[8] = {
1197 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1198 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1201 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1202 [STAC_REF] = ref925x_pin_configs,
1203 [STAC_M2_2] = stac925xM2_2_pin_configs,
1204 [STAC_MA6] = stac925x_MA6_pin_configs,
1205 [STAC_PA6] = stac925x_PA6_pin_configs,
1208 static const char *stac925x_models[STAC_925x_MODELS] = {
1210 [STAC_M2_2] = "m2-2",
1215 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1216 /* SigmaTel reference board */
1217 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1218 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1219 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1220 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1221 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1222 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1223 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1227 static unsigned int ref92hd73xx_pin_configs[13] = {
1228 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1229 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1230 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1234 static unsigned int dell_m6_pin_configs[13] = {
1235 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1236 0x03a11020, 0x03011050, 0x4f0000f0, 0x4f0000f0,
1237 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1241 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1242 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1243 [STAC_DELL_M6] = dell_m6_pin_configs,
1246 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1247 [STAC_92HD73XX_REF] = "ref",
1248 [STAC_DELL_M6] = "dell-m6",
1251 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1252 /* SigmaTel reference board */
1253 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1254 "DFI LanParty", STAC_92HD73XX_REF),
1255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1256 "unknown Dell", STAC_DELL_M6),
1257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1258 "unknown Dell", STAC_DELL_M6),
1259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1260 "unknown Dell", STAC_DELL_M6),
1261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1262 "unknown Dell", STAC_DELL_M6),
1263 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1264 "unknown Dell", STAC_DELL_M6),
1265 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1266 "unknown Dell", STAC_DELL_M6),
1267 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1268 "unknown Dell", STAC_DELL_M6),
1272 static unsigned int ref92hd71bxx_pin_configs[10] = {
1273 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1274 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1275 0x90a000f0, 0x01452050,
1278 static unsigned int dell_m4_1_pin_configs[13] = {
1279 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1280 0x23a1902e, 0x23014250, 0x40f000f0, 0x4f0000f0,
1281 0x40f000f0, 0x4f0000f0,
1284 static unsigned int dell_m4_2_pin_configs[13] = {
1285 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1286 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1287 0x40f000f0, 0x044413b0,
1290 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1291 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1292 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1293 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1296 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1297 [STAC_92HD71BXX_REF] = "ref",
1298 [STAC_DELL_M4_1] = "dell-m4-1",
1299 [STAC_DELL_M4_2] = "dell-m4-2",
1302 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1303 /* SigmaTel reference board */
1304 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1305 "DFI LanParty", STAC_92HD71BXX_REF),
1306 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1307 "unknown Dell", STAC_DELL_M4_1),
1308 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1309 "unknown Dell", STAC_DELL_M4_1),
1310 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1311 "unknown Dell", STAC_DELL_M4_1),
1312 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1313 "unknown Dell", STAC_DELL_M4_1),
1314 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1315 "unknown Dell", STAC_DELL_M4_1),
1316 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1317 "unknown Dell", STAC_DELL_M4_1),
1318 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1319 "unknown Dell", STAC_DELL_M4_1),
1320 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1321 "unknown Dell", STAC_DELL_M4_2),
1322 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1323 "unknown Dell", STAC_DELL_M4_2),
1324 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1325 "unknown Dell", STAC_DELL_M4_2),
1326 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1327 "unknown Dell", STAC_DELL_M4_2),
1331 static unsigned int ref922x_pin_configs[10] = {
1332 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1333 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1334 0x40000100, 0x40000100,
1338 STAC 922X pin configs for
1345 static unsigned int dell_922x_d81_pin_configs[10] = {
1346 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1347 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1348 0x01813122, 0x400001f2,
1352 STAC 922X pin configs for
1356 static unsigned int dell_922x_d82_pin_configs[10] = {
1357 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1358 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1359 0x01813122, 0x400001f1,
1363 STAC 922X pin configs for
1366 static unsigned int dell_922x_m81_pin_configs[10] = {
1367 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1368 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1369 0x40C003f1, 0x405003f0,
1373 STAC 9221 A1 pin configs for
1374 102801D7 (Dell XPS M1210)
1376 static unsigned int dell_922x_m82_pin_configs[10] = {
1377 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1378 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1379 0x508003f3, 0x405003f4,
1382 static unsigned int d945gtp3_pin_configs[10] = {
1383 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1384 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1385 0x02a19120, 0x40000100,
1388 static unsigned int d945gtp5_pin_configs[10] = {
1389 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1390 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1391 0x02a19320, 0x40000100,
1394 static unsigned int intel_mac_v1_pin_configs[10] = {
1395 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1396 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1397 0x400000fc, 0x400000fb,
1400 static unsigned int intel_mac_v2_pin_configs[10] = {
1401 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1402 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1403 0x400000fc, 0x400000fb,
1406 static unsigned int intel_mac_v3_pin_configs[10] = {
1407 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1408 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1409 0x400000fc, 0x400000fb,
1412 static unsigned int intel_mac_v4_pin_configs[10] = {
1413 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1414 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1415 0x400000fc, 0x400000fb,
1418 static unsigned int intel_mac_v5_pin_configs[10] = {
1419 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1420 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1421 0x400000fc, 0x400000fb,
1425 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1426 [STAC_D945_REF] = ref922x_pin_configs,
1427 [STAC_D945GTP3] = d945gtp3_pin_configs,
1428 [STAC_D945GTP5] = d945gtp5_pin_configs,
1429 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1430 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1431 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1432 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1433 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1434 /* for backward compatibility */
1435 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1436 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1437 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1438 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1439 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1440 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1441 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1442 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1443 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1444 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1447 static const char *stac922x_models[STAC_922X_MODELS] = {
1448 [STAC_D945_REF] = "ref",
1449 [STAC_D945GTP5] = "5stack",
1450 [STAC_D945GTP3] = "3stack",
1451 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1452 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1453 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1454 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1455 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1456 /* for backward compatibility */
1457 [STAC_MACMINI] = "macmini",
1458 [STAC_MACBOOK] = "macbook",
1459 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1460 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1461 [STAC_IMAC_INTEL] = "imac-intel",
1462 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1463 [STAC_922X_DELL_D81] = "dell-d81",
1464 [STAC_922X_DELL_D82] = "dell-d82",
1465 [STAC_922X_DELL_M81] = "dell-m81",
1466 [STAC_922X_DELL_M82] = "dell-m82",
1469 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1470 /* SigmaTel reference board */
1471 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1472 "DFI LanParty", STAC_D945_REF),
1473 /* Intel 945G based systems */
1474 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1475 "Intel D945G", STAC_D945GTP3),
1476 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1477 "Intel D945G", STAC_D945GTP3),
1478 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1479 "Intel D945G", STAC_D945GTP3),
1480 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1481 "Intel D945G", STAC_D945GTP3),
1482 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1483 "Intel D945G", STAC_D945GTP3),
1484 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1485 "Intel D945G", STAC_D945GTP3),
1486 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1487 "Intel D945G", STAC_D945GTP3),
1488 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1489 "Intel D945G", STAC_D945GTP3),
1490 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1491 "Intel D945G", STAC_D945GTP3),
1492 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1493 "Intel D945G", STAC_D945GTP3),
1494 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1495 "Intel D945G", STAC_D945GTP3),
1496 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1497 "Intel D945G", STAC_D945GTP3),
1498 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1499 "Intel D945G", STAC_D945GTP3),
1500 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1501 "Intel D945G", STAC_D945GTP3),
1502 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1503 "Intel D945G", STAC_D945GTP3),
1504 /* Intel D945G 5-stack systems */
1505 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1506 "Intel D945G", STAC_D945GTP5),
1507 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1508 "Intel D945G", STAC_D945GTP5),
1509 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1510 "Intel D945G", STAC_D945GTP5),
1511 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1512 "Intel D945G", STAC_D945GTP5),
1513 /* Intel 945P based systems */
1514 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1515 "Intel D945P", STAC_D945GTP3),
1516 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1517 "Intel D945P", STAC_D945GTP3),
1518 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1519 "Intel D945P", STAC_D945GTP3),
1520 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1521 "Intel D945P", STAC_D945GTP3),
1522 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1523 "Intel D945P", STAC_D945GTP3),
1524 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
1525 "Intel D945P", STAC_D945GTP5),
1527 /* Apple Mac Mini (early 2006) */
1528 SND_PCI_QUIRK(0x8384, 0x7680,
1529 "Mac Mini", STAC_INTEL_MAC_V3),
1531 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
1532 "unknown Dell", STAC_922X_DELL_D81),
1533 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
1534 "unknown Dell", STAC_922X_DELL_D81),
1535 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
1536 "unknown Dell", STAC_922X_DELL_D81),
1537 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
1538 "unknown Dell", STAC_922X_DELL_D82),
1539 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
1540 "unknown Dell", STAC_922X_DELL_M81),
1541 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1542 "unknown Dell", STAC_922X_DELL_D82),
1543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1544 "unknown Dell", STAC_922X_DELL_D81),
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1546 "unknown Dell", STAC_922X_DELL_D81),
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1548 "Dell XPS M1210", STAC_922X_DELL_M82),
1552 static unsigned int ref927x_pin_configs[14] = {
1553 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1554 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1555 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1556 0x01c42190, 0x40000100,
1559 static unsigned int d965_3st_pin_configs[14] = {
1560 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1561 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1562 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1563 0x40000100, 0x40000100
1566 static unsigned int d965_5st_pin_configs[14] = {
1567 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1568 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1569 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1570 0x40000100, 0x40000100
1573 static unsigned int dell_3st_pin_configs[14] = {
1574 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1575 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1576 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1577 0x40c003fc, 0x40000100
1580 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1581 [STAC_D965_REF] = ref927x_pin_configs,
1582 [STAC_D965_3ST] = d965_3st_pin_configs,
1583 [STAC_D965_5ST] = d965_5st_pin_configs,
1584 [STAC_DELL_3ST] = dell_3st_pin_configs,
1585 [STAC_DELL_BIOS] = NULL,
1588 static const char *stac927x_models[STAC_927X_MODELS] = {
1589 [STAC_D965_REF] = "ref",
1590 [STAC_D965_3ST] = "3stack",
1591 [STAC_D965_5ST] = "5stack",
1592 [STAC_DELL_3ST] = "dell-3stack",
1593 [STAC_DELL_BIOS] = "dell-bios",
1596 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1597 /* SigmaTel reference board */
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1599 "DFI LanParty", STAC_D965_REF),
1600 /* Intel 946 based systems */
1601 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1603 /* 965 based 3 stack systems */
1604 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1605 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1606 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1607 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1609 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1610 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1611 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1612 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1613 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1614 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1615 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1616 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1617 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1618 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1619 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1620 /* Dell 3 stack systems */
1621 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
1622 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1624 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1625 /* Dell 3 stack systems with verb table in BIOS */
1626 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1627 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1628 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS),
1629 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1631 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1632 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
1633 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
1634 /* 965 based 5 stack systems */
1635 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1636 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1637 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1638 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1639 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1640 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1641 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1642 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1643 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1647 static unsigned int ref9205_pin_configs[12] = {
1648 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1649 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1650 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1654 STAC 9205 pin configs for
1661 10280228 (Dell Vostro 1500)
1663 static unsigned int dell_9205_m42_pin_configs[12] = {
1664 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1665 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1666 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1670 STAC 9205 pin configs for
1674 102801FF (Dell Precision M4300)
1679 static unsigned int dell_9205_m43_pin_configs[12] = {
1680 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1681 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1682 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1685 static unsigned int dell_9205_m44_pin_configs[12] = {
1686 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1687 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1688 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1691 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1692 [STAC_9205_REF] = ref9205_pin_configs,
1693 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1694 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1695 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1698 static const char *stac9205_models[STAC_9205_MODELS] = {
1699 [STAC_9205_REF] = "ref",
1700 [STAC_9205_DELL_M42] = "dell-m42",
1701 [STAC_9205_DELL_M43] = "dell-m43",
1702 [STAC_9205_DELL_M44] = "dell-m44",
1705 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1706 /* SigmaTel reference board */
1707 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1708 "DFI LanParty", STAC_9205_REF),
1709 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1710 "unknown Dell", STAC_9205_DELL_M42),
1711 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1712 "unknown Dell", STAC_9205_DELL_M42),
1713 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1714 "Dell Precision", STAC_9205_DELL_M43),
1715 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1716 "Dell Precision", STAC_9205_DELL_M43),
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1718 "Dell Precision", STAC_9205_DELL_M43),
1719 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1720 "Dell Precision", STAC_9205_DELL_M43),
1721 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1722 "Dell Precision", STAC_9205_DELL_M43),
1723 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1724 "unknown Dell", STAC_9205_DELL_M42),
1725 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1726 "unknown Dell", STAC_9205_DELL_M42),
1727 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1728 "Dell Precision", STAC_9205_DELL_M43),
1729 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1730 "Dell Precision M4300", STAC_9205_DELL_M43),
1731 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1732 "Dell Precision", STAC_9205_DELL_M43),
1733 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1734 "Dell Inspiron", STAC_9205_DELL_M44),
1735 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1736 "Dell Inspiron", STAC_9205_DELL_M44),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1738 "Dell Inspiron", STAC_9205_DELL_M44),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1740 "Dell Inspiron", STAC_9205_DELL_M44),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1742 "unknown Dell", STAC_9205_DELL_M42),
1743 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1744 "Dell Inspiron", STAC_9205_DELL_M44),
1745 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
1746 "Dell Vostro 1500", STAC_9205_DELL_M42),
1750 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
1753 struct sigmatel_spec *spec = codec->spec;
1755 if (! spec->bios_pin_configs) {
1756 spec->bios_pin_configs = kcalloc(spec->num_pins,
1757 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
1758 if (! spec->bios_pin_configs)
1762 for (i = 0; i < spec->num_pins; i++) {
1763 hda_nid_t nid = spec->pin_nids[i];
1764 unsigned int pin_cfg;
1766 pin_cfg = snd_hda_codec_read(codec, nid, 0,
1767 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
1768 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1770 spec->bios_pin_configs[i] = pin_cfg;
1776 static void stac92xx_set_config_reg(struct hda_codec *codec,
1777 hda_nid_t pin_nid, unsigned int pin_config)
1780 snd_hda_codec_write(codec, pin_nid, 0,
1781 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
1782 pin_config & 0x000000ff);
1783 snd_hda_codec_write(codec, pin_nid, 0,
1784 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
1785 (pin_config & 0x0000ff00) >> 8);
1786 snd_hda_codec_write(codec, pin_nid, 0,
1787 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
1788 (pin_config & 0x00ff0000) >> 16);
1789 snd_hda_codec_write(codec, pin_nid, 0,
1790 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
1792 i = snd_hda_codec_read(codec, pin_nid, 0,
1793 AC_VERB_GET_CONFIG_DEFAULT,
1795 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
1799 static void stac92xx_set_config_regs(struct hda_codec *codec)
1802 struct sigmatel_spec *spec = codec->spec;
1804 if (!spec->pin_configs)
1807 for (i = 0; i < spec->num_pins; i++)
1808 stac92xx_set_config_reg(codec, spec->pin_nids[i],
1809 spec->pin_configs[i]);
1813 * Analog playback callbacks
1815 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
1816 struct hda_codec *codec,
1817 struct snd_pcm_substream *substream)
1819 struct sigmatel_spec *spec = codec->spec;
1820 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
1824 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1825 struct hda_codec *codec,
1826 unsigned int stream_tag,
1827 unsigned int format,
1828 struct snd_pcm_substream *substream)
1830 struct sigmatel_spec *spec = codec->spec;
1831 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
1834 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1835 struct hda_codec *codec,
1836 struct snd_pcm_substream *substream)
1838 struct sigmatel_spec *spec = codec->spec;
1839 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
1843 * Digital playback callbacks
1845 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
1846 struct hda_codec *codec,
1847 struct snd_pcm_substream *substream)
1849 struct sigmatel_spec *spec = codec->spec;
1850 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
1853 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
1854 struct hda_codec *codec,
1855 struct snd_pcm_substream *substream)
1857 struct sigmatel_spec *spec = codec->spec;
1858 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
1861 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1862 struct hda_codec *codec,
1863 unsigned int stream_tag,
1864 unsigned int format,
1865 struct snd_pcm_substream *substream)
1867 struct sigmatel_spec *spec = codec->spec;
1868 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
1869 stream_tag, format, substream);
1874 * Analog capture callbacks
1876 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
1877 struct hda_codec *codec,
1878 unsigned int stream_tag,
1879 unsigned int format,
1880 struct snd_pcm_substream *substream)
1882 struct sigmatel_spec *spec = codec->spec;
1884 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
1885 stream_tag, 0, format);
1889 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1890 struct hda_codec *codec,
1891 struct snd_pcm_substream *substream)
1893 struct sigmatel_spec *spec = codec->spec;
1895 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);
1899 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
1903 /* NID is set in stac92xx_build_pcms */
1905 .open = stac92xx_dig_playback_pcm_open,
1906 .close = stac92xx_dig_playback_pcm_close,
1907 .prepare = stac92xx_dig_playback_pcm_prepare
1911 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
1915 /* NID is set in stac92xx_build_pcms */
1918 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
1922 .nid = 0x02, /* NID to query formats and rates */
1924 .open = stac92xx_playback_pcm_open,
1925 .prepare = stac92xx_playback_pcm_prepare,
1926 .cleanup = stac92xx_playback_pcm_cleanup
1930 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
1934 .nid = 0x06, /* NID to query formats and rates */
1936 .open = stac92xx_playback_pcm_open,
1937 .prepare = stac92xx_playback_pcm_prepare,
1938 .cleanup = stac92xx_playback_pcm_cleanup
1942 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
1945 /* NID + .substreams is set in stac92xx_build_pcms */
1947 .prepare = stac92xx_capture_pcm_prepare,
1948 .cleanup = stac92xx_capture_pcm_cleanup
1952 static int stac92xx_build_pcms(struct hda_codec *codec)
1954 struct sigmatel_spec *spec = codec->spec;
1955 struct hda_pcm *info = spec->pcm_rec;
1957 codec->num_pcms = 1;
1958 codec->pcm_info = info;
1960 info->name = "STAC92xx Analog";
1961 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
1962 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
1963 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1964 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
1966 if (spec->alt_switch) {
1969 info->name = "STAC92xx Analog Alt";
1970 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
1973 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1976 info->name = "STAC92xx Digital";
1977 info->pcm_type = HDA_PCM_TYPE_SPDIF;
1978 if (spec->multiout.dig_out_nid) {
1979 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
1980 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
1982 if (spec->dig_in_nid) {
1983 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
1984 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
1991 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
1993 unsigned int pincap = snd_hda_param_read(codec, nid,
1995 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
1996 if (pincap & AC_PINCAP_VREF_100)
1997 return AC_PINCTL_VREF_100;
1998 if (pincap & AC_PINCAP_VREF_80)
1999 return AC_PINCTL_VREF_80;
2000 if (pincap & AC_PINCAP_VREF_50)
2001 return AC_PINCTL_VREF_50;
2002 if (pincap & AC_PINCAP_VREF_GRD)
2003 return AC_PINCTL_VREF_GRD;
2007 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2010 snd_hda_codec_write_cache(codec, nid, 0,
2011 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2014 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2016 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2018 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2019 struct sigmatel_spec *spec = codec->spec;
2020 int io_idx = kcontrol-> private_value & 0xff;
2022 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2026 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2029 struct sigmatel_spec *spec = codec->spec;
2030 hda_nid_t nid = kcontrol->private_value >> 8;
2031 int io_idx = kcontrol-> private_value & 0xff;
2032 unsigned short val = !!ucontrol->value.integer.value[0];
2034 spec->io_switch[io_idx] = val;
2037 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2039 unsigned int pinctl = AC_PINCTL_IN_EN;
2040 if (io_idx) /* set VREF for mic */
2041 pinctl |= stac92xx_get_vref(codec, nid);
2042 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2045 /* check the auto-mute again: we need to mute/unmute the speaker
2046 * appropriately according to the pin direction
2048 if (spec->hp_detect)
2049 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2054 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2056 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2057 struct snd_ctl_elem_value *ucontrol)
2059 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2060 struct sigmatel_spec *spec = codec->spec;
2062 ucontrol->value.integer.value[0] = spec->clfe_swap;
2066 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2067 struct snd_ctl_elem_value *ucontrol)
2069 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2070 struct sigmatel_spec *spec = codec->spec;
2071 hda_nid_t nid = kcontrol->private_value & 0xff;
2072 unsigned int val = !!ucontrol->value.integer.value[0];
2074 if (spec->clfe_swap == val)
2077 spec->clfe_swap = val;
2079 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2080 spec->clfe_swap ? 0x4 : 0x0);
2085 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2086 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2089 .info = stac92xx_io_switch_info, \
2090 .get = stac92xx_io_switch_get, \
2091 .put = stac92xx_io_switch_put, \
2092 .private_value = xpval, \
2095 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2096 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2099 .info = stac92xx_clfe_switch_info, \
2100 .get = stac92xx_clfe_switch_get, \
2101 .put = stac92xx_clfe_switch_put, \
2102 .private_value = xpval, \
2106 STAC_CTL_WIDGET_VOL,
2107 STAC_CTL_WIDGET_MUTE,
2108 STAC_CTL_WIDGET_MONO_MUX,
2109 STAC_CTL_WIDGET_IO_SWITCH,
2110 STAC_CTL_WIDGET_CLFE_SWITCH
2113 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2114 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2115 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2117 STAC_CODEC_IO_SWITCH(NULL, 0),
2118 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2121 /* add dynamic controls */
2122 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
2124 struct snd_kcontrol_new *knew;
2126 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2127 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2129 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
2132 if (spec->kctl_alloc) {
2133 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
2134 kfree(spec->kctl_alloc);
2136 spec->kctl_alloc = knew;
2137 spec->num_kctl_alloc = num;
2140 knew = &spec->kctl_alloc[spec->num_kctl_used];
2141 *knew = stac92xx_control_templates[type];
2142 knew->name = kstrdup(name, GFP_KERNEL);
2145 knew->private_value = val;
2146 spec->num_kctl_used++;
2150 /* flag inputs as additional dynamic lineouts */
2151 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2153 struct sigmatel_spec *spec = codec->spec;
2154 unsigned int wcaps, wtype;
2155 int i, num_dacs = 0;
2157 /* use the wcaps cache to count all DACs available for line-outs */
2158 for (i = 0; i < codec->num_nodes; i++) {
2159 wcaps = codec->wcaps[i];
2160 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2162 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2166 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2168 switch (cfg->line_outs) {
2170 /* add line-in as side */
2171 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2172 cfg->line_out_pins[cfg->line_outs] =
2173 cfg->input_pins[AUTO_PIN_LINE];
2174 spec->line_switch = 1;
2179 /* add line-in as clfe and mic as side */
2180 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2181 cfg->line_out_pins[cfg->line_outs] =
2182 cfg->input_pins[AUTO_PIN_LINE];
2183 spec->line_switch = 1;
2186 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2187 cfg->line_out_pins[cfg->line_outs] =
2188 cfg->input_pins[AUTO_PIN_MIC];
2189 spec->mic_switch = 1;
2194 /* add line-in as surr and mic as clfe */
2195 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2196 cfg->line_out_pins[cfg->line_outs] =
2197 cfg->input_pins[AUTO_PIN_LINE];
2198 spec->line_switch = 1;
2201 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2202 cfg->line_out_pins[cfg->line_outs] =
2203 cfg->input_pins[AUTO_PIN_MIC];
2204 spec->mic_switch = 1;
2214 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2218 for (i = 0; i < spec->multiout.num_dacs; i++) {
2219 if (spec->multiout.dac_nids[i] == nid)
2227 * Fill in the dac_nids table from the parsed pin configuration
2228 * This function only works when every pin in line_out_pins[]
2229 * contains atleast one DAC in its connection list. Some 92xx
2230 * codecs are not connected directly to a DAC, such as the 9200
2231 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2233 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2234 struct auto_pin_cfg *cfg)
2236 struct sigmatel_spec *spec = codec->spec;
2237 int i, j, conn_len = 0;
2238 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2239 unsigned int wcaps, wtype;
2241 for (i = 0; i < cfg->line_outs; i++) {
2242 nid = cfg->line_out_pins[i];
2243 conn_len = snd_hda_get_connections(codec, nid, conn,
2244 HDA_MAX_CONNECTIONS);
2245 for (j = 0; j < conn_len; j++) {
2246 wcaps = snd_hda_param_read(codec, conn[j],
2247 AC_PAR_AUDIO_WIDGET_CAP);
2248 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2249 if (wtype != AC_WID_AUD_OUT ||
2250 (wcaps & AC_WCAP_DIGITAL))
2252 /* conn[j] is a DAC routed to this line-out */
2253 if (!is_in_dac_nids(spec, conn[j]))
2257 if (j == conn_len) {
2258 if (spec->multiout.num_dacs > 0) {
2259 /* we have already working output pins,
2260 * so let's drop the broken ones again
2262 cfg->line_outs = spec->multiout.num_dacs;
2265 /* error out, no available DAC found */
2267 "%s: No available DAC for pin 0x%x\n",
2272 spec->multiout.dac_nids[i] = conn[j];
2273 spec->multiout.num_dacs++;
2275 /* select this DAC in the pin's input mux */
2276 snd_hda_codec_write_cache(codec, nid, 0,
2277 AC_VERB_SET_CONNECT_SEL, j);
2282 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2283 spec->multiout.num_dacs,
2284 spec->multiout.dac_nids[0],
2285 spec->multiout.dac_nids[1],
2286 spec->multiout.dac_nids[2],
2287 spec->multiout.dac_nids[3],
2288 spec->multiout.dac_nids[4]);
2292 /* create volume control/switch for the given prefx type */
2293 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2298 sprintf(name, "%s Playback Volume", pfx);
2299 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2300 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2303 sprintf(name, "%s Playback Switch", pfx);
2304 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2305 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2311 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2313 if (!spec->multiout.hp_nid)
2314 spec->multiout.hp_nid = nid;
2315 else if (spec->multiout.num_dacs > 4) {
2316 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2319 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2320 spec->multiout.num_dacs++;
2325 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2327 if (is_in_dac_nids(spec, nid))
2329 if (spec->multiout.hp_nid == nid)
2334 /* add playback controls from the parsed DAC table */
2335 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2336 const struct auto_pin_cfg *cfg)
2338 static const char *chname[4] = {
2339 "Front", "Surround", NULL /*CLFE*/, "Side"
2344 struct sigmatel_spec *spec = codec->spec;
2345 unsigned int wid_caps, pincap;
2348 for (i = 0; i < cfg->line_outs; i++) {
2349 if (!spec->multiout.dac_nids[i])
2352 nid = spec->multiout.dac_nids[i];
2356 err = create_controls(spec, "Center", nid, 1);
2359 err = create_controls(spec, "LFE", nid, 2);
2363 wid_caps = get_wcaps(codec, nid);
2365 if (wid_caps & AC_WCAP_LR_SWAP) {
2366 err = stac92xx_add_control(spec,
2367 STAC_CTL_WIDGET_CLFE_SWITCH,
2368 "Swap Center/LFE Playback Switch", nid);
2375 err = create_controls(spec, chname[i], nid, 3);
2381 if (spec->line_switch) {
2382 nid = cfg->input_pins[AUTO_PIN_LINE];
2383 pincap = snd_hda_param_read(codec, nid,
2385 if (pincap & AC_PINCAP_OUT) {
2386 err = stac92xx_add_control(spec,
2387 STAC_CTL_WIDGET_IO_SWITCH,
2388 "Line In as Output Switch", nid << 8);
2394 if (spec->mic_switch) {
2395 unsigned int def_conf;
2396 unsigned int mic_pin = AUTO_PIN_MIC;
2398 nid = cfg->input_pins[mic_pin];
2399 def_conf = snd_hda_codec_read(codec, nid, 0,
2400 AC_VERB_GET_CONFIG_DEFAULT, 0);
2401 /* some laptops have an internal analog microphone
2402 * which can't be used as a output */
2403 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2404 pincap = snd_hda_param_read(codec, nid,
2406 if (pincap & AC_PINCAP_OUT) {
2407 err = stac92xx_add_control(spec,
2408 STAC_CTL_WIDGET_IO_SWITCH,
2409 "Mic as Output Switch", (nid << 8) | 1);
2410 nid = snd_hda_codec_read(codec, nid, 0,
2411 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2412 if (!check_in_dac_nids(spec, nid))
2413 add_spec_dacs(spec, nid);
2417 } else if (mic_pin == AUTO_PIN_MIC) {
2418 mic_pin = AUTO_PIN_FRONT_MIC;
2426 /* add playback controls for Speaker and HP outputs */
2427 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
2428 struct auto_pin_cfg *cfg)
2430 struct sigmatel_spec *spec = codec->spec;
2432 int i, old_num_dacs, err;
2434 old_num_dacs = spec->multiout.num_dacs;
2435 for (i = 0; i < cfg->hp_outs; i++) {
2436 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
2437 if (wid_caps & AC_WCAP_UNSOL_CAP)
2438 spec->hp_detect = 1;
2439 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
2440 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2441 if (check_in_dac_nids(spec, nid))
2445 add_spec_dacs(spec, nid);
2447 for (i = 0; i < cfg->speaker_outs; i++) {
2448 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
2449 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2450 if (check_in_dac_nids(spec, nid))
2454 add_spec_dacs(spec, nid);
2456 for (i = 0; i < cfg->line_outs; i++) {
2457 nid = snd_hda_codec_read(codec, cfg->line_out_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 = old_num_dacs; i < spec->multiout.num_dacs; i++) {
2466 static const char *pfxs[] = {
2467 "Speaker", "External Speaker", "Speaker2",
2469 err = create_controls(spec, pfxs[i - old_num_dacs],
2470 spec->multiout.dac_nids[i], 3);
2474 if (spec->multiout.hp_nid) {
2476 if (old_num_dacs == spec->multiout.num_dacs)
2480 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3);
2488 /* labels for mono mux outputs */
2489 static const char *stac92xx_mono_labels[3] = {
2490 "DAC0", "DAC1", "Mixer"
2493 /* create mono mux for mono out on capable codecs */
2494 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
2496 struct sigmatel_spec *spec = codec->spec;
2497 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
2499 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
2501 num_cons = snd_hda_get_connections(codec,
2504 HDA_MAX_NUM_INPUTS);
2505 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
2508 for (i = 0; i < num_cons; i++) {
2509 mono_mux->items[mono_mux->num_items].label =
2510 stac92xx_mono_labels[i];
2511 mono_mux->items[mono_mux->num_items].index = i;
2512 mono_mux->num_items++;
2515 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
2516 "Mono Mux", spec->mono_nid);
2519 /* labels for dmic mux inputs */
2520 static const char *stac92xx_dmic_labels[5] = {
2521 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2522 "Digital Mic 3", "Digital Mic 4"
2525 /* create playback/capture controls for input pins on dmic capable codecs */
2526 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2527 const struct auto_pin_cfg *cfg)
2529 struct sigmatel_spec *spec = codec->spec;
2530 struct hda_input_mux *dimux = &spec->private_dimux;
2531 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2535 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2536 dimux->items[dimux->num_items].index = 0;
2539 for (i = 0; i < spec->num_dmics; i++) {
2544 unsigned int def_conf;
2546 def_conf = snd_hda_codec_read(codec,
2549 AC_VERB_GET_CONFIG_DEFAULT,
2551 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2554 nid = spec->dmic_nids[i];
2555 num_cons = snd_hda_get_connections(codec,
2558 HDA_MAX_NUM_INPUTS);
2559 for (j = 0; j < num_cons; j++)
2560 if (con_lst[j] == nid) {
2566 wcaps = get_wcaps(codec, nid);
2568 if (wcaps & AC_WCAP_OUT_AMP) {
2569 sprintf(name, "%s Capture Volume",
2570 stac92xx_dmic_labels[dimux->num_items]);
2572 err = stac92xx_add_control(spec,
2573 STAC_CTL_WIDGET_VOL,
2575 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
2580 dimux->items[dimux->num_items].label =
2581 stac92xx_dmic_labels[dimux->num_items];
2582 dimux->items[dimux->num_items].index = index;
2589 /* create playback/capture controls for input pins */
2590 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
2592 struct sigmatel_spec *spec = codec->spec;
2593 struct hda_input_mux *imux = &spec->private_imux;
2594 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2597 for (i = 0; i < AUTO_PIN_LAST; i++) {
2600 if (!cfg->input_pins[i])
2603 for (j = 0; j < spec->num_muxes; j++) {
2605 num_cons = snd_hda_get_connections(codec,
2608 HDA_MAX_NUM_INPUTS);
2609 for (k = 0; k < num_cons; k++)
2610 if (con_lst[k] == cfg->input_pins[i]) {
2617 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
2618 imux->items[imux->num_items].index = index;
2622 if (imux->num_items) {
2624 * Set the current input for the muxes.
2625 * The STAC9221 has two input muxes with identical source
2626 * NID lists. Hopefully this won't get confused.
2628 for (i = 0; i < spec->num_muxes; i++) {
2629 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
2630 AC_VERB_SET_CONNECT_SEL,
2631 imux->items[0].index);
2638 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
2640 struct sigmatel_spec *spec = codec->spec;
2643 for (i = 0; i < spec->autocfg.line_outs; i++) {
2644 hda_nid_t nid = spec->autocfg.line_out_pins[i];
2645 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2649 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
2651 struct sigmatel_spec *spec = codec->spec;
2654 for (i = 0; i < spec->autocfg.hp_outs; i++) {
2656 pin = spec->autocfg.hp_pins[i];
2657 if (pin) /* connect to front */
2658 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
2660 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
2662 pin = spec->autocfg.speaker_pins[i];
2663 if (pin) /* connect to front */
2664 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
2668 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
2670 struct sigmatel_spec *spec = codec->spec;
2672 int hp_speaker_swap = 0;
2674 if ((err = snd_hda_parse_pin_def_config(codec,
2676 spec->dmic_nids)) < 0)
2678 if (! spec->autocfg.line_outs)
2679 return 0; /* can't find valid pin config */
2681 /* If we have no real line-out pin and multiple hp-outs, HPs should
2682 * be set up as multi-channel outputs.
2684 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2685 spec->autocfg.hp_outs > 1) {
2686 /* Copy hp_outs to line_outs, backup line_outs in
2687 * speaker_outs so that the following routines can handle
2688 * HP pins as primary outputs.
2690 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
2691 sizeof(spec->autocfg.line_out_pins));
2692 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
2693 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
2694 sizeof(spec->autocfg.hp_pins));
2695 spec->autocfg.line_outs = spec->autocfg.hp_outs;
2696 hp_speaker_swap = 1;
2698 if (spec->autocfg.mono_out_pin) {
2699 int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin)
2700 & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
2701 u32 caps = query_amp_caps(codec,
2702 spec->autocfg.mono_out_pin, dir);
2703 hda_nid_t conn_list[1];
2705 /* get the mixer node and then the mono mux if it exists */
2706 if (snd_hda_get_connections(codec,
2707 spec->autocfg.mono_out_pin, conn_list, 1) &&
2708 snd_hda_get_connections(codec, conn_list[0],
2711 int wcaps = get_wcaps(codec, conn_list[0]);
2712 int wid_type = (wcaps & AC_WCAP_TYPE)
2713 >> AC_WCAP_TYPE_SHIFT;
2714 /* LR swap check, some stac925x have a mux that
2715 * changes the DACs output path instead of the
2718 if (wid_type == AC_WID_AUD_SEL &&
2719 !(wcaps & AC_WCAP_LR_SWAP))
2720 spec->mono_nid = conn_list[0];
2722 /* all mono outs have a least a mute/unmute switch */
2723 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2724 "Mono Playback Switch",
2725 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2729 /* check to see if there is volume support for the amp */
2730 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
2731 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
2732 "Mono Playback Volume",
2733 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2739 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
2743 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
2745 if (spec->multiout.num_dacs == 0)
2746 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
2749 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
2754 if (hp_speaker_swap == 1) {
2755 /* Restore the hp_outs and line_outs */
2756 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
2757 sizeof(spec->autocfg.line_out_pins));
2758 spec->autocfg.hp_outs = spec->autocfg.line_outs;
2759 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
2760 sizeof(spec->autocfg.speaker_pins));
2761 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
2762 memset(spec->autocfg.speaker_pins, 0,
2763 sizeof(spec->autocfg.speaker_pins));
2764 spec->autocfg.speaker_outs = 0;
2767 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
2772 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
2777 if (spec->mono_nid > 0) {
2778 err = stac92xx_auto_create_mono_output_ctls(codec);
2783 if (spec->num_dmics > 0)
2784 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
2785 &spec->autocfg)) < 0)
2788 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
2789 if (spec->multiout.max_channels > 2)
2790 spec->surr_switch = 1;
2792 if (spec->autocfg.dig_out_pin)
2793 spec->multiout.dig_out_nid = dig_out;
2794 if (spec->autocfg.dig_in_pin)
2795 spec->dig_in_nid = dig_in;
2797 if (spec->kctl_alloc)
2798 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2800 spec->input_mux = &spec->private_imux;
2801 if (!spec->dinput_mux)
2802 spec->dinput_mux = &spec->private_dimux;
2803 spec->mono_mux = &spec->private_mono_mux;
2808 /* add playback controls for HP output */
2809 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
2810 struct auto_pin_cfg *cfg)
2812 struct sigmatel_spec *spec = codec->spec;
2813 hda_nid_t pin = cfg->hp_pins[0];
2814 unsigned int wid_caps;
2819 wid_caps = get_wcaps(codec, pin);
2820 if (wid_caps & AC_WCAP_UNSOL_CAP)
2821 spec->hp_detect = 1;
2826 /* add playback controls for LFE output */
2827 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
2828 struct auto_pin_cfg *cfg)
2830 struct sigmatel_spec *spec = codec->spec;
2832 hda_nid_t lfe_pin = 0x0;
2836 * search speaker outs and line outs for a mono speaker pin
2837 * with an amp. If one is found, add LFE controls
2840 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
2841 hda_nid_t pin = spec->autocfg.speaker_pins[i];
2842 unsigned int wcaps = get_wcaps(codec, pin);
2843 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2844 if (wcaps == AC_WCAP_OUT_AMP)
2845 /* found a mono speaker with an amp, must be lfe */
2849 /* if speaker_outs is 0, then speakers may be in line_outs */
2850 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
2851 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
2852 hda_nid_t pin = spec->autocfg.line_out_pins[i];
2853 unsigned int defcfg;
2854 defcfg = snd_hda_codec_read(codec, pin, 0,
2855 AC_VERB_GET_CONFIG_DEFAULT,
2857 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
2858 unsigned int wcaps = get_wcaps(codec, pin);
2859 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2860 if (wcaps == AC_WCAP_OUT_AMP)
2861 /* found a mono speaker with an amp,
2869 err = create_controls(spec, "LFE", lfe_pin, 1);
2877 static int stac9200_parse_auto_config(struct hda_codec *codec)
2879 struct sigmatel_spec *spec = codec->spec;
2882 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
2885 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
2888 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
2891 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
2894 if (spec->autocfg.dig_out_pin)
2895 spec->multiout.dig_out_nid = 0x05;
2896 if (spec->autocfg.dig_in_pin)
2897 spec->dig_in_nid = 0x04;
2899 if (spec->kctl_alloc)
2900 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2902 spec->input_mux = &spec->private_imux;
2903 spec->dinput_mux = &spec->private_dimux;
2909 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
2910 * funky external mute control using GPIO pins.
2913 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
2914 unsigned int dir_mask, unsigned int data)
2916 unsigned int gpiostate, gpiomask, gpiodir;
2918 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
2919 AC_VERB_GET_GPIO_DATA, 0);
2920 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
2922 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
2923 AC_VERB_GET_GPIO_MASK, 0);
2926 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
2927 AC_VERB_GET_GPIO_DIRECTION, 0);
2928 gpiodir |= dir_mask;
2930 /* Configure GPIOx as CMOS */
2931 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
2933 snd_hda_codec_write(codec, codec->afg, 0,
2934 AC_VERB_SET_GPIO_MASK, gpiomask);
2935 snd_hda_codec_read(codec, codec->afg, 0,
2936 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
2940 snd_hda_codec_read(codec, codec->afg, 0,
2941 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
2944 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
2947 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
2948 snd_hda_codec_write_cache(codec, nid, 0,
2949 AC_VERB_SET_UNSOLICITED_ENABLE,
2950 (AC_USRSP_EN | event));
2953 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
2956 for (i = 0; i < cfg->hp_outs; i++)
2957 if (cfg->hp_pins[i] == nid)
2958 return 1; /* nid is a HP-Out */
2960 return 0; /* nid is not a HP-Out */
2963 static void stac92xx_power_down(struct hda_codec *codec)
2965 struct sigmatel_spec *spec = codec->spec;
2967 /* power down inactive DACs */
2969 for (dac = spec->dac_list; *dac; dac++)
2970 if (!is_in_dac_nids(spec, *dac) &&
2971 spec->multiout.hp_nid != *dac)
2972 snd_hda_codec_write_cache(codec, *dac, 0,
2973 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2976 static int stac92xx_init(struct hda_codec *codec)
2978 struct sigmatel_spec *spec = codec->spec;
2979 struct auto_pin_cfg *cfg = &spec->autocfg;
2982 snd_hda_sequence_write(codec, spec->init);
2985 if (spec->hp_detect) {
2986 /* Enable unsolicited responses on the HP widget */
2987 for (i = 0; i < cfg->hp_outs; i++)
2988 enable_pin_detect(codec, cfg->hp_pins[i],
2990 /* force to enable the first line-out; the others are set up
2993 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
2995 stac92xx_auto_init_hp_out(codec);
2996 /* fake event to set up pins */
2997 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2999 stac92xx_auto_init_multi_out(codec);
3000 stac92xx_auto_init_hp_out(codec);
3002 for (i = 0; i < AUTO_PIN_LAST; i++) {
3003 hda_nid_t nid = cfg->input_pins[i];
3005 unsigned int pinctl = AC_PINCTL_IN_EN;
3006 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
3007 pinctl |= stac92xx_get_vref(codec, nid);
3008 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3011 for (i = 0; i < spec->num_dmics; i++)
3012 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3014 for (i = 0; i < spec->num_pwrs; i++) {
3015 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i])
3016 ? STAC_HP_EVENT : STAC_PWR_EVENT;
3017 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i],
3018 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3019 /* outputs are only ports capable of power management
3020 * any attempts on powering down a input port cause the
3021 * referenced VREF to act quirky.
3023 if (pinctl & AC_PINCTL_IN_EN)
3025 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3026 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3029 stac92xx_power_down(codec);
3030 if (cfg->dig_out_pin)
3031 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3033 if (cfg->dig_in_pin)
3034 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3037 stac_gpio_set(codec, spec->gpio_mask,
3038 spec->gpio_dir, spec->gpio_data);
3043 static void stac92xx_free(struct hda_codec *codec)
3045 struct sigmatel_spec *spec = codec->spec;
3051 if (spec->kctl_alloc) {
3052 for (i = 0; i < spec->num_kctl_used; i++)
3053 kfree(spec->kctl_alloc[i].name);
3054 kfree(spec->kctl_alloc);
3057 if (spec->bios_pin_configs)
3058 kfree(spec->bios_pin_configs);
3063 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
3066 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3067 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3069 if (pin_ctl & AC_PINCTL_IN_EN) {
3071 * we need to check the current set-up direction of
3072 * shared input pins since they can be switched via
3073 * "xxx as Output" mixer switch
3075 struct sigmatel_spec *spec = codec->spec;
3076 struct auto_pin_cfg *cfg = &spec->autocfg;
3077 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
3078 spec->line_switch) ||
3079 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
3084 /* if setting pin direction bits, clear the current
3085 direction bits first */
3086 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
3087 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
3089 snd_hda_codec_write_cache(codec, nid, 0,
3090 AC_VERB_SET_PIN_WIDGET_CONTROL,
3094 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
3097 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3098 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3099 snd_hda_codec_write_cache(codec, nid, 0,
3100 AC_VERB_SET_PIN_WIDGET_CONTROL,
3104 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
3108 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
3110 unsigned int pinctl;
3111 pinctl = snd_hda_codec_read(codec, nid, 0,
3112 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3113 if (pinctl & AC_PINCTL_IN_EN)
3114 return 0; /* mic- or line-input */
3116 return 1; /* HP-output */
3121 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3123 struct sigmatel_spec *spec = codec->spec;
3124 struct auto_pin_cfg *cfg = &spec->autocfg;
3128 if (spec->gpio_mute)
3129 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
3130 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
3132 for (i = 0; i < cfg->hp_outs; i++) {
3135 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
3139 /* disable lineouts, enable hp */
3140 for (i = 0; i < cfg->line_outs; i++)
3141 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
3143 for (i = 0; i < cfg->speaker_outs; i++)
3144 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3147 /* enable lineouts, disable hp */
3148 for (i = 0; i < cfg->line_outs; i++)
3149 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
3151 for (i = 0; i < cfg->speaker_outs; i++)
3152 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3157 static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3159 struct sigmatel_spec *spec = codec->spec;
3160 hda_nid_t nid = spec->pwr_nids[idx];
3162 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0)
3164 presence = get_hp_pin_presence(codec, nid);
3172 /* power down unused output ports */
3173 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3176 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3178 struct sigmatel_spec *spec = codec->spec;
3179 int idx = res >> 26 & 0x0f;
3181 switch ((res >> 26) & 0x30) {
3183 stac92xx_hp_detect(codec, res);
3185 case STAC_PWR_EVENT:
3186 if (spec->num_pwrs > 0)
3187 stac92xx_pin_sense(codec, idx);
3191 #ifdef SND_HDA_NEEDS_RESUME
3192 static int stac92xx_resume(struct hda_codec *codec)
3194 struct sigmatel_spec *spec = codec->spec;
3196 stac92xx_set_config_regs(codec);
3197 snd_hda_sequence_write(codec, spec->init);
3198 stac_gpio_set(codec, spec->gpio_mask,
3199 spec->gpio_dir, spec->gpio_data);
3200 snd_hda_codec_resume_amp(codec);
3201 snd_hda_codec_resume_cache(codec);
3202 /* power down inactive DACs */
3204 stac92xx_power_down(codec);
3205 /* invoke unsolicited event to reset the HP state */
3206 if (spec->hp_detect)
3207 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3212 static struct hda_codec_ops stac92xx_patch_ops = {
3213 .build_controls = stac92xx_build_controls,
3214 .build_pcms = stac92xx_build_pcms,
3215 .init = stac92xx_init,
3216 .free = stac92xx_free,
3217 .unsol_event = stac92xx_unsol_event,
3218 #ifdef SND_HDA_NEEDS_RESUME
3219 .resume = stac92xx_resume,
3223 static int patch_stac9200(struct hda_codec *codec)
3225 struct sigmatel_spec *spec;
3228 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3233 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
3234 spec->pin_nids = stac9200_pin_nids;
3235 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
3238 if (spec->board_config < 0) {
3239 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3240 err = stac92xx_save_bios_config_regs(codec);
3242 stac92xx_free(codec);
3245 spec->pin_configs = spec->bios_pin_configs;
3247 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
3248 stac92xx_set_config_regs(codec);
3251 spec->multiout.max_channels = 2;
3252 spec->multiout.num_dacs = 1;
3253 spec->multiout.dac_nids = stac9200_dac_nids;
3254 spec->adc_nids = stac9200_adc_nids;
3255 spec->mux_nids = stac9200_mux_nids;
3256 spec->num_muxes = 1;
3257 spec->num_dmics = 0;
3261 if (spec->board_config == STAC_9200_GATEWAY ||
3262 spec->board_config == STAC_9200_OQO)
3263 spec->init = stac9200_eapd_init;
3265 spec->init = stac9200_core_init;
3266 spec->mixer = stac9200_mixer;
3268 err = stac9200_parse_auto_config(codec);
3270 stac92xx_free(codec);
3274 codec->patch_ops = stac92xx_patch_ops;
3279 static int patch_stac925x(struct hda_codec *codec)
3281 struct sigmatel_spec *spec;
3284 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3289 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
3290 spec->pin_nids = stac925x_pin_nids;
3291 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
3295 if (spec->board_config < 0) {
3296 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
3297 "using BIOS defaults\n");
3298 err = stac92xx_save_bios_config_regs(codec);
3300 stac92xx_free(codec);
3303 spec->pin_configs = spec->bios_pin_configs;
3304 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
3305 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
3306 stac92xx_set_config_regs(codec);
3309 spec->multiout.max_channels = 2;
3310 spec->multiout.num_dacs = 1;
3311 spec->multiout.dac_nids = stac925x_dac_nids;
3312 spec->adc_nids = stac925x_adc_nids;
3313 spec->mux_nids = stac925x_mux_nids;
3314 spec->num_muxes = 1;
3317 switch (codec->vendor_id) {
3318 case 0x83847632: /* STAC9202 */
3319 case 0x83847633: /* STAC9202D */
3320 case 0x83847636: /* STAC9251 */
3321 case 0x83847637: /* STAC9251D */
3322 spec->num_dmics = STAC925X_NUM_DMICS;
3323 spec->dmic_nids = stac925x_dmic_nids;
3324 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
3325 spec->dmux_nids = stac925x_dmux_nids;
3328 spec->num_dmics = 0;
3332 spec->init = stac925x_core_init;
3333 spec->mixer = stac925x_mixer;
3335 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
3337 if (spec->board_config < 0) {
3338 printk(KERN_WARNING "hda_codec: No auto-config is "
3339 "available, default to model=ref\n");
3340 spec->board_config = STAC_925x_REF;
3346 stac92xx_free(codec);
3350 codec->patch_ops = stac92xx_patch_ops;
3355 static struct hda_input_mux stac92hd73xx_dmux = {
3358 { "Analog Inputs", 0x0b },
3360 { "Digital Mic 1", 0x09 },
3361 { "Digital Mic 2", 0x0a },
3365 static int patch_stac92hd73xx(struct hda_codec *codec)
3367 struct sigmatel_spec *spec;
3368 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
3371 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3376 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
3377 spec->pin_nids = stac92hd73xx_pin_nids;
3378 spec->board_config = snd_hda_check_board_config(codec,
3379 STAC_92HD73XX_MODELS,
3380 stac92hd73xx_models,
3381 stac92hd73xx_cfg_tbl);
3383 if (spec->board_config < 0) {
3384 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3385 " STAC92HD73XX, using BIOS defaults\n");
3386 err = stac92xx_save_bios_config_regs(codec);
3388 stac92xx_free(codec);
3391 spec->pin_configs = spec->bios_pin_configs;
3393 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
3394 stac92xx_set_config_regs(codec);
3397 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
3398 conn, STAC92HD73_DAC_COUNT + 2) - 1;
3400 if (spec->multiout.num_dacs < 0) {
3401 printk(KERN_WARNING "hda_codec: Could not determine "
3402 "number of channels defaulting to DAC count\n");
3403 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
3406 switch (spec->multiout.num_dacs) {
3407 case 0x3: /* 6 Channel */
3408 spec->mixer = stac92hd73xx_6ch_mixer;
3409 spec->init = stac92hd73xx_6ch_core_init;
3411 case 0x4: /* 8 Channel */
3412 spec->multiout.hp_nid = 0x18;
3413 spec->mixer = stac92hd73xx_8ch_mixer;
3414 spec->init = stac92hd73xx_8ch_core_init;
3416 case 0x5: /* 10 Channel */
3417 spec->multiout.hp_nid = 0x19;
3418 spec->mixer = stac92hd73xx_10ch_mixer;
3419 spec->init = stac92hd73xx_10ch_core_init;
3422 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
3423 spec->aloopback_mask = 0x01;
3424 spec->aloopback_shift = 8;
3426 spec->mux_nids = stac92hd73xx_mux_nids;
3427 spec->adc_nids = stac92hd73xx_adc_nids;
3428 spec->dmic_nids = stac92hd73xx_dmic_nids;
3429 spec->dmux_nids = stac92hd73xx_dmux_nids;
3431 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
3432 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
3433 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3434 spec->dinput_mux = &stac92hd73xx_dmux;
3435 /* GPIO0 High = Enable EAPD */
3436 spec->gpio_mask = spec->gpio_dir = 0x1;
3437 spec->gpio_data = 0x01;
3439 switch (spec->board_config) {
3441 switch (codec->subsystem_id) {
3442 case 0x1028025e: /* Analog Mics */
3444 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3445 spec->num_dmics = 0;
3447 case 0x10280254: /* Digital Mics */
3451 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3452 spec->num_dmics = 1;
3454 case 0x10280256: /* Both */
3456 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3457 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3458 spec->num_dmics = 1;
3463 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
3466 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3467 spec->pwr_nids = stac92hd73xx_pwr_nids;
3469 err = stac92xx_parse_auto_config(codec, 0x22, 0x24);
3472 if (spec->board_config < 0) {
3473 printk(KERN_WARNING "hda_codec: No auto-config is "
3474 "available, default to model=ref\n");
3475 spec->board_config = STAC_92HD73XX_REF;
3482 stac92xx_free(codec);
3486 codec->patch_ops = stac92xx_patch_ops;
3491 static int patch_stac92hd71bxx(struct hda_codec *codec)
3493 struct sigmatel_spec *spec;
3496 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3501 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
3502 spec->pin_nids = stac92hd71bxx_pin_nids;
3503 spec->board_config = snd_hda_check_board_config(codec,
3504 STAC_92HD71BXX_MODELS,
3505 stac92hd71bxx_models,
3506 stac92hd71bxx_cfg_tbl);
3508 if (spec->board_config < 0) {
3509 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3510 " STAC92HD71BXX, using BIOS defaults\n");
3511 err = stac92xx_save_bios_config_regs(codec);
3513 stac92xx_free(codec);
3516 spec->pin_configs = spec->bios_pin_configs;
3518 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
3519 stac92xx_set_config_regs(codec);
3522 switch (codec->vendor_id) {
3523 case 0x111d76b6: /* 4 Port without Analog Mixer */
3525 case 0x111d76b4: /* 6 Port without Analog Mixer */
3527 spec->mixer = stac92hd71bxx_mixer;
3528 spec->init = stac92hd71bxx_core_init;
3531 spec->mixer = stac92hd71bxx_analog_mixer;
3532 spec->init = stac92hd71bxx_analog_core_init;
3535 spec->aloopback_mask = 0x20;
3536 spec->aloopback_shift = 0;
3538 /* GPIO0 High = EAPD */
3539 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1;
3541 spec->mux_nids = stac92hd71bxx_mux_nids;
3542 spec->adc_nids = stac92hd71bxx_adc_nids;
3543 spec->dmic_nids = stac92hd71bxx_dmic_nids;
3544 spec->dmux_nids = stac92hd71bxx_dmux_nids;
3546 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
3547 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
3548 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
3549 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
3551 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
3552 spec->pwr_nids = stac92hd71bxx_pwr_nids;
3554 spec->multiout.num_dacs = 1;
3555 spec->multiout.hp_nid = 0x11;
3556 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
3558 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
3560 if (spec->board_config < 0) {
3561 printk(KERN_WARNING "hda_codec: No auto-config is "
3562 "available, default to model=ref\n");
3563 spec->board_config = STAC_92HD71BXX_REF;
3570 stac92xx_free(codec);
3574 codec->patch_ops = stac92xx_patch_ops;
3579 static int patch_stac922x(struct hda_codec *codec)
3581 struct sigmatel_spec *spec;
3584 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3589 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
3590 spec->pin_nids = stac922x_pin_nids;
3591 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
3594 if (spec->board_config == STAC_INTEL_MAC_V3) {
3595 spec->gpio_mask = spec->gpio_dir = 0x03;
3596 spec->gpio_data = 0x03;
3597 /* Intel Macs have all same PCI SSID, so we need to check
3598 * codec SSID to distinguish the exact models
3600 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
3601 switch (codec->subsystem_id) {
3604 spec->board_config = STAC_INTEL_MAC_V1;
3608 spec->board_config = STAC_INTEL_MAC_V2;
3616 spec->board_config = STAC_INTEL_MAC_V3;
3620 spec->board_config = STAC_INTEL_MAC_V4;
3624 spec->board_config = STAC_INTEL_MAC_V5;
3630 if (spec->board_config < 0) {
3631 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
3632 "using BIOS defaults\n");
3633 err = stac92xx_save_bios_config_regs(codec);
3635 stac92xx_free(codec);
3638 spec->pin_configs = spec->bios_pin_configs;
3639 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
3640 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
3641 stac92xx_set_config_regs(codec);
3644 spec->adc_nids = stac922x_adc_nids;
3645 spec->mux_nids = stac922x_mux_nids;
3646 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
3647 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
3648 spec->num_dmics = 0;
3651 spec->init = stac922x_core_init;
3652 spec->mixer = stac922x_mixer;
3654 spec->multiout.dac_nids = spec->dac_nids;
3656 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
3658 if (spec->board_config < 0) {
3659 printk(KERN_WARNING "hda_codec: No auto-config is "
3660 "available, default to model=ref\n");
3661 spec->board_config = STAC_D945_REF;
3667 stac92xx_free(codec);
3671 codec->patch_ops = stac92xx_patch_ops;
3673 /* Fix Mux capture level; max to 2 */
3674 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
3675 (0 << AC_AMPCAP_OFFSET_SHIFT) |
3676 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
3677 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3678 (0 << AC_AMPCAP_MUTE_SHIFT));
3683 static int patch_stac927x(struct hda_codec *codec)
3685 struct sigmatel_spec *spec;
3688 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3693 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
3694 spec->pin_nids = stac927x_pin_nids;
3695 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
3699 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
3700 if (spec->board_config < 0)
3701 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3702 "STAC927x, using BIOS defaults\n");
3703 err = stac92xx_save_bios_config_regs(codec);
3705 stac92xx_free(codec);
3708 spec->pin_configs = spec->bios_pin_configs;
3710 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
3711 stac92xx_set_config_regs(codec);
3714 spec->adc_nids = stac927x_adc_nids;
3715 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
3716 spec->mux_nids = stac927x_mux_nids;
3717 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
3718 spec->dac_list = stac927x_dac_nids;
3719 spec->multiout.dac_nids = spec->dac_nids;
3721 switch (spec->board_config) {
3724 /* GPIO0 High = Enable EAPD */
3725 spec->gpio_mask = spec->gpio_dir = 0x01;
3726 spec->gpio_data = 0x01;
3727 spec->num_dmics = 0;
3729 spec->init = d965_core_init;
3730 spec->mixer = stac927x_mixer;
3732 case STAC_DELL_BIOS:
3733 /* configure the analog microphone on some laptops */
3734 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130);
3735 /* correct the front output jack as a hp out */
3736 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f);
3737 /* correct the front input jack as a mic */
3738 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
3741 /* GPIO2 High = Enable EAPD */
3742 spec->gpio_mask = spec->gpio_dir = 0x04;
3743 spec->gpio_data = 0x04;
3744 spec->dmic_nids = stac927x_dmic_nids;
3745 spec->num_dmics = STAC927X_NUM_DMICS;
3747 spec->init = d965_core_init;
3748 spec->mixer = stac927x_mixer;
3749 spec->dmux_nids = stac927x_dmux_nids;
3750 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
3753 /* GPIO0 High = Enable EAPD */
3754 spec->gpio_mask = spec->gpio_dir = 0x1;
3755 spec->gpio_data = 0x01;
3756 spec->num_dmics = 0;
3758 spec->init = stac927x_core_init;
3759 spec->mixer = stac927x_mixer;
3763 spec->aloopback_mask = 0x40;
3764 spec->aloopback_shift = 0;
3766 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
3768 if (spec->board_config < 0) {
3769 printk(KERN_WARNING "hda_codec: No auto-config is "
3770 "available, default to model=ref\n");
3771 spec->board_config = STAC_D965_REF;
3777 stac92xx_free(codec);
3781 codec->patch_ops = stac92xx_patch_ops;
3785 * The STAC927x seem to require fairly long delays for certain
3786 * command sequences. With too short delays (even if the answer
3787 * is set to RIRB properly), it results in the silence output
3788 * on some hardwares like Dell.
3790 * The below flag enables the longer delay (see get_response
3793 codec->bus->needs_damn_long_delay = 1;
3798 static int patch_stac9205(struct hda_codec *codec)
3800 struct sigmatel_spec *spec;
3803 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3808 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
3809 spec->pin_nids = stac9205_pin_nids;
3810 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
3814 if (spec->board_config < 0) {
3815 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
3816 err = stac92xx_save_bios_config_regs(codec);
3818 stac92xx_free(codec);
3821 spec->pin_configs = spec->bios_pin_configs;
3823 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
3824 stac92xx_set_config_regs(codec);
3827 spec->adc_nids = stac9205_adc_nids;
3828 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
3829 spec->mux_nids = stac9205_mux_nids;
3830 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
3831 spec->dmic_nids = stac9205_dmic_nids;
3832 spec->num_dmics = STAC9205_NUM_DMICS;
3833 spec->dmux_nids = stac9205_dmux_nids;
3834 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
3837 spec->init = stac9205_core_init;
3838 spec->mixer = stac9205_mixer;
3840 spec->aloopback_mask = 0x40;
3841 spec->aloopback_shift = 0;
3842 spec->multiout.dac_nids = spec->dac_nids;
3844 switch (spec->board_config){
3845 case STAC_9205_DELL_M43:
3846 /* Enable SPDIF in/out */
3847 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
3848 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
3850 /* Enable unsol response for GPIO4/Dock HP connection */
3851 snd_hda_codec_write(codec, codec->afg, 0,
3852 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
3853 snd_hda_codec_write_cache(codec, codec->afg, 0,
3854 AC_VERB_SET_UNSOLICITED_ENABLE,
3855 (AC_USRSP_EN | STAC_HP_EVENT));
3857 spec->gpio_dir = 0x0b;
3858 spec->gpio_mask = 0x1b;
3859 spec->gpio_mute = 0x10;
3860 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3863 spec->gpio_data = 0x01;
3866 /* GPIO0 High = EAPD */
3867 spec->gpio_mask = spec->gpio_dir = 0x1;
3868 spec->gpio_data = 0x01;
3872 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
3874 if (spec->board_config < 0) {
3875 printk(KERN_WARNING "hda_codec: No auto-config is "
3876 "available, default to model=ref\n");
3877 spec->board_config = STAC_9205_REF;
3883 stac92xx_free(codec);
3887 codec->patch_ops = stac92xx_patch_ops;
3896 /* static config for Sony VAIO FE550G and Sony VAIO AR */
3897 static hda_nid_t vaio_dacs[] = { 0x2 };
3898 #define VAIO_HP_DAC 0x5
3899 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
3900 static hda_nid_t vaio_mux_nids[] = { 0x15 };
3902 static struct hda_input_mux vaio_mux = {
3905 /* { "HP", 0x0 }, */
3906 { "Mic Jack", 0x1 },
3907 { "Internal Mic", 0x2 },
3912 static struct hda_verb vaio_init[] = {
3913 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3914 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
3915 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3916 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3917 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3920 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3921 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
3928 static struct hda_verb vaio_ar_init[] = {
3929 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3930 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3931 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3932 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3933 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
3934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3935 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3936 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3937 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3938 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
3939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
3945 /* bind volumes of both NID 0x02 and 0x05 */
3946 static struct hda_bind_ctls vaio_bind_master_vol = {
3947 .ops = &snd_hda_bind_vol,
3949 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
3950 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
3955 /* bind volumes of both NID 0x02 and 0x05 */
3956 static struct hda_bind_ctls vaio_bind_master_sw = {
3957 .ops = &snd_hda_bind_sw,
3959 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
3960 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
3965 static struct snd_kcontrol_new vaio_mixer[] = {
3966 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
3967 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
3968 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
3969 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
3970 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
3972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3973 .name = "Capture Source",
3975 .info = stac92xx_mux_enum_info,
3976 .get = stac92xx_mux_enum_get,
3977 .put = stac92xx_mux_enum_put,
3982 static struct snd_kcontrol_new vaio_ar_mixer[] = {
3983 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
3984 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
3985 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
3986 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
3987 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
3988 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
3989 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
3991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3992 .name = "Capture Source",
3994 .info = stac92xx_mux_enum_info,
3995 .get = stac92xx_mux_enum_get,
3996 .put = stac92xx_mux_enum_put,
4001 static struct hda_codec_ops stac9872_patch_ops = {
4002 .build_controls = stac92xx_build_controls,
4003 .build_pcms = stac92xx_build_pcms,
4004 .init = stac92xx_init,
4005 .free = stac92xx_free,
4006 #ifdef SND_HDA_NEEDS_RESUME
4007 .resume = stac92xx_resume,
4011 static int stac9872_vaio_init(struct hda_codec *codec)
4015 err = stac92xx_init(codec);
4018 if (codec->patch_ops.unsol_event)
4019 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
4023 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
4025 if (get_hp_pin_presence(codec, 0x0a)) {
4026 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4027 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4029 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4030 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4034 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
4036 switch (res >> 26) {
4038 stac9872_vaio_hp_detect(codec, res);
4043 static struct hda_codec_ops stac9872_vaio_patch_ops = {
4044 .build_controls = stac92xx_build_controls,
4045 .build_pcms = stac92xx_build_pcms,
4046 .init = stac9872_vaio_init,
4047 .free = stac92xx_free,
4048 .unsol_event = stac9872_vaio_unsol_event,
4050 .resume = stac92xx_resume,
4054 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4056 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4058 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4060 /* AR Series. id=0x83847664 and subsys=104D1300 */
4065 static const char *stac9872_models[STAC_9872_MODELS] = {
4066 [CXD9872RD_VAIO] = "vaio",
4067 [CXD9872AKD_VAIO] = "vaio-ar",
4070 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
4071 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
4072 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
4073 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
4074 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
4078 static int patch_stac9872(struct hda_codec *codec)
4080 struct sigmatel_spec *spec;
4083 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
4086 if (board_config < 0)
4087 /* unknown config, let generic-parser do its job... */
4088 return snd_hda_parse_generic_codec(codec);
4090 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4095 switch (board_config) {
4096 case CXD9872RD_VAIO:
4097 case STAC9872AK_VAIO:
4098 case STAC9872K_VAIO:
4099 spec->mixer = vaio_mixer;
4100 spec->init = vaio_init;
4101 spec->multiout.max_channels = 2;
4102 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4103 spec->multiout.dac_nids = vaio_dacs;
4104 spec->multiout.hp_nid = VAIO_HP_DAC;
4105 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4106 spec->adc_nids = vaio_adcs;
4108 spec->input_mux = &vaio_mux;
4109 spec->mux_nids = vaio_mux_nids;
4110 codec->patch_ops = stac9872_vaio_patch_ops;
4113 case CXD9872AKD_VAIO:
4114 spec->mixer = vaio_ar_mixer;
4115 spec->init = vaio_ar_init;
4116 spec->multiout.max_channels = 2;
4117 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4118 spec->multiout.dac_nids = vaio_dacs;
4119 spec->multiout.hp_nid = VAIO_HP_DAC;
4120 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4122 spec->adc_nids = vaio_adcs;
4123 spec->input_mux = &vaio_mux;
4124 spec->mux_nids = vaio_mux_nids;
4125 codec->patch_ops = stac9872_patch_ops;
4136 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
4137 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4138 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4139 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4140 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4141 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4142 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4143 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
4144 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4145 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4146 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4147 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4148 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4149 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
4150 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4151 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4152 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4153 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4154 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4155 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4156 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4157 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4158 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4159 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
4160 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4161 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4162 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4163 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4164 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4165 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
4166 /* The following does not take into account .id=0x83847661 when subsys =
4167 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4168 * currently not fully supported.
4170 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4171 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4172 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
4173 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4174 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4175 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4176 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4177 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4178 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4179 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4180 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
4181 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4182 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
4183 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4184 { .id = 0x111d7608, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },
4185 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4186 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4187 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4188 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4189 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4190 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4191 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4192 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },