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"
111 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
112 * is given, one of the above models will be
113 * chosen according to the subsystem id. */
114 /* for backward compatibility */
138 struct sigmatel_event {
145 struct sigmatel_jack {
148 struct snd_jack *jack;
151 struct sigmatel_spec {
152 struct snd_kcontrol_new *mixers[4];
153 unsigned int num_mixers;
156 unsigned int eapd_switch: 1;
157 unsigned int surr_switch: 1;
158 unsigned int line_switch: 1;
159 unsigned int mic_switch: 1;
160 unsigned int alt_switch: 1;
161 unsigned int hp_detect: 1;
162 unsigned int spdif_mute: 1;
165 unsigned int eapd_mask;
166 unsigned int gpio_mask;
167 unsigned int gpio_dir;
168 unsigned int gpio_data;
169 unsigned int gpio_mute;
172 unsigned int stream_delay;
174 /* analog loopback */
175 unsigned char aloopback_mask;
176 unsigned char aloopback_shift;
178 /* power management */
179 unsigned int num_pwrs;
180 unsigned int *pwr_mapping;
185 struct snd_array jacks;
188 struct snd_array events;
191 struct hda_input_mux *mono_mux;
192 struct hda_input_mux *amp_mux;
193 unsigned int cur_mmux;
194 struct hda_multi_out multiout;
195 hda_nid_t dac_nids[5];
199 unsigned int num_adcs;
201 unsigned int num_muxes;
202 hda_nid_t *dmic_nids;
203 unsigned int num_dmics;
204 hda_nid_t *dmux_nids;
205 unsigned int num_dmuxes;
206 hda_nid_t *smux_nids;
207 unsigned int num_smuxes;
208 const char **spdif_labels;
210 hda_nid_t dig_in_nid;
212 hda_nid_t anabeep_nid;
213 hda_nid_t digbeep_nid;
217 unsigned int num_pins;
218 unsigned int *pin_configs;
220 /* codec specific stuff */
221 struct hda_verb *init;
222 struct snd_kcontrol_new *mixer;
225 struct hda_input_mux *dinput_mux;
226 unsigned int cur_dmux[2];
227 struct hda_input_mux *input_mux;
228 unsigned int cur_mux[3];
229 struct hda_input_mux *sinput_mux;
230 unsigned int cur_smux[2];
231 unsigned int cur_amux;
233 unsigned int num_amps;
234 unsigned int powerdown_adcs;
237 unsigned int io_switch[2];
238 unsigned int clfe_swap;
239 unsigned int hp_switch; /* NID of HP as line-out */
240 unsigned int aloopback;
242 struct hda_pcm pcm_rec[2]; /* PCM information */
244 /* dynamic controls and input_mux */
245 struct auto_pin_cfg autocfg;
246 struct snd_array kctls;
247 struct hda_input_mux private_dimux;
248 struct hda_input_mux private_imux;
249 struct hda_input_mux private_smux;
250 struct hda_input_mux private_amp_mux;
251 struct hda_input_mux private_mono_mux;
254 static hda_nid_t stac9200_adc_nids[1] = {
258 static hda_nid_t stac9200_mux_nids[1] = {
262 static hda_nid_t stac9200_dac_nids[1] = {
266 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
267 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
271 static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
275 static hda_nid_t stac92hd73xx_adc_nids[2] = {
279 #define DELL_M6_AMP 2
280 static hda_nid_t stac92hd73xx_amp_nids[3] = {
284 #define STAC92HD73XX_NUM_DMICS 2
285 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
289 #define STAC92HD73_DAC_COUNT 5
290 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
291 0x15, 0x16, 0x17, 0x18, 0x19,
294 static hda_nid_t stac92hd73xx_mux_nids[4] = {
295 0x28, 0x29, 0x2a, 0x2b,
298 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
302 static hda_nid_t stac92hd73xx_smux_nids[2] = {
306 #define STAC92HD83XXX_NUM_DMICS 2
307 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
311 #define STAC92HD81_DAC_COUNT 2
312 #define STAC92HD83_DAC_COUNT 3
313 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {
317 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
321 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
325 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
329 static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
333 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
334 0x03, 0x0c, 0x10, 0x40,
337 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
341 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
345 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
349 static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
353 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
357 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
361 #define STAC92HD71BXX_NUM_DMICS 2
362 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
366 static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
370 static hda_nid_t stac925x_adc_nids[1] = {
374 static hda_nid_t stac925x_mux_nids[1] = {
378 static hda_nid_t stac925x_dac_nids[1] = {
382 #define STAC925X_NUM_DMICS 1
383 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
387 static hda_nid_t stac925x_dmux_nids[1] = {
391 static hda_nid_t stac922x_adc_nids[2] = {
395 static hda_nid_t stac922x_mux_nids[2] = {
399 static hda_nid_t stac927x_adc_nids[3] = {
403 static hda_nid_t stac927x_mux_nids[3] = {
407 static hda_nid_t stac927x_smux_nids[1] = {
411 static hda_nid_t stac927x_dac_nids[6] = {
412 0x02, 0x03, 0x04, 0x05, 0x06, 0
415 static hda_nid_t stac927x_dmux_nids[1] = {
419 #define STAC927X_NUM_DMICS 2
420 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
424 static const char *stac927x_spdif_labels[5] = {
425 "Digital Playback", "ADAT", "Analog Mux 1",
426 "Analog Mux 2", "Analog Mux 3"
429 static hda_nid_t stac9205_adc_nids[2] = {
433 static hda_nid_t stac9205_mux_nids[2] = {
437 static hda_nid_t stac9205_dmux_nids[1] = {
441 static hda_nid_t stac9205_smux_nids[1] = {
445 #define STAC9205_NUM_DMICS 2
446 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
450 static hda_nid_t stac9200_pin_nids[8] = {
451 0x08, 0x09, 0x0d, 0x0e,
452 0x0f, 0x10, 0x11, 0x12,
455 static hda_nid_t stac925x_pin_nids[8] = {
456 0x07, 0x08, 0x0a, 0x0b,
457 0x0c, 0x0d, 0x10, 0x11,
460 static hda_nid_t stac922x_pin_nids[10] = {
461 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
462 0x0f, 0x10, 0x11, 0x15, 0x1b,
465 static hda_nid_t stac92hd73xx_pin_nids[13] = {
466 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
467 0x0f, 0x10, 0x11, 0x12, 0x13,
471 static hda_nid_t stac92hd83xxx_pin_nids[14] = {
472 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
473 0x0f, 0x10, 0x11, 0x12, 0x13,
474 0x1d, 0x1e, 0x1f, 0x20
476 static hda_nid_t stac92hd71bxx_pin_nids[11] = {
477 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
478 0x0f, 0x14, 0x18, 0x19, 0x1e,
482 static hda_nid_t stac927x_pin_nids[14] = {
483 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
484 0x0f, 0x10, 0x11, 0x12, 0x13,
485 0x14, 0x21, 0x22, 0x23,
488 static hda_nid_t stac9205_pin_nids[12] = {
489 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
490 0x0f, 0x14, 0x16, 0x17, 0x18,
494 #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
496 static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_value *ucontrol)
499 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
500 struct sigmatel_spec *spec = codec->spec;
501 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
503 kcontrol->private_value ^= get_amp_nid(kcontrol);
504 kcontrol->private_value |= nid;
506 return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
509 static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
510 struct snd_ctl_elem_value *ucontrol)
512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
513 struct sigmatel_spec *spec = codec->spec;
514 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
516 kcontrol->private_value ^= get_amp_nid(kcontrol);
517 kcontrol->private_value |= nid;
519 return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
522 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
523 struct snd_ctl_elem_info *uinfo)
525 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
526 struct sigmatel_spec *spec = codec->spec;
527 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
530 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_value *ucontrol)
533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
534 struct sigmatel_spec *spec = codec->spec;
535 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
537 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
541 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_value *ucontrol)
544 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
545 struct sigmatel_spec *spec = codec->spec;
546 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
548 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
549 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
552 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_info *uinfo)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 struct sigmatel_spec *spec = codec->spec;
557 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
560 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
561 struct snd_ctl_elem_value *ucontrol)
563 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
564 struct sigmatel_spec *spec = codec->spec;
565 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
567 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
571 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
572 struct snd_ctl_elem_value *ucontrol)
574 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
575 struct sigmatel_spec *spec = codec->spec;
576 struct hda_input_mux *smux = &spec->private_smux;
577 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
581 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
582 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
586 if (spec->spdif_mute) {
588 nid = spec->multiout.dig_out_nid;
590 nid = codec->slave_dig_outs[smux_idx - 1];
591 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
595 /* un/mute SPDIF out */
596 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
602 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
605 struct sigmatel_spec *spec = codec->spec;
606 return snd_hda_input_mux_info(spec->input_mux, uinfo);
609 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
612 struct sigmatel_spec *spec = codec->spec;
613 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
615 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
619 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
621 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
622 struct sigmatel_spec *spec = codec->spec;
623 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
625 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
626 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
629 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
630 struct snd_ctl_elem_info *uinfo)
632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
633 struct sigmatel_spec *spec = codec->spec;
634 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
637 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
638 struct snd_ctl_elem_value *ucontrol)
640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
641 struct sigmatel_spec *spec = codec->spec;
643 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
647 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
648 struct snd_ctl_elem_value *ucontrol)
650 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
651 struct sigmatel_spec *spec = codec->spec;
653 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
654 spec->mono_nid, &spec->cur_mmux);
657 static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
658 struct snd_ctl_elem_info *uinfo)
660 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
661 struct sigmatel_spec *spec = codec->spec;
662 return snd_hda_input_mux_info(spec->amp_mux, uinfo);
665 static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
666 struct snd_ctl_elem_value *ucontrol)
668 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
669 struct sigmatel_spec *spec = codec->spec;
671 ucontrol->value.enumerated.item[0] = spec->cur_amux;
675 static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
676 struct snd_ctl_elem_value *ucontrol)
678 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
679 struct sigmatel_spec *spec = codec->spec;
680 struct snd_kcontrol *ctl =
681 snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
685 snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
686 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
688 return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
692 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
694 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
695 struct snd_ctl_elem_value *ucontrol)
697 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
698 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
699 struct sigmatel_spec *spec = codec->spec;
701 ucontrol->value.integer.value[0] = !!(spec->aloopback &
702 (spec->aloopback_mask << idx));
706 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
710 struct sigmatel_spec *spec = codec->spec;
711 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
712 unsigned int dac_mode;
713 unsigned int val, idx_val;
715 idx_val = spec->aloopback_mask << idx;
716 if (ucontrol->value.integer.value[0])
717 val = spec->aloopback | idx_val;
719 val = spec->aloopback & ~idx_val;
720 if (spec->aloopback == val)
723 spec->aloopback = val;
725 /* Only return the bits defined by the shift value of the
726 * first two bytes of the mask
728 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
729 kcontrol->private_value & 0xFFFF, 0x0);
730 dac_mode >>= spec->aloopback_shift;
732 if (spec->aloopback & idx_val) {
733 snd_hda_power_up(codec);
736 snd_hda_power_down(codec);
737 dac_mode &= ~idx_val;
740 snd_hda_codec_write_cache(codec, codec->afg, 0,
741 kcontrol->private_value >> 16, dac_mode);
746 static struct hda_verb stac9200_core_init[] = {
747 /* set dac0mux for dac converter */
748 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
752 static struct hda_verb stac9200_eapd_init[] = {
753 /* set dac0mux for dac converter */
754 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
755 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
759 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
760 /* set master volume and direct control */
761 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
762 /* setup audio connections */
763 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
764 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
765 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
766 /* setup adcs to point to mixer */
767 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
768 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
769 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
770 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
771 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
772 /* setup import muxs */
773 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
774 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
775 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
776 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
780 static struct hda_verb dell_eq_core_init[] = {
781 /* set master volume to max value without distortion
782 * and direct control */
783 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
784 /* setup audio connections */
785 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
786 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02},
787 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},
788 /* setup adcs to point to mixer */
789 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
790 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
791 /* setup import muxs */
792 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
793 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
794 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
795 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
799 static struct hda_verb dell_m6_core_init[] = {
800 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
801 /* setup audio connections */
802 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
803 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
804 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
805 /* setup adcs to point to mixer */
806 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
807 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
808 /* setup import muxs */
809 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
810 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
811 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
812 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
816 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
817 /* set master volume and direct control */
818 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
819 /* setup audio connections */
820 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
821 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
822 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
823 /* connect hp ports to dac3 */
824 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
825 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
826 /* setup adcs to point to mixer */
827 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
828 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
829 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
830 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
831 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
832 /* setup import muxs */
833 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
834 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
835 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
836 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
840 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
841 /* set master volume and direct control */
842 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
843 /* setup audio connections */
844 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
845 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
846 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
847 /* dac3 is connected to import3 mux */
848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
849 /* connect hp ports to dac4 */
850 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
851 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
852 /* setup adcs to point to mixer */
853 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
854 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
855 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
856 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
857 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
858 /* setup import muxs */
859 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
860 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
861 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
862 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
866 static struct hda_verb stac92hd83xxx_core_init[] = {
867 /* start of config #1 */
868 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
870 /* start of config #2 */
871 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
872 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
873 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
875 /* power state controls amps */
876 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
879 static struct hda_verb stac92hd71bxx_core_init[] = {
880 /* set master volume and direct control */
881 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
882 /* connect headphone jack to dac1 */
883 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
884 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
885 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
886 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
887 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
890 #define HD_DISABLE_PORTF 2
891 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
892 /* start of config #1 */
894 /* connect port 0f to audio mixer */
895 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
896 /* unmute right and left channels for node 0x0f */
897 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
898 /* start of config #2 */
900 /* set master volume and direct control */
901 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
902 /* connect headphone jack to dac1 */
903 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
904 /* unmute right and left channels for nodes 0x0a, 0xd */
905 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
906 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
910 static struct hda_verb stac925x_core_init[] = {
911 /* set dac0mux for dac converter */
912 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
916 static struct hda_verb stac922x_core_init[] = {
917 /* set master volume and direct control */
918 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
922 static struct hda_verb d965_core_init[] = {
923 /* set master volume and direct control */
924 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
925 /* unmute node 0x1b */
926 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
927 /* select node 0x03 as DAC */
928 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
932 static struct hda_verb stac927x_core_init[] = {
933 /* set master volume and direct control */
934 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
935 /* enable analog pc beep path */
936 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
940 static struct hda_verb stac9205_core_init[] = {
941 /* set master volume and direct control */
942 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
943 /* enable analog pc beep path */
944 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
948 #define STAC_MONO_MUX \
950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
951 .name = "Mono Mux", \
953 .info = stac92xx_mono_mux_enum_info, \
954 .get = stac92xx_mono_mux_enum_get, \
955 .put = stac92xx_mono_mux_enum_put, \
958 #define STAC_AMP_MUX \
960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
961 .name = "Amp Selector Capture Switch", \
963 .info = stac92xx_amp_mux_enum_info, \
964 .get = stac92xx_amp_mux_enum_get, \
965 .put = stac92xx_amp_mux_enum_put, \
968 #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
973 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
974 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
975 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
976 .info = stac92xx_amp_volume_info, \
977 .get = stac92xx_amp_volume_get, \
978 .put = stac92xx_amp_volume_put, \
979 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
980 .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
983 #define STAC_INPUT_SOURCE(cnt) \
985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
986 .name = "Input Source", \
988 .info = stac92xx_mux_enum_info, \
989 .get = stac92xx_mux_enum_get, \
990 .put = stac92xx_mux_enum_put, \
993 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
996 .name = "Analog Loopback", \
998 .info = stac92xx_aloopback_info, \
999 .get = stac92xx_aloopback_get, \
1000 .put = stac92xx_aloopback_put, \
1001 .private_value = verb_read | (verb_write << 16), \
1004 static struct snd_kcontrol_new stac9200_mixer[] = {
1005 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
1006 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1007 STAC_INPUT_SOURCE(1),
1008 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1009 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1013 #define DELL_M6_MIXER 6
1014 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1015 /* start of config #1 */
1016 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1017 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1019 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1020 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1022 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1023 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1025 /* start of config #2 */
1026 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1027 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1029 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1030 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1032 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1034 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1035 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1037 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1038 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1043 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1044 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1046 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1047 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1049 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1050 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1052 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1053 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1055 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1056 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1058 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1059 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1061 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1062 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1064 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1065 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1069 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1070 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1072 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1073 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1075 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1076 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1078 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1079 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1081 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1082 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1084 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1085 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1087 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1088 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1090 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1091 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1096 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1097 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
1098 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
1100 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
1101 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
1103 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT),
1104 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT),
1106 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT),
1107 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT),
1109 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT),
1110 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT),
1112 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT),
1113 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT),
1116 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
1117 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
1122 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
1123 STAC_INPUT_SOURCE(2),
1124 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1126 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1127 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1129 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1130 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1131 /* analog pc-beep replaced with digital beep support */
1133 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
1134 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
1137 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT),
1138 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT),
1140 HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT),
1141 HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT),
1143 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT),
1144 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT),
1146 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT),
1147 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT),
1151 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1152 STAC_INPUT_SOURCE(2),
1153 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
1155 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1156 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1158 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1159 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1163 static struct snd_kcontrol_new stac925x_mixer[] = {
1164 STAC_INPUT_SOURCE(1),
1165 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
1166 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
1170 static struct snd_kcontrol_new stac9205_mixer[] = {
1171 STAC_INPUT_SOURCE(2),
1172 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1174 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1175 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1177 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1178 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1182 /* This needs to be generated dynamically based on sequence */
1183 static struct snd_kcontrol_new stac922x_mixer[] = {
1184 STAC_INPUT_SOURCE(2),
1185 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1186 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1188 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1189 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1194 static struct snd_kcontrol_new stac927x_mixer[] = {
1195 STAC_INPUT_SOURCE(3),
1196 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1198 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1199 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1201 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1202 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1204 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1205 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1209 static struct snd_kcontrol_new stac_dmux_mixer = {
1210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1211 .name = "Digital Input Source",
1212 /* count set later */
1213 .info = stac92xx_dmux_enum_info,
1214 .get = stac92xx_dmux_enum_get,
1215 .put = stac92xx_dmux_enum_put,
1218 static struct snd_kcontrol_new stac_smux_mixer = {
1219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1220 .name = "IEC958 Playback Source",
1221 /* count set later */
1222 .info = stac92xx_smux_enum_info,
1223 .get = stac92xx_smux_enum_get,
1224 .put = stac92xx_smux_enum_put,
1227 static const char *slave_vols[] = {
1228 "Front Playback Volume",
1229 "Surround Playback Volume",
1230 "Center Playback Volume",
1231 "LFE Playback Volume",
1232 "Side Playback Volume",
1233 "Headphone Playback Volume",
1234 "Headphone Playback Volume",
1235 "Speaker Playback Volume",
1236 "External Speaker Playback Volume",
1237 "Speaker2 Playback Volume",
1241 static const char *slave_sws[] = {
1242 "Front Playback Switch",
1243 "Surround Playback Switch",
1244 "Center Playback Switch",
1245 "LFE Playback Switch",
1246 "Side Playback Switch",
1247 "Headphone Playback Switch",
1248 "Headphone Playback Switch",
1249 "Speaker Playback Switch",
1250 "External Speaker Playback Switch",
1251 "Speaker2 Playback Switch",
1252 "IEC958 Playback Switch",
1256 static void stac92xx_free_kctls(struct hda_codec *codec);
1257 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1259 static int stac92xx_build_controls(struct hda_codec *codec)
1261 struct sigmatel_spec *spec = codec->spec;
1262 struct auto_pin_cfg *cfg = &spec->autocfg;
1267 err = snd_hda_add_new_ctls(codec, spec->mixer);
1271 for (i = 0; i < spec->num_mixers; i++) {
1272 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1276 if (spec->num_dmuxes > 0) {
1277 stac_dmux_mixer.count = spec->num_dmuxes;
1278 err = snd_hda_ctl_add(codec,
1279 snd_ctl_new1(&stac_dmux_mixer, codec));
1283 if (spec->num_smuxes > 0) {
1284 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1285 struct hda_input_mux *smux = &spec->private_smux;
1286 /* check for mute support on SPDIF out */
1287 if (wcaps & AC_WCAP_OUT_AMP) {
1288 smux->items[smux->num_items].label = "Off";
1289 smux->items[smux->num_items].index = 0;
1291 spec->spdif_mute = 1;
1293 stac_smux_mixer.count = spec->num_smuxes;
1294 err = snd_ctl_add(codec->bus->card,
1295 snd_ctl_new1(&stac_smux_mixer, codec));
1300 if (spec->multiout.dig_out_nid) {
1301 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1304 err = snd_hda_create_spdif_share_sw(codec,
1308 spec->multiout.share_spdif = 1;
1310 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1311 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1316 /* if we have no master control, let's create it */
1317 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1318 unsigned int vmaster_tlv[4];
1319 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1320 HDA_OUTPUT, vmaster_tlv);
1321 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1322 vmaster_tlv, slave_vols);
1326 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1327 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1333 stac92xx_free_kctls(codec); /* no longer needed */
1335 /* create jack input elements */
1336 if (spec->hp_detect) {
1337 for (i = 0; i < cfg->hp_outs; i++) {
1338 int type = SND_JACK_HEADPHONE;
1339 nid = cfg->hp_pins[i];
1340 /* jack detection */
1341 if (cfg->hp_outs == i)
1342 type |= SND_JACK_LINEOUT;
1343 err = stac92xx_add_jack(codec, nid, type);
1348 for (i = 0; i < cfg->line_outs; i++) {
1349 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1354 for (i = 0; i < AUTO_PIN_LAST; i++) {
1355 nid = cfg->input_pins[i];
1357 err = stac92xx_add_jack(codec, nid,
1358 SND_JACK_MICROPHONE);
1367 static unsigned int ref9200_pin_configs[8] = {
1368 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1369 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1373 STAC 9200 pin configs for
1378 static unsigned int dell9200_d21_pin_configs[8] = {
1379 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1380 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1384 STAC 9200 pin configs for
1388 static unsigned int dell9200_d22_pin_configs[8] = {
1389 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1390 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1394 STAC 9200 pin configs for
1395 102801C4 (Dell Dimension E310)
1402 static unsigned int dell9200_d23_pin_configs[8] = {
1403 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1404 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1409 STAC 9200-32 pin configs for
1410 102801B5 (Dell Inspiron 630m)
1411 102801D8 (Dell Inspiron 640m)
1413 static unsigned int dell9200_m21_pin_configs[8] = {
1414 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1415 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1419 STAC 9200-32 pin configs for
1420 102801C2 (Dell Latitude D620)
1422 102801CC (Dell Latitude D820)
1426 static unsigned int dell9200_m22_pin_configs[8] = {
1427 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1428 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1432 STAC 9200-32 pin configs for
1433 102801CE (Dell XPS M1710)
1434 102801CF (Dell Precision M90)
1436 static unsigned int dell9200_m23_pin_configs[8] = {
1437 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1438 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1442 STAC 9200-32 pin configs for
1445 102801CB (Dell Latitude 120L)
1448 static unsigned int dell9200_m24_pin_configs[8] = {
1449 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1450 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1454 STAC 9200-32 pin configs for
1455 102801BD (Dell Inspiron E1505n)
1459 static unsigned int dell9200_m25_pin_configs[8] = {
1460 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1461 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1465 STAC 9200-32 pin configs for
1466 102801F5 (Dell Inspiron 1501)
1469 static unsigned int dell9200_m26_pin_configs[8] = {
1470 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1471 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1476 102801CD (Dell Inspiron E1705/9400)
1478 static unsigned int dell9200_m27_pin_configs[8] = {
1479 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1480 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1483 static unsigned int oqo9200_pin_configs[8] = {
1484 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1485 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1489 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1490 [STAC_REF] = ref9200_pin_configs,
1491 [STAC_9200_OQO] = oqo9200_pin_configs,
1492 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1493 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1494 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1495 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1496 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1497 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1498 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1499 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1500 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1501 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1502 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1505 static const char *stac9200_models[STAC_9200_MODELS] = {
1507 [STAC_9200_OQO] = "oqo",
1508 [STAC_9200_DELL_D21] = "dell-d21",
1509 [STAC_9200_DELL_D22] = "dell-d22",
1510 [STAC_9200_DELL_D23] = "dell-d23",
1511 [STAC_9200_DELL_M21] = "dell-m21",
1512 [STAC_9200_DELL_M22] = "dell-m22",
1513 [STAC_9200_DELL_M23] = "dell-m23",
1514 [STAC_9200_DELL_M24] = "dell-m24",
1515 [STAC_9200_DELL_M25] = "dell-m25",
1516 [STAC_9200_DELL_M26] = "dell-m26",
1517 [STAC_9200_DELL_M27] = "dell-m27",
1518 [STAC_9200_GATEWAY] = "gateway",
1519 [STAC_9200_PANASONIC] = "panasonic",
1522 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1523 /* SigmaTel reference board */
1524 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1525 "DFI LanParty", STAC_REF),
1526 /* Dell laptops have BIOS problem */
1527 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1528 "unknown Dell", STAC_9200_DELL_D21),
1529 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1530 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1531 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1532 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1533 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1534 "unknown Dell", STAC_9200_DELL_D22),
1535 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1536 "unknown Dell", STAC_9200_DELL_D22),
1537 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1538 "Dell Latitude D620", STAC_9200_DELL_M22),
1539 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1540 "unknown Dell", STAC_9200_DELL_D23),
1541 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1542 "unknown Dell", STAC_9200_DELL_D23),
1543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1544 "unknown Dell", STAC_9200_DELL_M22),
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1546 "unknown Dell", STAC_9200_DELL_M24),
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1548 "unknown Dell", STAC_9200_DELL_M24),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1550 "Dell Latitude 120L", STAC_9200_DELL_M24),
1551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1552 "Dell Latitude D820", STAC_9200_DELL_M22),
1553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1554 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1556 "Dell XPS M1710", STAC_9200_DELL_M23),
1557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1558 "Dell Precision M90", STAC_9200_DELL_M23),
1559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1560 "unknown Dell", STAC_9200_DELL_M22),
1561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1562 "unknown Dell", STAC_9200_DELL_M22),
1563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1564 "unknown Dell", STAC_9200_DELL_M22),
1565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1566 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1567 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1568 "unknown Dell", STAC_9200_DELL_D23),
1569 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1570 "unknown Dell", STAC_9200_DELL_D23),
1571 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1572 "unknown Dell", STAC_9200_DELL_D21),
1573 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1574 "unknown Dell", STAC_9200_DELL_D23),
1575 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1576 "unknown Dell", STAC_9200_DELL_D21),
1577 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1578 "unknown Dell", STAC_9200_DELL_M25),
1579 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1580 "unknown Dell", STAC_9200_DELL_M25),
1581 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1582 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1583 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1584 "unknown Dell", STAC_9200_DELL_M26),
1586 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1587 /* Gateway machines needs EAPD to be set on resume */
1588 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1589 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1591 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1594 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1598 static unsigned int ref925x_pin_configs[8] = {
1599 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1600 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1603 static unsigned int stac925x_MA6_pin_configs[8] = {
1604 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1605 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1608 static unsigned int stac925x_PA6_pin_configs[8] = {
1609 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1610 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1613 static unsigned int stac925xM2_2_pin_configs[8] = {
1614 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1615 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1618 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1619 [STAC_REF] = ref925x_pin_configs,
1620 [STAC_M2_2] = stac925xM2_2_pin_configs,
1621 [STAC_MA6] = stac925x_MA6_pin_configs,
1622 [STAC_PA6] = stac925x_PA6_pin_configs,
1625 static const char *stac925x_models[STAC_925x_MODELS] = {
1627 [STAC_M2_2] = "m2-2",
1632 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1633 /* SigmaTel reference board */
1634 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1635 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1636 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1637 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1638 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1639 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1640 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1644 static unsigned int ref92hd73xx_pin_configs[13] = {
1645 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1646 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1647 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1651 static unsigned int dell_m6_pin_configs[13] = {
1652 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1653 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1654 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1658 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1659 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1660 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1661 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1662 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1663 [STAC_DELL_EQ] = dell_m6_pin_configs,
1666 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1667 [STAC_92HD73XX_REF] = "ref",
1668 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1669 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1670 [STAC_DELL_M6_BOTH] = "dell-m6",
1671 [STAC_DELL_EQ] = "dell-eq",
1674 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1675 /* SigmaTel reference board */
1676 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1677 "DFI LanParty", STAC_92HD73XX_REF),
1678 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1679 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1680 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1681 "unknown Dell", STAC_DELL_M6_DMIC),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1683 "unknown Dell", STAC_DELL_M6_BOTH),
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1685 "unknown Dell", STAC_DELL_M6_BOTH),
1686 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1687 "unknown Dell", STAC_DELL_M6_AMIC),
1688 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1689 "unknown Dell", STAC_DELL_M6_AMIC),
1690 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1691 "unknown Dell", STAC_DELL_M6_DMIC),
1692 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1693 "unknown Dell", STAC_DELL_M6_DMIC),
1694 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1695 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1699 static unsigned int ref92hd83xxx_pin_configs[14] = {
1700 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1701 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1702 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1703 0x01451160, 0x98560170,
1706 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1707 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1710 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1711 [STAC_92HD83XXX_REF] = "ref",
1714 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1715 /* SigmaTel reference board */
1716 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1717 "DFI LanParty", STAC_92HD71BXX_REF),
1720 static unsigned int ref92hd71bxx_pin_configs[11] = {
1721 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1722 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1723 0x90a000f0, 0x01452050, 0x01452050,
1726 static unsigned int dell_m4_1_pin_configs[11] = {
1727 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1728 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1729 0x40f000f0, 0x4f0000f0, 0x4f0000f0,
1732 static unsigned int dell_m4_2_pin_configs[11] = {
1733 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1734 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1735 0x40f000f0, 0x044413b0, 0x044413b0,
1738 static unsigned int dell_m4_3_pin_configs[11] = {
1739 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1740 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1741 0x40f000f0, 0x044413b0, 0x044413b0,
1744 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1745 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1746 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1747 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1748 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1749 [STAC_HP_M4] = NULL,
1752 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1753 [STAC_92HD71BXX_REF] = "ref",
1754 [STAC_DELL_M4_1] = "dell-m4-1",
1755 [STAC_DELL_M4_2] = "dell-m4-2",
1756 [STAC_DELL_M4_3] = "dell-m4-3",
1757 [STAC_HP_M4] = "hp-m4",
1760 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1761 /* SigmaTel reference board */
1762 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1763 "DFI LanParty", STAC_92HD71BXX_REF),
1764 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
1765 "HP dv5", STAC_HP_M4),
1766 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
1767 "HP dv7", STAC_HP_M4),
1768 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1769 "unknown HP", STAC_HP_M4),
1770 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1771 "unknown Dell", STAC_DELL_M4_1),
1772 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1773 "unknown Dell", STAC_DELL_M4_1),
1774 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1775 "unknown Dell", STAC_DELL_M4_1),
1776 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1777 "unknown Dell", STAC_DELL_M4_1),
1778 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1779 "unknown Dell", STAC_DELL_M4_1),
1780 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1781 "unknown Dell", STAC_DELL_M4_1),
1782 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1783 "unknown Dell", STAC_DELL_M4_1),
1784 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1785 "unknown Dell", STAC_DELL_M4_2),
1786 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1787 "unknown Dell", STAC_DELL_M4_2),
1788 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1789 "unknown Dell", STAC_DELL_M4_2),
1790 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1791 "unknown Dell", STAC_DELL_M4_2),
1792 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1793 "unknown Dell", STAC_DELL_M4_3),
1797 static unsigned int ref922x_pin_configs[10] = {
1798 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1799 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1800 0x40000100, 0x40000100,
1804 STAC 922X pin configs for
1811 static unsigned int dell_922x_d81_pin_configs[10] = {
1812 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1813 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1814 0x01813122, 0x400001f2,
1818 STAC 922X pin configs for
1822 static unsigned int dell_922x_d82_pin_configs[10] = {
1823 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1824 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1825 0x01813122, 0x400001f1,
1829 STAC 922X pin configs for
1832 static unsigned int dell_922x_m81_pin_configs[10] = {
1833 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1834 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1835 0x40C003f1, 0x405003f0,
1839 STAC 9221 A1 pin configs for
1840 102801D7 (Dell XPS M1210)
1842 static unsigned int dell_922x_m82_pin_configs[10] = {
1843 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1844 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1845 0x508003f3, 0x405003f4,
1848 static unsigned int d945gtp3_pin_configs[10] = {
1849 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1850 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1851 0x02a19120, 0x40000100,
1854 static unsigned int d945gtp5_pin_configs[10] = {
1855 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1856 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1857 0x02a19320, 0x40000100,
1860 static unsigned int intel_mac_v1_pin_configs[10] = {
1861 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1862 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1863 0x400000fc, 0x400000fb,
1866 static unsigned int intel_mac_v2_pin_configs[10] = {
1867 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1868 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1869 0x400000fc, 0x400000fb,
1872 static unsigned int intel_mac_v3_pin_configs[10] = {
1873 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1874 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1875 0x400000fc, 0x400000fb,
1878 static unsigned int intel_mac_v4_pin_configs[10] = {
1879 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1880 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1881 0x400000fc, 0x400000fb,
1884 static unsigned int intel_mac_v5_pin_configs[10] = {
1885 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1886 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1887 0x400000fc, 0x400000fb,
1890 static unsigned int ecs202_pin_configs[10] = {
1891 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1892 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1893 0x9037012e, 0x40e000f2,
1896 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1897 [STAC_D945_REF] = ref922x_pin_configs,
1898 [STAC_D945GTP3] = d945gtp3_pin_configs,
1899 [STAC_D945GTP5] = d945gtp5_pin_configs,
1900 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1901 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1902 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1903 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1904 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1905 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1906 /* for backward compatibility */
1907 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1908 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1909 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1910 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1911 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1912 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1913 [STAC_ECS_202] = ecs202_pin_configs,
1914 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1915 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1916 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1917 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1920 static const char *stac922x_models[STAC_922X_MODELS] = {
1921 [STAC_D945_REF] = "ref",
1922 [STAC_D945GTP5] = "5stack",
1923 [STAC_D945GTP3] = "3stack",
1924 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1925 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1926 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1927 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1928 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1929 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1930 /* for backward compatibility */
1931 [STAC_MACMINI] = "macmini",
1932 [STAC_MACBOOK] = "macbook",
1933 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1934 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1935 [STAC_IMAC_INTEL] = "imac-intel",
1936 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1937 [STAC_ECS_202] = "ecs202",
1938 [STAC_922X_DELL_D81] = "dell-d81",
1939 [STAC_922X_DELL_D82] = "dell-d82",
1940 [STAC_922X_DELL_M81] = "dell-m81",
1941 [STAC_922X_DELL_M82] = "dell-m82",
1944 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1945 /* SigmaTel reference board */
1946 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1947 "DFI LanParty", STAC_D945_REF),
1948 /* Intel 945G based systems */
1949 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1950 "Intel D945G", STAC_D945GTP3),
1951 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1952 "Intel D945G", STAC_D945GTP3),
1953 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1954 "Intel D945G", STAC_D945GTP3),
1955 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1956 "Intel D945G", STAC_D945GTP3),
1957 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1958 "Intel D945G", STAC_D945GTP3),
1959 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1960 "Intel D945G", STAC_D945GTP3),
1961 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1962 "Intel D945G", STAC_D945GTP3),
1963 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1964 "Intel D945G", STAC_D945GTP3),
1965 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1966 "Intel D945G", STAC_D945GTP3),
1967 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1968 "Intel D945G", STAC_D945GTP3),
1969 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1970 "Intel D945G", STAC_D945GTP3),
1971 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1972 "Intel D945G", STAC_D945GTP3),
1973 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1974 "Intel D945G", STAC_D945GTP3),
1975 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1976 "Intel D945G", STAC_D945GTP3),
1977 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1978 "Intel D945G", STAC_D945GTP3),
1979 /* Intel D945G 5-stack systems */
1980 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1981 "Intel D945G", STAC_D945GTP5),
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1983 "Intel D945G", STAC_D945GTP5),
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1985 "Intel D945G", STAC_D945GTP5),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1987 "Intel D945G", STAC_D945GTP5),
1988 /* Intel 945P based systems */
1989 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1990 "Intel D945P", STAC_D945GTP3),
1991 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1992 "Intel D945P", STAC_D945GTP3),
1993 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1994 "Intel D945P", STAC_D945GTP3),
1995 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1996 "Intel D945P", STAC_D945GTP3),
1997 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1998 "Intel D945P", STAC_D945GTP3),
1999 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2000 "Intel D945P", STAC_D945GTP5),
2002 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2003 SND_PCI_QUIRK(0x8384, 0x7680,
2004 "Mac", STAC_INTEL_MAC_AUTO),
2006 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2007 "unknown Dell", STAC_922X_DELL_D81),
2008 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2009 "unknown Dell", STAC_922X_DELL_D81),
2010 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2011 "unknown Dell", STAC_922X_DELL_D81),
2012 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2013 "unknown Dell", STAC_922X_DELL_D82),
2014 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2015 "unknown Dell", STAC_922X_DELL_M81),
2016 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2017 "unknown Dell", STAC_922X_DELL_D82),
2018 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2019 "unknown Dell", STAC_922X_DELL_D81),
2020 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2021 "unknown Dell", STAC_922X_DELL_D81),
2022 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2023 "Dell XPS M1210", STAC_922X_DELL_M82),
2024 /* ECS/PC Chips boards */
2025 SND_PCI_QUIRK(0x1019, 0x2144,
2026 "ECS/PC chips", STAC_ECS_202),
2027 SND_PCI_QUIRK(0x1019, 0x2608,
2028 "ECS/PC chips", STAC_ECS_202),
2029 SND_PCI_QUIRK(0x1019, 0x2633,
2030 "ECS/PC chips P17G/1333", STAC_ECS_202),
2031 SND_PCI_QUIRK(0x1019, 0x2811,
2032 "ECS/PC chips", STAC_ECS_202),
2033 SND_PCI_QUIRK(0x1019, 0x2812,
2034 "ECS/PC chips", STAC_ECS_202),
2035 SND_PCI_QUIRK(0x1019, 0x2813,
2036 "ECS/PC chips", STAC_ECS_202),
2037 SND_PCI_QUIRK(0x1019, 0x2814,
2038 "ECS/PC chips", STAC_ECS_202),
2039 SND_PCI_QUIRK(0x1019, 0x2815,
2040 "ECS/PC chips", STAC_ECS_202),
2041 SND_PCI_QUIRK(0x1019, 0x2816,
2042 "ECS/PC chips", STAC_ECS_202),
2043 SND_PCI_QUIRK(0x1019, 0x2817,
2044 "ECS/PC chips", STAC_ECS_202),
2045 SND_PCI_QUIRK(0x1019, 0x2818,
2046 "ECS/PC chips", STAC_ECS_202),
2047 SND_PCI_QUIRK(0x1019, 0x2819,
2048 "ECS/PC chips", STAC_ECS_202),
2049 SND_PCI_QUIRK(0x1019, 0x2820,
2050 "ECS/PC chips", STAC_ECS_202),
2054 static unsigned int ref927x_pin_configs[14] = {
2055 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2056 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2057 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2058 0x01c42190, 0x40000100,
2061 static unsigned int d965_3st_pin_configs[14] = {
2062 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2063 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2064 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2065 0x40000100, 0x40000100
2068 static unsigned int d965_5st_pin_configs[14] = {
2069 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2070 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2071 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2072 0x40000100, 0x40000100
2075 static unsigned int dell_3st_pin_configs[14] = {
2076 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2077 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2078 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2079 0x40c003fc, 0x40000100
2082 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2083 [STAC_D965_REF] = ref927x_pin_configs,
2084 [STAC_D965_3ST] = d965_3st_pin_configs,
2085 [STAC_D965_5ST] = d965_5st_pin_configs,
2086 [STAC_DELL_3ST] = dell_3st_pin_configs,
2087 [STAC_DELL_BIOS] = NULL,
2090 static const char *stac927x_models[STAC_927X_MODELS] = {
2091 [STAC_D965_REF] = "ref",
2092 [STAC_D965_3ST] = "3stack",
2093 [STAC_D965_5ST] = "5stack",
2094 [STAC_DELL_3ST] = "dell-3stack",
2095 [STAC_DELL_BIOS] = "dell-bios",
2098 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2099 /* SigmaTel reference board */
2100 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2101 "DFI LanParty", STAC_D965_REF),
2102 /* Intel 946 based systems */
2103 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2104 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2105 /* 965 based 3 stack systems */
2106 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
2107 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
2108 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
2109 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
2110 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
2111 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
2112 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
2113 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
2115 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
2117 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
2119 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
2121 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
2122 /* Dell 3 stack systems */
2123 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2124 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2125 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2127 /* Dell 3 stack systems with verb table in BIOS */
2128 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2129 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2130 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2131 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
2132 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2133 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2134 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2135 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2136 /* 965 based 5 stack systems */
2137 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
2138 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
2139 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
2140 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
2141 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
2142 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
2143 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
2144 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
2145 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
2149 static unsigned int ref9205_pin_configs[12] = {
2150 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2151 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2152 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2156 STAC 9205 pin configs for
2163 10280228 (Dell Vostro 1500)
2165 static unsigned int dell_9205_m42_pin_configs[12] = {
2166 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2167 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2168 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2172 STAC 9205 pin configs for
2176 102801FF (Dell Precision M4300)
2181 static unsigned int dell_9205_m43_pin_configs[12] = {
2182 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2183 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2184 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2187 static unsigned int dell_9205_m44_pin_configs[12] = {
2188 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2189 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2190 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2193 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2194 [STAC_9205_REF] = ref9205_pin_configs,
2195 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2196 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2197 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2200 static const char *stac9205_models[STAC_9205_MODELS] = {
2201 [STAC_9205_REF] = "ref",
2202 [STAC_9205_DELL_M42] = "dell-m42",
2203 [STAC_9205_DELL_M43] = "dell-m43",
2204 [STAC_9205_DELL_M44] = "dell-m44",
2207 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2208 /* SigmaTel reference board */
2209 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2210 "DFI LanParty", STAC_9205_REF),
2211 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2212 "unknown Dell", STAC_9205_DELL_M42),
2213 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2214 "unknown Dell", STAC_9205_DELL_M42),
2215 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2216 "Dell Precision", STAC_9205_DELL_M43),
2217 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2218 "Dell Precision", STAC_9205_DELL_M43),
2219 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2220 "Dell Precision", STAC_9205_DELL_M43),
2221 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2222 "unknown Dell", STAC_9205_DELL_M42),
2223 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2224 "unknown Dell", STAC_9205_DELL_M42),
2225 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2226 "Dell Precision", STAC_9205_DELL_M43),
2227 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2228 "Dell Precision M4300", STAC_9205_DELL_M43),
2229 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2230 "unknown Dell", STAC_9205_DELL_M42),
2231 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2232 "Dell Precision", STAC_9205_DELL_M43),
2233 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2234 "Dell Precision", STAC_9205_DELL_M43),
2235 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2236 "Dell Precision", STAC_9205_DELL_M43),
2237 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2238 "Dell Inspiron", STAC_9205_DELL_M44),
2239 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2240 "Dell Vostro 1500", STAC_9205_DELL_M42),
2244 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
2247 struct sigmatel_spec *spec = codec->spec;
2249 kfree(spec->pin_configs);
2250 spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs),
2252 if (!spec->pin_configs)
2255 for (i = 0; i < spec->num_pins; i++) {
2256 hda_nid_t nid = spec->pin_nids[i];
2257 unsigned int pin_cfg;
2259 pin_cfg = snd_hda_codec_read(codec, nid, 0,
2260 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
2261 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
2263 spec->pin_configs[i] = pin_cfg;
2269 static void stac92xx_set_config_reg(struct hda_codec *codec,
2270 hda_nid_t pin_nid, unsigned int pin_config)
2273 snd_hda_codec_write(codec, pin_nid, 0,
2274 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2275 pin_config & 0x000000ff);
2276 snd_hda_codec_write(codec, pin_nid, 0,
2277 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2278 (pin_config & 0x0000ff00) >> 8);
2279 snd_hda_codec_write(codec, pin_nid, 0,
2280 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2281 (pin_config & 0x00ff0000) >> 16);
2282 snd_hda_codec_write(codec, pin_nid, 0,
2283 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2285 i = snd_hda_codec_read(codec, pin_nid, 0,
2286 AC_VERB_GET_CONFIG_DEFAULT,
2288 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
2292 static void stac92xx_set_config_regs(struct hda_codec *codec)
2295 struct sigmatel_spec *spec = codec->spec;
2297 if (!spec->pin_configs)
2300 for (i = 0; i < spec->num_pins; i++)
2301 stac92xx_set_config_reg(codec, spec->pin_nids[i],
2302 spec->pin_configs[i]);
2305 static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins)
2307 struct sigmatel_spec *spec = codec->spec;
2310 return stac92xx_save_bios_config_regs(codec);
2312 kfree(spec->pin_configs);
2313 spec->pin_configs = kmemdup(pins,
2314 spec->num_pins * sizeof(*pins),
2316 if (!spec->pin_configs)
2319 stac92xx_set_config_regs(codec);
2323 static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid,
2326 struct sigmatel_spec *spec = codec->spec;
2329 for (i = 0; i < spec->num_pins; i++) {
2330 if (spec->pin_nids[i] == nid) {
2331 spec->pin_configs[i] = cfg;
2332 stac92xx_set_config_reg(codec, nid, cfg);
2339 * Analog playback callbacks
2341 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2342 struct hda_codec *codec,
2343 struct snd_pcm_substream *substream)
2345 struct sigmatel_spec *spec = codec->spec;
2346 if (spec->stream_delay)
2347 msleep(spec->stream_delay);
2348 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2352 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2353 struct hda_codec *codec,
2354 unsigned int stream_tag,
2355 unsigned int format,
2356 struct snd_pcm_substream *substream)
2358 struct sigmatel_spec *spec = codec->spec;
2359 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2362 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2363 struct hda_codec *codec,
2364 struct snd_pcm_substream *substream)
2366 struct sigmatel_spec *spec = codec->spec;
2367 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2371 * Digital playback callbacks
2373 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2374 struct hda_codec *codec,
2375 struct snd_pcm_substream *substream)
2377 struct sigmatel_spec *spec = codec->spec;
2378 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2381 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2382 struct hda_codec *codec,
2383 struct snd_pcm_substream *substream)
2385 struct sigmatel_spec *spec = codec->spec;
2386 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2389 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2390 struct hda_codec *codec,
2391 unsigned int stream_tag,
2392 unsigned int format,
2393 struct snd_pcm_substream *substream)
2395 struct sigmatel_spec *spec = codec->spec;
2396 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2397 stream_tag, format, substream);
2402 * Analog capture callbacks
2404 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2405 struct hda_codec *codec,
2406 unsigned int stream_tag,
2407 unsigned int format,
2408 struct snd_pcm_substream *substream)
2410 struct sigmatel_spec *spec = codec->spec;
2411 hda_nid_t nid = spec->adc_nids[substream->number];
2413 if (spec->powerdown_adcs) {
2415 snd_hda_codec_write(codec, nid, 0,
2416 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2418 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2422 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2423 struct hda_codec *codec,
2424 struct snd_pcm_substream *substream)
2426 struct sigmatel_spec *spec = codec->spec;
2427 hda_nid_t nid = spec->adc_nids[substream->number];
2429 snd_hda_codec_cleanup_stream(codec, nid);
2430 if (spec->powerdown_adcs)
2431 snd_hda_codec_write(codec, nid, 0,
2432 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2436 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2440 /* NID is set in stac92xx_build_pcms */
2442 .open = stac92xx_dig_playback_pcm_open,
2443 .close = stac92xx_dig_playback_pcm_close,
2444 .prepare = stac92xx_dig_playback_pcm_prepare
2448 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2452 /* NID is set in stac92xx_build_pcms */
2455 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2459 .nid = 0x02, /* NID to query formats and rates */
2461 .open = stac92xx_playback_pcm_open,
2462 .prepare = stac92xx_playback_pcm_prepare,
2463 .cleanup = stac92xx_playback_pcm_cleanup
2467 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2471 .nid = 0x06, /* NID to query formats and rates */
2473 .open = stac92xx_playback_pcm_open,
2474 .prepare = stac92xx_playback_pcm_prepare,
2475 .cleanup = stac92xx_playback_pcm_cleanup
2479 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2482 /* NID + .substreams is set in stac92xx_build_pcms */
2484 .prepare = stac92xx_capture_pcm_prepare,
2485 .cleanup = stac92xx_capture_pcm_cleanup
2489 static int stac92xx_build_pcms(struct hda_codec *codec)
2491 struct sigmatel_spec *spec = codec->spec;
2492 struct hda_pcm *info = spec->pcm_rec;
2494 codec->num_pcms = 1;
2495 codec->pcm_info = info;
2497 info->name = "STAC92xx Analog";
2498 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2499 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2500 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2501 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2503 if (spec->alt_switch) {
2506 info->name = "STAC92xx Analog Alt";
2507 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2510 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2513 info->name = "STAC92xx Digital";
2514 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2515 if (spec->multiout.dig_out_nid) {
2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2519 if (spec->dig_in_nid) {
2520 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2521 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2528 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2530 unsigned int pincap = snd_hda_param_read(codec, nid,
2532 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2533 if (pincap & AC_PINCAP_VREF_100)
2534 return AC_PINCTL_VREF_100;
2535 if (pincap & AC_PINCAP_VREF_80)
2536 return AC_PINCTL_VREF_80;
2537 if (pincap & AC_PINCAP_VREF_50)
2538 return AC_PINCTL_VREF_50;
2539 if (pincap & AC_PINCAP_VREF_GRD)
2540 return AC_PINCTL_VREF_GRD;
2544 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2547 snd_hda_codec_write_cache(codec, nid, 0,
2548 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2551 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2553 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2554 struct snd_ctl_elem_value *ucontrol)
2556 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2557 struct sigmatel_spec *spec = codec->spec;
2559 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2563 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
2564 unsigned char type);
2566 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2567 struct snd_ctl_elem_value *ucontrol)
2569 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2570 struct sigmatel_spec *spec = codec->spec;
2571 int nid = kcontrol->private_value;
2573 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2575 /* check to be sure that the ports are upto date with
2578 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2583 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2585 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2588 struct sigmatel_spec *spec = codec->spec;
2589 int io_idx = kcontrol-> private_value & 0xff;
2591 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2595 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2598 struct sigmatel_spec *spec = codec->spec;
2599 hda_nid_t nid = kcontrol->private_value >> 8;
2600 int io_idx = kcontrol-> private_value & 0xff;
2601 unsigned short val = !!ucontrol->value.integer.value[0];
2603 spec->io_switch[io_idx] = val;
2606 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2608 unsigned int pinctl = AC_PINCTL_IN_EN;
2609 if (io_idx) /* set VREF for mic */
2610 pinctl |= stac92xx_get_vref(codec, nid);
2611 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2614 /* check the auto-mute again: we need to mute/unmute the speaker
2615 * appropriately according to the pin direction
2617 if (spec->hp_detect)
2618 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2623 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2625 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2626 struct snd_ctl_elem_value *ucontrol)
2628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2629 struct sigmatel_spec *spec = codec->spec;
2631 ucontrol->value.integer.value[0] = spec->clfe_swap;
2635 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2636 struct snd_ctl_elem_value *ucontrol)
2638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2639 struct sigmatel_spec *spec = codec->spec;
2640 hda_nid_t nid = kcontrol->private_value & 0xff;
2641 unsigned int val = !!ucontrol->value.integer.value[0];
2643 if (spec->clfe_swap == val)
2646 spec->clfe_swap = val;
2648 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2649 spec->clfe_swap ? 0x4 : 0x0);
2654 #define STAC_CODEC_HP_SWITCH(xname) \
2655 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2658 .info = stac92xx_hp_switch_info, \
2659 .get = stac92xx_hp_switch_get, \
2660 .put = stac92xx_hp_switch_put, \
2663 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2664 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2667 .info = stac92xx_io_switch_info, \
2668 .get = stac92xx_io_switch_get, \
2669 .put = stac92xx_io_switch_put, \
2670 .private_value = xpval, \
2673 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2674 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2677 .info = stac92xx_clfe_switch_info, \
2678 .get = stac92xx_clfe_switch_get, \
2679 .put = stac92xx_clfe_switch_put, \
2680 .private_value = xpval, \
2684 STAC_CTL_WIDGET_VOL,
2685 STAC_CTL_WIDGET_MUTE,
2686 STAC_CTL_WIDGET_MONO_MUX,
2687 STAC_CTL_WIDGET_AMP_MUX,
2688 STAC_CTL_WIDGET_AMP_VOL,
2689 STAC_CTL_WIDGET_HP_SWITCH,
2690 STAC_CTL_WIDGET_IO_SWITCH,
2691 STAC_CTL_WIDGET_CLFE_SWITCH
2694 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2695 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2696 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2699 STAC_AMP_VOL(NULL, 0, 0, 0, 0),
2700 STAC_CODEC_HP_SWITCH(NULL),
2701 STAC_CODEC_IO_SWITCH(NULL, 0),
2702 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2705 /* add dynamic controls */
2706 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2707 struct snd_kcontrol_new *ktemp,
2708 int idx, const char *name,
2711 struct snd_kcontrol_new *knew;
2713 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2714 knew = snd_array_new(&spec->kctls);
2719 knew->name = kstrdup(name, GFP_KERNEL);
2722 knew->private_value = val;
2726 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2727 int type, int idx, const char *name,
2730 return stac92xx_add_control_temp(spec,
2731 &stac92xx_control_templates[type],
2736 /* add dynamic controls */
2737 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2738 const char *name, unsigned long val)
2740 return stac92xx_add_control_idx(spec, type, 0, name, val);
2743 /* flag inputs as additional dynamic lineouts */
2744 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2746 struct sigmatel_spec *spec = codec->spec;
2747 unsigned int wcaps, wtype;
2748 int i, num_dacs = 0;
2750 /* use the wcaps cache to count all DACs available for line-outs */
2751 for (i = 0; i < codec->num_nodes; i++) {
2752 wcaps = codec->wcaps[i];
2753 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2755 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2759 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2761 switch (cfg->line_outs) {
2763 /* add line-in as side */
2764 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2765 cfg->line_out_pins[cfg->line_outs] =
2766 cfg->input_pins[AUTO_PIN_LINE];
2767 spec->line_switch = 1;
2772 /* add line-in as clfe and mic as side */
2773 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2774 cfg->line_out_pins[cfg->line_outs] =
2775 cfg->input_pins[AUTO_PIN_LINE];
2776 spec->line_switch = 1;
2779 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2780 cfg->line_out_pins[cfg->line_outs] =
2781 cfg->input_pins[AUTO_PIN_MIC];
2782 spec->mic_switch = 1;
2787 /* add line-in as surr and mic as clfe */
2788 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2789 cfg->line_out_pins[cfg->line_outs] =
2790 cfg->input_pins[AUTO_PIN_LINE];
2791 spec->line_switch = 1;
2794 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2795 cfg->line_out_pins[cfg->line_outs] =
2796 cfg->input_pins[AUTO_PIN_MIC];
2797 spec->mic_switch = 1;
2807 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2811 for (i = 0; i < spec->multiout.num_dacs; i++) {
2812 if (spec->multiout.dac_nids[i] == nid)
2820 * Fill in the dac_nids table from the parsed pin configuration
2821 * This function only works when every pin in line_out_pins[]
2822 * contains atleast one DAC in its connection list. Some 92xx
2823 * codecs are not connected directly to a DAC, such as the 9200
2824 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2826 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2827 struct auto_pin_cfg *cfg)
2829 struct sigmatel_spec *spec = codec->spec;
2830 int i, j, conn_len = 0;
2831 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2832 unsigned int wcaps, wtype;
2834 for (i = 0; i < cfg->line_outs; i++) {
2835 nid = cfg->line_out_pins[i];
2836 conn_len = snd_hda_get_connections(codec, nid, conn,
2837 HDA_MAX_CONNECTIONS);
2838 for (j = 0; j < conn_len; j++) {
2839 wcaps = snd_hda_param_read(codec, conn[j],
2840 AC_PAR_AUDIO_WIDGET_CAP);
2841 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2842 if (wtype != AC_WID_AUD_OUT ||
2843 (wcaps & AC_WCAP_DIGITAL))
2845 /* conn[j] is a DAC routed to this line-out */
2846 if (!is_in_dac_nids(spec, conn[j]))
2850 if (j == conn_len) {
2851 if (spec->multiout.num_dacs > 0) {
2852 /* we have already working output pins,
2853 * so let's drop the broken ones again
2855 cfg->line_outs = spec->multiout.num_dacs;
2858 /* error out, no available DAC found */
2860 "%s: No available DAC for pin 0x%x\n",
2865 spec->multiout.dac_nids[i] = conn[j];
2866 spec->multiout.num_dacs++;
2868 /* select this DAC in the pin's input mux */
2869 snd_hda_codec_write_cache(codec, nid, 0,
2870 AC_VERB_SET_CONNECT_SEL, j);
2875 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2876 spec->multiout.num_dacs,
2877 spec->multiout.dac_nids[0],
2878 spec->multiout.dac_nids[1],
2879 spec->multiout.dac_nids[2],
2880 spec->multiout.dac_nids[3],
2881 spec->multiout.dac_nids[4]);
2885 /* create volume control/switch for the given prefx type */
2886 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2891 sprintf(name, "%s Playback Volume", pfx);
2892 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2893 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2896 sprintf(name, "%s Playback Switch", pfx);
2897 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2898 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2904 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2906 if (!spec->multiout.hp_nid)
2907 spec->multiout.hp_nid = nid;
2908 else if (spec->multiout.num_dacs > 4) {
2909 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2912 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2913 spec->multiout.num_dacs++;
2918 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2920 if (is_in_dac_nids(spec, nid))
2922 if (spec->multiout.hp_nid == nid)
2927 /* add playback controls from the parsed DAC table */
2928 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2929 const struct auto_pin_cfg *cfg)
2931 static const char *chname[4] = {
2932 "Front", "Surround", NULL /*CLFE*/, "Side"
2937 struct sigmatel_spec *spec = codec->spec;
2938 unsigned int wid_caps, pincap;
2941 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2942 if (!spec->multiout.dac_nids[i])
2945 nid = spec->multiout.dac_nids[i];
2949 err = create_controls(spec, "Center", nid, 1);
2952 err = create_controls(spec, "LFE", nid, 2);
2956 wid_caps = get_wcaps(codec, nid);
2958 if (wid_caps & AC_WCAP_LR_SWAP) {
2959 err = stac92xx_add_control(spec,
2960 STAC_CTL_WIDGET_CLFE_SWITCH,
2961 "Swap Center/LFE Playback Switch", nid);
2968 err = create_controls(spec, chname[i], nid, 3);
2974 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 &&
2975 cfg->hp_outs && !spec->multiout.hp_nid)
2976 spec->multiout.hp_nid = nid;
2978 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
2979 err = stac92xx_add_control(spec,
2980 STAC_CTL_WIDGET_HP_SWITCH,
2981 "Headphone as Line Out Switch",
2982 cfg->hp_pins[cfg->hp_outs - 1]);
2987 if (spec->line_switch) {
2988 nid = cfg->input_pins[AUTO_PIN_LINE];
2989 pincap = snd_hda_param_read(codec, nid,
2991 if (pincap & AC_PINCAP_OUT) {
2992 err = stac92xx_add_control(spec,
2993 STAC_CTL_WIDGET_IO_SWITCH,
2994 "Line In as Output Switch", nid << 8);
3000 if (spec->mic_switch) {
3001 unsigned int def_conf;
3002 unsigned int mic_pin = AUTO_PIN_MIC;
3004 nid = cfg->input_pins[mic_pin];
3005 def_conf = snd_hda_codec_read(codec, nid, 0,
3006 AC_VERB_GET_CONFIG_DEFAULT, 0);
3007 /* some laptops have an internal analog microphone
3008 * which can't be used as a output */
3009 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
3010 pincap = snd_hda_param_read(codec, nid,
3012 if (pincap & AC_PINCAP_OUT) {
3013 err = stac92xx_add_control(spec,
3014 STAC_CTL_WIDGET_IO_SWITCH,
3015 "Mic as Output Switch", (nid << 8) | 1);
3016 nid = snd_hda_codec_read(codec, nid, 0,
3017 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3018 if (!check_in_dac_nids(spec, nid))
3019 add_spec_dacs(spec, nid);
3023 } else if (mic_pin == AUTO_PIN_MIC) {
3024 mic_pin = AUTO_PIN_FRONT_MIC;
3032 /* add playback controls for Speaker and HP outputs */
3033 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3034 struct auto_pin_cfg *cfg)
3036 struct sigmatel_spec *spec = codec->spec;
3038 int i, old_num_dacs, err;
3040 old_num_dacs = spec->multiout.num_dacs;
3041 for (i = 0; i < cfg->hp_outs; i++) {
3042 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
3043 if (wid_caps & AC_WCAP_UNSOL_CAP)
3044 spec->hp_detect = 1;
3045 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
3046 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3047 if (check_in_dac_nids(spec, nid))
3051 add_spec_dacs(spec, nid);
3053 for (i = 0; i < cfg->speaker_outs; i++) {
3054 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
3055 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3056 if (check_in_dac_nids(spec, nid))
3060 add_spec_dacs(spec, nid);
3062 for (i = 0; i < cfg->line_outs; i++) {
3063 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
3064 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
3065 if (check_in_dac_nids(spec, nid))
3069 add_spec_dacs(spec, nid);
3071 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
3072 static const char *pfxs[] = {
3073 "Speaker", "External Speaker", "Speaker2",
3075 err = create_controls(spec, pfxs[i - old_num_dacs],
3076 spec->multiout.dac_nids[i], 3);
3080 if (spec->multiout.hp_nid) {
3081 err = create_controls(spec, "Headphone",
3082 spec->multiout.hp_nid, 3);
3090 /* labels for mono mux outputs */
3091 static const char *stac92xx_mono_labels[4] = {
3092 "DAC0", "DAC1", "Mixer", "DAC2"
3095 /* create mono mux for mono out on capable codecs */
3096 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3098 struct sigmatel_spec *spec = codec->spec;
3099 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3101 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3103 num_cons = snd_hda_get_connections(codec,
3106 HDA_MAX_NUM_INPUTS);
3107 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3110 for (i = 0; i < num_cons; i++) {
3111 mono_mux->items[mono_mux->num_items].label =
3112 stac92xx_mono_labels[i];
3113 mono_mux->items[mono_mux->num_items].index = i;
3114 mono_mux->num_items++;
3117 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3118 "Mono Mux", spec->mono_nid);
3121 /* labels for amp mux outputs */
3122 static const char *stac92xx_amp_labels[3] = {
3123 "Front Microphone", "Microphone", "Line In",
3126 /* create amp out controls mux on capable codecs */
3127 static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
3129 struct sigmatel_spec *spec = codec->spec;
3130 struct hda_input_mux *amp_mux = &spec->private_amp_mux;
3133 for (i = 0; i < spec->num_amps; i++) {
3134 amp_mux->items[amp_mux->num_items].label =
3135 stac92xx_amp_labels[i];
3136 amp_mux->items[amp_mux->num_items].index = i;
3137 amp_mux->num_items++;
3140 if (spec->num_amps > 1) {
3141 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
3142 "Amp Selector Capture Switch", 0);
3146 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
3147 "Amp Capture Volume",
3148 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
3152 /* create PC beep volume controls */
3153 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3156 struct sigmatel_spec *spec = codec->spec;
3157 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3160 /* check for mute support for the the amp */
3161 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3162 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3163 "PC Beep Playback Switch",
3164 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3169 /* check to see if there is volume support for the amp */
3170 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3171 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3172 "PC Beep Playback Volume",
3173 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3180 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3181 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3183 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3184 struct snd_ctl_elem_value *ucontrol)
3186 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3187 ucontrol->value.integer.value[0] = codec->beep->enabled;
3191 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3192 struct snd_ctl_elem_value *ucontrol)
3194 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3195 int enabled = !!ucontrol->value.integer.value[0];
3196 if (codec->beep->enabled != enabled) {
3197 codec->beep->enabled = enabled;
3203 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3205 .info = stac92xx_dig_beep_switch_info,
3206 .get = stac92xx_dig_beep_switch_get,
3207 .put = stac92xx_dig_beep_switch_put,
3210 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3212 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3213 0, "PC Beep Playback Switch", 0);
3217 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3219 struct sigmatel_spec *spec = codec->spec;
3220 int wcaps, nid, i, err = 0;
3222 for (i = 0; i < spec->num_muxes; i++) {
3223 nid = spec->mux_nids[i];
3224 wcaps = get_wcaps(codec, nid);
3226 if (wcaps & AC_WCAP_OUT_AMP) {
3227 err = stac92xx_add_control_idx(spec,
3228 STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume",
3229 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3237 static const char *stac92xx_spdif_labels[3] = {
3238 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3241 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3243 struct sigmatel_spec *spec = codec->spec;
3244 struct hda_input_mux *spdif_mux = &spec->private_smux;
3245 const char **labels = spec->spdif_labels;
3247 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3249 num_cons = snd_hda_get_connections(codec,
3252 HDA_MAX_NUM_INPUTS);
3257 labels = stac92xx_spdif_labels;
3259 for (i = 0; i < num_cons; i++) {
3260 spdif_mux->items[spdif_mux->num_items].label = labels[i];
3261 spdif_mux->items[spdif_mux->num_items].index = i;
3262 spdif_mux->num_items++;
3268 /* labels for dmic mux inputs */
3269 static const char *stac92xx_dmic_labels[5] = {
3270 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3271 "Digital Mic 3", "Digital Mic 4"
3274 /* create playback/capture controls for input pins on dmic capable codecs */
3275 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3276 const struct auto_pin_cfg *cfg)
3278 struct sigmatel_spec *spec = codec->spec;
3279 struct hda_input_mux *dimux = &spec->private_dimux;
3280 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3284 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
3285 dimux->items[dimux->num_items].index = 0;
3288 for (i = 0; i < spec->num_dmics; i++) {
3293 unsigned int def_conf;
3295 def_conf = snd_hda_codec_read(codec,
3298 AC_VERB_GET_CONFIG_DEFAULT,
3300 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3303 nid = spec->dmic_nids[i];
3304 num_cons = snd_hda_get_connections(codec,
3307 HDA_MAX_NUM_INPUTS);
3308 for (j = 0; j < num_cons; j++)
3309 if (con_lst[j] == nid) {
3315 wcaps = get_wcaps(codec, nid) &
3316 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3319 sprintf(name, "%s Capture Volume",
3320 stac92xx_dmic_labels[dimux->num_items]);
3322 err = stac92xx_add_control(spec,
3323 STAC_CTL_WIDGET_VOL,
3325 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3326 (wcaps & AC_WCAP_OUT_AMP) ?
3327 HDA_OUTPUT : HDA_INPUT));
3332 dimux->items[dimux->num_items].label =
3333 stac92xx_dmic_labels[dimux->num_items];
3334 dimux->items[dimux->num_items].index = index;
3341 /* create playback/capture controls for input pins */
3342 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3344 struct sigmatel_spec *spec = codec->spec;
3345 struct hda_input_mux *imux = &spec->private_imux;
3346 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3349 for (i = 0; i < AUTO_PIN_LAST; i++) {
3352 if (!cfg->input_pins[i])
3355 for (j = 0; j < spec->num_muxes; j++) {
3357 num_cons = snd_hda_get_connections(codec,
3360 HDA_MAX_NUM_INPUTS);
3361 for (k = 0; k < num_cons; k++)
3362 if (con_lst[k] == cfg->input_pins[i]) {
3369 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
3370 imux->items[imux->num_items].index = index;
3374 if (imux->num_items) {
3376 * Set the current input for the muxes.
3377 * The STAC9221 has two input muxes with identical source
3378 * NID lists. Hopefully this won't get confused.
3380 for (i = 0; i < spec->num_muxes; i++) {
3381 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3382 AC_VERB_SET_CONNECT_SEL,
3383 imux->items[0].index);
3390 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3392 struct sigmatel_spec *spec = codec->spec;
3395 for (i = 0; i < spec->autocfg.line_outs; i++) {
3396 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3397 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3401 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3403 struct sigmatel_spec *spec = codec->spec;
3406 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3408 pin = spec->autocfg.hp_pins[i];
3409 if (pin) /* connect to front */
3410 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3412 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3414 pin = spec->autocfg.speaker_pins[i];
3415 if (pin) /* connect to front */
3416 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3420 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3422 struct sigmatel_spec *spec = codec->spec;
3424 int hp_speaker_swap = 0;
3426 if ((err = snd_hda_parse_pin_def_config(codec,
3428 spec->dmic_nids)) < 0)
3430 if (! spec->autocfg.line_outs)
3431 return 0; /* can't find valid pin config */
3433 /* If we have no real line-out pin and multiple hp-outs, HPs should
3434 * be set up as multi-channel outputs.
3436 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
3437 spec->autocfg.hp_outs > 1) {
3438 /* Copy hp_outs to line_outs, backup line_outs in
3439 * speaker_outs so that the following routines can handle
3440 * HP pins as primary outputs.
3442 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3443 sizeof(spec->autocfg.line_out_pins));
3444 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3445 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3446 sizeof(spec->autocfg.hp_pins));
3447 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3448 hp_speaker_swap = 1;
3450 if (spec->autocfg.mono_out_pin) {
3451 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3452 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3453 u32 caps = query_amp_caps(codec,
3454 spec->autocfg.mono_out_pin, dir);
3455 hda_nid_t conn_list[1];
3457 /* get the mixer node and then the mono mux if it exists */
3458 if (snd_hda_get_connections(codec,
3459 spec->autocfg.mono_out_pin, conn_list, 1) &&
3460 snd_hda_get_connections(codec, conn_list[0],
3463 int wcaps = get_wcaps(codec, conn_list[0]);
3464 int wid_type = (wcaps & AC_WCAP_TYPE)
3465 >> AC_WCAP_TYPE_SHIFT;
3466 /* LR swap check, some stac925x have a mux that
3467 * changes the DACs output path instead of the
3470 if (wid_type == AC_WID_AUD_SEL &&
3471 !(wcaps & AC_WCAP_LR_SWAP))
3472 spec->mono_nid = conn_list[0];
3475 hda_nid_t nid = spec->autocfg.mono_out_pin;
3477 /* most mono outs have a least a mute/unmute switch */
3478 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3479 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3480 "Mono Playback Switch",
3481 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3484 /* check for volume support for the amp */
3485 if ((caps & AC_AMPCAP_NUM_STEPS)
3486 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3487 err = stac92xx_add_control(spec,
3488 STAC_CTL_WIDGET_VOL,
3489 "Mono Playback Volume",
3490 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3496 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3500 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
3502 if (spec->multiout.num_dacs == 0)
3503 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
3506 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3511 /* setup analog beep controls */
3512 if (spec->anabeep_nid > 0) {
3513 err = stac92xx_auto_create_beep_ctls(codec,
3519 /* setup digital beep controls and input device */
3520 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3521 if (spec->digbeep_nid > 0) {
3522 hda_nid_t nid = spec->digbeep_nid;
3525 err = stac92xx_auto_create_beep_ctls(codec, nid);
3528 err = snd_hda_attach_beep_device(codec, nid);
3531 /* if no beep switch is available, make its own one */
3532 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3534 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
3535 err = stac92xx_beep_switch_ctl(codec);
3542 if (hp_speaker_swap == 1) {
3543 /* Restore the hp_outs and line_outs */
3544 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3545 sizeof(spec->autocfg.line_out_pins));
3546 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3547 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
3548 sizeof(spec->autocfg.speaker_pins));
3549 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
3550 memset(spec->autocfg.speaker_pins, 0,
3551 sizeof(spec->autocfg.speaker_pins));
3552 spec->autocfg.speaker_outs = 0;
3555 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3560 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3565 if (spec->mono_nid > 0) {
3566 err = stac92xx_auto_create_mono_output_ctls(codec);
3570 if (spec->num_amps > 0) {
3571 err = stac92xx_auto_create_amp_output_ctls(codec);
3575 if (spec->num_dmics > 0 && !spec->dinput_mux)
3576 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3577 &spec->autocfg)) < 0)
3579 if (spec->num_muxes > 0) {
3580 err = stac92xx_auto_create_mux_input_ctls(codec);
3584 if (spec->num_smuxes > 0) {
3585 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3590 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3591 if (spec->multiout.max_channels > 2)
3592 spec->surr_switch = 1;
3594 if (spec->autocfg.dig_out_pin)
3595 spec->multiout.dig_out_nid = dig_out;
3596 if (dig_in && spec->autocfg.dig_in_pin)
3597 spec->dig_in_nid = dig_in;
3599 if (spec->kctls.list)
3600 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3602 spec->input_mux = &spec->private_imux;
3603 spec->dinput_mux = &spec->private_dimux;
3604 spec->sinput_mux = &spec->private_smux;
3605 spec->mono_mux = &spec->private_mono_mux;
3606 spec->amp_mux = &spec->private_amp_mux;
3610 /* add playback controls for HP output */
3611 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3612 struct auto_pin_cfg *cfg)
3614 struct sigmatel_spec *spec = codec->spec;
3615 hda_nid_t pin = cfg->hp_pins[0];
3616 unsigned int wid_caps;
3621 wid_caps = get_wcaps(codec, pin);
3622 if (wid_caps & AC_WCAP_UNSOL_CAP)
3623 spec->hp_detect = 1;
3628 /* add playback controls for LFE output */
3629 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3630 struct auto_pin_cfg *cfg)
3632 struct sigmatel_spec *spec = codec->spec;
3634 hda_nid_t lfe_pin = 0x0;
3638 * search speaker outs and line outs for a mono speaker pin
3639 * with an amp. If one is found, add LFE controls
3642 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3643 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3644 unsigned int wcaps = get_wcaps(codec, pin);
3645 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3646 if (wcaps == AC_WCAP_OUT_AMP)
3647 /* found a mono speaker with an amp, must be lfe */
3651 /* if speaker_outs is 0, then speakers may be in line_outs */
3652 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3653 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3654 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3655 unsigned int defcfg;
3656 defcfg = snd_hda_codec_read(codec, pin, 0,
3657 AC_VERB_GET_CONFIG_DEFAULT,
3659 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3660 unsigned int wcaps = get_wcaps(codec, pin);
3661 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3662 if (wcaps == AC_WCAP_OUT_AMP)
3663 /* found a mono speaker with an amp,
3671 err = create_controls(spec, "LFE", lfe_pin, 1);
3679 static int stac9200_parse_auto_config(struct hda_codec *codec)
3681 struct sigmatel_spec *spec = codec->spec;
3684 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3687 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3690 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3693 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3696 if (spec->num_muxes > 0) {
3697 err = stac92xx_auto_create_mux_input_ctls(codec);
3702 if (spec->autocfg.dig_out_pin)
3703 spec->multiout.dig_out_nid = 0x05;
3704 if (spec->autocfg.dig_in_pin)
3705 spec->dig_in_nid = 0x04;
3707 if (spec->kctls.list)
3708 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3710 spec->input_mux = &spec->private_imux;
3711 spec->dinput_mux = &spec->private_dimux;
3717 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3718 * funky external mute control using GPIO pins.
3721 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3722 unsigned int dir_mask, unsigned int data)
3724 unsigned int gpiostate, gpiomask, gpiodir;
3726 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3727 AC_VERB_GET_GPIO_DATA, 0);
3728 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3730 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3731 AC_VERB_GET_GPIO_MASK, 0);
3734 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3735 AC_VERB_GET_GPIO_DIRECTION, 0);
3736 gpiodir |= dir_mask;
3738 /* Configure GPIOx as CMOS */
3739 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3741 snd_hda_codec_write(codec, codec->afg, 0,
3742 AC_VERB_SET_GPIO_MASK, gpiomask);
3743 snd_hda_codec_read(codec, codec->afg, 0,
3744 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3748 snd_hda_codec_read(codec, codec->afg, 0,
3749 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3752 static int stac92xx_add_jack(struct hda_codec *codec,
3753 hda_nid_t nid, int type)
3755 #ifdef CONFIG_SND_JACK
3756 struct sigmatel_spec *spec = codec->spec;
3757 struct sigmatel_jack *jack;
3758 int def_conf = snd_hda_codec_read(codec, nid,
3759 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3760 int connectivity = get_defcfg_connect(def_conf);
3763 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
3766 snd_array_init(&spec->jacks, sizeof(*jack), 32);
3767 jack = snd_array_new(&spec->jacks);
3773 sprintf(name, "%s at %s %s Jack",
3774 snd_hda_get_jack_type(def_conf),
3775 snd_hda_get_jack_connectivity(def_conf),
3776 snd_hda_get_jack_location(def_conf));
3778 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
3784 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
3785 unsigned char type, int data)
3787 struct sigmatel_event *event;
3789 snd_array_init(&spec->events, sizeof(*event), 32);
3790 event = snd_array_new(&spec->events);
3795 event->tag = spec->events.used;
3801 static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
3802 hda_nid_t nid, unsigned char type)
3804 struct sigmatel_spec *spec = codec->spec;
3805 struct sigmatel_event *event = spec->events.list;
3808 for (i = 0; i < spec->events.used; i++, event++) {
3809 if (event->nid == nid && event->type == type)
3815 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
3818 struct sigmatel_spec *spec = codec->spec;
3819 struct sigmatel_event *event = spec->events.list;
3822 for (i = 0; i < spec->events.used; i++, event++) {
3823 if (event->tag == tag)
3829 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3832 struct sigmatel_event *event;
3835 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
3837 event = stac_get_event(codec, nid, type);
3841 tag = stac_add_event(codec->spec, nid, type, 0);
3844 snd_hda_codec_write_cache(codec, nid, 0,
3845 AC_VERB_SET_UNSOLICITED_ENABLE,
3849 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3852 for (i = 0; i < cfg->hp_outs; i++)
3853 if (cfg->hp_pins[i] == nid)
3854 return 1; /* nid is a HP-Out */
3856 return 0; /* nid is not a HP-Out */
3859 static void stac92xx_power_down(struct hda_codec *codec)
3861 struct sigmatel_spec *spec = codec->spec;
3863 /* power down inactive DACs */
3865 for (dac = spec->dac_list; *dac; dac++)
3866 if (!is_in_dac_nids(spec, *dac) &&
3867 spec->multiout.hp_nid != *dac)
3868 snd_hda_codec_write(codec, *dac, 0,
3869 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3872 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3875 static int stac92xx_init(struct hda_codec *codec)
3877 struct sigmatel_spec *spec = codec->spec;
3878 struct auto_pin_cfg *cfg = &spec->autocfg;
3882 snd_hda_sequence_write(codec, spec->init);
3884 /* power down adcs initially */
3885 if (spec->powerdown_adcs)
3886 for (i = 0; i < spec->num_adcs; i++)
3887 snd_hda_codec_write(codec,
3888 spec->adc_nids[i], 0,
3889 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3892 gpio = spec->gpio_data;
3893 /* turn on EAPD statically when spec->eapd_switch isn't set.
3894 * otherwise, unsol event will turn it on/off dynamically
3896 if (!spec->eapd_switch)
3897 gpio |= spec->eapd_mask;
3898 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
3901 if (spec->hp_detect) {
3902 /* Enable unsolicited responses on the HP widget */
3903 for (i = 0; i < cfg->hp_outs; i++) {
3904 hda_nid_t nid = cfg->hp_pins[i];
3905 enable_pin_detect(codec, nid, STAC_HP_EVENT);
3907 /* force to enable the first line-out; the others are set up
3910 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3912 /* fake event to set up pins */
3913 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
3916 stac92xx_auto_init_multi_out(codec);
3917 stac92xx_auto_init_hp_out(codec);
3919 for (i = 0; i < AUTO_PIN_LAST; i++) {
3920 hda_nid_t nid = cfg->input_pins[i];
3922 unsigned int pinctl;
3923 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) {
3924 /* for mic pins, force to initialize */
3925 pinctl = stac92xx_get_vref(codec, nid);
3927 pinctl = snd_hda_codec_read(codec, nid, 0,
3928 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3929 /* if PINCTL already set then skip */
3930 if (pinctl & AC_PINCTL_IN_EN)
3933 pinctl |= AC_PINCTL_IN_EN;
3934 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3935 enable_pin_detect(codec, nid, STAC_INSERT_EVENT);
3938 for (i = 0; i < spec->num_dmics; i++)
3939 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3941 if (cfg->dig_out_pin)
3942 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3944 if (cfg->dig_in_pin)
3945 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3947 for (i = 0; i < spec->num_pwrs; i++) {
3948 hda_nid_t nid = spec->pwr_nids[i];
3949 int pinctl, def_conf;
3951 if (is_nid_hp_pin(cfg, nid) && spec->hp_detect)
3952 continue; /* already has an unsol event */
3954 pinctl = snd_hda_codec_read(codec, nid, 0,
3955 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3956 /* outputs are only ports capable of power management
3957 * any attempts on powering down a input port cause the
3958 * referenced VREF to act quirky.
3960 if (pinctl & AC_PINCTL_IN_EN)
3962 def_conf = snd_hda_codec_read(codec, nid, 0,
3963 AC_VERB_GET_CONFIG_DEFAULT, 0);
3964 def_conf = get_defcfg_connect(def_conf);
3965 /* skip any ports that don't have jacks since presence
3966 * detection is useless */
3967 if (def_conf != AC_JACK_PORT_COMPLEX) {
3968 if (def_conf != AC_JACK_PORT_NONE)
3969 stac_toggle_power_map(codec, nid, 1);
3972 enable_pin_detect(codec, nid, STAC_PWR_EVENT);
3973 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT);
3976 stac92xx_power_down(codec);
3980 static void stac92xx_free_jacks(struct hda_codec *codec)
3982 #ifdef CONFIG_SND_JACK
3983 /* free jack instances manually when clearing/reconfiguring */
3984 struct sigmatel_spec *spec = codec->spec;
3985 if (!codec->bus->shutdown && spec->jacks.list) {
3986 struct sigmatel_jack *jacks = spec->jacks.list;
3988 for (i = 0; i < spec->jacks.used; i++)
3989 snd_device_free(codec->bus->card, &jacks[i].jack);
3991 snd_array_free(&spec->jacks);
3995 static void stac92xx_free_kctls(struct hda_codec *codec)
3997 struct sigmatel_spec *spec = codec->spec;
3999 if (spec->kctls.list) {
4000 struct snd_kcontrol_new *kctl = spec->kctls.list;
4002 for (i = 0; i < spec->kctls.used; i++)
4003 kfree(kctl[i].name);
4005 snd_array_free(&spec->kctls);
4008 static void stac92xx_free(struct hda_codec *codec)
4010 struct sigmatel_spec *spec = codec->spec;
4015 kfree(spec->pin_configs);
4016 stac92xx_free_jacks(codec);
4017 snd_array_free(&spec->events);
4020 snd_hda_detach_beep_device(codec);
4023 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4026 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4027 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4029 if (pin_ctl & AC_PINCTL_IN_EN) {
4031 * we need to check the current set-up direction of
4032 * shared input pins since they can be switched via
4033 * "xxx as Output" mixer switch
4035 struct sigmatel_spec *spec = codec->spec;
4036 struct auto_pin_cfg *cfg = &spec->autocfg;
4037 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
4038 spec->line_switch) ||
4039 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
4044 /* if setting pin direction bits, clear the current
4045 direction bits first */
4046 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4047 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4049 snd_hda_codec_write_cache(codec, nid, 0,
4050 AC_VERB_SET_PIN_WIDGET_CONTROL,
4054 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4057 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4058 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4059 snd_hda_codec_write_cache(codec, nid, 0,
4060 AC_VERB_SET_PIN_WIDGET_CONTROL,
4064 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4068 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
4070 unsigned int pinctl;
4071 pinctl = snd_hda_codec_read(codec, nid, 0,
4072 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4073 if (pinctl & AC_PINCTL_IN_EN)
4074 return 0; /* mic- or line-input */
4076 return 1; /* HP-output */
4081 /* return non-zero if the hp-pin of the given array index isn't
4082 * a jack-detection target
4084 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4086 struct auto_pin_cfg *cfg = &spec->autocfg;
4088 /* ignore sensing of shared line and mic jacks */
4089 if (spec->line_switch &&
4090 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE])
4092 if (spec->mic_switch &&
4093 cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC])
4095 /* ignore if the pin is set as line-out */
4096 if (cfg->hp_pins[i] == spec->hp_switch)
4101 static void stac92xx_hp_detect(struct hda_codec *codec)
4103 struct sigmatel_spec *spec = codec->spec;
4104 struct auto_pin_cfg *cfg = &spec->autocfg;
4108 if (spec->gpio_mute)
4109 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4110 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4112 for (i = 0; i < cfg->hp_outs; i++) {
4115 if (no_hp_sensing(spec, i))
4117 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
4121 /* disable lineouts */
4122 if (spec->hp_switch)
4123 stac92xx_reset_pinctl(codec, spec->hp_switch,
4125 for (i = 0; i < cfg->line_outs; i++)
4126 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4128 for (i = 0; i < cfg->speaker_outs; i++)
4129 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4131 if (spec->eapd_mask && spec->eapd_switch)
4132 stac_gpio_set(codec, spec->gpio_mask,
4133 spec->gpio_dir, spec->gpio_data &
4136 /* enable lineouts */
4137 if (spec->hp_switch)
4138 stac92xx_set_pinctl(codec, spec->hp_switch,
4140 for (i = 0; i < cfg->line_outs; i++)
4141 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4143 for (i = 0; i < cfg->speaker_outs; i++)
4144 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4146 if (spec->eapd_mask && spec->eapd_switch)
4147 stac_gpio_set(codec, spec->gpio_mask,
4148 spec->gpio_dir, spec->gpio_data |
4151 /* toggle hp outs */
4152 for (i = 0; i < cfg->hp_outs; i++) {
4153 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4154 if (no_hp_sensing(spec, i))
4157 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4159 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4163 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4166 struct sigmatel_spec *spec = codec->spec;
4167 unsigned int idx, val;
4169 for (idx = 0; idx < spec->num_pwrs; idx++) {
4170 if (spec->pwr_nids[idx] == nid)
4173 if (idx >= spec->num_pwrs)
4176 /* several codecs have two power down bits */
4177 if (spec->pwr_mapping)
4178 idx = spec->pwr_mapping[idx];
4182 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4188 /* power down unused output ports */
4189 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4192 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4194 stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid));
4197 static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid)
4199 struct sigmatel_spec *spec = codec->spec;
4200 struct sigmatel_jack *jacks = spec->jacks.list;
4204 for (i = 0; i < spec->jacks.used; i++) {
4205 if (jacks->nid == nid) {
4206 unsigned int pin_ctl =
4207 snd_hda_codec_read(codec, nid,
4208 0, AC_VERB_GET_PIN_WIDGET_CONTROL,
4210 int type = jacks->type;
4211 if (type == (SND_JACK_LINEOUT
4212 | SND_JACK_HEADPHONE))
4213 type = (pin_ctl & AC_PINCTL_HP_EN)
4214 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT;
4215 snd_jack_report(jacks->jack,
4216 get_hp_pin_presence(codec, nid)
4224 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
4227 struct sigmatel_event *event = stac_get_event(codec, nid, type);
4230 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);
4233 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4235 struct sigmatel_spec *spec = codec->spec;
4236 struct sigmatel_event *event;
4239 tag = (res >> 26) & 0x7f;
4240 event = stac_get_event_from_tag(codec, tag);
4244 switch (event->type) {
4246 stac92xx_hp_detect(codec);
4248 case STAC_INSERT_EVENT:
4249 case STAC_PWR_EVENT:
4250 if (spec->num_pwrs > 0)
4251 stac92xx_pin_sense(codec, event->nid);
4252 stac92xx_report_jack(codec, event->nid);
4254 case STAC_VREF_EVENT:
4255 data = snd_hda_codec_read(codec, codec->afg, 0,
4256 AC_VERB_GET_GPIO_DATA, 0);
4257 /* toggle VREF state based on GPIOx status */
4258 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4259 !!(data & (1 << event->data)));
4264 #ifdef CONFIG_PROC_FS
4265 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4266 struct hda_codec *codec, hda_nid_t nid)
4268 if (nid == codec->afg)
4269 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4270 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4273 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4274 struct hda_codec *codec,
4277 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4278 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4281 /* stac92hd71bxx, stac92hd73xx */
4282 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4283 struct hda_codec *codec, hda_nid_t nid)
4285 stac92hd_proc_hook(buffer, codec, nid);
4286 if (nid == codec->afg)
4287 analog_loop_proc_hook(buffer, codec, 0xfa0);
4290 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4291 struct hda_codec *codec, hda_nid_t nid)
4293 if (nid == codec->afg)
4294 analog_loop_proc_hook(buffer, codec, 0xfe0);
4297 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4298 struct hda_codec *codec, hda_nid_t nid)
4300 if (nid == codec->afg)
4301 analog_loop_proc_hook(buffer, codec, 0xfeb);
4304 #define stac92hd_proc_hook NULL
4305 #define stac92hd7x_proc_hook NULL
4306 #define stac9205_proc_hook NULL
4307 #define stac927x_proc_hook NULL
4310 #ifdef SND_HDA_NEEDS_RESUME
4311 static int stac92xx_resume(struct hda_codec *codec)
4313 struct sigmatel_spec *spec = codec->spec;
4315 stac92xx_set_config_regs(codec);
4316 stac92xx_init(codec);
4317 snd_hda_codec_resume_amp(codec);
4318 snd_hda_codec_resume_cache(codec);
4319 /* fake event to set up pins again to override cached values */
4320 if (spec->hp_detect)
4321 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
4326 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4328 struct sigmatel_spec *spec = codec->spec;
4329 if (spec->eapd_mask)
4330 stac_gpio_set(codec, spec->gpio_mask,
4331 spec->gpio_dir, spec->gpio_data &
4337 static struct hda_codec_ops stac92xx_patch_ops = {
4338 .build_controls = stac92xx_build_controls,
4339 .build_pcms = stac92xx_build_pcms,
4340 .init = stac92xx_init,
4341 .free = stac92xx_free,
4342 .unsol_event = stac92xx_unsol_event,
4343 #ifdef SND_HDA_NEEDS_RESUME
4344 .suspend = stac92xx_suspend,
4345 .resume = stac92xx_resume,
4349 static int patch_stac9200(struct hda_codec *codec)
4351 struct sigmatel_spec *spec;
4354 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4359 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4360 spec->pin_nids = stac9200_pin_nids;
4361 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
4364 if (spec->board_config < 0) {
4365 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
4366 err = stac92xx_save_bios_config_regs(codec);
4368 err = stac_save_pin_cfgs(codec,
4369 stac9200_brd_tbl[spec->board_config]);
4371 stac92xx_free(codec);
4375 spec->multiout.max_channels = 2;
4376 spec->multiout.num_dacs = 1;
4377 spec->multiout.dac_nids = stac9200_dac_nids;
4378 spec->adc_nids = stac9200_adc_nids;
4379 spec->mux_nids = stac9200_mux_nids;
4380 spec->num_muxes = 1;
4381 spec->num_dmics = 0;
4385 if (spec->board_config == STAC_9200_GATEWAY ||
4386 spec->board_config == STAC_9200_OQO)
4387 spec->init = stac9200_eapd_init;
4389 spec->init = stac9200_core_init;
4390 spec->mixer = stac9200_mixer;
4392 if (spec->board_config == STAC_9200_PANASONIC) {
4393 spec->gpio_mask = spec->gpio_dir = 0x09;
4394 spec->gpio_data = 0x00;
4397 err = stac9200_parse_auto_config(codec);
4399 stac92xx_free(codec);
4403 codec->patch_ops = stac92xx_patch_ops;
4408 static int patch_stac925x(struct hda_codec *codec)
4410 struct sigmatel_spec *spec;
4413 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4418 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4419 spec->pin_nids = stac925x_pin_nids;
4420 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
4424 if (spec->board_config < 0) {
4425 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4426 "using BIOS defaults\n");
4427 err = stac92xx_save_bios_config_regs(codec);
4429 err = stac_save_pin_cfgs(codec,
4430 stac925x_brd_tbl[spec->board_config]);
4432 stac92xx_free(codec);
4436 spec->multiout.max_channels = 2;
4437 spec->multiout.num_dacs = 1;
4438 spec->multiout.dac_nids = stac925x_dac_nids;
4439 spec->adc_nids = stac925x_adc_nids;
4440 spec->mux_nids = stac925x_mux_nids;
4441 spec->num_muxes = 1;
4444 switch (codec->vendor_id) {
4445 case 0x83847632: /* STAC9202 */
4446 case 0x83847633: /* STAC9202D */
4447 case 0x83847636: /* STAC9251 */
4448 case 0x83847637: /* STAC9251D */
4449 spec->num_dmics = STAC925X_NUM_DMICS;
4450 spec->dmic_nids = stac925x_dmic_nids;
4451 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
4452 spec->dmux_nids = stac925x_dmux_nids;
4455 spec->num_dmics = 0;
4459 spec->init = stac925x_core_init;
4460 spec->mixer = stac925x_mixer;
4462 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
4464 if (spec->board_config < 0) {
4465 printk(KERN_WARNING "hda_codec: No auto-config is "
4466 "available, default to model=ref\n");
4467 spec->board_config = STAC_925x_REF;
4473 stac92xx_free(codec);
4477 codec->patch_ops = stac92xx_patch_ops;
4482 static struct hda_input_mux stac92hd73xx_dmux = {
4485 { "Analog Inputs", 0x0b },
4486 { "Digital Mic 1", 0x09 },
4487 { "Digital Mic 2", 0x0a },
4492 static int patch_stac92hd73xx(struct hda_codec *codec)
4494 struct sigmatel_spec *spec;
4495 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
4498 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4503 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
4504 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
4505 spec->pin_nids = stac92hd73xx_pin_nids;
4506 spec->board_config = snd_hda_check_board_config(codec,
4507 STAC_92HD73XX_MODELS,
4508 stac92hd73xx_models,
4509 stac92hd73xx_cfg_tbl);
4511 if (spec->board_config < 0) {
4512 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4513 " STAC92HD73XX, using BIOS defaults\n");
4514 err = stac92xx_save_bios_config_regs(codec);
4516 err = stac_save_pin_cfgs(codec,
4517 stac92hd73xx_brd_tbl[spec->board_config]);
4519 stac92xx_free(codec);
4523 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
4524 conn, STAC92HD73_DAC_COUNT + 2) - 1;
4526 if (spec->multiout.num_dacs < 0) {
4527 printk(KERN_WARNING "hda_codec: Could not determine "
4528 "number of channels defaulting to DAC count\n");
4529 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
4532 switch (spec->multiout.num_dacs) {
4533 case 0x3: /* 6 Channel */
4534 spec->mixer = stac92hd73xx_6ch_mixer;
4535 spec->init = stac92hd73xx_6ch_core_init;
4537 case 0x4: /* 8 Channel */
4538 spec->mixer = stac92hd73xx_8ch_mixer;
4539 spec->init = stac92hd73xx_8ch_core_init;
4541 case 0x5: /* 10 Channel */
4542 spec->mixer = stac92hd73xx_10ch_mixer;
4543 spec->init = stac92hd73xx_10ch_core_init;
4546 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
4547 spec->aloopback_mask = 0x01;
4548 spec->aloopback_shift = 8;
4550 spec->digbeep_nid = 0x1c;
4551 spec->mux_nids = stac92hd73xx_mux_nids;
4552 spec->adc_nids = stac92hd73xx_adc_nids;
4553 spec->dmic_nids = stac92hd73xx_dmic_nids;
4554 spec->dmux_nids = stac92hd73xx_dmux_nids;
4555 spec->smux_nids = stac92hd73xx_smux_nids;
4556 spec->amp_nids = stac92hd73xx_amp_nids;
4557 spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
4559 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
4560 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
4561 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
4562 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
4563 sizeof(stac92hd73xx_dmux));
4565 switch (spec->board_config) {
4567 spec->init = dell_eq_core_init;
4569 case STAC_DELL_M6_AMIC:
4570 case STAC_DELL_M6_DMIC:
4571 case STAC_DELL_M6_BOTH:
4572 spec->num_smuxes = 0;
4573 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4574 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4575 spec->eapd_switch = 0;
4579 spec->init = dell_m6_core_init;
4580 switch (spec->board_config) {
4581 case STAC_DELL_M6_AMIC: /* Analog Mics */
4582 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4583 spec->num_dmics = 0;
4584 spec->private_dimux.num_items = 1;
4586 case STAC_DELL_M6_DMIC: /* Digital Mics */
4587 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4588 spec->num_dmics = 1;
4589 spec->private_dimux.num_items = 2;
4591 case STAC_DELL_M6_BOTH: /* Both */
4592 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4593 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4594 spec->num_dmics = 1;
4595 spec->private_dimux.num_items = 2;
4600 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4601 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4602 spec->eapd_switch = 1;
4604 if (spec->board_config > STAC_92HD73XX_REF) {
4605 /* GPIO0 High = Enable EAPD */
4606 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4607 spec->gpio_data = 0x01;
4609 spec->dinput_mux = &spec->private_dimux;
4611 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4612 spec->pwr_nids = stac92hd73xx_pwr_nids;
4614 err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
4617 if (spec->board_config < 0) {
4618 printk(KERN_WARNING "hda_codec: No auto-config is "
4619 "available, default to model=ref\n");
4620 spec->board_config = STAC_92HD73XX_REF;
4627 stac92xx_free(codec);
4631 codec->patch_ops = stac92xx_patch_ops;
4633 codec->proc_widget_hook = stac92hd7x_proc_hook;
4638 static struct hda_input_mux stac92hd83xxx_dmux = {
4641 { "Analog Inputs", 0x03 },
4642 { "Digital Mic 1", 0x04 },
4643 { "Digital Mic 2", 0x05 },
4647 static int patch_stac92hd83xxx(struct hda_codec *codec)
4649 struct sigmatel_spec *spec;
4652 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4657 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
4658 spec->mono_nid = 0x19;
4659 spec->digbeep_nid = 0x21;
4660 spec->dmic_nids = stac92hd83xxx_dmic_nids;
4661 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4662 spec->adc_nids = stac92hd83xxx_adc_nids;
4663 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4664 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4665 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4666 spec->multiout.dac_nids = stac92hd83xxx_dac_nids;
4668 spec->init = stac92hd83xxx_core_init;
4669 switch (codec->vendor_id) {
4671 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;
4675 spec->init++; /* switch to config #2 */
4676 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;
4679 spec->mixer = stac92hd83xxx_mixer;
4680 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4681 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4682 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4683 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4684 spec->dinput_mux = &stac92hd83xxx_dmux;
4685 spec->pin_nids = stac92hd83xxx_pin_nids;
4686 spec->board_config = snd_hda_check_board_config(codec,
4687 STAC_92HD83XXX_MODELS,
4688 stac92hd83xxx_models,
4689 stac92hd83xxx_cfg_tbl);
4691 if (spec->board_config < 0) {
4692 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4693 " STAC92HD83XXX, using BIOS defaults\n");
4694 err = stac92xx_save_bios_config_regs(codec);
4696 err = stac_save_pin_cfgs(codec,
4697 stac92hd83xxx_brd_tbl[spec->board_config]);
4699 stac92xx_free(codec);
4703 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4705 if (spec->board_config < 0) {
4706 printk(KERN_WARNING "hda_codec: No auto-config is "
4707 "available, default to model=ref\n");
4708 spec->board_config = STAC_92HD83XXX_REF;
4715 stac92xx_free(codec);
4719 codec->patch_ops = stac92xx_patch_ops;
4721 codec->proc_widget_hook = stac92hd_proc_hook;
4726 static struct hda_input_mux stac92hd71bxx_dmux = {
4729 { "Analog Inputs", 0x00 },
4731 { "Digital Mic 1", 0x02 },
4732 { "Digital Mic 2", 0x03 },
4736 static int patch_stac92hd71bxx(struct hda_codec *codec)
4738 struct sigmatel_spec *spec;
4741 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4746 codec->patch_ops = stac92xx_patch_ops;
4747 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
4748 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4749 spec->pin_nids = stac92hd71bxx_pin_nids;
4750 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux,
4751 sizeof(stac92hd71bxx_dmux));
4752 spec->board_config = snd_hda_check_board_config(codec,
4753 STAC_92HD71BXX_MODELS,
4754 stac92hd71bxx_models,
4755 stac92hd71bxx_cfg_tbl);
4757 if (spec->board_config < 0) {
4758 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4759 " STAC92HD71BXX, using BIOS defaults\n");
4760 err = stac92xx_save_bios_config_regs(codec);
4762 err = stac_save_pin_cfgs(codec,
4763 stac92hd71bxx_brd_tbl[spec->board_config]);
4765 stac92xx_free(codec);
4769 if (spec->board_config > STAC_92HD71BXX_REF) {
4771 spec->gpio_mask = 0x01;
4772 spec->gpio_dir = 0x01;
4773 spec->gpio_data = 0x01;
4776 switch (codec->vendor_id) {
4777 case 0x111d76b6: /* 4 Port without Analog Mixer */
4779 case 0x111d76b4: /* 6 Port without Analog Mixer */
4781 spec->mixer = stac92hd71bxx_mixer;
4782 spec->init = stac92hd71bxx_core_init;
4783 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4785 case 0x111d7608: /* 5 Port with Analog Mixer */
4786 switch (spec->board_config) {
4788 /* Enable VREF power saving on GPIO1 detect */
4789 err = stac_add_event(spec, codec->afg,
4790 STAC_VREF_EVENT, 0x02);
4793 snd_hda_codec_write_cache(codec, codec->afg, 0,
4794 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
4795 snd_hda_codec_write_cache(codec, codec->afg, 0,
4796 AC_VERB_SET_UNSOLICITED_ENABLE,
4798 spec->gpio_mask |= 0x02;
4801 if ((codec->revision_id & 0xf) == 0 ||
4802 (codec->revision_id & 0xf) == 1)
4803 spec->stream_delay = 40; /* 40 milliseconds */
4805 /* no output amps */
4807 spec->mixer = stac92hd71bxx_analog_mixer;
4808 spec->dinput_mux = &spec->private_dimux;
4811 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
4812 stac_change_pin_config(codec, 0xf, 0x40f000f0);
4814 case 0x111d7603: /* 6 Port with Analog Mixer */
4815 if ((codec->revision_id & 0xf) == 1)
4816 spec->stream_delay = 40; /* 40 milliseconds */
4818 /* no output amps */
4822 spec->dinput_mux = &spec->private_dimux;
4823 spec->mixer = stac92hd71bxx_analog_mixer;
4824 spec->init = stac92hd71bxx_analog_core_init;
4825 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
4828 spec->aloopback_mask = 0x50;
4829 spec->aloopback_shift = 0;
4831 spec->powerdown_adcs = 1;
4832 spec->digbeep_nid = 0x26;
4833 spec->mux_nids = stac92hd71bxx_mux_nids;
4834 spec->adc_nids = stac92hd71bxx_adc_nids;
4835 spec->dmic_nids = stac92hd71bxx_dmic_nids;
4836 spec->dmux_nids = stac92hd71bxx_dmux_nids;
4837 spec->smux_nids = stac92hd71bxx_smux_nids;
4838 spec->pwr_nids = stac92hd71bxx_pwr_nids;
4840 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
4841 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
4843 switch (spec->board_config) {
4845 /* enable internal microphone */
4846 stac_change_pin_config(codec, 0x0e, 0x01813040);
4847 stac92xx_auto_set_pinctl(codec, 0x0e,
4848 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
4850 case STAC_DELL_M4_2:
4851 spec->num_dmics = 0;
4852 spec->num_smuxes = 0;
4853 spec->num_dmuxes = 0;
4855 case STAC_DELL_M4_1:
4856 case STAC_DELL_M4_3:
4857 spec->num_dmics = 1;
4858 spec->num_smuxes = 0;
4859 spec->num_dmuxes = 0;
4862 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
4863 spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids);
4864 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
4867 spec->multiout.num_dacs = 1;
4868 spec->multiout.hp_nid = 0x11;
4869 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
4870 if (spec->dinput_mux)
4871 spec->private_dimux.num_items +=
4873 (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1);
4875 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
4877 if (spec->board_config < 0) {
4878 printk(KERN_WARNING "hda_codec: No auto-config is "
4879 "available, default to model=ref\n");
4880 spec->board_config = STAC_92HD71BXX_REF;
4887 stac92xx_free(codec);
4891 codec->proc_widget_hook = stac92hd7x_proc_hook;
4896 static int patch_stac922x(struct hda_codec *codec)
4898 struct sigmatel_spec *spec;
4901 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4906 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
4907 spec->pin_nids = stac922x_pin_nids;
4908 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
4911 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
4912 spec->gpio_mask = spec->gpio_dir = 0x03;
4913 spec->gpio_data = 0x03;
4914 /* Intel Macs have all same PCI SSID, so we need to check
4915 * codec SSID to distinguish the exact models
4917 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
4918 switch (codec->subsystem_id) {
4921 spec->board_config = STAC_INTEL_MAC_V1;
4925 spec->board_config = STAC_INTEL_MAC_V2;
4933 spec->board_config = STAC_INTEL_MAC_V3;
4937 spec->board_config = STAC_INTEL_MAC_V4;
4941 spec->board_config = STAC_INTEL_MAC_V5;
4944 spec->board_config = STAC_INTEL_MAC_V3;
4950 if (spec->board_config < 0) {
4951 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
4952 "using BIOS defaults\n");
4953 err = stac92xx_save_bios_config_regs(codec);
4955 err = stac_save_pin_cfgs(codec,
4956 stac922x_brd_tbl[spec->board_config]);
4958 stac92xx_free(codec);
4962 spec->adc_nids = stac922x_adc_nids;
4963 spec->mux_nids = stac922x_mux_nids;
4964 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
4965 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
4966 spec->num_dmics = 0;
4969 spec->init = stac922x_core_init;
4970 spec->mixer = stac922x_mixer;
4972 spec->multiout.dac_nids = spec->dac_nids;
4974 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
4976 if (spec->board_config < 0) {
4977 printk(KERN_WARNING "hda_codec: No auto-config is "
4978 "available, default to model=ref\n");
4979 spec->board_config = STAC_D945_REF;
4985 stac92xx_free(codec);
4989 codec->patch_ops = stac92xx_patch_ops;
4991 /* Fix Mux capture level; max to 2 */
4992 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4993 (0 << AC_AMPCAP_OFFSET_SHIFT) |
4994 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4995 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4996 (0 << AC_AMPCAP_MUTE_SHIFT));
5001 static int patch_stac927x(struct hda_codec *codec)
5003 struct sigmatel_spec *spec;
5006 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5011 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
5012 spec->pin_nids = stac927x_pin_nids;
5013 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
5017 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
5018 if (spec->board_config < 0)
5019 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
5020 "STAC927x, using BIOS defaults\n");
5021 err = stac92xx_save_bios_config_regs(codec);
5023 err = stac_save_pin_cfgs(codec,
5024 stac927x_brd_tbl[spec->board_config]);
5026 stac92xx_free(codec);
5030 spec->digbeep_nid = 0x23;
5031 spec->adc_nids = stac927x_adc_nids;
5032 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
5033 spec->mux_nids = stac927x_mux_nids;
5034 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
5035 spec->smux_nids = stac927x_smux_nids;
5036 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
5037 spec->spdif_labels = stac927x_spdif_labels;
5038 spec->dac_list = stac927x_dac_nids;
5039 spec->multiout.dac_nids = spec->dac_nids;
5041 switch (spec->board_config) {
5044 /* GPIO0 High = Enable EAPD */
5045 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
5046 spec->gpio_data = 0x01;
5047 spec->num_dmics = 0;
5049 spec->init = d965_core_init;
5050 spec->mixer = stac927x_mixer;
5052 case STAC_DELL_BIOS:
5053 switch (codec->subsystem_id) {
5056 /* correct the device field to SPDIF out */
5057 stac_change_pin_config(codec, 0x21, 0x01442070);
5060 /* configure the analog microphone on some laptops */
5061 stac_change_pin_config(codec, 0x0c, 0x90a79130);
5062 /* correct the front output jack as a hp out */
5063 stac_change_pin_config(codec, 0x0f, 0x0227011f);
5064 /* correct the front input jack as a mic */
5065 stac_change_pin_config(codec, 0x0e, 0x02a79130);
5068 /* GPIO2 High = Enable EAPD */
5069 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
5070 spec->gpio_data = 0x04;
5071 spec->dmic_nids = stac927x_dmic_nids;
5072 spec->num_dmics = STAC927X_NUM_DMICS;
5074 spec->init = d965_core_init;
5075 spec->mixer = stac927x_mixer;
5076 spec->dmux_nids = stac927x_dmux_nids;
5077 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5080 if (spec->board_config > STAC_D965_REF) {
5081 /* GPIO0 High = Enable EAPD */
5082 spec->eapd_mask = spec->gpio_mask = 0x01;
5083 spec->gpio_dir = spec->gpio_data = 0x01;
5085 spec->num_dmics = 0;
5087 spec->init = stac927x_core_init;
5088 spec->mixer = stac927x_mixer;
5092 spec->aloopback_mask = 0x40;
5093 spec->aloopback_shift = 0;
5094 spec->eapd_switch = 1;
5096 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
5098 if (spec->board_config < 0) {
5099 printk(KERN_WARNING "hda_codec: No auto-config is "
5100 "available, default to model=ref\n");
5101 spec->board_config = STAC_D965_REF;
5107 stac92xx_free(codec);
5111 codec->patch_ops = stac92xx_patch_ops;
5113 codec->proc_widget_hook = stac927x_proc_hook;
5117 * The STAC927x seem to require fairly long delays for certain
5118 * command sequences. With too short delays (even if the answer
5119 * is set to RIRB properly), it results in the silence output
5120 * on some hardwares like Dell.
5122 * The below flag enables the longer delay (see get_response
5125 codec->bus->needs_damn_long_delay = 1;
5130 static int patch_stac9205(struct hda_codec *codec)
5132 struct sigmatel_spec *spec;
5135 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5140 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5141 spec->pin_nids = stac9205_pin_nids;
5142 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
5146 if (spec->board_config < 0) {
5147 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
5148 err = stac92xx_save_bios_config_regs(codec);
5150 err = stac_save_pin_cfgs(codec,
5151 stac9205_brd_tbl[spec->board_config]);
5153 stac92xx_free(codec);
5157 spec->digbeep_nid = 0x23;
5158 spec->adc_nids = stac9205_adc_nids;
5159 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
5160 spec->mux_nids = stac9205_mux_nids;
5161 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
5162 spec->smux_nids = stac9205_smux_nids;
5163 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
5164 spec->dmic_nids = stac9205_dmic_nids;
5165 spec->num_dmics = STAC9205_NUM_DMICS;
5166 spec->dmux_nids = stac9205_dmux_nids;
5167 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
5170 spec->init = stac9205_core_init;
5171 spec->mixer = stac9205_mixer;
5173 spec->aloopback_mask = 0x40;
5174 spec->aloopback_shift = 0;
5175 spec->eapd_switch = 1;
5176 spec->multiout.dac_nids = spec->dac_nids;
5178 switch (spec->board_config){
5179 case STAC_9205_DELL_M43:
5180 /* Enable SPDIF in/out */
5181 stac_change_pin_config(codec, 0x1f, 0x01441030);
5182 stac_change_pin_config(codec, 0x20, 0x1c410030);
5184 /* Enable unsol response for GPIO4/Dock HP connection */
5185 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
5188 snd_hda_codec_write_cache(codec, codec->afg, 0,
5189 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
5190 snd_hda_codec_write_cache(codec, codec->afg, 0,
5191 AC_VERB_SET_UNSOLICITED_ENABLE,
5194 spec->gpio_dir = 0x0b;
5195 spec->eapd_mask = 0x01;
5196 spec->gpio_mask = 0x1b;
5197 spec->gpio_mute = 0x10;
5198 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
5201 spec->gpio_data = 0x01;
5204 /* SPDIF-In enabled */
5207 /* GPIO0 High = EAPD */
5208 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5209 spec->gpio_data = 0x01;
5213 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
5215 if (spec->board_config < 0) {
5216 printk(KERN_WARNING "hda_codec: No auto-config is "
5217 "available, default to model=ref\n");
5218 spec->board_config = STAC_9205_REF;
5224 stac92xx_free(codec);
5228 codec->patch_ops = stac92xx_patch_ops;
5230 codec->proc_widget_hook = stac9205_proc_hook;
5239 /* static config for Sony VAIO FE550G and Sony VAIO AR */
5240 static hda_nid_t vaio_dacs[] = { 0x2 };
5241 #define VAIO_HP_DAC 0x5
5242 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
5243 static hda_nid_t vaio_mux_nids[] = { 0x15 };
5245 static struct hda_input_mux vaio_mux = {
5248 /* { "HP", 0x0 }, */
5249 { "Mic Jack", 0x1 },
5250 { "Internal Mic", 0x2 },
5255 static struct hda_verb vaio_init[] = {
5256 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5257 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
5258 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5259 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5260 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5262 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5263 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5264 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5271 static struct hda_verb vaio_ar_init[] = {
5272 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5273 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5274 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5275 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5276 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
5277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5278 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5279 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5280 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5281 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
5282 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5288 static struct snd_kcontrol_new vaio_mixer[] = {
5289 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5291 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5292 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5293 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5294 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5295 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5297 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5298 .name = "Capture Source",
5300 .info = stac92xx_mux_enum_info,
5301 .get = stac92xx_mux_enum_get,
5302 .put = stac92xx_mux_enum_put,
5307 static struct snd_kcontrol_new vaio_ar_mixer[] = {
5308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5310 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5311 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5312 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5313 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5314 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5315 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
5316 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
5318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5319 .name = "Capture Source",
5321 .info = stac92xx_mux_enum_info,
5322 .get = stac92xx_mux_enum_get,
5323 .put = stac92xx_mux_enum_put,
5328 static struct hda_codec_ops stac9872_patch_ops = {
5329 .build_controls = stac92xx_build_controls,
5330 .build_pcms = stac92xx_build_pcms,
5331 .init = stac92xx_init,
5332 .free = stac92xx_free,
5333 #ifdef SND_HDA_NEEDS_RESUME
5334 .resume = stac92xx_resume,
5338 static int stac9872_vaio_init(struct hda_codec *codec)
5342 err = stac92xx_init(codec);
5345 if (codec->patch_ops.unsol_event)
5346 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
5350 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
5352 if (get_hp_pin_presence(codec, 0x0a)) {
5353 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5354 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5356 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5357 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5361 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
5363 switch (res >> 26) {
5365 stac9872_vaio_hp_detect(codec, res);
5370 static struct hda_codec_ops stac9872_vaio_patch_ops = {
5371 .build_controls = stac92xx_build_controls,
5372 .build_pcms = stac92xx_build_pcms,
5373 .init = stac9872_vaio_init,
5374 .free = stac92xx_free,
5375 .unsol_event = stac9872_vaio_unsol_event,
5377 .resume = stac92xx_resume,
5381 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
5383 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
5385 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
5387 /* AR Series. id=0x83847664 and subsys=104D1300 */
5392 static const char *stac9872_models[STAC_9872_MODELS] = {
5393 [CXD9872RD_VAIO] = "vaio",
5394 [CXD9872AKD_VAIO] = "vaio-ar",
5397 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5398 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
5399 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
5400 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
5401 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
5405 static int patch_stac9872(struct hda_codec *codec)
5407 struct sigmatel_spec *spec;
5410 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5413 if (board_config < 0)
5414 /* unknown config, let generic-parser do its job... */
5415 return snd_hda_parse_generic_codec(codec);
5417 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5422 switch (board_config) {
5423 case CXD9872RD_VAIO:
5424 case STAC9872AK_VAIO:
5425 case STAC9872K_VAIO:
5426 spec->mixer = vaio_mixer;
5427 spec->init = vaio_init;
5428 spec->multiout.max_channels = 2;
5429 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5430 spec->multiout.dac_nids = vaio_dacs;
5431 spec->multiout.hp_nid = VAIO_HP_DAC;
5432 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5433 spec->adc_nids = vaio_adcs;
5435 spec->input_mux = &vaio_mux;
5436 spec->mux_nids = vaio_mux_nids;
5437 codec->patch_ops = stac9872_vaio_patch_ops;
5440 case CXD9872AKD_VAIO:
5441 spec->mixer = vaio_ar_mixer;
5442 spec->init = vaio_ar_init;
5443 spec->multiout.max_channels = 2;
5444 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5445 spec->multiout.dac_nids = vaio_dacs;
5446 spec->multiout.hp_nid = VAIO_HP_DAC;
5447 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5449 spec->adc_nids = vaio_adcs;
5450 spec->input_mux = &vaio_mux;
5451 spec->mux_nids = vaio_mux_nids;
5452 codec->patch_ops = stac9872_patch_ops;
5463 static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5464 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5465 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5466 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
5467 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
5468 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
5469 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
5470 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
5471 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
5472 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
5473 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
5474 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
5475 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
5476 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
5477 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
5478 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
5479 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
5480 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
5481 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
5482 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
5483 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
5484 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
5485 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
5486 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
5487 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
5488 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
5489 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
5490 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
5491 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
5492 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
5493 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
5494 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
5495 /* The following does not take into account .id=0x83847661 when subsys =
5496 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
5497 * currently not fully supported.
5499 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
5500 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
5501 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
5502 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
5503 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
5504 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
5505 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
5506 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
5507 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
5508 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
5509 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
5510 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
5511 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
5512 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
5513 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
5514 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
5515 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
5516 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
5517 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5518 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5519 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5520 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5521 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5522 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5523 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5524 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5528 MODULE_ALIAS("snd-hda-codec-id:8384*");
5529 MODULE_ALIAS("snd-hda-codec-id:111d*");
5531 MODULE_LICENSE("GPL");
5532 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5534 static struct hda_codec_preset_list sigmatel_list = {
5535 .preset = snd_hda_preset_sigmatel,
5536 .owner = THIS_MODULE,
5539 static int __init patch_sigmatel_init(void)
5541 return snd_hda_add_codec_preset(&sigmatel_list);
5544 static void __exit patch_sigmatel_exit(void)
5546 snd_hda_delete_codec_preset(&sigmatel_list);
5549 module_init(patch_sigmatel_init)
5550 module_exit(patch_sigmatel_exit)