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"
36 #include "hda_patch.h"
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 */
139 struct sigmatel_event {
146 struct sigmatel_jack {
149 struct snd_jack *jack;
152 struct sigmatel_spec {
153 struct snd_kcontrol_new *mixers[4];
154 unsigned int num_mixers;
157 unsigned int eapd_switch: 1;
158 unsigned int surr_switch: 1;
159 unsigned int line_switch: 1;
160 unsigned int mic_switch: 1;
161 unsigned int alt_switch: 1;
162 unsigned int hp_detect: 1;
163 unsigned int spdif_mute: 1;
166 unsigned int eapd_mask;
167 unsigned int gpio_mask;
168 unsigned int gpio_dir;
169 unsigned int gpio_data;
170 unsigned int gpio_mute;
173 unsigned int stream_delay;
175 /* analog loopback */
176 unsigned char aloopback_mask;
177 unsigned char aloopback_shift;
179 /* power management */
180 unsigned int num_pwrs;
181 unsigned int *pwr_mapping;
186 struct snd_array jacks;
189 struct snd_array events;
192 struct hda_input_mux *mono_mux;
193 struct hda_input_mux *amp_mux;
194 unsigned int cur_mmux;
195 struct hda_multi_out multiout;
196 hda_nid_t dac_nids[5];
200 unsigned int num_adcs;
202 unsigned int num_muxes;
203 hda_nid_t *dmic_nids;
204 unsigned int num_dmics;
205 hda_nid_t *dmux_nids;
206 unsigned int num_dmuxes;
207 hda_nid_t *smux_nids;
208 unsigned int num_smuxes;
209 const char **spdif_labels;
211 hda_nid_t dig_in_nid;
213 hda_nid_t anabeep_nid;
214 hda_nid_t digbeep_nid;
218 unsigned int num_pins;
219 unsigned int *pin_configs;
221 /* codec specific stuff */
222 struct hda_verb *init;
223 struct snd_kcontrol_new *mixer;
226 struct hda_input_mux *dinput_mux;
227 unsigned int cur_dmux[2];
228 struct hda_input_mux *input_mux;
229 unsigned int cur_mux[3];
230 struct hda_input_mux *sinput_mux;
231 unsigned int cur_smux[2];
232 unsigned int cur_amux;
234 unsigned int num_amps;
235 unsigned int powerdown_adcs;
238 unsigned int io_switch[2];
239 unsigned int clfe_swap;
240 unsigned int hp_switch; /* NID of HP as line-out */
241 unsigned int aloopback;
243 struct hda_pcm pcm_rec[2]; /* PCM information */
245 /* dynamic controls and input_mux */
246 struct auto_pin_cfg autocfg;
247 struct snd_array kctls;
248 struct hda_input_mux private_dimux;
249 struct hda_input_mux private_imux;
250 struct hda_input_mux private_smux;
251 struct hda_input_mux private_amp_mux;
252 struct hda_input_mux private_mono_mux;
255 static hda_nid_t stac9200_adc_nids[1] = {
259 static hda_nid_t stac9200_mux_nids[1] = {
263 static hda_nid_t stac9200_dac_nids[1] = {
267 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
268 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
272 static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
276 static hda_nid_t stac92hd73xx_adc_nids[2] = {
280 #define DELL_M6_AMP 2
281 static hda_nid_t stac92hd73xx_amp_nids[3] = {
285 #define STAC92HD73XX_NUM_DMICS 2
286 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
290 #define STAC92HD73_DAC_COUNT 5
291 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
292 0x15, 0x16, 0x17, 0x18, 0x19,
295 static hda_nid_t stac92hd73xx_mux_nids[4] = {
296 0x28, 0x29, 0x2a, 0x2b,
299 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
303 static hda_nid_t stac92hd73xx_smux_nids[2] = {
307 #define STAC92HD83XXX_NUM_DMICS 2
308 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
312 #define STAC92HD81_DAC_COUNT 2
313 #define STAC92HD83_DAC_COUNT 3
314 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {
318 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
322 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
326 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
330 static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
334 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
335 0x03, 0x0c, 0x10, 0x40,
338 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
342 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
346 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
350 static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
354 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
358 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
362 #define STAC92HD71BXX_NUM_DMICS 2
363 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
367 static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
371 static hda_nid_t stac925x_adc_nids[1] = {
375 static hda_nid_t stac925x_mux_nids[1] = {
379 static hda_nid_t stac925x_dac_nids[1] = {
383 #define STAC925X_NUM_DMICS 1
384 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
388 static hda_nid_t stac925x_dmux_nids[1] = {
392 static hda_nid_t stac922x_adc_nids[2] = {
396 static hda_nid_t stac922x_mux_nids[2] = {
400 static hda_nid_t stac927x_adc_nids[3] = {
404 static hda_nid_t stac927x_mux_nids[3] = {
408 static hda_nid_t stac927x_smux_nids[1] = {
412 static hda_nid_t stac927x_dac_nids[6] = {
413 0x02, 0x03, 0x04, 0x05, 0x06, 0
416 static hda_nid_t stac927x_dmux_nids[1] = {
420 #define STAC927X_NUM_DMICS 2
421 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
425 static const char *stac927x_spdif_labels[5] = {
426 "Digital Playback", "ADAT", "Analog Mux 1",
427 "Analog Mux 2", "Analog Mux 3"
430 static hda_nid_t stac9205_adc_nids[2] = {
434 static hda_nid_t stac9205_mux_nids[2] = {
438 static hda_nid_t stac9205_dmux_nids[1] = {
442 static hda_nid_t stac9205_smux_nids[1] = {
446 #define STAC9205_NUM_DMICS 2
447 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
451 static hda_nid_t stac9200_pin_nids[8] = {
452 0x08, 0x09, 0x0d, 0x0e,
453 0x0f, 0x10, 0x11, 0x12,
456 static hda_nid_t stac925x_pin_nids[8] = {
457 0x07, 0x08, 0x0a, 0x0b,
458 0x0c, 0x0d, 0x10, 0x11,
461 static hda_nid_t stac922x_pin_nids[10] = {
462 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
463 0x0f, 0x10, 0x11, 0x15, 0x1b,
466 static hda_nid_t stac92hd73xx_pin_nids[13] = {
467 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
468 0x0f, 0x10, 0x11, 0x12, 0x13,
472 static hda_nid_t stac92hd83xxx_pin_nids[14] = {
473 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
474 0x0f, 0x10, 0x11, 0x12, 0x13,
475 0x1d, 0x1e, 0x1f, 0x20
477 static hda_nid_t stac92hd71bxx_pin_nids[11] = {
478 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
479 0x0f, 0x14, 0x18, 0x19, 0x1e,
483 static hda_nid_t stac927x_pin_nids[14] = {
484 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
485 0x0f, 0x10, 0x11, 0x12, 0x13,
486 0x14, 0x21, 0x22, 0x23,
489 static hda_nid_t stac9205_pin_nids[12] = {
490 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
491 0x0f, 0x14, 0x16, 0x17, 0x18,
495 #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
497 static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol,
498 struct snd_ctl_elem_value *ucontrol)
500 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
501 struct sigmatel_spec *spec = codec->spec;
502 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
504 kcontrol->private_value ^= get_amp_nid(kcontrol);
505 kcontrol->private_value |= nid;
507 return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
510 static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
511 struct snd_ctl_elem_value *ucontrol)
513 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
514 struct sigmatel_spec *spec = codec->spec;
515 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
517 kcontrol->private_value ^= get_amp_nid(kcontrol);
518 kcontrol->private_value |= nid;
520 return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
523 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_info *uinfo)
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 struct sigmatel_spec *spec = codec->spec;
528 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
531 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
532 struct snd_ctl_elem_value *ucontrol)
534 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
535 struct sigmatel_spec *spec = codec->spec;
536 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
538 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
542 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_value *ucontrol)
545 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
546 struct sigmatel_spec *spec = codec->spec;
547 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
549 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
550 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
553 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
554 struct snd_ctl_elem_info *uinfo)
556 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
557 struct sigmatel_spec *spec = codec->spec;
558 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
561 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
565 struct sigmatel_spec *spec = codec->spec;
566 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
568 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
572 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
573 struct snd_ctl_elem_value *ucontrol)
575 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
576 struct sigmatel_spec *spec = codec->spec;
577 struct hda_input_mux *smux = &spec->private_smux;
578 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
582 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
583 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
587 if (spec->spdif_mute) {
589 nid = spec->multiout.dig_out_nid;
591 nid = codec->slave_dig_outs[smux_idx - 1];
592 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
596 /* un/mute SPDIF out */
597 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
603 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
605 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
606 struct sigmatel_spec *spec = codec->spec;
607 return snd_hda_input_mux_info(spec->input_mux, uinfo);
610 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
612 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
613 struct sigmatel_spec *spec = codec->spec;
614 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
616 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
620 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
622 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
623 struct sigmatel_spec *spec = codec->spec;
624 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
626 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
627 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
630 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
631 struct snd_ctl_elem_info *uinfo)
633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
634 struct sigmatel_spec *spec = codec->spec;
635 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
638 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
639 struct snd_ctl_elem_value *ucontrol)
641 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
642 struct sigmatel_spec *spec = codec->spec;
644 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
648 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
649 struct snd_ctl_elem_value *ucontrol)
651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
652 struct sigmatel_spec *spec = codec->spec;
654 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
655 spec->mono_nid, &spec->cur_mmux);
658 static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
659 struct snd_ctl_elem_info *uinfo)
661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
662 struct sigmatel_spec *spec = codec->spec;
663 return snd_hda_input_mux_info(spec->amp_mux, uinfo);
666 static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
667 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 struct sigmatel_spec *spec = codec->spec;
672 ucontrol->value.enumerated.item[0] = spec->cur_amux;
676 static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
677 struct snd_ctl_elem_value *ucontrol)
679 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
680 struct sigmatel_spec *spec = codec->spec;
681 struct snd_kcontrol *ctl =
682 snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
686 snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
687 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
689 return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
693 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
695 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
696 struct snd_ctl_elem_value *ucontrol)
698 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
699 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
700 struct sigmatel_spec *spec = codec->spec;
702 ucontrol->value.integer.value[0] = !!(spec->aloopback &
703 (spec->aloopback_mask << idx));
707 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 struct sigmatel_spec *spec = codec->spec;
712 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
713 unsigned int dac_mode;
714 unsigned int val, idx_val;
716 idx_val = spec->aloopback_mask << idx;
717 if (ucontrol->value.integer.value[0])
718 val = spec->aloopback | idx_val;
720 val = spec->aloopback & ~idx_val;
721 if (spec->aloopback == val)
724 spec->aloopback = val;
726 /* Only return the bits defined by the shift value of the
727 * first two bytes of the mask
729 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
730 kcontrol->private_value & 0xFFFF, 0x0);
731 dac_mode >>= spec->aloopback_shift;
733 if (spec->aloopback & idx_val) {
734 snd_hda_power_up(codec);
737 snd_hda_power_down(codec);
738 dac_mode &= ~idx_val;
741 snd_hda_codec_write_cache(codec, codec->afg, 0,
742 kcontrol->private_value >> 16, dac_mode);
747 static struct hda_verb stac9200_core_init[] = {
748 /* set dac0mux for dac converter */
749 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
753 static struct hda_verb stac9200_eapd_init[] = {
754 /* set dac0mux for dac converter */
755 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
756 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
760 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
761 /* set master volume and direct control */
762 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
763 /* setup audio connections */
764 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
765 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
766 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
767 /* setup adcs to point to mixer */
768 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
769 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
770 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
771 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
772 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
773 /* setup import muxs */
774 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
775 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
776 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
777 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
781 static struct hda_verb dell_eq_core_init[] = {
782 /* set master volume to max value without distortion
783 * and direct control */
784 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
785 /* setup audio connections */
786 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
787 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02},
788 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},
789 /* setup adcs to point to mixer */
790 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
791 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
792 /* setup import muxs */
793 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
794 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
795 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
796 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
800 static struct hda_verb dell_m6_core_init[] = {
801 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
802 /* setup audio connections */
803 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
804 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
805 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
806 /* setup adcs to point to mixer */
807 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
808 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
809 /* setup import muxs */
810 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
811 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
812 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
813 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
817 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
818 /* set master volume and direct control */
819 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
820 /* setup audio connections */
821 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
822 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
823 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
824 /* connect hp ports to dac3 */
825 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
826 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
827 /* setup adcs to point to mixer */
828 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
829 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
830 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
831 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
832 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
833 /* setup import muxs */
834 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
835 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
836 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
837 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
841 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
842 /* set master volume and direct control */
843 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
844 /* setup audio connections */
845 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
846 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
847 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
848 /* dac3 is connected to import3 mux */
849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
850 /* connect hp ports to dac4 */
851 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
852 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
853 /* setup adcs to point to mixer */
854 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
855 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
856 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
857 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
858 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
859 /* setup import muxs */
860 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
861 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
862 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
863 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
867 static struct hda_verb stac92hd83xxx_core_init[] = {
868 /* start of config #1 */
869 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
871 /* start of config #2 */
872 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
873 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
874 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
876 /* power state controls amps */
877 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
880 static struct hda_verb stac92hd71bxx_core_init[] = {
881 /* set master volume and direct control */
882 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
883 /* connect headphone jack to dac1 */
884 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
885 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
886 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
887 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
888 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
891 #define HD_DISABLE_PORTF 2
892 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
893 /* start of config #1 */
895 /* connect port 0f to audio mixer */
896 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
897 /* unmute right and left channels for node 0x0f */
898 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
899 /* start of config #2 */
901 /* set master volume and direct control */
902 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
903 /* connect headphone jack to dac1 */
904 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
905 /* unmute right and left channels for nodes 0x0a, 0xd */
906 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
907 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
911 static struct hda_verb stac925x_core_init[] = {
912 /* set dac0mux for dac converter */
913 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
917 static struct hda_verb stac922x_core_init[] = {
918 /* set master volume and direct control */
919 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
923 static struct hda_verb d965_core_init[] = {
924 /* set master volume and direct control */
925 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
926 /* unmute node 0x1b */
927 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
928 /* select node 0x03 as DAC */
929 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
933 static struct hda_verb stac927x_core_init[] = {
934 /* set master volume and direct control */
935 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
936 /* enable analog pc beep path */
937 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
941 static struct hda_verb stac9205_core_init[] = {
942 /* set master volume and direct control */
943 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
944 /* enable analog pc beep path */
945 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
949 #define STAC_MONO_MUX \
951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
952 .name = "Mono Mux", \
954 .info = stac92xx_mono_mux_enum_info, \
955 .get = stac92xx_mono_mux_enum_get, \
956 .put = stac92xx_mono_mux_enum_put, \
959 #define STAC_AMP_MUX \
961 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
962 .name = "Amp Selector Capture Switch", \
964 .info = stac92xx_amp_mux_enum_info, \
965 .get = stac92xx_amp_mux_enum_get, \
966 .put = stac92xx_amp_mux_enum_put, \
969 #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
974 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
975 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
976 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
977 .info = stac92xx_amp_volume_info, \
978 .get = stac92xx_amp_volume_get, \
979 .put = stac92xx_amp_volume_put, \
980 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
981 .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
984 #define STAC_INPUT_SOURCE(cnt) \
986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
987 .name = "Input Source", \
989 .info = stac92xx_mux_enum_info, \
990 .get = stac92xx_mux_enum_get, \
991 .put = stac92xx_mux_enum_put, \
994 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
996 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
997 .name = "Analog Loopback", \
999 .info = stac92xx_aloopback_info, \
1000 .get = stac92xx_aloopback_get, \
1001 .put = stac92xx_aloopback_put, \
1002 .private_value = verb_read | (verb_write << 16), \
1005 static struct snd_kcontrol_new stac9200_mixer[] = {
1006 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
1007 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1008 STAC_INPUT_SOURCE(1),
1009 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1010 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1014 #define DELL_M6_MIXER 6
1015 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1016 /* start of config #1 */
1017 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1018 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1020 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1021 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1023 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1024 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1026 /* start of config #2 */
1027 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1028 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1030 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1031 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1033 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1035 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1036 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1038 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1039 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1044 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1045 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1047 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1048 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1050 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1051 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1053 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1054 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1056 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1057 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1059 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1060 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1062 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1063 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1065 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1066 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1070 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1071 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1073 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1074 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1076 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1077 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1079 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1080 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1082 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1083 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1085 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1086 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1088 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1089 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1091 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1092 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1097 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1098 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
1099 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
1101 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
1102 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
1104 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT),
1105 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT),
1107 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT),
1108 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT),
1110 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT),
1111 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT),
1113 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT),
1114 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT),
1117 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
1118 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
1123 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
1124 STAC_INPUT_SOURCE(2),
1125 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1127 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1128 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1130 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1131 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1132 /* analog pc-beep replaced with digital beep support */
1134 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
1135 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
1138 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT),
1139 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT),
1141 HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT),
1142 HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT),
1144 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT),
1145 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT),
1147 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT),
1148 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT),
1152 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1153 STAC_INPUT_SOURCE(2),
1154 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1156 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1157 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1159 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1160 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1164 static struct snd_kcontrol_new stac925x_mixer[] = {
1165 STAC_INPUT_SOURCE(1),
1166 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
1167 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
1171 static struct snd_kcontrol_new stac9205_mixer[] = {
1172 STAC_INPUT_SOURCE(2),
1173 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1175 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1176 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1178 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1179 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1183 /* This needs to be generated dynamically based on sequence */
1184 static struct snd_kcontrol_new stac922x_mixer[] = {
1185 STAC_INPUT_SOURCE(2),
1186 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1187 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1189 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1190 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1195 static struct snd_kcontrol_new stac927x_mixer[] = {
1196 STAC_INPUT_SOURCE(3),
1197 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1199 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1200 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1202 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1203 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1205 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1206 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1210 static struct snd_kcontrol_new stac_dmux_mixer = {
1211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1212 .name = "Digital Input Source",
1213 /* count set later */
1214 .info = stac92xx_dmux_enum_info,
1215 .get = stac92xx_dmux_enum_get,
1216 .put = stac92xx_dmux_enum_put,
1219 static struct snd_kcontrol_new stac_smux_mixer = {
1220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1221 .name = "IEC958 Playback Source",
1222 /* count set later */
1223 .info = stac92xx_smux_enum_info,
1224 .get = stac92xx_smux_enum_get,
1225 .put = stac92xx_smux_enum_put,
1228 static const char *slave_vols[] = {
1229 "Front Playback Volume",
1230 "Surround Playback Volume",
1231 "Center Playback Volume",
1232 "LFE Playback Volume",
1233 "Side Playback Volume",
1234 "Headphone Playback Volume",
1235 "Headphone Playback Volume",
1236 "Speaker Playback Volume",
1237 "External Speaker Playback Volume",
1238 "Speaker2 Playback Volume",
1242 static const char *slave_sws[] = {
1243 "Front Playback Switch",
1244 "Surround Playback Switch",
1245 "Center Playback Switch",
1246 "LFE Playback Switch",
1247 "Side Playback Switch",
1248 "Headphone Playback Switch",
1249 "Headphone Playback Switch",
1250 "Speaker Playback Switch",
1251 "External Speaker Playback Switch",
1252 "Speaker2 Playback Switch",
1253 "IEC958 Playback Switch",
1257 static void stac92xx_free_kctls(struct hda_codec *codec);
1258 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1260 static int stac92xx_build_controls(struct hda_codec *codec)
1262 struct sigmatel_spec *spec = codec->spec;
1263 struct auto_pin_cfg *cfg = &spec->autocfg;
1268 err = snd_hda_add_new_ctls(codec, spec->mixer);
1272 for (i = 0; i < spec->num_mixers; i++) {
1273 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1277 if (spec->num_dmuxes > 0) {
1278 stac_dmux_mixer.count = spec->num_dmuxes;
1279 err = snd_hda_ctl_add(codec,
1280 snd_ctl_new1(&stac_dmux_mixer, codec));
1284 if (spec->num_smuxes > 0) {
1285 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1286 struct hda_input_mux *smux = &spec->private_smux;
1287 /* check for mute support on SPDIF out */
1288 if (wcaps & AC_WCAP_OUT_AMP) {
1289 smux->items[smux->num_items].label = "Off";
1290 smux->items[smux->num_items].index = 0;
1292 spec->spdif_mute = 1;
1294 stac_smux_mixer.count = spec->num_smuxes;
1295 err = snd_ctl_add(codec->bus->card,
1296 snd_ctl_new1(&stac_smux_mixer, codec));
1301 if (spec->multiout.dig_out_nid) {
1302 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1305 err = snd_hda_create_spdif_share_sw(codec,
1309 spec->multiout.share_spdif = 1;
1311 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1312 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1317 /* if we have no master control, let's create it */
1318 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1319 unsigned int vmaster_tlv[4];
1320 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1321 HDA_OUTPUT, vmaster_tlv);
1322 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1323 vmaster_tlv, slave_vols);
1327 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1328 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1334 stac92xx_free_kctls(codec); /* no longer needed */
1336 /* create jack input elements */
1337 if (spec->hp_detect) {
1338 for (i = 0; i < cfg->hp_outs; i++) {
1339 int type = SND_JACK_HEADPHONE;
1340 nid = cfg->hp_pins[i];
1341 /* jack detection */
1342 if (cfg->hp_outs == i)
1343 type |= SND_JACK_LINEOUT;
1344 err = stac92xx_add_jack(codec, nid, type);
1349 for (i = 0; i < cfg->line_outs; i++) {
1350 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1355 for (i = 0; i < AUTO_PIN_LAST; i++) {
1356 nid = cfg->input_pins[i];
1358 err = stac92xx_add_jack(codec, nid,
1359 SND_JACK_MICROPHONE);
1368 static unsigned int ref9200_pin_configs[8] = {
1369 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1370 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1374 STAC 9200 pin configs for
1379 static unsigned int dell9200_d21_pin_configs[8] = {
1380 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1381 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1385 STAC 9200 pin configs for
1389 static unsigned int dell9200_d22_pin_configs[8] = {
1390 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1391 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1395 STAC 9200 pin configs for
1396 102801C4 (Dell Dimension E310)
1403 static unsigned int dell9200_d23_pin_configs[8] = {
1404 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1405 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1410 STAC 9200-32 pin configs for
1411 102801B5 (Dell Inspiron 630m)
1412 102801D8 (Dell Inspiron 640m)
1414 static unsigned int dell9200_m21_pin_configs[8] = {
1415 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1416 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1420 STAC 9200-32 pin configs for
1421 102801C2 (Dell Latitude D620)
1423 102801CC (Dell Latitude D820)
1427 static unsigned int dell9200_m22_pin_configs[8] = {
1428 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1429 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1433 STAC 9200-32 pin configs for
1434 102801CE (Dell XPS M1710)
1435 102801CF (Dell Precision M90)
1437 static unsigned int dell9200_m23_pin_configs[8] = {
1438 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1439 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1443 STAC 9200-32 pin configs for
1446 102801CB (Dell Latitude 120L)
1449 static unsigned int dell9200_m24_pin_configs[8] = {
1450 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1451 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1455 STAC 9200-32 pin configs for
1456 102801BD (Dell Inspiron E1505n)
1460 static unsigned int dell9200_m25_pin_configs[8] = {
1461 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1462 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1466 STAC 9200-32 pin configs for
1467 102801F5 (Dell Inspiron 1501)
1470 static unsigned int dell9200_m26_pin_configs[8] = {
1471 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1472 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1477 102801CD (Dell Inspiron E1705/9400)
1479 static unsigned int dell9200_m27_pin_configs[8] = {
1480 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1481 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1484 static unsigned int oqo9200_pin_configs[8] = {
1485 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1486 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1490 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1491 [STAC_REF] = ref9200_pin_configs,
1492 [STAC_9200_OQO] = oqo9200_pin_configs,
1493 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1494 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1495 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1496 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1497 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1498 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1499 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1500 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1501 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1502 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1503 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1506 static const char *stac9200_models[STAC_9200_MODELS] = {
1508 [STAC_9200_OQO] = "oqo",
1509 [STAC_9200_DELL_D21] = "dell-d21",
1510 [STAC_9200_DELL_D22] = "dell-d22",
1511 [STAC_9200_DELL_D23] = "dell-d23",
1512 [STAC_9200_DELL_M21] = "dell-m21",
1513 [STAC_9200_DELL_M22] = "dell-m22",
1514 [STAC_9200_DELL_M23] = "dell-m23",
1515 [STAC_9200_DELL_M24] = "dell-m24",
1516 [STAC_9200_DELL_M25] = "dell-m25",
1517 [STAC_9200_DELL_M26] = "dell-m26",
1518 [STAC_9200_DELL_M27] = "dell-m27",
1519 [STAC_9200_GATEWAY] = "gateway",
1520 [STAC_9200_PANASONIC] = "panasonic",
1523 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1524 /* SigmaTel reference board */
1525 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1526 "DFI LanParty", STAC_REF),
1527 /* Dell laptops have BIOS problem */
1528 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1529 "unknown Dell", STAC_9200_DELL_D21),
1530 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1531 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1532 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1533 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1534 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1535 "unknown Dell", STAC_9200_DELL_D22),
1536 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1537 "unknown Dell", STAC_9200_DELL_D22),
1538 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1539 "Dell Latitude D620", STAC_9200_DELL_M22),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1541 "unknown Dell", STAC_9200_DELL_D23),
1542 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1543 "unknown Dell", STAC_9200_DELL_D23),
1544 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1545 "unknown Dell", STAC_9200_DELL_M22),
1546 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1547 "unknown Dell", STAC_9200_DELL_M24),
1548 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1549 "unknown Dell", STAC_9200_DELL_M24),
1550 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1551 "Dell Latitude 120L", STAC_9200_DELL_M24),
1552 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1553 "Dell Latitude D820", STAC_9200_DELL_M22),
1554 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1555 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1556 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1557 "Dell XPS M1710", STAC_9200_DELL_M23),
1558 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1559 "Dell Precision M90", STAC_9200_DELL_M23),
1560 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1561 "unknown Dell", STAC_9200_DELL_M22),
1562 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1563 "unknown Dell", STAC_9200_DELL_M22),
1564 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1565 "unknown Dell", STAC_9200_DELL_M22),
1566 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1567 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1569 "unknown Dell", STAC_9200_DELL_D23),
1570 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1571 "unknown Dell", STAC_9200_DELL_D23),
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1573 "unknown Dell", STAC_9200_DELL_D21),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1575 "unknown Dell", STAC_9200_DELL_D23),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1577 "unknown Dell", STAC_9200_DELL_D21),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1579 "unknown Dell", STAC_9200_DELL_M25),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1581 "unknown Dell", STAC_9200_DELL_M25),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1583 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1585 "unknown Dell", STAC_9200_DELL_M26),
1587 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1588 /* Gateway machines needs EAPD to be set on resume */
1589 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1590 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1592 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1595 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1599 static unsigned int ref925x_pin_configs[8] = {
1600 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1601 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1604 static unsigned int stac925x_MA6_pin_configs[8] = {
1605 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1606 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1609 static unsigned int stac925x_PA6_pin_configs[8] = {
1610 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1611 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1614 static unsigned int stac925xM2_2_pin_configs[8] = {
1615 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1616 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1619 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1620 [STAC_REF] = ref925x_pin_configs,
1621 [STAC_M2_2] = stac925xM2_2_pin_configs,
1622 [STAC_MA6] = stac925x_MA6_pin_configs,
1623 [STAC_PA6] = stac925x_PA6_pin_configs,
1626 static const char *stac925x_models[STAC_925x_MODELS] = {
1628 [STAC_M2_2] = "m2-2",
1633 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1634 /* SigmaTel reference board */
1635 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1636 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1637 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1638 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1639 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1640 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1641 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1645 static unsigned int ref92hd73xx_pin_configs[13] = {
1646 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1647 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1648 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1652 static unsigned int dell_m6_pin_configs[13] = {
1653 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1654 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1655 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1659 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1660 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1661 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1662 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1663 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1664 [STAC_DELL_EQ] = dell_m6_pin_configs,
1667 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1668 [STAC_92HD73XX_REF] = "ref",
1669 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1670 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1671 [STAC_DELL_M6_BOTH] = "dell-m6",
1672 [STAC_DELL_EQ] = "dell-eq",
1675 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1676 /* SigmaTel reference board */
1677 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1678 "DFI LanParty", STAC_92HD73XX_REF),
1679 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1680 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1682 "unknown Dell", STAC_DELL_M6_DMIC),
1683 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1684 "unknown Dell", STAC_DELL_M6_BOTH),
1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1686 "unknown Dell", STAC_DELL_M6_BOTH),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1688 "unknown Dell", STAC_DELL_M6_AMIC),
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1690 "unknown Dell", STAC_DELL_M6_AMIC),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1692 "unknown Dell", STAC_DELL_M6_DMIC),
1693 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1694 "unknown Dell", STAC_DELL_M6_DMIC),
1695 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1696 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1700 static unsigned int ref92hd83xxx_pin_configs[14] = {
1701 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1702 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1703 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1704 0x01451160, 0x98560170,
1707 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1708 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1711 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1712 [STAC_92HD83XXX_REF] = "ref",
1715 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1716 /* SigmaTel reference board */
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1718 "DFI LanParty", STAC_92HD71BXX_REF),
1721 static unsigned int ref92hd71bxx_pin_configs[11] = {
1722 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1723 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1724 0x90a000f0, 0x01452050, 0x01452050,
1727 static unsigned int dell_m4_1_pin_configs[11] = {
1728 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1729 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1730 0x40f000f0, 0x4f0000f0, 0x4f0000f0,
1733 static unsigned int dell_m4_2_pin_configs[11] = {
1734 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1735 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1736 0x40f000f0, 0x044413b0, 0x044413b0,
1739 static unsigned int dell_m4_3_pin_configs[11] = {
1740 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1741 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1742 0x40f000f0, 0x044413b0, 0x044413b0,
1745 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1746 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1747 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1748 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1749 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1750 [STAC_HP_M4] = NULL,
1753 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1754 [STAC_92HD71BXX_REF] = "ref",
1755 [STAC_DELL_M4_1] = "dell-m4-1",
1756 [STAC_DELL_M4_2] = "dell-m4-2",
1757 [STAC_DELL_M4_3] = "dell-m4-3",
1758 [STAC_HP_M4] = "hp-m4",
1761 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1762 /* SigmaTel reference board */
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1764 "DFI LanParty", STAC_92HD71BXX_REF),
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
1766 "HP dv5", STAC_HP_M4),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
1768 "HP dv7", STAC_HP_M4),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1770 "unknown HP", STAC_HP_M4),
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1772 "unknown Dell", STAC_DELL_M4_1),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1774 "unknown Dell", STAC_DELL_M4_1),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1776 "unknown Dell", STAC_DELL_M4_1),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1778 "unknown Dell", STAC_DELL_M4_1),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1780 "unknown Dell", STAC_DELL_M4_1),
1781 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1782 "unknown Dell", STAC_DELL_M4_1),
1783 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1784 "unknown Dell", STAC_DELL_M4_1),
1785 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1786 "unknown Dell", STAC_DELL_M4_2),
1787 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1788 "unknown Dell", STAC_DELL_M4_2),
1789 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1790 "unknown Dell", STAC_DELL_M4_2),
1791 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1792 "unknown Dell", STAC_DELL_M4_2),
1793 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1794 "unknown Dell", STAC_DELL_M4_3),
1798 static unsigned int ref922x_pin_configs[10] = {
1799 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1800 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1801 0x40000100, 0x40000100,
1805 STAC 922X pin configs for
1812 static unsigned int dell_922x_d81_pin_configs[10] = {
1813 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1814 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1815 0x01813122, 0x400001f2,
1819 STAC 922X pin configs for
1823 static unsigned int dell_922x_d82_pin_configs[10] = {
1824 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1825 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1826 0x01813122, 0x400001f1,
1830 STAC 922X pin configs for
1833 static unsigned int dell_922x_m81_pin_configs[10] = {
1834 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1835 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1836 0x40C003f1, 0x405003f0,
1840 STAC 9221 A1 pin configs for
1841 102801D7 (Dell XPS M1210)
1843 static unsigned int dell_922x_m82_pin_configs[10] = {
1844 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1845 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1846 0x508003f3, 0x405003f4,
1849 static unsigned int d945gtp3_pin_configs[10] = {
1850 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1851 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1852 0x02a19120, 0x40000100,
1855 static unsigned int d945gtp5_pin_configs[10] = {
1856 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1857 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1858 0x02a19320, 0x40000100,
1861 static unsigned int intel_mac_v1_pin_configs[10] = {
1862 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1863 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1864 0x400000fc, 0x400000fb,
1867 static unsigned int intel_mac_v2_pin_configs[10] = {
1868 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1869 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1870 0x400000fc, 0x400000fb,
1873 static unsigned int intel_mac_v3_pin_configs[10] = {
1874 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1875 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1876 0x400000fc, 0x400000fb,
1879 static unsigned int intel_mac_v4_pin_configs[10] = {
1880 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1881 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1882 0x400000fc, 0x400000fb,
1885 static unsigned int intel_mac_v5_pin_configs[10] = {
1886 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1887 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1888 0x400000fc, 0x400000fb,
1891 static unsigned int ecs202_pin_configs[10] = {
1892 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1893 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1894 0x9037012e, 0x40e000f2,
1897 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1898 [STAC_D945_REF] = ref922x_pin_configs,
1899 [STAC_D945GTP3] = d945gtp3_pin_configs,
1900 [STAC_D945GTP5] = d945gtp5_pin_configs,
1901 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1902 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1903 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1904 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1905 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1906 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1907 /* for backward compatibility */
1908 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1909 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1910 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1911 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1912 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1913 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1914 [STAC_ECS_202] = ecs202_pin_configs,
1915 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1916 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1917 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1918 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1921 static const char *stac922x_models[STAC_922X_MODELS] = {
1922 [STAC_D945_REF] = "ref",
1923 [STAC_D945GTP5] = "5stack",
1924 [STAC_D945GTP3] = "3stack",
1925 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1926 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1927 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1928 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1929 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1930 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1931 /* for backward compatibility */
1932 [STAC_MACMINI] = "macmini",
1933 [STAC_MACBOOK] = "macbook",
1934 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1935 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1936 [STAC_IMAC_INTEL] = "imac-intel",
1937 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1938 [STAC_ECS_202] = "ecs202",
1939 [STAC_922X_DELL_D81] = "dell-d81",
1940 [STAC_922X_DELL_D82] = "dell-d82",
1941 [STAC_922X_DELL_M81] = "dell-m81",
1942 [STAC_922X_DELL_M82] = "dell-m82",
1945 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1946 /* SigmaTel reference board */
1947 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1948 "DFI LanParty", STAC_D945_REF),
1949 /* Intel 945G based systems */
1950 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1951 "Intel D945G", STAC_D945GTP3),
1952 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1953 "Intel D945G", STAC_D945GTP3),
1954 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1955 "Intel D945G", STAC_D945GTP3),
1956 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1957 "Intel D945G", STAC_D945GTP3),
1958 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1959 "Intel D945G", STAC_D945GTP3),
1960 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1961 "Intel D945G", STAC_D945GTP3),
1962 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1963 "Intel D945G", STAC_D945GTP3),
1964 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1965 "Intel D945G", STAC_D945GTP3),
1966 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1967 "Intel D945G", STAC_D945GTP3),
1968 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1969 "Intel D945G", STAC_D945GTP3),
1970 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1971 "Intel D945G", STAC_D945GTP3),
1972 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1973 "Intel D945G", STAC_D945GTP3),
1974 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1975 "Intel D945G", STAC_D945GTP3),
1976 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1977 "Intel D945G", STAC_D945GTP3),
1978 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1979 "Intel D945G", STAC_D945GTP3),
1980 /* Intel D945G 5-stack systems */
1981 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1982 "Intel D945G", STAC_D945GTP5),
1983 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1984 "Intel D945G", STAC_D945GTP5),
1985 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1986 "Intel D945G", STAC_D945GTP5),
1987 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1988 "Intel D945G", STAC_D945GTP5),
1989 /* Intel 945P based systems */
1990 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1991 "Intel D945P", STAC_D945GTP3),
1992 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1993 "Intel D945P", STAC_D945GTP3),
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1995 "Intel D945P", STAC_D945GTP3),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1997 "Intel D945P", STAC_D945GTP3),
1998 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1999 "Intel D945P", STAC_D945GTP3),
2000 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2001 "Intel D945P", STAC_D945GTP5),
2003 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2004 SND_PCI_QUIRK(0x8384, 0x7680,
2005 "Mac", STAC_INTEL_MAC_AUTO),
2007 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2008 "unknown Dell", STAC_922X_DELL_D81),
2009 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2010 "unknown Dell", STAC_922X_DELL_D81),
2011 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2012 "unknown Dell", STAC_922X_DELL_D81),
2013 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2014 "unknown Dell", STAC_922X_DELL_D82),
2015 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2016 "unknown Dell", STAC_922X_DELL_M81),
2017 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2018 "unknown Dell", STAC_922X_DELL_D82),
2019 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2020 "unknown Dell", STAC_922X_DELL_D81),
2021 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2022 "unknown Dell", STAC_922X_DELL_D81),
2023 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2024 "Dell XPS M1210", STAC_922X_DELL_M82),
2025 /* ECS/PC Chips boards */
2026 SND_PCI_QUIRK(0x1019, 0x2144,
2027 "ECS/PC chips", STAC_ECS_202),
2028 SND_PCI_QUIRK(0x1019, 0x2608,
2029 "ECS/PC chips", STAC_ECS_202),
2030 SND_PCI_QUIRK(0x1019, 0x2633,
2031 "ECS/PC chips P17G/1333", STAC_ECS_202),
2032 SND_PCI_QUIRK(0x1019, 0x2811,
2033 "ECS/PC chips", STAC_ECS_202),
2034 SND_PCI_QUIRK(0x1019, 0x2812,
2035 "ECS/PC chips", STAC_ECS_202),
2036 SND_PCI_QUIRK(0x1019, 0x2813,
2037 "ECS/PC chips", STAC_ECS_202),
2038 SND_PCI_QUIRK(0x1019, 0x2814,
2039 "ECS/PC chips", STAC_ECS_202),
2040 SND_PCI_QUIRK(0x1019, 0x2815,
2041 "ECS/PC chips", STAC_ECS_202),
2042 SND_PCI_QUIRK(0x1019, 0x2816,
2043 "ECS/PC chips", STAC_ECS_202),
2044 SND_PCI_QUIRK(0x1019, 0x2817,
2045 "ECS/PC chips", STAC_ECS_202),
2046 SND_PCI_QUIRK(0x1019, 0x2818,
2047 "ECS/PC chips", STAC_ECS_202),
2048 SND_PCI_QUIRK(0x1019, 0x2819,
2049 "ECS/PC chips", STAC_ECS_202),
2050 SND_PCI_QUIRK(0x1019, 0x2820,
2051 "ECS/PC chips", STAC_ECS_202),
2055 static unsigned int ref927x_pin_configs[14] = {
2056 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2057 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2058 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2059 0x01c42190, 0x40000100,
2062 static unsigned int d965_3st_pin_configs[14] = {
2063 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2064 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2065 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2066 0x40000100, 0x40000100
2069 static unsigned int d965_5st_pin_configs[14] = {
2070 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2071 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2072 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2073 0x40000100, 0x40000100
2076 static unsigned int dell_3st_pin_configs[14] = {
2077 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2078 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2079 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2080 0x40c003fc, 0x40000100
2083 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2084 [STAC_D965_REF] = ref927x_pin_configs,
2085 [STAC_D965_3ST] = d965_3st_pin_configs,
2086 [STAC_D965_5ST] = d965_5st_pin_configs,
2087 [STAC_DELL_3ST] = dell_3st_pin_configs,
2088 [STAC_DELL_BIOS] = NULL,
2091 static const char *stac927x_models[STAC_927X_MODELS] = {
2092 [STAC_D965_REF] = "ref",
2093 [STAC_D965_3ST] = "3stack",
2094 [STAC_D965_5ST] = "5stack",
2095 [STAC_DELL_3ST] = "dell-3stack",
2096 [STAC_DELL_BIOS] = "dell-bios",
2099 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2100 /* SigmaTel reference board */
2101 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2102 "DFI LanParty", STAC_D965_REF),
2103 /* Intel 946 based systems */
2104 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2105 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2106 /* 965 based 3 stack systems */
2107 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
2108 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
2109 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
2110 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
2111 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
2112 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
2113 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
2115 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
2117 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
2119 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
2121 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
2122 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
2123 /* Dell 3 stack systems */
2124 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2125 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2127 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2128 /* Dell 3 stack systems with verb table in BIOS */
2129 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2131 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
2133 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2134 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2135 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2136 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2137 /* 965 based 5 stack systems */
2138 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
2139 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
2140 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
2141 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
2142 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
2143 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
2144 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
2145 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
2146 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
2150 static unsigned int ref9205_pin_configs[12] = {
2151 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2152 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2153 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2157 STAC 9205 pin configs for
2164 10280228 (Dell Vostro 1500)
2166 static unsigned int dell_9205_m42_pin_configs[12] = {
2167 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2168 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2169 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2173 STAC 9205 pin configs for
2177 102801FF (Dell Precision M4300)
2182 static unsigned int dell_9205_m43_pin_configs[12] = {
2183 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2184 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2185 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2188 static unsigned int dell_9205_m44_pin_configs[12] = {
2189 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2190 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2191 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2194 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2195 [STAC_9205_REF] = ref9205_pin_configs,
2196 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2197 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2198 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2201 static const char *stac9205_models[STAC_9205_MODELS] = {
2202 [STAC_9205_REF] = "ref",
2203 [STAC_9205_DELL_M42] = "dell-m42",
2204 [STAC_9205_DELL_M43] = "dell-m43",
2205 [STAC_9205_DELL_M44] = "dell-m44",
2208 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2209 /* SigmaTel reference board */
2210 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2211 "DFI LanParty", STAC_9205_REF),
2212 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2213 "unknown Dell", STAC_9205_DELL_M42),
2214 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2215 "unknown Dell", STAC_9205_DELL_M42),
2216 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2217 "Dell Precision", STAC_9205_DELL_M43),
2218 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2219 "Dell Precision", STAC_9205_DELL_M43),
2220 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2221 "Dell Precision", STAC_9205_DELL_M43),
2222 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2223 "unknown Dell", STAC_9205_DELL_M42),
2224 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2225 "unknown Dell", STAC_9205_DELL_M42),
2226 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2227 "Dell Precision", STAC_9205_DELL_M43),
2228 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2229 "Dell Precision M4300", STAC_9205_DELL_M43),
2230 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2231 "unknown Dell", STAC_9205_DELL_M42),
2232 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2233 "Dell Precision", STAC_9205_DELL_M43),
2234 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2235 "Dell Precision", STAC_9205_DELL_M43),
2236 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2237 "Dell Precision", STAC_9205_DELL_M43),
2238 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2239 "Dell Inspiron", STAC_9205_DELL_M44),
2240 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2241 "Dell Vostro 1500", STAC_9205_DELL_M42),
2245 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
2248 struct sigmatel_spec *spec = codec->spec;
2250 kfree(spec->pin_configs);
2251 spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs),
2253 if (!spec->pin_configs)
2256 for (i = 0; i < spec->num_pins; i++) {
2257 hda_nid_t nid = spec->pin_nids[i];
2258 unsigned int pin_cfg;
2260 pin_cfg = snd_hda_codec_read(codec, nid, 0,
2261 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
2262 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
2264 spec->pin_configs[i] = pin_cfg;
2270 static void stac92xx_set_config_reg(struct hda_codec *codec,
2271 hda_nid_t pin_nid, unsigned int pin_config)
2274 snd_hda_codec_write(codec, pin_nid, 0,
2275 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2276 pin_config & 0x000000ff);
2277 snd_hda_codec_write(codec, pin_nid, 0,
2278 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2279 (pin_config & 0x0000ff00) >> 8);
2280 snd_hda_codec_write(codec, pin_nid, 0,
2281 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2282 (pin_config & 0x00ff0000) >> 16);
2283 snd_hda_codec_write(codec, pin_nid, 0,
2284 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2286 i = snd_hda_codec_read(codec, pin_nid, 0,
2287 AC_VERB_GET_CONFIG_DEFAULT,
2289 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
2293 static void stac92xx_set_config_regs(struct hda_codec *codec)
2296 struct sigmatel_spec *spec = codec->spec;
2298 if (!spec->pin_configs)
2301 for (i = 0; i < spec->num_pins; i++)
2302 stac92xx_set_config_reg(codec, spec->pin_nids[i],
2303 spec->pin_configs[i]);
2306 static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins)
2308 struct sigmatel_spec *spec = codec->spec;
2311 return stac92xx_save_bios_config_regs(codec);
2313 kfree(spec->pin_configs);
2314 spec->pin_configs = kmemdup(pins,
2315 spec->num_pins * sizeof(*pins),
2317 if (!spec->pin_configs)
2320 stac92xx_set_config_regs(codec);
2324 static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid,
2327 struct sigmatel_spec *spec = codec->spec;
2330 for (i = 0; i < spec->num_pins; i++) {
2331 if (spec->pin_nids[i] == nid) {
2332 spec->pin_configs[i] = cfg;
2333 stac92xx_set_config_reg(codec, nid, cfg);
2340 * Analog playback callbacks
2342 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2343 struct hda_codec *codec,
2344 struct snd_pcm_substream *substream)
2346 struct sigmatel_spec *spec = codec->spec;
2347 if (spec->stream_delay)
2348 msleep(spec->stream_delay);
2349 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2353 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2354 struct hda_codec *codec,
2355 unsigned int stream_tag,
2356 unsigned int format,
2357 struct snd_pcm_substream *substream)
2359 struct sigmatel_spec *spec = codec->spec;
2360 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2363 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2364 struct hda_codec *codec,
2365 struct snd_pcm_substream *substream)
2367 struct sigmatel_spec *spec = codec->spec;
2368 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2372 * Digital playback callbacks
2374 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2375 struct hda_codec *codec,
2376 struct snd_pcm_substream *substream)
2378 struct sigmatel_spec *spec = codec->spec;
2379 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2382 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2383 struct hda_codec *codec,
2384 struct snd_pcm_substream *substream)
2386 struct sigmatel_spec *spec = codec->spec;
2387 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2390 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2391 struct hda_codec *codec,
2392 unsigned int stream_tag,
2393 unsigned int format,
2394 struct snd_pcm_substream *substream)
2396 struct sigmatel_spec *spec = codec->spec;
2397 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2398 stream_tag, format, substream);
2403 * Analog capture callbacks
2405 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2406 struct hda_codec *codec,
2407 unsigned int stream_tag,
2408 unsigned int format,
2409 struct snd_pcm_substream *substream)
2411 struct sigmatel_spec *spec = codec->spec;
2412 hda_nid_t nid = spec->adc_nids[substream->number];
2414 if (spec->powerdown_adcs) {
2416 snd_hda_codec_write_cache(codec, nid, 0,
2417 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2419 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2423 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2424 struct hda_codec *codec,
2425 struct snd_pcm_substream *substream)
2427 struct sigmatel_spec *spec = codec->spec;
2428 hda_nid_t nid = spec->adc_nids[substream->number];
2430 snd_hda_codec_cleanup_stream(codec, nid);
2431 if (spec->powerdown_adcs)
2432 snd_hda_codec_write_cache(codec, nid, 0,
2433 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2437 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2441 /* NID is set in stac92xx_build_pcms */
2443 .open = stac92xx_dig_playback_pcm_open,
2444 .close = stac92xx_dig_playback_pcm_close,
2445 .prepare = stac92xx_dig_playback_pcm_prepare
2449 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2453 /* NID is set in stac92xx_build_pcms */
2456 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2460 .nid = 0x02, /* NID to query formats and rates */
2462 .open = stac92xx_playback_pcm_open,
2463 .prepare = stac92xx_playback_pcm_prepare,
2464 .cleanup = stac92xx_playback_pcm_cleanup
2468 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2472 .nid = 0x06, /* NID to query formats and rates */
2474 .open = stac92xx_playback_pcm_open,
2475 .prepare = stac92xx_playback_pcm_prepare,
2476 .cleanup = stac92xx_playback_pcm_cleanup
2480 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2483 /* NID + .substreams is set in stac92xx_build_pcms */
2485 .prepare = stac92xx_capture_pcm_prepare,
2486 .cleanup = stac92xx_capture_pcm_cleanup
2490 static int stac92xx_build_pcms(struct hda_codec *codec)
2492 struct sigmatel_spec *spec = codec->spec;
2493 struct hda_pcm *info = spec->pcm_rec;
2495 codec->num_pcms = 1;
2496 codec->pcm_info = info;
2498 info->name = "STAC92xx Analog";
2499 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2500 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2501 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2502 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2504 if (spec->alt_switch) {
2507 info->name = "STAC92xx Analog Alt";
2508 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2511 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2514 info->name = "STAC92xx Digital";
2515 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2516 if (spec->multiout.dig_out_nid) {
2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2518 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2520 if (spec->dig_in_nid) {
2521 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2522 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2529 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2531 unsigned int pincap = snd_hda_param_read(codec, nid,
2533 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2534 if (pincap & AC_PINCAP_VREF_100)
2535 return AC_PINCTL_VREF_100;
2536 if (pincap & AC_PINCAP_VREF_80)
2537 return AC_PINCTL_VREF_80;
2538 if (pincap & AC_PINCAP_VREF_50)
2539 return AC_PINCTL_VREF_50;
2540 if (pincap & AC_PINCAP_VREF_GRD)
2541 return AC_PINCTL_VREF_GRD;
2545 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2548 snd_hda_codec_write_cache(codec, nid, 0,
2549 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2552 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2554 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2555 struct snd_ctl_elem_value *ucontrol)
2557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2558 struct sigmatel_spec *spec = codec->spec;
2560 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2564 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
2565 unsigned char type);
2567 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2568 struct snd_ctl_elem_value *ucontrol)
2570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2571 struct sigmatel_spec *spec = codec->spec;
2572 int nid = kcontrol->private_value;
2574 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2576 /* check to be sure that the ports are upto date with
2579 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2584 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2586 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2588 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2589 struct sigmatel_spec *spec = codec->spec;
2590 int io_idx = kcontrol-> private_value & 0xff;
2592 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2596 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2598 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2599 struct sigmatel_spec *spec = codec->spec;
2600 hda_nid_t nid = kcontrol->private_value >> 8;
2601 int io_idx = kcontrol-> private_value & 0xff;
2602 unsigned short val = !!ucontrol->value.integer.value[0];
2604 spec->io_switch[io_idx] = val;
2607 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2609 unsigned int pinctl = AC_PINCTL_IN_EN;
2610 if (io_idx) /* set VREF for mic */
2611 pinctl |= stac92xx_get_vref(codec, nid);
2612 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2615 /* check the auto-mute again: we need to mute/unmute the speaker
2616 * appropriately according to the pin direction
2618 if (spec->hp_detect)
2619 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2624 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2626 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2627 struct snd_ctl_elem_value *ucontrol)
2629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2630 struct sigmatel_spec *spec = codec->spec;
2632 ucontrol->value.integer.value[0] = spec->clfe_swap;
2636 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2637 struct snd_ctl_elem_value *ucontrol)
2639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2640 struct sigmatel_spec *spec = codec->spec;
2641 hda_nid_t nid = kcontrol->private_value & 0xff;
2642 unsigned int val = !!ucontrol->value.integer.value[0];
2644 if (spec->clfe_swap == val)
2647 spec->clfe_swap = val;
2649 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2650 spec->clfe_swap ? 0x4 : 0x0);
2655 #define STAC_CODEC_HP_SWITCH(xname) \
2656 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2659 .info = stac92xx_hp_switch_info, \
2660 .get = stac92xx_hp_switch_get, \
2661 .put = stac92xx_hp_switch_put, \
2664 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2665 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2668 .info = stac92xx_io_switch_info, \
2669 .get = stac92xx_io_switch_get, \
2670 .put = stac92xx_io_switch_put, \
2671 .private_value = xpval, \
2674 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2675 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2678 .info = stac92xx_clfe_switch_info, \
2679 .get = stac92xx_clfe_switch_get, \
2680 .put = stac92xx_clfe_switch_put, \
2681 .private_value = xpval, \
2685 STAC_CTL_WIDGET_VOL,
2686 STAC_CTL_WIDGET_MUTE,
2687 STAC_CTL_WIDGET_MONO_MUX,
2688 STAC_CTL_WIDGET_AMP_MUX,
2689 STAC_CTL_WIDGET_AMP_VOL,
2690 STAC_CTL_WIDGET_HP_SWITCH,
2691 STAC_CTL_WIDGET_IO_SWITCH,
2692 STAC_CTL_WIDGET_CLFE_SWITCH
2695 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2696 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2697 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2700 STAC_AMP_VOL(NULL, 0, 0, 0, 0),
2701 STAC_CODEC_HP_SWITCH(NULL),
2702 STAC_CODEC_IO_SWITCH(NULL, 0),
2703 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2706 /* add dynamic controls */
2707 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2708 struct snd_kcontrol_new *ktemp,
2709 int idx, const char *name,
2712 struct snd_kcontrol_new *knew;
2714 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2715 knew = snd_array_new(&spec->kctls);
2720 knew->name = kstrdup(name, GFP_KERNEL);
2723 knew->private_value = val;
2727 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2728 int type, int idx, const char *name,
2731 return stac92xx_add_control_temp(spec,
2732 &stac92xx_control_templates[type],
2737 /* add dynamic controls */
2738 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2739 const char *name, unsigned long val)
2741 return stac92xx_add_control_idx(spec, type, 0, name, val);
2744 /* flag inputs as additional dynamic lineouts */
2745 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2747 struct sigmatel_spec *spec = codec->spec;
2748 unsigned int wcaps, wtype;
2749 int i, num_dacs = 0;
2751 /* use the wcaps cache to count all DACs available for line-outs */
2752 for (i = 0; i < codec->num_nodes; i++) {
2753 wcaps = codec->wcaps[i];
2754 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2756 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2760 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2762 switch (cfg->line_outs) {
2764 /* add line-in as side */
2765 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2766 cfg->line_out_pins[cfg->line_outs] =
2767 cfg->input_pins[AUTO_PIN_LINE];
2768 spec->line_switch = 1;
2773 /* add line-in as clfe and mic as side */
2774 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2775 cfg->line_out_pins[cfg->line_outs] =
2776 cfg->input_pins[AUTO_PIN_LINE];
2777 spec->line_switch = 1;
2780 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2781 cfg->line_out_pins[cfg->line_outs] =
2782 cfg->input_pins[AUTO_PIN_MIC];
2783 spec->mic_switch = 1;
2788 /* add line-in as surr and mic as clfe */
2789 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2790 cfg->line_out_pins[cfg->line_outs] =
2791 cfg->input_pins[AUTO_PIN_LINE];
2792 spec->line_switch = 1;
2795 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2796 cfg->line_out_pins[cfg->line_outs] =
2797 cfg->input_pins[AUTO_PIN_MIC];
2798 spec->mic_switch = 1;
2808 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2812 for (i = 0; i < spec->multiout.num_dacs; i++) {
2813 if (spec->multiout.dac_nids[i] == nid)
2821 * Fill in the dac_nids table from the parsed pin configuration
2822 * This function only works when every pin in line_out_pins[]
2823 * contains atleast one DAC in its connection list. Some 92xx
2824 * codecs are not connected directly to a DAC, such as the 9200
2825 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2827 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2828 struct auto_pin_cfg *cfg)
2830 struct sigmatel_spec *spec = codec->spec;
2831 int i, j, conn_len = 0;
2832 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2833 unsigned int wcaps, wtype;
2835 for (i = 0; i < cfg->line_outs; i++) {
2836 nid = cfg->line_out_pins[i];
2837 conn_len = snd_hda_get_connections(codec, nid, conn,
2838 HDA_MAX_CONNECTIONS);
2839 for (j = 0; j < conn_len; j++) {
2840 wcaps = snd_hda_param_read(codec, conn[j],
2841 AC_PAR_AUDIO_WIDGET_CAP);
2842 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2843 if (wtype != AC_WID_AUD_OUT ||
2844 (wcaps & AC_WCAP_DIGITAL))
2846 /* conn[j] is a DAC routed to this line-out */
2847 if (!is_in_dac_nids(spec, conn[j]))
2851 if (j == conn_len) {
2852 if (spec->multiout.num_dacs > 0) {
2853 /* we have already working output pins,
2854 * so let's drop the broken ones again
2856 cfg->line_outs = spec->multiout.num_dacs;
2859 /* error out, no available DAC found */
2861 "%s: No available DAC for pin 0x%x\n",
2866 spec->multiout.dac_nids[i] = conn[j];
2867 spec->multiout.num_dacs++;
2869 /* select this DAC in the pin's input mux */
2870 snd_hda_codec_write_cache(codec, nid, 0,
2871 AC_VERB_SET_CONNECT_SEL, j);
2876 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2877 spec->multiout.num_dacs,
2878 spec->multiout.dac_nids[0],
2879 spec->multiout.dac_nids[1],
2880 spec->multiout.dac_nids[2],
2881 spec->multiout.dac_nids[3],
2882 spec->multiout.dac_nids[4]);
2886 /* create volume control/switch for the given prefx type */
2887 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2892 sprintf(name, "%s Playback Volume", pfx);
2893 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2894 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2897 sprintf(name, "%s Playback Switch", pfx);
2898 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2899 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2905 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2907 if (!spec->multiout.hp_nid)
2908 spec->multiout.hp_nid = nid;
2909 else if (spec->multiout.num_dacs > 4) {
2910 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2913 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2914 spec->multiout.num_dacs++;
2919 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2921 if (is_in_dac_nids(spec, nid))
2923 if (spec->multiout.hp_nid == nid)
2928 /* add playback controls from the parsed DAC table */
2929 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2930 const struct auto_pin_cfg *cfg)
2932 static const char *chname[4] = {
2933 "Front", "Surround", NULL /*CLFE*/, "Side"
2938 struct sigmatel_spec *spec = codec->spec;
2939 unsigned int wid_caps, pincap;
2942 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2943 if (!spec->multiout.dac_nids[i])
2946 nid = spec->multiout.dac_nids[i];
2950 err = create_controls(spec, "Center", nid, 1);
2953 err = create_controls(spec, "LFE", nid, 2);
2957 wid_caps = get_wcaps(codec, nid);
2959 if (wid_caps & AC_WCAP_LR_SWAP) {
2960 err = stac92xx_add_control(spec,
2961 STAC_CTL_WIDGET_CLFE_SWITCH,
2962 "Swap Center/LFE Playback Switch", nid);
2969 err = create_controls(spec, chname[i], nid, 3);
2975 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 &&
2976 cfg->hp_outs && !spec->multiout.hp_nid)
2977 spec->multiout.hp_nid = nid;
2979 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
2980 err = stac92xx_add_control(spec,
2981 STAC_CTL_WIDGET_HP_SWITCH,
2982 "Headphone as Line Out Switch",
2983 cfg->hp_pins[cfg->hp_outs - 1]);
2988 if (spec->line_switch) {
2989 nid = cfg->input_pins[AUTO_PIN_LINE];
2990 pincap = snd_hda_param_read(codec, nid,
2992 if (pincap & AC_PINCAP_OUT) {
2993 err = stac92xx_add_control(spec,
2994 STAC_CTL_WIDGET_IO_SWITCH,
2995 "Line In as Output Switch", nid << 8);
3001 if (spec->mic_switch) {
3002 unsigned int def_conf;
3003 unsigned int mic_pin = AUTO_PIN_MIC;
3005 nid = cfg->input_pins[mic_pin];
3006 def_conf = snd_hda_codec_read(codec, nid, 0,
3007 AC_VERB_GET_CONFIG_DEFAULT, 0);
3008 /* some laptops have an internal analog microphone
3009 * which can't be used as a output */
3010 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
3011 pincap = snd_hda_param_read(codec, nid,
3013 if (pincap & AC_PINCAP_OUT) {
3014 err = stac92xx_add_control(spec,
3015 STAC_CTL_WIDGET_IO_SWITCH,
3016 "Mic as Output Switch", (nid << 8) | 1);
3017 nid = snd_hda_codec_read(codec, nid, 0,
3018 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3019 if (!check_in_dac_nids(spec, nid))
3020 add_spec_dacs(spec, nid);
3024 } else if (mic_pin == AUTO_PIN_MIC) {
3025 mic_pin = AUTO_PIN_FRONT_MIC;
3033 /* add playback controls for Speaker and HP outputs */
3034 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3035 struct auto_pin_cfg *cfg)
3037 struct sigmatel_spec *spec = codec->spec;
3039 int i, old_num_dacs, err;
3041 old_num_dacs = spec->multiout.num_dacs;
3042 for (i = 0; i < cfg->hp_outs; i++) {
3043 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
3044 if (wid_caps & AC_WCAP_UNSOL_CAP)
3045 spec->hp_detect = 1;
3046 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
3047 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3048 if (check_in_dac_nids(spec, nid))
3052 add_spec_dacs(spec, nid);
3054 for (i = 0; i < cfg->speaker_outs; i++) {
3055 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
3056 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3057 if (check_in_dac_nids(spec, nid))
3061 add_spec_dacs(spec, nid);
3063 for (i = 0; i < cfg->line_outs; i++) {
3064 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
3065 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3066 if (check_in_dac_nids(spec, nid))
3070 add_spec_dacs(spec, nid);
3072 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
3073 static const char *pfxs[] = {
3074 "Speaker", "External Speaker", "Speaker2",
3076 err = create_controls(spec, pfxs[i - old_num_dacs],
3077 spec->multiout.dac_nids[i], 3);
3081 if (spec->multiout.hp_nid) {
3082 err = create_controls(spec, "Headphone",
3083 spec->multiout.hp_nid, 3);
3091 /* labels for mono mux outputs */
3092 static const char *stac92xx_mono_labels[4] = {
3093 "DAC0", "DAC1", "Mixer", "DAC2"
3096 /* create mono mux for mono out on capable codecs */
3097 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3099 struct sigmatel_spec *spec = codec->spec;
3100 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3102 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3104 num_cons = snd_hda_get_connections(codec,
3107 HDA_MAX_NUM_INPUTS);
3108 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3111 for (i = 0; i < num_cons; i++) {
3112 mono_mux->items[mono_mux->num_items].label =
3113 stac92xx_mono_labels[i];
3114 mono_mux->items[mono_mux->num_items].index = i;
3115 mono_mux->num_items++;
3118 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3119 "Mono Mux", spec->mono_nid);
3122 /* labels for amp mux outputs */
3123 static const char *stac92xx_amp_labels[3] = {
3124 "Front Microphone", "Microphone", "Line In",
3127 /* create amp out controls mux on capable codecs */
3128 static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
3130 struct sigmatel_spec *spec = codec->spec;
3131 struct hda_input_mux *amp_mux = &spec->private_amp_mux;
3134 for (i = 0; i < spec->num_amps; i++) {
3135 amp_mux->items[amp_mux->num_items].label =
3136 stac92xx_amp_labels[i];
3137 amp_mux->items[amp_mux->num_items].index = i;
3138 amp_mux->num_items++;
3141 if (spec->num_amps > 1) {
3142 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
3143 "Amp Selector Capture Switch", 0);
3147 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
3148 "Amp Capture Volume",
3149 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
3153 /* create PC beep volume controls */
3154 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3157 struct sigmatel_spec *spec = codec->spec;
3158 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3161 /* check for mute support for the the amp */
3162 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3163 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3164 "PC Beep Playback Switch",
3165 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3170 /* check to see if there is volume support for the amp */
3171 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3172 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3173 "PC Beep Playback Volume",
3174 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3181 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3182 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3184 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3185 struct snd_ctl_elem_value *ucontrol)
3187 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3188 ucontrol->value.integer.value[0] = codec->beep->enabled;
3192 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3193 struct snd_ctl_elem_value *ucontrol)
3195 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3196 int enabled = !!ucontrol->value.integer.value[0];
3197 if (codec->beep->enabled != enabled) {
3198 codec->beep->enabled = enabled;
3204 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3206 .info = stac92xx_dig_beep_switch_info,
3207 .get = stac92xx_dig_beep_switch_get,
3208 .put = stac92xx_dig_beep_switch_put,
3211 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3213 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3214 0, "PC Beep Playback Switch", 0);
3218 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3220 struct sigmatel_spec *spec = codec->spec;
3221 int wcaps, nid, i, err = 0;
3223 for (i = 0; i < spec->num_muxes; i++) {
3224 nid = spec->mux_nids[i];
3225 wcaps = get_wcaps(codec, nid);
3227 if (wcaps & AC_WCAP_OUT_AMP) {
3228 err = stac92xx_add_control_idx(spec,
3229 STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume",
3230 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3238 static const char *stac92xx_spdif_labels[3] = {
3239 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3242 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3244 struct sigmatel_spec *spec = codec->spec;
3245 struct hda_input_mux *spdif_mux = &spec->private_smux;
3246 const char **labels = spec->spdif_labels;
3248 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3250 num_cons = snd_hda_get_connections(codec,
3253 HDA_MAX_NUM_INPUTS);
3258 labels = stac92xx_spdif_labels;
3260 for (i = 0; i < num_cons; i++) {
3261 spdif_mux->items[spdif_mux->num_items].label = labels[i];
3262 spdif_mux->items[spdif_mux->num_items].index = i;
3263 spdif_mux->num_items++;
3269 /* labels for dmic mux inputs */
3270 static const char *stac92xx_dmic_labels[5] = {
3271 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3272 "Digital Mic 3", "Digital Mic 4"
3275 /* create playback/capture controls for input pins on dmic capable codecs */
3276 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3277 const struct auto_pin_cfg *cfg)
3279 struct sigmatel_spec *spec = codec->spec;
3280 struct hda_input_mux *dimux = &spec->private_dimux;
3281 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3285 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
3286 dimux->items[dimux->num_items].index = 0;
3289 for (i = 0; i < spec->num_dmics; i++) {
3294 unsigned int def_conf;
3296 def_conf = snd_hda_codec_read(codec,
3299 AC_VERB_GET_CONFIG_DEFAULT,
3301 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3304 nid = spec->dmic_nids[i];
3305 num_cons = snd_hda_get_connections(codec,
3308 HDA_MAX_NUM_INPUTS);
3309 for (j = 0; j < num_cons; j++)
3310 if (con_lst[j] == nid) {
3316 wcaps = get_wcaps(codec, nid) &
3317 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3320 sprintf(name, "%s Capture Volume",
3321 stac92xx_dmic_labels[dimux->num_items]);
3323 err = stac92xx_add_control(spec,
3324 STAC_CTL_WIDGET_VOL,
3326 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3327 (wcaps & AC_WCAP_OUT_AMP) ?
3328 HDA_OUTPUT : HDA_INPUT));
3333 dimux->items[dimux->num_items].label =
3334 stac92xx_dmic_labels[dimux->num_items];
3335 dimux->items[dimux->num_items].index = index;
3342 /* create playback/capture controls for input pins */
3343 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3345 struct sigmatel_spec *spec = codec->spec;
3346 struct hda_input_mux *imux = &spec->private_imux;
3347 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3350 for (i = 0; i < AUTO_PIN_LAST; i++) {
3353 if (!cfg->input_pins[i])
3356 for (j = 0; j < spec->num_muxes; j++) {
3358 num_cons = snd_hda_get_connections(codec,
3361 HDA_MAX_NUM_INPUTS);
3362 for (k = 0; k < num_cons; k++)
3363 if (con_lst[k] == cfg->input_pins[i]) {
3370 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
3371 imux->items[imux->num_items].index = index;
3375 if (imux->num_items) {
3377 * Set the current input for the muxes.
3378 * The STAC9221 has two input muxes with identical source
3379 * NID lists. Hopefully this won't get confused.
3381 for (i = 0; i < spec->num_muxes; i++) {
3382 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3383 AC_VERB_SET_CONNECT_SEL,
3384 imux->items[0].index);
3391 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3393 struct sigmatel_spec *spec = codec->spec;
3396 for (i = 0; i < spec->autocfg.line_outs; i++) {
3397 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3398 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3402 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3404 struct sigmatel_spec *spec = codec->spec;
3407 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3409 pin = spec->autocfg.hp_pins[i];
3410 if (pin) /* connect to front */
3411 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3413 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3415 pin = spec->autocfg.speaker_pins[i];
3416 if (pin) /* connect to front */
3417 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3421 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3423 struct sigmatel_spec *spec = codec->spec;
3425 int hp_speaker_swap = 0;
3427 if ((err = snd_hda_parse_pin_def_config(codec,
3429 spec->dmic_nids)) < 0)
3431 if (! spec->autocfg.line_outs)
3432 return 0; /* can't find valid pin config */
3434 /* If we have no real line-out pin and multiple hp-outs, HPs should
3435 * be set up as multi-channel outputs.
3437 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
3438 spec->autocfg.hp_outs > 1) {
3439 /* Copy hp_outs to line_outs, backup line_outs in
3440 * speaker_outs so that the following routines can handle
3441 * HP pins as primary outputs.
3443 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3444 sizeof(spec->autocfg.line_out_pins));
3445 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3446 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3447 sizeof(spec->autocfg.hp_pins));
3448 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3449 hp_speaker_swap = 1;
3451 if (spec->autocfg.mono_out_pin) {
3452 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3453 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3454 u32 caps = query_amp_caps(codec,
3455 spec->autocfg.mono_out_pin, dir);
3456 hda_nid_t conn_list[1];
3458 /* get the mixer node and then the mono mux if it exists */
3459 if (snd_hda_get_connections(codec,
3460 spec->autocfg.mono_out_pin, conn_list, 1) &&
3461 snd_hda_get_connections(codec, conn_list[0],
3464 int wcaps = get_wcaps(codec, conn_list[0]);
3465 int wid_type = (wcaps & AC_WCAP_TYPE)
3466 >> AC_WCAP_TYPE_SHIFT;
3467 /* LR swap check, some stac925x have a mux that
3468 * changes the DACs output path instead of the
3471 if (wid_type == AC_WID_AUD_SEL &&
3472 !(wcaps & AC_WCAP_LR_SWAP))
3473 spec->mono_nid = conn_list[0];
3476 hda_nid_t nid = spec->autocfg.mono_out_pin;
3478 /* most mono outs have a least a mute/unmute switch */
3479 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3480 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3481 "Mono Playback Switch",
3482 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3485 /* check for volume support for the amp */
3486 if ((caps & AC_AMPCAP_NUM_STEPS)
3487 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3488 err = stac92xx_add_control(spec,
3489 STAC_CTL_WIDGET_VOL,
3490 "Mono Playback Volume",
3491 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3497 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3501 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
3503 if (spec->multiout.num_dacs == 0)
3504 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
3507 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3512 /* setup analog beep controls */
3513 if (spec->anabeep_nid > 0) {
3514 err = stac92xx_auto_create_beep_ctls(codec,
3520 /* setup digital beep controls and input device */
3521 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3522 if (spec->digbeep_nid > 0) {
3523 hda_nid_t nid = spec->digbeep_nid;
3526 err = stac92xx_auto_create_beep_ctls(codec, nid);
3529 err = snd_hda_attach_beep_device(codec, nid);
3532 /* if no beep switch is available, make its own one */
3533 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3535 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
3536 err = stac92xx_beep_switch_ctl(codec);
3543 if (hp_speaker_swap == 1) {
3544 /* Restore the hp_outs and line_outs */
3545 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3546 sizeof(spec->autocfg.line_out_pins));
3547 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3548 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
3549 sizeof(spec->autocfg.speaker_pins));
3550 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
3551 memset(spec->autocfg.speaker_pins, 0,
3552 sizeof(spec->autocfg.speaker_pins));
3553 spec->autocfg.speaker_outs = 0;
3556 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3561 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3566 if (spec->mono_nid > 0) {
3567 err = stac92xx_auto_create_mono_output_ctls(codec);
3571 if (spec->num_amps > 0) {
3572 err = stac92xx_auto_create_amp_output_ctls(codec);
3576 if (spec->num_dmics > 0 && !spec->dinput_mux)
3577 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3578 &spec->autocfg)) < 0)
3580 if (spec->num_muxes > 0) {
3581 err = stac92xx_auto_create_mux_input_ctls(codec);
3585 if (spec->num_smuxes > 0) {
3586 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3591 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3592 if (spec->multiout.max_channels > 2)
3593 spec->surr_switch = 1;
3595 if (spec->autocfg.dig_out_pin)
3596 spec->multiout.dig_out_nid = dig_out;
3597 if (dig_in && spec->autocfg.dig_in_pin)
3598 spec->dig_in_nid = dig_in;
3600 if (spec->kctls.list)
3601 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3603 spec->input_mux = &spec->private_imux;
3604 spec->dinput_mux = &spec->private_dimux;
3605 spec->sinput_mux = &spec->private_smux;
3606 spec->mono_mux = &spec->private_mono_mux;
3607 spec->amp_mux = &spec->private_amp_mux;
3611 /* add playback controls for HP output */
3612 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3613 struct auto_pin_cfg *cfg)
3615 struct sigmatel_spec *spec = codec->spec;
3616 hda_nid_t pin = cfg->hp_pins[0];
3617 unsigned int wid_caps;
3622 wid_caps = get_wcaps(codec, pin);
3623 if (wid_caps & AC_WCAP_UNSOL_CAP)
3624 spec->hp_detect = 1;
3629 /* add playback controls for LFE output */
3630 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3631 struct auto_pin_cfg *cfg)
3633 struct sigmatel_spec *spec = codec->spec;
3635 hda_nid_t lfe_pin = 0x0;
3639 * search speaker outs and line outs for a mono speaker pin
3640 * with an amp. If one is found, add LFE controls
3643 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3644 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3645 unsigned int wcaps = get_wcaps(codec, pin);
3646 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3647 if (wcaps == AC_WCAP_OUT_AMP)
3648 /* found a mono speaker with an amp, must be lfe */
3652 /* if speaker_outs is 0, then speakers may be in line_outs */
3653 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3654 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3655 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3656 unsigned int defcfg;
3657 defcfg = snd_hda_codec_read(codec, pin, 0,
3658 AC_VERB_GET_CONFIG_DEFAULT,
3660 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3661 unsigned int wcaps = get_wcaps(codec, pin);
3662 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3663 if (wcaps == AC_WCAP_OUT_AMP)
3664 /* found a mono speaker with an amp,
3672 err = create_controls(spec, "LFE", lfe_pin, 1);
3680 static int stac9200_parse_auto_config(struct hda_codec *codec)
3682 struct sigmatel_spec *spec = codec->spec;
3685 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3688 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3691 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3694 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3697 if (spec->num_muxes > 0) {
3698 err = stac92xx_auto_create_mux_input_ctls(codec);
3703 if (spec->autocfg.dig_out_pin)
3704 spec->multiout.dig_out_nid = 0x05;
3705 if (spec->autocfg.dig_in_pin)
3706 spec->dig_in_nid = 0x04;
3708 if (spec->kctls.list)
3709 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3711 spec->input_mux = &spec->private_imux;
3712 spec->dinput_mux = &spec->private_dimux;
3718 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3719 * funky external mute control using GPIO pins.
3722 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3723 unsigned int dir_mask, unsigned int data)
3725 unsigned int gpiostate, gpiomask, gpiodir;
3727 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3728 AC_VERB_GET_GPIO_DATA, 0);
3729 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3731 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3732 AC_VERB_GET_GPIO_MASK, 0);
3735 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3736 AC_VERB_GET_GPIO_DIRECTION, 0);
3737 gpiodir |= dir_mask;
3739 /* Configure GPIOx as CMOS */
3740 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3742 snd_hda_codec_write(codec, codec->afg, 0,
3743 AC_VERB_SET_GPIO_MASK, gpiomask);
3744 snd_hda_codec_read(codec, codec->afg, 0,
3745 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3749 snd_hda_codec_read(codec, codec->afg, 0,
3750 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3753 static int stac92xx_add_jack(struct hda_codec *codec,
3754 hda_nid_t nid, int type)
3756 #ifdef CONFIG_SND_JACK
3757 struct sigmatel_spec *spec = codec->spec;
3758 struct sigmatel_jack *jack;
3759 int def_conf = snd_hda_codec_read(codec, nid,
3760 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3761 int connectivity = get_defcfg_connect(def_conf);
3764 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
3767 snd_array_init(&spec->jacks, sizeof(*jack), 32);
3768 jack = snd_array_new(&spec->jacks);
3774 sprintf(name, "%s at %s %s Jack",
3775 snd_hda_get_jack_type(def_conf),
3776 snd_hda_get_jack_connectivity(def_conf),
3777 snd_hda_get_jack_location(def_conf));
3779 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
3785 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
3786 unsigned char type, int data)
3788 struct sigmatel_event *event;
3790 snd_array_init(&spec->events, sizeof(*event), 32);
3791 event = snd_array_new(&spec->events);
3796 event->tag = spec->events.used;
3802 static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
3803 hda_nid_t nid, unsigned char type)
3805 struct sigmatel_spec *spec = codec->spec;
3806 struct sigmatel_event *event = spec->events.list;
3809 for (i = 0; i < spec->events.used; i++, event++) {
3810 if (event->nid == nid && event->type == type)
3816 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
3819 struct sigmatel_spec *spec = codec->spec;
3820 struct sigmatel_event *event = spec->events.list;
3823 for (i = 0; i < spec->events.used; i++, event++) {
3824 if (event->tag == tag)
3830 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3833 struct sigmatel_event *event;
3836 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
3838 event = stac_get_event(codec, nid, type);
3842 tag = stac_add_event(codec->spec, nid, type, 0);
3845 snd_hda_codec_write_cache(codec, nid, 0,
3846 AC_VERB_SET_UNSOLICITED_ENABLE,
3850 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3853 for (i = 0; i < cfg->hp_outs; i++)
3854 if (cfg->hp_pins[i] == nid)
3855 return 1; /* nid is a HP-Out */
3857 return 0; /* nid is not a HP-Out */
3860 static void stac92xx_power_down(struct hda_codec *codec)
3862 struct sigmatel_spec *spec = codec->spec;
3864 /* power down inactive DACs */
3866 for (dac = spec->dac_list; *dac; dac++)
3867 if (!is_in_dac_nids(spec, *dac) &&
3868 spec->multiout.hp_nid != *dac)
3869 snd_hda_codec_write_cache(codec, *dac, 0,
3870 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3873 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3876 static int stac92xx_init(struct hda_codec *codec)
3878 struct sigmatel_spec *spec = codec->spec;
3879 struct auto_pin_cfg *cfg = &spec->autocfg;
3883 snd_hda_sequence_write(codec, spec->init);
3885 /* power down adcs initially */
3886 if (spec->powerdown_adcs)
3887 for (i = 0; i < spec->num_adcs; i++)
3888 snd_hda_codec_write_cache(codec,
3889 spec->adc_nids[i], 0,
3890 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3893 gpio = spec->gpio_data;
3894 /* turn on EAPD statically when spec->eapd_switch isn't set.
3895 * otherwise, unsol event will turn it on/off dynamically
3897 if (!spec->eapd_switch)
3898 gpio |= spec->eapd_mask;
3899 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
3902 if (spec->hp_detect) {
3903 /* Enable unsolicited responses on the HP widget */
3904 for (i = 0; i < cfg->hp_outs; i++) {
3905 hda_nid_t nid = cfg->hp_pins[i];
3906 enable_pin_detect(codec, nid, STAC_HP_EVENT);
3908 /* force to enable the first line-out; the others are set up
3911 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3913 /* fake event to set up pins */
3914 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
3917 stac92xx_auto_init_multi_out(codec);
3918 stac92xx_auto_init_hp_out(codec);
3920 for (i = 0; i < AUTO_PIN_LAST; i++) {
3921 hda_nid_t nid = cfg->input_pins[i];
3923 unsigned int pinctl;
3924 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) {
3925 /* for mic pins, force to initialize */
3926 pinctl = stac92xx_get_vref(codec, nid);
3928 pinctl = snd_hda_codec_read(codec, nid, 0,
3929 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3930 /* if PINCTL already set then skip */
3931 if (pinctl & AC_PINCTL_IN_EN)
3934 pinctl |= AC_PINCTL_IN_EN;
3935 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3936 enable_pin_detect(codec, nid, STAC_INSERT_EVENT);
3939 for (i = 0; i < spec->num_dmics; i++)
3940 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3942 if (cfg->dig_out_pin)
3943 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3945 if (cfg->dig_in_pin)
3946 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3948 for (i = 0; i < spec->num_pwrs; i++) {
3949 hda_nid_t nid = spec->pwr_nids[i];
3950 int pinctl, def_conf;
3952 if (is_nid_hp_pin(cfg, nid) && spec->hp_detect)
3953 continue; /* already has an unsol event */
3955 pinctl = snd_hda_codec_read(codec, nid, 0,
3956 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3957 /* outputs are only ports capable of power management
3958 * any attempts on powering down a input port cause the
3959 * referenced VREF to act quirky.
3961 if (pinctl & AC_PINCTL_IN_EN)
3963 def_conf = snd_hda_codec_read(codec, nid, 0,
3964 AC_VERB_GET_CONFIG_DEFAULT, 0);
3965 def_conf = get_defcfg_connect(def_conf);
3966 /* skip any ports that don't have jacks since presence
3967 * detection is useless */
3968 if (def_conf != AC_JACK_PORT_COMPLEX) {
3969 if (def_conf != AC_JACK_PORT_NONE)
3970 stac_toggle_power_map(codec, nid, 1);
3973 enable_pin_detect(codec, nid, STAC_PWR_EVENT);
3974 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT);
3977 stac92xx_power_down(codec);
3981 static void stac92xx_free_jacks(struct hda_codec *codec)
3983 #ifdef CONFIG_SND_JACK
3984 /* free jack instances manually when clearing/reconfiguring */
3985 struct sigmatel_spec *spec = codec->spec;
3986 if (!codec->bus->shutdown && spec->jacks.list) {
3987 struct sigmatel_jack *jacks = spec->jacks.list;
3989 for (i = 0; i < spec->jacks.used; i++)
3990 snd_device_free(codec->bus->card, &jacks[i].jack);
3992 snd_array_free(&spec->jacks);
3996 static void stac92xx_free_kctls(struct hda_codec *codec)
3998 struct sigmatel_spec *spec = codec->spec;
4000 if (spec->kctls.list) {
4001 struct snd_kcontrol_new *kctl = spec->kctls.list;
4003 for (i = 0; i < spec->kctls.used; i++)
4004 kfree(kctl[i].name);
4006 snd_array_free(&spec->kctls);
4009 static void stac92xx_free(struct hda_codec *codec)
4011 struct sigmatel_spec *spec = codec->spec;
4016 kfree(spec->pin_configs);
4017 stac92xx_free_jacks(codec);
4018 snd_array_free(&spec->events);
4021 snd_hda_detach_beep_device(codec);
4024 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4027 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4028 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4030 if (pin_ctl & AC_PINCTL_IN_EN) {
4032 * we need to check the current set-up direction of
4033 * shared input pins since they can be switched via
4034 * "xxx as Output" mixer switch
4036 struct sigmatel_spec *spec = codec->spec;
4037 struct auto_pin_cfg *cfg = &spec->autocfg;
4038 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
4039 spec->line_switch) ||
4040 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
4045 /* if setting pin direction bits, clear the current
4046 direction bits first */
4047 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4048 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4050 snd_hda_codec_write_cache(codec, nid, 0,
4051 AC_VERB_SET_PIN_WIDGET_CONTROL,
4055 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4058 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4059 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4060 snd_hda_codec_write_cache(codec, nid, 0,
4061 AC_VERB_SET_PIN_WIDGET_CONTROL,
4065 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4069 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
4071 unsigned int pinctl;
4072 pinctl = snd_hda_codec_read(codec, nid, 0,
4073 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4074 if (pinctl & AC_PINCTL_IN_EN)
4075 return 0; /* mic- or line-input */
4077 return 1; /* HP-output */
4082 /* return non-zero if the hp-pin of the given array index isn't
4083 * a jack-detection target
4085 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4087 struct auto_pin_cfg *cfg = &spec->autocfg;
4089 /* ignore sensing of shared line and mic jacks */
4090 if (spec->line_switch &&
4091 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE])
4093 if (spec->mic_switch &&
4094 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC])
4096 /* ignore if the pin is set as line-out */
4097 if (cfg->hp_pins[i] == spec->hp_switch)
4102 static void stac92xx_hp_detect(struct hda_codec *codec)
4104 struct sigmatel_spec *spec = codec->spec;
4105 struct auto_pin_cfg *cfg = &spec->autocfg;
4109 if (spec->gpio_mute)
4110 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4111 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4113 for (i = 0; i < cfg->hp_outs; i++) {
4116 if (no_hp_sensing(spec, i))
4118 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
4122 /* disable lineouts */
4123 if (spec->hp_switch)
4124 stac92xx_reset_pinctl(codec, spec->hp_switch,
4126 for (i = 0; i < cfg->line_outs; i++)
4127 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4129 for (i = 0; i < cfg->speaker_outs; i++)
4130 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4132 if (spec->eapd_mask && spec->eapd_switch)
4133 stac_gpio_set(codec, spec->gpio_mask,
4134 spec->gpio_dir, spec->gpio_data &
4137 /* enable lineouts */
4138 if (spec->hp_switch)
4139 stac92xx_set_pinctl(codec, spec->hp_switch,
4141 for (i = 0; i < cfg->line_outs; i++)
4142 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4144 for (i = 0; i < cfg->speaker_outs; i++)
4145 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4147 if (spec->eapd_mask && spec->eapd_switch)
4148 stac_gpio_set(codec, spec->gpio_mask,
4149 spec->gpio_dir, spec->gpio_data |
4152 /* toggle hp outs */
4153 for (i = 0; i < cfg->hp_outs; i++) {
4154 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4155 if (no_hp_sensing(spec, i))
4158 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4160 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4164 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4167 struct sigmatel_spec *spec = codec->spec;
4168 unsigned int idx, val;
4170 for (idx = 0; idx < spec->num_pwrs; idx++) {
4171 if (spec->pwr_nids[idx] == nid)
4174 if (idx >= spec->num_pwrs)
4177 /* several codecs have two power down bits */
4178 if (spec->pwr_mapping)
4179 idx = spec->pwr_mapping[idx];
4183 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4189 /* power down unused output ports */
4190 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4193 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4195 stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid));
4198 static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid)
4200 struct sigmatel_spec *spec = codec->spec;
4201 struct sigmatel_jack *jacks = spec->jacks.list;
4205 for (i = 0; i < spec->jacks.used; i++) {
4206 if (jacks->nid == nid) {
4207 unsigned int pin_ctl =
4208 snd_hda_codec_read(codec, nid,
4209 0, AC_VERB_GET_PIN_WIDGET_CONTROL,
4211 int type = jacks->type;
4212 if (type == (SND_JACK_LINEOUT
4213 | SND_JACK_HEADPHONE))
4214 type = (pin_ctl & AC_PINCTL_HP_EN)
4215 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT;
4216 snd_jack_report(jacks->jack,
4217 get_hp_pin_presence(codec, nid)
4225 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
4228 struct sigmatel_event *event = stac_get_event(codec, nid, type);
4231 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);
4234 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4236 struct sigmatel_spec *spec = codec->spec;
4237 struct sigmatel_event *event;
4240 tag = (res >> 26) & 0x7f;
4241 event = stac_get_event_from_tag(codec, tag);
4245 switch (event->type) {
4247 stac92xx_hp_detect(codec);
4249 case STAC_INSERT_EVENT:
4250 case STAC_PWR_EVENT:
4251 if (spec->num_pwrs > 0)
4252 stac92xx_pin_sense(codec, event->nid);
4253 stac92xx_report_jack(codec, event->nid);
4255 case STAC_VREF_EVENT:
4256 data = snd_hda_codec_read(codec, codec->afg, 0,
4257 AC_VERB_GET_GPIO_DATA, 0);
4258 /* toggle VREF state based on GPIOx status */
4259 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4260 !!(data & (1 << event->data)));
4265 #ifdef CONFIG_PROC_FS
4266 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4267 struct hda_codec *codec, hda_nid_t nid)
4269 if (nid == codec->afg)
4270 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4271 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4274 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4275 struct hda_codec *codec,
4278 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4279 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4282 /* stac92hd71bxx, stac92hd73xx */
4283 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4284 struct hda_codec *codec, hda_nid_t nid)
4286 stac92hd_proc_hook(buffer, codec, nid);
4287 if (nid == codec->afg)
4288 analog_loop_proc_hook(buffer, codec, 0xfa0);
4291 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4292 struct hda_codec *codec, hda_nid_t nid)
4294 if (nid == codec->afg)
4295 analog_loop_proc_hook(buffer, codec, 0xfe0);
4298 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4299 struct hda_codec *codec, hda_nid_t nid)
4301 if (nid == codec->afg)
4302 analog_loop_proc_hook(buffer, codec, 0xfeb);
4305 #define stac92hd_proc_hook NULL
4306 #define stac92hd7x_proc_hook NULL
4307 #define stac9205_proc_hook NULL
4308 #define stac927x_proc_hook NULL
4311 #ifdef SND_HDA_NEEDS_RESUME
4312 static int stac92xx_resume(struct hda_codec *codec)
4314 struct sigmatel_spec *spec = codec->spec;
4316 stac92xx_set_config_regs(codec);
4317 stac92xx_init(codec);
4318 snd_hda_codec_resume_amp(codec);
4319 snd_hda_codec_resume_cache(codec);
4320 /* fake event to set up pins again to override cached values */
4321 if (spec->hp_detect)
4322 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
4327 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4329 struct sigmatel_spec *spec = codec->spec;
4330 if (spec->eapd_mask)
4331 stac_gpio_set(codec, spec->gpio_mask,
4332 spec->gpio_dir, spec->gpio_data &
4338 static struct hda_codec_ops stac92xx_patch_ops = {
4339 .build_controls = stac92xx_build_controls,
4340 .build_pcms = stac92xx_build_pcms,
4341 .init = stac92xx_init,
4342 .free = stac92xx_free,
4343 .unsol_event = stac92xx_unsol_event,
4344 #ifdef SND_HDA_NEEDS_RESUME
4345 .suspend = stac92xx_suspend,
4346 .resume = stac92xx_resume,
4350 static int patch_stac9200(struct hda_codec *codec)
4352 struct sigmatel_spec *spec;
4355 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4360 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4361 spec->pin_nids = stac9200_pin_nids;
4362 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
4365 if (spec->board_config < 0) {
4366 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
4367 err = stac92xx_save_bios_config_regs(codec);
4369 err = stac_save_pin_cfgs(codec,
4370 stac9200_brd_tbl[spec->board_config]);
4372 stac92xx_free(codec);
4376 spec->multiout.max_channels = 2;
4377 spec->multiout.num_dacs = 1;
4378 spec->multiout.dac_nids = stac9200_dac_nids;
4379 spec->adc_nids = stac9200_adc_nids;
4380 spec->mux_nids = stac9200_mux_nids;
4381 spec->num_muxes = 1;
4382 spec->num_dmics = 0;
4386 if (spec->board_config == STAC_9200_GATEWAY ||
4387 spec->board_config == STAC_9200_OQO)
4388 spec->init = stac9200_eapd_init;
4390 spec->init = stac9200_core_init;
4391 spec->mixer = stac9200_mixer;
4393 if (spec->board_config == STAC_9200_PANASONIC) {
4394 spec->gpio_mask = spec->gpio_dir = 0x09;
4395 spec->gpio_data = 0x00;
4398 err = stac9200_parse_auto_config(codec);
4400 stac92xx_free(codec);
4404 codec->patch_ops = stac92xx_patch_ops;
4409 static int patch_stac925x(struct hda_codec *codec)
4411 struct sigmatel_spec *spec;
4414 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4419 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4420 spec->pin_nids = stac925x_pin_nids;
4421 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
4425 if (spec->board_config < 0) {
4426 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4427 "using BIOS defaults\n");
4428 err = stac92xx_save_bios_config_regs(codec);
4430 err = stac_save_pin_cfgs(codec,
4431 stac925x_brd_tbl[spec->board_config]);
4433 stac92xx_free(codec);
4437 spec->multiout.max_channels = 2;
4438 spec->multiout.num_dacs = 1;
4439 spec->multiout.dac_nids = stac925x_dac_nids;
4440 spec->adc_nids = stac925x_adc_nids;
4441 spec->mux_nids = stac925x_mux_nids;
4442 spec->num_muxes = 1;
4445 switch (codec->vendor_id) {
4446 case 0x83847632: /* STAC9202 */
4447 case 0x83847633: /* STAC9202D */
4448 case 0x83847636: /* STAC9251 */
4449 case 0x83847637: /* STAC9251D */
4450 spec->num_dmics = STAC925X_NUM_DMICS;
4451 spec->dmic_nids = stac925x_dmic_nids;
4452 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
4453 spec->dmux_nids = stac925x_dmux_nids;
4456 spec->num_dmics = 0;
4460 spec->init = stac925x_core_init;
4461 spec->mixer = stac925x_mixer;
4463 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
4465 if (spec->board_config < 0) {
4466 printk(KERN_WARNING "hda_codec: No auto-config is "
4467 "available, default to model=ref\n");
4468 spec->board_config = STAC_925x_REF;
4474 stac92xx_free(codec);
4478 codec->patch_ops = stac92xx_patch_ops;
4483 static struct hda_input_mux stac92hd73xx_dmux = {
4486 { "Analog Inputs", 0x0b },
4487 { "Digital Mic 1", 0x09 },
4488 { "Digital Mic 2", 0x0a },
4493 static int patch_stac92hd73xx(struct hda_codec *codec)
4495 struct sigmatel_spec *spec;
4496 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
4499 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4504 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
4505 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
4506 spec->pin_nids = stac92hd73xx_pin_nids;
4507 spec->board_config = snd_hda_check_board_config(codec,
4508 STAC_92HD73XX_MODELS,
4509 stac92hd73xx_models,
4510 stac92hd73xx_cfg_tbl);
4512 if (spec->board_config < 0) {
4513 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4514 " STAC92HD73XX, using BIOS defaults\n");
4515 err = stac92xx_save_bios_config_regs(codec);
4517 err = stac_save_pin_cfgs(codec,
4518 stac92hd73xx_brd_tbl[spec->board_config]);
4520 stac92xx_free(codec);
4524 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
4525 conn, STAC92HD73_DAC_COUNT + 2) - 1;
4527 if (spec->multiout.num_dacs < 0) {
4528 printk(KERN_WARNING "hda_codec: Could not determine "
4529 "number of channels defaulting to DAC count\n");
4530 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
4533 switch (spec->multiout.num_dacs) {
4534 case 0x3: /* 6 Channel */
4535 spec->mixer = stac92hd73xx_6ch_mixer;
4536 spec->init = stac92hd73xx_6ch_core_init;
4538 case 0x4: /* 8 Channel */
4539 spec->mixer = stac92hd73xx_8ch_mixer;
4540 spec->init = stac92hd73xx_8ch_core_init;
4542 case 0x5: /* 10 Channel */
4543 spec->mixer = stac92hd73xx_10ch_mixer;
4544 spec->init = stac92hd73xx_10ch_core_init;
4547 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
4548 spec->aloopback_mask = 0x01;
4549 spec->aloopback_shift = 8;
4551 spec->digbeep_nid = 0x1c;
4552 spec->mux_nids = stac92hd73xx_mux_nids;
4553 spec->adc_nids = stac92hd73xx_adc_nids;
4554 spec->dmic_nids = stac92hd73xx_dmic_nids;
4555 spec->dmux_nids = stac92hd73xx_dmux_nids;
4556 spec->smux_nids = stac92hd73xx_smux_nids;
4557 spec->amp_nids = stac92hd73xx_amp_nids;
4558 spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
4560 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
4561 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
4562 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
4563 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
4564 sizeof(stac92hd73xx_dmux));
4566 switch (spec->board_config) {
4568 spec->init = dell_eq_core_init;
4570 case STAC_DELL_M6_AMIC:
4571 case STAC_DELL_M6_DMIC:
4572 case STAC_DELL_M6_BOTH:
4573 spec->num_smuxes = 0;
4574 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4575 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4576 spec->eapd_switch = 0;
4580 spec->init = dell_m6_core_init;
4581 switch (spec->board_config) {
4582 case STAC_DELL_M6_AMIC: /* Analog Mics */
4583 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4584 spec->num_dmics = 0;
4585 spec->private_dimux.num_items = 1;
4587 case STAC_DELL_M6_DMIC: /* Digital Mics */
4588 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4589 spec->num_dmics = 1;
4590 spec->private_dimux.num_items = 2;
4592 case STAC_DELL_M6_BOTH: /* Both */
4593 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4594 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4595 spec->num_dmics = 1;
4596 spec->private_dimux.num_items = 2;
4601 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4602 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4603 spec->eapd_switch = 1;
4605 if (spec->board_config > STAC_92HD73XX_REF) {
4606 /* GPIO0 High = Enable EAPD */
4607 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4608 spec->gpio_data = 0x01;
4610 spec->dinput_mux = &spec->private_dimux;
4612 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4613 spec->pwr_nids = stac92hd73xx_pwr_nids;
4615 err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
4618 if (spec->board_config < 0) {
4619 printk(KERN_WARNING "hda_codec: No auto-config is "
4620 "available, default to model=ref\n");
4621 spec->board_config = STAC_92HD73XX_REF;
4628 stac92xx_free(codec);
4632 codec->patch_ops = stac92xx_patch_ops;
4634 codec->proc_widget_hook = stac92hd7x_proc_hook;
4639 static struct hda_input_mux stac92hd83xxx_dmux = {
4642 { "Analog Inputs", 0x03 },
4643 { "Digital Mic 1", 0x04 },
4644 { "Digital Mic 2", 0x05 },
4648 static int patch_stac92hd83xxx(struct hda_codec *codec)
4650 struct sigmatel_spec *spec;
4653 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4658 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
4659 spec->mono_nid = 0x19;
4660 spec->digbeep_nid = 0x21;
4661 spec->dmic_nids = stac92hd83xxx_dmic_nids;
4662 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4663 spec->adc_nids = stac92hd83xxx_adc_nids;
4664 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4665 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4666 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4667 spec->multiout.dac_nids = stac92hd83xxx_dac_nids;
4669 spec->init = stac92hd83xxx_core_init;
4670 switch (codec->vendor_id) {
4672 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;
4676 spec->init++; /* switch to config #2 */
4677 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;
4680 spec->mixer = stac92hd83xxx_mixer;
4681 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4682 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4683 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4684 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4685 spec->dinput_mux = &stac92hd83xxx_dmux;
4686 spec->pin_nids = stac92hd83xxx_pin_nids;
4687 spec->board_config = snd_hda_check_board_config(codec,
4688 STAC_92HD83XXX_MODELS,
4689 stac92hd83xxx_models,
4690 stac92hd83xxx_cfg_tbl);
4692 if (spec->board_config < 0) {
4693 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4694 " STAC92HD83XXX, using BIOS defaults\n");
4695 err = stac92xx_save_bios_config_regs(codec);
4697 err = stac_save_pin_cfgs(codec,
4698 stac92hd83xxx_brd_tbl[spec->board_config]);
4700 stac92xx_free(codec);
4704 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4706 if (spec->board_config < 0) {
4707 printk(KERN_WARNING "hda_codec: No auto-config is "
4708 "available, default to model=ref\n");
4709 spec->board_config = STAC_92HD83XXX_REF;
4716 stac92xx_free(codec);
4720 codec->patch_ops = stac92xx_patch_ops;
4722 codec->proc_widget_hook = stac92hd_proc_hook;
4727 #ifdef SND_HDA_NEEDS_RESUME
4728 static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr)
4730 struct sigmatel_spec *spec = codec->spec;
4732 snd_hda_codec_write_cache(codec, codec->afg, 0,
4733 AC_VERB_SET_POWER_STATE, pwr);
4736 for (i = 0; i < spec->num_adcs; i++) {
4737 snd_hda_codec_write_cache(codec,
4738 spec->adc_nids[i], 0,
4739 AC_VERB_SET_POWER_STATE, pwr);
4743 static int stac92hd71xx_resume(struct hda_codec *codec)
4745 stac92hd71xx_set_power_state(codec, AC_PWRST_D0);
4746 return stac92xx_resume(codec);
4749 static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state)
4751 stac92hd71xx_set_power_state(codec, AC_PWRST_D3);
4752 return stac92xx_suspend(codec, state);
4757 static struct hda_codec_ops stac92hd71bxx_patch_ops = {
4758 .build_controls = stac92xx_build_controls,
4759 .build_pcms = stac92xx_build_pcms,
4760 .init = stac92xx_init,
4761 .free = stac92xx_free,
4762 .unsol_event = stac92xx_unsol_event,
4763 #ifdef SND_HDA_NEEDS_RESUME
4764 .suspend = stac92hd71xx_suspend,
4765 .resume = stac92hd71xx_resume,
4769 static struct hda_input_mux stac92hd71bxx_dmux = {
4772 { "Analog Inputs", 0x00 },
4774 { "Digital Mic 1", 0x02 },
4775 { "Digital Mic 2", 0x03 },
4779 static int patch_stac92hd71bxx(struct hda_codec *codec)
4781 struct sigmatel_spec *spec;
4784 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4789 codec->patch_ops = stac92xx_patch_ops;
4790 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
4791 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4792 spec->pin_nids = stac92hd71bxx_pin_nids;
4793 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux,
4794 sizeof(stac92hd71bxx_dmux));
4795 spec->board_config = snd_hda_check_board_config(codec,
4796 STAC_92HD71BXX_MODELS,
4797 stac92hd71bxx_models,
4798 stac92hd71bxx_cfg_tbl);
4800 if (spec->board_config < 0) {
4801 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4802 " STAC92HD71BXX, using BIOS defaults\n");
4803 err = stac92xx_save_bios_config_regs(codec);
4805 err = stac_save_pin_cfgs(codec,
4806 stac92hd71bxx_brd_tbl[spec->board_config]);
4808 stac92xx_free(codec);
4812 if (spec->board_config > STAC_92HD71BXX_REF) {
4814 spec->gpio_mask = 0x01;
4815 spec->gpio_dir = 0x01;
4816 spec->gpio_data = 0x01;
4819 switch (codec->vendor_id) {
4820 case 0x111d76b6: /* 4 Port without Analog Mixer */
4822 case 0x111d76b4: /* 6 Port without Analog Mixer */
4824 spec->mixer = stac92hd71bxx_mixer;
4825 spec->init = stac92hd71bxx_core_init;
4826 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4828 case 0x111d7608: /* 5 Port with Analog Mixer */
4829 switch (spec->board_config) {
4831 /* Enable VREF power saving on GPIO1 detect */
4832 err = stac_add_event(spec, codec->afg,
4833 STAC_VREF_EVENT, 0x02);
4836 snd_hda_codec_write_cache(codec, codec->afg, 0,
4837 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
4838 snd_hda_codec_write_cache(codec, codec->afg, 0,
4839 AC_VERB_SET_UNSOLICITED_ENABLE,
4841 spec->gpio_mask |= 0x02;
4844 if ((codec->revision_id & 0xf) == 0 ||
4845 (codec->revision_id & 0xf) == 1) {
4846 #ifdef SND_HDA_NEEDS_RESUME
4847 codec->patch_ops = stac92hd71bxx_patch_ops;
4849 spec->stream_delay = 40; /* 40 milliseconds */
4852 /* no output amps */
4854 spec->mixer = stac92hd71bxx_analog_mixer;
4855 spec->dinput_mux = &spec->private_dimux;
4858 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
4859 stac_change_pin_config(codec, 0xf, 0x40f000f0);
4861 case 0x111d7603: /* 6 Port with Analog Mixer */
4862 if ((codec->revision_id & 0xf) == 1) {
4863 #ifdef SND_HDA_NEEDS_RESUME
4864 codec->patch_ops = stac92hd71bxx_patch_ops;
4866 spec->stream_delay = 40; /* 40 milliseconds */
4869 /* no output amps */
4873 spec->dinput_mux = &spec->private_dimux;
4874 spec->mixer = stac92hd71bxx_analog_mixer;
4875 spec->init = stac92hd71bxx_analog_core_init;
4876 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4879 spec->aloopback_mask = 0x50;
4880 spec->aloopback_shift = 0;
4882 spec->powerdown_adcs = 1;
4883 spec->digbeep_nid = 0x26;
4884 spec->mux_nids = stac92hd71bxx_mux_nids;
4885 spec->adc_nids = stac92hd71bxx_adc_nids;
4886 spec->dmic_nids = stac92hd71bxx_dmic_nids;
4887 spec->dmux_nids = stac92hd71bxx_dmux_nids;
4888 spec->smux_nids = stac92hd71bxx_smux_nids;
4889 spec->pwr_nids = stac92hd71bxx_pwr_nids;
4891 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
4892 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
4894 switch (spec->board_config) {
4896 /* enable internal microphone */
4897 stac_change_pin_config(codec, 0x0e, 0x01813040);
4898 stac92xx_auto_set_pinctl(codec, 0x0e,
4899 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
4901 case STAC_DELL_M4_2:
4902 spec->num_dmics = 0;
4903 spec->num_smuxes = 0;
4904 spec->num_dmuxes = 0;
4906 case STAC_DELL_M4_1:
4907 case STAC_DELL_M4_3:
4908 spec->num_dmics = 1;
4909 spec->num_smuxes = 0;
4910 spec->num_dmuxes = 0;
4913 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
4914 spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids);
4915 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
4918 spec->multiout.num_dacs = 1;
4919 spec->multiout.hp_nid = 0x11;
4920 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
4921 if (spec->dinput_mux)
4922 spec->private_dimux.num_items +=
4924 (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1);
4926 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
4928 if (spec->board_config < 0) {
4929 printk(KERN_WARNING "hda_codec: No auto-config is "
4930 "available, default to model=ref\n");
4931 spec->board_config = STAC_92HD71BXX_REF;
4938 stac92xx_free(codec);
4942 codec->proc_widget_hook = stac92hd7x_proc_hook;
4947 static int patch_stac922x(struct hda_codec *codec)
4949 struct sigmatel_spec *spec;
4952 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4957 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
4958 spec->pin_nids = stac922x_pin_nids;
4959 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
4962 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
4963 spec->gpio_mask = spec->gpio_dir = 0x03;
4964 spec->gpio_data = 0x03;
4965 /* Intel Macs have all same PCI SSID, so we need to check
4966 * codec SSID to distinguish the exact models
4968 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
4969 switch (codec->subsystem_id) {
4972 spec->board_config = STAC_INTEL_MAC_V1;
4976 spec->board_config = STAC_INTEL_MAC_V2;
4984 spec->board_config = STAC_INTEL_MAC_V3;
4988 spec->board_config = STAC_INTEL_MAC_V4;
4992 spec->board_config = STAC_INTEL_MAC_V5;
4995 spec->board_config = STAC_INTEL_MAC_V3;
5001 if (spec->board_config < 0) {
5002 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
5003 "using BIOS defaults\n");
5004 err = stac92xx_save_bios_config_regs(codec);
5006 err = stac_save_pin_cfgs(codec,
5007 stac922x_brd_tbl[spec->board_config]);
5009 stac92xx_free(codec);
5013 spec->adc_nids = stac922x_adc_nids;
5014 spec->mux_nids = stac922x_mux_nids;
5015 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
5016 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
5017 spec->num_dmics = 0;
5020 spec->init = stac922x_core_init;
5021 spec->mixer = stac922x_mixer;
5023 spec->multiout.dac_nids = spec->dac_nids;
5025 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
5027 if (spec->board_config < 0) {
5028 printk(KERN_WARNING "hda_codec: No auto-config is "
5029 "available, default to model=ref\n");
5030 spec->board_config = STAC_D945_REF;
5036 stac92xx_free(codec);
5040 codec->patch_ops = stac92xx_patch_ops;
5042 /* Fix Mux capture level; max to 2 */
5043 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
5044 (0 << AC_AMPCAP_OFFSET_SHIFT) |
5045 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5046 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5047 (0 << AC_AMPCAP_MUTE_SHIFT));
5052 static int patch_stac927x(struct hda_codec *codec)
5054 struct sigmatel_spec *spec;
5057 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5062 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
5063 spec->pin_nids = stac927x_pin_nids;
5064 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
5068 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
5069 if (spec->board_config < 0)
5070 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
5071 "STAC927x, using BIOS defaults\n");
5072 err = stac92xx_save_bios_config_regs(codec);
5074 err = stac_save_pin_cfgs(codec,
5075 stac927x_brd_tbl[spec->board_config]);
5077 stac92xx_free(codec);
5081 spec->digbeep_nid = 0x23;
5082 spec->adc_nids = stac927x_adc_nids;
5083 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
5084 spec->mux_nids = stac927x_mux_nids;
5085 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
5086 spec->smux_nids = stac927x_smux_nids;
5087 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
5088 spec->spdif_labels = stac927x_spdif_labels;
5089 spec->dac_list = stac927x_dac_nids;
5090 spec->multiout.dac_nids = spec->dac_nids;
5092 switch (spec->board_config) {
5095 /* GPIO0 High = Enable EAPD */
5096 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
5097 spec->gpio_data = 0x01;
5098 spec->num_dmics = 0;
5100 spec->init = d965_core_init;
5101 spec->mixer = stac927x_mixer;
5103 case STAC_DELL_BIOS:
5104 switch (codec->subsystem_id) {
5107 /* correct the device field to SPDIF out */
5108 stac_change_pin_config(codec, 0x21, 0x01442070);
5111 /* configure the analog microphone on some laptops */
5112 stac_change_pin_config(codec, 0x0c, 0x90a79130);
5113 /* correct the front output jack as a hp out */
5114 stac_change_pin_config(codec, 0x0f, 0x0227011f);
5115 /* correct the front input jack as a mic */
5116 stac_change_pin_config(codec, 0x0e, 0x02a79130);
5119 /* GPIO2 High = Enable EAPD */
5120 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
5121 spec->gpio_data = 0x04;
5122 spec->dmic_nids = stac927x_dmic_nids;
5123 spec->num_dmics = STAC927X_NUM_DMICS;
5125 spec->init = d965_core_init;
5126 spec->mixer = stac927x_mixer;
5127 spec->dmux_nids = stac927x_dmux_nids;
5128 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5131 if (spec->board_config > STAC_D965_REF) {
5132 /* GPIO0 High = Enable EAPD */
5133 spec->eapd_mask = spec->gpio_mask = 0x01;
5134 spec->gpio_dir = spec->gpio_data = 0x01;
5136 spec->num_dmics = 0;
5138 spec->init = stac927x_core_init;
5139 spec->mixer = stac927x_mixer;
5143 spec->aloopback_mask = 0x40;
5144 spec->aloopback_shift = 0;
5145 spec->eapd_switch = 1;
5147 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
5149 if (spec->board_config < 0) {
5150 printk(KERN_WARNING "hda_codec: No auto-config is "
5151 "available, default to model=ref\n");
5152 spec->board_config = STAC_D965_REF;
5158 stac92xx_free(codec);
5162 codec->patch_ops = stac92xx_patch_ops;
5164 codec->proc_widget_hook = stac927x_proc_hook;
5168 * The STAC927x seem to require fairly long delays for certain
5169 * command sequences. With too short delays (even if the answer
5170 * is set to RIRB properly), it results in the silence output
5171 * on some hardwares like Dell.
5173 * The below flag enables the longer delay (see get_response
5176 codec->bus->needs_damn_long_delay = 1;
5181 static int patch_stac9205(struct hda_codec *codec)
5183 struct sigmatel_spec *spec;
5186 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5191 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5192 spec->pin_nids = stac9205_pin_nids;
5193 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
5197 if (spec->board_config < 0) {
5198 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
5199 err = stac92xx_save_bios_config_regs(codec);
5201 err = stac_save_pin_cfgs(codec,
5202 stac9205_brd_tbl[spec->board_config]);
5204 stac92xx_free(codec);
5208 spec->digbeep_nid = 0x23;
5209 spec->adc_nids = stac9205_adc_nids;
5210 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
5211 spec->mux_nids = stac9205_mux_nids;
5212 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
5213 spec->smux_nids = stac9205_smux_nids;
5214 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
5215 spec->dmic_nids = stac9205_dmic_nids;
5216 spec->num_dmics = STAC9205_NUM_DMICS;
5217 spec->dmux_nids = stac9205_dmux_nids;
5218 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
5221 spec->init = stac9205_core_init;
5222 spec->mixer = stac9205_mixer;
5224 spec->aloopback_mask = 0x40;
5225 spec->aloopback_shift = 0;
5226 spec->eapd_switch = 1;
5227 spec->multiout.dac_nids = spec->dac_nids;
5229 switch (spec->board_config){
5230 case STAC_9205_DELL_M43:
5231 /* Enable SPDIF in/out */
5232 stac_change_pin_config(codec, 0x1f, 0x01441030);
5233 stac_change_pin_config(codec, 0x20, 0x1c410030);
5235 /* Enable unsol response for GPIO4/Dock HP connection */
5236 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
5239 snd_hda_codec_write_cache(codec, codec->afg, 0,
5240 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
5241 snd_hda_codec_write_cache(codec, codec->afg, 0,
5242 AC_VERB_SET_UNSOLICITED_ENABLE,
5245 spec->gpio_dir = 0x0b;
5246 spec->eapd_mask = 0x01;
5247 spec->gpio_mask = 0x1b;
5248 spec->gpio_mute = 0x10;
5249 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
5252 spec->gpio_data = 0x01;
5255 /* SPDIF-In enabled */
5258 /* GPIO0 High = EAPD */
5259 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5260 spec->gpio_data = 0x01;
5264 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
5266 if (spec->board_config < 0) {
5267 printk(KERN_WARNING "hda_codec: No auto-config is "
5268 "available, default to model=ref\n");
5269 spec->board_config = STAC_9205_REF;
5275 stac92xx_free(codec);
5279 codec->patch_ops = stac92xx_patch_ops;
5281 codec->proc_widget_hook = stac9205_proc_hook;
5290 /* static config for Sony VAIO FE550G and Sony VAIO AR */
5291 static hda_nid_t vaio_dacs[] = { 0x2 };
5292 #define VAIO_HP_DAC 0x5
5293 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
5294 static hda_nid_t vaio_mux_nids[] = { 0x15 };
5296 static struct hda_input_mux vaio_mux = {
5299 /* { "HP", 0x0 }, */
5300 { "Mic Jack", 0x1 },
5301 { "Internal Mic", 0x2 },
5306 static struct hda_verb vaio_init[] = {
5307 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5308 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
5309 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5310 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5311 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5313 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5314 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5315 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5322 static struct hda_verb vaio_ar_init[] = {
5323 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5324 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5325 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5326 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5327 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
5328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5329 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5330 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5331 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5332 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
5333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5339 static struct snd_kcontrol_new vaio_mixer[] = {
5340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5343 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5344 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5345 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5346 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5348 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5349 .name = "Capture Source",
5351 .info = stac92xx_mux_enum_info,
5352 .get = stac92xx_mux_enum_get,
5353 .put = stac92xx_mux_enum_put,
5358 static struct snd_kcontrol_new vaio_ar_mixer[] = {
5359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5362 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5363 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5364 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5365 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5366 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
5367 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
5369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5370 .name = "Capture Source",
5372 .info = stac92xx_mux_enum_info,
5373 .get = stac92xx_mux_enum_get,
5374 .put = stac92xx_mux_enum_put,
5379 static struct hda_codec_ops stac9872_patch_ops = {
5380 .build_controls = stac92xx_build_controls,
5381 .build_pcms = stac92xx_build_pcms,
5382 .init = stac92xx_init,
5383 .free = stac92xx_free,
5384 #ifdef SND_HDA_NEEDS_RESUME
5385 .resume = stac92xx_resume,
5389 static int stac9872_vaio_init(struct hda_codec *codec)
5393 err = stac92xx_init(codec);
5396 if (codec->patch_ops.unsol_event)
5397 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
5401 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
5403 if (get_hp_pin_presence(codec, 0x0a)) {
5404 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5405 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5407 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5408 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5412 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
5414 switch (res >> 26) {
5416 stac9872_vaio_hp_detect(codec, res);
5421 static struct hda_codec_ops stac9872_vaio_patch_ops = {
5422 .build_controls = stac92xx_build_controls,
5423 .build_pcms = stac92xx_build_pcms,
5424 .init = stac9872_vaio_init,
5425 .free = stac92xx_free,
5426 .unsol_event = stac9872_vaio_unsol_event,
5428 .resume = stac92xx_resume,
5432 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
5434 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
5436 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
5438 /* AR Series. id=0x83847664 and subsys=104D1300 */
5443 static const char *stac9872_models[STAC_9872_MODELS] = {
5444 [CXD9872RD_VAIO] = "vaio",
5445 [CXD9872AKD_VAIO] = "vaio-ar",
5448 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5449 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
5450 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
5451 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
5452 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
5456 static int patch_stac9872(struct hda_codec *codec)
5458 struct sigmatel_spec *spec;
5461 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5464 if (board_config < 0)
5465 /* unknown config, let generic-parser do its job... */
5466 return snd_hda_parse_generic_codec(codec);
5468 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5473 switch (board_config) {
5474 case CXD9872RD_VAIO:
5475 case STAC9872AK_VAIO:
5476 case STAC9872K_VAIO:
5477 spec->mixer = vaio_mixer;
5478 spec->init = vaio_init;
5479 spec->multiout.max_channels = 2;
5480 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5481 spec->multiout.dac_nids = vaio_dacs;
5482 spec->multiout.hp_nid = VAIO_HP_DAC;
5483 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5484 spec->adc_nids = vaio_adcs;
5486 spec->input_mux = &vaio_mux;
5487 spec->mux_nids = vaio_mux_nids;
5488 codec->patch_ops = stac9872_vaio_patch_ops;
5491 case CXD9872AKD_VAIO:
5492 spec->mixer = vaio_ar_mixer;
5493 spec->init = vaio_ar_init;
5494 spec->multiout.max_channels = 2;
5495 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5496 spec->multiout.dac_nids = vaio_dacs;
5497 spec->multiout.hp_nid = VAIO_HP_DAC;
5498 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5500 spec->adc_nids = vaio_adcs;
5501 spec->input_mux = &vaio_mux;
5502 spec->mux_nids = vaio_mux_nids;
5503 codec->patch_ops = stac9872_patch_ops;
5514 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5515 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5516 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5517 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
5518 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
5519 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
5520 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
5521 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
5522 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
5523 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
5524 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
5525 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
5526 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
5527 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
5528 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
5529 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
5530 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
5531 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
5532 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
5533 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
5534 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
5535 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
5536 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
5537 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
5538 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
5539 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
5540 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
5541 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
5542 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
5543 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
5544 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
5545 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
5546 /* The following does not take into account .id=0x83847661 when subsys =
5547 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
5548 * currently not fully supported.
5550 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
5551 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
5552 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
5553 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
5554 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
5555 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
5556 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
5557 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
5558 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
5559 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
5560 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
5561 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
5562 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
5563 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
5564 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
5565 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
5566 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
5567 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
5568 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5569 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5570 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5571 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5572 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5573 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5574 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5575 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },