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"
38 #define NUM_CONTROL_ALLOC 32
39 #define STAC_PWR_EVENT 0x20
40 #define STAC_HP_EVENT 0x30
103 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
104 * is given, one of the above models will be
105 * chosen according to the subsystem id. */
106 /* for backward compatibility */
130 struct sigmatel_spec {
131 struct snd_kcontrol_new *mixers[4];
132 unsigned int num_mixers;
135 unsigned int surr_switch: 1;
136 unsigned int line_switch: 1;
137 unsigned int mic_switch: 1;
138 unsigned int alt_switch: 1;
139 unsigned int hp_detect: 1;
142 unsigned int eapd_mask;
143 unsigned int gpio_mask;
144 unsigned int gpio_dir;
145 unsigned int gpio_data;
146 unsigned int gpio_mute;
149 unsigned int stream_delay;
151 /* analog loopback */
152 unsigned char aloopback_mask;
153 unsigned char aloopback_shift;
155 /* power management */
156 unsigned int num_pwrs;
157 unsigned int *pwr_mapping;
162 struct hda_input_mux *mono_mux;
163 unsigned int cur_mmux;
164 struct hda_multi_out multiout;
165 hda_nid_t dac_nids[5];
169 unsigned int num_adcs;
171 unsigned int num_muxes;
172 hda_nid_t *dmic_nids;
173 unsigned int num_dmics;
174 hda_nid_t *dmux_nids;
175 unsigned int num_dmuxes;
176 hda_nid_t *smux_nids;
177 unsigned int num_smuxes;
179 hda_nid_t dig_in_nid;
181 hda_nid_t anabeep_nid;
182 hda_nid_t digbeep_nid;
186 unsigned int num_pins;
187 unsigned int *pin_configs;
188 unsigned int *bios_pin_configs;
190 /* codec specific stuff */
191 struct hda_verb *init;
192 struct snd_kcontrol_new *mixer;
195 struct hda_input_mux *dinput_mux;
196 unsigned int cur_dmux[2];
197 struct hda_input_mux *input_mux;
198 unsigned int cur_mux[3];
199 struct hda_input_mux *sinput_mux;
200 unsigned int cur_smux[2];
201 unsigned int powerdown_adcs;
204 unsigned int io_switch[2];
205 unsigned int clfe_swap;
206 unsigned int hp_switch;
207 unsigned int aloopback;
209 struct hda_pcm pcm_rec[2]; /* PCM information */
211 /* dynamic controls and input_mux */
212 struct auto_pin_cfg autocfg;
213 unsigned int num_kctl_alloc, num_kctl_used;
214 struct snd_kcontrol_new *kctl_alloc;
215 struct hda_input_mux private_dimux;
216 struct hda_input_mux private_imux;
217 struct hda_input_mux private_smux;
218 struct hda_input_mux private_mono_mux;
221 static hda_nid_t stac9200_adc_nids[1] = {
225 static hda_nid_t stac9200_mux_nids[1] = {
229 static hda_nid_t stac9200_dac_nids[1] = {
233 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
234 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
238 static hda_nid_t stac92hd73xx_adc_nids[2] = {
242 #define STAC92HD73XX_NUM_DMICS 2
243 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
247 #define STAC92HD73_DAC_COUNT 5
248 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
249 0x15, 0x16, 0x17, 0x18, 0x19,
252 static hda_nid_t stac92hd73xx_mux_nids[4] = {
253 0x28, 0x29, 0x2a, 0x2b,
256 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
260 static hda_nid_t stac92hd73xx_smux_nids[2] = {
264 #define STAC92HD83XXX_NUM_DMICS 2
265 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
269 #define STAC92HD81_DAC_COUNT 2
270 #define STAC92HD83_DAC_COUNT 3
271 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {
275 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
279 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
283 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
287 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
288 0x03, 0x0c, 0x10, 0x40,
291 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
295 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
299 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
303 static hda_nid_t stac92hd71bxx_dmux_nids[1] = {
307 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
311 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
315 #define STAC92HD71BXX_NUM_DMICS 2
316 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
320 static hda_nid_t stac925x_adc_nids[1] = {
324 static hda_nid_t stac925x_mux_nids[1] = {
328 static hda_nid_t stac925x_dac_nids[1] = {
332 #define STAC925X_NUM_DMICS 1
333 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
337 static hda_nid_t stac925x_dmux_nids[1] = {
341 static hda_nid_t stac922x_adc_nids[2] = {
345 static hda_nid_t stac922x_mux_nids[2] = {
349 static hda_nid_t stac927x_adc_nids[3] = {
353 static hda_nid_t stac927x_mux_nids[3] = {
357 static hda_nid_t stac927x_smux_nids[1] = {
361 static hda_nid_t stac927x_dac_nids[6] = {
362 0x02, 0x03, 0x04, 0x05, 0x06, 0
365 static hda_nid_t stac927x_dmux_nids[1] = {
369 #define STAC927X_NUM_DMICS 2
370 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
374 static hda_nid_t stac9205_adc_nids[2] = {
378 static hda_nid_t stac9205_mux_nids[2] = {
382 static hda_nid_t stac9205_dmux_nids[1] = {
386 static hda_nid_t stac9205_smux_nids[1] = {
390 #define STAC9205_NUM_DMICS 2
391 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
395 static hda_nid_t stac9200_pin_nids[8] = {
396 0x08, 0x09, 0x0d, 0x0e,
397 0x0f, 0x10, 0x11, 0x12,
400 static hda_nid_t stac925x_pin_nids[8] = {
401 0x07, 0x08, 0x0a, 0x0b,
402 0x0c, 0x0d, 0x10, 0x11,
405 static hda_nid_t stac922x_pin_nids[10] = {
406 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
407 0x0f, 0x10, 0x11, 0x15, 0x1b,
410 static hda_nid_t stac92hd73xx_pin_nids[13] = {
411 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
412 0x0f, 0x10, 0x11, 0x12, 0x13,
416 static hda_nid_t stac92hd83xxx_pin_nids[14] = {
417 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
418 0x0f, 0x10, 0x11, 0x12, 0x13,
419 0x1d, 0x1e, 0x1f, 0x20
421 static hda_nid_t stac92hd71bxx_pin_nids[10] = {
422 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
423 0x0f, 0x14, 0x18, 0x19, 0x1e,
426 static hda_nid_t stac927x_pin_nids[14] = {
427 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
428 0x0f, 0x10, 0x11, 0x12, 0x13,
429 0x14, 0x21, 0x22, 0x23,
432 static hda_nid_t stac9205_pin_nids[12] = {
433 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
434 0x0f, 0x14, 0x16, 0x17, 0x18,
438 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
439 struct snd_ctl_elem_info *uinfo)
441 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
442 struct sigmatel_spec *spec = codec->spec;
443 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
446 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_value *ucontrol)
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct sigmatel_spec *spec = codec->spec;
451 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
453 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
457 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
458 struct snd_ctl_elem_value *ucontrol)
460 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
461 struct sigmatel_spec *spec = codec->spec;
462 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
464 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
465 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
468 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct sigmatel_spec *spec = codec->spec;
473 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
476 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
477 struct snd_ctl_elem_value *ucontrol)
479 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
480 struct sigmatel_spec *spec = codec->spec;
481 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
483 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
487 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct sigmatel_spec *spec = codec->spec;
492 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
494 return snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
495 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
498 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
500 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
501 struct sigmatel_spec *spec = codec->spec;
502 return snd_hda_input_mux_info(spec->input_mux, uinfo);
505 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
507 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
508 struct sigmatel_spec *spec = codec->spec;
509 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
511 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
515 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
518 struct sigmatel_spec *spec = codec->spec;
519 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
521 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
522 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
525 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_info *uinfo)
528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
529 struct sigmatel_spec *spec = codec->spec;
530 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
533 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
534 struct snd_ctl_elem_value *ucontrol)
536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
537 struct sigmatel_spec *spec = codec->spec;
539 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
543 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 struct sigmatel_spec *spec = codec->spec;
549 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
550 spec->mono_nid, &spec->cur_mmux);
553 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
555 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
556 struct snd_ctl_elem_value *ucontrol)
558 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
559 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
560 struct sigmatel_spec *spec = codec->spec;
562 ucontrol->value.integer.value[0] = !!(spec->aloopback &
563 (spec->aloopback_mask << idx));
567 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
571 struct sigmatel_spec *spec = codec->spec;
572 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
573 unsigned int dac_mode;
574 unsigned int val, idx_val;
576 idx_val = spec->aloopback_mask << idx;
577 if (ucontrol->value.integer.value[0])
578 val = spec->aloopback | idx_val;
580 val = spec->aloopback & ~idx_val;
581 if (spec->aloopback == val)
584 spec->aloopback = val;
586 /* Only return the bits defined by the shift value of the
587 * first two bytes of the mask
589 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
590 kcontrol->private_value & 0xFFFF, 0x0);
591 dac_mode >>= spec->aloopback_shift;
593 if (spec->aloopback & idx_val) {
594 snd_hda_power_up(codec);
597 snd_hda_power_down(codec);
598 dac_mode &= ~idx_val;
601 snd_hda_codec_write_cache(codec, codec->afg, 0,
602 kcontrol->private_value >> 16, dac_mode);
607 static struct hda_verb stac9200_core_init[] = {
608 /* set dac0mux for dac converter */
609 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
613 static struct hda_verb stac9200_eapd_init[] = {
614 /* set dac0mux for dac converter */
615 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
616 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
620 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
621 /* set master volume and direct control */
622 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
623 /* setup audio connections */
624 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
625 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
626 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
627 /* setup adcs to point to mixer */
628 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
629 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
630 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
631 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
632 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
633 /* setup import muxs */
634 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
635 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
636 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
637 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
641 static struct hda_verb dell_eq_core_init[] = {
642 /* set master volume to max value without distortion
643 * and direct control */
644 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
645 /* setup audio connections */
646 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
647 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
648 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
649 /* setup adcs to point to mixer */
650 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
651 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
652 /* setup import muxs */
653 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
654 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
655 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
656 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
660 static struct hda_verb dell_m6_core_init[] = {
661 /* set master volume to max value without distortion
662 * and direct control */
663 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
664 /* setup audio connections */
665 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
666 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
667 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
668 /* setup adcs to point to mixer */
669 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
670 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
671 /* setup import muxs */
672 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
673 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
674 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
675 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
679 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
680 /* set master volume and direct control */
681 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
682 /* setup audio connections */
683 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
684 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
685 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
686 /* connect hp ports to dac3 */
687 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
688 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
689 /* setup adcs to point to mixer */
690 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
691 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
692 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
693 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
694 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
695 /* setup import muxs */
696 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
697 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
698 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
699 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
703 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
704 /* set master volume and direct control */
705 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
706 /* setup audio connections */
707 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
708 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
709 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
710 /* dac3 is connected to import3 mux */
711 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
712 /* connect hp ports to dac4 */
713 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
714 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
715 /* setup adcs to point to mixer */
716 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
717 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
718 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
719 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
720 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
721 /* setup import muxs */
722 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
723 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
724 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
725 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
729 static struct hda_verb stac92hd83xxx_core_init[] = {
730 /* start of config #1 */
731 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
733 /* start of config #2 */
734 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
735 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
736 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
738 /* power state controls amps */
739 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
742 static struct hda_verb stac92hd71bxx_core_init[] = {
743 /* set master volume and direct control */
744 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
745 /* connect headphone jack to dac1 */
746 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
747 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
748 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
749 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
750 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
751 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
754 #define HD_DISABLE_PORTF 3
755 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
756 /* start of config #1 */
758 /* connect port 0f to audio mixer */
759 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
760 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
761 /* unmute right and left channels for node 0x0f */
762 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
763 /* start of config #2 */
765 /* set master volume and direct control */
766 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
767 /* connect headphone jack to dac1 */
768 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
769 /* connect port 0d to audio mixer */
770 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
771 /* unmute dac0 input in audio mixer */
772 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
773 /* unmute right and left channels for nodes 0x0a, 0xd */
774 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
775 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
779 static struct hda_verb stac925x_core_init[] = {
780 /* set dac0mux for dac converter */
781 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
785 static struct hda_verb stac922x_core_init[] = {
786 /* set master volume and direct control */
787 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
791 static struct hda_verb d965_core_init[] = {
792 /* set master volume and direct control */
793 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
794 /* unmute node 0x1b */
795 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
796 /* select node 0x03 as DAC */
797 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
801 static struct hda_verb stac927x_core_init[] = {
802 /* set master volume and direct control */
803 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
804 /* enable analog pc beep path */
805 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
809 static struct hda_verb stac9205_core_init[] = {
810 /* set master volume and direct control */
811 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
812 /* enable analog pc beep path */
813 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
817 #define STAC_MONO_MUX \
819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
820 .name = "Mono Mux", \
822 .info = stac92xx_mono_mux_enum_info, \
823 .get = stac92xx_mono_mux_enum_get, \
824 .put = stac92xx_mono_mux_enum_put, \
827 #define STAC_INPUT_SOURCE(cnt) \
829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
830 .name = "Input Source", \
832 .info = stac92xx_mux_enum_info, \
833 .get = stac92xx_mux_enum_get, \
834 .put = stac92xx_mux_enum_put, \
837 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
839 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
840 .name = "Analog Loopback", \
842 .info = stac92xx_aloopback_info, \
843 .get = stac92xx_aloopback_get, \
844 .put = stac92xx_aloopback_put, \
845 .private_value = verb_read | (verb_write << 16), \
848 static struct snd_kcontrol_new stac9200_mixer[] = {
849 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
850 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
851 STAC_INPUT_SOURCE(1),
852 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
853 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
857 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
858 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
860 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
861 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
863 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
864 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
866 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
867 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
869 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
870 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
872 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
873 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
875 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
876 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
878 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
879 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
883 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
884 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
886 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
887 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
889 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
890 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
892 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
893 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
895 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
896 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
898 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
899 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
901 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
902 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
904 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
905 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
909 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
910 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
912 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
913 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
915 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
916 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
918 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
919 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
921 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
922 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
924 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
925 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
927 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
928 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
930 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
931 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
936 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
937 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
938 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
940 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
941 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
943 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT),
944 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT),
946 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT),
947 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT),
949 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT),
950 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT),
952 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT),
953 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT),
956 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
957 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
962 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
963 STAC_INPUT_SOURCE(2),
965 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
966 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
968 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
969 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
970 /* analog pc-beep replaced with digital beep support */
972 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
973 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
976 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
977 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
981 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
982 STAC_INPUT_SOURCE(2),
983 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
985 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
986 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
988 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
989 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
993 static struct snd_kcontrol_new stac925x_mixer[] = {
994 STAC_INPUT_SOURCE(1),
995 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
996 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
1000 static struct snd_kcontrol_new stac9205_mixer[] = {
1001 STAC_INPUT_SOURCE(2),
1002 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1004 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1005 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1007 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1008 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1012 /* This needs to be generated dynamically based on sequence */
1013 static struct snd_kcontrol_new stac922x_mixer[] = {
1014 STAC_INPUT_SOURCE(2),
1015 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1016 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1018 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1019 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1024 static struct snd_kcontrol_new stac927x_mixer[] = {
1025 STAC_INPUT_SOURCE(3),
1026 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1028 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1029 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1031 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1032 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1034 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1035 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1039 static struct snd_kcontrol_new stac_dmux_mixer = {
1040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1041 .name = "Digital Input Source",
1042 /* count set later */
1043 .info = stac92xx_dmux_enum_info,
1044 .get = stac92xx_dmux_enum_get,
1045 .put = stac92xx_dmux_enum_put,
1048 static struct snd_kcontrol_new stac_smux_mixer = {
1049 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1050 .name = "IEC958 Mux",
1051 /* count set later */
1052 .info = stac92xx_smux_enum_info,
1053 .get = stac92xx_smux_enum_get,
1054 .put = stac92xx_smux_enum_put,
1057 static const char *slave_vols[] = {
1058 "Front Playback Volume",
1059 "Surround Playback Volume",
1060 "Center Playback Volume",
1061 "LFE Playback Volume",
1062 "Side Playback Volume",
1063 "Headphone Playback Volume",
1064 "Headphone Playback Volume",
1065 "Speaker Playback Volume",
1066 "External Speaker Playback Volume",
1067 "Speaker2 Playback Volume",
1071 static const char *slave_sws[] = {
1072 "Front Playback Switch",
1073 "Surround Playback Switch",
1074 "Center Playback Switch",
1075 "LFE Playback Switch",
1076 "Side Playback Switch",
1077 "Headphone Playback Switch",
1078 "Headphone Playback Switch",
1079 "Speaker Playback Switch",
1080 "External Speaker Playback Switch",
1081 "Speaker2 Playback Switch",
1082 "IEC958 Playback Switch",
1086 static int stac92xx_build_controls(struct hda_codec *codec)
1088 struct sigmatel_spec *spec = codec->spec;
1092 err = snd_hda_add_new_ctls(codec, spec->mixer);
1096 for (i = 0; i < spec->num_mixers; i++) {
1097 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1101 if (spec->num_dmuxes > 0) {
1102 stac_dmux_mixer.count = spec->num_dmuxes;
1103 err = snd_ctl_add(codec->bus->card,
1104 snd_ctl_new1(&stac_dmux_mixer, codec));
1108 if (spec->num_smuxes > 0) {
1109 stac_smux_mixer.count = spec->num_smuxes;
1110 err = snd_ctl_add(codec->bus->card,
1111 snd_ctl_new1(&stac_smux_mixer, codec));
1116 if (spec->multiout.dig_out_nid) {
1117 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1120 err = snd_hda_create_spdif_share_sw(codec,
1124 spec->multiout.share_spdif = 1;
1126 if (spec->dig_in_nid) {
1127 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1132 /* if we have no master control, let's create it */
1133 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1134 unsigned int vmaster_tlv[4];
1135 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1136 HDA_OUTPUT, vmaster_tlv);
1137 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1138 vmaster_tlv, slave_vols);
1142 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1143 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1152 static unsigned int ref9200_pin_configs[8] = {
1153 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1154 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1158 STAC 9200 pin configs for
1163 static unsigned int dell9200_d21_pin_configs[8] = {
1164 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1165 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1169 STAC 9200 pin configs for
1173 static unsigned int dell9200_d22_pin_configs[8] = {
1174 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1175 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1179 STAC 9200 pin configs for
1180 102801C4 (Dell Dimension E310)
1187 static unsigned int dell9200_d23_pin_configs[8] = {
1188 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1189 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1194 STAC 9200-32 pin configs for
1195 102801B5 (Dell Inspiron 630m)
1196 102801D8 (Dell Inspiron 640m)
1198 static unsigned int dell9200_m21_pin_configs[8] = {
1199 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1200 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1204 STAC 9200-32 pin configs for
1205 102801C2 (Dell Latitude D620)
1207 102801CC (Dell Latitude D820)
1211 static unsigned int dell9200_m22_pin_configs[8] = {
1212 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1213 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1217 STAC 9200-32 pin configs for
1218 102801CE (Dell XPS M1710)
1219 102801CF (Dell Precision M90)
1221 static unsigned int dell9200_m23_pin_configs[8] = {
1222 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1223 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1227 STAC 9200-32 pin configs for
1230 102801CB (Dell Latitude 120L)
1233 static unsigned int dell9200_m24_pin_configs[8] = {
1234 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1235 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1239 STAC 9200-32 pin configs for
1240 102801BD (Dell Inspiron E1505n)
1244 static unsigned int dell9200_m25_pin_configs[8] = {
1245 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1246 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1250 STAC 9200-32 pin configs for
1251 102801F5 (Dell Inspiron 1501)
1254 static unsigned int dell9200_m26_pin_configs[8] = {
1255 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1256 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1261 102801CD (Dell Inspiron E1705/9400)
1263 static unsigned int dell9200_m27_pin_configs[8] = {
1264 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1265 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1268 static unsigned int oqo9200_pin_configs[8] = {
1269 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1270 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1274 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1275 [STAC_REF] = ref9200_pin_configs,
1276 [STAC_9200_OQO] = oqo9200_pin_configs,
1277 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1278 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1279 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1280 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1281 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1282 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1283 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1284 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1285 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1286 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1287 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1290 static const char *stac9200_models[STAC_9200_MODELS] = {
1292 [STAC_9200_OQO] = "oqo",
1293 [STAC_9200_DELL_D21] = "dell-d21",
1294 [STAC_9200_DELL_D22] = "dell-d22",
1295 [STAC_9200_DELL_D23] = "dell-d23",
1296 [STAC_9200_DELL_M21] = "dell-m21",
1297 [STAC_9200_DELL_M22] = "dell-m22",
1298 [STAC_9200_DELL_M23] = "dell-m23",
1299 [STAC_9200_DELL_M24] = "dell-m24",
1300 [STAC_9200_DELL_M25] = "dell-m25",
1301 [STAC_9200_DELL_M26] = "dell-m26",
1302 [STAC_9200_DELL_M27] = "dell-m27",
1303 [STAC_9200_GATEWAY] = "gateway",
1304 [STAC_9200_PANASONIC] = "panasonic",
1307 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1308 /* SigmaTel reference board */
1309 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1310 "DFI LanParty", STAC_REF),
1311 /* Dell laptops have BIOS problem */
1312 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1313 "unknown Dell", STAC_9200_DELL_D21),
1314 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1315 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1316 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1317 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1318 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1319 "unknown Dell", STAC_9200_DELL_D22),
1320 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1321 "unknown Dell", STAC_9200_DELL_D22),
1322 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1323 "Dell Latitude D620", STAC_9200_DELL_M22),
1324 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1325 "unknown Dell", STAC_9200_DELL_D23),
1326 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1327 "unknown Dell", STAC_9200_DELL_D23),
1328 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1329 "unknown Dell", STAC_9200_DELL_M22),
1330 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1331 "unknown Dell", STAC_9200_DELL_M24),
1332 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1333 "unknown Dell", STAC_9200_DELL_M24),
1334 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1335 "Dell Latitude 120L", STAC_9200_DELL_M24),
1336 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1337 "Dell Latitude D820", STAC_9200_DELL_M22),
1338 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1339 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1340 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1341 "Dell XPS M1710", STAC_9200_DELL_M23),
1342 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1343 "Dell Precision M90", STAC_9200_DELL_M23),
1344 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1345 "unknown Dell", STAC_9200_DELL_M22),
1346 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1347 "unknown Dell", STAC_9200_DELL_M22),
1348 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1349 "unknown Dell", STAC_9200_DELL_M22),
1350 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1351 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1352 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1353 "unknown Dell", STAC_9200_DELL_D23),
1354 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1355 "unknown Dell", STAC_9200_DELL_D23),
1356 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1357 "unknown Dell", STAC_9200_DELL_D21),
1358 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1359 "unknown Dell", STAC_9200_DELL_D23),
1360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1361 "unknown Dell", STAC_9200_DELL_D21),
1362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1363 "unknown Dell", STAC_9200_DELL_M25),
1364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1365 "unknown Dell", STAC_9200_DELL_M25),
1366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1367 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1368 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1369 "unknown Dell", STAC_9200_DELL_M26),
1371 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1372 /* Gateway machines needs EAPD to be set on resume */
1373 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1374 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1376 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1379 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1383 static unsigned int ref925x_pin_configs[8] = {
1384 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1385 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1388 static unsigned int stac925x_MA6_pin_configs[8] = {
1389 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1390 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1393 static unsigned int stac925x_PA6_pin_configs[8] = {
1394 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1395 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1398 static unsigned int stac925xM2_2_pin_configs[8] = {
1399 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1400 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1403 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1404 [STAC_REF] = ref925x_pin_configs,
1405 [STAC_M2_2] = stac925xM2_2_pin_configs,
1406 [STAC_MA6] = stac925x_MA6_pin_configs,
1407 [STAC_PA6] = stac925x_PA6_pin_configs,
1410 static const char *stac925x_models[STAC_925x_MODELS] = {
1412 [STAC_M2_2] = "m2-2",
1417 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1418 /* SigmaTel reference board */
1419 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1420 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1421 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1422 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1423 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1424 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1425 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1429 static unsigned int ref92hd73xx_pin_configs[13] = {
1430 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1431 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1432 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1436 static unsigned int dell_m6_pin_configs[13] = {
1437 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1438 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1439 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1443 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1444 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1445 [STAC_DELL_M6] = dell_m6_pin_configs,
1448 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1449 [STAC_92HD73XX_REF] = "ref",
1450 [STAC_DELL_M6] = "dell-m6",
1453 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1454 /* SigmaTel reference board */
1455 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1456 "DFI LanParty", STAC_92HD73XX_REF),
1457 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1458 "unknown Dell", STAC_DELL_M6),
1459 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1460 "unknown Dell", STAC_DELL_M6),
1461 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1462 "unknown Dell", STAC_DELL_M6),
1463 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1464 "unknown Dell", STAC_DELL_M6),
1465 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1466 "unknown Dell", STAC_DELL_M6),
1467 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1468 "unknown Dell", STAC_DELL_M6),
1469 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1470 "unknown Dell", STAC_DELL_M6),
1474 static unsigned int ref92hd83xxx_pin_configs[14] = {
1475 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1476 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1477 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1478 0x01451160, 0x98560170,
1481 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1482 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1485 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1486 [STAC_92HD83XXX_REF] = "ref",
1489 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1490 /* SigmaTel reference board */
1491 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1492 "DFI LanParty", STAC_92HD71BXX_REF),
1495 static unsigned int ref92hd71bxx_pin_configs[10] = {
1496 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1497 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1498 0x90a000f0, 0x01452050,
1501 static unsigned int dell_m4_1_pin_configs[10] = {
1502 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1503 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1504 0x40f000f0, 0x4f0000f0,
1507 static unsigned int dell_m4_2_pin_configs[10] = {
1508 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1509 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1510 0x40f000f0, 0x044413b0,
1513 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1514 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1515 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1516 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1519 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1520 [STAC_92HD71BXX_REF] = "ref",
1521 [STAC_DELL_M4_1] = "dell-m4-1",
1522 [STAC_DELL_M4_2] = "dell-m4-2",
1525 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1526 /* SigmaTel reference board */
1527 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1528 "DFI LanParty", STAC_92HD71BXX_REF),
1529 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1530 "unknown Dell", STAC_DELL_M4_1),
1531 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1532 "unknown Dell", STAC_DELL_M4_1),
1533 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1534 "unknown Dell", STAC_DELL_M4_1),
1535 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1536 "unknown Dell", STAC_DELL_M4_1),
1537 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1538 "unknown Dell", STAC_DELL_M4_1),
1539 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1540 "unknown Dell", STAC_DELL_M4_1),
1541 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1542 "unknown Dell", STAC_DELL_M4_1),
1543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1544 "unknown Dell", STAC_DELL_M4_2),
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1546 "unknown Dell", STAC_DELL_M4_2),
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1548 "unknown Dell", STAC_DELL_M4_2),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1550 "unknown Dell", STAC_DELL_M4_2),
1554 static unsigned int ref922x_pin_configs[10] = {
1555 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1556 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1557 0x40000100, 0x40000100,
1561 STAC 922X pin configs for
1568 static unsigned int dell_922x_d81_pin_configs[10] = {
1569 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1570 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1571 0x01813122, 0x400001f2,
1575 STAC 922X pin configs for
1579 static unsigned int dell_922x_d82_pin_configs[10] = {
1580 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1581 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1582 0x01813122, 0x400001f1,
1586 STAC 922X pin configs for
1589 static unsigned int dell_922x_m81_pin_configs[10] = {
1590 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1591 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1592 0x40C003f1, 0x405003f0,
1596 STAC 9221 A1 pin configs for
1597 102801D7 (Dell XPS M1210)
1599 static unsigned int dell_922x_m82_pin_configs[10] = {
1600 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1601 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1602 0x508003f3, 0x405003f4,
1605 static unsigned int d945gtp3_pin_configs[10] = {
1606 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1607 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1608 0x02a19120, 0x40000100,
1611 static unsigned int d945gtp5_pin_configs[10] = {
1612 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1613 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1614 0x02a19320, 0x40000100,
1617 static unsigned int intel_mac_v1_pin_configs[10] = {
1618 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1619 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1620 0x400000fc, 0x400000fb,
1623 static unsigned int intel_mac_v2_pin_configs[10] = {
1624 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1625 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1626 0x400000fc, 0x400000fb,
1629 static unsigned int intel_mac_v3_pin_configs[10] = {
1630 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1631 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1632 0x400000fc, 0x400000fb,
1635 static unsigned int intel_mac_v4_pin_configs[10] = {
1636 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1637 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1638 0x400000fc, 0x400000fb,
1641 static unsigned int intel_mac_v5_pin_configs[10] = {
1642 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1643 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1644 0x400000fc, 0x400000fb,
1647 static unsigned int ecs202_pin_configs[10] = {
1648 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1649 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1650 0x9037012e, 0x40e000f2,
1653 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1654 [STAC_D945_REF] = ref922x_pin_configs,
1655 [STAC_D945GTP3] = d945gtp3_pin_configs,
1656 [STAC_D945GTP5] = d945gtp5_pin_configs,
1657 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1658 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1659 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1660 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1661 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1662 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1663 /* for backward compatibility */
1664 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1665 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1666 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1667 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1668 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1669 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1670 [STAC_ECS_202] = ecs202_pin_configs,
1671 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1672 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1673 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1674 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1677 static const char *stac922x_models[STAC_922X_MODELS] = {
1678 [STAC_D945_REF] = "ref",
1679 [STAC_D945GTP5] = "5stack",
1680 [STAC_D945GTP3] = "3stack",
1681 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1682 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1683 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1684 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1685 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1686 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1687 /* for backward compatibility */
1688 [STAC_MACMINI] = "macmini",
1689 [STAC_MACBOOK] = "macbook",
1690 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1691 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1692 [STAC_IMAC_INTEL] = "imac-intel",
1693 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1694 [STAC_ECS_202] = "ecs202",
1695 [STAC_922X_DELL_D81] = "dell-d81",
1696 [STAC_922X_DELL_D82] = "dell-d82",
1697 [STAC_922X_DELL_M81] = "dell-m81",
1698 [STAC_922X_DELL_M82] = "dell-m82",
1701 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1702 /* SigmaTel reference board */
1703 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1704 "DFI LanParty", STAC_D945_REF),
1705 /* Intel 945G based systems */
1706 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1707 "Intel D945G", STAC_D945GTP3),
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1709 "Intel D945G", STAC_D945GTP3),
1710 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1711 "Intel D945G", STAC_D945GTP3),
1712 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1713 "Intel D945G", STAC_D945GTP3),
1714 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1715 "Intel D945G", STAC_D945GTP3),
1716 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1717 "Intel D945G", STAC_D945GTP3),
1718 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1719 "Intel D945G", STAC_D945GTP3),
1720 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1721 "Intel D945G", STAC_D945GTP3),
1722 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1723 "Intel D945G", STAC_D945GTP3),
1724 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1725 "Intel D945G", STAC_D945GTP3),
1726 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1727 "Intel D945G", STAC_D945GTP3),
1728 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1729 "Intel D945G", STAC_D945GTP3),
1730 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1731 "Intel D945G", STAC_D945GTP3),
1732 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1733 "Intel D945G", STAC_D945GTP3),
1734 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1735 "Intel D945G", STAC_D945GTP3),
1736 /* Intel D945G 5-stack systems */
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1738 "Intel D945G", STAC_D945GTP5),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1740 "Intel D945G", STAC_D945GTP5),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1742 "Intel D945G", STAC_D945GTP5),
1743 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1744 "Intel D945G", STAC_D945GTP5),
1745 /* Intel 945P based systems */
1746 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1747 "Intel D945P", STAC_D945GTP3),
1748 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1749 "Intel D945P", STAC_D945GTP3),
1750 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1751 "Intel D945P", STAC_D945GTP3),
1752 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1753 "Intel D945P", STAC_D945GTP3),
1754 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1755 "Intel D945P", STAC_D945GTP3),
1756 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
1757 "Intel D945P", STAC_D945GTP5),
1759 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1760 SND_PCI_QUIRK(0x8384, 0x7680,
1761 "Mac", STAC_INTEL_MAC_AUTO),
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
1764 "unknown Dell", STAC_922X_DELL_D81),
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
1766 "unknown Dell", STAC_922X_DELL_D81),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
1768 "unknown Dell", STAC_922X_DELL_D81),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
1770 "unknown Dell", STAC_922X_DELL_D82),
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
1772 "unknown Dell", STAC_922X_DELL_M81),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1774 "unknown Dell", STAC_922X_DELL_D82),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1776 "unknown Dell", STAC_922X_DELL_D81),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1778 "unknown Dell", STAC_922X_DELL_D81),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1780 "Dell XPS M1210", STAC_922X_DELL_M82),
1781 /* ECS/PC Chips boards */
1782 SND_PCI_QUIRK(0x1019, 0x2144,
1783 "ECS/PC chips", STAC_ECS_202),
1784 SND_PCI_QUIRK(0x1019, 0x2608,
1785 "ECS/PC chips", STAC_ECS_202),
1786 SND_PCI_QUIRK(0x1019, 0x2633,
1787 "ECS/PC chips P17G/1333", STAC_ECS_202),
1788 SND_PCI_QUIRK(0x1019, 0x2811,
1789 "ECS/PC chips", STAC_ECS_202),
1790 SND_PCI_QUIRK(0x1019, 0x2812,
1791 "ECS/PC chips", STAC_ECS_202),
1792 SND_PCI_QUIRK(0x1019, 0x2813,
1793 "ECS/PC chips", STAC_ECS_202),
1794 SND_PCI_QUIRK(0x1019, 0x2814,
1795 "ECS/PC chips", STAC_ECS_202),
1796 SND_PCI_QUIRK(0x1019, 0x2815,
1797 "ECS/PC chips", STAC_ECS_202),
1798 SND_PCI_QUIRK(0x1019, 0x2816,
1799 "ECS/PC chips", STAC_ECS_202),
1800 SND_PCI_QUIRK(0x1019, 0x2817,
1801 "ECS/PC chips", STAC_ECS_202),
1802 SND_PCI_QUIRK(0x1019, 0x2818,
1803 "ECS/PC chips", STAC_ECS_202),
1804 SND_PCI_QUIRK(0x1019, 0x2819,
1805 "ECS/PC chips", STAC_ECS_202),
1806 SND_PCI_QUIRK(0x1019, 0x2820,
1807 "ECS/PC chips", STAC_ECS_202),
1811 static unsigned int ref927x_pin_configs[14] = {
1812 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1813 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1814 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1815 0x01c42190, 0x40000100,
1818 static unsigned int d965_3st_pin_configs[14] = {
1819 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1820 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1821 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1822 0x40000100, 0x40000100
1825 static unsigned int d965_5st_pin_configs[14] = {
1826 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1827 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1828 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1829 0x40000100, 0x40000100
1832 static unsigned int dell_3st_pin_configs[14] = {
1833 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1834 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1835 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1836 0x40c003fc, 0x40000100
1839 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1840 [STAC_D965_REF] = ref927x_pin_configs,
1841 [STAC_D965_3ST] = d965_3st_pin_configs,
1842 [STAC_D965_5ST] = d965_5st_pin_configs,
1843 [STAC_DELL_3ST] = dell_3st_pin_configs,
1844 [STAC_DELL_BIOS] = NULL,
1847 static const char *stac927x_models[STAC_927X_MODELS] = {
1848 [STAC_D965_REF] = "ref",
1849 [STAC_D965_3ST] = "3stack",
1850 [STAC_D965_5ST] = "5stack",
1851 [STAC_DELL_3ST] = "dell-3stack",
1852 [STAC_DELL_BIOS] = "dell-bios",
1855 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1856 /* SigmaTel reference board */
1857 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1858 "DFI LanParty", STAC_D965_REF),
1859 /* Intel 946 based systems */
1860 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1861 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1862 /* 965 based 3 stack systems */
1863 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1864 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1865 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1866 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1867 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1868 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1869 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1870 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1871 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1872 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1873 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1874 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1875 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1877 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1879 /* Dell 3 stack systems */
1880 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
1881 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1882 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1883 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1884 /* Dell 3 stack systems with verb table in BIOS */
1885 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1886 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1887 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1888 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
1889 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1890 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1891 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
1892 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
1893 /* 965 based 5 stack systems */
1894 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1895 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1896 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1897 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1898 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1899 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1900 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1901 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1902 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1906 static unsigned int ref9205_pin_configs[12] = {
1907 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1908 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1909 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1913 STAC 9205 pin configs for
1920 10280228 (Dell Vostro 1500)
1922 static unsigned int dell_9205_m42_pin_configs[12] = {
1923 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1924 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1925 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1929 STAC 9205 pin configs for
1933 102801FF (Dell Precision M4300)
1938 static unsigned int dell_9205_m43_pin_configs[12] = {
1939 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1940 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1941 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1944 static unsigned int dell_9205_m44_pin_configs[12] = {
1945 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1946 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1947 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1950 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1951 [STAC_9205_REF] = ref9205_pin_configs,
1952 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1953 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1954 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1957 static const char *stac9205_models[STAC_9205_MODELS] = {
1958 [STAC_9205_REF] = "ref",
1959 [STAC_9205_DELL_M42] = "dell-m42",
1960 [STAC_9205_DELL_M43] = "dell-m43",
1961 [STAC_9205_DELL_M44] = "dell-m44",
1964 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1965 /* SigmaTel reference board */
1966 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1967 "DFI LanParty", STAC_9205_REF),
1968 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1969 "unknown Dell", STAC_9205_DELL_M42),
1970 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1971 "unknown Dell", STAC_9205_DELL_M42),
1972 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1973 "Dell Precision", STAC_9205_DELL_M43),
1974 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1975 "Dell Precision", STAC_9205_DELL_M43),
1976 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1977 "Dell Precision", STAC_9205_DELL_M43),
1978 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1979 "unknown Dell", STAC_9205_DELL_M42),
1980 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1981 "unknown Dell", STAC_9205_DELL_M42),
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1983 "Dell Precision", STAC_9205_DELL_M43),
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1985 "Dell Precision M4300", STAC_9205_DELL_M43),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1987 "unknown Dell", STAC_9205_DELL_M42),
1988 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1989 "Dell Precision", STAC_9205_DELL_M43),
1990 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1991 "Dell Precision", STAC_9205_DELL_M43),
1992 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1993 "Dell Precision", STAC_9205_DELL_M43),
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1995 "Dell Inspiron", STAC_9205_DELL_M44),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
1997 "Dell Vostro 1500", STAC_9205_DELL_M42),
2001 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
2004 struct sigmatel_spec *spec = codec->spec;
2006 if (! spec->bios_pin_configs) {
2007 spec->bios_pin_configs = kcalloc(spec->num_pins,
2008 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
2009 if (! spec->bios_pin_configs)
2013 for (i = 0; i < spec->num_pins; i++) {
2014 hda_nid_t nid = spec->pin_nids[i];
2015 unsigned int pin_cfg;
2017 pin_cfg = snd_hda_codec_read(codec, nid, 0,
2018 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
2019 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
2021 spec->bios_pin_configs[i] = pin_cfg;
2027 static void stac92xx_set_config_reg(struct hda_codec *codec,
2028 hda_nid_t pin_nid, unsigned int pin_config)
2031 snd_hda_codec_write(codec, pin_nid, 0,
2032 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2033 pin_config & 0x000000ff);
2034 snd_hda_codec_write(codec, pin_nid, 0,
2035 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2036 (pin_config & 0x0000ff00) >> 8);
2037 snd_hda_codec_write(codec, pin_nid, 0,
2038 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2039 (pin_config & 0x00ff0000) >> 16);
2040 snd_hda_codec_write(codec, pin_nid, 0,
2041 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2043 i = snd_hda_codec_read(codec, pin_nid, 0,
2044 AC_VERB_GET_CONFIG_DEFAULT,
2046 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
2050 static void stac92xx_set_config_regs(struct hda_codec *codec)
2053 struct sigmatel_spec *spec = codec->spec;
2055 if (!spec->pin_configs)
2058 for (i = 0; i < spec->num_pins; i++)
2059 stac92xx_set_config_reg(codec, spec->pin_nids[i],
2060 spec->pin_configs[i]);
2064 * Analog playback callbacks
2066 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2067 struct hda_codec *codec,
2068 struct snd_pcm_substream *substream)
2070 struct sigmatel_spec *spec = codec->spec;
2071 if (spec->stream_delay)
2072 msleep(spec->stream_delay);
2073 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2077 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2078 struct hda_codec *codec,
2079 unsigned int stream_tag,
2080 unsigned int format,
2081 struct snd_pcm_substream *substream)
2083 struct sigmatel_spec *spec = codec->spec;
2084 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2087 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2088 struct hda_codec *codec,
2089 struct snd_pcm_substream *substream)
2091 struct sigmatel_spec *spec = codec->spec;
2092 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2096 * Digital playback callbacks
2098 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2099 struct hda_codec *codec,
2100 struct snd_pcm_substream *substream)
2102 struct sigmatel_spec *spec = codec->spec;
2103 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2106 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2107 struct hda_codec *codec,
2108 struct snd_pcm_substream *substream)
2110 struct sigmatel_spec *spec = codec->spec;
2111 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2114 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2115 struct hda_codec *codec,
2116 unsigned int stream_tag,
2117 unsigned int format,
2118 struct snd_pcm_substream *substream)
2120 struct sigmatel_spec *spec = codec->spec;
2121 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2122 stream_tag, format, substream);
2127 * Analog capture callbacks
2129 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2130 struct hda_codec *codec,
2131 unsigned int stream_tag,
2132 unsigned int format,
2133 struct snd_pcm_substream *substream)
2135 struct sigmatel_spec *spec = codec->spec;
2136 hda_nid_t nid = spec->adc_nids[substream->number];
2138 if (spec->powerdown_adcs) {
2140 snd_hda_codec_write_cache(codec, nid, 0,
2141 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2143 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2147 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2148 struct hda_codec *codec,
2149 struct snd_pcm_substream *substream)
2151 struct sigmatel_spec *spec = codec->spec;
2152 hda_nid_t nid = spec->adc_nids[substream->number];
2154 snd_hda_codec_cleanup_stream(codec, nid);
2155 if (spec->powerdown_adcs)
2156 snd_hda_codec_write_cache(codec, nid, 0,
2157 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2161 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2165 /* NID is set in stac92xx_build_pcms */
2167 .open = stac92xx_dig_playback_pcm_open,
2168 .close = stac92xx_dig_playback_pcm_close,
2169 .prepare = stac92xx_dig_playback_pcm_prepare
2173 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2177 /* NID is set in stac92xx_build_pcms */
2180 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2184 .nid = 0x02, /* NID to query formats and rates */
2186 .open = stac92xx_playback_pcm_open,
2187 .prepare = stac92xx_playback_pcm_prepare,
2188 .cleanup = stac92xx_playback_pcm_cleanup
2192 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2196 .nid = 0x06, /* NID to query formats and rates */
2198 .open = stac92xx_playback_pcm_open,
2199 .prepare = stac92xx_playback_pcm_prepare,
2200 .cleanup = stac92xx_playback_pcm_cleanup
2204 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2207 /* NID + .substreams is set in stac92xx_build_pcms */
2209 .prepare = stac92xx_capture_pcm_prepare,
2210 .cleanup = stac92xx_capture_pcm_cleanup
2214 static int stac92xx_build_pcms(struct hda_codec *codec)
2216 struct sigmatel_spec *spec = codec->spec;
2217 struct hda_pcm *info = spec->pcm_rec;
2219 codec->num_pcms = 1;
2220 codec->pcm_info = info;
2222 info->name = "STAC92xx Analog";
2223 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2224 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2225 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2226 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2228 if (spec->alt_switch) {
2231 info->name = "STAC92xx Analog Alt";
2232 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2235 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2238 info->name = "STAC92xx Digital";
2239 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2240 if (spec->multiout.dig_out_nid) {
2241 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2242 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2244 if (spec->dig_in_nid) {
2245 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2246 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2253 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2255 unsigned int pincap = snd_hda_param_read(codec, nid,
2257 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2258 if (pincap & AC_PINCAP_VREF_100)
2259 return AC_PINCTL_VREF_100;
2260 if (pincap & AC_PINCAP_VREF_80)
2261 return AC_PINCTL_VREF_80;
2262 if (pincap & AC_PINCAP_VREF_50)
2263 return AC_PINCTL_VREF_50;
2264 if (pincap & AC_PINCAP_VREF_GRD)
2265 return AC_PINCTL_VREF_GRD;
2269 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2272 snd_hda_codec_write_cache(codec, nid, 0,
2273 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2276 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2278 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2279 struct snd_ctl_elem_value *ucontrol)
2281 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2282 struct sigmatel_spec *spec = codec->spec;
2284 ucontrol->value.integer.value[0] = spec->hp_switch;
2288 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2289 struct snd_ctl_elem_value *ucontrol)
2291 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2292 struct sigmatel_spec *spec = codec->spec;
2294 spec->hp_switch = ucontrol->value.integer.value[0];
2296 /* check to be sure that the ports are upto date with
2299 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2304 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2306 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2308 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2309 struct sigmatel_spec *spec = codec->spec;
2310 int io_idx = kcontrol-> private_value & 0xff;
2312 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2316 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2319 struct sigmatel_spec *spec = codec->spec;
2320 hda_nid_t nid = kcontrol->private_value >> 8;
2321 int io_idx = kcontrol-> private_value & 0xff;
2322 unsigned short val = !!ucontrol->value.integer.value[0];
2324 spec->io_switch[io_idx] = val;
2327 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2329 unsigned int pinctl = AC_PINCTL_IN_EN;
2330 if (io_idx) /* set VREF for mic */
2331 pinctl |= stac92xx_get_vref(codec, nid);
2332 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2335 /* check the auto-mute again: we need to mute/unmute the speaker
2336 * appropriately according to the pin direction
2338 if (spec->hp_detect)
2339 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2344 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2346 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2347 struct snd_ctl_elem_value *ucontrol)
2349 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2350 struct sigmatel_spec *spec = codec->spec;
2352 ucontrol->value.integer.value[0] = spec->clfe_swap;
2356 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2357 struct snd_ctl_elem_value *ucontrol)
2359 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2360 struct sigmatel_spec *spec = codec->spec;
2361 hda_nid_t nid = kcontrol->private_value & 0xff;
2362 unsigned int val = !!ucontrol->value.integer.value[0];
2364 if (spec->clfe_swap == val)
2367 spec->clfe_swap = val;
2369 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2370 spec->clfe_swap ? 0x4 : 0x0);
2375 #define STAC_CODEC_HP_SWITCH(xname) \
2376 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2379 .info = stac92xx_hp_switch_info, \
2380 .get = stac92xx_hp_switch_get, \
2381 .put = stac92xx_hp_switch_put, \
2384 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2385 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2388 .info = stac92xx_io_switch_info, \
2389 .get = stac92xx_io_switch_get, \
2390 .put = stac92xx_io_switch_put, \
2391 .private_value = xpval, \
2394 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2395 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2398 .info = stac92xx_clfe_switch_info, \
2399 .get = stac92xx_clfe_switch_get, \
2400 .put = stac92xx_clfe_switch_put, \
2401 .private_value = xpval, \
2405 STAC_CTL_WIDGET_VOL,
2406 STAC_CTL_WIDGET_MUTE,
2407 STAC_CTL_WIDGET_MONO_MUX,
2408 STAC_CTL_WIDGET_HP_SWITCH,
2409 STAC_CTL_WIDGET_IO_SWITCH,
2410 STAC_CTL_WIDGET_CLFE_SWITCH
2413 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2414 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2415 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2417 STAC_CODEC_HP_SWITCH(NULL),
2418 STAC_CODEC_IO_SWITCH(NULL, 0),
2419 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2422 /* add dynamic controls */
2423 static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type,
2424 int idx, const char *name, unsigned long val)
2426 struct snd_kcontrol_new *knew;
2428 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2429 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2431 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
2434 if (spec->kctl_alloc) {
2435 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
2436 kfree(spec->kctl_alloc);
2438 spec->kctl_alloc = knew;
2439 spec->num_kctl_alloc = num;
2442 knew = &spec->kctl_alloc[spec->num_kctl_used];
2443 *knew = stac92xx_control_templates[type];
2445 knew->name = kstrdup(name, GFP_KERNEL);
2448 knew->private_value = val;
2449 spec->num_kctl_used++;
2454 /* add dynamic controls */
2455 static int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2456 const char *name, unsigned long val)
2458 return stac92xx_add_control_idx(spec, type, 0, name, val);
2461 /* flag inputs as additional dynamic lineouts */
2462 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2464 struct sigmatel_spec *spec = codec->spec;
2465 unsigned int wcaps, wtype;
2466 int i, num_dacs = 0;
2468 /* use the wcaps cache to count all DACs available for line-outs */
2469 for (i = 0; i < codec->num_nodes; i++) {
2470 wcaps = codec->wcaps[i];
2471 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2473 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2477 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2479 switch (cfg->line_outs) {
2481 /* add line-in as side */
2482 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2483 cfg->line_out_pins[cfg->line_outs] =
2484 cfg->input_pins[AUTO_PIN_LINE];
2485 spec->line_switch = 1;
2490 /* add line-in as clfe and mic as side */
2491 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2492 cfg->line_out_pins[cfg->line_outs] =
2493 cfg->input_pins[AUTO_PIN_LINE];
2494 spec->line_switch = 1;
2497 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2498 cfg->line_out_pins[cfg->line_outs] =
2499 cfg->input_pins[AUTO_PIN_MIC];
2500 spec->mic_switch = 1;
2505 /* add line-in as surr and mic as clfe */
2506 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2507 cfg->line_out_pins[cfg->line_outs] =
2508 cfg->input_pins[AUTO_PIN_LINE];
2509 spec->line_switch = 1;
2512 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2513 cfg->line_out_pins[cfg->line_outs] =
2514 cfg->input_pins[AUTO_PIN_MIC];
2515 spec->mic_switch = 1;
2525 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2529 for (i = 0; i < spec->multiout.num_dacs; i++) {
2530 if (spec->multiout.dac_nids[i] == nid)
2538 * Fill in the dac_nids table from the parsed pin configuration
2539 * This function only works when every pin in line_out_pins[]
2540 * contains atleast one DAC in its connection list. Some 92xx
2541 * codecs are not connected directly to a DAC, such as the 9200
2542 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2544 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2545 struct auto_pin_cfg *cfg)
2547 struct sigmatel_spec *spec = codec->spec;
2548 int i, j, conn_len = 0;
2549 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2550 unsigned int wcaps, wtype;
2552 for (i = 0; i < cfg->line_outs; i++) {
2553 nid = cfg->line_out_pins[i];
2554 conn_len = snd_hda_get_connections(codec, nid, conn,
2555 HDA_MAX_CONNECTIONS);
2556 for (j = 0; j < conn_len; j++) {
2557 wcaps = snd_hda_param_read(codec, conn[j],
2558 AC_PAR_AUDIO_WIDGET_CAP);
2559 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2560 if (wtype != AC_WID_AUD_OUT ||
2561 (wcaps & AC_WCAP_DIGITAL))
2563 /* conn[j] is a DAC routed to this line-out */
2564 if (!is_in_dac_nids(spec, conn[j]))
2568 if (j == conn_len) {
2569 if (spec->multiout.num_dacs > 0) {
2570 /* we have already working output pins,
2571 * so let's drop the broken ones again
2573 cfg->line_outs = spec->multiout.num_dacs;
2576 /* error out, no available DAC found */
2578 "%s: No available DAC for pin 0x%x\n",
2583 spec->multiout.dac_nids[i] = conn[j];
2584 spec->multiout.num_dacs++;
2586 /* select this DAC in the pin's input mux */
2587 snd_hda_codec_write_cache(codec, nid, 0,
2588 AC_VERB_SET_CONNECT_SEL, j);
2593 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2594 spec->multiout.num_dacs,
2595 spec->multiout.dac_nids[0],
2596 spec->multiout.dac_nids[1],
2597 spec->multiout.dac_nids[2],
2598 spec->multiout.dac_nids[3],
2599 spec->multiout.dac_nids[4]);
2603 /* create volume control/switch for the given prefx type */
2604 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2609 sprintf(name, "%s Playback Volume", pfx);
2610 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2611 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2614 sprintf(name, "%s Playback Switch", pfx);
2615 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2616 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2622 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2624 if (!spec->multiout.hp_nid)
2625 spec->multiout.hp_nid = nid;
2626 else if (spec->multiout.num_dacs > 4) {
2627 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2630 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2631 spec->multiout.num_dacs++;
2636 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2638 if (is_in_dac_nids(spec, nid))
2640 if (spec->multiout.hp_nid == nid)
2645 /* add playback controls from the parsed DAC table */
2646 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2647 const struct auto_pin_cfg *cfg)
2649 static const char *chname[4] = {
2650 "Front", "Surround", NULL /*CLFE*/, "Side"
2655 struct sigmatel_spec *spec = codec->spec;
2656 unsigned int wid_caps, pincap;
2659 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2660 if (!spec->multiout.dac_nids[i])
2663 nid = spec->multiout.dac_nids[i];
2667 err = create_controls(spec, "Center", nid, 1);
2670 err = create_controls(spec, "LFE", nid, 2);
2674 wid_caps = get_wcaps(codec, nid);
2676 if (wid_caps & AC_WCAP_LR_SWAP) {
2677 err = stac92xx_add_control(spec,
2678 STAC_CTL_WIDGET_CLFE_SWITCH,
2679 "Swap Center/LFE Playback Switch", nid);
2686 err = create_controls(spec, chname[i], nid, 3);
2692 if (cfg->hp_outs > 1) {
2693 err = stac92xx_add_control(spec,
2694 STAC_CTL_WIDGET_HP_SWITCH,
2695 "Headphone as Line Out Switch", 0);
2700 if (spec->line_switch) {
2701 nid = cfg->input_pins[AUTO_PIN_LINE];
2702 pincap = snd_hda_param_read(codec, nid,
2704 if (pincap & AC_PINCAP_OUT) {
2705 err = stac92xx_add_control(spec,
2706 STAC_CTL_WIDGET_IO_SWITCH,
2707 "Line In as Output Switch", nid << 8);
2713 if (spec->mic_switch) {
2714 unsigned int def_conf;
2715 unsigned int mic_pin = AUTO_PIN_MIC;
2717 nid = cfg->input_pins[mic_pin];
2718 def_conf = snd_hda_codec_read(codec, nid, 0,
2719 AC_VERB_GET_CONFIG_DEFAULT, 0);
2720 /* some laptops have an internal analog microphone
2721 * which can't be used as a output */
2722 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2723 pincap = snd_hda_param_read(codec, nid,
2725 if (pincap & AC_PINCAP_OUT) {
2726 err = stac92xx_add_control(spec,
2727 STAC_CTL_WIDGET_IO_SWITCH,
2728 "Mic as Output Switch", (nid << 8) | 1);
2729 nid = snd_hda_codec_read(codec, nid, 0,
2730 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2731 if (!check_in_dac_nids(spec, nid))
2732 add_spec_dacs(spec, nid);
2736 } else if (mic_pin == AUTO_PIN_MIC) {
2737 mic_pin = AUTO_PIN_FRONT_MIC;
2745 /* add playback controls for Speaker and HP outputs */
2746 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
2747 struct auto_pin_cfg *cfg)
2749 struct sigmatel_spec *spec = codec->spec;
2751 int i, old_num_dacs, err;
2753 old_num_dacs = spec->multiout.num_dacs;
2754 for (i = 0; i < cfg->hp_outs; i++) {
2755 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
2756 if (wid_caps & AC_WCAP_UNSOL_CAP)
2757 spec->hp_detect = 1;
2758 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
2759 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2760 if (check_in_dac_nids(spec, nid))
2764 add_spec_dacs(spec, nid);
2766 for (i = 0; i < cfg->speaker_outs; i++) {
2767 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
2768 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2769 if (check_in_dac_nids(spec, nid))
2773 add_spec_dacs(spec, nid);
2775 for (i = 0; i < cfg->line_outs; i++) {
2776 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
2777 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2778 if (check_in_dac_nids(spec, nid))
2782 add_spec_dacs(spec, nid);
2784 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
2785 static const char *pfxs[] = {
2786 "Speaker", "External Speaker", "Speaker2",
2788 err = create_controls(spec, pfxs[i - old_num_dacs],
2789 spec->multiout.dac_nids[i], 3);
2793 if (spec->multiout.hp_nid) {
2794 err = create_controls(spec, "Headphone",
2795 spec->multiout.hp_nid, 3);
2803 /* labels for mono mux outputs */
2804 static const char *stac92xx_mono_labels[4] = {
2805 "DAC0", "DAC1", "Mixer", "DAC2"
2808 /* create mono mux for mono out on capable codecs */
2809 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
2811 struct sigmatel_spec *spec = codec->spec;
2812 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
2814 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
2816 num_cons = snd_hda_get_connections(codec,
2819 HDA_MAX_NUM_INPUTS);
2820 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
2823 for (i = 0; i < num_cons; i++) {
2824 mono_mux->items[mono_mux->num_items].label =
2825 stac92xx_mono_labels[i];
2826 mono_mux->items[mono_mux->num_items].index = i;
2827 mono_mux->num_items++;
2830 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
2831 "Mono Mux", spec->mono_nid);
2834 /* create PC beep volume controls */
2835 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
2838 struct sigmatel_spec *spec = codec->spec;
2839 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
2842 /* check for mute support for the the amp */
2843 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
2844 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2845 "PC Beep Playback Switch",
2846 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
2851 /* check to see if there is volume support for the amp */
2852 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
2853 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
2854 "PC Beep Playback Volume",
2855 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
2862 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
2864 struct sigmatel_spec *spec = codec->spec;
2865 int wcaps, nid, i, err = 0;
2867 for (i = 0; i < spec->num_muxes; i++) {
2868 nid = spec->mux_nids[i];
2869 wcaps = get_wcaps(codec, nid);
2871 if (wcaps & AC_WCAP_OUT_AMP) {
2872 err = stac92xx_add_control_idx(spec,
2873 STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume",
2874 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
2882 static const char *stac92xx_spdif_labels[3] = {
2883 "Digital Playback", "Analog Mux 1", "Analog Mux 2"
2886 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
2888 struct sigmatel_spec *spec = codec->spec;
2889 struct hda_input_mux *spdif_mux = &spec->private_smux;
2891 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_spdif_labels)];
2893 num_cons = snd_hda_get_connections(codec,
2896 HDA_MAX_NUM_INPUTS);
2897 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_spdif_labels))
2900 for (i = 0; i < num_cons; i++) {
2901 spdif_mux->items[spdif_mux->num_items].label =
2902 stac92xx_spdif_labels[i];
2903 spdif_mux->items[spdif_mux->num_items].index = i;
2904 spdif_mux->num_items++;
2910 /* labels for dmic mux inputs */
2911 static const char *stac92xx_dmic_labels[5] = {
2912 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2913 "Digital Mic 3", "Digital Mic 4"
2916 /* create playback/capture controls for input pins on dmic capable codecs */
2917 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2918 const struct auto_pin_cfg *cfg)
2920 struct sigmatel_spec *spec = codec->spec;
2921 struct hda_input_mux *dimux = &spec->private_dimux;
2922 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2926 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2927 dimux->items[dimux->num_items].index = 0;
2930 for (i = 0; i < spec->num_dmics; i++) {
2935 unsigned int def_conf;
2937 def_conf = snd_hda_codec_read(codec,
2940 AC_VERB_GET_CONFIG_DEFAULT,
2942 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2945 nid = spec->dmic_nids[i];
2946 num_cons = snd_hda_get_connections(codec,
2949 HDA_MAX_NUM_INPUTS);
2950 for (j = 0; j < num_cons; j++)
2951 if (con_lst[j] == nid) {
2957 wcaps = get_wcaps(codec, nid) &
2958 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
2961 sprintf(name, "%s Capture Volume",
2962 stac92xx_dmic_labels[dimux->num_items]);
2964 err = stac92xx_add_control(spec,
2965 STAC_CTL_WIDGET_VOL,
2967 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
2968 (wcaps & AC_WCAP_OUT_AMP) ?
2969 HDA_OUTPUT : HDA_INPUT));
2974 dimux->items[dimux->num_items].label =
2975 stac92xx_dmic_labels[dimux->num_items];
2976 dimux->items[dimux->num_items].index = index;
2983 /* create playback/capture controls for input pins */
2984 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
2986 struct sigmatel_spec *spec = codec->spec;
2987 struct hda_input_mux *imux = &spec->private_imux;
2988 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2991 for (i = 0; i < AUTO_PIN_LAST; i++) {
2994 if (!cfg->input_pins[i])
2997 for (j = 0; j < spec->num_muxes; j++) {
2999 num_cons = snd_hda_get_connections(codec,
3002 HDA_MAX_NUM_INPUTS);
3003 for (k = 0; k < num_cons; k++)
3004 if (con_lst[k] == cfg->input_pins[i]) {
3011 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
3012 imux->items[imux->num_items].index = index;
3016 if (imux->num_items) {
3018 * Set the current input for the muxes.
3019 * The STAC9221 has two input muxes with identical source
3020 * NID lists. Hopefully this won't get confused.
3022 for (i = 0; i < spec->num_muxes; i++) {
3023 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3024 AC_VERB_SET_CONNECT_SEL,
3025 imux->items[0].index);
3032 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3034 struct sigmatel_spec *spec = codec->spec;
3037 for (i = 0; i < spec->autocfg.line_outs; i++) {
3038 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3039 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3043 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3045 struct sigmatel_spec *spec = codec->spec;
3048 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3050 pin = spec->autocfg.hp_pins[i];
3051 if (pin) /* connect to front */
3052 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3054 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3056 pin = spec->autocfg.speaker_pins[i];
3057 if (pin) /* connect to front */
3058 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3062 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3064 struct sigmatel_spec *spec = codec->spec;
3066 int hp_speaker_swap = 0;
3068 if ((err = snd_hda_parse_pin_def_config(codec,
3070 spec->dmic_nids)) < 0)
3072 if (! spec->autocfg.line_outs)
3073 return 0; /* can't find valid pin config */
3075 /* If we have no real line-out pin and multiple hp-outs, HPs should
3076 * be set up as multi-channel outputs.
3078 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
3079 spec->autocfg.hp_outs > 1) {
3080 /* Copy hp_outs to line_outs, backup line_outs in
3081 * speaker_outs so that the following routines can handle
3082 * HP pins as primary outputs.
3084 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3085 sizeof(spec->autocfg.line_out_pins));
3086 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3087 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3088 sizeof(spec->autocfg.hp_pins));
3089 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3090 hp_speaker_swap = 1;
3092 if (spec->autocfg.mono_out_pin) {
3093 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3094 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3095 u32 caps = query_amp_caps(codec,
3096 spec->autocfg.mono_out_pin, dir);
3097 hda_nid_t conn_list[1];
3099 /* get the mixer node and then the mono mux if it exists */
3100 if (snd_hda_get_connections(codec,
3101 spec->autocfg.mono_out_pin, conn_list, 1) &&
3102 snd_hda_get_connections(codec, conn_list[0],
3105 int wcaps = get_wcaps(codec, conn_list[0]);
3106 int wid_type = (wcaps & AC_WCAP_TYPE)
3107 >> AC_WCAP_TYPE_SHIFT;
3108 /* LR swap check, some stac925x have a mux that
3109 * changes the DACs output path instead of the
3112 if (wid_type == AC_WID_AUD_SEL &&
3113 !(wcaps & AC_WCAP_LR_SWAP))
3114 spec->mono_nid = conn_list[0];
3117 hda_nid_t nid = spec->autocfg.mono_out_pin;
3119 /* most mono outs have a least a mute/unmute switch */
3120 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3121 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3122 "Mono Playback Switch",
3123 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3126 /* check for volume support for the amp */
3127 if ((caps & AC_AMPCAP_NUM_STEPS)
3128 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3129 err = stac92xx_add_control(spec,
3130 STAC_CTL_WIDGET_VOL,
3131 "Mono Playback Volume",
3132 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3138 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3142 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
3144 if (spec->multiout.num_dacs == 0)
3145 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
3148 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3153 /* setup analog beep controls */
3154 if (spec->anabeep_nid > 0) {
3155 err = stac92xx_auto_create_beep_ctls(codec,
3161 /* setup digital beep controls and input device */
3162 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3163 if (spec->digbeep_nid > 0) {
3164 hda_nid_t nid = spec->digbeep_nid;
3166 err = stac92xx_auto_create_beep_ctls(codec, nid);
3169 err = snd_hda_attach_beep_device(codec, nid);
3175 if (hp_speaker_swap == 1) {
3176 /* Restore the hp_outs and line_outs */
3177 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3178 sizeof(spec->autocfg.line_out_pins));
3179 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3180 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
3181 sizeof(spec->autocfg.speaker_pins));
3182 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
3183 memset(spec->autocfg.speaker_pins, 0,
3184 sizeof(spec->autocfg.speaker_pins));
3185 spec->autocfg.speaker_outs = 0;
3188 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3193 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3198 if (spec->mono_nid > 0) {
3199 err = stac92xx_auto_create_mono_output_ctls(codec);
3204 if (spec->num_dmics > 0)
3205 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3206 &spec->autocfg)) < 0)
3208 if (spec->num_muxes > 0) {
3209 err = stac92xx_auto_create_mux_input_ctls(codec);
3213 if (spec->num_smuxes > 0) {
3214 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3219 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3220 if (spec->multiout.max_channels > 2)
3221 spec->surr_switch = 1;
3223 if (spec->autocfg.dig_out_pin)
3224 spec->multiout.dig_out_nid = dig_out;
3225 if (dig_in && spec->autocfg.dig_in_pin)
3226 spec->dig_in_nid = dig_in;
3228 if (spec->kctl_alloc)
3229 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3231 spec->input_mux = &spec->private_imux;
3232 if (!spec->dinput_mux)
3233 spec->dinput_mux = &spec->private_dimux;
3234 spec->sinput_mux = &spec->private_smux;
3235 spec->mono_mux = &spec->private_mono_mux;
3240 /* add playback controls for HP output */
3241 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3242 struct auto_pin_cfg *cfg)
3244 struct sigmatel_spec *spec = codec->spec;
3245 hda_nid_t pin = cfg->hp_pins[0];
3246 unsigned int wid_caps;
3251 wid_caps = get_wcaps(codec, pin);
3252 if (wid_caps & AC_WCAP_UNSOL_CAP)
3253 spec->hp_detect = 1;
3258 /* add playback controls for LFE output */
3259 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3260 struct auto_pin_cfg *cfg)
3262 struct sigmatel_spec *spec = codec->spec;
3264 hda_nid_t lfe_pin = 0x0;
3268 * search speaker outs and line outs for a mono speaker pin
3269 * with an amp. If one is found, add LFE controls
3272 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3273 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3274 unsigned int wcaps = get_wcaps(codec, pin);
3275 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3276 if (wcaps == AC_WCAP_OUT_AMP)
3277 /* found a mono speaker with an amp, must be lfe */
3281 /* if speaker_outs is 0, then speakers may be in line_outs */
3282 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3283 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3284 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3285 unsigned int defcfg;
3286 defcfg = snd_hda_codec_read(codec, pin, 0,
3287 AC_VERB_GET_CONFIG_DEFAULT,
3289 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3290 unsigned int wcaps = get_wcaps(codec, pin);
3291 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3292 if (wcaps == AC_WCAP_OUT_AMP)
3293 /* found a mono speaker with an amp,
3301 err = create_controls(spec, "LFE", lfe_pin, 1);
3309 static int stac9200_parse_auto_config(struct hda_codec *codec)
3311 struct sigmatel_spec *spec = codec->spec;
3314 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3317 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3320 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3323 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3326 if (spec->autocfg.dig_out_pin)
3327 spec->multiout.dig_out_nid = 0x05;
3328 if (spec->autocfg.dig_in_pin)
3329 spec->dig_in_nid = 0x04;
3331 if (spec->kctl_alloc)
3332 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3334 spec->input_mux = &spec->private_imux;
3335 spec->dinput_mux = &spec->private_dimux;
3341 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3342 * funky external mute control using GPIO pins.
3345 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3346 unsigned int dir_mask, unsigned int data)
3348 unsigned int gpiostate, gpiomask, gpiodir;
3350 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3351 AC_VERB_GET_GPIO_DATA, 0);
3352 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3354 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3355 AC_VERB_GET_GPIO_MASK, 0);
3358 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3359 AC_VERB_GET_GPIO_DIRECTION, 0);
3360 gpiodir |= dir_mask;
3362 /* Configure GPIOx as CMOS */
3363 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3365 snd_hda_codec_write(codec, codec->afg, 0,
3366 AC_VERB_SET_GPIO_MASK, gpiomask);
3367 snd_hda_codec_read(codec, codec->afg, 0,
3368 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3372 snd_hda_codec_read(codec, codec->afg, 0,
3373 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3376 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3379 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
3380 snd_hda_codec_write_cache(codec, nid, 0,
3381 AC_VERB_SET_UNSOLICITED_ENABLE,
3382 (AC_USRSP_EN | event));
3385 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3388 for (i = 0; i < cfg->hp_outs; i++)
3389 if (cfg->hp_pins[i] == nid)
3390 return 1; /* nid is a HP-Out */
3392 return 0; /* nid is not a HP-Out */
3395 static void stac92xx_power_down(struct hda_codec *codec)
3397 struct sigmatel_spec *spec = codec->spec;
3399 /* power down inactive DACs */
3401 for (dac = spec->dac_list; *dac; dac++)
3402 if (!is_in_dac_nids(spec, *dac) &&
3403 spec->multiout.hp_nid != *dac)
3404 snd_hda_codec_write_cache(codec, *dac, 0,
3405 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3408 static int stac92xx_init(struct hda_codec *codec)
3410 struct sigmatel_spec *spec = codec->spec;
3411 struct auto_pin_cfg *cfg = &spec->autocfg;
3414 snd_hda_sequence_write(codec, spec->init);
3416 /* power down adcs initially */
3417 if (spec->powerdown_adcs)
3418 for (i = 0; i < spec->num_adcs; i++)
3419 snd_hda_codec_write_cache(codec,
3420 spec->adc_nids[i], 0,
3421 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3423 if (spec->hp_detect) {
3424 /* Enable unsolicited responses on the HP widget */
3425 for (i = 0; i < cfg->hp_outs; i++)
3426 enable_pin_detect(codec, cfg->hp_pins[i],
3428 /* force to enable the first line-out; the others are set up
3431 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3433 stac92xx_auto_init_hp_out(codec);
3434 /* fake event to set up pins */
3435 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3437 stac92xx_auto_init_multi_out(codec);
3438 stac92xx_auto_init_hp_out(codec);
3440 for (i = 0; i < AUTO_PIN_LAST; i++) {
3441 hda_nid_t nid = cfg->input_pins[i];
3443 unsigned int pinctl = AC_PINCTL_IN_EN;
3444 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
3445 pinctl |= stac92xx_get_vref(codec, nid);
3446 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3449 for (i = 0; i < spec->num_dmics; i++)
3450 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3452 for (i = 0; i < spec->num_pwrs; i++) {
3453 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i])
3454 ? STAC_HP_EVENT : STAC_PWR_EVENT;
3455 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i],
3456 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3457 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i],
3458 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3459 def_conf = get_defcfg_connect(def_conf);
3460 /* outputs are only ports capable of power management
3461 * any attempts on powering down a input port cause the
3462 * referenced VREF to act quirky.
3464 if (pinctl & AC_PINCTL_IN_EN)
3466 /* skip any ports that don't have jacks since presence
3467 * detection is useless */
3468 if (def_conf && def_conf != AC_JACK_PORT_FIXED)
3470 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3471 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3474 stac92xx_power_down(codec);
3475 if (cfg->dig_out_pin)
3476 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3478 if (cfg->dig_in_pin)
3479 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3482 stac_gpio_set(codec, spec->gpio_mask,
3483 spec->gpio_dir, spec->gpio_data);
3488 static void stac92xx_free(struct hda_codec *codec)
3490 struct sigmatel_spec *spec = codec->spec;
3496 if (spec->kctl_alloc) {
3497 for (i = 0; i < spec->num_kctl_used; i++)
3498 kfree(spec->kctl_alloc[i].name);
3499 kfree(spec->kctl_alloc);
3502 if (spec->bios_pin_configs)
3503 kfree(spec->bios_pin_configs);
3506 snd_hda_detach_beep_device(codec);
3509 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
3512 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3513 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3515 if (pin_ctl & AC_PINCTL_IN_EN) {
3517 * we need to check the current set-up direction of
3518 * shared input pins since they can be switched via
3519 * "xxx as Output" mixer switch
3521 struct sigmatel_spec *spec = codec->spec;
3522 struct auto_pin_cfg *cfg = &spec->autocfg;
3523 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
3524 spec->line_switch) ||
3525 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
3530 /* if setting pin direction bits, clear the current
3531 direction bits first */
3532 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
3533 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
3535 snd_hda_codec_write_cache(codec, nid, 0,
3536 AC_VERB_SET_PIN_WIDGET_CONTROL,
3540 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
3543 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3544 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3545 snd_hda_codec_write_cache(codec, nid, 0,
3546 AC_VERB_SET_PIN_WIDGET_CONTROL,
3550 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
3554 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
3556 unsigned int pinctl;
3557 pinctl = snd_hda_codec_read(codec, nid, 0,
3558 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3559 if (pinctl & AC_PINCTL_IN_EN)
3560 return 0; /* mic- or line-input */
3562 return 1; /* HP-output */
3567 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3569 struct sigmatel_spec *spec = codec->spec;
3570 struct auto_pin_cfg *cfg = &spec->autocfg;
3571 int nid = cfg->hp_pins[cfg->hp_outs - 1];
3575 if (spec->gpio_mute)
3576 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
3577 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
3579 for (i = 0; i < cfg->hp_outs; i++) {
3582 if (spec->hp_switch && cfg->hp_pins[i] == nid)
3584 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
3588 /* disable lineouts, enable hp */
3589 if (spec->hp_switch)
3590 stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3591 for (i = 0; i < cfg->line_outs; i++)
3592 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
3594 for (i = 0; i < cfg->speaker_outs; i++)
3595 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3597 if (spec->eapd_mask)
3598 stac_gpio_set(codec, spec->gpio_mask,
3599 spec->gpio_dir, spec->gpio_data &
3602 /* enable lineouts, disable hp */
3603 if (spec->hp_switch)
3604 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3605 for (i = 0; i < cfg->line_outs; i++)
3606 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
3608 for (i = 0; i < cfg->speaker_outs; i++)
3609 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3611 if (spec->eapd_mask)
3612 stac_gpio_set(codec, spec->gpio_mask,
3613 spec->gpio_dir, spec->gpio_data |
3616 if (!spec->hp_switch && cfg->hp_outs > 1 && presence)
3617 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3620 static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3622 struct sigmatel_spec *spec = codec->spec;
3623 hda_nid_t nid = spec->pwr_nids[idx];
3625 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0)
3627 presence = get_hp_pin_presence(codec, nid);
3629 /* several codecs have two power down bits */
3630 if (spec->pwr_mapping)
3631 idx = spec->pwr_mapping[idx];
3640 /* power down unused output ports */
3641 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3644 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3646 struct sigmatel_spec *spec = codec->spec;
3647 int idx = res >> 26 & 0x0f;
3649 switch ((res >> 26) & 0x30) {
3651 stac92xx_hp_detect(codec, res);
3653 case STAC_PWR_EVENT:
3654 if (spec->num_pwrs > 0)
3655 stac92xx_pin_sense(codec, idx);
3659 #ifdef SND_HDA_NEEDS_RESUME
3660 static int stac92xx_resume(struct hda_codec *codec)
3662 struct sigmatel_spec *spec = codec->spec;
3664 stac92xx_set_config_regs(codec);
3665 snd_hda_sequence_write(codec, spec->init);
3666 stac_gpio_set(codec, spec->gpio_mask,
3667 spec->gpio_dir, spec->gpio_data);
3668 snd_hda_codec_resume_amp(codec);
3669 snd_hda_codec_resume_cache(codec);
3670 /* power down inactive DACs */
3672 stac92xx_power_down(codec);
3673 /* invoke unsolicited event to reset the HP state */
3674 if (spec->hp_detect)
3675 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3680 static struct hda_codec_ops stac92xx_patch_ops = {
3681 .build_controls = stac92xx_build_controls,
3682 .build_pcms = stac92xx_build_pcms,
3683 .init = stac92xx_init,
3684 .free = stac92xx_free,
3685 .unsol_event = stac92xx_unsol_event,
3686 #ifdef SND_HDA_NEEDS_RESUME
3687 .resume = stac92xx_resume,
3691 static int patch_stac9200(struct hda_codec *codec)
3693 struct sigmatel_spec *spec;
3696 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3701 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
3702 spec->pin_nids = stac9200_pin_nids;
3703 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
3706 if (spec->board_config < 0) {
3707 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3708 err = stac92xx_save_bios_config_regs(codec);
3710 stac92xx_free(codec);
3713 spec->pin_configs = spec->bios_pin_configs;
3715 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
3716 stac92xx_set_config_regs(codec);
3719 spec->multiout.max_channels = 2;
3720 spec->multiout.num_dacs = 1;
3721 spec->multiout.dac_nids = stac9200_dac_nids;
3722 spec->adc_nids = stac9200_adc_nids;
3723 spec->mux_nids = stac9200_mux_nids;
3724 spec->num_muxes = 1;
3725 spec->num_dmics = 0;
3729 if (spec->board_config == STAC_9200_GATEWAY ||
3730 spec->board_config == STAC_9200_OQO)
3731 spec->init = stac9200_eapd_init;
3733 spec->init = stac9200_core_init;
3734 spec->mixer = stac9200_mixer;
3736 if (spec->board_config == STAC_9200_PANASONIC) {
3737 spec->gpio_mask = spec->gpio_dir = 0x09;
3738 spec->gpio_data = 0x00;
3741 err = stac9200_parse_auto_config(codec);
3743 stac92xx_free(codec);
3747 codec->patch_ops = stac92xx_patch_ops;
3752 static int patch_stac925x(struct hda_codec *codec)
3754 struct sigmatel_spec *spec;
3757 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3762 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
3763 spec->pin_nids = stac925x_pin_nids;
3764 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
3768 if (spec->board_config < 0) {
3769 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
3770 "using BIOS defaults\n");
3771 err = stac92xx_save_bios_config_regs(codec);
3773 stac92xx_free(codec);
3776 spec->pin_configs = spec->bios_pin_configs;
3777 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
3778 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
3779 stac92xx_set_config_regs(codec);
3782 spec->multiout.max_channels = 2;
3783 spec->multiout.num_dacs = 1;
3784 spec->multiout.dac_nids = stac925x_dac_nids;
3785 spec->adc_nids = stac925x_adc_nids;
3786 spec->mux_nids = stac925x_mux_nids;
3787 spec->num_muxes = 1;
3790 switch (codec->vendor_id) {
3791 case 0x83847632: /* STAC9202 */
3792 case 0x83847633: /* STAC9202D */
3793 case 0x83847636: /* STAC9251 */
3794 case 0x83847637: /* STAC9251D */
3795 spec->num_dmics = STAC925X_NUM_DMICS;
3796 spec->dmic_nids = stac925x_dmic_nids;
3797 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
3798 spec->dmux_nids = stac925x_dmux_nids;
3801 spec->num_dmics = 0;
3805 spec->init = stac925x_core_init;
3806 spec->mixer = stac925x_mixer;
3808 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
3810 if (spec->board_config < 0) {
3811 printk(KERN_WARNING "hda_codec: No auto-config is "
3812 "available, default to model=ref\n");
3813 spec->board_config = STAC_925x_REF;
3819 stac92xx_free(codec);
3823 codec->patch_ops = stac92xx_patch_ops;
3828 static struct hda_input_mux stac92hd73xx_dmux = {
3831 { "Analog Inputs", 0x0b },
3833 { "Digital Mic 1", 0x09 },
3834 { "Digital Mic 2", 0x0a },
3838 static int patch_stac92hd73xx(struct hda_codec *codec)
3840 struct sigmatel_spec *spec;
3841 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
3844 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3849 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
3850 spec->pin_nids = stac92hd73xx_pin_nids;
3851 spec->board_config = snd_hda_check_board_config(codec,
3852 STAC_92HD73XX_MODELS,
3853 stac92hd73xx_models,
3854 stac92hd73xx_cfg_tbl);
3856 if (spec->board_config < 0) {
3857 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3858 " STAC92HD73XX, using BIOS defaults\n");
3859 err = stac92xx_save_bios_config_regs(codec);
3861 stac92xx_free(codec);
3864 spec->pin_configs = spec->bios_pin_configs;
3866 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
3867 stac92xx_set_config_regs(codec);
3870 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
3871 conn, STAC92HD73_DAC_COUNT + 2) - 1;
3873 if (spec->multiout.num_dacs < 0) {
3874 printk(KERN_WARNING "hda_codec: Could not determine "
3875 "number of channels defaulting to DAC count\n");
3876 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
3879 switch (spec->multiout.num_dacs) {
3880 case 0x3: /* 6 Channel */
3881 spec->multiout.hp_nid = 0x17;
3882 spec->mixer = stac92hd73xx_6ch_mixer;
3883 spec->init = stac92hd73xx_6ch_core_init;
3885 case 0x4: /* 8 Channel */
3886 spec->multiout.hp_nid = 0x18;
3887 spec->mixer = stac92hd73xx_8ch_mixer;
3888 spec->init = stac92hd73xx_8ch_core_init;
3890 case 0x5: /* 10 Channel */
3891 spec->multiout.hp_nid = 0x19;
3892 spec->mixer = stac92hd73xx_10ch_mixer;
3893 spec->init = stac92hd73xx_10ch_core_init;
3896 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
3897 spec->aloopback_mask = 0x01;
3898 spec->aloopback_shift = 8;
3900 spec->digbeep_nid = 0x1c;
3901 spec->mux_nids = stac92hd73xx_mux_nids;
3902 spec->adc_nids = stac92hd73xx_adc_nids;
3903 spec->dmic_nids = stac92hd73xx_dmic_nids;
3904 spec->dmux_nids = stac92hd73xx_dmux_nids;
3905 spec->smux_nids = stac92hd73xx_smux_nids;
3907 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
3908 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
3909 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3910 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
3911 spec->dinput_mux = &stac92hd73xx_dmux;
3912 /* GPIO0 High = Enable EAPD */
3913 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3914 spec->gpio_data = 0x01;
3916 switch (spec->board_config) {
3918 spec->init = dell_eq_core_init;
3919 switch (codec->subsystem_id) {
3920 case 0x1028025e: /* Analog Mics */
3922 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3923 spec->num_dmics = 0;
3925 case 0x10280271: /* Digital Mics */
3927 spec->init = dell_m6_core_init;
3931 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3932 spec->num_dmics = 1;
3934 case 0x10280256: /* Both */
3936 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3937 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3938 spec->num_dmics = 1;
3943 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
3946 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3947 spec->pwr_nids = stac92hd73xx_pwr_nids;
3949 err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
3952 if (spec->board_config < 0) {
3953 printk(KERN_WARNING "hda_codec: No auto-config is "
3954 "available, default to model=ref\n");
3955 spec->board_config = STAC_92HD73XX_REF;
3962 stac92xx_free(codec);
3966 codec->patch_ops = stac92xx_patch_ops;
3971 static struct hda_input_mux stac92hd83xxx_dmux = {
3974 { "Analog Inputs", 0x03 },
3975 { "Digital Mic 1", 0x04 },
3976 { "Digital Mic 2", 0x05 },
3980 static int patch_stac92hd83xxx(struct hda_codec *codec)
3982 struct sigmatel_spec *spec;
3985 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3990 spec->mono_nid = 0x19;
3991 spec->digbeep_nid = 0x21;
3992 spec->dmic_nids = stac92hd83xxx_dmic_nids;
3993 spec->dmux_nids = stac92hd83xxx_dmux_nids;
3994 spec->adc_nids = stac92hd83xxx_adc_nids;
3995 spec->pwr_nids = stac92hd83xxx_pwr_nids;
3996 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
3997 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
3998 spec->multiout.dac_nids = stac92hd83xxx_dac_nids;
4000 spec->init = stac92hd83xxx_core_init;
4001 switch (codec->vendor_id) {
4003 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;
4007 spec->init++; /* switch to config #2 */
4008 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;
4011 spec->mixer = stac92hd83xxx_mixer;
4012 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4013 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4014 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4015 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4016 spec->dinput_mux = &stac92hd83xxx_dmux;
4017 spec->pin_nids = stac92hd83xxx_pin_nids;
4018 spec->board_config = snd_hda_check_board_config(codec,
4019 STAC_92HD83XXX_MODELS,
4020 stac92hd83xxx_models,
4021 stac92hd83xxx_cfg_tbl);
4023 if (spec->board_config < 0) {
4024 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4025 " STAC92HD83XXX, using BIOS defaults\n");
4026 err = stac92xx_save_bios_config_regs(codec);
4028 stac92xx_free(codec);
4031 spec->pin_configs = spec->bios_pin_configs;
4033 spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config];
4034 stac92xx_set_config_regs(codec);
4037 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4039 if (spec->board_config < 0) {
4040 printk(KERN_WARNING "hda_codec: No auto-config is "
4041 "available, default to model=ref\n");
4042 spec->board_config = STAC_92HD83XXX_REF;
4049 stac92xx_free(codec);
4053 codec->patch_ops = stac92xx_patch_ops;
4058 #ifdef SND_HDA_NEEDS_RESUME
4059 static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr)
4061 struct sigmatel_spec *spec = codec->spec;
4063 snd_hda_codec_write_cache(codec, codec->afg, 0,
4064 AC_VERB_SET_POWER_STATE, pwr);
4067 for (i = 0; i < spec->num_adcs; i++) {
4068 snd_hda_codec_write_cache(codec,
4069 spec->adc_nids[i], 0,
4070 AC_VERB_SET_POWER_STATE, pwr);
4074 static int stac92hd71xx_resume(struct hda_codec *codec)
4076 stac92hd71xx_set_power_state(codec, AC_PWRST_D0);
4077 return stac92xx_resume(codec);
4080 static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state)
4082 stac92hd71xx_set_power_state(codec, AC_PWRST_D3);
4088 static struct hda_codec_ops stac92hd71bxx_patch_ops = {
4089 .build_controls = stac92xx_build_controls,
4090 .build_pcms = stac92xx_build_pcms,
4091 .init = stac92xx_init,
4092 .free = stac92xx_free,
4093 .unsol_event = stac92xx_unsol_event,
4094 #ifdef SND_HDA_NEEDS_RESUME
4095 .resume = stac92hd71xx_resume,
4096 .suspend = stac92hd71xx_suspend,
4100 static int patch_stac92hd71bxx(struct hda_codec *codec)
4102 struct sigmatel_spec *spec;
4105 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4110 codec->patch_ops = stac92xx_patch_ops;
4111 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
4112 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4113 spec->pin_nids = stac92hd71bxx_pin_nids;
4114 spec->board_config = snd_hda_check_board_config(codec,
4115 STAC_92HD71BXX_MODELS,
4116 stac92hd71bxx_models,
4117 stac92hd71bxx_cfg_tbl);
4119 if (spec->board_config < 0) {
4120 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4121 " STAC92HD71BXX, using BIOS defaults\n");
4122 err = stac92xx_save_bios_config_regs(codec);
4124 stac92xx_free(codec);
4127 spec->pin_configs = spec->bios_pin_configs;
4129 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
4130 stac92xx_set_config_regs(codec);
4133 switch (codec->vendor_id) {
4134 case 0x111d76b6: /* 4 Port without Analog Mixer */
4136 case 0x111d76b4: /* 6 Port without Analog Mixer */
4138 spec->mixer = stac92hd71bxx_mixer;
4139 spec->init = stac92hd71bxx_core_init;
4141 case 0x111d7608: /* 5 Port with Analog Mixer */
4142 if ((codec->revision_id & 0xf) == 0 ||
4143 (codec->revision_id & 0xf) == 1) {
4144 #ifdef SND_HDA_NEEDS_RESUME
4145 codec->patch_ops = stac92hd71bxx_patch_ops;
4147 spec->stream_delay = 40; /* 40 milliseconds */
4150 /* no output amps */
4152 spec->mixer = stac92hd71bxx_analog_mixer;
4155 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
4156 stac92xx_set_config_reg(codec, 0xf, 0x40f000f0);
4158 case 0x111d7603: /* 6 Port with Analog Mixer */
4159 if ((codec->revision_id & 0xf) == 1) {
4160 #ifdef SND_HDA_NEEDS_RESUME
4161 codec->patch_ops = stac92hd71bxx_patch_ops;
4163 spec->stream_delay = 40; /* 40 milliseconds */
4166 /* no output amps */
4170 spec->mixer = stac92hd71bxx_analog_mixer;
4171 spec->init = stac92hd71bxx_analog_core_init;
4174 spec->aloopback_mask = 0x20;
4175 spec->aloopback_shift = 0;
4177 /* GPIO0 High = EAPD */
4178 spec->gpio_mask = 0x01;
4179 spec->gpio_dir = 0x01;
4180 spec->gpio_data = 0x01;
4182 spec->powerdown_adcs = 1;
4183 spec->digbeep_nid = 0x26;
4184 spec->mux_nids = stac92hd71bxx_mux_nids;
4185 spec->adc_nids = stac92hd71bxx_adc_nids;
4186 spec->dmic_nids = stac92hd71bxx_dmic_nids;
4187 spec->dmux_nids = stac92hd71bxx_dmux_nids;
4188 spec->smux_nids = stac92hd71bxx_smux_nids;
4189 spec->pwr_nids = stac92hd71bxx_pwr_nids;
4191 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
4192 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
4193 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
4194 spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids);
4195 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
4197 spec->multiout.num_dacs = 1;
4198 spec->multiout.hp_nid = 0x11;
4199 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
4201 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
4203 if (spec->board_config < 0) {
4204 printk(KERN_WARNING "hda_codec: No auto-config is "
4205 "available, default to model=ref\n");
4206 spec->board_config = STAC_92HD71BXX_REF;
4213 stac92xx_free(codec);
4220 static int patch_stac922x(struct hda_codec *codec)
4222 struct sigmatel_spec *spec;
4225 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4230 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
4231 spec->pin_nids = stac922x_pin_nids;
4232 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
4235 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
4236 spec->gpio_mask = spec->gpio_dir = 0x03;
4237 spec->gpio_data = 0x03;
4238 /* Intel Macs have all same PCI SSID, so we need to check
4239 * codec SSID to distinguish the exact models
4241 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
4242 switch (codec->subsystem_id) {
4245 spec->board_config = STAC_INTEL_MAC_V1;
4249 spec->board_config = STAC_INTEL_MAC_V2;
4257 spec->board_config = STAC_INTEL_MAC_V3;
4261 spec->board_config = STAC_INTEL_MAC_V4;
4265 spec->board_config = STAC_INTEL_MAC_V5;
4268 spec->board_config = STAC_INTEL_MAC_V3;
4274 if (spec->board_config < 0) {
4275 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
4276 "using BIOS defaults\n");
4277 err = stac92xx_save_bios_config_regs(codec);
4279 stac92xx_free(codec);
4282 spec->pin_configs = spec->bios_pin_configs;
4283 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
4284 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
4285 stac92xx_set_config_regs(codec);
4288 spec->adc_nids = stac922x_adc_nids;
4289 spec->mux_nids = stac922x_mux_nids;
4290 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
4291 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
4292 spec->num_dmics = 0;
4295 spec->init = stac922x_core_init;
4296 spec->mixer = stac922x_mixer;
4298 spec->multiout.dac_nids = spec->dac_nids;
4300 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
4302 if (spec->board_config < 0) {
4303 printk(KERN_WARNING "hda_codec: No auto-config is "
4304 "available, default to model=ref\n");
4305 spec->board_config = STAC_D945_REF;
4311 stac92xx_free(codec);
4315 codec->patch_ops = stac92xx_patch_ops;
4317 /* Fix Mux capture level; max to 2 */
4318 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4319 (0 << AC_AMPCAP_OFFSET_SHIFT) |
4320 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4321 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4322 (0 << AC_AMPCAP_MUTE_SHIFT));
4327 static int patch_stac927x(struct hda_codec *codec)
4329 struct sigmatel_spec *spec;
4332 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4337 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
4338 spec->pin_nids = stac927x_pin_nids;
4339 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
4343 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
4344 if (spec->board_config < 0)
4345 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4346 "STAC927x, using BIOS defaults\n");
4347 err = stac92xx_save_bios_config_regs(codec);
4349 stac92xx_free(codec);
4352 spec->pin_configs = spec->bios_pin_configs;
4354 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
4355 stac92xx_set_config_regs(codec);
4358 spec->digbeep_nid = 0x23;
4359 spec->adc_nids = stac927x_adc_nids;
4360 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
4361 spec->mux_nids = stac927x_mux_nids;
4362 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
4363 spec->smux_nids = stac927x_smux_nids;
4364 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
4365 spec->dac_list = stac927x_dac_nids;
4366 spec->multiout.dac_nids = spec->dac_nids;
4368 switch (spec->board_config) {
4371 /* GPIO0 High = Enable EAPD */
4372 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
4373 spec->gpio_data = 0x01;
4374 spec->num_dmics = 0;
4376 spec->init = d965_core_init;
4377 spec->mixer = stac927x_mixer;
4379 case STAC_DELL_BIOS:
4380 switch (codec->subsystem_id) {
4383 /* correct the device field to SPDIF out */
4384 stac92xx_set_config_reg(codec, 0x21, 0x01442070);
4387 /* configure the analog microphone on some laptops */
4388 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130);
4389 /* correct the front output jack as a hp out */
4390 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f);
4391 /* correct the front input jack as a mic */
4392 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
4395 /* GPIO2 High = Enable EAPD */
4396 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
4397 spec->gpio_data = 0x04;
4398 spec->dmic_nids = stac927x_dmic_nids;
4399 spec->num_dmics = STAC927X_NUM_DMICS;
4401 spec->init = d965_core_init;
4402 spec->mixer = stac927x_mixer;
4403 spec->dmux_nids = stac927x_dmux_nids;
4404 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
4407 /* GPIO0 High = Enable EAPD */
4408 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4409 spec->gpio_data = 0x01;
4410 spec->num_dmics = 0;
4412 spec->init = stac927x_core_init;
4413 spec->mixer = stac927x_mixer;
4417 spec->aloopback_mask = 0x40;
4418 spec->aloopback_shift = 0;
4420 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
4422 if (spec->board_config < 0) {
4423 printk(KERN_WARNING "hda_codec: No auto-config is "
4424 "available, default to model=ref\n");
4425 spec->board_config = STAC_D965_REF;
4431 stac92xx_free(codec);
4435 codec->patch_ops = stac92xx_patch_ops;
4439 * The STAC927x seem to require fairly long delays for certain
4440 * command sequences. With too short delays (even if the answer
4441 * is set to RIRB properly), it results in the silence output
4442 * on some hardwares like Dell.
4444 * The below flag enables the longer delay (see get_response
4447 codec->bus->needs_damn_long_delay = 1;
4452 static int patch_stac9205(struct hda_codec *codec)
4454 struct sigmatel_spec *spec;
4457 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4462 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
4463 spec->pin_nids = stac9205_pin_nids;
4464 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
4468 if (spec->board_config < 0) {
4469 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
4470 err = stac92xx_save_bios_config_regs(codec);
4472 stac92xx_free(codec);
4475 spec->pin_configs = spec->bios_pin_configs;
4477 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
4478 stac92xx_set_config_regs(codec);
4481 spec->digbeep_nid = 0x23;
4482 spec->adc_nids = stac9205_adc_nids;
4483 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
4484 spec->mux_nids = stac9205_mux_nids;
4485 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
4486 spec->smux_nids = stac9205_smux_nids;
4487 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
4488 spec->dmic_nids = stac9205_dmic_nids;
4489 spec->num_dmics = STAC9205_NUM_DMICS;
4490 spec->dmux_nids = stac9205_dmux_nids;
4491 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
4494 spec->init = stac9205_core_init;
4495 spec->mixer = stac9205_mixer;
4497 spec->aloopback_mask = 0x40;
4498 spec->aloopback_shift = 0;
4499 spec->multiout.dac_nids = spec->dac_nids;
4501 switch (spec->board_config){
4502 case STAC_9205_DELL_M43:
4503 /* Enable SPDIF in/out */
4504 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
4505 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
4507 /* Enable unsol response for GPIO4/Dock HP connection */
4508 snd_hda_codec_write(codec, codec->afg, 0,
4509 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
4510 snd_hda_codec_write_cache(codec, codec->afg, 0,
4511 AC_VERB_SET_UNSOLICITED_ENABLE,
4512 (AC_USRSP_EN | STAC_HP_EVENT));
4514 spec->gpio_dir = 0x0b;
4515 spec->eapd_mask = 0x01;
4516 spec->gpio_mask = 0x1b;
4517 spec->gpio_mute = 0x10;
4518 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4521 spec->gpio_data = 0x01;
4524 /* GPIO0 High = EAPD */
4525 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4526 spec->gpio_data = 0x01;
4530 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
4532 if (spec->board_config < 0) {
4533 printk(KERN_WARNING "hda_codec: No auto-config is "
4534 "available, default to model=ref\n");
4535 spec->board_config = STAC_9205_REF;
4541 stac92xx_free(codec);
4545 codec->patch_ops = stac92xx_patch_ops;
4554 /* static config for Sony VAIO FE550G and Sony VAIO AR */
4555 static hda_nid_t vaio_dacs[] = { 0x2 };
4556 #define VAIO_HP_DAC 0x5
4557 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
4558 static hda_nid_t vaio_mux_nids[] = { 0x15 };
4560 static struct hda_input_mux vaio_mux = {
4563 /* { "HP", 0x0 }, */
4564 { "Mic Jack", 0x1 },
4565 { "Internal Mic", 0x2 },
4570 static struct hda_verb vaio_init[] = {
4571 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
4572 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
4573 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
4574 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
4575 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
4576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
4577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
4578 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
4579 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
4580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4586 static struct hda_verb vaio_ar_init[] = {
4587 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
4588 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
4589 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
4590 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
4591 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
4592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
4593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
4594 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
4595 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
4596 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
4597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4599 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4603 /* bind volumes of both NID 0x02 and 0x05 */
4604 static struct hda_bind_ctls vaio_bind_master_vol = {
4605 .ops = &snd_hda_bind_vol,
4607 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4608 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4613 /* bind volumes of both NID 0x02 and 0x05 */
4614 static struct hda_bind_ctls vaio_bind_master_sw = {
4615 .ops = &snd_hda_bind_sw,
4617 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4618 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4623 static struct snd_kcontrol_new vaio_mixer[] = {
4624 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4625 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4626 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4627 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4628 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4630 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4631 .name = "Capture Source",
4633 .info = stac92xx_mux_enum_info,
4634 .get = stac92xx_mux_enum_get,
4635 .put = stac92xx_mux_enum_put,
4640 static struct snd_kcontrol_new vaio_ar_mixer[] = {
4641 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4642 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4643 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4644 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4645 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4646 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4647 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4650 .name = "Capture Source",
4652 .info = stac92xx_mux_enum_info,
4653 .get = stac92xx_mux_enum_get,
4654 .put = stac92xx_mux_enum_put,
4659 static struct hda_codec_ops stac9872_patch_ops = {
4660 .build_controls = stac92xx_build_controls,
4661 .build_pcms = stac92xx_build_pcms,
4662 .init = stac92xx_init,
4663 .free = stac92xx_free,
4664 #ifdef SND_HDA_NEEDS_RESUME
4665 .resume = stac92xx_resume,
4669 static int stac9872_vaio_init(struct hda_codec *codec)
4673 err = stac92xx_init(codec);
4676 if (codec->patch_ops.unsol_event)
4677 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
4681 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
4683 if (get_hp_pin_presence(codec, 0x0a)) {
4684 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4685 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4687 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4688 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4692 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
4694 switch (res >> 26) {
4696 stac9872_vaio_hp_detect(codec, res);
4701 static struct hda_codec_ops stac9872_vaio_patch_ops = {
4702 .build_controls = stac92xx_build_controls,
4703 .build_pcms = stac92xx_build_pcms,
4704 .init = stac9872_vaio_init,
4705 .free = stac92xx_free,
4706 .unsol_event = stac9872_vaio_unsol_event,
4708 .resume = stac92xx_resume,
4712 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4714 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4716 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4718 /* AR Series. id=0x83847664 and subsys=104D1300 */
4723 static const char *stac9872_models[STAC_9872_MODELS] = {
4724 [CXD9872RD_VAIO] = "vaio",
4725 [CXD9872AKD_VAIO] = "vaio-ar",
4728 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
4729 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
4730 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
4731 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
4732 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
4736 static int patch_stac9872(struct hda_codec *codec)
4738 struct sigmatel_spec *spec;
4741 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
4744 if (board_config < 0)
4745 /* unknown config, let generic-parser do its job... */
4746 return snd_hda_parse_generic_codec(codec);
4748 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4753 switch (board_config) {
4754 case CXD9872RD_VAIO:
4755 case STAC9872AK_VAIO:
4756 case STAC9872K_VAIO:
4757 spec->mixer = vaio_mixer;
4758 spec->init = vaio_init;
4759 spec->multiout.max_channels = 2;
4760 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4761 spec->multiout.dac_nids = vaio_dacs;
4762 spec->multiout.hp_nid = VAIO_HP_DAC;
4763 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4764 spec->adc_nids = vaio_adcs;
4766 spec->input_mux = &vaio_mux;
4767 spec->mux_nids = vaio_mux_nids;
4768 codec->patch_ops = stac9872_vaio_patch_ops;
4771 case CXD9872AKD_VAIO:
4772 spec->mixer = vaio_ar_mixer;
4773 spec->init = vaio_ar_init;
4774 spec->multiout.max_channels = 2;
4775 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4776 spec->multiout.dac_nids = vaio_dacs;
4777 spec->multiout.hp_nid = VAIO_HP_DAC;
4778 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4780 spec->adc_nids = vaio_adcs;
4781 spec->input_mux = &vaio_mux;
4782 spec->mux_nids = vaio_mux_nids;
4783 codec->patch_ops = stac9872_patch_ops;
4794 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
4795 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4796 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4797 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4798 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4799 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4800 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4801 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
4802 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4803 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4804 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4805 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4806 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4807 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
4808 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4809 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4810 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4811 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4812 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4813 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4814 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4815 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4816 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4817 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
4818 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4819 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4820 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4821 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4822 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4823 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
4824 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
4825 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
4826 /* The following does not take into account .id=0x83847661 when subsys =
4827 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4828 * currently not fully supported.
4830 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4831 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4832 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
4833 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4834 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4835 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4836 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4837 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4838 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4839 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4840 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
4841 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
4842 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
4843 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
4844 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
4845 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4846 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
4847 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4848 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4849 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4850 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4851 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4852 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4853 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4854 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4855 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },