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"
77 STAC_92HD73XX_NO_JD, /* no jack-detection */
89 STAC_92HD83XXX_PWR_REF,
103 STAC_92HD71BXX_MODELS
129 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
130 * is given, one of the above models will be
131 * chosen according to the subsystem id. */
132 /* for backward compatibility */
149 STAC_D965_REF_NO_JD, /* no jack-detection */
164 struct sigmatel_event {
171 struct sigmatel_jack {
174 struct snd_jack *jack;
177 struct sigmatel_spec {
178 struct snd_kcontrol_new *mixers[4];
179 unsigned int num_mixers;
182 unsigned int eapd_switch: 1;
183 unsigned int surr_switch: 1;
184 unsigned int alt_switch: 1;
185 unsigned int hp_detect: 1;
186 unsigned int spdif_mute: 1;
187 unsigned int check_volume_offset:1;
190 unsigned int eapd_mask;
191 unsigned int gpio_mask;
192 unsigned int gpio_dir;
193 unsigned int gpio_data;
194 unsigned int gpio_mute;
197 unsigned int stream_delay;
199 /* analog loopback */
200 struct snd_kcontrol_new *aloopback_ctl;
201 unsigned char aloopback_mask;
202 unsigned char aloopback_shift;
204 /* power management */
205 unsigned int num_pwrs;
206 unsigned int *pwr_mapping;
211 struct snd_array jacks;
214 struct snd_array events;
217 struct hda_input_mux *mono_mux;
218 struct hda_input_mux *amp_mux;
219 unsigned int cur_mmux;
220 struct hda_multi_out multiout;
221 hda_nid_t dac_nids[5];
222 hda_nid_t hp_dacs[5];
223 hda_nid_t speaker_dacs[5];
229 unsigned int num_adcs;
231 unsigned int num_muxes;
232 hda_nid_t *dmic_nids;
233 unsigned int num_dmics;
234 hda_nid_t *dmux_nids;
235 unsigned int num_dmuxes;
236 hda_nid_t *smux_nids;
237 unsigned int num_smuxes;
238 const char **spdif_labels;
240 hda_nid_t dig_in_nid;
242 hda_nid_t anabeep_nid;
243 hda_nid_t digbeep_nid;
247 unsigned int num_pins;
249 /* codec specific stuff */
250 struct hda_verb *init;
251 struct snd_kcontrol_new *mixer;
254 struct hda_input_mux *dinput_mux;
255 unsigned int cur_dmux[2];
256 struct hda_input_mux *input_mux;
257 unsigned int cur_mux[3];
258 struct hda_input_mux *sinput_mux;
259 unsigned int cur_smux[2];
260 unsigned int cur_amux;
262 unsigned int num_amps;
263 unsigned int powerdown_adcs;
266 unsigned int io_switch[2];
267 unsigned int clfe_swap;
268 hda_nid_t line_switch; /* shared line-in for input and output */
269 hda_nid_t mic_switch; /* shared mic-in for input and output */
270 hda_nid_t hp_switch; /* NID of HP as line-out */
271 unsigned int aloopback;
273 struct hda_pcm pcm_rec[2]; /* PCM information */
275 /* dynamic controls and input_mux */
276 struct auto_pin_cfg autocfg;
277 struct snd_array kctls;
278 struct hda_input_mux private_dimux;
279 struct hda_input_mux private_imux;
280 struct hda_input_mux private_smux;
281 struct hda_input_mux private_amp_mux;
282 struct hda_input_mux private_mono_mux;
285 static hda_nid_t stac9200_adc_nids[1] = {
289 static hda_nid_t stac9200_mux_nids[1] = {
293 static hda_nid_t stac9200_dac_nids[1] = {
297 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
298 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
302 static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
306 static hda_nid_t stac92hd73xx_adc_nids[2] = {
310 #define DELL_M6_AMP 2
311 static hda_nid_t stac92hd73xx_amp_nids[3] = {
315 #define STAC92HD73XX_NUM_DMICS 2
316 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
320 #define STAC92HD73_DAC_COUNT 5
322 static hda_nid_t stac92hd73xx_mux_nids[4] = {
323 0x28, 0x29, 0x2a, 0x2b,
326 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
330 static hda_nid_t stac92hd73xx_smux_nids[2] = {
334 #define STAC92HD83XXX_NUM_DMICS 2
335 static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
339 #define STAC92HD83_DAC_COUNT 3
341 static hda_nid_t stac92hd83xxx_dmux_nids[2] = {
345 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
349 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
353 static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
357 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
358 0x03, 0x0c, 0x20, 0x40,
361 static hda_nid_t stac92hd83xxx_amp_nids[1] = {
365 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
369 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
373 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
377 static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
381 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
385 #define STAC92HD71BXX_NUM_DMICS 2
386 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
390 static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
394 static hda_nid_t stac925x_adc_nids[1] = {
398 static hda_nid_t stac925x_mux_nids[1] = {
402 static hda_nid_t stac925x_dac_nids[1] = {
406 #define STAC925X_NUM_DMICS 1
407 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
411 static hda_nid_t stac925x_dmux_nids[1] = {
415 static hda_nid_t stac922x_adc_nids[2] = {
419 static hda_nid_t stac922x_mux_nids[2] = {
423 static hda_nid_t stac927x_slave_dig_outs[2] = {
427 static hda_nid_t stac927x_adc_nids[3] = {
431 static hda_nid_t stac927x_mux_nids[3] = {
435 static hda_nid_t stac927x_smux_nids[1] = {
439 static hda_nid_t stac927x_dac_nids[6] = {
440 0x02, 0x03, 0x04, 0x05, 0x06, 0
443 static hda_nid_t stac927x_dmux_nids[1] = {
447 #define STAC927X_NUM_DMICS 2
448 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
452 static const char *stac927x_spdif_labels[5] = {
453 "Digital Playback", "ADAT", "Analog Mux 1",
454 "Analog Mux 2", "Analog Mux 3"
457 static hda_nid_t stac9205_adc_nids[2] = {
461 static hda_nid_t stac9205_mux_nids[2] = {
465 static hda_nid_t stac9205_dmux_nids[1] = {
469 static hda_nid_t stac9205_smux_nids[1] = {
473 #define STAC9205_NUM_DMICS 2
474 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
478 static hda_nid_t stac9200_pin_nids[8] = {
479 0x08, 0x09, 0x0d, 0x0e,
480 0x0f, 0x10, 0x11, 0x12,
483 static hda_nid_t stac925x_pin_nids[8] = {
484 0x07, 0x08, 0x0a, 0x0b,
485 0x0c, 0x0d, 0x10, 0x11,
488 static hda_nid_t stac922x_pin_nids[10] = {
489 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
490 0x0f, 0x10, 0x11, 0x15, 0x1b,
493 static hda_nid_t stac92hd73xx_pin_nids[13] = {
494 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
495 0x0f, 0x10, 0x11, 0x12, 0x13,
499 static hda_nid_t stac92hd83xxx_pin_nids[10] = {
500 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
501 0x0f, 0x10, 0x11, 0x1f, 0x20,
504 #define STAC92HD71BXX_NUM_PINS 13
505 static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
506 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
507 0x00, 0x14, 0x18, 0x19, 0x1e,
510 static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
511 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
512 0x0f, 0x14, 0x18, 0x19, 0x1e,
516 static hda_nid_t stac927x_pin_nids[14] = {
517 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
518 0x0f, 0x10, 0x11, 0x12, 0x13,
519 0x14, 0x21, 0x22, 0x23,
522 static hda_nid_t stac9205_pin_nids[12] = {
523 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
524 0x0f, 0x14, 0x16, 0x17, 0x18,
528 #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
530 static int stac92xx_amp_volume_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 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
537 kcontrol->private_value ^= get_amp_nid(kcontrol);
538 kcontrol->private_value |= nid;
540 return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
543 static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 struct sigmatel_spec *spec = codec->spec;
548 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
550 kcontrol->private_value ^= get_amp_nid(kcontrol);
551 kcontrol->private_value |= nid;
553 return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
556 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
557 struct snd_ctl_elem_info *uinfo)
559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
560 struct sigmatel_spec *spec = codec->spec;
561 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
564 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
565 struct snd_ctl_elem_value *ucontrol)
567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
568 struct sigmatel_spec *spec = codec->spec;
569 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
571 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
575 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
576 struct snd_ctl_elem_value *ucontrol)
578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
579 struct sigmatel_spec *spec = codec->spec;
580 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
582 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
583 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
586 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
587 struct snd_ctl_elem_info *uinfo)
589 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
590 struct sigmatel_spec *spec = codec->spec;
591 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
594 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
595 struct snd_ctl_elem_value *ucontrol)
597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
598 struct sigmatel_spec *spec = codec->spec;
599 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
601 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
605 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
606 struct snd_ctl_elem_value *ucontrol)
608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
609 struct sigmatel_spec *spec = codec->spec;
610 struct hda_input_mux *smux = &spec->private_smux;
611 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
615 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
616 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
620 if (spec->spdif_mute) {
622 nid = spec->multiout.dig_out_nid;
624 nid = codec->slave_dig_outs[smux_idx - 1];
625 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
629 /* un/mute SPDIF out */
630 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
636 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
639 struct sigmatel_spec *spec = codec->spec;
640 return snd_hda_input_mux_info(spec->input_mux, uinfo);
643 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
646 struct sigmatel_spec *spec = codec->spec;
647 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
649 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
653 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
656 struct sigmatel_spec *spec = codec->spec;
657 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
659 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
660 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
663 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_info *uinfo)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 struct sigmatel_spec *spec = codec->spec;
668 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
671 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
672 struct snd_ctl_elem_value *ucontrol)
674 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
675 struct sigmatel_spec *spec = codec->spec;
677 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
681 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
682 struct snd_ctl_elem_value *ucontrol)
684 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
685 struct sigmatel_spec *spec = codec->spec;
687 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
688 spec->mono_nid, &spec->cur_mmux);
691 static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
692 struct snd_ctl_elem_info *uinfo)
694 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
695 struct sigmatel_spec *spec = codec->spec;
696 return snd_hda_input_mux_info(spec->amp_mux, uinfo);
699 static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
703 struct sigmatel_spec *spec = codec->spec;
705 ucontrol->value.enumerated.item[0] = spec->cur_amux;
709 static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
710 struct snd_ctl_elem_value *ucontrol)
712 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
713 struct sigmatel_spec *spec = codec->spec;
714 struct snd_kcontrol *ctl =
715 snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
719 snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
720 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
722 return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
726 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
728 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
729 struct snd_ctl_elem_value *ucontrol)
731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
732 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
733 struct sigmatel_spec *spec = codec->spec;
735 ucontrol->value.integer.value[0] = !!(spec->aloopback &
736 (spec->aloopback_mask << idx));
740 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
741 struct snd_ctl_elem_value *ucontrol)
743 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
744 struct sigmatel_spec *spec = codec->spec;
745 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
746 unsigned int dac_mode;
747 unsigned int val, idx_val;
749 idx_val = spec->aloopback_mask << idx;
750 if (ucontrol->value.integer.value[0])
751 val = spec->aloopback | idx_val;
753 val = spec->aloopback & ~idx_val;
754 if (spec->aloopback == val)
757 spec->aloopback = val;
759 /* Only return the bits defined by the shift value of the
760 * first two bytes of the mask
762 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
763 kcontrol->private_value & 0xFFFF, 0x0);
764 dac_mode >>= spec->aloopback_shift;
766 if (spec->aloopback & idx_val) {
767 snd_hda_power_up(codec);
770 snd_hda_power_down(codec);
771 dac_mode &= ~idx_val;
774 snd_hda_codec_write_cache(codec, codec->afg, 0,
775 kcontrol->private_value >> 16, dac_mode);
780 static struct hda_verb stac9200_core_init[] = {
781 /* set dac0mux for dac converter */
782 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
786 static struct hda_verb stac9200_eapd_init[] = {
787 /* set dac0mux for dac converter */
788 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
789 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
793 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
794 /* set master volume and direct control */
795 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
796 /* setup adcs to point to mixer */
797 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
798 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
799 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
800 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
801 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
802 /* setup import muxs */
803 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
804 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
805 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
806 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
810 static struct hda_verb dell_eq_core_init[] = {
811 /* set master volume to max value without distortion
812 * and direct control */
813 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
814 /* setup adcs to point to mixer */
815 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
816 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
817 /* setup import muxs */
818 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
819 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
820 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
821 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
825 static struct hda_verb dell_m6_core_init[] = {
826 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
827 /* setup adcs to point to mixer */
828 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
829 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
830 /* setup import muxs */
831 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
832 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
833 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
834 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
838 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
839 /* set master volume and direct control */
840 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
841 /* setup adcs to point to mixer */
842 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
843 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
844 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
845 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
846 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
847 /* setup import muxs */
848 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
849 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
850 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
851 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
855 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
856 /* set master volume and direct control */
857 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
858 /* dac3 is connected to import3 mux */
859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
860 /* setup adcs to point to mixer */
861 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
862 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
863 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
864 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
865 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
866 /* setup import muxs */
867 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
868 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
869 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
870 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
874 static struct hda_verb stac92hd83xxx_core_init[] = {
875 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1},
876 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1},
877 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0},
879 /* power state controls amps */
880 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
884 static struct hda_verb stac92hd71bxx_core_init[] = {
885 /* set master volume and direct control */
886 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
890 #define HD_DISABLE_PORTF 1
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 /* start of config #2 */
898 /* set master volume and direct control */
899 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
903 static struct hda_verb stac92hd71bxx_unmute_core_init[] = {
904 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
905 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
906 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
907 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
911 static struct hda_verb stac925x_core_init[] = {
912 /* set dac0mux for dac converter */
913 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
914 /* mute the master volume */
915 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
919 static struct hda_verb stac922x_core_init[] = {
920 /* set master volume and direct control */
921 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
925 static struct hda_verb d965_core_init[] = {
926 /* set master volume and direct control */
927 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
928 /* unmute node 0x1b */
929 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
930 /* select node 0x03 as DAC */
931 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
935 static struct hda_verb stac927x_core_init[] = {
936 /* set master volume and direct control */
937 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
938 /* enable analog pc beep path */
939 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
943 static struct hda_verb stac9205_core_init[] = {
944 /* set master volume and direct control */
945 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
946 /* enable analog pc beep path */
947 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
951 #define STAC_MONO_MUX \
953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
954 .name = "Mono Mux", \
956 .info = stac92xx_mono_mux_enum_info, \
957 .get = stac92xx_mono_mux_enum_get, \
958 .put = stac92xx_mono_mux_enum_put, \
961 #define STAC_AMP_MUX \
963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
964 .name = "Amp Selector Capture Switch", \
966 .info = stac92xx_amp_mux_enum_info, \
967 .get = stac92xx_amp_mux_enum_get, \
968 .put = stac92xx_amp_mux_enum_put, \
971 #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
976 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
977 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
978 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
979 .info = stac92xx_amp_volume_info, \
980 .get = stac92xx_amp_volume_get, \
981 .put = stac92xx_amp_volume_put, \
982 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
983 .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
986 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
988 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
989 .name = "Analog Loopback", \
991 .info = stac92xx_aloopback_info, \
992 .get = stac92xx_aloopback_get, \
993 .put = stac92xx_aloopback_put, \
994 .private_value = verb_read | (verb_write << 16), \
997 static struct snd_kcontrol_new stac9200_mixer[] = {
998 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
999 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1000 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1001 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1005 #define DELL_M6_MIXER 6
1006 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1007 /* start of config #1 */
1008 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1009 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1011 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1012 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1014 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1015 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1017 /* start of config #2 */
1018 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1019 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1021 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1022 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1024 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1025 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1027 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1028 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1033 static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
1034 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1038 static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
1039 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1043 static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1044 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1048 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1049 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1050 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1052 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1053 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1055 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1056 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1058 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1059 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1061 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1062 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1064 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1065 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1067 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1068 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1072 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1073 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
1074 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
1076 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
1077 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
1079 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1080 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1082 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1083 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1085 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1086 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1088 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1089 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1091 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1092 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1097 static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
1098 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT),
1099 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT),
1101 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT),
1102 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT),
1104 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT),
1105 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT),
1107 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT),
1108 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT),
1110 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT),
1111 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT),
1113 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT),
1114 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT),
1117 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT),
1118 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT),
1123 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
1124 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1125 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1127 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1128 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1129 /* analog pc-beep replaced with digital beep support */
1131 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
1132 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
1135 HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT),
1136 HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT),
1138 HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT),
1139 HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT),
1141 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT),
1142 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT),
1144 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT),
1145 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT),
1149 static struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1150 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1153 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1154 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1155 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
1157 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1158 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
1162 static struct snd_kcontrol_new stac925x_mixer[] = {
1163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
1164 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
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 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
1172 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
1174 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
1175 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
1179 static struct snd_kcontrol_new stac9205_loopback[] = {
1180 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1184 /* This needs to be generated dynamically based on sequence */
1185 static struct snd_kcontrol_new stac922x_mixer[] = {
1186 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
1187 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
1189 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
1190 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
1195 static struct snd_kcontrol_new stac927x_mixer[] = {
1196 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
1197 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
1199 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
1200 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
1202 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
1203 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
1207 static struct snd_kcontrol_new stac927x_loopback[] = {
1208 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1212 static struct snd_kcontrol_new stac_dmux_mixer = {
1213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1214 .name = "Digital Input Source",
1215 /* count set later */
1216 .info = stac92xx_dmux_enum_info,
1217 .get = stac92xx_dmux_enum_get,
1218 .put = stac92xx_dmux_enum_put,
1221 static struct snd_kcontrol_new stac_smux_mixer = {
1222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1223 .name = "IEC958 Playback Source",
1224 /* count set later */
1225 .info = stac92xx_smux_enum_info,
1226 .get = stac92xx_smux_enum_get,
1227 .put = stac92xx_smux_enum_put,
1230 static const char *slave_vols[] = {
1231 "Front Playback Volume",
1232 "Surround Playback Volume",
1233 "Center Playback Volume",
1234 "LFE Playback Volume",
1235 "Side Playback Volume",
1236 "Headphone Playback Volume",
1237 "Speaker 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 "Speaker Playback Switch",
1249 "IEC958 Playback Switch",
1253 static void stac92xx_free_kctls(struct hda_codec *codec);
1254 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1256 static int stac92xx_build_controls(struct hda_codec *codec)
1258 struct sigmatel_spec *spec = codec->spec;
1259 struct auto_pin_cfg *cfg = &spec->autocfg;
1264 err = snd_hda_add_new_ctls(codec, spec->mixer);
1268 for (i = 0; i < spec->num_mixers; i++) {
1269 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1273 if (spec->num_dmuxes > 0) {
1274 stac_dmux_mixer.count = spec->num_dmuxes;
1275 err = snd_hda_ctl_add(codec,
1276 snd_ctl_new1(&stac_dmux_mixer, codec));
1280 if (spec->num_smuxes > 0) {
1281 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1282 struct hda_input_mux *smux = &spec->private_smux;
1283 /* check for mute support on SPDIF out */
1284 if (wcaps & AC_WCAP_OUT_AMP) {
1285 smux->items[smux->num_items].label = "Off";
1286 smux->items[smux->num_items].index = 0;
1288 spec->spdif_mute = 1;
1290 stac_smux_mixer.count = spec->num_smuxes;
1291 err = snd_hda_ctl_add(codec,
1292 snd_ctl_new1(&stac_smux_mixer, codec));
1297 if (spec->multiout.dig_out_nid) {
1298 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1301 err = snd_hda_create_spdif_share_sw(codec,
1305 spec->multiout.share_spdif = 1;
1307 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1308 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1313 /* if we have no master control, let's create it */
1314 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1315 unsigned int vmaster_tlv[4];
1316 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1317 HDA_OUTPUT, vmaster_tlv);
1318 /* correct volume offset */
1319 vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
1320 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1321 vmaster_tlv, slave_vols);
1325 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1326 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1332 if (spec->aloopback_ctl &&
1333 snd_hda_get_bool_hint(codec, "loopback") == 1) {
1334 err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl);
1339 stac92xx_free_kctls(codec); /* no longer needed */
1341 /* create jack input elements */
1342 if (spec->hp_detect) {
1343 for (i = 0; i < cfg->hp_outs; i++) {
1344 int type = SND_JACK_HEADPHONE;
1345 nid = cfg->hp_pins[i];
1346 /* jack detection */
1347 if (cfg->hp_outs == i)
1348 type |= SND_JACK_LINEOUT;
1349 err = stac92xx_add_jack(codec, nid, type);
1354 for (i = 0; i < cfg->line_outs; i++) {
1355 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1360 for (i = 0; i < AUTO_PIN_LAST; i++) {
1361 nid = cfg->input_pins[i];
1363 err = stac92xx_add_jack(codec, nid,
1364 SND_JACK_MICROPHONE);
1373 static unsigned int ref9200_pin_configs[8] = {
1374 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1375 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1378 static unsigned int gateway9200_m4_pin_configs[8] = {
1379 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1380 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1382 static unsigned int gateway9200_m4_2_pin_configs[8] = {
1383 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1384 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1388 STAC 9200 pin configs for
1393 static unsigned int dell9200_d21_pin_configs[8] = {
1394 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1395 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1399 STAC 9200 pin configs for
1403 static unsigned int dell9200_d22_pin_configs[8] = {
1404 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1405 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1409 STAC 9200 pin configs for
1410 102801C4 (Dell Dimension E310)
1417 static unsigned int dell9200_d23_pin_configs[8] = {
1418 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1419 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1424 STAC 9200-32 pin configs for
1425 102801B5 (Dell Inspiron 630m)
1426 102801D8 (Dell Inspiron 640m)
1428 static unsigned int dell9200_m21_pin_configs[8] = {
1429 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1430 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1434 STAC 9200-32 pin configs for
1435 102801C2 (Dell Latitude D620)
1437 102801CC (Dell Latitude D820)
1441 static unsigned int dell9200_m22_pin_configs[8] = {
1442 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1443 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1447 STAC 9200-32 pin configs for
1448 102801CE (Dell XPS M1710)
1449 102801CF (Dell Precision M90)
1451 static unsigned int dell9200_m23_pin_configs[8] = {
1452 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1453 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1457 STAC 9200-32 pin configs for
1460 102801CB (Dell Latitude 120L)
1463 static unsigned int dell9200_m24_pin_configs[8] = {
1464 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1465 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1469 STAC 9200-32 pin configs for
1470 102801BD (Dell Inspiron E1505n)
1474 static unsigned int dell9200_m25_pin_configs[8] = {
1475 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1476 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1480 STAC 9200-32 pin configs for
1481 102801F5 (Dell Inspiron 1501)
1484 static unsigned int dell9200_m26_pin_configs[8] = {
1485 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1486 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1491 102801CD (Dell Inspiron E1705/9400)
1493 static unsigned int dell9200_m27_pin_configs[8] = {
1494 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1495 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1498 static unsigned int oqo9200_pin_configs[8] = {
1499 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1500 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1504 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1505 [STAC_REF] = ref9200_pin_configs,
1506 [STAC_9200_OQO] = oqo9200_pin_configs,
1507 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1508 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1509 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1510 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1511 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1512 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1513 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1514 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1515 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1516 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1517 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1518 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1519 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1522 static const char *stac9200_models[STAC_9200_MODELS] = {
1523 [STAC_AUTO] = "auto",
1525 [STAC_9200_OQO] = "oqo",
1526 [STAC_9200_DELL_D21] = "dell-d21",
1527 [STAC_9200_DELL_D22] = "dell-d22",
1528 [STAC_9200_DELL_D23] = "dell-d23",
1529 [STAC_9200_DELL_M21] = "dell-m21",
1530 [STAC_9200_DELL_M22] = "dell-m22",
1531 [STAC_9200_DELL_M23] = "dell-m23",
1532 [STAC_9200_DELL_M24] = "dell-m24",
1533 [STAC_9200_DELL_M25] = "dell-m25",
1534 [STAC_9200_DELL_M26] = "dell-m26",
1535 [STAC_9200_DELL_M27] = "dell-m27",
1536 [STAC_9200_M4] = "gateway-m4",
1537 [STAC_9200_M4_2] = "gateway-m4-2",
1538 [STAC_9200_PANASONIC] = "panasonic",
1541 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1542 /* SigmaTel reference board */
1543 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1544 "DFI LanParty", STAC_REF),
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1546 "DFI LanParty", STAC_REF),
1547 /* Dell laptops have BIOS problem */
1548 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1549 "unknown Dell", STAC_9200_DELL_D21),
1550 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1551 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1552 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1553 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1554 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1555 "unknown Dell", STAC_9200_DELL_D22),
1556 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1557 "unknown Dell", STAC_9200_DELL_D22),
1558 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1559 "Dell Latitude D620", STAC_9200_DELL_M22),
1560 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1561 "unknown Dell", STAC_9200_DELL_D23),
1562 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1563 "unknown Dell", STAC_9200_DELL_D23),
1564 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1565 "unknown Dell", STAC_9200_DELL_M22),
1566 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1567 "unknown Dell", STAC_9200_DELL_M24),
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1569 "unknown Dell", STAC_9200_DELL_M24),
1570 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1571 "Dell Latitude 120L", STAC_9200_DELL_M24),
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1573 "Dell Latitude D820", STAC_9200_DELL_M22),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1575 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1577 "Dell XPS M1710", STAC_9200_DELL_M23),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1579 "Dell Precision M90", STAC_9200_DELL_M23),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1581 "unknown Dell", STAC_9200_DELL_M22),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1583 "unknown Dell", STAC_9200_DELL_M22),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1585 "unknown Dell", STAC_9200_DELL_M22),
1586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1587 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1589 "unknown Dell", STAC_9200_DELL_D23),
1590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1591 "unknown Dell", STAC_9200_DELL_D23),
1592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1593 "unknown Dell", STAC_9200_DELL_D21),
1594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1595 "unknown Dell", STAC_9200_DELL_D23),
1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1597 "unknown Dell", STAC_9200_DELL_D21),
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1599 "unknown Dell", STAC_9200_DELL_M25),
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1601 "unknown Dell", STAC_9200_DELL_M25),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1603 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1605 "unknown Dell", STAC_9200_DELL_M26),
1607 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1608 /* Gateway machines needs EAPD to be set on resume */
1609 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1610 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1611 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1613 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1617 static unsigned int ref925x_pin_configs[8] = {
1618 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1619 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1622 static unsigned int stac925xM1_pin_configs[8] = {
1623 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1624 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1627 static unsigned int stac925xM1_2_pin_configs[8] = {
1628 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1629 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1632 static unsigned int stac925xM2_pin_configs[8] = {
1633 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1634 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1637 static unsigned int stac925xM2_2_pin_configs[8] = {
1638 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1639 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1642 static unsigned int stac925xM3_pin_configs[8] = {
1643 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1644 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1647 static unsigned int stac925xM5_pin_configs[8] = {
1648 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1649 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1652 static unsigned int stac925xM6_pin_configs[8] = {
1653 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1654 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1657 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1658 [STAC_REF] = ref925x_pin_configs,
1659 [STAC_M1] = stac925xM1_pin_configs,
1660 [STAC_M1_2] = stac925xM1_2_pin_configs,
1661 [STAC_M2] = stac925xM2_pin_configs,
1662 [STAC_M2_2] = stac925xM2_2_pin_configs,
1663 [STAC_M3] = stac925xM3_pin_configs,
1664 [STAC_M5] = stac925xM5_pin_configs,
1665 [STAC_M6] = stac925xM6_pin_configs,
1668 static const char *stac925x_models[STAC_925x_MODELS] = {
1669 [STAC_925x_AUTO] = "auto",
1672 [STAC_M1_2] = "m1-2",
1674 [STAC_M2_2] = "m2-2",
1680 static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1681 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1682 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1683 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1684 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1685 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1686 /* Not sure about the brand name for those */
1687 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1688 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1689 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1690 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1694 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1695 /* SigmaTel reference board */
1696 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1697 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1698 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1700 /* Default table for unknown ID */
1701 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1706 static unsigned int ref92hd73xx_pin_configs[13] = {
1707 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1708 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1709 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1713 static unsigned int dell_m6_pin_configs[13] = {
1714 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1715 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1716 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1720 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1721 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1722 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1723 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1724 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1725 [STAC_DELL_EQ] = dell_m6_pin_configs,
1728 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1729 [STAC_92HD73XX_AUTO] = "auto",
1730 [STAC_92HD73XX_NO_JD] = "no-jd",
1731 [STAC_92HD73XX_REF] = "ref",
1732 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1733 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1734 [STAC_DELL_M6_BOTH] = "dell-m6",
1735 [STAC_DELL_EQ] = "dell-eq",
1738 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1739 /* SigmaTel reference board */
1740 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1741 "DFI LanParty", STAC_92HD73XX_REF),
1742 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1743 "DFI LanParty", STAC_92HD73XX_REF),
1744 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1745 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1746 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1747 "unknown Dell", STAC_DELL_M6_DMIC),
1748 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1749 "unknown Dell", STAC_DELL_M6_BOTH),
1750 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1751 "unknown Dell", STAC_DELL_M6_BOTH),
1752 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1753 "unknown Dell", STAC_DELL_M6_AMIC),
1754 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1755 "unknown Dell", STAC_DELL_M6_AMIC),
1756 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1757 "unknown Dell", STAC_DELL_M6_DMIC),
1758 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1759 "unknown Dell", STAC_DELL_M6_DMIC),
1760 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1761 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1762 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1763 "Dell Studio 17", STAC_DELL_M6_DMIC),
1767 static unsigned int ref92hd83xxx_pin_configs[10] = {
1768 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1769 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1770 0x01451160, 0x98560170,
1773 static unsigned int dell_s14_pin_configs[10] = {
1774 0x02214030, 0x02211010, 0x02a19020, 0x01014050,
1775 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160,
1776 0x40f000f0, 0x40f000f0,
1779 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1780 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1781 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1782 [STAC_DELL_S14] = dell_s14_pin_configs,
1785 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1786 [STAC_92HD83XXX_AUTO] = "auto",
1787 [STAC_92HD83XXX_REF] = "ref",
1788 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1789 [STAC_DELL_S14] = "dell-s14",
1792 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1793 /* SigmaTel reference board */
1794 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1795 "DFI LanParty", STAC_92HD83XXX_REF),
1796 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1797 "DFI LanParty", STAC_92HD83XXX_REF),
1798 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
1799 "unknown Dell", STAC_DELL_S14),
1803 static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1804 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1805 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1806 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1810 static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1811 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1812 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1813 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1817 static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1818 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1819 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1820 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1824 static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1825 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1826 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1827 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1831 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1832 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1833 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1834 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1835 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1836 [STAC_HP_M4] = NULL,
1837 [STAC_HP_DV5] = NULL,
1838 [STAC_HP_HDX] = NULL,
1841 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1842 [STAC_92HD71BXX_AUTO] = "auto",
1843 [STAC_92HD71BXX_REF] = "ref",
1844 [STAC_DELL_M4_1] = "dell-m4-1",
1845 [STAC_DELL_M4_2] = "dell-m4-2",
1846 [STAC_DELL_M4_3] = "dell-m4-3",
1847 [STAC_HP_M4] = "hp-m4",
1848 [STAC_HP_DV5] = "hp-dv5",
1849 [STAC_HP_HDX] = "hp-hdx",
1852 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1853 /* SigmaTel reference board */
1854 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1855 "DFI LanParty", STAC_92HD71BXX_REF),
1856 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1857 "DFI LanParty", STAC_92HD71BXX_REF),
1858 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
1860 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
1861 "HP dv4-7", STAC_HP_DV5),
1862 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
1863 "HP dv4-7", STAC_HP_DV5),
1864 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
1865 "HP HDX", STAC_HP_HDX), /* HDX18 */
1866 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1867 "HP mini 1000", STAC_HP_M4),
1868 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
1869 "HP HDX", STAC_HP_HDX), /* HDX16 */
1870 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1871 "unknown Dell", STAC_DELL_M4_1),
1872 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1873 "unknown Dell", STAC_DELL_M4_1),
1874 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1875 "unknown Dell", STAC_DELL_M4_1),
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1877 "unknown Dell", STAC_DELL_M4_1),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1879 "unknown Dell", STAC_DELL_M4_1),
1880 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1881 "unknown Dell", STAC_DELL_M4_1),
1882 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1883 "unknown Dell", STAC_DELL_M4_1),
1884 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1885 "unknown Dell", STAC_DELL_M4_2),
1886 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1887 "unknown Dell", STAC_DELL_M4_2),
1888 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1889 "unknown Dell", STAC_DELL_M4_2),
1890 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1891 "unknown Dell", STAC_DELL_M4_2),
1892 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1893 "unknown Dell", STAC_DELL_M4_3),
1897 static unsigned int ref922x_pin_configs[10] = {
1898 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1899 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1900 0x40000100, 0x40000100,
1904 STAC 922X pin configs for
1911 static unsigned int dell_922x_d81_pin_configs[10] = {
1912 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1913 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1914 0x01813122, 0x400001f2,
1918 STAC 922X pin configs for
1922 static unsigned int dell_922x_d82_pin_configs[10] = {
1923 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1924 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1925 0x01813122, 0x400001f1,
1929 STAC 922X pin configs for
1932 static unsigned int dell_922x_m81_pin_configs[10] = {
1933 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1934 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1935 0x40C003f1, 0x405003f0,
1939 STAC 9221 A1 pin configs for
1940 102801D7 (Dell XPS M1210)
1942 static unsigned int dell_922x_m82_pin_configs[10] = {
1943 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1944 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1945 0x508003f3, 0x405003f4,
1948 static unsigned int d945gtp3_pin_configs[10] = {
1949 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1950 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1951 0x02a19120, 0x40000100,
1954 static unsigned int d945gtp5_pin_configs[10] = {
1955 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1956 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1957 0x02a19320, 0x40000100,
1960 static unsigned int intel_mac_v1_pin_configs[10] = {
1961 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1962 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1963 0x400000fc, 0x400000fb,
1966 static unsigned int intel_mac_v2_pin_configs[10] = {
1967 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1968 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1969 0x400000fc, 0x400000fb,
1972 static unsigned int intel_mac_v3_pin_configs[10] = {
1973 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1974 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1975 0x400000fc, 0x400000fb,
1978 static unsigned int intel_mac_v4_pin_configs[10] = {
1979 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1980 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1981 0x400000fc, 0x400000fb,
1984 static unsigned int intel_mac_v5_pin_configs[10] = {
1985 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1986 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1987 0x400000fc, 0x400000fb,
1990 static unsigned int ecs202_pin_configs[10] = {
1991 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1992 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1993 0x9037012e, 0x40e000f2,
1996 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1997 [STAC_D945_REF] = ref922x_pin_configs,
1998 [STAC_D945GTP3] = d945gtp3_pin_configs,
1999 [STAC_D945GTP5] = d945gtp5_pin_configs,
2000 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
2001 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
2002 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
2003 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
2004 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
2005 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
2006 /* for backward compatibility */
2007 [STAC_MACMINI] = intel_mac_v3_pin_configs,
2008 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
2009 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
2010 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
2011 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
2012 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
2013 [STAC_ECS_202] = ecs202_pin_configs,
2014 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
2015 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
2016 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
2017 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
2020 static const char *stac922x_models[STAC_922X_MODELS] = {
2021 [STAC_922X_AUTO] = "auto",
2022 [STAC_D945_REF] = "ref",
2023 [STAC_D945GTP5] = "5stack",
2024 [STAC_D945GTP3] = "3stack",
2025 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
2026 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
2027 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
2028 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
2029 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
2030 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
2031 /* for backward compatibility */
2032 [STAC_MACMINI] = "macmini",
2033 [STAC_MACBOOK] = "macbook",
2034 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
2035 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
2036 [STAC_IMAC_INTEL] = "imac-intel",
2037 [STAC_IMAC_INTEL_20] = "imac-intel-20",
2038 [STAC_ECS_202] = "ecs202",
2039 [STAC_922X_DELL_D81] = "dell-d81",
2040 [STAC_922X_DELL_D82] = "dell-d82",
2041 [STAC_922X_DELL_M81] = "dell-m81",
2042 [STAC_922X_DELL_M82] = "dell-m82",
2045 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
2046 /* SigmaTel reference board */
2047 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2048 "DFI LanParty", STAC_D945_REF),
2049 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2050 "DFI LanParty", STAC_D945_REF),
2051 /* Intel 945G based systems */
2052 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
2053 "Intel D945G", STAC_D945GTP3),
2054 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
2055 "Intel D945G", STAC_D945GTP3),
2056 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
2057 "Intel D945G", STAC_D945GTP3),
2058 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
2059 "Intel D945G", STAC_D945GTP3),
2060 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
2061 "Intel D945G", STAC_D945GTP3),
2062 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
2063 "Intel D945G", STAC_D945GTP3),
2064 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
2065 "Intel D945G", STAC_D945GTP3),
2066 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
2067 "Intel D945G", STAC_D945GTP3),
2068 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
2069 "Intel D945G", STAC_D945GTP3),
2070 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
2071 "Intel D945G", STAC_D945GTP3),
2072 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
2073 "Intel D945G", STAC_D945GTP3),
2074 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
2075 "Intel D945G", STAC_D945GTP3),
2076 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
2077 "Intel D945G", STAC_D945GTP3),
2078 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
2079 "Intel D945G", STAC_D945GTP3),
2080 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
2081 "Intel D945G", STAC_D945GTP3),
2082 /* Intel D945G 5-stack systems */
2083 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
2084 "Intel D945G", STAC_D945GTP5),
2085 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
2086 "Intel D945G", STAC_D945GTP5),
2087 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
2088 "Intel D945G", STAC_D945GTP5),
2089 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
2090 "Intel D945G", STAC_D945GTP5),
2091 /* Intel 945P based systems */
2092 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
2093 "Intel D945P", STAC_D945GTP3),
2094 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
2095 "Intel D945P", STAC_D945GTP3),
2096 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
2097 "Intel D945P", STAC_D945GTP3),
2098 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
2099 "Intel D945P", STAC_D945GTP3),
2100 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
2101 "Intel D945P", STAC_D945GTP3),
2102 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2103 "Intel D945P", STAC_D945GTP5),
2105 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
2106 "Intel D945", STAC_D945_REF),
2108 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2109 SND_PCI_QUIRK(0x8384, 0x7680,
2110 "Mac", STAC_INTEL_MAC_AUTO),
2112 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2113 "unknown Dell", STAC_922X_DELL_D81),
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2115 "unknown Dell", STAC_922X_DELL_D81),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2117 "unknown Dell", STAC_922X_DELL_D81),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2119 "unknown Dell", STAC_922X_DELL_D82),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2121 "unknown Dell", STAC_922X_DELL_M81),
2122 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2123 "unknown Dell", STAC_922X_DELL_D82),
2124 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2125 "unknown Dell", STAC_922X_DELL_D81),
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2127 "unknown Dell", STAC_922X_DELL_D81),
2128 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2129 "Dell XPS M1210", STAC_922X_DELL_M82),
2130 /* ECS/PC Chips boards */
2131 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2132 "ECS/PC chips", STAC_ECS_202),
2136 static unsigned int ref927x_pin_configs[14] = {
2137 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2138 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2139 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2140 0x01c42190, 0x40000100,
2143 static unsigned int d965_3st_pin_configs[14] = {
2144 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2145 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2146 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2147 0x40000100, 0x40000100
2150 static unsigned int d965_5st_pin_configs[14] = {
2151 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2152 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2153 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2154 0x40000100, 0x40000100
2157 static unsigned int dell_3st_pin_configs[14] = {
2158 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2159 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2160 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2161 0x40c003fc, 0x40000100
2164 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2165 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2166 [STAC_D965_REF] = ref927x_pin_configs,
2167 [STAC_D965_3ST] = d965_3st_pin_configs,
2168 [STAC_D965_5ST] = d965_5st_pin_configs,
2169 [STAC_DELL_3ST] = dell_3st_pin_configs,
2170 [STAC_DELL_BIOS] = NULL,
2173 static const char *stac927x_models[STAC_927X_MODELS] = {
2174 [STAC_927X_AUTO] = "auto",
2175 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2176 [STAC_D965_REF] = "ref",
2177 [STAC_D965_3ST] = "3stack",
2178 [STAC_D965_5ST] = "5stack",
2179 [STAC_DELL_3ST] = "dell-3stack",
2180 [STAC_DELL_BIOS] = "dell-bios",
2183 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2184 /* SigmaTel reference board */
2185 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2186 "DFI LanParty", STAC_D965_REF),
2187 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2188 "DFI LanParty", STAC_D965_REF),
2189 /* Intel 946 based systems */
2190 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2191 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2192 /* 965 based 3 stack systems */
2193 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
2194 "Intel D965", STAC_D965_3ST),
2195 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
2196 "Intel D965", STAC_D965_3ST),
2197 /* Dell 3 stack systems */
2198 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2199 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2200 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2201 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2202 /* Dell 3 stack systems with verb table in BIOS */
2203 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2204 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2205 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2206 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
2207 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2208 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2209 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2210 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2211 /* 965 based 5 stack systems */
2212 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
2213 "Intel D965", STAC_D965_5ST),
2214 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
2215 "Intel D965", STAC_D965_5ST),
2219 static unsigned int ref9205_pin_configs[12] = {
2220 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2221 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2222 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2226 STAC 9205 pin configs for
2233 10280228 (Dell Vostro 1500)
2235 static unsigned int dell_9205_m42_pin_configs[12] = {
2236 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2237 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2238 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2242 STAC 9205 pin configs for
2246 102801FF (Dell Precision M4300)
2251 static unsigned int dell_9205_m43_pin_configs[12] = {
2252 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2253 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2254 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2257 static unsigned int dell_9205_m44_pin_configs[12] = {
2258 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2259 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2260 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2263 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2264 [STAC_9205_REF] = ref9205_pin_configs,
2265 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2266 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2267 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2268 [STAC_9205_EAPD] = NULL,
2271 static const char *stac9205_models[STAC_9205_MODELS] = {
2272 [STAC_9205_AUTO] = "auto",
2273 [STAC_9205_REF] = "ref",
2274 [STAC_9205_DELL_M42] = "dell-m42",
2275 [STAC_9205_DELL_M43] = "dell-m43",
2276 [STAC_9205_DELL_M44] = "dell-m44",
2277 [STAC_9205_EAPD] = "eapd",
2280 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2281 /* SigmaTel reference board */
2282 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2283 "DFI LanParty", STAC_9205_REF),
2284 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2285 "DFI LanParty", STAC_9205_REF),
2287 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2288 "unknown Dell", STAC_9205_DELL_M42),
2289 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2290 "unknown Dell", STAC_9205_DELL_M42),
2291 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2292 "Dell Precision", STAC_9205_DELL_M43),
2293 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2294 "Dell Precision", STAC_9205_DELL_M43),
2295 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2296 "Dell Precision", STAC_9205_DELL_M43),
2297 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2298 "unknown Dell", STAC_9205_DELL_M42),
2299 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2300 "unknown Dell", STAC_9205_DELL_M42),
2301 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2302 "Dell Precision", STAC_9205_DELL_M43),
2303 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2304 "Dell Precision M4300", STAC_9205_DELL_M43),
2305 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2306 "unknown Dell", STAC_9205_DELL_M42),
2307 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2308 "Dell Precision", STAC_9205_DELL_M43),
2309 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2310 "Dell Precision", STAC_9205_DELL_M43),
2311 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2312 "Dell Precision", STAC_9205_DELL_M43),
2313 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2314 "Dell Inspiron", STAC_9205_DELL_M44),
2315 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2316 "Dell Vostro 1500", STAC_9205_DELL_M42),
2318 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2322 static void stac92xx_set_config_regs(struct hda_codec *codec,
2323 unsigned int *pincfgs)
2326 struct sigmatel_spec *spec = codec->spec;
2331 for (i = 0; i < spec->num_pins; i++)
2332 if (spec->pin_nids[i] && pincfgs[i])
2333 snd_hda_codec_set_pincfg(codec, spec->pin_nids[i],
2338 * Analog playback callbacks
2340 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2341 struct hda_codec *codec,
2342 struct snd_pcm_substream *substream)
2344 struct sigmatel_spec *spec = codec->spec;
2345 if (spec->stream_delay)
2346 msleep(spec->stream_delay);
2347 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2351 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2352 struct hda_codec *codec,
2353 unsigned int stream_tag,
2354 unsigned int format,
2355 struct snd_pcm_substream *substream)
2357 struct sigmatel_spec *spec = codec->spec;
2358 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2361 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2362 struct hda_codec *codec,
2363 struct snd_pcm_substream *substream)
2365 struct sigmatel_spec *spec = codec->spec;
2366 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2370 * Digital playback callbacks
2372 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2373 struct hda_codec *codec,
2374 struct snd_pcm_substream *substream)
2376 struct sigmatel_spec *spec = codec->spec;
2377 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2380 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2381 struct hda_codec *codec,
2382 struct snd_pcm_substream *substream)
2384 struct sigmatel_spec *spec = codec->spec;
2385 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2388 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2389 struct hda_codec *codec,
2390 unsigned int stream_tag,
2391 unsigned int format,
2392 struct snd_pcm_substream *substream)
2394 struct sigmatel_spec *spec = codec->spec;
2395 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2396 stream_tag, format, substream);
2399 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2400 struct hda_codec *codec,
2401 struct snd_pcm_substream *substream)
2403 struct sigmatel_spec *spec = codec->spec;
2404 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2409 * Analog capture callbacks
2411 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2412 struct hda_codec *codec,
2413 unsigned int stream_tag,
2414 unsigned int format,
2415 struct snd_pcm_substream *substream)
2417 struct sigmatel_spec *spec = codec->spec;
2418 hda_nid_t nid = spec->adc_nids[substream->number];
2420 if (spec->powerdown_adcs) {
2422 snd_hda_codec_write(codec, nid, 0,
2423 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2425 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2429 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2430 struct hda_codec *codec,
2431 struct snd_pcm_substream *substream)
2433 struct sigmatel_spec *spec = codec->spec;
2434 hda_nid_t nid = spec->adc_nids[substream->number];
2436 snd_hda_codec_cleanup_stream(codec, nid);
2437 if (spec->powerdown_adcs)
2438 snd_hda_codec_write(codec, nid, 0,
2439 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2443 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2447 /* NID is set in stac92xx_build_pcms */
2449 .open = stac92xx_dig_playback_pcm_open,
2450 .close = stac92xx_dig_playback_pcm_close,
2451 .prepare = stac92xx_dig_playback_pcm_prepare,
2452 .cleanup = stac92xx_dig_playback_pcm_cleanup
2456 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2460 /* NID is set in stac92xx_build_pcms */
2463 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2467 .nid = 0x02, /* NID to query formats and rates */
2469 .open = stac92xx_playback_pcm_open,
2470 .prepare = stac92xx_playback_pcm_prepare,
2471 .cleanup = stac92xx_playback_pcm_cleanup
2475 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2479 .nid = 0x06, /* NID to query formats and rates */
2481 .open = stac92xx_playback_pcm_open,
2482 .prepare = stac92xx_playback_pcm_prepare,
2483 .cleanup = stac92xx_playback_pcm_cleanup
2487 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2490 /* NID + .substreams is set in stac92xx_build_pcms */
2492 .prepare = stac92xx_capture_pcm_prepare,
2493 .cleanup = stac92xx_capture_pcm_cleanup
2497 static int stac92xx_build_pcms(struct hda_codec *codec)
2499 struct sigmatel_spec *spec = codec->spec;
2500 struct hda_pcm *info = spec->pcm_rec;
2502 codec->num_pcms = 1;
2503 codec->pcm_info = info;
2505 info->name = "STAC92xx Analog";
2506 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2507 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2508 spec->multiout.dac_nids[0];
2509 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2510 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2511 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2513 if (spec->alt_switch) {
2516 info->name = "STAC92xx Analog Alt";
2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2520 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2523 info->name = "STAC92xx Digital";
2524 info->pcm_type = spec->autocfg.dig_out_type[0];
2525 if (spec->multiout.dig_out_nid) {
2526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2527 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2529 if (spec->dig_in_nid) {
2530 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2531 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2538 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2540 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2541 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2542 if (pincap & AC_PINCAP_VREF_100)
2543 return AC_PINCTL_VREF_100;
2544 if (pincap & AC_PINCAP_VREF_80)
2545 return AC_PINCTL_VREF_80;
2546 if (pincap & AC_PINCAP_VREF_50)
2547 return AC_PINCTL_VREF_50;
2548 if (pincap & AC_PINCAP_VREF_GRD)
2549 return AC_PINCTL_VREF_GRD;
2553 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2556 snd_hda_codec_write_cache(codec, nid, 0,
2557 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2560 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2562 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2563 struct snd_ctl_elem_value *ucontrol)
2565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2566 struct sigmatel_spec *spec = codec->spec;
2568 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2572 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
2573 unsigned char type);
2575 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2576 struct snd_ctl_elem_value *ucontrol)
2578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2579 struct sigmatel_spec *spec = codec->spec;
2580 int nid = kcontrol->private_value;
2582 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2584 /* check to be sure that the ports are upto date with
2587 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2592 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2594 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2597 struct sigmatel_spec *spec = codec->spec;
2598 int io_idx = kcontrol-> private_value & 0xff;
2600 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2604 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2606 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2607 struct sigmatel_spec *spec = codec->spec;
2608 hda_nid_t nid = kcontrol->private_value >> 8;
2609 int io_idx = kcontrol-> private_value & 0xff;
2610 unsigned short val = !!ucontrol->value.integer.value[0];
2612 spec->io_switch[io_idx] = val;
2615 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2617 unsigned int pinctl = AC_PINCTL_IN_EN;
2618 if (io_idx) /* set VREF for mic */
2619 pinctl |= stac92xx_get_vref(codec, nid);
2620 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2623 /* check the auto-mute again: we need to mute/unmute the speaker
2624 * appropriately according to the pin direction
2626 if (spec->hp_detect)
2627 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);
2632 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2634 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2635 struct snd_ctl_elem_value *ucontrol)
2637 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2638 struct sigmatel_spec *spec = codec->spec;
2640 ucontrol->value.integer.value[0] = spec->clfe_swap;
2644 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2645 struct snd_ctl_elem_value *ucontrol)
2647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2648 struct sigmatel_spec *spec = codec->spec;
2649 hda_nid_t nid = kcontrol->private_value & 0xff;
2650 unsigned int val = !!ucontrol->value.integer.value[0];
2652 if (spec->clfe_swap == val)
2655 spec->clfe_swap = val;
2657 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2658 spec->clfe_swap ? 0x4 : 0x0);
2663 #define STAC_CODEC_HP_SWITCH(xname) \
2664 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2667 .info = stac92xx_hp_switch_info, \
2668 .get = stac92xx_hp_switch_get, \
2669 .put = stac92xx_hp_switch_put, \
2672 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2673 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2676 .info = stac92xx_io_switch_info, \
2677 .get = stac92xx_io_switch_get, \
2678 .put = stac92xx_io_switch_put, \
2679 .private_value = xpval, \
2682 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2686 .info = stac92xx_clfe_switch_info, \
2687 .get = stac92xx_clfe_switch_get, \
2688 .put = stac92xx_clfe_switch_put, \
2689 .private_value = xpval, \
2693 STAC_CTL_WIDGET_VOL,
2694 STAC_CTL_WIDGET_MUTE,
2695 STAC_CTL_WIDGET_MONO_MUX,
2696 STAC_CTL_WIDGET_AMP_MUX,
2697 STAC_CTL_WIDGET_AMP_VOL,
2698 STAC_CTL_WIDGET_HP_SWITCH,
2699 STAC_CTL_WIDGET_IO_SWITCH,
2700 STAC_CTL_WIDGET_CLFE_SWITCH
2703 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2704 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2705 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2708 STAC_AMP_VOL(NULL, 0, 0, 0, 0),
2709 STAC_CODEC_HP_SWITCH(NULL),
2710 STAC_CODEC_IO_SWITCH(NULL, 0),
2711 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2714 /* add dynamic controls */
2715 static struct snd_kcontrol_new *
2716 stac_control_new(struct sigmatel_spec *spec,
2717 struct snd_kcontrol_new *ktemp,
2720 struct snd_kcontrol_new *knew;
2722 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2723 knew = snd_array_new(&spec->kctls);
2727 knew->name = kstrdup(name, GFP_KERNEL);
2730 memset(knew, 0, sizeof(*knew));
2731 spec->kctls.alloced--;
2737 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2738 struct snd_kcontrol_new *ktemp,
2739 int idx, const char *name,
2742 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name);
2746 knew->private_value = val;
2750 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2751 int type, int idx, const char *name,
2754 return stac92xx_add_control_temp(spec,
2755 &stac92xx_control_templates[type],
2760 /* add dynamic controls */
2761 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2762 const char *name, unsigned long val)
2764 return stac92xx_add_control_idx(spec, type, 0, name, val);
2767 static struct snd_kcontrol_new stac_input_src_temp = {
2768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2769 .name = "Input Source",
2770 .info = stac92xx_mux_enum_info,
2771 .get = stac92xx_mux_enum_get,
2772 .put = stac92xx_mux_enum_put,
2775 static int stac92xx_add_input_source(struct sigmatel_spec *spec)
2777 struct snd_kcontrol_new *knew;
2778 struct hda_input_mux *imux = &spec->private_imux;
2780 if (!spec->num_adcs || imux->num_items <= 1)
2781 return 0; /* no need for input source control */
2782 knew = stac_control_new(spec, &stac_input_src_temp,
2783 stac_input_src_temp.name);
2786 knew->count = spec->num_adcs;
2790 /* check whether the line-input can be used as line-out */
2791 static hda_nid_t check_line_out_switch(struct hda_codec *codec)
2793 struct sigmatel_spec *spec = codec->spec;
2794 struct auto_pin_cfg *cfg = &spec->autocfg;
2796 unsigned int pincap;
2798 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2800 nid = cfg->input_pins[AUTO_PIN_LINE];
2801 pincap = snd_hda_query_pin_caps(codec, nid);
2802 if (pincap & AC_PINCAP_OUT)
2807 /* check whether the mic-input can be used as line-out */
2808 static hda_nid_t check_mic_out_switch(struct hda_codec *codec)
2810 struct sigmatel_spec *spec = codec->spec;
2811 struct auto_pin_cfg *cfg = &spec->autocfg;
2812 unsigned int def_conf, pincap;
2813 unsigned int mic_pin;
2815 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2817 mic_pin = AUTO_PIN_MIC;
2819 hda_nid_t nid = cfg->input_pins[mic_pin];
2820 def_conf = snd_hda_codec_get_pincfg(codec, nid);
2821 /* some laptops have an internal analog microphone
2822 * which can't be used as a output */
2823 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2824 pincap = snd_hda_query_pin_caps(codec, nid);
2825 if (pincap & AC_PINCAP_OUT)
2828 if (mic_pin == AUTO_PIN_MIC)
2829 mic_pin = AUTO_PIN_FRONT_MIC;
2836 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2840 for (i = 0; i < spec->multiout.num_dacs; i++) {
2841 if (spec->multiout.dac_nids[i] == nid)
2848 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2851 if (is_in_dac_nids(spec, nid))
2853 for (i = 0; i < spec->autocfg.hp_outs; i++)
2854 if (spec->hp_dacs[i] == nid)
2856 for (i = 0; i < spec->autocfg.speaker_outs; i++)
2857 if (spec->speaker_dacs[i] == nid)
2862 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
2864 struct sigmatel_spec *spec = codec->spec;
2866 hda_nid_t conn[HDA_MAX_CONNECTIONS];
2867 unsigned int wcaps, wtype;
2869 conn_len = snd_hda_get_connections(codec, nid, conn,
2870 HDA_MAX_CONNECTIONS);
2871 for (j = 0; j < conn_len; j++) {
2872 wcaps = snd_hda_param_read(codec, conn[j],
2873 AC_PAR_AUDIO_WIDGET_CAP);
2874 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2875 /* we check only analog outputs */
2876 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))
2878 /* if this route has a free DAC, assign it */
2879 if (!check_all_dac_nids(spec, conn[j])) {
2881 /* select this DAC in the pin's input mux */
2882 snd_hda_codec_write_cache(codec, nid, 0,
2883 AC_VERB_SET_CONNECT_SEL, j);
2888 /* if all DACs are already assigned, connect to the primary DAC */
2890 for (j = 0; j < conn_len; j++) {
2891 if (conn[j] == spec->multiout.dac_nids[0]) {
2892 snd_hda_codec_write_cache(codec, nid, 0,
2893 AC_VERB_SET_CONNECT_SEL, j);
2901 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
2902 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
2905 * Fill in the dac_nids table from the parsed pin configuration
2906 * This function only works when every pin in line_out_pins[]
2907 * contains atleast one DAC in its connection list. Some 92xx
2908 * codecs are not connected directly to a DAC, such as the 9200
2909 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2911 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec)
2913 struct sigmatel_spec *spec = codec->spec;
2914 struct auto_pin_cfg *cfg = &spec->autocfg;
2918 for (i = 0; i < cfg->line_outs; i++) {
2919 nid = cfg->line_out_pins[i];
2920 dac = get_unassigned_dac(codec, nid);
2922 if (spec->multiout.num_dacs > 0) {
2923 /* we have already working output pins,
2924 * so let's drop the broken ones again
2926 cfg->line_outs = spec->multiout.num_dacs;
2929 /* error out, no available DAC found */
2931 "%s: No available DAC for pin 0x%x\n",
2935 add_spec_dacs(spec, dac);
2938 for (i = 0; i < cfg->hp_outs; i++) {
2939 nid = cfg->hp_pins[i];
2940 dac = get_unassigned_dac(codec, nid);
2942 if (!spec->multiout.hp_nid)
2943 spec->multiout.hp_nid = dac;
2945 add_spec_extra_dacs(spec, dac);
2947 spec->hp_dacs[i] = dac;
2950 for (i = 0; i < cfg->speaker_outs; i++) {
2951 nid = cfg->speaker_pins[i];
2952 dac = get_unassigned_dac(codec, nid);
2954 add_spec_extra_dacs(spec, dac);
2955 spec->speaker_dacs[i] = dac;
2958 /* add line-in as output */
2959 nid = check_line_out_switch(codec);
2961 dac = get_unassigned_dac(codec, nid);
2963 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
2964 nid, cfg->line_outs);
2965 cfg->line_out_pins[cfg->line_outs] = nid;
2967 spec->line_switch = nid;
2968 add_spec_dacs(spec, dac);
2971 /* add mic as output */
2972 nid = check_mic_out_switch(codec);
2974 dac = get_unassigned_dac(codec, nid);
2976 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
2977 nid, cfg->line_outs);
2978 cfg->line_out_pins[cfg->line_outs] = nid;
2980 spec->mic_switch = nid;
2981 add_spec_dacs(spec, dac);
2985 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2986 spec->multiout.num_dacs,
2987 spec->multiout.dac_nids[0],
2988 spec->multiout.dac_nids[1],
2989 spec->multiout.dac_nids[2],
2990 spec->multiout.dac_nids[3],
2991 spec->multiout.dac_nids[4]);
2996 /* create volume control/switch for the given prefx type */
2997 static int create_controls_idx(struct hda_codec *codec, const char *pfx,
2998 int idx, hda_nid_t nid, int chs)
3000 struct sigmatel_spec *spec = codec->spec;
3004 if (!spec->check_volume_offset) {
3005 unsigned int caps, step, nums, db_scale;
3006 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3007 step = (caps & AC_AMPCAP_STEP_SIZE) >>
3008 AC_AMPCAP_STEP_SIZE_SHIFT;
3009 step = (step + 1) * 25; /* in .01dB unit */
3010 nums = (caps & AC_AMPCAP_NUM_STEPS) >>
3011 AC_AMPCAP_NUM_STEPS_SHIFT;
3012 db_scale = nums * step;
3013 /* if dB scale is over -64dB, and finer enough,
3014 * let's reduce it to half
3016 if (db_scale > 6400 && nums >= 0x1f)
3017 spec->volume_offset = nums / 2;
3018 spec->check_volume_offset = 1;
3021 sprintf(name, "%s Playback Volume", pfx);
3022 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name,
3023 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT,
3024 spec->volume_offset));
3027 sprintf(name, "%s Playback Switch", pfx);
3028 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name,
3029 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
3035 #define create_controls(codec, pfx, nid, chs) \
3036 create_controls_idx(codec, pfx, 0, nid, chs)
3038 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3040 if (spec->multiout.num_dacs > 4) {
3041 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
3044 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
3045 spec->multiout.num_dacs++;
3050 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3053 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) {
3054 if (!spec->multiout.extra_out_nid[i]) {
3055 spec->multiout.extra_out_nid[i] = nid;
3059 printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid);
3063 /* Create output controls
3064 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
3066 static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3067 const hda_nid_t *pins,
3068 const hda_nid_t *dac_nids,
3071 struct sigmatel_spec *spec = codec->spec;
3072 static const char *chname[4] = {
3073 "Front", "Surround", NULL /*CLFE*/, "Side"
3077 unsigned int wid_caps;
3079 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
3083 if (type != AUTO_PIN_HP_OUT && i == 2) {
3085 err = create_controls(codec, "Center", nid, 1);
3088 err = create_controls(codec, "LFE", nid, 2);
3092 wid_caps = get_wcaps(codec, nid);
3094 if (wid_caps & AC_WCAP_LR_SWAP) {
3095 err = stac92xx_add_control(spec,
3096 STAC_CTL_WIDGET_CLFE_SWITCH,
3097 "Swap Center/LFE Playback Switch", nid);
3107 case AUTO_PIN_HP_OUT:
3111 case AUTO_PIN_SPEAKER_OUT:
3120 err = create_controls_idx(codec, name, idx, nid, 3);
3123 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
3124 wid_caps = get_wcaps(codec, pins[i]);
3125 if (wid_caps & AC_WCAP_UNSOL_CAP)
3126 spec->hp_detect = 1;
3133 /* add playback controls from the parsed DAC table */
3134 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
3135 const struct auto_pin_cfg *cfg)
3137 struct sigmatel_spec *spec = codec->spec;
3140 err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins,
3141 spec->multiout.dac_nids,
3142 cfg->line_out_type);
3146 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
3147 err = stac92xx_add_control(spec,
3148 STAC_CTL_WIDGET_HP_SWITCH,
3149 "Headphone as Line Out Switch",
3150 cfg->hp_pins[cfg->hp_outs - 1]);
3155 if (spec->line_switch) {
3156 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH,
3157 "Line In as Output Switch",
3158 spec->line_switch << 8);
3163 if (spec->mic_switch) {
3164 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH,
3165 "Mic as Output Switch",
3166 (spec->mic_switch << 8) | 1);
3174 /* add playback controls for Speaker and HP outputs */
3175 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3176 struct auto_pin_cfg *cfg)
3178 struct sigmatel_spec *spec = codec->spec;
3181 err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins,
3182 spec->hp_dacs, AUTO_PIN_HP_OUT);
3186 err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins,
3187 spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT);
3194 /* labels for mono mux outputs */
3195 static const char *stac92xx_mono_labels[4] = {
3196 "DAC0", "DAC1", "Mixer", "DAC2"
3199 /* create mono mux for mono out on capable codecs */
3200 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3202 struct sigmatel_spec *spec = codec->spec;
3203 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3205 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3207 num_cons = snd_hda_get_connections(codec,
3210 HDA_MAX_NUM_INPUTS);
3211 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3214 for (i = 0; i < num_cons; i++) {
3215 mono_mux->items[mono_mux->num_items].label =
3216 stac92xx_mono_labels[i];
3217 mono_mux->items[mono_mux->num_items].index = i;
3218 mono_mux->num_items++;
3221 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3222 "Mono Mux", spec->mono_nid);
3225 /* labels for amp mux outputs */
3226 static const char *stac92xx_amp_labels[3] = {
3227 "Front Microphone", "Microphone", "Line In",
3230 /* create amp out controls mux on capable codecs */
3231 static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
3233 struct sigmatel_spec *spec = codec->spec;
3234 struct hda_input_mux *amp_mux = &spec->private_amp_mux;
3237 for (i = 0; i < spec->num_amps; i++) {
3238 amp_mux->items[amp_mux->num_items].label =
3239 stac92xx_amp_labels[i];
3240 amp_mux->items[amp_mux->num_items].index = i;
3241 amp_mux->num_items++;
3244 if (spec->num_amps > 1) {
3245 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
3246 "Amp Selector Capture Switch", 0);
3250 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
3251 "Amp Capture Volume",
3252 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
3256 /* create PC beep volume controls */
3257 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3260 struct sigmatel_spec *spec = codec->spec;
3261 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3264 /* check for mute support for the the amp */
3265 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3266 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3267 "PC Beep Playback Switch",
3268 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3273 /* check to see if there is volume support for the amp */
3274 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3275 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3276 "PC Beep Playback Volume",
3277 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3284 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3285 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3287 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3288 struct snd_ctl_elem_value *ucontrol)
3290 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3291 ucontrol->value.integer.value[0] = codec->beep->enabled;
3295 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3296 struct snd_ctl_elem_value *ucontrol)
3298 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3299 int enabled = !!ucontrol->value.integer.value[0];
3300 if (codec->beep->enabled != enabled) {
3301 codec->beep->enabled = enabled;
3307 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3309 .info = stac92xx_dig_beep_switch_info,
3310 .get = stac92xx_dig_beep_switch_get,
3311 .put = stac92xx_dig_beep_switch_put,
3314 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3316 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3317 0, "PC Beep Playback Switch", 0);
3321 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3323 struct sigmatel_spec *spec = codec->spec;
3324 int wcaps, nid, i, err = 0;
3326 for (i = 0; i < spec->num_muxes; i++) {
3327 nid = spec->mux_nids[i];
3328 wcaps = get_wcaps(codec, nid);
3330 if (wcaps & AC_WCAP_OUT_AMP) {
3331 err = stac92xx_add_control_idx(spec,
3332 STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume",
3333 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3341 static const char *stac92xx_spdif_labels[3] = {
3342 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3345 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3347 struct sigmatel_spec *spec = codec->spec;
3348 struct hda_input_mux *spdif_mux = &spec->private_smux;
3349 const char **labels = spec->spdif_labels;
3351 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3353 num_cons = snd_hda_get_connections(codec,
3356 HDA_MAX_NUM_INPUTS);
3361 labels = stac92xx_spdif_labels;
3363 for (i = 0; i < num_cons; i++) {
3364 spdif_mux->items[spdif_mux->num_items].label = labels[i];
3365 spdif_mux->items[spdif_mux->num_items].index = i;
3366 spdif_mux->num_items++;
3372 /* labels for dmic mux inputs */
3373 static const char *stac92xx_dmic_labels[5] = {
3374 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3375 "Digital Mic 3", "Digital Mic 4"
3378 /* create playback/capture controls for input pins on dmic capable codecs */
3379 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3380 const struct auto_pin_cfg *cfg)
3382 struct sigmatel_spec *spec = codec->spec;
3383 struct hda_input_mux *dimux = &spec->private_dimux;
3384 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3388 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
3389 dimux->items[dimux->num_items].index = 0;
3392 for (i = 0; i < spec->num_dmics; i++) {
3397 unsigned int def_conf;
3399 def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]);
3400 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3403 nid = spec->dmic_nids[i];
3404 num_cons = snd_hda_get_connections(codec,
3407 HDA_MAX_NUM_INPUTS);
3408 for (j = 0; j < num_cons; j++)
3409 if (con_lst[j] == nid) {
3415 wcaps = get_wcaps(codec, nid) &
3416 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3419 sprintf(name, "%s Capture Volume",
3420 stac92xx_dmic_labels[dimux->num_items]);
3422 err = stac92xx_add_control(spec,
3423 STAC_CTL_WIDGET_VOL,
3425 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3426 (wcaps & AC_WCAP_OUT_AMP) ?
3427 HDA_OUTPUT : HDA_INPUT));
3432 dimux->items[dimux->num_items].label =
3433 stac92xx_dmic_labels[dimux->num_items];
3434 dimux->items[dimux->num_items].index = index;
3441 /* create playback/capture controls for input pins */
3442 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3444 struct sigmatel_spec *spec = codec->spec;
3445 struct hda_input_mux *imux = &spec->private_imux;
3446 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3449 for (i = 0; i < AUTO_PIN_LAST; i++) {
3452 if (!cfg->input_pins[i])
3455 for (j = 0; j < spec->num_muxes; j++) {
3457 num_cons = snd_hda_get_connections(codec,
3460 HDA_MAX_NUM_INPUTS);
3461 for (k = 0; k < num_cons; k++)
3462 if (con_lst[k] == cfg->input_pins[i]) {
3469 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
3470 imux->items[imux->num_items].index = index;
3474 if (imux->num_items) {
3476 * Set the current input for the muxes.
3477 * The STAC9221 has two input muxes with identical source
3478 * NID lists. Hopefully this won't get confused.
3480 for (i = 0; i < spec->num_muxes; i++) {
3481 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3482 AC_VERB_SET_CONNECT_SEL,
3483 imux->items[0].index);
3490 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3492 struct sigmatel_spec *spec = codec->spec;
3495 for (i = 0; i < spec->autocfg.line_outs; i++) {
3496 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3497 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3501 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3503 struct sigmatel_spec *spec = codec->spec;
3506 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3508 pin = spec->autocfg.hp_pins[i];
3509 if (pin) /* connect to front */
3510 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3512 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3514 pin = spec->autocfg.speaker_pins[i];
3515 if (pin) /* connect to front */
3516 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3520 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3522 struct sigmatel_spec *spec = codec->spec;
3526 if ((err = snd_hda_parse_pin_def_config(codec,
3528 spec->dmic_nids)) < 0)
3530 if (! spec->autocfg.line_outs)
3531 return 0; /* can't find valid pin config */
3533 /* If we have no real line-out pin and multiple hp-outs, HPs should
3534 * be set up as multi-channel outputs.
3536 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
3537 spec->autocfg.hp_outs > 1) {
3538 /* Copy hp_outs to line_outs, backup line_outs in
3539 * speaker_outs so that the following routines can handle
3540 * HP pins as primary outputs.
3542 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
3543 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3544 sizeof(spec->autocfg.line_out_pins));
3545 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3546 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3547 sizeof(spec->autocfg.hp_pins));
3548 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3549 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3550 spec->autocfg.hp_outs = 0;
3553 if (spec->autocfg.mono_out_pin) {
3554 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3555 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3556 u32 caps = query_amp_caps(codec,
3557 spec->autocfg.mono_out_pin, dir);
3558 hda_nid_t conn_list[1];
3560 /* get the mixer node and then the mono mux if it exists */
3561 if (snd_hda_get_connections(codec,
3562 spec->autocfg.mono_out_pin, conn_list, 1) &&
3563 snd_hda_get_connections(codec, conn_list[0],
3566 int wcaps = get_wcaps(codec, conn_list[0]);
3567 int wid_type = (wcaps & AC_WCAP_TYPE)
3568 >> AC_WCAP_TYPE_SHIFT;
3569 /* LR swap check, some stac925x have a mux that
3570 * changes the DACs output path instead of the
3573 if (wid_type == AC_WID_AUD_SEL &&
3574 !(wcaps & AC_WCAP_LR_SWAP))
3575 spec->mono_nid = conn_list[0];
3578 hda_nid_t nid = spec->autocfg.mono_out_pin;
3580 /* most mono outs have a least a mute/unmute switch */
3581 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3582 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3583 "Mono Playback Switch",
3584 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3587 /* check for volume support for the amp */
3588 if ((caps & AC_AMPCAP_NUM_STEPS)
3589 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3590 err = stac92xx_add_control(spec,
3591 STAC_CTL_WIDGET_VOL,
3592 "Mono Playback Volume",
3593 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3599 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3603 if (!spec->multiout.num_dacs) {
3604 err = stac92xx_auto_fill_dac_nids(codec);
3607 err = stac92xx_auto_create_multi_out_ctls(codec,
3613 /* setup analog beep controls */
3614 if (spec->anabeep_nid > 0) {
3615 err = stac92xx_auto_create_beep_ctls(codec,
3621 /* setup digital beep controls and input device */
3622 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3623 if (spec->digbeep_nid > 0) {
3624 hda_nid_t nid = spec->digbeep_nid;
3627 err = stac92xx_auto_create_beep_ctls(codec, nid);
3630 err = snd_hda_attach_beep_device(codec, nid);
3633 /* if no beep switch is available, make its own one */
3634 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3636 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
3637 err = stac92xx_beep_switch_ctl(codec);
3644 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3648 /* All output parsing done, now restore the swapped hp pins */
3650 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3651 sizeof(spec->autocfg.hp_pins));
3652 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3653 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3654 spec->autocfg.line_outs = 0;
3657 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3661 if (spec->mono_nid > 0) {
3662 err = stac92xx_auto_create_mono_output_ctls(codec);
3666 if (spec->num_amps > 0) {
3667 err = stac92xx_auto_create_amp_output_ctls(codec);
3671 if (spec->num_dmics > 0 && !spec->dinput_mux)
3672 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3673 &spec->autocfg)) < 0)
3675 if (spec->num_muxes > 0) {
3676 err = stac92xx_auto_create_mux_input_ctls(codec);
3680 if (spec->num_smuxes > 0) {
3681 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3686 err = stac92xx_add_input_source(spec);
3690 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3691 if (spec->multiout.max_channels > 2)
3692 spec->surr_switch = 1;
3694 if (spec->autocfg.dig_outs)
3695 spec->multiout.dig_out_nid = dig_out;
3696 if (dig_in && spec->autocfg.dig_in_pin)
3697 spec->dig_in_nid = dig_in;
3699 if (spec->kctls.list)
3700 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3702 spec->input_mux = &spec->private_imux;
3703 if (!spec->dinput_mux)
3704 spec->dinput_mux = &spec->private_dimux;
3705 spec->sinput_mux = &spec->private_smux;
3706 spec->mono_mux = &spec->private_mono_mux;
3707 spec->amp_mux = &spec->private_amp_mux;
3711 /* add playback controls for HP output */
3712 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3713 struct auto_pin_cfg *cfg)
3715 struct sigmatel_spec *spec = codec->spec;
3716 hda_nid_t pin = cfg->hp_pins[0];
3717 unsigned int wid_caps;
3722 wid_caps = get_wcaps(codec, pin);
3723 if (wid_caps & AC_WCAP_UNSOL_CAP)
3724 spec->hp_detect = 1;
3729 /* add playback controls for LFE output */
3730 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
3731 struct auto_pin_cfg *cfg)
3733 struct sigmatel_spec *spec = codec->spec;
3735 hda_nid_t lfe_pin = 0x0;
3739 * search speaker outs and line outs for a mono speaker pin
3740 * with an amp. If one is found, add LFE controls
3743 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
3744 hda_nid_t pin = spec->autocfg.speaker_pins[i];
3745 unsigned int wcaps = get_wcaps(codec, pin);
3746 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3747 if (wcaps == AC_WCAP_OUT_AMP)
3748 /* found a mono speaker with an amp, must be lfe */
3752 /* if speaker_outs is 0, then speakers may be in line_outs */
3753 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
3754 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
3755 hda_nid_t pin = spec->autocfg.line_out_pins[i];
3756 unsigned int defcfg;
3757 defcfg = snd_hda_codec_get_pincfg(codec, pin);
3758 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
3759 unsigned int wcaps = get_wcaps(codec, pin);
3760 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
3761 if (wcaps == AC_WCAP_OUT_AMP)
3762 /* found a mono speaker with an amp,
3770 err = create_controls(codec, "LFE", lfe_pin, 1);
3778 static int stac9200_parse_auto_config(struct hda_codec *codec)
3780 struct sigmatel_spec *spec = codec->spec;
3783 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
3786 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
3789 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
3792 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
3795 if (spec->num_muxes > 0) {
3796 err = stac92xx_auto_create_mux_input_ctls(codec);
3801 err = stac92xx_add_input_source(spec);
3805 if (spec->autocfg.dig_outs)
3806 spec->multiout.dig_out_nid = 0x05;
3807 if (spec->autocfg.dig_in_pin)
3808 spec->dig_in_nid = 0x04;
3810 if (spec->kctls.list)
3811 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3813 spec->input_mux = &spec->private_imux;
3814 spec->dinput_mux = &spec->private_dimux;
3820 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3821 * funky external mute control using GPIO pins.
3824 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3825 unsigned int dir_mask, unsigned int data)
3827 unsigned int gpiostate, gpiomask, gpiodir;
3829 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
3830 AC_VERB_GET_GPIO_DATA, 0);
3831 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
3833 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
3834 AC_VERB_GET_GPIO_MASK, 0);
3837 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
3838 AC_VERB_GET_GPIO_DIRECTION, 0);
3839 gpiodir |= dir_mask;
3841 /* Configure GPIOx as CMOS */
3842 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
3844 snd_hda_codec_write(codec, codec->afg, 0,
3845 AC_VERB_SET_GPIO_MASK, gpiomask);
3846 snd_hda_codec_read(codec, codec->afg, 0,
3847 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
3851 snd_hda_codec_read(codec, codec->afg, 0,
3852 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3855 static int stac92xx_add_jack(struct hda_codec *codec,
3856 hda_nid_t nid, int type)
3858 #ifdef CONFIG_SND_JACK
3859 struct sigmatel_spec *spec = codec->spec;
3860 struct sigmatel_jack *jack;
3861 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
3862 int connectivity = get_defcfg_connect(def_conf);
3865 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
3868 snd_array_init(&spec->jacks, sizeof(*jack), 32);
3869 jack = snd_array_new(&spec->jacks);
3875 sprintf(name, "%s at %s %s Jack",
3876 snd_hda_get_jack_type(def_conf),
3877 snd_hda_get_jack_connectivity(def_conf),
3878 snd_hda_get_jack_location(def_conf));
3880 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
3886 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
3887 unsigned char type, int data)
3889 struct sigmatel_event *event;
3891 snd_array_init(&spec->events, sizeof(*event), 32);
3892 event = snd_array_new(&spec->events);
3897 event->tag = spec->events.used;
3903 static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
3904 hda_nid_t nid, unsigned char type)
3906 struct sigmatel_spec *spec = codec->spec;
3907 struct sigmatel_event *event = spec->events.list;
3910 for (i = 0; i < spec->events.used; i++, event++) {
3911 if (event->nid == nid && event->type == type)
3917 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
3920 struct sigmatel_spec *spec = codec->spec;
3921 struct sigmatel_event *event = spec->events.list;
3924 for (i = 0; i < spec->events.used; i++, event++) {
3925 if (event->tag == tag)
3931 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
3934 struct sigmatel_event *event;
3937 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
3939 event = stac_get_event(codec, nid, type);
3943 tag = stac_add_event(codec->spec, nid, type, 0);
3946 snd_hda_codec_write_cache(codec, nid, 0,
3947 AC_VERB_SET_UNSOLICITED_ENABLE,
3951 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
3954 for (i = 0; i < cfg->hp_outs; i++)
3955 if (cfg->hp_pins[i] == nid)
3956 return 1; /* nid is a HP-Out */
3958 return 0; /* nid is not a HP-Out */
3961 static void stac92xx_power_down(struct hda_codec *codec)
3963 struct sigmatel_spec *spec = codec->spec;
3965 /* power down inactive DACs */
3967 for (dac = spec->dac_list; *dac; dac++)
3968 if (!check_all_dac_nids(spec, *dac))
3969 snd_hda_codec_write(codec, *dac, 0,
3970 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3973 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3976 /* override some hints from the hwdep entry */
3977 static void stac_store_hints(struct hda_codec *codec)
3979 struct sigmatel_spec *spec = codec->spec;
3983 val = snd_hda_get_bool_hint(codec, "hp_detect");
3985 spec->hp_detect = val;
3986 p = snd_hda_get_hint(codec, "gpio_mask");
3988 spec->gpio_mask = simple_strtoul(p, NULL, 0);
3989 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
3992 p = snd_hda_get_hint(codec, "gpio_dir");
3994 spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
3995 p = snd_hda_get_hint(codec, "gpio_data");
3997 spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
3998 p = snd_hda_get_hint(codec, "eapd_mask");
4000 spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
4001 val = snd_hda_get_bool_hint(codec, "eapd_switch");
4003 spec->eapd_switch = val;
4006 static int stac92xx_init(struct hda_codec *codec)
4008 struct sigmatel_spec *spec = codec->spec;
4009 struct auto_pin_cfg *cfg = &spec->autocfg;
4013 snd_hda_sequence_write(codec, spec->init);
4015 /* power down adcs initially */
4016 if (spec->powerdown_adcs)
4017 for (i = 0; i < spec->num_adcs; i++)
4018 snd_hda_codec_write(codec,
4019 spec->adc_nids[i], 0,
4020 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
4022 /* override some hints */
4023 stac_store_hints(codec);
4026 gpio = spec->gpio_data;
4027 /* turn on EAPD statically when spec->eapd_switch isn't set.
4028 * otherwise, unsol event will turn it on/off dynamically
4030 if (!spec->eapd_switch)
4031 gpio |= spec->eapd_mask;
4032 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
4035 if (spec->hp_detect) {
4036 /* Enable unsolicited responses on the HP widget */
4037 for (i = 0; i < cfg->hp_outs; i++) {
4038 hda_nid_t nid = cfg->hp_pins[i];
4039 enable_pin_detect(codec, nid, STAC_HP_EVENT);
4041 /* force to enable the first line-out; the others are set up
4044 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
4046 /* fake event to set up pins */
4047 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
4050 stac92xx_auto_init_multi_out(codec);
4051 stac92xx_auto_init_hp_out(codec);
4052 for (i = 0; i < cfg->hp_outs; i++)
4053 stac_toggle_power_map(codec, cfg->hp_pins[i], 1);
4055 for (i = 0; i < AUTO_PIN_LAST; i++) {
4056 hda_nid_t nid = cfg->input_pins[i];
4058 unsigned int pinctl, conf;
4059 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) {
4060 /* for mic pins, force to initialize */
4061 pinctl = stac92xx_get_vref(codec, nid);
4062 pinctl |= AC_PINCTL_IN_EN;
4063 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4065 pinctl = snd_hda_codec_read(codec, nid, 0,
4066 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4067 /* if PINCTL already set then skip */
4068 if (!(pinctl & AC_PINCTL_IN_EN)) {
4069 pinctl |= AC_PINCTL_IN_EN;
4070 stac92xx_auto_set_pinctl(codec, nid,
4074 conf = snd_hda_codec_get_pincfg(codec, nid);
4075 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) {
4076 enable_pin_detect(codec, nid,
4078 stac_issue_unsol_event(codec, nid,
4083 for (i = 0; i < spec->num_dmics; i++)
4084 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
4086 if (cfg->dig_out_pins[0])
4087 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0],
4089 if (cfg->dig_in_pin)
4090 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
4092 for (i = 0; i < spec->num_pwrs; i++) {
4093 hda_nid_t nid = spec->pwr_nids[i];
4094 int pinctl, def_conf;
4096 /* power on when no jack detection is available */
4097 if (!spec->hp_detect) {
4098 stac_toggle_power_map(codec, nid, 1);
4102 if (is_nid_hp_pin(cfg, nid))
4103 continue; /* already has an unsol event */
4105 pinctl = snd_hda_codec_read(codec, nid, 0,
4106 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4107 /* outputs are only ports capable of power management
4108 * any attempts on powering down a input port cause the
4109 * referenced VREF to act quirky.
4111 if (pinctl & AC_PINCTL_IN_EN) {
4112 stac_toggle_power_map(codec, nid, 1);
4115 def_conf = snd_hda_codec_get_pincfg(codec, nid);
4116 def_conf = get_defcfg_connect(def_conf);
4117 /* skip any ports that don't have jacks since presence
4118 * detection is useless */
4119 if (def_conf != AC_JACK_PORT_COMPLEX) {
4120 if (def_conf != AC_JACK_PORT_NONE)
4121 stac_toggle_power_map(codec, nid, 1);
4124 if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) {
4125 enable_pin_detect(codec, nid, STAC_PWR_EVENT);
4126 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT);
4130 stac92xx_power_down(codec);
4134 static void stac92xx_free_jacks(struct hda_codec *codec)
4136 #ifdef CONFIG_SND_JACK
4137 /* free jack instances manually when clearing/reconfiguring */
4138 struct sigmatel_spec *spec = codec->spec;
4139 if (!codec->bus->shutdown && spec->jacks.list) {
4140 struct sigmatel_jack *jacks = spec->jacks.list;
4142 for (i = 0; i < spec->jacks.used; i++)
4143 snd_device_free(codec->bus->card, &jacks[i].jack);
4145 snd_array_free(&spec->jacks);
4149 static void stac92xx_free_kctls(struct hda_codec *codec)
4151 struct sigmatel_spec *spec = codec->spec;
4153 if (spec->kctls.list) {
4154 struct snd_kcontrol_new *kctl = spec->kctls.list;
4156 for (i = 0; i < spec->kctls.used; i++)
4157 kfree(kctl[i].name);
4159 snd_array_free(&spec->kctls);
4162 static void stac92xx_free(struct hda_codec *codec)
4164 struct sigmatel_spec *spec = codec->spec;
4169 stac92xx_free_jacks(codec);
4170 snd_array_free(&spec->events);
4173 snd_hda_detach_beep_device(codec);
4176 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4179 unsigned int old_ctl, pin_ctl;
4181 pin_ctl = snd_hda_codec_read(codec, nid,
4182 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4184 if (pin_ctl & AC_PINCTL_IN_EN) {
4186 * we need to check the current set-up direction of
4187 * shared input pins since they can be switched via
4188 * "xxx as Output" mixer switch
4190 struct sigmatel_spec *spec = codec->spec;
4191 if (nid == spec->line_switch || nid == spec->mic_switch)
4196 /* if setting pin direction bits, clear the current
4197 direction bits first */
4198 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4199 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4202 if (old_ctl != pin_ctl)
4203 snd_hda_codec_write_cache(codec, nid, 0,
4204 AC_VERB_SET_PIN_WIDGET_CONTROL,
4208 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4211 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4212 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4214 snd_hda_codec_write_cache(codec, nid, 0,
4215 AC_VERB_SET_PIN_WIDGET_CONTROL,
4219 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4223 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
4229 /* return non-zero if the hp-pin of the given array index isn't
4230 * a jack-detection target
4232 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4234 struct auto_pin_cfg *cfg = &spec->autocfg;
4236 /* ignore sensing of shared line and mic jacks */
4237 if (cfg->hp_pins[i] == spec->line_switch)
4239 if (cfg->hp_pins[i] == spec->mic_switch)
4241 /* ignore if the pin is set as line-out */
4242 if (cfg->hp_pins[i] == spec->hp_switch)
4247 static void stac92xx_hp_detect(struct hda_codec *codec)
4249 struct sigmatel_spec *spec = codec->spec;
4250 struct auto_pin_cfg *cfg = &spec->autocfg;
4254 if (spec->gpio_mute)
4255 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4256 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4258 for (i = 0; i < cfg->hp_outs; i++) {
4261 if (no_hp_sensing(spec, i))
4263 presence = get_pin_presence(codec, cfg->hp_pins[i]);
4265 unsigned int pinctl;
4266 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
4267 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4268 if (pinctl & AC_PINCTL_IN_EN)
4269 presence = 0; /* mic- or line-input */
4274 /* disable lineouts */
4275 if (spec->hp_switch)
4276 stac92xx_reset_pinctl(codec, spec->hp_switch,
4278 for (i = 0; i < cfg->line_outs; i++)
4279 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4281 for (i = 0; i < cfg->speaker_outs; i++)
4282 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4284 if (spec->eapd_mask && spec->eapd_switch)
4285 stac_gpio_set(codec, spec->gpio_mask,
4286 spec->gpio_dir, spec->gpio_data &
4289 /* enable lineouts */
4290 if (spec->hp_switch)
4291 stac92xx_set_pinctl(codec, spec->hp_switch,
4293 for (i = 0; i < cfg->line_outs; i++)
4294 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4296 for (i = 0; i < cfg->speaker_outs; i++)
4297 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4299 if (spec->eapd_mask && spec->eapd_switch)
4300 stac_gpio_set(codec, spec->gpio_mask,
4301 spec->gpio_dir, spec->gpio_data |
4304 /* toggle hp outs */
4305 for (i = 0; i < cfg->hp_outs; i++) {
4306 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4307 if (no_hp_sensing(spec, i))
4310 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4312 /* Resetting the pinctl like below may lead to (a sort of) regressions
4313 * on some devices since they use the HP pin actually for line/speaker
4314 * outs although the default pin config shows a different pin (that is
4315 * wrong and useless).
4317 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4318 * But, disabling the code below just works around it, and I'm too tired of
4319 * bug reports with such devices...
4322 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4327 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4330 struct sigmatel_spec *spec = codec->spec;
4331 unsigned int idx, val;
4333 for (idx = 0; idx < spec->num_pwrs; idx++) {
4334 if (spec->pwr_nids[idx] == nid)
4337 if (idx >= spec->num_pwrs)
4340 /* several codecs have two power down bits */
4341 if (spec->pwr_mapping)
4342 idx = spec->pwr_mapping[idx];
4346 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4352 /* power down unused output ports */
4353 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4356 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4358 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid));
4361 static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid)
4363 struct sigmatel_spec *spec = codec->spec;
4364 struct sigmatel_jack *jacks = spec->jacks.list;
4368 for (i = 0; i < spec->jacks.used; i++) {
4369 if (jacks->nid == nid) {
4370 unsigned int pin_ctl =
4371 snd_hda_codec_read(codec, nid,
4372 0, AC_VERB_GET_PIN_WIDGET_CONTROL,
4374 int type = jacks->type;
4375 if (type == (SND_JACK_LINEOUT
4376 | SND_JACK_HEADPHONE))
4377 type = (pin_ctl & AC_PINCTL_HP_EN)
4378 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT;
4379 snd_jack_report(jacks->jack,
4380 get_pin_presence(codec, nid)
4388 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,
4391 struct sigmatel_event *event = stac_get_event(codec, nid, type);
4394 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);
4397 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4399 struct sigmatel_spec *spec = codec->spec;
4400 struct sigmatel_event *event;
4403 tag = (res >> 26) & 0x7f;
4404 event = stac_get_event_from_tag(codec, tag);
4408 switch (event->type) {
4410 stac92xx_hp_detect(codec);
4412 case STAC_INSERT_EVENT:
4413 case STAC_PWR_EVENT:
4414 if (spec->num_pwrs > 0)
4415 stac92xx_pin_sense(codec, event->nid);
4416 stac92xx_report_jack(codec, event->nid);
4418 case STAC_VREF_EVENT:
4419 data = snd_hda_codec_read(codec, codec->afg, 0,
4420 AC_VERB_GET_GPIO_DATA, 0);
4421 /* toggle VREF state based on GPIOx status */
4422 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4423 !!(data & (1 << event->data)));
4428 #ifdef CONFIG_PROC_FS
4429 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4430 struct hda_codec *codec, hda_nid_t nid)
4432 if (nid == codec->afg)
4433 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4434 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4437 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4438 struct hda_codec *codec,
4441 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4442 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4445 /* stac92hd71bxx, stac92hd73xx */
4446 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4447 struct hda_codec *codec, hda_nid_t nid)
4449 stac92hd_proc_hook(buffer, codec, nid);
4450 if (nid == codec->afg)
4451 analog_loop_proc_hook(buffer, codec, 0xfa0);
4454 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4455 struct hda_codec *codec, hda_nid_t nid)
4457 if (nid == codec->afg)
4458 analog_loop_proc_hook(buffer, codec, 0xfe0);
4461 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4462 struct hda_codec *codec, hda_nid_t nid)
4464 if (nid == codec->afg)
4465 analog_loop_proc_hook(buffer, codec, 0xfeb);
4468 #define stac92hd_proc_hook NULL
4469 #define stac92hd7x_proc_hook NULL
4470 #define stac9205_proc_hook NULL
4471 #define stac927x_proc_hook NULL
4474 #ifdef SND_HDA_NEEDS_RESUME
4475 static int stac92xx_resume(struct hda_codec *codec)
4477 struct sigmatel_spec *spec = codec->spec;
4479 stac92xx_init(codec);
4480 snd_hda_codec_resume_amp(codec);
4481 snd_hda_codec_resume_cache(codec);
4482 /* fake event to set up pins again to override cached values */
4483 if (spec->hp_detect)
4484 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],
4491 * using power check for controlling mute led of HP HDX notebooks
4492 * check for mute state only on Speakers (nid = 0x10)
4494 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise
4495 * the LED is NOT working properly !
4498 #ifdef CONFIG_SND_HDA_POWER_SAVE
4499 static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec,
4502 struct sigmatel_spec *spec = codec->spec;
4505 if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
4507 spec->gpio_data &= ~0x08; /* orange */
4509 spec->gpio_data |= 0x08; /* white */
4511 stac_gpio_set(codec, spec->gpio_mask,
4520 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4522 struct sigmatel_spec *spec = codec->spec;
4523 if (spec->eapd_mask)
4524 stac_gpio_set(codec, spec->gpio_mask,
4525 spec->gpio_dir, spec->gpio_data &
4531 static struct hda_codec_ops stac92xx_patch_ops = {
4532 .build_controls = stac92xx_build_controls,
4533 .build_pcms = stac92xx_build_pcms,
4534 .init = stac92xx_init,
4535 .free = stac92xx_free,
4536 .unsol_event = stac92xx_unsol_event,
4537 #ifdef SND_HDA_NEEDS_RESUME
4538 .suspend = stac92xx_suspend,
4539 .resume = stac92xx_resume,
4543 static int patch_stac9200(struct hda_codec *codec)
4545 struct sigmatel_spec *spec;
4548 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4553 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4554 spec->pin_nids = stac9200_pin_nids;
4555 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
4558 if (spec->board_config < 0)
4559 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
4561 stac92xx_set_config_regs(codec,
4562 stac9200_brd_tbl[spec->board_config]);
4564 spec->multiout.max_channels = 2;
4565 spec->multiout.num_dacs = 1;
4566 spec->multiout.dac_nids = stac9200_dac_nids;
4567 spec->adc_nids = stac9200_adc_nids;
4568 spec->mux_nids = stac9200_mux_nids;
4569 spec->num_muxes = 1;
4570 spec->num_dmics = 0;
4574 if (spec->board_config == STAC_9200_M4 ||
4575 spec->board_config == STAC_9200_M4_2 ||
4576 spec->board_config == STAC_9200_OQO)
4577 spec->init = stac9200_eapd_init;
4579 spec->init = stac9200_core_init;
4580 spec->mixer = stac9200_mixer;
4582 if (spec->board_config == STAC_9200_PANASONIC) {
4583 spec->gpio_mask = spec->gpio_dir = 0x09;
4584 spec->gpio_data = 0x00;
4587 err = stac9200_parse_auto_config(codec);
4589 stac92xx_free(codec);
4593 /* CF-74 has no headphone detection, and the driver should *NOT*
4594 * do detection and HP/speaker toggle because the hardware does it.
4596 if (spec->board_config == STAC_9200_PANASONIC)
4597 spec->hp_detect = 0;
4599 codec->patch_ops = stac92xx_patch_ops;
4604 static int patch_stac925x(struct hda_codec *codec)
4606 struct sigmatel_spec *spec;
4609 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4614 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4615 spec->pin_nids = stac925x_pin_nids;
4617 /* Check first for codec ID */
4618 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
4621 stac925x_codec_id_cfg_tbl);
4623 /* Now checks for PCI ID, if codec ID is not found */
4624 if (spec->board_config < 0)
4625 spec->board_config = snd_hda_check_board_config(codec,
4630 if (spec->board_config < 0)
4631 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4632 "using BIOS defaults\n");
4634 stac92xx_set_config_regs(codec,
4635 stac925x_brd_tbl[spec->board_config]);
4637 spec->multiout.max_channels = 2;
4638 spec->multiout.num_dacs = 1;
4639 spec->multiout.dac_nids = stac925x_dac_nids;
4640 spec->adc_nids = stac925x_adc_nids;
4641 spec->mux_nids = stac925x_mux_nids;
4642 spec->num_muxes = 1;
4645 switch (codec->vendor_id) {
4646 case 0x83847632: /* STAC9202 */
4647 case 0x83847633: /* STAC9202D */
4648 case 0x83847636: /* STAC9251 */
4649 case 0x83847637: /* STAC9251D */
4650 spec->num_dmics = STAC925X_NUM_DMICS;
4651 spec->dmic_nids = stac925x_dmic_nids;
4652 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
4653 spec->dmux_nids = stac925x_dmux_nids;
4656 spec->num_dmics = 0;
4660 spec->init = stac925x_core_init;
4661 spec->mixer = stac925x_mixer;
4663 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
4665 if (spec->board_config < 0) {
4666 printk(KERN_WARNING "hda_codec: No auto-config is "
4667 "available, default to model=ref\n");
4668 spec->board_config = STAC_925x_REF;
4674 stac92xx_free(codec);
4678 codec->patch_ops = stac92xx_patch_ops;
4683 static struct hda_input_mux stac92hd73xx_dmux = {
4686 { "Analog Inputs", 0x0b },
4687 { "Digital Mic 1", 0x09 },
4688 { "Digital Mic 2", 0x0a },
4693 static int patch_stac92hd73xx(struct hda_codec *codec)
4695 struct sigmatel_spec *spec;
4696 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
4700 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4705 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
4706 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
4707 spec->pin_nids = stac92hd73xx_pin_nids;
4708 spec->board_config = snd_hda_check_board_config(codec,
4709 STAC_92HD73XX_MODELS,
4710 stac92hd73xx_models,
4711 stac92hd73xx_cfg_tbl);
4713 if (spec->board_config < 0)
4714 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4715 " STAC92HD73XX, using BIOS defaults\n");
4717 stac92xx_set_config_regs(codec,
4718 stac92hd73xx_brd_tbl[spec->board_config]);
4720 num_dacs = snd_hda_get_connections(codec, 0x0a,
4721 conn, STAC92HD73_DAC_COUNT + 2) - 1;
4723 if (num_dacs < 3 || num_dacs > 5) {
4724 printk(KERN_WARNING "hda_codec: Could not determine "
4725 "number of channels defaulting to DAC count\n");
4726 num_dacs = STAC92HD73_DAC_COUNT;
4729 case 0x3: /* 6 Channel */
4730 spec->mixer = stac92hd73xx_6ch_mixer;
4731 spec->init = stac92hd73xx_6ch_core_init;
4732 spec->aloopback_ctl = stac92hd73xx_6ch_loopback;
4734 case 0x4: /* 8 Channel */
4735 spec->mixer = stac92hd73xx_8ch_mixer;
4736 spec->init = stac92hd73xx_8ch_core_init;
4737 spec->aloopback_ctl = stac92hd73xx_8ch_loopback;
4739 case 0x5: /* 10 Channel */
4740 spec->mixer = stac92hd73xx_10ch_mixer;
4741 spec->init = stac92hd73xx_10ch_core_init;
4742 spec->aloopback_ctl = stac92hd73xx_10ch_loopback;
4745 spec->multiout.dac_nids = spec->dac_nids;
4747 spec->aloopback_mask = 0x01;
4748 spec->aloopback_shift = 8;
4750 spec->digbeep_nid = 0x1c;
4751 spec->mux_nids = stac92hd73xx_mux_nids;
4752 spec->adc_nids = stac92hd73xx_adc_nids;
4753 spec->dmic_nids = stac92hd73xx_dmic_nids;
4754 spec->dmux_nids = stac92hd73xx_dmux_nids;
4755 spec->smux_nids = stac92hd73xx_smux_nids;
4756 spec->amp_nids = stac92hd73xx_amp_nids;
4757 spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
4759 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
4760 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
4761 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
4762 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
4763 sizeof(stac92hd73xx_dmux));
4765 switch (spec->board_config) {
4767 spec->init = dell_eq_core_init;
4769 case STAC_DELL_M6_AMIC:
4770 case STAC_DELL_M6_DMIC:
4771 case STAC_DELL_M6_BOTH:
4772 spec->num_smuxes = 0;
4773 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4774 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4775 spec->eapd_switch = 0;
4778 if (spec->board_config != STAC_DELL_EQ)
4779 spec->init = dell_m6_core_init;
4780 switch (spec->board_config) {
4781 case STAC_DELL_M6_AMIC: /* Analog Mics */
4782 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
4783 spec->num_dmics = 0;
4784 spec->private_dimux.num_items = 1;
4786 case STAC_DELL_M6_DMIC: /* Digital Mics */
4787 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
4788 spec->num_dmics = 1;
4789 spec->private_dimux.num_items = 2;
4791 case STAC_DELL_M6_BOTH: /* Both */
4792 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
4793 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
4794 spec->num_dmics = 1;
4795 spec->private_dimux.num_items = 2;
4800 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4801 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4802 spec->eapd_switch = 1;
4804 if (spec->board_config > STAC_92HD73XX_REF) {
4805 /* GPIO0 High = Enable EAPD */
4806 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4807 spec->gpio_data = 0x01;
4809 spec->dinput_mux = &spec->private_dimux;
4811 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4812 spec->pwr_nids = stac92hd73xx_pwr_nids;
4814 err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
4817 if (spec->board_config < 0) {
4818 printk(KERN_WARNING "hda_codec: No auto-config is "
4819 "available, default to model=ref\n");
4820 spec->board_config = STAC_92HD73XX_REF;
4827 stac92xx_free(codec);
4831 if (spec->board_config == STAC_92HD73XX_NO_JD)
4832 spec->hp_detect = 0;
4834 codec->patch_ops = stac92xx_patch_ops;
4836 codec->proc_widget_hook = stac92hd7x_proc_hook;
4841 static struct hda_input_mux stac92hd83xxx_dmux = {
4844 { "Analog Inputs", 0x03 },
4845 { "Digital Mic 1", 0x04 },
4846 { "Digital Mic 2", 0x05 },
4850 static int patch_stac92hd83xxx(struct hda_codec *codec)
4852 struct sigmatel_spec *spec;
4853 hda_nid_t conn[STAC92HD83_DAC_COUNT + 1];
4858 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4863 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
4864 spec->mono_nid = 0x19;
4865 spec->digbeep_nid = 0x21;
4866 spec->dmic_nids = stac92hd83xxx_dmic_nids;
4867 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4868 spec->adc_nids = stac92hd83xxx_adc_nids;
4869 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4870 spec->amp_nids = stac92hd83xxx_amp_nids;
4871 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4872 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4873 spec->multiout.dac_nids = spec->dac_nids;
4875 spec->init = stac92hd83xxx_core_init;
4876 spec->mixer = stac92hd83xxx_mixer;
4877 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4878 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4879 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4880 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids);
4881 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4882 spec->dinput_mux = &stac92hd83xxx_dmux;
4883 spec->pin_nids = stac92hd83xxx_pin_nids;
4884 spec->board_config = snd_hda_check_board_config(codec,
4885 STAC_92HD83XXX_MODELS,
4886 stac92hd83xxx_models,
4887 stac92hd83xxx_cfg_tbl);
4889 if (spec->board_config < 0)
4890 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
4891 " STAC92HD83XXX, using BIOS defaults\n");
4893 stac92xx_set_config_regs(codec,
4894 stac92hd83xxx_brd_tbl[spec->board_config]);
4896 switch (codec->vendor_id) {
4899 if (spec->board_config == STAC_92HD83XXX_PWR_REF)
4905 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4907 if (spec->board_config < 0) {
4908 printk(KERN_WARNING "hda_codec: No auto-config is "
4909 "available, default to model=ref\n");
4910 spec->board_config = STAC_92HD83XXX_REF;
4917 stac92xx_free(codec);
4921 switch (spec->board_config) {
4930 num_dacs = snd_hda_get_connections(codec, nid,
4931 conn, STAC92HD83_DAC_COUNT + 1) - 1;
4933 /* set port X to select the last DAC
4935 snd_hda_codec_write_cache(codec, nid, 0,
4936 AC_VERB_SET_CONNECT_SEL, num_dacs);
4938 codec->patch_ops = stac92xx_patch_ops;
4940 codec->proc_widget_hook = stac92hd_proc_hook;
4945 static struct hda_input_mux stac92hd71bxx_dmux_nomixer = {
4948 { "Analog Inputs", 0x00 },
4949 { "Digital Mic 1", 0x02 },
4950 { "Digital Mic 2", 0x03 },
4954 static struct hda_input_mux stac92hd71bxx_dmux_amixer = {
4957 { "Analog Inputs", 0x00 },
4959 { "Digital Mic 1", 0x02 },
4960 { "Digital Mic 2", 0x03 },
4964 /* get the pin connection (fixed, none, etc) */
4965 static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
4967 struct sigmatel_spec *spec = codec->spec;
4970 cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
4971 return get_defcfg_connect(cfg);
4974 static int stac92hd71bxx_connected_ports(struct hda_codec *codec,
4975 hda_nid_t *nids, int num_nids)
4977 struct sigmatel_spec *spec = codec->spec;
4979 unsigned int def_conf;
4981 for (num = 0; num < num_nids; num++) {
4982 for (idx = 0; idx < spec->num_pins; idx++)
4983 if (spec->pin_nids[idx] == nids[num])
4985 if (idx >= spec->num_pins)
4987 def_conf = stac_get_defcfg_connect(codec, idx);
4988 if (def_conf == AC_JACK_PORT_NONE)
4994 static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
4997 struct sigmatel_spec *spec = codec->spec;
5000 for (idx = 0; idx < spec->num_pins; idx++)
5001 if (spec->pin_nids[idx] == dig0pin)
5003 if ((idx + 2) >= spec->num_pins)
5007 if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE)
5010 /* dig0pin + dig2pin case */
5011 if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE)
5013 if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE)
5019 static int patch_stac92hd71bxx(struct hda_codec *codec)
5021 struct sigmatel_spec *spec;
5022 struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5024 unsigned int ndmic_nids = 0;
5026 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5031 codec->patch_ops = stac92xx_patch_ops;
5032 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5033 switch (codec->vendor_id) {
5036 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5040 /* On 92HD75Bx 0x27 isn't a pin nid */
5044 spec->pin_nids = stac92hd71bxx_pin_nids_6port;
5046 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
5047 spec->board_config = snd_hda_check_board_config(codec,
5048 STAC_92HD71BXX_MODELS,
5049 stac92hd71bxx_models,
5050 stac92hd71bxx_cfg_tbl);
5052 if (spec->board_config < 0)
5053 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
5054 " STAC92HD71BXX, using BIOS defaults\n");
5056 stac92xx_set_config_regs(codec,
5057 stac92hd71bxx_brd_tbl[spec->board_config]);
5059 if (spec->board_config > STAC_92HD71BXX_REF) {
5061 spec->gpio_mask = 0x01;
5062 spec->gpio_dir = 0x01;
5063 spec->gpio_data = 0x01;
5066 spec->dmic_nids = stac92hd71bxx_dmic_nids;
5067 spec->dmux_nids = stac92hd71bxx_dmux_nids;
5069 switch (codec->vendor_id) {
5070 case 0x111d76b6: /* 4 Port without Analog Mixer */
5074 case 0x111d76b4: /* 6 Port without Analog Mixer */
5076 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer,
5077 sizeof(stac92hd71bxx_dmux_nomixer));
5078 spec->mixer = stac92hd71bxx_mixer;
5079 spec->init = stac92hd71bxx_core_init;
5080 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5081 spec->num_dmics = stac92hd71bxx_connected_ports(codec,
5082 stac92hd71bxx_dmic_nids,
5083 STAC92HD71BXX_NUM_DMICS);
5084 if (spec->num_dmics) {
5085 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5086 spec->dinput_mux = &spec->private_dimux;
5087 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1;
5090 case 0x111d7608: /* 5 Port with Analog Mixer */
5091 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer,
5092 sizeof(stac92hd71bxx_dmux_amixer));
5093 spec->private_dimux.num_items--;
5094 switch (spec->board_config) {
5096 /* Enable VREF power saving on GPIO1 detect */
5097 err = stac_add_event(spec, codec->afg,
5098 STAC_VREF_EVENT, 0x02);
5101 snd_hda_codec_write_cache(codec, codec->afg, 0,
5102 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
5103 snd_hda_codec_write_cache(codec, codec->afg, 0,
5104 AC_VERB_SET_UNSOLICITED_ENABLE,
5106 spec->gpio_mask |= 0x02;
5109 if ((codec->revision_id & 0xf) == 0 ||
5110 (codec->revision_id & 0xf) == 1)
5111 spec->stream_delay = 40; /* 40 milliseconds */
5113 /* no output amps */
5115 spec->mixer = stac92hd71bxx_analog_mixer;
5116 spec->dinput_mux = &spec->private_dimux;
5119 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
5121 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
5122 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
5123 stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0;
5124 spec->num_dmics = stac92hd71bxx_connected_ports(codec,
5125 stac92hd71bxx_dmic_nids,
5126 STAC92HD71BXX_NUM_DMICS - 1);
5127 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5128 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2;
5130 case 0x111d7603: /* 6 Port with Analog Mixer */
5131 if ((codec->revision_id & 0xf) == 1)
5132 spec->stream_delay = 40; /* 40 milliseconds */
5134 /* no output amps */
5138 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer,
5139 sizeof(stac92hd71bxx_dmux_amixer));
5140 spec->dinput_mux = &spec->private_dimux;
5141 spec->mixer = stac92hd71bxx_analog_mixer;
5142 spec->init = stac92hd71bxx_analog_core_init;
5143 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5144 spec->num_dmics = stac92hd71bxx_connected_ports(codec,
5145 stac92hd71bxx_dmic_nids,
5146 STAC92HD71BXX_NUM_DMICS);
5147 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5148 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1;
5151 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
5152 snd_hda_sequence_write_cache(codec, unmute_init);
5154 spec->aloopback_ctl = stac92hd71bxx_loopback;
5155 spec->aloopback_mask = 0x50;
5156 spec->aloopback_shift = 0;
5158 spec->powerdown_adcs = 1;
5159 spec->digbeep_nid = 0x26;
5160 spec->mux_nids = stac92hd71bxx_mux_nids;
5161 spec->adc_nids = stac92hd71bxx_adc_nids;
5162 spec->smux_nids = stac92hd71bxx_smux_nids;
5163 spec->pwr_nids = stac92hd71bxx_pwr_nids;
5165 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
5166 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
5167 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5169 switch (spec->board_config) {
5171 /* enable internal microphone */
5172 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
5173 stac92xx_auto_set_pinctl(codec, 0x0e,
5174 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
5176 case STAC_DELL_M4_2:
5177 spec->num_dmics = 0;
5178 spec->num_smuxes = 0;
5179 spec->num_dmuxes = 0;
5181 case STAC_DELL_M4_1:
5182 case STAC_DELL_M4_3:
5183 spec->num_dmics = 1;
5184 spec->num_smuxes = 0;
5185 spec->num_dmuxes = 1;
5188 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
5189 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
5192 spec->num_dmics = 1;
5193 spec->num_dmuxes = 1;
5194 spec->num_smuxes = 1;
5196 * For controlling MUTE LED on HP HDX16/HDX18 notebooks,
5197 * the CONFIG_SND_HDA_POWER_SAVE is needed to be set.
5199 #ifdef CONFIG_SND_HDA_POWER_SAVE
5200 /* orange/white mute led on GPIO3, orange=0, white=1 */
5201 spec->gpio_mask |= 0x08;
5202 spec->gpio_dir |= 0x08;
5203 spec->gpio_data |= 0x08; /* set to white */
5205 /* register check_power_status callback. */
5206 codec->patch_ops.check_power_status =
5207 stac92xx_hp_hdx_check_power_status;
5212 spec->multiout.dac_nids = spec->dac_nids;
5213 if (spec->dinput_mux)
5214 spec->private_dimux.num_items += spec->num_dmics - ndmic_nids;
5216 err = stac92xx_parse_auto_config(codec, 0x21, 0);
5218 if (spec->board_config < 0) {
5219 printk(KERN_WARNING "hda_codec: No auto-config is "
5220 "available, default to model=ref\n");
5221 spec->board_config = STAC_92HD71BXX_REF;
5228 stac92xx_free(codec);
5232 codec->proc_widget_hook = stac92hd7x_proc_hook;
5237 static int patch_stac922x(struct hda_codec *codec)
5239 struct sigmatel_spec *spec;
5242 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5247 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5248 spec->pin_nids = stac922x_pin_nids;
5249 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
5252 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
5253 spec->gpio_mask = spec->gpio_dir = 0x03;
5254 spec->gpio_data = 0x03;
5255 /* Intel Macs have all same PCI SSID, so we need to check
5256 * codec SSID to distinguish the exact models
5258 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
5259 switch (codec->subsystem_id) {
5262 spec->board_config = STAC_INTEL_MAC_V1;
5266 spec->board_config = STAC_INTEL_MAC_V2;
5274 spec->board_config = STAC_INTEL_MAC_V3;
5278 spec->board_config = STAC_INTEL_MAC_V4;
5282 spec->board_config = STAC_INTEL_MAC_V5;
5285 spec->board_config = STAC_INTEL_MAC_V3;
5291 if (spec->board_config < 0)
5292 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
5293 "using BIOS defaults\n");
5295 stac92xx_set_config_regs(codec,
5296 stac922x_brd_tbl[spec->board_config]);
5298 spec->adc_nids = stac922x_adc_nids;
5299 spec->mux_nids = stac922x_mux_nids;
5300 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
5301 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
5302 spec->num_dmics = 0;
5305 spec->init = stac922x_core_init;
5306 spec->mixer = stac922x_mixer;
5308 spec->multiout.dac_nids = spec->dac_nids;
5310 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
5312 if (spec->board_config < 0) {
5313 printk(KERN_WARNING "hda_codec: No auto-config is "
5314 "available, default to model=ref\n");
5315 spec->board_config = STAC_D945_REF;
5321 stac92xx_free(codec);
5325 codec->patch_ops = stac92xx_patch_ops;
5327 /* Fix Mux capture level; max to 2 */
5328 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
5329 (0 << AC_AMPCAP_OFFSET_SHIFT) |
5330 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5331 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5332 (0 << AC_AMPCAP_MUTE_SHIFT));
5337 static int patch_stac927x(struct hda_codec *codec)
5339 struct sigmatel_spec *spec;
5342 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5347 codec->slave_dig_outs = stac927x_slave_dig_outs;
5348 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
5349 spec->pin_nids = stac927x_pin_nids;
5350 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
5354 if (spec->board_config < 0)
5355 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
5356 "STAC927x, using BIOS defaults\n");
5358 stac92xx_set_config_regs(codec,
5359 stac927x_brd_tbl[spec->board_config]);
5361 spec->digbeep_nid = 0x23;
5362 spec->adc_nids = stac927x_adc_nids;
5363 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
5364 spec->mux_nids = stac927x_mux_nids;
5365 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
5366 spec->smux_nids = stac927x_smux_nids;
5367 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
5368 spec->spdif_labels = stac927x_spdif_labels;
5369 spec->dac_list = stac927x_dac_nids;
5370 spec->multiout.dac_nids = spec->dac_nids;
5372 switch (spec->board_config) {
5375 /* GPIO0 High = Enable EAPD */
5376 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
5377 spec->gpio_data = 0x01;
5378 spec->num_dmics = 0;
5380 spec->init = d965_core_init;
5381 spec->mixer = stac927x_mixer;
5383 case STAC_DELL_BIOS:
5384 switch (codec->subsystem_id) {
5387 /* correct the device field to SPDIF out */
5388 snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070);
5391 /* configure the analog microphone on some laptops */
5392 snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130);
5393 /* correct the front output jack as a hp out */
5394 snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f);
5395 /* correct the front input jack as a mic */
5396 snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130);
5399 /* GPIO2 High = Enable EAPD */
5400 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
5401 spec->gpio_data = 0x04;
5402 spec->dmic_nids = stac927x_dmic_nids;
5403 spec->num_dmics = STAC927X_NUM_DMICS;
5405 spec->init = d965_core_init;
5406 spec->mixer = stac927x_mixer;
5407 spec->dmux_nids = stac927x_dmux_nids;
5408 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5411 if (spec->board_config > STAC_D965_REF) {
5412 /* GPIO0 High = Enable EAPD */
5413 spec->eapd_mask = spec->gpio_mask = 0x01;
5414 spec->gpio_dir = spec->gpio_data = 0x01;
5416 spec->num_dmics = 0;
5418 spec->init = stac927x_core_init;
5419 spec->mixer = stac927x_mixer;
5423 spec->aloopback_ctl = stac927x_loopback;
5424 spec->aloopback_mask = 0x40;
5425 spec->aloopback_shift = 0;
5426 spec->eapd_switch = 1;
5428 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
5430 if (spec->board_config < 0) {
5431 printk(KERN_WARNING "hda_codec: No auto-config is "
5432 "available, default to model=ref\n");
5433 spec->board_config = STAC_D965_REF;
5439 stac92xx_free(codec);
5443 codec->patch_ops = stac92xx_patch_ops;
5445 codec->proc_widget_hook = stac927x_proc_hook;
5449 * The STAC927x seem to require fairly long delays for certain
5450 * command sequences. With too short delays (even if the answer
5451 * is set to RIRB properly), it results in the silence output
5452 * on some hardwares like Dell.
5454 * The below flag enables the longer delay (see get_response
5457 codec->bus->needs_damn_long_delay = 1;
5459 /* no jack detecion for ref-no-jd model */
5460 if (spec->board_config == STAC_D965_REF_NO_JD)
5461 spec->hp_detect = 0;
5466 static int patch_stac9205(struct hda_codec *codec)
5468 struct sigmatel_spec *spec;
5471 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5476 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5477 spec->pin_nids = stac9205_pin_nids;
5478 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
5482 if (spec->board_config < 0)
5483 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
5485 stac92xx_set_config_regs(codec,
5486 stac9205_brd_tbl[spec->board_config]);
5488 spec->digbeep_nid = 0x23;
5489 spec->adc_nids = stac9205_adc_nids;
5490 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
5491 spec->mux_nids = stac9205_mux_nids;
5492 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
5493 spec->smux_nids = stac9205_smux_nids;
5494 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
5495 spec->dmic_nids = stac9205_dmic_nids;
5496 spec->num_dmics = STAC9205_NUM_DMICS;
5497 spec->dmux_nids = stac9205_dmux_nids;
5498 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
5501 spec->init = stac9205_core_init;
5502 spec->mixer = stac9205_mixer;
5503 spec->aloopback_ctl = stac9205_loopback;
5505 spec->aloopback_mask = 0x40;
5506 spec->aloopback_shift = 0;
5507 /* Turn on/off EAPD per HP plugging */
5508 if (spec->board_config != STAC_9205_EAPD)
5509 spec->eapd_switch = 1;
5510 spec->multiout.dac_nids = spec->dac_nids;
5512 switch (spec->board_config){
5513 case STAC_9205_DELL_M43:
5514 /* Enable SPDIF in/out */
5515 snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030);
5516 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
5518 /* Enable unsol response for GPIO4/Dock HP connection */
5519 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
5522 snd_hda_codec_write_cache(codec, codec->afg, 0,
5523 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
5524 snd_hda_codec_write_cache(codec, codec->afg, 0,
5525 AC_VERB_SET_UNSOLICITED_ENABLE,
5528 spec->gpio_dir = 0x0b;
5529 spec->eapd_mask = 0x01;
5530 spec->gpio_mask = 0x1b;
5531 spec->gpio_mute = 0x10;
5532 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
5535 spec->gpio_data = 0x01;
5538 /* SPDIF-In enabled */
5541 /* GPIO0 High = EAPD */
5542 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5543 spec->gpio_data = 0x01;
5547 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
5549 if (spec->board_config < 0) {
5550 printk(KERN_WARNING "hda_codec: No auto-config is "
5551 "available, default to model=ref\n");
5552 spec->board_config = STAC_9205_REF;
5558 stac92xx_free(codec);
5562 codec->patch_ops = stac92xx_patch_ops;
5564 codec->proc_widget_hook = stac9205_proc_hook;
5573 static struct hda_verb stac9872_core_init[] = {
5574 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5579 static struct snd_kcontrol_new stac9872_mixer[] = {
5580 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5581 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5585 static hda_nid_t stac9872_pin_nids[] = {
5586 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
5590 static hda_nid_t stac9872_adc_nids[] = {
5594 static hda_nid_t stac9872_mux_nids[] = {
5598 static unsigned int stac9872_vaio_pin_configs[9] = {
5599 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
5600 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
5604 static const char *stac9872_models[STAC_9872_MODELS] = {
5605 [STAC_9872_AUTO] = "auto",
5606 [STAC_9872_VAIO] = "vaio",
5609 static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
5610 [STAC_9872_VAIO] = stac9872_vaio_pin_configs,
5613 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5617 static int patch_stac9872(struct hda_codec *codec)
5619 struct sigmatel_spec *spec;
5622 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5627 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5630 if (spec->board_config < 0)
5631 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, "
5632 "using BIOS defaults\n");
5634 stac92xx_set_config_regs(codec,
5635 stac9872_brd_tbl[spec->board_config]);
5637 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
5638 spec->pin_nids = stac9872_pin_nids;
5639 spec->multiout.dac_nids = spec->dac_nids;
5640 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
5641 spec->adc_nids = stac9872_adc_nids;
5642 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
5643 spec->mux_nids = stac9872_mux_nids;
5644 spec->mixer = stac9872_mixer;
5645 spec->init = stac9872_core_init;
5647 err = stac92xx_parse_auto_config(codec, 0x10, 0x12);
5649 stac92xx_free(codec);
5652 spec->input_mux = &spec->private_imux;
5653 codec->patch_ops = stac92xx_patch_ops;
5661 static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5662 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5663 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5664 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
5665 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
5666 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
5667 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
5668 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
5669 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
5670 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
5671 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
5672 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
5673 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
5674 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
5675 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
5676 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
5677 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
5678 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
5679 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
5680 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
5681 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
5682 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
5683 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
5684 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
5685 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
5686 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
5687 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
5688 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
5689 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
5690 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
5691 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
5692 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
5693 /* The following does not take into account .id=0x83847661 when subsys =
5694 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
5695 * currently not fully supported.
5697 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
5698 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
5699 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
5700 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
5701 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
5702 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
5703 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
5704 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
5705 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
5706 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
5707 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
5708 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
5709 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
5710 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
5711 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
5712 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
5713 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
5714 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
5715 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5716 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
5717 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5718 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
5719 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5720 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
5721 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5722 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5726 MODULE_ALIAS("snd-hda-codec-id:8384*");
5727 MODULE_ALIAS("snd-hda-codec-id:111d*");
5729 MODULE_LICENSE("GPL");
5730 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5732 static struct hda_codec_preset_list sigmatel_list = {
5733 .preset = snd_hda_preset_sigmatel,
5734 .owner = THIS_MODULE,
5737 static int __init patch_sigmatel_init(void)
5739 return snd_hda_add_codec_preset(&sigmatel_list);
5742 static void __exit patch_sigmatel_exit(void)
5744 snd_hda_delete_codec_preset(&sigmatel_list);
5747 module_init(patch_sigmatel_init)
5748 module_exit(patch_sigmatel_exit)