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 <sound/jack.h>
34 #include "hda_codec.h"
35 #include "hda_local.h"
72 STAC_92HD73XX_NO_JD, /* no jack-detection */
112 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
113 * is given, one of the above models will be
114 * chosen according to the subsystem id. */
115 /* for backward compatibility */
131 STAC_D965_REF_NO_JD, /* no jack-detection */
140 struct sigmatel_event {
147 struct sigmatel_jack {
150 struct snd_jack *jack;
153 struct sigmatel_spec {
154 struct snd_kcontrol_new *mixers[4];
155 unsigned int num_mixers;
158 unsigned int eapd_switch: 1;
159 unsigned int surr_switch: 1;
160 unsigned int line_switch: 1;
161 unsigned int mic_switch: 1;
162 unsigned int alt_switch: 1;
163 unsigned int hp_detect: 1;
164 unsigned int spdif_mute: 1;
167 unsigned int eapd_mask;
168 unsigned int gpio_mask;
169 unsigned int gpio_dir;
170 unsigned int gpio_data;
171 unsigned int gpio_mute;
174 unsigned int stream_delay;
176 /* analog loopback */
177 unsigned char aloopback_mask;
178 unsigned char aloopback_shift;
180 /* power management */
181 unsigned int num_pwrs;
182 unsigned int *pwr_mapping;
187 struct snd_array jacks;
190 struct snd_array events;
193 struct hda_input_mux *mono_mux;
194 struct hda_input_mux *amp_mux;
195 unsigned int cur_mmux;
196 struct hda_multi_out multiout;
197 hda_nid_t dac_nids[5];
201 unsigned int num_adcs;
203 unsigned int num_muxes;
204 hda_nid_t *dmic_nids;
205 unsigned int num_dmics;
206 hda_nid_t *dmux_nids;
207 unsigned int num_dmuxes;
208 hda_nid_t *smux_nids;
209 unsigned int num_smuxes;
210 const char **spdif_labels;
212 hda_nid_t dig_in_nid;
214 hda_nid_t anabeep_nid;
215 hda_nid_t digbeep_nid;
219 unsigned int num_pins;
220 unsigned int *pin_configs;
222 /* codec specific stuff */
223 struct hda_verb *init;
224 struct snd_kcontrol_new *mixer;
227 struct hda_input_mux *dinput_mux;
228 unsigned int cur_dmux[2];
229 struct hda_input_mux *input_mux;
230 unsigned int cur_mux[3];
231 struct hda_input_mux *sinput_mux;
232 unsigned int cur_smux[2];
233 unsigned int cur_amux;
235 unsigned int num_amps;
236 unsigned int powerdown_adcs;
239 unsigned int io_switch[2];
240 unsigned int clfe_swap;
241 unsigned int hp_switch; /* NID of HP as line-out */
242 unsigned int aloopback;
244 struct hda_pcm pcm_rec[2]; /* PCM information */
246 /* dynamic controls and input_mux */
247 struct auto_pin_cfg autocfg;
248 struct snd_array kctls;
249 struct hda_input_mux private_dimux;
250 struct hda_input_mux private_imux;
251 struct hda_input_mux private_smux;
252 struct hda_input_mux private_amp_mux;
253 struct hda_input_mux private_mono_mux;
256 static hda_nid_t stac9200_adc_nids[1] = {
260 static hda_nid_t stac9200_mux_nids[1] = {
264 static hda_nid_t stac9200_dac_nids[1] = {
268 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
269 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
273 static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
277 static hda_nid_t stac92hd73xx_adc_nids[2] = {
281 #define DELL_M6_AMP 2
282 static hda_nid_t stac92hd73xx_amp_nids[3] = {
286 #define STAC92HD73XX_NUM_DMICS 2
287 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
291 #define STAC92HD73_DAC_COUNT 5
292 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
293 0x15, 0x16, 0x17, 0x18, 0x19,
296 static hda_nid_t stac92hd73xx_mux_nids[4] = {
297 0x28, 0x29, 0x2a, 0x2b,
300 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
304 static hda_nid_t stac92hd73xx_smux_nids[2] = {
308 #define STAC92HD83XXX_NUM_DMICS 2
309 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
313 #define STAC92HD81_DAC_COUNT 2
314 #define STAC92HD83_DAC_COUNT 3
315 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {
319 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
323 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
327 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
331 static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
335 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
336 0x03, 0x0c, 0x10, 0x40,
339 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
343 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
347 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
351 static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
355 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
359 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
363 #define STAC92HD71BXX_NUM_DMICS 2
364 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
368 static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
372 static hda_nid_t stac925x_adc_nids[1] = {
376 static hda_nid_t stac925x_mux_nids[1] = {
380 static hda_nid_t stac925x_dac_nids[1] = {
384 #define STAC925X_NUM_DMICS 1
385 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
389 static hda_nid_t stac925x_dmux_nids[1] = {
393 static hda_nid_t stac922x_adc_nids[2] = {
397 static hda_nid_t stac922x_mux_nids[2] = {
401 static hda_nid_t stac927x_adc_nids[3] = {
405 static hda_nid_t stac927x_mux_nids[3] = {
409 static hda_nid_t stac927x_smux_nids[1] = {
413 static hda_nid_t stac927x_dac_nids[6] = {
414 0x02, 0x03, 0x04, 0x05, 0x06, 0
417 static hda_nid_t stac927x_dmux_nids[1] = {
421 #define STAC927X_NUM_DMICS 2
422 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
426 static const char *stac927x_spdif_labels[5] = {
427 "Digital Playback", "ADAT", "Analog Mux 1",
428 "Analog Mux 2", "Analog Mux 3"
431 static hda_nid_t stac9205_adc_nids[2] = {
435 static hda_nid_t stac9205_mux_nids[2] = {
439 static hda_nid_t stac9205_dmux_nids[1] = {
443 static hda_nid_t stac9205_smux_nids[1] = {
447 #define STAC9205_NUM_DMICS 2
448 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
452 static hda_nid_t stac9200_pin_nids[8] = {
453 0x08, 0x09, 0x0d, 0x0e,
454 0x0f, 0x10, 0x11, 0x12,
457 static hda_nid_t stac925x_pin_nids[8] = {
458 0x07, 0x08, 0x0a, 0x0b,
459 0x0c, 0x0d, 0x10, 0x11,
462 static hda_nid_t stac922x_pin_nids[10] = {
463 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
464 0x0f, 0x10, 0x11, 0x15, 0x1b,
467 static hda_nid_t stac92hd73xx_pin_nids[13] = {
468 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
469 0x0f, 0x10, 0x11, 0x12, 0x13,
473 static hda_nid_t stac92hd83xxx_pin_nids[14] = {
474 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
475 0x0f, 0x10, 0x11, 0x12, 0x13,
476 0x1d, 0x1e, 0x1f, 0x20
478 static hda_nid_t stac92hd71bxx_pin_nids[11] = {
479 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
480 0x0f, 0x14, 0x18, 0x19, 0x1e,
484 static hda_nid_t stac927x_pin_nids[14] = {
485 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
486 0x0f, 0x10, 0x11, 0x12, 0x13,
487 0x14, 0x21, 0x22, 0x23,
490 static hda_nid_t stac9205_pin_nids[12] = {
491 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
492 0x0f, 0x14, 0x16, 0x17, 0x18,
496 #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
498 static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_value *ucontrol)
501 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
502 struct sigmatel_spec *spec = codec->spec;
503 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
505 kcontrol->private_value ^= get_amp_nid(kcontrol);
506 kcontrol->private_value |= nid;
508 return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
511 static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
512 struct snd_ctl_elem_value *ucontrol)
514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
515 struct sigmatel_spec *spec = codec->spec;
516 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
518 kcontrol->private_value ^= get_amp_nid(kcontrol);
519 kcontrol->private_value |= nid;
521 return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
524 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_info *uinfo)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct sigmatel_spec *spec = codec->spec;
529 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
532 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
536 struct sigmatel_spec *spec = codec->spec;
537 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
539 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
543 static int stac92xx_dmux_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;
548 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
550 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
551 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
554 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
555 struct snd_ctl_elem_info *uinfo)
557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
558 struct sigmatel_spec *spec = codec->spec;
559 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
562 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 struct sigmatel_spec *spec = codec->spec;
567 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
569 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
573 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
574 struct snd_ctl_elem_value *ucontrol)
576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
577 struct sigmatel_spec *spec = codec->spec;
578 struct hda_input_mux *smux = &spec->private_smux;
579 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
583 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
584 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
588 if (spec->spdif_mute) {
590 nid = spec->multiout.dig_out_nid;
592 nid = codec->slave_dig_outs[smux_idx - 1];
593 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
597 /* un/mute SPDIF out */
598 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
604 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
606 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
607 struct sigmatel_spec *spec = codec->spec;
608 return snd_hda_input_mux_info(spec->input_mux, uinfo);
611 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
614 struct sigmatel_spec *spec = codec->spec;
615 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
617 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
621 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
623 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
624 struct sigmatel_spec *spec = codec->spec;
625 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
627 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
628 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
631 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
632 struct snd_ctl_elem_info *uinfo)
634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
635 struct sigmatel_spec *spec = codec->spec;
636 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
639 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
643 struct sigmatel_spec *spec = codec->spec;
645 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
649 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
650 struct snd_ctl_elem_value *ucontrol)
652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
653 struct sigmatel_spec *spec = codec->spec;
655 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
656 spec->mono_nid, &spec->cur_mmux);
659 static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_info *uinfo)
662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
663 struct sigmatel_spec *spec = codec->spec;
664 return snd_hda_input_mux_info(spec->amp_mux, uinfo);
667 static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
668 struct snd_ctl_elem_value *ucontrol)
670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
671 struct sigmatel_spec *spec = codec->spec;
673 ucontrol->value.enumerated.item[0] = spec->cur_amux;
677 static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
678 struct snd_ctl_elem_value *ucontrol)
680 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
681 struct sigmatel_spec *spec = codec->spec;
682 struct snd_kcontrol *ctl =
683 snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
687 snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
688 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
690 return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
694 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
696 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
697 struct snd_ctl_elem_value *ucontrol)
699 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
700 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
701 struct sigmatel_spec *spec = codec->spec;
703 ucontrol->value.integer.value[0] = !!(spec->aloopback &
704 (spec->aloopback_mask << idx));
708 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
709 struct snd_ctl_elem_value *ucontrol)
711 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
712 struct sigmatel_spec *spec = codec->spec;
713 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
714 unsigned int dac_mode;
715 unsigned int val, idx_val;
717 idx_val = spec->aloopback_mask << idx;
718 if (ucontrol->value.integer.value[0])
719 val = spec->aloopback | idx_val;
721 val = spec->aloopback & ~idx_val;
722 if (spec->aloopback == val)
725 spec->aloopback = val;
727 /* Only return the bits defined by the shift value of the
728 * first two bytes of the mask
730 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
731 kcontrol->private_value & 0xFFFF, 0x0);
732 dac_mode >>= spec->aloopback_shift;
734 if (spec->aloopback & idx_val) {
735 snd_hda_power_up(codec);
738 snd_hda_power_down(codec);
739 dac_mode &= ~idx_val;
742 snd_hda_codec_write_cache(codec, codec->afg, 0,
743 kcontrol->private_value >> 16, dac_mode);
748 static struct hda_verb stac9200_core_init[] = {
749 /* set dac0mux for dac converter */
750 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
754 static struct hda_verb stac9200_eapd_init[] = {
755 /* set dac0mux for dac converter */
756 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
757 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
761 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
762 /* set master volume and direct control */
763 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
764 /* setup audio connections */
765 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
766 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
767 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
768 /* setup adcs to point to mixer */
769 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
770 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
771 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
772 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
773 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
774 /* setup import muxs */
775 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
776 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
777 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
778 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
782 static struct hda_verb dell_eq_core_init[] = {
783 /* set master volume to max value without distortion
784 * and direct control */
785 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
786 /* setup audio connections */
787 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
788 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02},
789 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},
790 /* setup adcs to point to mixer */
791 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
792 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
793 /* setup import muxs */
794 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
795 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
796 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
797 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
801 static struct hda_verb dell_m6_core_init[] = {
802 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
803 /* setup audio connections */
804 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
805 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
806 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
807 /* setup adcs to point to mixer */
808 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
809 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
810 /* setup import muxs */
811 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
812 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
813 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
814 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
818 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
819 /* set master volume and direct control */
820 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
821 /* setup audio connections */
822 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
823 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
824 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
825 /* connect hp ports to dac3 */
826 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
827 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
828 /* setup adcs to point to mixer */
829 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
830 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
831 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
832 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
833 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
834 /* setup import muxs */
835 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
836 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
837 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
838 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
842 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
843 /* set master volume and direct control */
844 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
845 /* setup audio connections */
846 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
847 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
848 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
849 /* dac3 is connected to import3 mux */
850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
851 /* connect hp ports to dac4 */
852 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
853 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
854 /* setup adcs to point to mixer */
855 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
856 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
857 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
858 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
859 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
860 /* setup import muxs */
861 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
862 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
863 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
864 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
868 static struct hda_verb stac92hd83xxx_core_init[] = {
869 /* start of config #1 */
870 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
872 /* start of config #2 */
873 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
874 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
875 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
877 /* power state controls amps */
878 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
881 static struct hda_verb stac92hd71bxx_core_init[] = {
882 /* set master volume and direct control */
883 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
884 /* connect headphone jack to dac1 */
885 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
886 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
887 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
888 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
889 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
892 #define HD_DISABLE_PORTF 2
893 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
894 /* start of config #1 */
896 /* connect port 0f to audio mixer */
897 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
898 /* unmute right and left channels for node 0x0f */
899 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
900 /* start of config #2 */
902 /* set master volume and direct control */
903 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
904 /* connect headphone jack to dac1 */
905 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
906 /* unmute right and left channels for nodes 0x0a, 0xd */
907 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
908 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
912 static struct hda_verb stac925x_core_init[] = {
913 /* set dac0mux for dac converter */
914 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
918 static struct hda_verb stac922x_core_init[] = {
919 /* set master volume and direct control */
920 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
924 static struct hda_verb d965_core_init[] = {
925 /* set master volume and direct control */
926 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
927 /* unmute node 0x1b */
928 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
929 /* select node 0x03 as DAC */
930 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
934 static struct hda_verb stac927x_core_init[] = {
935 /* set master volume and direct control */
936 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
937 /* enable analog pc beep path */
938 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
942 static struct hda_verb stac9205_core_init[] = {
943 /* set master volume and direct control */
944 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
945 /* enable analog pc beep path */
946 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
950 #define STAC_MONO_MUX \
952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
953 .name = "Mono Mux", \
955 .info = stac92xx_mono_mux_enum_info, \
956 .get = stac92xx_mono_mux_enum_get, \
957 .put = stac92xx_mono_mux_enum_put, \
960 #define STAC_AMP_MUX \
962 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
963 .name = "Amp Selector Capture Switch", \
965 .info = stac92xx_amp_mux_enum_info, \
966 .get = stac92xx_amp_mux_enum_get, \
967 .put = stac92xx_amp_mux_enum_put, \
970 #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
975 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
976 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
977 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
978 .info = stac92xx_amp_volume_info, \
979 .get = stac92xx_amp_volume_get, \
980 .put = stac92xx_amp_volume_put, \
981 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
982 .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
985 #define STAC_INPUT_SOURCE(cnt) \
987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
988 .name = "Input Source", \
990 .info = stac92xx_mux_enum_info, \
991 .get = stac92xx_mux_enum_get, \
992 .put = stac92xx_mux_enum_put, \
995 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
998 .name = "Analog Loopback", \
1000 .info = stac92xx_aloopback_info, \
1001 .get = stac92xx_aloopback_get, \
1002 .put = stac92xx_aloopback_put, \
1003 .private_value = verb_read | (verb_write << 16), \
1006 static struct snd_kcontrol_new stac9200_mixer[] = {
1007 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
1008 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1009 STAC_INPUT_SOURCE(1),
1010 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1011 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1015 #define DELL_M6_MIXER 6
1016 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1017 /* start of config #1 */
1018 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1019 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1021 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1022 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1024 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1025 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1027 /* start of config #2 */
1028 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1029 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1031 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1032 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1034 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1036 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1037 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1039 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1040 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1045 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1046 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1048 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1049 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1051 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1052 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1054 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1055 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1057 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1058 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1060 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1061 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1063 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1064 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1066 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1067 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1071 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1072 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1074 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1075 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1077 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1078 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1080 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1081 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1083 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1084 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1086 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1087 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1089 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1090 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1092 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1093 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1098 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1099 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
1100 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
1102 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
1103 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
1105 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT),
1106 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT),
1108 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT),
1109 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT),
1111 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT),
1112 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT),
1114 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT),
1115 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT),
1118 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
1119 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
1124 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
1125 STAC_INPUT_SOURCE(2),
1126 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1128 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1129 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1131 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1132 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1133 /* analog pc-beep replaced with digital beep support */
1135 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
1136 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
1139 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT),
1140 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT),
1142 HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT),
1143 HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT),
1145 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT),
1146 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT),
1148 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT),
1149 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT),
1153 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1154 STAC_INPUT_SOURCE(2),
1155 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1157 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1158 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1160 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1161 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1165 static struct snd_kcontrol_new stac925x_mixer[] = {
1166 STAC_INPUT_SOURCE(1),
1167 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
1168 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
1172 static struct snd_kcontrol_new stac9205_mixer[] = {
1173 STAC_INPUT_SOURCE(2),
1174 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1176 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1177 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1179 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1180 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1184 /* This needs to be generated dynamically based on sequence */
1185 static struct snd_kcontrol_new stac922x_mixer[] = {
1186 STAC_INPUT_SOURCE(2),
1187 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1188 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1190 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1191 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1196 static struct snd_kcontrol_new stac927x_mixer[] = {
1197 STAC_INPUT_SOURCE(3),
1198 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1200 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1201 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1203 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1204 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1206 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1207 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1211 static struct snd_kcontrol_new stac_dmux_mixer = {
1212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1213 .name = "Digital Input Source",
1214 /* count set later */
1215 .info = stac92xx_dmux_enum_info,
1216 .get = stac92xx_dmux_enum_get,
1217 .put = stac92xx_dmux_enum_put,
1220 static struct snd_kcontrol_new stac_smux_mixer = {
1221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1222 .name = "IEC958 Playback Source",
1223 /* count set later */
1224 .info = stac92xx_smux_enum_info,
1225 .get = stac92xx_smux_enum_get,
1226 .put = stac92xx_smux_enum_put,
1229 static const char *slave_vols[] = {
1230 "Front Playback Volume",
1231 "Surround Playback Volume",
1232 "Center Playback Volume",
1233 "LFE Playback Volume",
1234 "Side Playback Volume",
1235 "Headphone Playback Volume",
1236 "Headphone Playback Volume",
1237 "Speaker Playback Volume",
1238 "External Speaker Playback Volume",
1239 "Speaker2 Playback Volume",
1243 static const char *slave_sws[] = {
1244 "Front Playback Switch",
1245 "Surround Playback Switch",
1246 "Center Playback Switch",
1247 "LFE Playback Switch",
1248 "Side Playback Switch",
1249 "Headphone Playback Switch",
1250 "Headphone Playback Switch",
1251 "Speaker Playback Switch",
1252 "External Speaker Playback Switch",
1253 "Speaker2 Playback Switch",
1254 "IEC958 Playback Switch",
1258 static void stac92xx_free_kctls(struct hda_codec *codec);
1259 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1261 static int stac92xx_build_controls(struct hda_codec *codec)
1263 struct sigmatel_spec *spec = codec->spec;
1264 struct auto_pin_cfg *cfg = &spec->autocfg;
1269 err = snd_hda_add_new_ctls(codec, spec->mixer);
1273 for (i = 0; i < spec->num_mixers; i++) {
1274 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1278 if (spec->num_dmuxes > 0) {
1279 stac_dmux_mixer.count = spec->num_dmuxes;
1280 err = snd_hda_ctl_add(codec,
1281 snd_ctl_new1(&stac_dmux_mixer, codec));
1285 if (spec->num_smuxes > 0) {
1286 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1287 struct hda_input_mux *smux = &spec->private_smux;
1288 /* check for mute support on SPDIF out */
1289 if (wcaps & AC_WCAP_OUT_AMP) {
1290 smux->items[smux->num_items].label = "Off";
1291 smux->items[smux->num_items].index = 0;
1293 spec->spdif_mute = 1;
1295 stac_smux_mixer.count = spec->num_smuxes;
1296 err = snd_ctl_add(codec->bus->card,
1297 snd_ctl_new1(&stac_smux_mixer, codec));
1302 if (spec->multiout.dig_out_nid) {
1303 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1306 err = snd_hda_create_spdif_share_sw(codec,
1310 spec->multiout.share_spdif = 1;
1312 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1313 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1318 /* if we have no master control, let's create it */
1319 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1320 unsigned int vmaster_tlv[4];
1321 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1322 HDA_OUTPUT, vmaster_tlv);
1323 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1324 vmaster_tlv, slave_vols);
1328 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1329 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1335 stac92xx_free_kctls(codec); /* no longer needed */
1337 /* create jack input elements */
1338 if (spec->hp_detect) {
1339 for (i = 0; i < cfg->hp_outs; i++) {
1340 int type = SND_JACK_HEADPHONE;
1341 nid = cfg->hp_pins[i];
1342 /* jack detection */
1343 if (cfg->hp_outs == i)
1344 type |= SND_JACK_LINEOUT;
1345 err = stac92xx_add_jack(codec, nid, type);
1350 for (i = 0; i < cfg->line_outs; i++) {
1351 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1356 for (i = 0; i < AUTO_PIN_LAST; i++) {
1357 nid = cfg->input_pins[i];
1359 err = stac92xx_add_jack(codec, nid,
1360 SND_JACK_MICROPHONE);
1369 static unsigned int ref9200_pin_configs[8] = {
1370 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1371 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1375 STAC 9200 pin configs for
1380 static unsigned int dell9200_d21_pin_configs[8] = {
1381 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1382 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1386 STAC 9200 pin configs for
1390 static unsigned int dell9200_d22_pin_configs[8] = {
1391 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1392 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1396 STAC 9200 pin configs for
1397 102801C4 (Dell Dimension E310)
1404 static unsigned int dell9200_d23_pin_configs[8] = {
1405 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1406 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1411 STAC 9200-32 pin configs for
1412 102801B5 (Dell Inspiron 630m)
1413 102801D8 (Dell Inspiron 640m)
1415 static unsigned int dell9200_m21_pin_configs[8] = {
1416 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1417 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1421 STAC 9200-32 pin configs for
1422 102801C2 (Dell Latitude D620)
1424 102801CC (Dell Latitude D820)
1428 static unsigned int dell9200_m22_pin_configs[8] = {
1429 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1430 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1434 STAC 9200-32 pin configs for
1435 102801CE (Dell XPS M1710)
1436 102801CF (Dell Precision M90)
1438 static unsigned int dell9200_m23_pin_configs[8] = {
1439 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1440 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1444 STAC 9200-32 pin configs for
1447 102801CB (Dell Latitude 120L)
1450 static unsigned int dell9200_m24_pin_configs[8] = {
1451 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1452 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1456 STAC 9200-32 pin configs for
1457 102801BD (Dell Inspiron E1505n)
1461 static unsigned int dell9200_m25_pin_configs[8] = {
1462 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1463 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1467 STAC 9200-32 pin configs for
1468 102801F5 (Dell Inspiron 1501)
1471 static unsigned int dell9200_m26_pin_configs[8] = {
1472 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1473 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1478 102801CD (Dell Inspiron E1705/9400)
1480 static unsigned int dell9200_m27_pin_configs[8] = {
1481 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1482 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1485 static unsigned int oqo9200_pin_configs[8] = {
1486 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1487 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1491 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1492 [STAC_REF] = ref9200_pin_configs,
1493 [STAC_9200_OQO] = oqo9200_pin_configs,
1494 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1495 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1496 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1497 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1498 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1499 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1500 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1501 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1502 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1503 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1504 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1507 static const char *stac9200_models[STAC_9200_MODELS] = {
1509 [STAC_9200_OQO] = "oqo",
1510 [STAC_9200_DELL_D21] = "dell-d21",
1511 [STAC_9200_DELL_D22] = "dell-d22",
1512 [STAC_9200_DELL_D23] = "dell-d23",
1513 [STAC_9200_DELL_M21] = "dell-m21",
1514 [STAC_9200_DELL_M22] = "dell-m22",
1515 [STAC_9200_DELL_M23] = "dell-m23",
1516 [STAC_9200_DELL_M24] = "dell-m24",
1517 [STAC_9200_DELL_M25] = "dell-m25",
1518 [STAC_9200_DELL_M26] = "dell-m26",
1519 [STAC_9200_DELL_M27] = "dell-m27",
1520 [STAC_9200_GATEWAY] = "gateway",
1521 [STAC_9200_PANASONIC] = "panasonic",
1524 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1525 /* SigmaTel reference board */
1526 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1527 "DFI LanParty", STAC_REF),
1528 /* Dell laptops have BIOS problem */
1529 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1530 "unknown Dell", STAC_9200_DELL_D21),
1531 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1532 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1533 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1534 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1535 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1536 "unknown Dell", STAC_9200_DELL_D22),
1537 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1538 "unknown Dell", STAC_9200_DELL_D22),
1539 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1540 "Dell Latitude D620", STAC_9200_DELL_M22),
1541 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1542 "unknown Dell", STAC_9200_DELL_D23),
1543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1544 "unknown Dell", STAC_9200_DELL_D23),
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1546 "unknown Dell", STAC_9200_DELL_M22),
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1548 "unknown Dell", STAC_9200_DELL_M24),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1550 "unknown Dell", STAC_9200_DELL_M24),
1551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1552 "Dell Latitude 120L", STAC_9200_DELL_M24),
1553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1554 "Dell Latitude D820", STAC_9200_DELL_M22),
1555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1556 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1558 "Dell XPS M1710", STAC_9200_DELL_M23),
1559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1560 "Dell Precision M90", STAC_9200_DELL_M23),
1561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1562 "unknown Dell", STAC_9200_DELL_M22),
1563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1564 "unknown Dell", STAC_9200_DELL_M22),
1565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1566 "unknown Dell", STAC_9200_DELL_M22),
1567 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1568 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1569 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1570 "unknown Dell", STAC_9200_DELL_D23),
1571 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1572 "unknown Dell", STAC_9200_DELL_D23),
1573 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1574 "unknown Dell", STAC_9200_DELL_D21),
1575 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1576 "unknown Dell", STAC_9200_DELL_D23),
1577 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1578 "unknown Dell", STAC_9200_DELL_D21),
1579 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1580 "unknown Dell", STAC_9200_DELL_M25),
1581 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1582 "unknown Dell", STAC_9200_DELL_M25),
1583 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1584 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1585 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1586 "unknown Dell", STAC_9200_DELL_M26),
1588 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1589 /* Gateway machines needs EAPD to be set on resume */
1590 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1591 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1593 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1596 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1600 static unsigned int ref925x_pin_configs[8] = {
1601 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1602 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1605 static unsigned int stac925x_MA6_pin_configs[8] = {
1606 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1607 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1610 static unsigned int stac925x_PA6_pin_configs[8] = {
1611 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1612 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1615 static unsigned int stac925xM2_2_pin_configs[8] = {
1616 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1617 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1620 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1621 [STAC_REF] = ref925x_pin_configs,
1622 [STAC_M2_2] = stac925xM2_2_pin_configs,
1623 [STAC_MA6] = stac925x_MA6_pin_configs,
1624 [STAC_PA6] = stac925x_PA6_pin_configs,
1627 static const char *stac925x_models[STAC_925x_MODELS] = {
1629 [STAC_M2_2] = "m2-2",
1634 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1635 /* SigmaTel reference board */
1636 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1637 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1638 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1639 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1640 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1641 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1642 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1646 static unsigned int ref92hd73xx_pin_configs[13] = {
1647 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1648 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1649 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1653 static unsigned int dell_m6_pin_configs[13] = {
1654 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1655 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1656 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1660 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1661 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1662 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1663 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1664 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1665 [STAC_DELL_EQ] = dell_m6_pin_configs,
1668 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1669 [STAC_92HD73XX_NO_JD] = "no-jd",
1670 [STAC_92HD73XX_REF] = "ref",
1671 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1672 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1673 [STAC_DELL_M6_BOTH] = "dell-m6",
1674 [STAC_DELL_EQ] = "dell-eq",
1677 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1678 /* SigmaTel reference board */
1679 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1680 "DFI LanParty", STAC_92HD73XX_REF),
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1682 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1683 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1684 "unknown Dell", STAC_DELL_M6_DMIC),
1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1686 "unknown Dell", STAC_DELL_M6_BOTH),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1688 "unknown Dell", STAC_DELL_M6_BOTH),
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1690 "unknown Dell", STAC_DELL_M6_AMIC),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1692 "unknown Dell", STAC_DELL_M6_AMIC),
1693 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1694 "unknown Dell", STAC_DELL_M6_DMIC),
1695 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1696 "unknown Dell", STAC_DELL_M6_DMIC),
1697 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1698 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1699 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1700 "Dell Studio 17", STAC_DELL_M6_DMIC),
1704 static unsigned int ref92hd83xxx_pin_configs[14] = {
1705 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1706 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1707 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1708 0x01451160, 0x98560170,
1711 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1712 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1715 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1716 [STAC_92HD83XXX_REF] = "ref",
1719 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1720 /* SigmaTel reference board */
1721 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1722 "DFI LanParty", STAC_92HD71BXX_REF),
1725 static unsigned int ref92hd71bxx_pin_configs[11] = {
1726 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1727 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1728 0x90a000f0, 0x01452050, 0x01452050,
1731 static unsigned int dell_m4_1_pin_configs[11] = {
1732 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1733 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1734 0x40f000f0, 0x4f0000f0, 0x4f0000f0,
1737 static unsigned int dell_m4_2_pin_configs[11] = {
1738 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1739 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1740 0x40f000f0, 0x044413b0, 0x044413b0,
1743 static unsigned int dell_m4_3_pin_configs[11] = {
1744 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1745 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1746 0x40f000f0, 0x044413b0, 0x044413b0,
1749 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1750 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1751 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1752 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1753 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1754 [STAC_HP_M4] = NULL,
1757 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1758 [STAC_92HD71BXX_REF] = "ref",
1759 [STAC_DELL_M4_1] = "dell-m4-1",
1760 [STAC_DELL_M4_2] = "dell-m4-2",
1761 [STAC_DELL_M4_3] = "dell-m4-3",
1762 [STAC_HP_M4] = "hp-m4",
1765 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1766 /* SigmaTel reference board */
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1768 "DFI LanParty", STAC_92HD71BXX_REF),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
1770 "HP dv5", STAC_HP_M4),
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
1772 "HP dv7", STAC_HP_M4),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1774 "unknown HP", STAC_HP_M4),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1776 "unknown Dell", STAC_DELL_M4_1),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1778 "unknown Dell", STAC_DELL_M4_1),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1780 "unknown Dell", STAC_DELL_M4_1),
1781 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1782 "unknown Dell", STAC_DELL_M4_1),
1783 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1784 "unknown Dell", STAC_DELL_M4_1),
1785 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1786 "unknown Dell", STAC_DELL_M4_1),
1787 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1788 "unknown Dell", STAC_DELL_M4_1),
1789 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1790 "unknown Dell", STAC_DELL_M4_2),
1791 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1792 "unknown Dell", STAC_DELL_M4_2),
1793 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1794 "unknown Dell", STAC_DELL_M4_2),
1795 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1796 "unknown Dell", STAC_DELL_M4_2),
1797 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1798 "unknown Dell", STAC_DELL_M4_3),
1802 static unsigned int ref922x_pin_configs[10] = {
1803 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1804 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1805 0x40000100, 0x40000100,
1809 STAC 922X pin configs for
1816 static unsigned int dell_922x_d81_pin_configs[10] = {
1817 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1818 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1819 0x01813122, 0x400001f2,
1823 STAC 922X pin configs for
1827 static unsigned int dell_922x_d82_pin_configs[10] = {
1828 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1829 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1830 0x01813122, 0x400001f1,
1834 STAC 922X pin configs for
1837 static unsigned int dell_922x_m81_pin_configs[10] = {
1838 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1839 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1840 0x40C003f1, 0x405003f0,
1844 STAC 9221 A1 pin configs for
1845 102801D7 (Dell XPS M1210)
1847 static unsigned int dell_922x_m82_pin_configs[10] = {
1848 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1849 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1850 0x508003f3, 0x405003f4,
1853 static unsigned int d945gtp3_pin_configs[10] = {
1854 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1855 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1856 0x02a19120, 0x40000100,
1859 static unsigned int d945gtp5_pin_configs[10] = {
1860 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1861 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1862 0x02a19320, 0x40000100,
1865 static unsigned int intel_mac_v1_pin_configs[10] = {
1866 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1867 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1868 0x400000fc, 0x400000fb,
1871 static unsigned int intel_mac_v2_pin_configs[10] = {
1872 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1873 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1874 0x400000fc, 0x400000fb,
1877 static unsigned int intel_mac_v3_pin_configs[10] = {
1878 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1879 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1880 0x400000fc, 0x400000fb,
1883 static unsigned int intel_mac_v4_pin_configs[10] = {
1884 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1885 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1886 0x400000fc, 0x400000fb,
1889 static unsigned int intel_mac_v5_pin_configs[10] = {
1890 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1891 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1892 0x400000fc, 0x400000fb,
1895 static unsigned int ecs202_pin_configs[10] = {
1896 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1897 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1898 0x9037012e, 0x40e000f2,
1901 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1902 [STAC_D945_REF] = ref922x_pin_configs,
1903 [STAC_D945GTP3] = d945gtp3_pin_configs,
1904 [STAC_D945GTP5] = d945gtp5_pin_configs,
1905 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1906 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1907 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1908 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1909 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1910 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1911 /* for backward compatibility */
1912 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1913 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1914 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1915 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1916 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1917 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1918 [STAC_ECS_202] = ecs202_pin_configs,
1919 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1920 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1921 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1922 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1925 static const char *stac922x_models[STAC_922X_MODELS] = {
1926 [STAC_D945_REF] = "ref",
1927 [STAC_D945GTP5] = "5stack",
1928 [STAC_D945GTP3] = "3stack",
1929 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1930 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1931 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1932 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1933 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1934 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1935 /* for backward compatibility */
1936 [STAC_MACMINI] = "macmini",
1937 [STAC_MACBOOK] = "macbook",
1938 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1939 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1940 [STAC_IMAC_INTEL] = "imac-intel",
1941 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1942 [STAC_ECS_202] = "ecs202",
1943 [STAC_922X_DELL_D81] = "dell-d81",
1944 [STAC_922X_DELL_D82] = "dell-d82",
1945 [STAC_922X_DELL_M81] = "dell-m81",
1946 [STAC_922X_DELL_M82] = "dell-m82",
1949 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1950 /* SigmaTel reference board */
1951 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1952 "DFI LanParty", STAC_D945_REF),
1953 /* Intel 945G based systems */
1954 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1955 "Intel D945G", STAC_D945GTP3),
1956 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1957 "Intel D945G", STAC_D945GTP3),
1958 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1959 "Intel D945G", STAC_D945GTP3),
1960 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1961 "Intel D945G", STAC_D945GTP3),
1962 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1963 "Intel D945G", STAC_D945GTP3),
1964 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1965 "Intel D945G", STAC_D945GTP3),
1966 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1967 "Intel D945G", STAC_D945GTP3),
1968 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1969 "Intel D945G", STAC_D945GTP3),
1970 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1971 "Intel D945G", STAC_D945GTP3),
1972 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1973 "Intel D945G", STAC_D945GTP3),
1974 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1975 "Intel D945G", STAC_D945GTP3),
1976 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1977 "Intel D945G", STAC_D945GTP3),
1978 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1979 "Intel D945G", STAC_D945GTP3),
1980 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1981 "Intel D945G", STAC_D945GTP3),
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1983 "Intel D945G", STAC_D945GTP3),
1984 /* Intel D945G 5-stack systems */
1985 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1986 "Intel D945G", STAC_D945GTP5),
1987 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1988 "Intel D945G", STAC_D945GTP5),
1989 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1990 "Intel D945G", STAC_D945GTP5),
1991 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1992 "Intel D945G", STAC_D945GTP5),
1993 /* Intel 945P based systems */
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1995 "Intel D945P", STAC_D945GTP3),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1997 "Intel D945P", STAC_D945GTP3),
1998 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1999 "Intel D945P", STAC_D945GTP3),
2000 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
2001 "Intel D945P", STAC_D945GTP3),
2002 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
2003 "Intel D945P", STAC_D945GTP3),
2004 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2005 "Intel D945P", STAC_D945GTP5),
2007 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2008 SND_PCI_QUIRK(0x8384, 0x7680,
2009 "Mac", STAC_INTEL_MAC_AUTO),
2011 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2012 "unknown Dell", STAC_922X_DELL_D81),
2013 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2014 "unknown Dell", STAC_922X_DELL_D81),
2015 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2016 "unknown Dell", STAC_922X_DELL_D81),
2017 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2018 "unknown Dell", STAC_922X_DELL_D82),
2019 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2020 "unknown Dell", STAC_922X_DELL_M81),
2021 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2022 "unknown Dell", STAC_922X_DELL_D82),
2023 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2024 "unknown Dell", STAC_922X_DELL_D81),
2025 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2026 "unknown Dell", STAC_922X_DELL_D81),
2027 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2028 "Dell XPS M1210", STAC_922X_DELL_M82),
2029 /* ECS/PC Chips boards */
2030 SND_PCI_QUIRK(0x1019, 0x2144,
2031 "ECS/PC chips", STAC_ECS_202),
2032 SND_PCI_QUIRK(0x1019, 0x2608,
2033 "ECS/PC chips", STAC_ECS_202),
2034 SND_PCI_QUIRK(0x1019, 0x2633,
2035 "ECS/PC chips P17G/1333", STAC_ECS_202),
2036 SND_PCI_QUIRK(0x1019, 0x2811,
2037 "ECS/PC chips", STAC_ECS_202),
2038 SND_PCI_QUIRK(0x1019, 0x2812,
2039 "ECS/PC chips", STAC_ECS_202),
2040 SND_PCI_QUIRK(0x1019, 0x2813,
2041 "ECS/PC chips", STAC_ECS_202),
2042 SND_PCI_QUIRK(0x1019, 0x2814,
2043 "ECS/PC chips", STAC_ECS_202),
2044 SND_PCI_QUIRK(0x1019, 0x2815,
2045 "ECS/PC chips", STAC_ECS_202),
2046 SND_PCI_QUIRK(0x1019, 0x2816,
2047 "ECS/PC chips", STAC_ECS_202),
2048 SND_PCI_QUIRK(0x1019, 0x2817,
2049 "ECS/PC chips", STAC_ECS_202),
2050 SND_PCI_QUIRK(0x1019, 0x2818,
2051 "ECS/PC chips", STAC_ECS_202),
2052 SND_PCI_QUIRK(0x1019, 0x2819,
2053 "ECS/PC chips", STAC_ECS_202),
2054 SND_PCI_QUIRK(0x1019, 0x2820,
2055 "ECS/PC chips", STAC_ECS_202),
2059 static unsigned int ref927x_pin_configs[14] = {
2060 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2061 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2062 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2063 0x01c42190, 0x40000100,
2066 static unsigned int d965_3st_pin_configs[14] = {
2067 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2068 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2069 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2070 0x40000100, 0x40000100
2073 static unsigned int d965_5st_pin_configs[14] = {
2074 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2075 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2076 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2077 0x40000100, 0x40000100
2080 static unsigned int dell_3st_pin_configs[14] = {
2081 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2082 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2083 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2084 0x40c003fc, 0x40000100
2087 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2088 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2089 [STAC_D965_REF] = ref927x_pin_configs,
2090 [STAC_D965_3ST] = d965_3st_pin_configs,
2091 [STAC_D965_5ST] = d965_5st_pin_configs,
2092 [STAC_DELL_3ST] = dell_3st_pin_configs,
2093 [STAC_DELL_BIOS] = NULL,
2096 static const char *stac927x_models[STAC_927X_MODELS] = {
2097 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2098 [STAC_D965_REF] = "ref",
2099 [STAC_D965_3ST] = "3stack",
2100 [STAC_D965_5ST] = "5stack",
2101 [STAC_DELL_3ST] = "dell-3stack",
2102 [STAC_DELL_BIOS] = "dell-bios",
2105 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2106 /* SigmaTel reference board */
2107 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2108 "DFI LanParty", STAC_D965_REF),
2109 /* Intel 946 based systems */
2110 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2111 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2112 /* 965 based 3 stack systems */
2113 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
2115 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
2117 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
2119 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
2121 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
2122 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
2123 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
2124 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
2125 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
2127 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
2128 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
2129 /* Dell 3 stack systems */
2130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2131 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2133 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2134 /* Dell 3 stack systems with verb table in BIOS */
2135 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2136 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2137 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2138 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
2139 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2140 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2141 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2142 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2143 /* 965 based 5 stack systems */
2144 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
2145 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
2146 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
2147 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
2148 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
2149 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
2150 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
2151 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
2152 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
2156 static unsigned int ref9205_pin_configs[12] = {
2157 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2158 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2159 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2163 STAC 9205 pin configs for
2170 10280228 (Dell Vostro 1500)
2172 static unsigned int dell_9205_m42_pin_configs[12] = {
2173 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2174 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2175 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2179 STAC 9205 pin configs for
2183 102801FF (Dell Precision M4300)
2188 static unsigned int dell_9205_m43_pin_configs[12] = {
2189 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2190 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2191 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2194 static unsigned int dell_9205_m44_pin_configs[12] = {
2195 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2196 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2197 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2200 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2201 [STAC_9205_REF] = ref9205_pin_configs,
2202 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2203 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2204 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2207 static const char *stac9205_models[STAC_9205_MODELS] = {
2208 [STAC_9205_REF] = "ref",
2209 [STAC_9205_DELL_M42] = "dell-m42",
2210 [STAC_9205_DELL_M43] = "dell-m43",
2211 [STAC_9205_DELL_M44] = "dell-m44",
2214 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2215 /* SigmaTel reference board */
2216 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2217 "DFI LanParty", STAC_9205_REF),
2218 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2219 "unknown Dell", STAC_9205_DELL_M42),
2220 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2221 "unknown Dell", STAC_9205_DELL_M42),
2222 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2223 "Dell Precision", STAC_9205_DELL_M43),
2224 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2225 "Dell Precision", STAC_9205_DELL_M43),
2226 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2227 "Dell Precision", STAC_9205_DELL_M43),
2228 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2229 "unknown Dell", STAC_9205_DELL_M42),
2230 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2231 "unknown Dell", STAC_9205_DELL_M42),
2232 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2233 "Dell Precision", STAC_9205_DELL_M43),
2234 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2235 "Dell Precision M4300", STAC_9205_DELL_M43),
2236 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2237 "unknown Dell", STAC_9205_DELL_M42),
2238 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2239 "Dell Precision", STAC_9205_DELL_M43),
2240 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2241 "Dell Precision", STAC_9205_DELL_M43),
2242 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2243 "Dell Precision", STAC_9205_DELL_M43),
2244 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2245 "Dell Inspiron", STAC_9205_DELL_M44),
2246 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2247 "Dell Vostro 1500", STAC_9205_DELL_M42),
2251 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
2254 struct sigmatel_spec *spec = codec->spec;
2256 kfree(spec->pin_configs);
2257 spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs),
2259 if (!spec->pin_configs)
2262 for (i = 0; i < spec->num_pins; i++) {
2263 hda_nid_t nid = spec->pin_nids[i];
2264 unsigned int pin_cfg;
2266 pin_cfg = snd_hda_codec_read(codec, nid, 0,
2267 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
2268 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
2270 spec->pin_configs[i] = pin_cfg;
2276 static void stac92xx_set_config_reg(struct hda_codec *codec,
2277 hda_nid_t pin_nid, unsigned int pin_config)
2280 snd_hda_codec_write(codec, pin_nid, 0,
2281 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2282 pin_config & 0x000000ff);
2283 snd_hda_codec_write(codec, pin_nid, 0,
2284 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2285 (pin_config & 0x0000ff00) >> 8);
2286 snd_hda_codec_write(codec, pin_nid, 0,
2287 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2288 (pin_config & 0x00ff0000) >> 16);
2289 snd_hda_codec_write(codec, pin_nid, 0,
2290 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2292 i = snd_hda_codec_read(codec, pin_nid, 0,
2293 AC_VERB_GET_CONFIG_DEFAULT,
2295 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
2299 static void stac92xx_set_config_regs(struct hda_codec *codec)
2302 struct sigmatel_spec *spec = codec->spec;
2304 if (!spec->pin_configs)
2307 for (i = 0; i < spec->num_pins; i++)
2308 stac92xx_set_config_reg(codec, spec->pin_nids[i],
2309 spec->pin_configs[i]);
2312 static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins)
2314 struct sigmatel_spec *spec = codec->spec;
2317 return stac92xx_save_bios_config_regs(codec);
2319 kfree(spec->pin_configs);
2320 spec->pin_configs = kmemdup(pins,
2321 spec->num_pins * sizeof(*pins),
2323 if (!spec->pin_configs)
2326 stac92xx_set_config_regs(codec);
2330 static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid,
2333 struct sigmatel_spec *spec = codec->spec;
2336 for (i = 0; i < spec->num_pins; i++) {
2337 if (spec->pin_nids[i] == nid) {
2338 spec->pin_configs[i] = cfg;
2339 stac92xx_set_config_reg(codec, nid, cfg);
2346 * Analog playback callbacks
2348 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2349 struct hda_codec *codec,
2350 struct snd_pcm_substream *substream)
2352 struct sigmatel_spec *spec = codec->spec;
2353 if (spec->stream_delay)
2354 msleep(spec->stream_delay);
2355 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2359 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2360 struct hda_codec *codec,
2361 unsigned int stream_tag,
2362 unsigned int format,
2363 struct snd_pcm_substream *substream)
2365 struct sigmatel_spec *spec = codec->spec;
2366 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2369 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2370 struct hda_codec *codec,
2371 struct snd_pcm_substream *substream)
2373 struct sigmatel_spec *spec = codec->spec;
2374 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2378 * Digital playback callbacks
2380 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2381 struct hda_codec *codec,
2382 struct snd_pcm_substream *substream)
2384 struct sigmatel_spec *spec = codec->spec;
2385 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2388 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2389 struct hda_codec *codec,
2390 struct snd_pcm_substream *substream)
2392 struct sigmatel_spec *spec = codec->spec;
2393 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2396 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2397 struct hda_codec *codec,
2398 unsigned int stream_tag,
2399 unsigned int format,
2400 struct snd_pcm_substream *substream)
2402 struct sigmatel_spec *spec = codec->spec;
2403 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2404 stream_tag, format, substream);
2409 * Analog capture callbacks
2411 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2412 struct hda_codec *codec,
2413 unsigned int stream_tag,
2414 unsigned int format,
2415 struct snd_pcm_substream *substream)
2417 struct sigmatel_spec *spec = codec->spec;
2418 hda_nid_t nid = spec->adc_nids[substream->number];
2420 if (spec->powerdown_adcs) {
2422 snd_hda_codec_write(codec, nid, 0,
2423 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2425 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2429 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2430 struct hda_codec *codec,
2431 struct snd_pcm_substream *substream)
2433 struct sigmatel_spec *spec = codec->spec;
2434 hda_nid_t nid = spec->adc_nids[substream->number];
2436 snd_hda_codec_cleanup_stream(codec, nid);
2437 if (spec->powerdown_adcs)
2438 snd_hda_codec_write(codec, nid, 0,
2439 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2443 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2447 /* NID is set in stac92xx_build_pcms */
2449 .open = stac92xx_dig_playback_pcm_open,
2450 .close = stac92xx_dig_playback_pcm_close,
2451 .prepare = stac92xx_dig_playback_pcm_prepare
2455 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2459 /* NID is set in stac92xx_build_pcms */
2462 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2466 .nid = 0x02, /* NID to query formats and rates */
2468 .open = stac92xx_playback_pcm_open,
2469 .prepare = stac92xx_playback_pcm_prepare,
2470 .cleanup = stac92xx_playback_pcm_cleanup
2474 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2478 .nid = 0x06, /* NID to query formats and rates */
2480 .open = stac92xx_playback_pcm_open,
2481 .prepare = stac92xx_playback_pcm_prepare,
2482 .cleanup = stac92xx_playback_pcm_cleanup
2486 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2489 /* NID + .substreams is set in stac92xx_build_pcms */
2491 .prepare = stac92xx_capture_pcm_prepare,
2492 .cleanup = stac92xx_capture_pcm_cleanup
2496 static int stac92xx_build_pcms(struct hda_codec *codec)
2498 struct sigmatel_spec *spec = codec->spec;
2499 struct hda_pcm *info = spec->pcm_rec;
2501 codec->num_pcms = 1;
2502 codec->pcm_info = info;
2504 info->name = "STAC92xx Analog";
2505 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2506 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2507 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2508 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2510 if (spec->alt_switch) {
2513 info->name = "STAC92xx Analog Alt";
2514 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2517 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2520 info->name = "STAC92xx Digital";
2521 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2522 if (spec->multiout.dig_out_nid) {
2523 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2524 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2526 if (spec->dig_in_nid) {
2527 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2528 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2535 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2537 unsigned int pincap = snd_hda_param_read(codec, nid,
2539 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2540 if (pincap & AC_PINCAP_VREF_100)
2541 return AC_PINCTL_VREF_100;
2542 if (pincap & AC_PINCAP_VREF_80)
2543 return AC_PINCTL_VREF_80;
2544 if (pincap & AC_PINCAP_VREF_50)
2545 return AC_PINCTL_VREF_50;
2546 if (pincap & AC_PINCAP_VREF_GRD)
2547 return AC_PINCTL_VREF_GRD;
2551 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2554 snd_hda_codec_write_cache(codec, nid, 0,
2555 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2558 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2560 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2561 struct snd_ctl_elem_value *ucontrol)
2563 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2564 struct sigmatel_spec *spec = codec->spec;
2566 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2570 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
2571 unsigned char type);
2573 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2574 struct snd_ctl_elem_value *ucontrol)
2576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2577 struct sigmatel_spec *spec = codec->spec;
2578 int nid = kcontrol->private_value;
2580 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2582 /* check to be sure that the ports are upto date with
2585 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2590 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2592 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2594 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2595 struct sigmatel_spec *spec = codec->spec;
2596 int io_idx = kcontrol-> private_value & 0xff;
2598 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2602 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2605 struct sigmatel_spec *spec = codec->spec;
2606 hda_nid_t nid = kcontrol->private_value >> 8;
2607 int io_idx = kcontrol-> private_value & 0xff;
2608 unsigned short val = !!ucontrol->value.integer.value[0];
2610 spec->io_switch[io_idx] = val;
2613 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2615 unsigned int pinctl = AC_PINCTL_IN_EN;
2616 if (io_idx) /* set VREF for mic */
2617 pinctl |= stac92xx_get_vref(codec, nid);
2618 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2621 /* check the auto-mute again: we need to mute/unmute the speaker
2622 * appropriately according to the pin direction
2624 if (spec->hp_detect)
2625 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2630 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2632 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2633 struct snd_ctl_elem_value *ucontrol)
2635 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2636 struct sigmatel_spec *spec = codec->spec;
2638 ucontrol->value.integer.value[0] = spec->clfe_swap;
2642 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2643 struct snd_ctl_elem_value *ucontrol)
2645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2646 struct sigmatel_spec *spec = codec->spec;
2647 hda_nid_t nid = kcontrol->private_value & 0xff;
2648 unsigned int val = !!ucontrol->value.integer.value[0];
2650 if (spec->clfe_swap == val)
2653 spec->clfe_swap = val;
2655 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2656 spec->clfe_swap ? 0x4 : 0x0);
2661 #define STAC_CODEC_HP_SWITCH(xname) \
2662 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2665 .info = stac92xx_hp_switch_info, \
2666 .get = stac92xx_hp_switch_get, \
2667 .put = stac92xx_hp_switch_put, \
2670 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2671 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2674 .info = stac92xx_io_switch_info, \
2675 .get = stac92xx_io_switch_get, \
2676 .put = stac92xx_io_switch_put, \
2677 .private_value = xpval, \
2680 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2681 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2684 .info = stac92xx_clfe_switch_info, \
2685 .get = stac92xx_clfe_switch_get, \
2686 .put = stac92xx_clfe_switch_put, \
2687 .private_value = xpval, \
2691 STAC_CTL_WIDGET_VOL,
2692 STAC_CTL_WIDGET_MUTE,
2693 STAC_CTL_WIDGET_MONO_MUX,
2694 STAC_CTL_WIDGET_AMP_MUX,
2695 STAC_CTL_WIDGET_AMP_VOL,
2696 STAC_CTL_WIDGET_HP_SWITCH,
2697 STAC_CTL_WIDGET_IO_SWITCH,
2698 STAC_CTL_WIDGET_CLFE_SWITCH
2701 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2702 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2703 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2706 STAC_AMP_VOL(NULL, 0, 0, 0, 0),
2707 STAC_CODEC_HP_SWITCH(NULL),
2708 STAC_CODEC_IO_SWITCH(NULL, 0),
2709 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2712 /* add dynamic controls */
2713 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2714 struct snd_kcontrol_new *ktemp,
2715 int idx, const char *name,
2718 struct snd_kcontrol_new *knew;
2720 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2721 knew = snd_array_new(&spec->kctls);
2726 knew->name = kstrdup(name, GFP_KERNEL);
2729 knew->private_value = val;
2733 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2734 int type, int idx, const char *name,
2737 return stac92xx_add_control_temp(spec,
2738 &stac92xx_control_templates[type],
2743 /* add dynamic controls */
2744 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2745 const char *name, unsigned long val)
2747 return stac92xx_add_control_idx(spec, type, 0, name, val);
2750 /* flag inputs as additional dynamic lineouts */
2751 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2753 struct sigmatel_spec *spec = codec->spec;
2754 unsigned int wcaps, wtype;
2755 int i, num_dacs = 0;
2757 /* use the wcaps cache to count all DACs available for line-outs */
2758 for (i = 0; i < codec->num_nodes; i++) {
2759 wcaps = codec->wcaps[i];
2760 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2762 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2766 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2768 switch (cfg->line_outs) {
2770 /* add line-in as side */
2771 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2772 cfg->line_out_pins[cfg->line_outs] =
2773 cfg->input_pins[AUTO_PIN_LINE];
2774 spec->line_switch = 1;
2779 /* add line-in as clfe and mic as side */
2780 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2781 cfg->line_out_pins[cfg->line_outs] =
2782 cfg->input_pins[AUTO_PIN_LINE];
2783 spec->line_switch = 1;
2786 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2787 cfg->line_out_pins[cfg->line_outs] =
2788 cfg->input_pins[AUTO_PIN_MIC];
2789 spec->mic_switch = 1;
2794 /* add line-in as surr and mic as clfe */
2795 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2796 cfg->line_out_pins[cfg->line_outs] =
2797 cfg->input_pins[AUTO_PIN_LINE];
2798 spec->line_switch = 1;
2801 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2802 cfg->line_out_pins[cfg->line_outs] =
2803 cfg->input_pins[AUTO_PIN_MIC];
2804 spec->mic_switch = 1;
2814 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2818 for (i = 0; i < spec->multiout.num_dacs; i++) {
2819 if (spec->multiout.dac_nids[i] == nid)
2827 * Fill in the dac_nids table from the parsed pin configuration
2828 * This function only works when every pin in line_out_pins[]
2829 * contains atleast one DAC in its connection list. Some 92xx
2830 * codecs are not connected directly to a DAC, such as the 9200
2831 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2833 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2834 struct auto_pin_cfg *cfg)
2836 struct sigmatel_spec *spec = codec->spec;
2837 int i, j, conn_len = 0;
2838 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2839 unsigned int wcaps, wtype;
2841 for (i = 0; i < cfg->line_outs; i++) {
2842 nid = cfg->line_out_pins[i];
2843 conn_len = snd_hda_get_connections(codec, nid, conn,
2844 HDA_MAX_CONNECTIONS);
2845 for (j = 0; j < conn_len; j++) {
2846 wcaps = snd_hda_param_read(codec, conn[j],
2847 AC_PAR_AUDIO_WIDGET_CAP);
2848 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2849 if (wtype != AC_WID_AUD_OUT ||
2850 (wcaps & AC_WCAP_DIGITAL))
2852 /* conn[j] is a DAC routed to this line-out */
2853 if (!is_in_dac_nids(spec, conn[j]))
2857 if (j == conn_len) {
2858 if (spec->multiout.num_dacs > 0) {
2859 /* we have already working output pins,
2860 * so let's drop the broken ones again
2862 cfg->line_outs = spec->multiout.num_dacs;
2865 /* error out, no available DAC found */
2867 "%s: No available DAC for pin 0x%x\n",
2872 spec->multiout.dac_nids[i] = conn[j];
2873 spec->multiout.num_dacs++;
2875 /* select this DAC in the pin's input mux */
2876 snd_hda_codec_write_cache(codec, nid, 0,
2877 AC_VERB_SET_CONNECT_SEL, j);
2882 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2883 spec->multiout.num_dacs,
2884 spec->multiout.dac_nids[0],
2885 spec->multiout.dac_nids[1],
2886 spec->multiout.dac_nids[2],
2887 spec->multiout.dac_nids[3],
2888 spec->multiout.dac_nids[4]);
2892 /* create volume control/switch for the given prefx type */
2893 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2898 sprintf(name, "%s Playback Volume", pfx);
2899 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2900 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2903 sprintf(name, "%s Playback Switch", pfx);
2904 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2905 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2911 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2913 if (!spec->multiout.hp_nid)
2914 spec->multiout.hp_nid = nid;
2915 else if (spec->multiout.num_dacs > 4) {
2916 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2919 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2920 spec->multiout.num_dacs++;
2925 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2927 if (is_in_dac_nids(spec, nid))
2929 if (spec->multiout.hp_nid == nid)
2934 /* add playback controls from the parsed DAC table */
2935 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2936 const struct auto_pin_cfg *cfg)
2938 static const char *chname[4] = {
2939 "Front", "Surround", NULL /*CLFE*/, "Side"
2944 struct sigmatel_spec *spec = codec->spec;
2945 unsigned int wid_caps, pincap;
2948 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2949 if (!spec->multiout.dac_nids[i])
2952 nid = spec->multiout.dac_nids[i];
2956 err = create_controls(spec, "Center", nid, 1);
2959 err = create_controls(spec, "LFE", nid, 2);
2963 wid_caps = get_wcaps(codec, nid);
2965 if (wid_caps & AC_WCAP_LR_SWAP) {
2966 err = stac92xx_add_control(spec,
2967 STAC_CTL_WIDGET_CLFE_SWITCH,
2968 "Swap Center/LFE Playback Switch", nid);
2975 err = create_controls(spec, chname[i], nid, 3);
2981 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 &&
2982 cfg->hp_outs && !spec->multiout.hp_nid)
2983 spec->multiout.hp_nid = nid;
2985 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
2986 err = stac92xx_add_control(spec,
2987 STAC_CTL_WIDGET_HP_SWITCH,
2988 "Headphone as Line Out Switch",
2989 cfg->hp_pins[cfg->hp_outs - 1]);
2994 if (spec->line_switch) {
2995 nid = cfg->input_pins[AUTO_PIN_LINE];
2996 pincap = snd_hda_param_read(codec, nid,
2998 if (pincap & AC_PINCAP_OUT) {
2999 err = stac92xx_add_control(spec,
3000 STAC_CTL_WIDGET_IO_SWITCH,
3001 "Line In as Output Switch", nid << 8);
3007 if (spec->mic_switch) {
3008 unsigned int def_conf;
3009 unsigned int mic_pin = AUTO_PIN_MIC;
3011 nid = cfg->input_pins[mic_pin];
3012 def_conf = snd_hda_codec_read(codec, nid, 0,
3013 AC_VERB_GET_CONFIG_DEFAULT, 0);
3014 /* some laptops have an internal analog microphone
3015 * which can't be used as a output */
3016 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
3017 pincap = snd_hda_param_read(codec, nid,
3019 if (pincap & AC_PINCAP_OUT) {
3020 err = stac92xx_add_control(spec,
3021 STAC_CTL_WIDGET_IO_SWITCH,
3022 "Mic as Output Switch", (nid << 8) | 1);
3023 nid = snd_hda_codec_read(codec, nid, 0,
3024 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3025 if (!check_in_dac_nids(spec, nid))
3026 add_spec_dacs(spec, nid);
3030 } else if (mic_pin == AUTO_PIN_MIC) {
3031 mic_pin = AUTO_PIN_FRONT_MIC;
3039 /* add playback controls for Speaker and HP outputs */
3040 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3041 struct auto_pin_cfg *cfg)
3043 struct sigmatel_spec *spec = codec->spec;
3045 int i, old_num_dacs, err;
3047 old_num_dacs = spec->multiout.num_dacs;
3048 for (i = 0; i < cfg->hp_outs; i++) {
3049 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
3050 if (wid_caps & AC_WCAP_UNSOL_CAP)
3051 spec->hp_detect = 1;
3052 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
3053 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3054 if (check_in_dac_nids(spec, nid))
3058 add_spec_dacs(spec, nid);
3060 for (i = 0; i < cfg->speaker_outs; i++) {
3061 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
3062 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3063 if (check_in_dac_nids(spec, nid))
3067 add_spec_dacs(spec, nid);
3069 for (i = 0; i < cfg->line_outs; i++) {
3070 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
3071 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3072 if (check_in_dac_nids(spec, nid))
3076 add_spec_dacs(spec, nid);
3078 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
3079 static const char *pfxs[] = {
3080 "Speaker", "External Speaker", "Speaker2",
3082 err = create_controls(spec, pfxs[i - old_num_dacs],
3083 spec->multiout.dac_nids[i], 3);
3087 if (spec->multiout.hp_nid) {
3088 err = create_controls(spec, "Headphone",
3089 spec->multiout.hp_nid, 3);
3097 /* labels for mono mux outputs */
3098 static const char *stac92xx_mono_labels[4] = {
3099 "DAC0", "DAC1", "Mixer", "DAC2"
3102 /* create mono mux for mono out on capable codecs */
3103 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3105 struct sigmatel_spec *spec = codec->spec;
3106 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3108 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3110 num_cons = snd_hda_get_connections(codec,
3113 HDA_MAX_NUM_INPUTS);
3114 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3117 for (i = 0; i < num_cons; i++) {
3118 mono_mux->items[mono_mux->num_items].label =
3119 stac92xx_mono_labels[i];
3120 mono_mux->items[mono_mux->num_items].index = i;
3121 mono_mux->num_items++;
3124 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3125 "Mono Mux", spec->mono_nid);
3128 /* labels for amp mux outputs */
3129 static const char *stac92xx_amp_labels[3] = {
3130 "Front Microphone", "Microphone", "Line In",
3133 /* create amp out controls mux on capable codecs */
3134 static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
3136 struct sigmatel_spec *spec = codec->spec;
3137 struct hda_input_mux *amp_mux = &spec->private_amp_mux;
3140 for (i = 0; i < spec->num_amps; i++) {
3141 amp_mux->items[amp_mux->num_items].label =
3142 stac92xx_amp_labels[i];
3143 amp_mux->items[amp_mux->num_items].index = i;
3144 amp_mux->num_items++;
3147 if (spec->num_amps > 1) {
3148 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
3149 "Amp Selector Capture Switch", 0);
3153 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
3154 "Amp Capture Volume",
3155 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
3159 /* create PC beep volume controls */
3160 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3163 struct sigmatel_spec *spec = codec->spec;
3164 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3167 /* check for mute support for the the amp */
3168 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3169 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3170 "PC Beep Playback Switch",
3171 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3176 /* check to see if there is volume support for the amp */
3177 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3178 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3179 "PC Beep Playback Volume",
3180 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3187 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3188 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3190 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3191 struct snd_ctl_elem_value *ucontrol)
3193 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3194 ucontrol->value.integer.value[0] = codec->beep->enabled;
3198 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3199 struct snd_ctl_elem_value *ucontrol)
3201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3202 int enabled = !!ucontrol->value.integer.value[0];
3203 if (codec->beep->enabled != enabled) {
3204 codec->beep->enabled = enabled;
3210 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3212 .info = stac92xx_dig_beep_switch_info,
3213 .get = stac92xx_dig_beep_switch_get,
3214 .put = stac92xx_dig_beep_switch_put,
3217 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3219 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3220 0, "PC Beep Playback Switch", 0);
3224 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3226 struct sigmatel_spec *spec = codec->spec;
3227 int wcaps, nid, i, err = 0;
3229 for (i = 0; i < spec->num_muxes; i++) {
3230 nid = spec->mux_nids[i];
3231 wcaps = get_wcaps(codec, nid);
3233 if (wcaps & AC_WCAP_OUT_AMP) {
3234 err = stac92xx_add_control_idx(spec,
3235 STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume",
3236 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3244 static const char *stac92xx_spdif_labels[3] = {
3245 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3248 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3250 struct sigmatel_spec *spec = codec->spec;
3251 struct hda_input_mux *spdif_mux = &spec->private_smux;
3252 const char **labels = spec->spdif_labels;
3254 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3256 num_cons = snd_hda_get_connections(codec,
3259 HDA_MAX_NUM_INPUTS);
3264 labels = stac92xx_spdif_labels;
3266 for (i = 0; i < num_cons; i++) {
3267 spdif_mux->items[spdif_mux->num_items].label = labels[i];
3268 spdif_mux->items[spdif_mux->num_items].index = i;
3269 spdif_mux->num_items++;
3275 /* labels for dmic mux inputs */
3276 static const char *stac92xx_dmic_labels[5] = {
3277 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3278 "Digital Mic 3", "Digital Mic 4"
3281 /* create playback/capture controls for input pins on dmic capable codecs */
3282 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3283 const struct auto_pin_cfg *cfg)
3285 struct sigmatel_spec *spec = codec->spec;
3286 struct hda_input_mux *dimux = &spec->private_dimux;
3287 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3291 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
3292 dimux->items[dimux->num_items].index = 0;
3295 for (i = 0; i < spec->num_dmics; i++) {
3300 unsigned int def_conf;
3302 def_conf = snd_hda_codec_read(codec,
3305 AC_VERB_GET_CONFIG_DEFAULT,
3307 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3310 nid = spec->dmic_nids[i];
3311 num_cons = snd_hda_get_connections(codec,
3314 HDA_MAX_NUM_INPUTS);
3315 for (j = 0; j < num_cons; j++)
3316 if (con_lst[j] == nid) {
3322 wcaps = get_wcaps(codec, nid) &
3323 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3326 sprintf(name, "%s Capture Volume",
3327 stac92xx_dmic_labels[dimux->num_items]);
3329 err = stac92xx_add_control(spec,
3330 STAC_CTL_WIDGET_VOL,
3332 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3333 (wcaps & AC_WCAP_OUT_AMP) ?
3334 HDA_OUTPUT : HDA_INPUT));
3339 dimux->items[dimux->num_items].label =
3340 stac92xx_dmic_labels[dimux->num_items];
3341 dimux->items[dimux->num_items].index = index;
3348 /* create playback/capture controls for input pins */
3349 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3351 struct sigmatel_spec *spec = codec->spec;
3352 struct hda_input_mux *imux = &spec->private_imux;
3353 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3356 for (i = 0; i < AUTO_PIN_LAST; i++) {
3359 if (!cfg->input_pins[i])
3362 for (j = 0; j < spec->num_muxes; j++) {
3364 num_cons = snd_hda_get_connections(codec,
3367 HDA_MAX_NUM_INPUTS);
3368 for (k = 0; k < num_cons; k++)
3369 if (con_lst[k] == cfg->input_pins[i]) {
3376 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
3377 imux->items[imux->num_items].index = index;
3381 if (imux->num_items) {
3383 * Set the current input for the muxes.
3384 * The STAC9221 has two input muxes with identical source
3385 * NID lists. Hopefully this won't get confused.
3387 for (i = 0; i < spec->num_muxes; i++) {
3388 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3389 AC_VERB_SET_CONNECT_SEL,
3390 imux->items[0].index);
3397 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3399 struct sigmatel_spec *spec = codec->spec;
3402 for (i = 0; i < spec->autocfg.line_outs; i++) {
3403 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3404 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3408 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3410 struct sigmatel_spec *spec = codec->spec;
3413 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3415 pin = spec->autocfg.hp_pins[i];
3416 if (pin) /* connect to front */
3417 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3419 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3421 pin = spec->autocfg.speaker_pins[i];
3422 if (pin) /* connect to front */
3423 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3427 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3429 struct sigmatel_spec *spec = codec->spec;
3431 int hp_speaker_swap = 0;
3433 if ((err = snd_hda_parse_pin_def_config(codec,
3435 spec->dmic_nids)) < 0)
3437 if (! spec->autocfg.line_outs)
3438 return 0; /* can't find valid pin config */
3440 /* If we have no real line-out pin and multiple hp-outs, HPs should
3441 * be set up as multi-channel outputs.
3443 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
3444 spec->autocfg.hp_outs > 1) {
3445 /* Copy hp_outs to line_outs, backup line_outs in
3446 * speaker_outs so that the following routines can handle
3447 * HP pins as primary outputs.
3449 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3450 sizeof(spec->autocfg.line_out_pins));
3451 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3452 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3453 sizeof(spec->autocfg.hp_pins));
3454 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3455 hp_speaker_swap = 1;
3457 if (spec->autocfg.mono_out_pin) {
3458 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3459 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3460 u32 caps = query_amp_caps(codec,
3461 spec->autocfg.mono_out_pin, dir);
3462 hda_nid_t conn_list[1];
3464 /* get the mixer node and then the mono mux if it exists */
3465 if (snd_hda_get_connections(codec,
3466 spec->autocfg.mono_out_pin, conn_list, 1) &&
3467 snd_hda_get_connections(codec, conn_list[0],
3470 int wcaps = get_wcaps(codec, conn_list[0]);
3471 int wid_type = (wcaps & AC_WCAP_TYPE)
3472 >> AC_WCAP_TYPE_SHIFT;
3473 /* LR swap check, some stac925x have a mux that
3474 * changes the DACs output path instead of the
3477 if (wid_type == AC_WID_AUD_SEL &&
3478 !(wcaps & AC_WCAP_LR_SWAP))
3479 spec->mono_nid = conn_list[0];
3482 hda_nid_t nid = spec->autocfg.mono_out_pin;
3484 /* most mono outs have a least a mute/unmute switch */
3485 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3486 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3487 "Mono Playback Switch",
3488 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3491 /* check for volume support for the amp */
3492 if ((caps & AC_AMPCAP_NUM_STEPS)
3493 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3494 err = stac92xx_add_control(spec,
3495 STAC_CTL_WIDGET_VOL,
3496 "Mono Playback Volume",
3497 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3503 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3507 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
3509 if (spec->multiout.num_dacs == 0)
3510 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
3513 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3518 /* setup analog beep controls */
3519 if (spec->anabeep_nid > 0) {
3520 err = stac92xx_auto_create_beep_ctls(codec,
3526 /* setup digital beep controls and input device */
3527 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3528 if (spec->digbeep_nid > 0) {
3529 hda_nid_t nid = spec->digbeep_nid;
3532 err = stac92xx_auto_create_beep_ctls(codec, nid);
3535 err = snd_hda_attach_beep_device(codec, nid);
3538 /* if no beep switch is available, make its own one */
3539 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3541 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
3542 err = stac92xx_beep_switch_ctl(codec);
3549 if (hp_speaker_swap == 1) {
3550 /* Restore the hp_outs and line_outs */
3551 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3552 sizeof(spec->autocfg.line_out_pins));
3553 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3554 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
3555 sizeof(spec->autocfg.speaker_pins));
3556 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
3557 memset(spec->autocfg.speaker_pins, 0,
3558 sizeof(spec->autocfg.speaker_pins));
3559 spec->autocfg.speaker_outs = 0;
3562 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3567 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3572 if (spec->mono_nid > 0) {
3573 err = stac92xx_auto_create_mono_output_ctls(codec);
3577 if (spec->num_amps > 0) {
3578 err = stac92xx_auto_create_amp_output_ctls(codec);
3582 if (spec->num_dmics > 0 && !spec->dinput_mux)
3583 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3584 &spec->autocfg)) < 0)
3586 if (spec->num_muxes > 0) {
3587 err = stac92xx_auto_create_mux_input_ctls(codec);
3591 if (spec->num_smuxes > 0) {
3592 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3597 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3598 if (spec->multiout.max_channels > 2)
3599 spec->surr_switch = 1;
3601 if (spec->autocfg.dig_out_pin)
3602 spec->multiout.dig_out_nid = dig_out;
3603 if (dig_in && spec->autocfg.dig_in_pin)
3604 spec->dig_in_nid = dig_in;
3606 if (spec->kctls.list)
3607 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3609 spec->input_mux = &spec->private_imux;
3610 spec->dinput_mux = &spec->private_dimux;
3611 spec->sinput_mux = &spec->private_smux;
3612 spec->mono_mux = &spec->private_mono_mux;
3613 spec->amp_mux = &spec->private_amp_mux;
3617 /* add playback controls for HP output */
3618 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3619 struct auto_pin_cfg *cfg)
3621 struct sigmatel_spec *spec = codec->spec;
3622 hda_nid_t pin = cfg->hp_pins[0];
3623 unsigned int wid_caps;
3628 wid_caps = get_wcaps(codec, pin);
3629 if (wid_caps & AC_WCAP_UNSOL_CAP)
3630 spec->hp_detect = 1;
3635 /* add playback controls for LFE output */
3636 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3637 struct auto_pin_cfg *cfg)
3639 struct sigmatel_spec *spec = codec->spec;
3641 hda_nid_t lfe_pin = 0x0;
3645 * search speaker outs and line outs for a mono speaker pin
3646 * with an amp. If one is found, add LFE controls
3649 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3650 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3651 unsigned int wcaps = get_wcaps(codec, pin);
3652 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3653 if (wcaps == AC_WCAP_OUT_AMP)
3654 /* found a mono speaker with an amp, must be lfe */
3658 /* if speaker_outs is 0, then speakers may be in line_outs */
3659 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3660 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3661 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3662 unsigned int defcfg;
3663 defcfg = snd_hda_codec_read(codec, pin, 0,
3664 AC_VERB_GET_CONFIG_DEFAULT,
3666 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3667 unsigned int wcaps = get_wcaps(codec, pin);
3668 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3669 if (wcaps == AC_WCAP_OUT_AMP)
3670 /* found a mono speaker with an amp,
3678 err = create_controls(spec, "LFE", lfe_pin, 1);
3686 static int stac9200_parse_auto_config(struct hda_codec *codec)
3688 struct sigmatel_spec *spec = codec->spec;
3691 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3694 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3697 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3700 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3703 if (spec->num_muxes > 0) {
3704 err = stac92xx_auto_create_mux_input_ctls(codec);
3709 if (spec->autocfg.dig_out_pin)
3710 spec->multiout.dig_out_nid = 0x05;
3711 if (spec->autocfg.dig_in_pin)
3712 spec->dig_in_nid = 0x04;
3714 if (spec->kctls.list)
3715 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3717 spec->input_mux = &spec->private_imux;
3718 spec->dinput_mux = &spec->private_dimux;
3724 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3725 * funky external mute control using GPIO pins.
3728 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3729 unsigned int dir_mask, unsigned int data)
3731 unsigned int gpiostate, gpiomask, gpiodir;
3733 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3734 AC_VERB_GET_GPIO_DATA, 0);
3735 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3737 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3738 AC_VERB_GET_GPIO_MASK, 0);
3741 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3742 AC_VERB_GET_GPIO_DIRECTION, 0);
3743 gpiodir |= dir_mask;
3745 /* Configure GPIOx as CMOS */
3746 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3748 snd_hda_codec_write(codec, codec->afg, 0,
3749 AC_VERB_SET_GPIO_MASK, gpiomask);
3750 snd_hda_codec_read(codec, codec->afg, 0,
3751 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3755 snd_hda_codec_read(codec, codec->afg, 0,
3756 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3759 static int stac92xx_add_jack(struct hda_codec *codec,
3760 hda_nid_t nid, int type)
3762 #ifdef CONFIG_SND_JACK
3763 struct sigmatel_spec *spec = codec->spec;
3764 struct sigmatel_jack *jack;
3765 int def_conf = snd_hda_codec_read(codec, nid,
3766 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3767 int connectivity = get_defcfg_connect(def_conf);
3770 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
3773 snd_array_init(&spec->jacks, sizeof(*jack), 32);
3774 jack = snd_array_new(&spec->jacks);
3780 sprintf(name, "%s at %s %s Jack",
3781 snd_hda_get_jack_type(def_conf),
3782 snd_hda_get_jack_connectivity(def_conf),
3783 snd_hda_get_jack_location(def_conf));
3785 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
3791 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
3792 unsigned char type, int data)
3794 struct sigmatel_event *event;
3796 snd_array_init(&spec->events, sizeof(*event), 32);
3797 event = snd_array_new(&spec->events);
3802 event->tag = spec->events.used;
3808 static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
3809 hda_nid_t nid, unsigned char type)
3811 struct sigmatel_spec *spec = codec->spec;
3812 struct sigmatel_event *event = spec->events.list;
3815 for (i = 0; i < spec->events.used; i++, event++) {
3816 if (event->nid == nid && event->type == type)
3822 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
3825 struct sigmatel_spec *spec = codec->spec;
3826 struct sigmatel_event *event = spec->events.list;
3829 for (i = 0; i < spec->events.used; i++, event++) {
3830 if (event->tag == tag)
3836 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3839 struct sigmatel_event *event;
3842 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
3844 event = stac_get_event(codec, nid, type);
3848 tag = stac_add_event(codec->spec, nid, type, 0);
3851 snd_hda_codec_write_cache(codec, nid, 0,
3852 AC_VERB_SET_UNSOLICITED_ENABLE,
3856 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3859 for (i = 0; i < cfg->hp_outs; i++)
3860 if (cfg->hp_pins[i] == nid)
3861 return 1; /* nid is a HP-Out */
3863 return 0; /* nid is not a HP-Out */
3866 static void stac92xx_power_down(struct hda_codec *codec)
3868 struct sigmatel_spec *spec = codec->spec;
3870 /* power down inactive DACs */
3872 for (dac = spec->dac_list; *dac; dac++)
3873 if (!is_in_dac_nids(spec, *dac) &&
3874 spec->multiout.hp_nid != *dac)
3875 snd_hda_codec_write(codec, *dac, 0,
3876 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3879 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3882 static int stac92xx_init(struct hda_codec *codec)
3884 struct sigmatel_spec *spec = codec->spec;
3885 struct auto_pin_cfg *cfg = &spec->autocfg;
3889 snd_hda_sequence_write(codec, spec->init);
3891 /* power down adcs initially */
3892 if (spec->powerdown_adcs)
3893 for (i = 0; i < spec->num_adcs; i++)
3894 snd_hda_codec_write(codec,
3895 spec->adc_nids[i], 0,
3896 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3899 gpio = spec->gpio_data;
3900 /* turn on EAPD statically when spec->eapd_switch isn't set.
3901 * otherwise, unsol event will turn it on/off dynamically
3903 if (!spec->eapd_switch)
3904 gpio |= spec->eapd_mask;
3905 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
3908 if (spec->hp_detect) {
3909 /* Enable unsolicited responses on the HP widget */
3910 for (i = 0; i < cfg->hp_outs; i++) {
3911 hda_nid_t nid = cfg->hp_pins[i];
3912 enable_pin_detect(codec, nid, STAC_HP_EVENT);
3914 /* force to enable the first line-out; the others are set up
3917 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3919 /* fake event to set up pins */
3920 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
3923 stac92xx_auto_init_multi_out(codec);
3924 stac92xx_auto_init_hp_out(codec);
3925 for (i = 0; i < cfg->hp_outs; i++)
3926 stac_toggle_power_map(codec, cfg->hp_pins[i], 1);
3928 for (i = 0; i < AUTO_PIN_LAST; i++) {
3929 hda_nid_t nid = cfg->input_pins[i];
3931 unsigned int pinctl, conf;
3932 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) {
3933 /* for mic pins, force to initialize */
3934 pinctl = stac92xx_get_vref(codec, nid);
3935 pinctl |= AC_PINCTL_IN_EN;
3936 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3938 pinctl = snd_hda_codec_read(codec, nid, 0,
3939 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3940 /* if PINCTL already set then skip */
3941 if (!(pinctl & AC_PINCTL_IN_EN)) {
3942 pinctl |= AC_PINCTL_IN_EN;
3943 stac92xx_auto_set_pinctl(codec, nid,
3947 conf = snd_hda_codec_read(codec, nid, 0,
3948 AC_VERB_GET_CONFIG_DEFAULT, 0);
3949 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) {
3950 enable_pin_detect(codec, nid,
3952 stac_issue_unsol_event(codec, nid,
3957 for (i = 0; i < spec->num_dmics; i++)
3958 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3960 if (cfg->dig_out_pin)
3961 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3963 if (cfg->dig_in_pin)
3964 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3966 for (i = 0; i < spec->num_pwrs; i++) {
3967 hda_nid_t nid = spec->pwr_nids[i];
3968 int pinctl, def_conf;
3970 if (is_nid_hp_pin(cfg, nid) && spec->hp_detect)
3971 continue; /* already has an unsol event */
3973 pinctl = snd_hda_codec_read(codec, nid, 0,
3974 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3975 /* outputs are only ports capable of power management
3976 * any attempts on powering down a input port cause the
3977 * referenced VREF to act quirky.
3979 if (pinctl & AC_PINCTL_IN_EN)
3981 def_conf = snd_hda_codec_read(codec, nid, 0,
3982 AC_VERB_GET_CONFIG_DEFAULT, 0);
3983 def_conf = get_defcfg_connect(def_conf);
3984 /* skip any ports that don't have jacks since presence
3985 * detection is useless */
3986 if (def_conf != AC_JACK_PORT_COMPLEX) {
3987 if (def_conf != AC_JACK_PORT_NONE)
3988 stac_toggle_power_map(codec, nid, 1);
3991 if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) {
3992 enable_pin_detect(codec, nid, STAC_PWR_EVENT);
3993 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT);
3997 stac92xx_power_down(codec);
4001 static void stac92xx_free_jacks(struct hda_codec *codec)
4003 #ifdef CONFIG_SND_JACK
4004 /* free jack instances manually when clearing/reconfiguring */
4005 struct sigmatel_spec *spec = codec->spec;
4006 if (!codec->bus->shutdown && spec->jacks.list) {
4007 struct sigmatel_jack *jacks = spec->jacks.list;
4009 for (i = 0; i < spec->jacks.used; i++)
4010 snd_device_free(codec->bus->card, &jacks[i].jack);
4012 snd_array_free(&spec->jacks);
4016 static void stac92xx_free_kctls(struct hda_codec *codec)
4018 struct sigmatel_spec *spec = codec->spec;
4020 if (spec->kctls.list) {
4021 struct snd_kcontrol_new *kctl = spec->kctls.list;
4023 for (i = 0; i < spec->kctls.used; i++)
4024 kfree(kctl[i].name);
4026 snd_array_free(&spec->kctls);
4029 static void stac92xx_free(struct hda_codec *codec)
4031 struct sigmatel_spec *spec = codec->spec;
4036 kfree(spec->pin_configs);
4037 stac92xx_free_jacks(codec);
4038 snd_array_free(&spec->events);
4041 snd_hda_detach_beep_device(codec);
4044 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4047 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4048 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4050 if (pin_ctl & AC_PINCTL_IN_EN) {
4052 * we need to check the current set-up direction of
4053 * shared input pins since they can be switched via
4054 * "xxx as Output" mixer switch
4056 struct sigmatel_spec *spec = codec->spec;
4057 struct auto_pin_cfg *cfg = &spec->autocfg;
4058 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
4059 spec->line_switch) ||
4060 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
4065 /* if setting pin direction bits, clear the current
4066 direction bits first */
4067 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4068 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4070 snd_hda_codec_write_cache(codec, nid, 0,
4071 AC_VERB_SET_PIN_WIDGET_CONTROL,
4075 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4078 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4079 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4080 snd_hda_codec_write_cache(codec, nid, 0,
4081 AC_VERB_SET_PIN_WIDGET_CONTROL,
4085 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4089 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
4095 /* return non-zero if the hp-pin of the given array index isn't
4096 * a jack-detection target
4098 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4100 struct auto_pin_cfg *cfg = &spec->autocfg;
4102 /* ignore sensing of shared line and mic jacks */
4103 if (spec->line_switch &&
4104 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE])
4106 if (spec->mic_switch &&
4107 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC])
4109 /* ignore if the pin is set as line-out */
4110 if (cfg->hp_pins[i] == spec->hp_switch)
4115 static void stac92xx_hp_detect(struct hda_codec *codec)
4117 struct sigmatel_spec *spec = codec->spec;
4118 struct auto_pin_cfg *cfg = &spec->autocfg;
4122 if (spec->gpio_mute)
4123 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4124 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4126 for (i = 0; i < cfg->hp_outs; i++) {
4129 if (no_hp_sensing(spec, i))
4131 presence = get_pin_presence(codec, cfg->hp_pins[i]);
4133 unsigned int pinctl;
4134 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
4135 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4136 if (pinctl & AC_PINCTL_IN_EN)
4137 presence = 0; /* mic- or line-input */
4142 /* disable lineouts */
4143 if (spec->hp_switch)
4144 stac92xx_reset_pinctl(codec, spec->hp_switch,
4146 for (i = 0; i < cfg->line_outs; i++)
4147 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4149 for (i = 0; i < cfg->speaker_outs; i++)
4150 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4152 if (spec->eapd_mask && spec->eapd_switch)
4153 stac_gpio_set(codec, spec->gpio_mask,
4154 spec->gpio_dir, spec->gpio_data &
4157 /* enable lineouts */
4158 if (spec->hp_switch)
4159 stac92xx_set_pinctl(codec, spec->hp_switch,
4161 for (i = 0; i < cfg->line_outs; i++)
4162 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4164 for (i = 0; i < cfg->speaker_outs; i++)
4165 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4167 if (spec->eapd_mask && spec->eapd_switch)
4168 stac_gpio_set(codec, spec->gpio_mask,
4169 spec->gpio_dir, spec->gpio_data |
4172 /* toggle hp outs */
4173 for (i = 0; i < cfg->hp_outs; i++) {
4174 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4175 if (no_hp_sensing(spec, i))
4178 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4180 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4184 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4187 struct sigmatel_spec *spec = codec->spec;
4188 unsigned int idx, val;
4190 for (idx = 0; idx < spec->num_pwrs; idx++) {
4191 if (spec->pwr_nids[idx] == nid)
4194 if (idx >= spec->num_pwrs)
4197 /* several codecs have two power down bits */
4198 if (spec->pwr_mapping)
4199 idx = spec->pwr_mapping[idx];
4203 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4209 /* power down unused output ports */
4210 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4213 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4215 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid));
4218 static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid)
4220 struct sigmatel_spec *spec = codec->spec;
4221 struct sigmatel_jack *jacks = spec->jacks.list;
4225 for (i = 0; i < spec->jacks.used; i++) {
4226 if (jacks->nid == nid) {
4227 unsigned int pin_ctl =
4228 snd_hda_codec_read(codec, nid,
4229 0, AC_VERB_GET_PIN_WIDGET_CONTROL,
4231 int type = jacks->type;
4232 if (type == (SND_JACK_LINEOUT
4233 | SND_JACK_HEADPHONE))
4234 type = (pin_ctl & AC_PINCTL_HP_EN)
4235 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT;
4236 snd_jack_report(jacks->jack,
4237 get_pin_presence(codec, nid)
4245 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
4248 struct sigmatel_event *event = stac_get_event(codec, nid, type);
4251 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);
4254 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4256 struct sigmatel_spec *spec = codec->spec;
4257 struct sigmatel_event *event;
4260 tag = (res >> 26) & 0x7f;
4261 event = stac_get_event_from_tag(codec, tag);
4265 switch (event->type) {
4267 stac92xx_hp_detect(codec);
4269 case STAC_INSERT_EVENT:
4270 case STAC_PWR_EVENT:
4271 if (spec->num_pwrs > 0)
4272 stac92xx_pin_sense(codec, event->nid);
4273 stac92xx_report_jack(codec, event->nid);
4275 case STAC_VREF_EVENT:
4276 data = snd_hda_codec_read(codec, codec->afg, 0,
4277 AC_VERB_GET_GPIO_DATA, 0);
4278 /* toggle VREF state based on GPIOx status */
4279 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4280 !!(data & (1 << event->data)));
4285 #ifdef CONFIG_PROC_FS
4286 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4287 struct hda_codec *codec, hda_nid_t nid)
4289 if (nid == codec->afg)
4290 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4291 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4294 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4295 struct hda_codec *codec,
4298 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4299 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4302 /* stac92hd71bxx, stac92hd73xx */
4303 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4304 struct hda_codec *codec, hda_nid_t nid)
4306 stac92hd_proc_hook(buffer, codec, nid);
4307 if (nid == codec->afg)
4308 analog_loop_proc_hook(buffer, codec, 0xfa0);
4311 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4312 struct hda_codec *codec, hda_nid_t nid)
4314 if (nid == codec->afg)
4315 analog_loop_proc_hook(buffer, codec, 0xfe0);
4318 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4319 struct hda_codec *codec, hda_nid_t nid)
4321 if (nid == codec->afg)
4322 analog_loop_proc_hook(buffer, codec, 0xfeb);
4325 #define stac92hd_proc_hook NULL
4326 #define stac92hd7x_proc_hook NULL
4327 #define stac9205_proc_hook NULL
4328 #define stac927x_proc_hook NULL
4331 #ifdef SND_HDA_NEEDS_RESUME
4332 static int stac92xx_resume(struct hda_codec *codec)
4334 struct sigmatel_spec *spec = codec->spec;
4336 stac92xx_set_config_regs(codec);
4337 stac92xx_init(codec);
4338 snd_hda_codec_resume_amp(codec);
4339 snd_hda_codec_resume_cache(codec);
4340 /* fake event to set up pins again to override cached values */
4341 if (spec->hp_detect)
4342 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
4347 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4349 struct sigmatel_spec *spec = codec->spec;
4350 if (spec->eapd_mask)
4351 stac_gpio_set(codec, spec->gpio_mask,
4352 spec->gpio_dir, spec->gpio_data &
4358 static struct hda_codec_ops stac92xx_patch_ops = {
4359 .build_controls = stac92xx_build_controls,
4360 .build_pcms = stac92xx_build_pcms,
4361 .init = stac92xx_init,
4362 .free = stac92xx_free,
4363 .unsol_event = stac92xx_unsol_event,
4364 #ifdef SND_HDA_NEEDS_RESUME
4365 .suspend = stac92xx_suspend,
4366 .resume = stac92xx_resume,
4370 static int patch_stac9200(struct hda_codec *codec)
4372 struct sigmatel_spec *spec;
4375 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4380 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4381 spec->pin_nids = stac9200_pin_nids;
4382 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
4385 if (spec->board_config < 0) {
4386 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
4387 err = stac92xx_save_bios_config_regs(codec);
4389 err = stac_save_pin_cfgs(codec,
4390 stac9200_brd_tbl[spec->board_config]);
4392 stac92xx_free(codec);
4396 spec->multiout.max_channels = 2;
4397 spec->multiout.num_dacs = 1;
4398 spec->multiout.dac_nids = stac9200_dac_nids;
4399 spec->adc_nids = stac9200_adc_nids;
4400 spec->mux_nids = stac9200_mux_nids;
4401 spec->num_muxes = 1;
4402 spec->num_dmics = 0;
4406 if (spec->board_config == STAC_9200_GATEWAY ||
4407 spec->board_config == STAC_9200_OQO)
4408 spec->init = stac9200_eapd_init;
4410 spec->init = stac9200_core_init;
4411 spec->mixer = stac9200_mixer;
4413 if (spec->board_config == STAC_9200_PANASONIC) {
4414 spec->gpio_mask = spec->gpio_dir = 0x09;
4415 spec->gpio_data = 0x00;
4418 err = stac9200_parse_auto_config(codec);
4420 stac92xx_free(codec);
4424 codec->patch_ops = stac92xx_patch_ops;
4429 static int patch_stac925x(struct hda_codec *codec)
4431 struct sigmatel_spec *spec;
4434 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4439 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4440 spec->pin_nids = stac925x_pin_nids;
4441 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
4445 if (spec->board_config < 0) {
4446 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4447 "using BIOS defaults\n");
4448 err = stac92xx_save_bios_config_regs(codec);
4450 err = stac_save_pin_cfgs(codec,
4451 stac925x_brd_tbl[spec->board_config]);
4453 stac92xx_free(codec);
4457 spec->multiout.max_channels = 2;
4458 spec->multiout.num_dacs = 1;
4459 spec->multiout.dac_nids = stac925x_dac_nids;
4460 spec->adc_nids = stac925x_adc_nids;
4461 spec->mux_nids = stac925x_mux_nids;
4462 spec->num_muxes = 1;
4465 switch (codec->vendor_id) {
4466 case 0x83847632: /* STAC9202 */
4467 case 0x83847633: /* STAC9202D */
4468 case 0x83847636: /* STAC9251 */
4469 case 0x83847637: /* STAC9251D */
4470 spec->num_dmics = STAC925X_NUM_DMICS;
4471 spec->dmic_nids = stac925x_dmic_nids;
4472 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
4473 spec->dmux_nids = stac925x_dmux_nids;
4476 spec->num_dmics = 0;
4480 spec->init = stac925x_core_init;
4481 spec->mixer = stac925x_mixer;
4483 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
4485 if (spec->board_config < 0) {
4486 printk(KERN_WARNING "hda_codec: No auto-config is "
4487 "available, default to model=ref\n");
4488 spec->board_config = STAC_925x_REF;
4494 stac92xx_free(codec);
4498 codec->patch_ops = stac92xx_patch_ops;
4503 static struct hda_input_mux stac92hd73xx_dmux = {
4506 { "Analog Inputs", 0x0b },
4507 { "Digital Mic 1", 0x09 },
4508 { "Digital Mic 2", 0x0a },
4513 static int patch_stac92hd73xx(struct hda_codec *codec)
4515 struct sigmatel_spec *spec;
4516 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
4519 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4524 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
4525 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
4526 spec->pin_nids = stac92hd73xx_pin_nids;
4527 spec->board_config = snd_hda_check_board_config(codec,
4528 STAC_92HD73XX_MODELS,
4529 stac92hd73xx_models,
4530 stac92hd73xx_cfg_tbl);
4532 if (spec->board_config < 0) {
4533 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4534 " STAC92HD73XX, using BIOS defaults\n");
4535 err = stac92xx_save_bios_config_regs(codec);
4537 err = stac_save_pin_cfgs(codec,
4538 stac92hd73xx_brd_tbl[spec->board_config]);
4540 stac92xx_free(codec);
4544 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
4545 conn, STAC92HD73_DAC_COUNT + 2) - 1;
4547 if (spec->multiout.num_dacs < 0) {
4548 printk(KERN_WARNING "hda_codec: Could not determine "
4549 "number of channels defaulting to DAC count\n");
4550 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
4553 switch (spec->multiout.num_dacs) {
4554 case 0x3: /* 6 Channel */
4555 spec->multiout.hp_nid = 0x17;
4556 spec->mixer = stac92hd73xx_6ch_mixer;
4557 spec->init = stac92hd73xx_6ch_core_init;
4559 case 0x4: /* 8 Channel */
4560 spec->multiout.hp_nid = 0x18;
4561 spec->mixer = stac92hd73xx_8ch_mixer;
4562 spec->init = stac92hd73xx_8ch_core_init;
4564 case 0x5: /* 10 Channel */
4565 spec->multiout.hp_nid = 0x19;
4566 spec->mixer = stac92hd73xx_10ch_mixer;
4567 spec->init = stac92hd73xx_10ch_core_init;
4570 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
4571 spec->aloopback_mask = 0x01;
4572 spec->aloopback_shift = 8;
4574 spec->digbeep_nid = 0x1c;
4575 spec->mux_nids = stac92hd73xx_mux_nids;
4576 spec->adc_nids = stac92hd73xx_adc_nids;
4577 spec->dmic_nids = stac92hd73xx_dmic_nids;
4578 spec->dmux_nids = stac92hd73xx_dmux_nids;
4579 spec->smux_nids = stac92hd73xx_smux_nids;
4580 spec->amp_nids = stac92hd73xx_amp_nids;
4581 spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
4583 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
4584 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
4585 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
4586 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
4587 sizeof(stac92hd73xx_dmux));
4589 switch (spec->board_config) {
4591 spec->init = dell_eq_core_init;
4593 case STAC_DELL_M6_AMIC:
4594 case STAC_DELL_M6_DMIC:
4595 case STAC_DELL_M6_BOTH:
4596 spec->num_smuxes = 0;
4597 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4598 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4599 spec->eapd_switch = 0;
4603 spec->init = dell_m6_core_init;
4604 switch (spec->board_config) {
4605 case STAC_DELL_M6_AMIC: /* Analog Mics */
4606 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4607 spec->num_dmics = 0;
4608 spec->private_dimux.num_items = 1;
4610 case STAC_DELL_M6_DMIC: /* Digital Mics */
4611 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4612 spec->num_dmics = 1;
4613 spec->private_dimux.num_items = 2;
4615 case STAC_DELL_M6_BOTH: /* Both */
4616 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4617 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4618 spec->num_dmics = 1;
4619 spec->private_dimux.num_items = 2;
4624 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4625 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4626 spec->eapd_switch = 1;
4628 if (spec->board_config > STAC_92HD73XX_REF) {
4629 /* GPIO0 High = Enable EAPD */
4630 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4631 spec->gpio_data = 0x01;
4633 spec->dinput_mux = &spec->private_dimux;
4635 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4636 spec->pwr_nids = stac92hd73xx_pwr_nids;
4638 err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
4641 if (spec->board_config < 0) {
4642 printk(KERN_WARNING "hda_codec: No auto-config is "
4643 "available, default to model=ref\n");
4644 spec->board_config = STAC_92HD73XX_REF;
4651 stac92xx_free(codec);
4655 if (spec->board_config == STAC_92HD73XX_NO_JD)
4656 spec->hp_detect = 0;
4658 codec->patch_ops = stac92xx_patch_ops;
4660 codec->proc_widget_hook = stac92hd7x_proc_hook;
4665 static struct hda_input_mux stac92hd83xxx_dmux = {
4668 { "Analog Inputs", 0x03 },
4669 { "Digital Mic 1", 0x04 },
4670 { "Digital Mic 2", 0x05 },
4674 static int patch_stac92hd83xxx(struct hda_codec *codec)
4676 struct sigmatel_spec *spec;
4679 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4684 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
4685 spec->mono_nid = 0x19;
4686 spec->digbeep_nid = 0x21;
4687 spec->dmic_nids = stac92hd83xxx_dmic_nids;
4688 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4689 spec->adc_nids = stac92hd83xxx_adc_nids;
4690 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4691 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4692 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4693 spec->multiout.dac_nids = stac92hd83xxx_dac_nids;
4695 spec->init = stac92hd83xxx_core_init;
4696 switch (codec->vendor_id) {
4698 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;
4702 spec->init++; /* switch to config #2 */
4703 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;
4706 spec->mixer = stac92hd83xxx_mixer;
4707 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4708 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4709 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4710 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4711 spec->dinput_mux = &stac92hd83xxx_dmux;
4712 spec->pin_nids = stac92hd83xxx_pin_nids;
4713 spec->board_config = snd_hda_check_board_config(codec,
4714 STAC_92HD83XXX_MODELS,
4715 stac92hd83xxx_models,
4716 stac92hd83xxx_cfg_tbl);
4718 if (spec->board_config < 0) {
4719 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4720 " STAC92HD83XXX, using BIOS defaults\n");
4721 err = stac92xx_save_bios_config_regs(codec);
4723 err = stac_save_pin_cfgs(codec,
4724 stac92hd83xxx_brd_tbl[spec->board_config]);
4726 stac92xx_free(codec);
4730 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4732 if (spec->board_config < 0) {
4733 printk(KERN_WARNING "hda_codec: No auto-config is "
4734 "available, default to model=ref\n");
4735 spec->board_config = STAC_92HD83XXX_REF;
4742 stac92xx_free(codec);
4746 codec->patch_ops = stac92xx_patch_ops;
4748 codec->proc_widget_hook = stac92hd_proc_hook;
4753 static struct hda_input_mux stac92hd71bxx_dmux = {
4756 { "Analog Inputs", 0x00 },
4758 { "Digital Mic 1", 0x02 },
4759 { "Digital Mic 2", 0x03 },
4763 static int patch_stac92hd71bxx(struct hda_codec *codec)
4765 struct sigmatel_spec *spec;
4768 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4773 codec->patch_ops = stac92xx_patch_ops;
4774 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
4775 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4776 spec->pin_nids = stac92hd71bxx_pin_nids;
4777 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux,
4778 sizeof(stac92hd71bxx_dmux));
4779 spec->board_config = snd_hda_check_board_config(codec,
4780 STAC_92HD71BXX_MODELS,
4781 stac92hd71bxx_models,
4782 stac92hd71bxx_cfg_tbl);
4784 if (spec->board_config < 0) {
4785 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4786 " STAC92HD71BXX, using BIOS defaults\n");
4787 err = stac92xx_save_bios_config_regs(codec);
4789 err = stac_save_pin_cfgs(codec,
4790 stac92hd71bxx_brd_tbl[spec->board_config]);
4792 stac92xx_free(codec);
4796 if (spec->board_config > STAC_92HD71BXX_REF) {
4798 spec->gpio_mask = 0x01;
4799 spec->gpio_dir = 0x01;
4800 spec->gpio_data = 0x01;
4803 switch (codec->vendor_id) {
4804 case 0x111d76b6: /* 4 Port without Analog Mixer */
4806 case 0x111d76b4: /* 6 Port without Analog Mixer */
4808 spec->mixer = stac92hd71bxx_mixer;
4809 spec->init = stac92hd71bxx_core_init;
4810 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4812 case 0x111d7608: /* 5 Port with Analog Mixer */
4813 switch (spec->board_config) {
4815 /* Enable VREF power saving on GPIO1 detect */
4816 err = stac_add_event(spec, codec->afg,
4817 STAC_VREF_EVENT, 0x02);
4820 snd_hda_codec_write_cache(codec, codec->afg, 0,
4821 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
4822 snd_hda_codec_write_cache(codec, codec->afg, 0,
4823 AC_VERB_SET_UNSOLICITED_ENABLE,
4825 spec->gpio_mask |= 0x02;
4828 if ((codec->revision_id & 0xf) == 0 ||
4829 (codec->revision_id & 0xf) == 1)
4830 spec->stream_delay = 40; /* 40 milliseconds */
4832 /* no output amps */
4834 spec->mixer = stac92hd71bxx_analog_mixer;
4835 spec->dinput_mux = &spec->private_dimux;
4838 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
4839 stac_change_pin_config(codec, 0xf, 0x40f000f0);
4841 case 0x111d7603: /* 6 Port with Analog Mixer */
4842 if ((codec->revision_id & 0xf) == 1)
4843 spec->stream_delay = 40; /* 40 milliseconds */
4845 /* no output amps */
4849 spec->dinput_mux = &spec->private_dimux;
4850 spec->mixer = stac92hd71bxx_analog_mixer;
4851 spec->init = stac92hd71bxx_analog_core_init;
4852 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4855 spec->aloopback_mask = 0x50;
4856 spec->aloopback_shift = 0;
4858 spec->powerdown_adcs = 1;
4859 spec->digbeep_nid = 0x26;
4860 spec->mux_nids = stac92hd71bxx_mux_nids;
4861 spec->adc_nids = stac92hd71bxx_adc_nids;
4862 spec->dmic_nids = stac92hd71bxx_dmic_nids;
4863 spec->dmux_nids = stac92hd71bxx_dmux_nids;
4864 spec->smux_nids = stac92hd71bxx_smux_nids;
4865 spec->pwr_nids = stac92hd71bxx_pwr_nids;
4867 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
4868 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
4870 switch (spec->board_config) {
4872 /* enable internal microphone */
4873 stac_change_pin_config(codec, 0x0e, 0x01813040);
4874 stac92xx_auto_set_pinctl(codec, 0x0e,
4875 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
4877 case STAC_DELL_M4_2:
4878 spec->num_dmics = 0;
4879 spec->num_smuxes = 0;
4880 spec->num_dmuxes = 0;
4882 case STAC_DELL_M4_1:
4883 case STAC_DELL_M4_3:
4884 spec->num_dmics = 1;
4885 spec->num_smuxes = 0;
4886 spec->num_dmuxes = 0;
4889 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
4890 spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids);
4891 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
4894 spec->multiout.num_dacs = 1;
4895 spec->multiout.hp_nid = 0x11;
4896 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
4897 if (spec->dinput_mux)
4898 spec->private_dimux.num_items +=
4900 (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1);
4902 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
4904 if (spec->board_config < 0) {
4905 printk(KERN_WARNING "hda_codec: No auto-config is "
4906 "available, default to model=ref\n");
4907 spec->board_config = STAC_92HD71BXX_REF;
4914 stac92xx_free(codec);
4918 codec->proc_widget_hook = stac92hd7x_proc_hook;
4923 static int patch_stac922x(struct hda_codec *codec)
4925 struct sigmatel_spec *spec;
4928 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4933 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
4934 spec->pin_nids = stac922x_pin_nids;
4935 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
4938 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
4939 spec->gpio_mask = spec->gpio_dir = 0x03;
4940 spec->gpio_data = 0x03;
4941 /* Intel Macs have all same PCI SSID, so we need to check
4942 * codec SSID to distinguish the exact models
4944 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
4945 switch (codec->subsystem_id) {
4948 spec->board_config = STAC_INTEL_MAC_V1;
4952 spec->board_config = STAC_INTEL_MAC_V2;
4960 spec->board_config = STAC_INTEL_MAC_V3;
4964 spec->board_config = STAC_INTEL_MAC_V4;
4968 spec->board_config = STAC_INTEL_MAC_V5;
4971 spec->board_config = STAC_INTEL_MAC_V3;
4977 if (spec->board_config < 0) {
4978 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
4979 "using BIOS defaults\n");
4980 err = stac92xx_save_bios_config_regs(codec);
4982 err = stac_save_pin_cfgs(codec,
4983 stac922x_brd_tbl[spec->board_config]);
4985 stac92xx_free(codec);
4989 spec->adc_nids = stac922x_adc_nids;
4990 spec->mux_nids = stac922x_mux_nids;
4991 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
4992 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
4993 spec->num_dmics = 0;
4996 spec->init = stac922x_core_init;
4997 spec->mixer = stac922x_mixer;
4999 spec->multiout.dac_nids = spec->dac_nids;
5001 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
5003 if (spec->board_config < 0) {
5004 printk(KERN_WARNING "hda_codec: No auto-config is "
5005 "available, default to model=ref\n");
5006 spec->board_config = STAC_D945_REF;
5012 stac92xx_free(codec);
5016 codec->patch_ops = stac92xx_patch_ops;
5018 /* Fix Mux capture level; max to 2 */
5019 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
5020 (0 << AC_AMPCAP_OFFSET_SHIFT) |
5021 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5022 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5023 (0 << AC_AMPCAP_MUTE_SHIFT));
5028 static int patch_stac927x(struct hda_codec *codec)
5030 struct sigmatel_spec *spec;
5033 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5038 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
5039 spec->pin_nids = stac927x_pin_nids;
5040 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
5044 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
5045 if (spec->board_config < 0)
5046 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
5047 "STAC927x, using BIOS defaults\n");
5048 err = stac92xx_save_bios_config_regs(codec);
5050 err = stac_save_pin_cfgs(codec,
5051 stac927x_brd_tbl[spec->board_config]);
5053 stac92xx_free(codec);
5057 spec->digbeep_nid = 0x23;
5058 spec->adc_nids = stac927x_adc_nids;
5059 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
5060 spec->mux_nids = stac927x_mux_nids;
5061 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
5062 spec->smux_nids = stac927x_smux_nids;
5063 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
5064 spec->spdif_labels = stac927x_spdif_labels;
5065 spec->dac_list = stac927x_dac_nids;
5066 spec->multiout.dac_nids = spec->dac_nids;
5068 switch (spec->board_config) {
5071 /* GPIO0 High = Enable EAPD */
5072 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
5073 spec->gpio_data = 0x01;
5074 spec->num_dmics = 0;
5076 spec->init = d965_core_init;
5077 spec->mixer = stac927x_mixer;
5079 case STAC_DELL_BIOS:
5080 switch (codec->subsystem_id) {
5083 /* correct the device field to SPDIF out */
5084 stac_change_pin_config(codec, 0x21, 0x01442070);
5087 /* configure the analog microphone on some laptops */
5088 stac_change_pin_config(codec, 0x0c, 0x90a79130);
5089 /* correct the front output jack as a hp out */
5090 stac_change_pin_config(codec, 0x0f, 0x0227011f);
5091 /* correct the front input jack as a mic */
5092 stac_change_pin_config(codec, 0x0e, 0x02a79130);
5095 /* GPIO2 High = Enable EAPD */
5096 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
5097 spec->gpio_data = 0x04;
5098 spec->dmic_nids = stac927x_dmic_nids;
5099 spec->num_dmics = STAC927X_NUM_DMICS;
5101 spec->init = d965_core_init;
5102 spec->mixer = stac927x_mixer;
5103 spec->dmux_nids = stac927x_dmux_nids;
5104 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5107 if (spec->board_config > STAC_D965_REF) {
5108 /* GPIO0 High = Enable EAPD */
5109 spec->eapd_mask = spec->gpio_mask = 0x01;
5110 spec->gpio_dir = spec->gpio_data = 0x01;
5112 spec->num_dmics = 0;
5114 spec->init = stac927x_core_init;
5115 spec->mixer = stac927x_mixer;
5119 spec->aloopback_mask = 0x40;
5120 spec->aloopback_shift = 0;
5121 spec->eapd_switch = 1;
5123 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
5125 if (spec->board_config < 0) {
5126 printk(KERN_WARNING "hda_codec: No auto-config is "
5127 "available, default to model=ref\n");
5128 spec->board_config = STAC_D965_REF;
5134 stac92xx_free(codec);
5138 codec->patch_ops = stac92xx_patch_ops;
5140 codec->proc_widget_hook = stac927x_proc_hook;
5144 * The STAC927x seem to require fairly long delays for certain
5145 * command sequences. With too short delays (even if the answer
5146 * is set to RIRB properly), it results in the silence output
5147 * on some hardwares like Dell.
5149 * The below flag enables the longer delay (see get_response
5152 codec->bus->needs_damn_long_delay = 1;
5154 /* no jack detecion for ref-no-jd model */
5155 if (spec->board_config == STAC_D965_REF_NO_JD)
5156 spec->hp_detect = 0;
5161 static int patch_stac9205(struct hda_codec *codec)
5163 struct sigmatel_spec *spec;
5166 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5171 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5172 spec->pin_nids = stac9205_pin_nids;
5173 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
5177 if (spec->board_config < 0) {
5178 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
5179 err = stac92xx_save_bios_config_regs(codec);
5181 err = stac_save_pin_cfgs(codec,
5182 stac9205_brd_tbl[spec->board_config]);
5184 stac92xx_free(codec);
5188 spec->digbeep_nid = 0x23;
5189 spec->adc_nids = stac9205_adc_nids;
5190 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
5191 spec->mux_nids = stac9205_mux_nids;
5192 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
5193 spec->smux_nids = stac9205_smux_nids;
5194 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
5195 spec->dmic_nids = stac9205_dmic_nids;
5196 spec->num_dmics = STAC9205_NUM_DMICS;
5197 spec->dmux_nids = stac9205_dmux_nids;
5198 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
5201 spec->init = stac9205_core_init;
5202 spec->mixer = stac9205_mixer;
5204 spec->aloopback_mask = 0x40;
5205 spec->aloopback_shift = 0;
5206 spec->eapd_switch = 1;
5207 spec->multiout.dac_nids = spec->dac_nids;
5209 switch (spec->board_config){
5210 case STAC_9205_DELL_M43:
5211 /* Enable SPDIF in/out */
5212 stac_change_pin_config(codec, 0x1f, 0x01441030);
5213 stac_change_pin_config(codec, 0x20, 0x1c410030);
5215 /* Enable unsol response for GPIO4/Dock HP connection */
5216 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
5219 snd_hda_codec_write_cache(codec, codec->afg, 0,
5220 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
5221 snd_hda_codec_write_cache(codec, codec->afg, 0,
5222 AC_VERB_SET_UNSOLICITED_ENABLE,
5225 spec->gpio_dir = 0x0b;
5226 spec->eapd_mask = 0x01;
5227 spec->gpio_mask = 0x1b;
5228 spec->gpio_mute = 0x10;
5229 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
5232 spec->gpio_data = 0x01;
5235 /* SPDIF-In enabled */
5238 /* GPIO0 High = EAPD */
5239 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5240 spec->gpio_data = 0x01;
5244 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
5246 if (spec->board_config < 0) {
5247 printk(KERN_WARNING "hda_codec: No auto-config is "
5248 "available, default to model=ref\n");
5249 spec->board_config = STAC_9205_REF;
5255 stac92xx_free(codec);
5259 codec->patch_ops = stac92xx_patch_ops;
5261 codec->proc_widget_hook = stac9205_proc_hook;
5270 /* static config for Sony VAIO FE550G and Sony VAIO AR */
5271 static hda_nid_t vaio_dacs[] = { 0x2 };
5272 #define VAIO_HP_DAC 0x5
5273 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
5274 static hda_nid_t vaio_mux_nids[] = { 0x15 };
5276 static struct hda_input_mux vaio_mux = {
5279 /* { "HP", 0x0 }, */
5280 { "Mic Jack", 0x1 },
5281 { "Internal Mic", 0x2 },
5286 static struct hda_verb vaio_init[] = {
5287 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5288 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
5289 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5290 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5291 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5293 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5294 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5295 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5298 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5302 static struct hda_verb vaio_ar_init[] = {
5303 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5304 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5305 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5306 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5307 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
5308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5310 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5311 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5312 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
5313 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5319 static struct snd_kcontrol_new vaio_mixer[] = {
5320 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5322 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5323 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5324 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5325 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5326 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5329 .name = "Capture Source",
5331 .info = stac92xx_mux_enum_info,
5332 .get = stac92xx_mux_enum_get,
5333 .put = stac92xx_mux_enum_put,
5338 static struct snd_kcontrol_new vaio_ar_mixer[] = {
5339 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5341 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5342 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5343 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5344 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5345 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5346 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
5347 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
5349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5350 .name = "Capture Source",
5352 .info = stac92xx_mux_enum_info,
5353 .get = stac92xx_mux_enum_get,
5354 .put = stac92xx_mux_enum_put,
5359 static struct hda_codec_ops stac9872_patch_ops = {
5360 .build_controls = stac92xx_build_controls,
5361 .build_pcms = stac92xx_build_pcms,
5362 .init = stac92xx_init,
5363 .free = stac92xx_free,
5364 #ifdef SND_HDA_NEEDS_RESUME
5365 .resume = stac92xx_resume,
5369 static int stac9872_vaio_init(struct hda_codec *codec)
5373 err = stac92xx_init(codec);
5376 if (codec->patch_ops.unsol_event)
5377 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
5381 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
5383 if (get_pin_presence(codec, 0x0a)) {
5384 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5385 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5387 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5388 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5392 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
5394 switch (res >> 26) {
5396 stac9872_vaio_hp_detect(codec, res);
5401 static struct hda_codec_ops stac9872_vaio_patch_ops = {
5402 .build_controls = stac92xx_build_controls,
5403 .build_pcms = stac92xx_build_pcms,
5404 .init = stac9872_vaio_init,
5405 .free = stac92xx_free,
5406 .unsol_event = stac9872_vaio_unsol_event,
5408 .resume = stac92xx_resume,
5412 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
5414 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
5416 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
5418 /* AR Series. id=0x83847664 and subsys=104D1300 */
5423 static const char *stac9872_models[STAC_9872_MODELS] = {
5424 [CXD9872RD_VAIO] = "vaio",
5425 [CXD9872AKD_VAIO] = "vaio-ar",
5428 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5429 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
5430 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
5431 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
5432 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
5436 static int patch_stac9872(struct hda_codec *codec)
5438 struct sigmatel_spec *spec;
5441 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5444 if (board_config < 0)
5445 /* unknown config, let generic-parser do its job... */
5446 return snd_hda_parse_generic_codec(codec);
5448 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5453 switch (board_config) {
5454 case CXD9872RD_VAIO:
5455 case STAC9872AK_VAIO:
5456 case STAC9872K_VAIO:
5457 spec->mixer = vaio_mixer;
5458 spec->init = vaio_init;
5459 spec->multiout.max_channels = 2;
5460 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5461 spec->multiout.dac_nids = vaio_dacs;
5462 spec->multiout.hp_nid = VAIO_HP_DAC;
5463 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5464 spec->adc_nids = vaio_adcs;
5466 spec->input_mux = &vaio_mux;
5467 spec->mux_nids = vaio_mux_nids;
5468 codec->patch_ops = stac9872_vaio_patch_ops;
5471 case CXD9872AKD_VAIO:
5472 spec->mixer = vaio_ar_mixer;
5473 spec->init = vaio_ar_init;
5474 spec->multiout.max_channels = 2;
5475 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5476 spec->multiout.dac_nids = vaio_dacs;
5477 spec->multiout.hp_nid = VAIO_HP_DAC;
5478 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5480 spec->adc_nids = vaio_adcs;
5481 spec->input_mux = &vaio_mux;
5482 spec->mux_nids = vaio_mux_nids;
5483 codec->patch_ops = stac9872_patch_ops;
5494 static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5495 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5496 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5497 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
5498 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
5499 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
5500 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
5501 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
5502 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
5503 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
5504 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
5505 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
5506 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
5507 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
5508 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
5509 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
5510 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
5511 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
5512 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
5513 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
5514 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
5515 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
5516 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
5517 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
5518 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
5519 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
5520 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
5521 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
5522 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
5523 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
5524 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
5525 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
5526 /* The following does not take into account .id=0x83847661 when subsys =
5527 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
5528 * currently not fully supported.
5530 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
5531 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
5532 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
5533 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
5534 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
5535 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
5536 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
5537 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
5538 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
5539 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
5540 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
5541 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
5542 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
5543 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
5544 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
5545 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
5546 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
5547 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
5548 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5549 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5550 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5551 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5552 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5553 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5554 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5555 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5559 MODULE_ALIAS("snd-hda-codec-id:8384*");
5560 MODULE_ALIAS("snd-hda-codec-id:111d*");
5562 MODULE_LICENSE("GPL");
5563 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5565 static struct hda_codec_preset_list sigmatel_list = {
5566 .preset = snd_hda_preset_sigmatel,
5567 .owner = THIS_MODULE,
5570 static int __init patch_sigmatel_init(void)
5572 return snd_hda_add_codec_preset(&sigmatel_list);
5575 static void __exit patch_sigmatel_exit(void)
5577 snd_hda_delete_codec_preset(&sigmatel_list);
5580 module_init(patch_sigmatel_init)
5581 module_exit(patch_sigmatel_exit)