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"
79 STAC_92HD73XX_NO_JD, /* no jack-detection */
92 STAC_92HD83XXX_PWR_REF,
107 STAC_92HD71BXX_MODELS
133 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
134 * is given, one of the above models will be
135 * chosen according to the subsystem id. */
136 /* for backward compatibility */
153 STAC_D965_REF_NO_JD, /* no jack-detection */
169 struct sigmatel_event {
176 struct sigmatel_jack {
179 struct snd_jack *jack;
182 struct sigmatel_mic_route {
184 unsigned char mux_idx;
185 unsigned char dmux_idx;
188 struct sigmatel_spec {
189 struct snd_kcontrol_new *mixers[4];
190 unsigned int num_mixers;
193 unsigned int eapd_switch: 1;
194 unsigned int surr_switch: 1;
195 unsigned int alt_switch: 1;
196 unsigned int hp_detect: 1;
197 unsigned int spdif_mute: 1;
198 unsigned int check_volume_offset:1;
199 unsigned int auto_mic:1;
202 unsigned int eapd_mask;
203 unsigned int gpio_mask;
204 unsigned int gpio_dir;
205 unsigned int gpio_data;
206 unsigned int gpio_mute;
207 unsigned int gpio_led;
210 unsigned int stream_delay;
212 /* analog loopback */
213 struct snd_kcontrol_new *aloopback_ctl;
214 unsigned char aloopback_mask;
215 unsigned char aloopback_shift;
217 /* power management */
218 unsigned int num_pwrs;
219 unsigned int *pwr_mapping;
224 struct snd_array jacks;
227 struct snd_array events;
230 struct hda_input_mux *mono_mux;
231 struct hda_input_mux *amp_mux;
232 unsigned int cur_mmux;
233 struct hda_multi_out multiout;
234 hda_nid_t dac_nids[5];
235 hda_nid_t hp_dacs[5];
236 hda_nid_t speaker_dacs[5];
242 unsigned int num_adcs;
244 unsigned int num_muxes;
245 hda_nid_t *dmic_nids;
246 unsigned int num_dmics;
247 hda_nid_t *dmux_nids;
248 unsigned int num_dmuxes;
249 hda_nid_t *smux_nids;
250 unsigned int num_smuxes;
251 unsigned int num_analog_muxes;
253 unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
254 unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
255 unsigned int num_caps; /* number of capture volume/switch elements */
257 struct sigmatel_mic_route ext_mic;
258 struct sigmatel_mic_route int_mic;
260 const char **spdif_labels;
262 hda_nid_t dig_in_nid;
264 hda_nid_t anabeep_nid;
265 hda_nid_t digbeep_nid;
269 unsigned int num_pins;
271 /* codec specific stuff */
272 struct hda_verb *init;
273 struct snd_kcontrol_new *mixer;
276 struct hda_input_mux *dinput_mux;
277 unsigned int cur_dmux[2];
278 struct hda_input_mux *input_mux;
279 unsigned int cur_mux[3];
280 struct hda_input_mux *sinput_mux;
281 unsigned int cur_smux[2];
282 unsigned int cur_amux;
284 unsigned int num_amps;
285 unsigned int powerdown_adcs;
288 unsigned int io_switch[2];
289 unsigned int clfe_swap;
290 hda_nid_t line_switch; /* shared line-in for input and output */
291 hda_nid_t mic_switch; /* shared mic-in for input and output */
292 hda_nid_t hp_switch; /* NID of HP as line-out */
293 unsigned int aloopback;
295 struct hda_pcm pcm_rec[2]; /* PCM information */
297 /* dynamic controls and input_mux */
298 struct auto_pin_cfg autocfg;
299 struct snd_array kctls;
300 struct hda_input_mux private_dimux;
301 struct hda_input_mux private_imux;
302 struct hda_input_mux private_smux;
303 struct hda_input_mux private_amp_mux;
304 struct hda_input_mux private_mono_mux;
307 static hda_nid_t stac9200_adc_nids[1] = {
311 static hda_nid_t stac9200_mux_nids[1] = {
315 static hda_nid_t stac9200_dac_nids[1] = {
319 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
320 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
324 static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
328 static hda_nid_t stac92hd73xx_adc_nids[2] = {
332 #define DELL_M6_AMP 2
333 static hda_nid_t stac92hd73xx_amp_nids[3] = {
337 #define STAC92HD73XX_NUM_DMICS 2
338 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
342 #define STAC92HD73_DAC_COUNT 5
344 static hda_nid_t stac92hd73xx_mux_nids[4] = {
345 0x28, 0x29, 0x2a, 0x2b,
348 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
352 static hda_nid_t stac92hd73xx_smux_nids[2] = {
356 #define STAC92HD73XX_NUM_CAPS 2
357 static unsigned long stac92hd73xx_capvols[] = {
358 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
359 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
361 #define stac92hd73xx_capsws stac92hd73xx_capvols
363 #define STAC92HD83_DAC_COUNT 3
365 static hda_nid_t stac92hd83xxx_mux_nids[2] = {
369 static hda_nid_t stac92hd83xxx_adc_nids[2] = {
373 static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
377 static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
381 static unsigned int stac92hd83xxx_pwr_mapping[4] = {
382 0x03, 0x0c, 0x20, 0x40,
385 #define STAC92HD83XXX_NUM_CAPS 2
386 static unsigned long stac92hd83xxx_capvols[] = {
387 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
388 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_OUTPUT),
390 #define stac92hd83xxx_capsws stac92hd83xxx_capvols
392 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
396 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
400 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
404 static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
408 static hda_nid_t stac92hd71bxx_smux_nids[2] = {
412 #define STAC92HD71BXX_NUM_DMICS 2
413 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
417 static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
421 #define STAC92HD71BXX_NUM_CAPS 2
422 static unsigned long stac92hd71bxx_capvols[] = {
423 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
424 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
426 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
428 static hda_nid_t stac925x_adc_nids[1] = {
432 static hda_nid_t stac925x_mux_nids[1] = {
436 static hda_nid_t stac925x_dac_nids[1] = {
440 #define STAC925X_NUM_DMICS 1
441 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
445 static hda_nid_t stac925x_dmux_nids[1] = {
449 static unsigned long stac925x_capvols[] = {
450 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
452 static unsigned long stac925x_capsws[] = {
453 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
456 static hda_nid_t stac922x_adc_nids[2] = {
460 static hda_nid_t stac922x_mux_nids[2] = {
464 #define STAC922X_NUM_CAPS 2
465 static unsigned long stac922x_capvols[] = {
466 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
467 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
469 #define stac922x_capsws stac922x_capvols
471 static hda_nid_t stac927x_slave_dig_outs[2] = {
475 static hda_nid_t stac927x_adc_nids[3] = {
479 static hda_nid_t stac927x_mux_nids[3] = {
483 static hda_nid_t stac927x_smux_nids[1] = {
487 static hda_nid_t stac927x_dac_nids[6] = {
488 0x02, 0x03, 0x04, 0x05, 0x06, 0
491 static hda_nid_t stac927x_dmux_nids[1] = {
495 #define STAC927X_NUM_DMICS 2
496 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
500 #define STAC927X_NUM_CAPS 3
501 static unsigned long stac927x_capvols[] = {
502 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
503 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
504 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
506 static unsigned long stac927x_capsws[] = {
507 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
508 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
509 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
512 static const char *stac927x_spdif_labels[5] = {
513 "Digital Playback", "ADAT", "Analog Mux 1",
514 "Analog Mux 2", "Analog Mux 3"
517 static hda_nid_t stac9205_adc_nids[2] = {
521 static hda_nid_t stac9205_mux_nids[2] = {
525 static hda_nid_t stac9205_dmux_nids[1] = {
529 static hda_nid_t stac9205_smux_nids[1] = {
533 #define STAC9205_NUM_DMICS 2
534 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
538 #define STAC9205_NUM_CAPS 2
539 static unsigned long stac9205_capvols[] = {
540 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
541 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
543 static unsigned long stac9205_capsws[] = {
544 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
545 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
548 static hda_nid_t stac9200_pin_nids[8] = {
549 0x08, 0x09, 0x0d, 0x0e,
550 0x0f, 0x10, 0x11, 0x12,
553 static hda_nid_t stac925x_pin_nids[8] = {
554 0x07, 0x08, 0x0a, 0x0b,
555 0x0c, 0x0d, 0x10, 0x11,
558 static hda_nid_t stac922x_pin_nids[10] = {
559 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
560 0x0f, 0x10, 0x11, 0x15, 0x1b,
563 static hda_nid_t stac92hd73xx_pin_nids[13] = {
564 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
565 0x0f, 0x10, 0x11, 0x12, 0x13,
569 static hda_nid_t stac92hd83xxx_pin_nids[10] = {
570 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
571 0x0f, 0x10, 0x11, 0x1f, 0x20,
574 #define STAC92HD71BXX_NUM_PINS 13
575 static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
576 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
577 0x00, 0x14, 0x18, 0x19, 0x1e,
580 static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
581 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
582 0x0f, 0x14, 0x18, 0x19, 0x1e,
586 static hda_nid_t stac927x_pin_nids[14] = {
587 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
588 0x0f, 0x10, 0x11, 0x12, 0x13,
589 0x14, 0x21, 0x22, 0x23,
592 static hda_nid_t stac9205_pin_nids[12] = {
593 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
594 0x0f, 0x14, 0x16, 0x17, 0x18,
598 #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info
600 static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_value *ucontrol)
603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
604 struct sigmatel_spec *spec = codec->spec;
605 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
607 kcontrol->private_value ^= get_amp_nid(kcontrol);
608 kcontrol->private_value |= nid;
610 return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
613 static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol,
614 struct snd_ctl_elem_value *ucontrol)
616 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
617 struct sigmatel_spec *spec = codec->spec;
618 hda_nid_t nid = spec->amp_nids[spec->cur_amux];
620 kcontrol->private_value ^= get_amp_nid(kcontrol);
621 kcontrol->private_value |= nid;
623 return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
626 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_info *uinfo)
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
630 struct sigmatel_spec *spec = codec->spec;
631 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
634 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
635 struct snd_ctl_elem_value *ucontrol)
637 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
638 struct sigmatel_spec *spec = codec->spec;
639 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
641 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
645 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
646 struct snd_ctl_elem_value *ucontrol)
648 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
649 struct sigmatel_spec *spec = codec->spec;
650 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
652 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
653 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
656 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
657 struct snd_ctl_elem_info *uinfo)
659 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
660 struct sigmatel_spec *spec = codec->spec;
661 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
664 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
665 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 struct sigmatel_spec *spec = codec->spec;
669 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
671 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
675 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
676 struct snd_ctl_elem_value *ucontrol)
678 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
679 struct sigmatel_spec *spec = codec->spec;
680 struct hda_input_mux *smux = &spec->private_smux;
681 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
685 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
686 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
690 if (spec->spdif_mute) {
692 nid = spec->multiout.dig_out_nid;
694 nid = codec->slave_dig_outs[smux_idx - 1];
695 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
699 /* un/mute SPDIF out */
700 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
706 static unsigned int stac92xx_vref_set(struct hda_codec *codec,
707 hda_nid_t nid, unsigned int new_vref)
711 pincfg = snd_hda_codec_read(codec, nid, 0,
712 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
715 pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
718 if (new_vref == AC_PINCTL_VREF_HIZ)
719 pincfg |= AC_PINCTL_OUT_EN;
721 pincfg |= AC_PINCTL_IN_EN;
723 error = snd_hda_codec_write_cache(codec, nid, 0,
724 AC_VERB_SET_PIN_WIDGET_CONTROL, pincfg);
731 static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid)
734 vref = snd_hda_codec_read(codec, nid, 0,
735 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
736 vref &= AC_PINCTL_VREFEN;
740 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
743 struct sigmatel_spec *spec = codec->spec;
744 return snd_hda_input_mux_info(spec->input_mux, uinfo);
747 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
749 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
750 struct sigmatel_spec *spec = codec->spec;
751 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
753 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
757 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
760 struct sigmatel_spec *spec = codec->spec;
761 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
762 const struct hda_input_mux *imux = spec->input_mux;
763 unsigned int idx, prev_idx;
765 idx = ucontrol->value.enumerated.item[0];
766 if (idx >= imux->num_items)
767 idx = imux->num_items - 1;
768 prev_idx = spec->cur_mux[adc_idx];
771 if (idx < spec->num_analog_muxes) {
772 snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0,
773 AC_VERB_SET_CONNECT_SEL,
774 imux->items[idx].index);
775 if (prev_idx >= spec->num_analog_muxes) {
776 imux = spec->dinput_mux;
778 snd_hda_codec_write_cache(codec,
779 spec->dmux_nids[adc_idx], 0,
780 AC_VERB_SET_CONNECT_SEL,
781 imux->items[0].index);
784 imux = spec->dinput_mux;
785 snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0,
786 AC_VERB_SET_CONNECT_SEL,
787 imux->items[idx - 1].index);
789 spec->cur_mux[adc_idx] = idx;
793 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_info *uinfo)
796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
797 struct sigmatel_spec *spec = codec->spec;
798 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
801 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
802 struct snd_ctl_elem_value *ucontrol)
804 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
805 struct sigmatel_spec *spec = codec->spec;
807 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
811 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
812 struct snd_ctl_elem_value *ucontrol)
814 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
815 struct sigmatel_spec *spec = codec->spec;
817 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
818 spec->mono_nid, &spec->cur_mmux);
821 static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol,
822 struct snd_ctl_elem_info *uinfo)
824 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
825 struct sigmatel_spec *spec = codec->spec;
826 return snd_hda_input_mux_info(spec->amp_mux, uinfo);
829 static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol,
830 struct snd_ctl_elem_value *ucontrol)
832 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
833 struct sigmatel_spec *spec = codec->spec;
835 ucontrol->value.enumerated.item[0] = spec->cur_amux;
839 static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol,
840 struct snd_ctl_elem_value *ucontrol)
842 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
843 struct sigmatel_spec *spec = codec->spec;
844 struct snd_kcontrol *ctl =
845 snd_hda_find_mixer_ctl(codec, "Amp Capture Volume");
849 snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE |
850 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
852 return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol,
856 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
858 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
859 struct snd_ctl_elem_value *ucontrol)
861 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
862 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
863 struct sigmatel_spec *spec = codec->spec;
865 ucontrol->value.integer.value[0] = !!(spec->aloopback &
866 (spec->aloopback_mask << idx));
870 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
871 struct snd_ctl_elem_value *ucontrol)
873 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
874 struct sigmatel_spec *spec = codec->spec;
875 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
876 unsigned int dac_mode;
877 unsigned int val, idx_val;
879 idx_val = spec->aloopback_mask << idx;
880 if (ucontrol->value.integer.value[0])
881 val = spec->aloopback | idx_val;
883 val = spec->aloopback & ~idx_val;
884 if (spec->aloopback == val)
887 spec->aloopback = val;
889 /* Only return the bits defined by the shift value of the
890 * first two bytes of the mask
892 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
893 kcontrol->private_value & 0xFFFF, 0x0);
894 dac_mode >>= spec->aloopback_shift;
896 if (spec->aloopback & idx_val) {
897 snd_hda_power_up(codec);
900 snd_hda_power_down(codec);
901 dac_mode &= ~idx_val;
904 snd_hda_codec_write_cache(codec, codec->afg, 0,
905 kcontrol->private_value >> 16, dac_mode);
910 static struct hda_verb stac9200_core_init[] = {
911 /* set dac0mux for dac converter */
912 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
916 static struct hda_verb stac9200_eapd_init[] = {
917 /* set dac0mux for dac converter */
918 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
919 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
923 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
924 /* set master volume and direct control */
925 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
926 /* setup adcs to point to mixer */
927 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
928 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
929 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
930 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
931 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
932 /* setup import muxs */
933 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
934 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
935 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
936 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
940 static struct hda_verb dell_eq_core_init[] = {
941 /* set master volume to max value without distortion
942 * and direct control */
943 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
944 /* setup adcs to point to mixer */
945 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
946 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
947 /* setup import muxs */
948 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
949 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
950 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
951 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
955 static struct hda_verb dell_m6_core_init[] = {
956 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
957 /* setup adcs to point to mixer */
958 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
959 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
960 /* setup import muxs */
961 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
962 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
963 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
964 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
968 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
969 /* set master volume and direct control */
970 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
971 /* setup adcs to point to mixer */
972 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
973 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
974 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
975 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
976 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
977 /* setup import muxs */
978 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
979 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
980 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
981 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
985 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
986 /* set master volume and direct control */
987 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
988 /* dac3 is connected to import3 mux */
989 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
990 /* setup adcs to point to mixer */
991 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
992 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
993 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
994 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
995 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
996 /* setup import muxs */
997 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
998 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
999 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
1000 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
1004 static struct hda_verb stac92hd83xxx_core_init[] = {
1005 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1},
1006 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1},
1007 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0},
1009 /* power state controls amps */
1010 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
1014 static struct hda_verb stac92hd71bxx_core_init[] = {
1015 /* set master volume and direct control */
1016 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1020 static struct hda_verb stac92hd71bxx_unmute_core_init[] = {
1021 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
1022 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1023 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1024 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1028 static struct hda_verb stac925x_core_init[] = {
1029 /* set dac0mux for dac converter */
1030 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
1031 /* mute the master volume */
1032 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1036 static struct hda_verb stac922x_core_init[] = {
1037 /* set master volume and direct control */
1038 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1042 static struct hda_verb d965_core_init[] = {
1043 /* set master volume and direct control */
1044 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1045 /* unmute node 0x1b */
1046 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1047 /* select node 0x03 as DAC */
1048 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1052 static struct hda_verb stac927x_core_init[] = {
1053 /* set master volume and direct control */
1054 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1055 /* enable analog pc beep path */
1056 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1060 static struct hda_verb stac9205_core_init[] = {
1061 /* set master volume and direct control */
1062 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
1063 /* enable analog pc beep path */
1064 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1068 #define STAC_MONO_MUX \
1070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1071 .name = "Mono Mux", \
1073 .info = stac92xx_mono_mux_enum_info, \
1074 .get = stac92xx_mono_mux_enum_get, \
1075 .put = stac92xx_mono_mux_enum_put, \
1078 #define STAC_AMP_MUX \
1080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1081 .name = "Amp Selector Capture Switch", \
1083 .info = stac92xx_amp_mux_enum_info, \
1084 .get = stac92xx_amp_mux_enum_get, \
1085 .put = stac92xx_amp_mux_enum_put, \
1088 #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \
1090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1093 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1094 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1095 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
1096 .info = stac92xx_amp_volume_info, \
1097 .get = stac92xx_amp_volume_get, \
1098 .put = stac92xx_amp_volume_put, \
1099 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
1100 .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \
1103 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
1105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1106 .name = "Analog Loopback", \
1108 .info = stac92xx_aloopback_info, \
1109 .get = stac92xx_aloopback_get, \
1110 .put = stac92xx_aloopback_put, \
1111 .private_value = verb_read | (verb_write << 16), \
1114 #define DC_BIAS(xname, idx, nid) \
1116 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1119 .info = stac92xx_dc_bias_info, \
1120 .get = stac92xx_dc_bias_get, \
1121 .put = stac92xx_dc_bias_put, \
1122 .private_value = nid, \
1125 static struct snd_kcontrol_new stac9200_mixer[] = {
1126 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
1127 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1128 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1129 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1133 #define DELL_M6_MIXER 6
1134 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
1135 /* start of config #1 */
1136 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1137 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1139 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1140 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1142 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1143 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1145 /* start of config #2 */
1146 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1147 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1149 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1150 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1155 static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
1156 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1160 static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
1161 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1165 static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1166 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1170 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
1171 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1172 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1174 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1175 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1177 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1178 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1180 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1181 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1183 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1184 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1188 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
1189 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
1190 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
1192 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
1193 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
1195 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
1196 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
1199 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
1201 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
1202 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
1207 static struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1208 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1211 static struct snd_kcontrol_new stac925x_mixer[] = {
1212 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
1213 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1217 static struct snd_kcontrol_new stac9205_loopback[] = {
1218 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1222 static struct snd_kcontrol_new stac927x_loopback[] = {
1223 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1227 static struct snd_kcontrol_new stac_dmux_mixer = {
1228 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1229 .name = "Digital Input Source",
1230 /* count set later */
1231 .info = stac92xx_dmux_enum_info,
1232 .get = stac92xx_dmux_enum_get,
1233 .put = stac92xx_dmux_enum_put,
1236 static struct snd_kcontrol_new stac_smux_mixer = {
1237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1238 .name = "IEC958 Playback Source",
1239 /* count set later */
1240 .info = stac92xx_smux_enum_info,
1241 .get = stac92xx_smux_enum_get,
1242 .put = stac92xx_smux_enum_put,
1245 static const char *slave_vols[] = {
1246 "Front Playback Volume",
1247 "Surround Playback Volume",
1248 "Center Playback Volume",
1249 "LFE Playback Volume",
1250 "Side Playback Volume",
1251 "Headphone Playback Volume",
1252 "Speaker Playback Volume",
1256 static const char *slave_sws[] = {
1257 "Front Playback Switch",
1258 "Surround Playback Switch",
1259 "Center Playback Switch",
1260 "LFE Playback Switch",
1261 "Side Playback Switch",
1262 "Headphone Playback Switch",
1263 "Speaker Playback Switch",
1264 "IEC958 Playback Switch",
1268 static void stac92xx_free_kctls(struct hda_codec *codec);
1269 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1271 static int stac92xx_build_controls(struct hda_codec *codec)
1273 struct sigmatel_spec *spec = codec->spec;
1274 struct auto_pin_cfg *cfg = &spec->autocfg;
1280 err = snd_hda_add_new_ctls(codec, spec->mixer);
1285 for (i = 0; i < spec->num_mixers; i++) {
1286 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1290 if (!spec->auto_mic && spec->num_dmuxes > 0 &&
1291 snd_hda_get_bool_hint(codec, "separate_dmux") == 1) {
1292 stac_dmux_mixer.count = spec->num_dmuxes;
1293 err = snd_hda_ctl_add(codec,
1294 snd_ctl_new1(&stac_dmux_mixer, codec));
1298 if (spec->num_smuxes > 0) {
1299 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1300 struct hda_input_mux *smux = &spec->private_smux;
1301 /* check for mute support on SPDIF out */
1302 if (wcaps & AC_WCAP_OUT_AMP) {
1303 smux->items[smux->num_items].label = "Off";
1304 smux->items[smux->num_items].index = 0;
1306 spec->spdif_mute = 1;
1308 stac_smux_mixer.count = spec->num_smuxes;
1309 err = snd_hda_ctl_add(codec,
1310 snd_ctl_new1(&stac_smux_mixer, codec));
1315 if (spec->multiout.dig_out_nid) {
1316 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
1319 err = snd_hda_create_spdif_share_sw(codec,
1323 spec->multiout.share_spdif = 1;
1325 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1326 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1331 /* if we have no master control, let's create it */
1332 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1333 unsigned int vmaster_tlv[4];
1334 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1335 HDA_OUTPUT, vmaster_tlv);
1336 /* correct volume offset */
1337 vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
1338 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1339 vmaster_tlv, slave_vols);
1343 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1344 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1350 if (spec->aloopback_ctl &&
1351 snd_hda_get_bool_hint(codec, "loopback") == 1) {
1352 err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl);
1357 stac92xx_free_kctls(codec); /* no longer needed */
1359 /* create jack input elements */
1360 if (spec->hp_detect) {
1361 for (i = 0; i < cfg->hp_outs; i++) {
1362 int type = SND_JACK_HEADPHONE;
1363 nid = cfg->hp_pins[i];
1364 /* jack detection */
1365 if (cfg->hp_outs == i)
1366 type |= SND_JACK_LINEOUT;
1367 err = stac92xx_add_jack(codec, nid, type);
1372 for (i = 0; i < cfg->line_outs; i++) {
1373 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1378 for (i = 0; i < AUTO_PIN_LAST; i++) {
1379 nid = cfg->input_pins[i];
1381 err = stac92xx_add_jack(codec, nid,
1382 SND_JACK_MICROPHONE);
1391 static unsigned int ref9200_pin_configs[8] = {
1392 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1393 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1396 static unsigned int gateway9200_m4_pin_configs[8] = {
1397 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1398 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1400 static unsigned int gateway9200_m4_2_pin_configs[8] = {
1401 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1402 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1406 STAC 9200 pin configs for
1411 static unsigned int dell9200_d21_pin_configs[8] = {
1412 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1413 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1417 STAC 9200 pin configs for
1421 static unsigned int dell9200_d22_pin_configs[8] = {
1422 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1423 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1427 STAC 9200 pin configs for
1428 102801C4 (Dell Dimension E310)
1435 static unsigned int dell9200_d23_pin_configs[8] = {
1436 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1437 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1442 STAC 9200-32 pin configs for
1443 102801B5 (Dell Inspiron 630m)
1444 102801D8 (Dell Inspiron 640m)
1446 static unsigned int dell9200_m21_pin_configs[8] = {
1447 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1448 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1452 STAC 9200-32 pin configs for
1453 102801C2 (Dell Latitude D620)
1455 102801CC (Dell Latitude D820)
1459 static unsigned int dell9200_m22_pin_configs[8] = {
1460 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1461 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1465 STAC 9200-32 pin configs for
1466 102801CE (Dell XPS M1710)
1467 102801CF (Dell Precision M90)
1469 static unsigned int dell9200_m23_pin_configs[8] = {
1470 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1471 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1475 STAC 9200-32 pin configs for
1478 102801CB (Dell Latitude 120L)
1481 static unsigned int dell9200_m24_pin_configs[8] = {
1482 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1483 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1487 STAC 9200-32 pin configs for
1488 102801BD (Dell Inspiron E1505n)
1492 static unsigned int dell9200_m25_pin_configs[8] = {
1493 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1494 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1498 STAC 9200-32 pin configs for
1499 102801F5 (Dell Inspiron 1501)
1502 static unsigned int dell9200_m26_pin_configs[8] = {
1503 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1504 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1509 102801CD (Dell Inspiron E1705/9400)
1511 static unsigned int dell9200_m27_pin_configs[8] = {
1512 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1513 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1516 static unsigned int oqo9200_pin_configs[8] = {
1517 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1518 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1522 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1523 [STAC_REF] = ref9200_pin_configs,
1524 [STAC_9200_OQO] = oqo9200_pin_configs,
1525 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1526 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1527 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1528 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1529 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1530 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1531 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1532 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1533 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1534 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1535 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1536 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1537 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1540 static const char *stac9200_models[STAC_9200_MODELS] = {
1541 [STAC_AUTO] = "auto",
1543 [STAC_9200_OQO] = "oqo",
1544 [STAC_9200_DELL_D21] = "dell-d21",
1545 [STAC_9200_DELL_D22] = "dell-d22",
1546 [STAC_9200_DELL_D23] = "dell-d23",
1547 [STAC_9200_DELL_M21] = "dell-m21",
1548 [STAC_9200_DELL_M22] = "dell-m22",
1549 [STAC_9200_DELL_M23] = "dell-m23",
1550 [STAC_9200_DELL_M24] = "dell-m24",
1551 [STAC_9200_DELL_M25] = "dell-m25",
1552 [STAC_9200_DELL_M26] = "dell-m26",
1553 [STAC_9200_DELL_M27] = "dell-m27",
1554 [STAC_9200_M4] = "gateway-m4",
1555 [STAC_9200_M4_2] = "gateway-m4-2",
1556 [STAC_9200_PANASONIC] = "panasonic",
1559 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1560 /* SigmaTel reference board */
1561 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1562 "DFI LanParty", STAC_REF),
1563 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1564 "DFI LanParty", STAC_REF),
1565 /* Dell laptops have BIOS problem */
1566 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1567 "unknown Dell", STAC_9200_DELL_D21),
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1569 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1570 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1571 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1573 "unknown Dell", STAC_9200_DELL_D22),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1575 "unknown Dell", STAC_9200_DELL_D22),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1577 "Dell Latitude D620", STAC_9200_DELL_M22),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1579 "unknown Dell", STAC_9200_DELL_D23),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1581 "unknown Dell", STAC_9200_DELL_D23),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1583 "unknown Dell", STAC_9200_DELL_M22),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1585 "unknown Dell", STAC_9200_DELL_M24),
1586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1587 "unknown Dell", STAC_9200_DELL_M24),
1588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1589 "Dell Latitude 120L", STAC_9200_DELL_M24),
1590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1591 "Dell Latitude D820", STAC_9200_DELL_M22),
1592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1593 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1595 "Dell XPS M1710", STAC_9200_DELL_M23),
1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1597 "Dell Precision M90", STAC_9200_DELL_M23),
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1599 "unknown Dell", STAC_9200_DELL_M22),
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1601 "unknown Dell", STAC_9200_DELL_M22),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1603 "unknown Dell", STAC_9200_DELL_M22),
1604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1605 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1607 "unknown Dell", STAC_9200_DELL_D23),
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1609 "unknown Dell", STAC_9200_DELL_D23),
1610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1611 "unknown Dell", STAC_9200_DELL_D21),
1612 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1613 "unknown Dell", STAC_9200_DELL_D23),
1614 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1615 "unknown Dell", STAC_9200_DELL_D21),
1616 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1617 "unknown Dell", STAC_9200_DELL_M25),
1618 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1619 "unknown Dell", STAC_9200_DELL_M25),
1620 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1621 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1622 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1623 "unknown Dell", STAC_9200_DELL_M26),
1625 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1626 /* Gateway machines needs EAPD to be set on resume */
1627 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1628 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1629 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1631 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1635 static unsigned int ref925x_pin_configs[8] = {
1636 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1637 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1640 static unsigned int stac925xM1_pin_configs[8] = {
1641 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1642 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1645 static unsigned int stac925xM1_2_pin_configs[8] = {
1646 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1647 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1650 static unsigned int stac925xM2_pin_configs[8] = {
1651 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1652 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1655 static unsigned int stac925xM2_2_pin_configs[8] = {
1656 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1657 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1660 static unsigned int stac925xM3_pin_configs[8] = {
1661 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1662 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1665 static unsigned int stac925xM5_pin_configs[8] = {
1666 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1667 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1670 static unsigned int stac925xM6_pin_configs[8] = {
1671 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1672 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1675 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1676 [STAC_REF] = ref925x_pin_configs,
1677 [STAC_M1] = stac925xM1_pin_configs,
1678 [STAC_M1_2] = stac925xM1_2_pin_configs,
1679 [STAC_M2] = stac925xM2_pin_configs,
1680 [STAC_M2_2] = stac925xM2_2_pin_configs,
1681 [STAC_M3] = stac925xM3_pin_configs,
1682 [STAC_M5] = stac925xM5_pin_configs,
1683 [STAC_M6] = stac925xM6_pin_configs,
1686 static const char *stac925x_models[STAC_925x_MODELS] = {
1687 [STAC_925x_AUTO] = "auto",
1690 [STAC_M1_2] = "m1-2",
1692 [STAC_M2_2] = "m2-2",
1698 static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1699 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1700 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1701 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1702 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1703 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1704 /* Not sure about the brand name for those */
1705 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1706 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1707 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1708 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1712 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1713 /* SigmaTel reference board */
1714 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1715 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1716 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1718 /* Default table for unknown ID */
1719 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1724 static unsigned int ref92hd73xx_pin_configs[13] = {
1725 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1726 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1727 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1731 static unsigned int dell_m6_pin_configs[13] = {
1732 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1733 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1734 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1738 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1739 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1740 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1741 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1742 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1743 [STAC_DELL_EQ] = dell_m6_pin_configs,
1746 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1747 [STAC_92HD73XX_AUTO] = "auto",
1748 [STAC_92HD73XX_NO_JD] = "no-jd",
1749 [STAC_92HD73XX_REF] = "ref",
1750 [STAC_92HD73XX_INTEL] = "intel",
1751 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1752 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1753 [STAC_DELL_M6_BOTH] = "dell-m6",
1754 [STAC_DELL_EQ] = "dell-eq",
1757 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1758 /* SigmaTel reference board */
1759 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1760 "DFI LanParty", STAC_92HD73XX_REF),
1761 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1762 "DFI LanParty", STAC_92HD73XX_REF),
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1764 "Intel DG45ID", STAC_92HD73XX_INTEL),
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1766 "Intel DG45FC", STAC_92HD73XX_INTEL),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1768 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1770 "unknown Dell", STAC_DELL_M6_DMIC),
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1772 "unknown Dell", STAC_DELL_M6_BOTH),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1774 "unknown Dell", STAC_DELL_M6_BOTH),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1776 "unknown Dell", STAC_DELL_M6_AMIC),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1778 "unknown Dell", STAC_DELL_M6_AMIC),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1780 "unknown Dell", STAC_DELL_M6_DMIC),
1781 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1782 "unknown Dell", STAC_DELL_M6_DMIC),
1783 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1784 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1785 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1786 "Dell Studio 17", STAC_DELL_M6_DMIC),
1787 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1788 "Dell Studio 1555", STAC_DELL_M6_DMIC),
1792 static unsigned int ref92hd83xxx_pin_configs[10] = {
1793 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1794 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1795 0x01451160, 0x98560170,
1798 static unsigned int dell_s14_pin_configs[10] = {
1799 0x02214030, 0x02211010, 0x02a19020, 0x01014050,
1800 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160,
1801 0x40f000f0, 0x40f000f0,
1804 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1805 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1806 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1807 [STAC_DELL_S14] = dell_s14_pin_configs,
1810 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1811 [STAC_92HD83XXX_AUTO] = "auto",
1812 [STAC_92HD83XXX_REF] = "ref",
1813 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1814 [STAC_DELL_S14] = "dell-s14",
1817 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1818 /* SigmaTel reference board */
1819 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1820 "DFI LanParty", STAC_92HD83XXX_REF),
1821 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1822 "DFI LanParty", STAC_92HD83XXX_REF),
1823 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
1824 "unknown Dell", STAC_DELL_S14),
1828 static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1829 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1830 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1831 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1835 static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1836 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1837 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1838 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1842 static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1843 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1844 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1845 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1849 static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1850 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1851 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1852 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1856 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1857 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1858 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1859 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1860 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1861 [STAC_HP_M4] = NULL,
1862 [STAC_HP_DV5] = NULL,
1863 [STAC_HP_HDX] = NULL,
1864 [STAC_HP_DV4_1222NR] = NULL,
1867 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1868 [STAC_92HD71BXX_AUTO] = "auto",
1869 [STAC_92HD71BXX_REF] = "ref",
1870 [STAC_DELL_M4_1] = "dell-m4-1",
1871 [STAC_DELL_M4_2] = "dell-m4-2",
1872 [STAC_DELL_M4_3] = "dell-m4-3",
1873 [STAC_HP_M4] = "hp-m4",
1874 [STAC_HP_DV5] = "hp-dv5",
1875 [STAC_HP_HDX] = "hp-hdx",
1876 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
1879 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1880 /* SigmaTel reference board */
1881 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1882 "DFI LanParty", STAC_92HD71BXX_REF),
1883 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1884 "DFI LanParty", STAC_92HD71BXX_REF),
1885 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb,
1886 "HP dv4-1222nr", STAC_HP_DV4_1222NR),
1887 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
1889 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
1890 "HP dv4-7", STAC_HP_DV5),
1891 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
1892 "HP dv4-7", STAC_HP_DV5),
1893 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
1894 "HP HDX", STAC_HP_HDX), /* HDX18 */
1895 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1896 "HP mini 1000", STAC_HP_M4),
1897 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
1898 "HP HDX", STAC_HP_HDX), /* HDX16 */
1899 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
1901 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1902 "unknown Dell", STAC_DELL_M4_1),
1903 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1904 "unknown Dell", STAC_DELL_M4_1),
1905 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1906 "unknown Dell", STAC_DELL_M4_1),
1907 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1908 "unknown Dell", STAC_DELL_M4_1),
1909 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1910 "unknown Dell", STAC_DELL_M4_1),
1911 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1912 "unknown Dell", STAC_DELL_M4_1),
1913 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1914 "unknown Dell", STAC_DELL_M4_1),
1915 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1916 "unknown Dell", STAC_DELL_M4_2),
1917 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1918 "unknown Dell", STAC_DELL_M4_2),
1919 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1920 "unknown Dell", STAC_DELL_M4_2),
1921 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1922 "unknown Dell", STAC_DELL_M4_2),
1923 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1924 "unknown Dell", STAC_DELL_M4_3),
1928 static unsigned int ref922x_pin_configs[10] = {
1929 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1930 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1931 0x40000100, 0x40000100,
1935 STAC 922X pin configs for
1942 static unsigned int dell_922x_d81_pin_configs[10] = {
1943 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1944 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1945 0x01813122, 0x400001f2,
1949 STAC 922X pin configs for
1953 static unsigned int dell_922x_d82_pin_configs[10] = {
1954 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1955 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1956 0x01813122, 0x400001f1,
1960 STAC 922X pin configs for
1963 static unsigned int dell_922x_m81_pin_configs[10] = {
1964 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1965 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1966 0x40C003f1, 0x405003f0,
1970 STAC 9221 A1 pin configs for
1971 102801D7 (Dell XPS M1210)
1973 static unsigned int dell_922x_m82_pin_configs[10] = {
1974 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1975 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1976 0x508003f3, 0x405003f4,
1979 static unsigned int d945gtp3_pin_configs[10] = {
1980 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1981 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1982 0x02a19120, 0x40000100,
1985 static unsigned int d945gtp5_pin_configs[10] = {
1986 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1987 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1988 0x02a19320, 0x40000100,
1991 static unsigned int intel_mac_v1_pin_configs[10] = {
1992 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1993 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1994 0x400000fc, 0x400000fb,
1997 static unsigned int intel_mac_v2_pin_configs[10] = {
1998 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1999 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
2000 0x400000fc, 0x400000fb,
2003 static unsigned int intel_mac_v3_pin_configs[10] = {
2004 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
2005 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
2006 0x400000fc, 0x400000fb,
2009 static unsigned int intel_mac_v4_pin_configs[10] = {
2010 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
2011 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
2012 0x400000fc, 0x400000fb,
2015 static unsigned int intel_mac_v5_pin_configs[10] = {
2016 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
2017 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
2018 0x400000fc, 0x400000fb,
2021 static unsigned int ecs202_pin_configs[10] = {
2022 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
2023 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
2024 0x9037012e, 0x40e000f2,
2027 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
2028 [STAC_D945_REF] = ref922x_pin_configs,
2029 [STAC_D945GTP3] = d945gtp3_pin_configs,
2030 [STAC_D945GTP5] = d945gtp5_pin_configs,
2031 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
2032 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
2033 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
2034 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
2035 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
2036 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
2037 /* for backward compatibility */
2038 [STAC_MACMINI] = intel_mac_v3_pin_configs,
2039 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
2040 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
2041 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
2042 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
2043 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
2044 [STAC_ECS_202] = ecs202_pin_configs,
2045 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
2046 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
2047 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
2048 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
2051 static const char *stac922x_models[STAC_922X_MODELS] = {
2052 [STAC_922X_AUTO] = "auto",
2053 [STAC_D945_REF] = "ref",
2054 [STAC_D945GTP5] = "5stack",
2055 [STAC_D945GTP3] = "3stack",
2056 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
2057 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
2058 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
2059 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
2060 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
2061 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
2062 /* for backward compatibility */
2063 [STAC_MACMINI] = "macmini",
2064 [STAC_MACBOOK] = "macbook",
2065 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
2066 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
2067 [STAC_IMAC_INTEL] = "imac-intel",
2068 [STAC_IMAC_INTEL_20] = "imac-intel-20",
2069 [STAC_ECS_202] = "ecs202",
2070 [STAC_922X_DELL_D81] = "dell-d81",
2071 [STAC_922X_DELL_D82] = "dell-d82",
2072 [STAC_922X_DELL_M81] = "dell-m81",
2073 [STAC_922X_DELL_M82] = "dell-m82",
2076 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
2077 /* SigmaTel reference board */
2078 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2079 "DFI LanParty", STAC_D945_REF),
2080 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2081 "DFI LanParty", STAC_D945_REF),
2082 /* Intel 945G based systems */
2083 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
2084 "Intel D945G", STAC_D945GTP3),
2085 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
2086 "Intel D945G", STAC_D945GTP3),
2087 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
2088 "Intel D945G", STAC_D945GTP3),
2089 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
2090 "Intel D945G", STAC_D945GTP3),
2091 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
2092 "Intel D945G", STAC_D945GTP3),
2093 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
2094 "Intel D945G", STAC_D945GTP3),
2095 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
2096 "Intel D945G", STAC_D945GTP3),
2097 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
2098 "Intel D945G", STAC_D945GTP3),
2099 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
2100 "Intel D945G", STAC_D945GTP3),
2101 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
2102 "Intel D945G", STAC_D945GTP3),
2103 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
2104 "Intel D945G", STAC_D945GTP3),
2105 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
2106 "Intel D945G", STAC_D945GTP3),
2107 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
2108 "Intel D945G", STAC_D945GTP3),
2109 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
2110 "Intel D945G", STAC_D945GTP3),
2111 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
2112 "Intel D945G", STAC_D945GTP3),
2113 /* Intel D945G 5-stack systems */
2114 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
2115 "Intel D945G", STAC_D945GTP5),
2116 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
2117 "Intel D945G", STAC_D945GTP5),
2118 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
2119 "Intel D945G", STAC_D945GTP5),
2120 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
2121 "Intel D945G", STAC_D945GTP5),
2122 /* Intel 945P based systems */
2123 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
2124 "Intel D945P", STAC_D945GTP3),
2125 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
2126 "Intel D945P", STAC_D945GTP3),
2127 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
2128 "Intel D945P", STAC_D945GTP3),
2129 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
2130 "Intel D945P", STAC_D945GTP3),
2131 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
2132 "Intel D945P", STAC_D945GTP3),
2133 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2134 "Intel D945P", STAC_D945GTP5),
2136 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
2137 "Intel D945", STAC_D945_REF),
2139 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2140 SND_PCI_QUIRK(0x8384, 0x7680,
2141 "Mac", STAC_INTEL_MAC_AUTO),
2143 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2144 "unknown Dell", STAC_922X_DELL_D81),
2145 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2146 "unknown Dell", STAC_922X_DELL_D81),
2147 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2148 "unknown Dell", STAC_922X_DELL_D81),
2149 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2150 "unknown Dell", STAC_922X_DELL_D82),
2151 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2152 "unknown Dell", STAC_922X_DELL_M81),
2153 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2154 "unknown Dell", STAC_922X_DELL_D82),
2155 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2156 "unknown Dell", STAC_922X_DELL_D81),
2157 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2158 "unknown Dell", STAC_922X_DELL_D81),
2159 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2160 "Dell XPS M1210", STAC_922X_DELL_M82),
2161 /* ECS/PC Chips boards */
2162 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2163 "ECS/PC chips", STAC_ECS_202),
2167 static unsigned int ref927x_pin_configs[14] = {
2168 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2169 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2170 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2171 0x01c42190, 0x40000100,
2174 static unsigned int d965_3st_pin_configs[14] = {
2175 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2176 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2177 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2178 0x40000100, 0x40000100
2181 static unsigned int d965_5st_pin_configs[14] = {
2182 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2183 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2184 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2185 0x40000100, 0x40000100
2188 static unsigned int d965_5st_no_fp_pin_configs[14] = {
2189 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2190 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2191 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2192 0x40000100, 0x40000100
2195 static unsigned int dell_3st_pin_configs[14] = {
2196 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2197 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2198 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2199 0x40c003fc, 0x40000100
2202 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2203 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2204 [STAC_D965_REF] = ref927x_pin_configs,
2205 [STAC_D965_3ST] = d965_3st_pin_configs,
2206 [STAC_D965_5ST] = d965_5st_pin_configs,
2207 [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs,
2208 [STAC_DELL_3ST] = dell_3st_pin_configs,
2209 [STAC_DELL_BIOS] = NULL,
2212 static const char *stac927x_models[STAC_927X_MODELS] = {
2213 [STAC_927X_AUTO] = "auto",
2214 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2215 [STAC_D965_REF] = "ref",
2216 [STAC_D965_3ST] = "3stack",
2217 [STAC_D965_5ST] = "5stack",
2218 [STAC_D965_5ST_NO_FP] = "5stack-no-fp",
2219 [STAC_DELL_3ST] = "dell-3stack",
2220 [STAC_DELL_BIOS] = "dell-bios",
2223 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2224 /* SigmaTel reference board */
2225 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2226 "DFI LanParty", STAC_D965_REF),
2227 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2228 "DFI LanParty", STAC_D965_REF),
2229 /* Intel 946 based systems */
2230 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2231 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2232 /* 965 based 3 stack systems */
2233 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
2234 "Intel D965", STAC_D965_3ST),
2235 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
2236 "Intel D965", STAC_D965_3ST),
2237 /* Dell 3 stack systems */
2238 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2239 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2240 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2241 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2242 /* Dell 3 stack systems with verb table in BIOS */
2243 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2244 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2245 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2246 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
2247 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2248 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2249 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2250 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2251 /* 965 based 5 stack systems */
2252 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
2253 "Intel D965", STAC_D965_5ST),
2254 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
2255 "Intel D965", STAC_D965_5ST),
2259 static unsigned int ref9205_pin_configs[12] = {
2260 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2261 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2262 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2266 STAC 9205 pin configs for
2273 10280228 (Dell Vostro 1500)
2275 static unsigned int dell_9205_m42_pin_configs[12] = {
2276 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2277 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2278 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2282 STAC 9205 pin configs for
2286 102801FF (Dell Precision M4300)
2291 static unsigned int dell_9205_m43_pin_configs[12] = {
2292 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2293 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2294 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2297 static unsigned int dell_9205_m44_pin_configs[12] = {
2298 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2299 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2300 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2303 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2304 [STAC_9205_REF] = ref9205_pin_configs,
2305 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2306 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2307 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2308 [STAC_9205_EAPD] = NULL,
2311 static const char *stac9205_models[STAC_9205_MODELS] = {
2312 [STAC_9205_AUTO] = "auto",
2313 [STAC_9205_REF] = "ref",
2314 [STAC_9205_DELL_M42] = "dell-m42",
2315 [STAC_9205_DELL_M43] = "dell-m43",
2316 [STAC_9205_DELL_M44] = "dell-m44",
2317 [STAC_9205_EAPD] = "eapd",
2320 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2321 /* SigmaTel reference board */
2322 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2323 "DFI LanParty", STAC_9205_REF),
2324 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
2325 "SigmaTel", STAC_9205_REF),
2326 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2327 "DFI LanParty", STAC_9205_REF),
2329 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2330 "unknown Dell", STAC_9205_DELL_M42),
2331 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2332 "unknown Dell", STAC_9205_DELL_M42),
2333 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2334 "Dell Precision", STAC_9205_DELL_M43),
2335 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2336 "Dell Precision", STAC_9205_DELL_M43),
2337 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2338 "Dell Precision", STAC_9205_DELL_M43),
2339 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2340 "unknown Dell", STAC_9205_DELL_M42),
2341 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2342 "unknown Dell", STAC_9205_DELL_M42),
2343 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2344 "Dell Precision", STAC_9205_DELL_M43),
2345 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2346 "Dell Precision M4300", STAC_9205_DELL_M43),
2347 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2348 "unknown Dell", STAC_9205_DELL_M42),
2349 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2350 "Dell Precision", STAC_9205_DELL_M43),
2351 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2352 "Dell Precision", STAC_9205_DELL_M43),
2353 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2354 "Dell Precision", STAC_9205_DELL_M43),
2355 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2356 "Dell Inspiron", STAC_9205_DELL_M44),
2357 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2358 "Dell Vostro 1500", STAC_9205_DELL_M42),
2360 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2361 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2365 static void stac92xx_set_config_regs(struct hda_codec *codec,
2366 unsigned int *pincfgs)
2369 struct sigmatel_spec *spec = codec->spec;
2374 for (i = 0; i < spec->num_pins; i++)
2375 if (spec->pin_nids[i] && pincfgs[i])
2376 snd_hda_codec_set_pincfg(codec, spec->pin_nids[i],
2381 * Analog playback callbacks
2383 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2384 struct hda_codec *codec,
2385 struct snd_pcm_substream *substream)
2387 struct sigmatel_spec *spec = codec->spec;
2388 if (spec->stream_delay)
2389 msleep(spec->stream_delay);
2390 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2394 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2395 struct hda_codec *codec,
2396 unsigned int stream_tag,
2397 unsigned int format,
2398 struct snd_pcm_substream *substream)
2400 struct sigmatel_spec *spec = codec->spec;
2401 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2404 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2405 struct hda_codec *codec,
2406 struct snd_pcm_substream *substream)
2408 struct sigmatel_spec *spec = codec->spec;
2409 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2413 * Digital playback callbacks
2415 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2416 struct hda_codec *codec,
2417 struct snd_pcm_substream *substream)
2419 struct sigmatel_spec *spec = codec->spec;
2420 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2423 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2424 struct hda_codec *codec,
2425 struct snd_pcm_substream *substream)
2427 struct sigmatel_spec *spec = codec->spec;
2428 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2431 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2432 struct hda_codec *codec,
2433 unsigned int stream_tag,
2434 unsigned int format,
2435 struct snd_pcm_substream *substream)
2437 struct sigmatel_spec *spec = codec->spec;
2438 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2439 stream_tag, format, substream);
2442 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2443 struct hda_codec *codec,
2444 struct snd_pcm_substream *substream)
2446 struct sigmatel_spec *spec = codec->spec;
2447 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2452 * Analog capture callbacks
2454 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2455 struct hda_codec *codec,
2456 unsigned int stream_tag,
2457 unsigned int format,
2458 struct snd_pcm_substream *substream)
2460 struct sigmatel_spec *spec = codec->spec;
2461 hda_nid_t nid = spec->adc_nids[substream->number];
2463 if (spec->powerdown_adcs) {
2465 snd_hda_codec_write(codec, nid, 0,
2466 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2468 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2472 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2473 struct hda_codec *codec,
2474 struct snd_pcm_substream *substream)
2476 struct sigmatel_spec *spec = codec->spec;
2477 hda_nid_t nid = spec->adc_nids[substream->number];
2479 snd_hda_codec_cleanup_stream(codec, nid);
2480 if (spec->powerdown_adcs)
2481 snd_hda_codec_write(codec, nid, 0,
2482 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2486 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2490 /* NID is set in stac92xx_build_pcms */
2492 .open = stac92xx_dig_playback_pcm_open,
2493 .close = stac92xx_dig_playback_pcm_close,
2494 .prepare = stac92xx_dig_playback_pcm_prepare,
2495 .cleanup = stac92xx_dig_playback_pcm_cleanup
2499 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2503 /* NID is set in stac92xx_build_pcms */
2506 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2510 .nid = 0x02, /* NID to query formats and rates */
2512 .open = stac92xx_playback_pcm_open,
2513 .prepare = stac92xx_playback_pcm_prepare,
2514 .cleanup = stac92xx_playback_pcm_cleanup
2518 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2522 .nid = 0x06, /* NID to query formats and rates */
2524 .open = stac92xx_playback_pcm_open,
2525 .prepare = stac92xx_playback_pcm_prepare,
2526 .cleanup = stac92xx_playback_pcm_cleanup
2530 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2533 /* NID + .substreams is set in stac92xx_build_pcms */
2535 .prepare = stac92xx_capture_pcm_prepare,
2536 .cleanup = stac92xx_capture_pcm_cleanup
2540 static int stac92xx_build_pcms(struct hda_codec *codec)
2542 struct sigmatel_spec *spec = codec->spec;
2543 struct hda_pcm *info = spec->pcm_rec;
2545 codec->num_pcms = 1;
2546 codec->pcm_info = info;
2548 info->name = "STAC92xx Analog";
2549 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2550 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2551 spec->multiout.dac_nids[0];
2552 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2553 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2554 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2556 if (spec->alt_switch) {
2559 info->name = "STAC92xx Analog Alt";
2560 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2563 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2566 info->name = "STAC92xx Digital";
2567 info->pcm_type = spec->autocfg.dig_out_type[0];
2568 if (spec->multiout.dig_out_nid) {
2569 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2570 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2572 if (spec->dig_in_nid) {
2573 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2574 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2581 static unsigned int stac92xx_get_default_vref(struct hda_codec *codec,
2584 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2585 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2586 if (pincap & AC_PINCAP_VREF_100)
2587 return AC_PINCTL_VREF_100;
2588 if (pincap & AC_PINCAP_VREF_80)
2589 return AC_PINCTL_VREF_80;
2590 if (pincap & AC_PINCAP_VREF_50)
2591 return AC_PINCTL_VREF_50;
2592 if (pincap & AC_PINCAP_VREF_GRD)
2593 return AC_PINCTL_VREF_GRD;
2597 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2600 snd_hda_codec_write_cache(codec, nid, 0,
2601 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2604 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2606 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2607 struct snd_ctl_elem_value *ucontrol)
2609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2610 struct sigmatel_spec *spec = codec->spec;
2612 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2616 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid);
2618 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2619 struct snd_ctl_elem_value *ucontrol)
2621 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2622 struct sigmatel_spec *spec = codec->spec;
2623 int nid = kcontrol->private_value;
2625 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2627 /* check to be sure that the ports are upto date with
2630 stac_issue_unsol_event(codec, nid);
2635 static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol,
2636 struct snd_ctl_elem_info *uinfo)
2639 static char *texts[] = {
2640 "Mic In", "Line In", "Line Out"
2643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2644 struct sigmatel_spec *spec = codec->spec;
2645 hda_nid_t nid = kcontrol->private_value;
2647 if (nid == spec->mic_switch || nid == spec->line_switch)
2652 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2653 uinfo->value.enumerated.items = i;
2655 if (uinfo->value.enumerated.item >= i)
2656 uinfo->value.enumerated.item = i-1;
2657 strcpy(uinfo->value.enumerated.name,
2658 texts[uinfo->value.enumerated.item]);
2663 static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol,
2664 struct snd_ctl_elem_value *ucontrol)
2666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2667 hda_nid_t nid = kcontrol->private_value;
2668 unsigned int vref = stac92xx_vref_get(codec, nid);
2670 if (vref == stac92xx_get_default_vref(codec, nid))
2671 ucontrol->value.enumerated.item[0] = 0;
2672 else if (vref == AC_PINCTL_VREF_GRD)
2673 ucontrol->value.enumerated.item[0] = 1;
2674 else if (vref == AC_PINCTL_VREF_HIZ)
2675 ucontrol->value.enumerated.item[0] = 2;
2680 static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol,
2681 struct snd_ctl_elem_value *ucontrol)
2683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2684 unsigned int new_vref = 0;
2686 hda_nid_t nid = kcontrol->private_value;
2688 if (ucontrol->value.enumerated.item[0] == 0)
2689 new_vref = stac92xx_get_default_vref(codec, nid);
2690 else if (ucontrol->value.enumerated.item[0] == 1)
2691 new_vref = AC_PINCTL_VREF_GRD;
2692 else if (ucontrol->value.enumerated.item[0] == 2)
2693 new_vref = AC_PINCTL_VREF_HIZ;
2697 if (new_vref != stac92xx_vref_get(codec, nid)) {
2698 error = stac92xx_vref_set(codec, nid, new_vref);
2705 static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol,
2706 struct snd_ctl_elem_info *uinfo)
2708 static char *texts[2];
2709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2710 struct sigmatel_spec *spec = codec->spec;
2712 if (kcontrol->private_value == spec->line_switch)
2713 texts[0] = "Line In";
2715 texts[0] = "Mic In";
2716 texts[1] = "Line Out";
2717 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2718 uinfo->value.enumerated.items = 2;
2721 if (uinfo->value.enumerated.item >= 2)
2722 uinfo->value.enumerated.item = 1;
2723 strcpy(uinfo->value.enumerated.name,
2724 texts[uinfo->value.enumerated.item]);
2729 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2732 struct sigmatel_spec *spec = codec->spec;
2733 hda_nid_t nid = kcontrol->private_value;
2734 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2736 ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx];
2740 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2743 struct sigmatel_spec *spec = codec->spec;
2744 hda_nid_t nid = kcontrol->private_value;
2745 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2746 unsigned short val = !!ucontrol->value.enumerated.item[0];
2748 spec->io_switch[io_idx] = val;
2751 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2753 unsigned int pinctl = AC_PINCTL_IN_EN;
2754 if (io_idx) /* set VREF for mic */
2755 pinctl |= stac92xx_get_default_vref(codec, nid);
2756 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2759 /* check the auto-mute again: we need to mute/unmute the speaker
2760 * appropriately according to the pin direction
2762 if (spec->hp_detect)
2763 stac_issue_unsol_event(codec, nid);
2768 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2770 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2771 struct snd_ctl_elem_value *ucontrol)
2773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2774 struct sigmatel_spec *spec = codec->spec;
2776 ucontrol->value.integer.value[0] = spec->clfe_swap;
2780 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2781 struct snd_ctl_elem_value *ucontrol)
2783 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2784 struct sigmatel_spec *spec = codec->spec;
2785 hda_nid_t nid = kcontrol->private_value & 0xff;
2786 unsigned int val = !!ucontrol->value.integer.value[0];
2788 if (spec->clfe_swap == val)
2791 spec->clfe_swap = val;
2793 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2794 spec->clfe_swap ? 0x4 : 0x0);
2799 #define STAC_CODEC_HP_SWITCH(xname) \
2800 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2803 .info = stac92xx_hp_switch_info, \
2804 .get = stac92xx_hp_switch_get, \
2805 .put = stac92xx_hp_switch_put, \
2808 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2809 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2812 .info = stac92xx_io_switch_info, \
2813 .get = stac92xx_io_switch_get, \
2814 .put = stac92xx_io_switch_put, \
2815 .private_value = xpval, \
2818 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2819 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2822 .info = stac92xx_clfe_switch_info, \
2823 .get = stac92xx_clfe_switch_get, \
2824 .put = stac92xx_clfe_switch_put, \
2825 .private_value = xpval, \
2829 STAC_CTL_WIDGET_VOL,
2830 STAC_CTL_WIDGET_MUTE,
2831 STAC_CTL_WIDGET_MONO_MUX,
2832 STAC_CTL_WIDGET_AMP_MUX,
2833 STAC_CTL_WIDGET_AMP_VOL,
2834 STAC_CTL_WIDGET_HP_SWITCH,
2835 STAC_CTL_WIDGET_IO_SWITCH,
2836 STAC_CTL_WIDGET_CLFE_SWITCH,
2837 STAC_CTL_WIDGET_DC_BIAS
2840 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2841 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2842 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2845 STAC_AMP_VOL(NULL, 0, 0, 0, 0),
2846 STAC_CODEC_HP_SWITCH(NULL),
2847 STAC_CODEC_IO_SWITCH(NULL, 0),
2848 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2849 DC_BIAS(NULL, 0, 0),
2852 /* add dynamic controls */
2853 static struct snd_kcontrol_new *
2854 stac_control_new(struct sigmatel_spec *spec,
2855 struct snd_kcontrol_new *ktemp,
2858 struct snd_kcontrol_new *knew;
2860 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2861 knew = snd_array_new(&spec->kctls);
2865 knew->name = kstrdup(name, GFP_KERNEL);
2868 memset(knew, 0, sizeof(*knew));
2869 spec->kctls.alloced--;
2875 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2876 struct snd_kcontrol_new *ktemp,
2877 int idx, const char *name,
2880 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name);
2884 knew->private_value = val;
2888 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2889 int type, int idx, const char *name,
2892 return stac92xx_add_control_temp(spec,
2893 &stac92xx_control_templates[type],
2898 /* add dynamic controls */
2899 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2900 const char *name, unsigned long val)
2902 return stac92xx_add_control_idx(spec, type, 0, name, val);
2905 static struct snd_kcontrol_new stac_input_src_temp = {
2906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2907 .name = "Input Source",
2908 .info = stac92xx_mux_enum_info,
2909 .get = stac92xx_mux_enum_get,
2910 .put = stac92xx_mux_enum_put,
2913 static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
2914 hda_nid_t nid, int idx)
2916 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
2918 struct sigmatel_spec *spec = codec->spec;
2921 if (!((get_defcfg_connect(def_conf)) & AC_JACK_PORT_FIXED)) {
2922 if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD
2923 && nid == spec->line_switch)
2924 control = STAC_CTL_WIDGET_IO_SWITCH;
2925 else if (snd_hda_query_pin_caps(codec, nid)
2926 & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT))
2927 control = STAC_CTL_WIDGET_DC_BIAS;
2928 else if (nid == spec->mic_switch)
2929 control = STAC_CTL_WIDGET_IO_SWITCH;
2933 strcpy(name, auto_pin_cfg_labels[idx]);
2934 return stac92xx_add_control(codec->spec, control,
2935 strcat(name, " Jack Mode"), nid);
2941 static int stac92xx_add_input_source(struct sigmatel_spec *spec)
2943 struct snd_kcontrol_new *knew;
2944 struct hda_input_mux *imux = &spec->private_imux;
2947 return 0; /* no need for input source */
2948 if (!spec->num_adcs || imux->num_items <= 1)
2949 return 0; /* no need for input source control */
2950 knew = stac_control_new(spec, &stac_input_src_temp,
2951 stac_input_src_temp.name);
2954 knew->count = spec->num_adcs;
2958 /* check whether the line-input can be used as line-out */
2959 static hda_nid_t check_line_out_switch(struct hda_codec *codec)
2961 struct sigmatel_spec *spec = codec->spec;
2962 struct auto_pin_cfg *cfg = &spec->autocfg;
2964 unsigned int pincap;
2966 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2968 nid = cfg->input_pins[AUTO_PIN_LINE];
2969 pincap = snd_hda_query_pin_caps(codec, nid);
2970 if (pincap & AC_PINCAP_OUT)
2975 /* check whether the mic-input can be used as line-out */
2976 static hda_nid_t check_mic_out_switch(struct hda_codec *codec)
2978 struct sigmatel_spec *spec = codec->spec;
2979 struct auto_pin_cfg *cfg = &spec->autocfg;
2980 unsigned int def_conf, pincap;
2981 unsigned int mic_pin;
2983 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2985 mic_pin = AUTO_PIN_MIC;
2987 hda_nid_t nid = cfg->input_pins[mic_pin];
2988 def_conf = snd_hda_codec_get_pincfg(codec, nid);
2989 /* some laptops have an internal analog microphone
2990 * which can't be used as a output */
2991 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2992 pincap = snd_hda_query_pin_caps(codec, nid);
2993 if (pincap & AC_PINCAP_OUT)
2996 if (mic_pin == AUTO_PIN_MIC)
2997 mic_pin = AUTO_PIN_FRONT_MIC;
3004 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
3008 for (i = 0; i < spec->multiout.num_dacs; i++) {
3009 if (spec->multiout.dac_nids[i] == nid)
3016 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
3019 if (is_in_dac_nids(spec, nid))
3021 for (i = 0; i < spec->autocfg.hp_outs; i++)
3022 if (spec->hp_dacs[i] == nid)
3024 for (i = 0; i < spec->autocfg.speaker_outs; i++)
3025 if (spec->speaker_dacs[i] == nid)
3030 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
3032 struct sigmatel_spec *spec = codec->spec;
3034 hda_nid_t conn[HDA_MAX_CONNECTIONS];
3035 unsigned int wcaps, wtype;
3037 conn_len = snd_hda_get_connections(codec, nid, conn,
3038 HDA_MAX_CONNECTIONS);
3039 for (j = 0; j < conn_len; j++) {
3040 wcaps = get_wcaps(codec, conn[j]);
3041 wtype = get_wcaps_type(wcaps);
3042 /* we check only analog outputs */
3043 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))
3045 /* if this route has a free DAC, assign it */
3046 if (!check_all_dac_nids(spec, conn[j])) {
3048 /* select this DAC in the pin's input mux */
3049 snd_hda_codec_write_cache(codec, nid, 0,
3050 AC_VERB_SET_CONNECT_SEL, j);
3055 /* if all DACs are already assigned, connect to the primary DAC */
3057 for (j = 0; j < conn_len; j++) {
3058 if (conn[j] == spec->multiout.dac_nids[0]) {
3059 snd_hda_codec_write_cache(codec, nid, 0,
3060 AC_VERB_SET_CONNECT_SEL, j);
3068 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3069 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3072 * Fill in the dac_nids table from the parsed pin configuration
3073 * This function only works when every pin in line_out_pins[]
3074 * contains atleast one DAC in its connection list. Some 92xx
3075 * codecs are not connected directly to a DAC, such as the 9200
3076 * and 9202/925x. For those, dac_nids[] must be hard-coded.
3078 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec)
3080 struct sigmatel_spec *spec = codec->spec;
3081 struct auto_pin_cfg *cfg = &spec->autocfg;
3085 for (i = 0; i < cfg->line_outs; i++) {
3086 nid = cfg->line_out_pins[i];
3087 dac = get_unassigned_dac(codec, nid);
3089 if (spec->multiout.num_dacs > 0) {
3090 /* we have already working output pins,
3091 * so let's drop the broken ones again
3093 cfg->line_outs = spec->multiout.num_dacs;
3096 /* error out, no available DAC found */
3098 "%s: No available DAC for pin 0x%x\n",
3102 add_spec_dacs(spec, dac);
3105 for (i = 0; i < cfg->hp_outs; i++) {
3106 nid = cfg->hp_pins[i];
3107 dac = get_unassigned_dac(codec, nid);
3109 if (!spec->multiout.hp_nid)
3110 spec->multiout.hp_nid = dac;
3112 add_spec_extra_dacs(spec, dac);
3114 spec->hp_dacs[i] = dac;
3117 for (i = 0; i < cfg->speaker_outs; i++) {
3118 nid = cfg->speaker_pins[i];
3119 dac = get_unassigned_dac(codec, nid);
3121 add_spec_extra_dacs(spec, dac);
3122 spec->speaker_dacs[i] = dac;
3125 /* add line-in as output */
3126 nid = check_line_out_switch(codec);
3128 dac = get_unassigned_dac(codec, nid);
3130 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
3131 nid, cfg->line_outs);
3132 cfg->line_out_pins[cfg->line_outs] = nid;
3134 spec->line_switch = nid;
3135 add_spec_dacs(spec, dac);
3138 /* add mic as output */
3139 nid = check_mic_out_switch(codec);
3141 dac = get_unassigned_dac(codec, nid);
3143 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
3144 nid, cfg->line_outs);
3145 cfg->line_out_pins[cfg->line_outs] = nid;
3147 spec->mic_switch = nid;
3148 add_spec_dacs(spec, dac);
3152 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
3153 spec->multiout.num_dacs,
3154 spec->multiout.dac_nids[0],
3155 spec->multiout.dac_nids[1],
3156 spec->multiout.dac_nids[2],
3157 spec->multiout.dac_nids[3],
3158 spec->multiout.dac_nids[4]);
3163 /* create volume control/switch for the given prefx type */
3164 static int create_controls_idx(struct hda_codec *codec, const char *pfx,
3165 int idx, hda_nid_t nid, int chs)
3167 struct sigmatel_spec *spec = codec->spec;
3171 if (!spec->check_volume_offset) {
3172 unsigned int caps, step, nums, db_scale;
3173 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3174 step = (caps & AC_AMPCAP_STEP_SIZE) >>