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 <linux/dmi.h>
32 #include <linux/module.h>
33 #include <sound/core.h>
34 #include <sound/asoundef.h>
35 #include <sound/jack.h>
36 #include <sound/tlv.h>
37 #include "hda_codec.h"
38 #include "hda_local.h"
83 STAC_92HD73XX_NO_JD, /* no jack-detection */
97 STAC_92HD83XXX_PWR_REF,
99 STAC_DELL_VOSTRO_3500,
100 STAC_92HD83XXX_HP_cNB11_INTQUAD,
102 STAC_92HD83XXX_MODELS
116 STAC_92HD71BXX_MODELS
142 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
143 * is given, one of the above models will be
144 * chosen according to the subsystem id. */
145 /* for backward compatibility */
162 STAC_D965_REF_NO_JD, /* no jack-detection */
179 struct sigmatel_mic_route {
182 signed char dmux_idx;
185 #define MAX_PINS_NUM 16
186 #define MAX_ADCS_NUM 4
187 #define MAX_DMICS_NUM 4
189 struct sigmatel_spec {
190 struct snd_kcontrol_new *mixers[4];
191 unsigned int num_mixers;
194 unsigned int eapd_switch: 1;
195 unsigned int surr_switch: 1;
196 unsigned int alt_switch: 1;
197 unsigned int hp_detect: 1;
198 unsigned int spdif_mute: 1;
199 unsigned int check_volume_offset:1;
200 unsigned int auto_mic:1;
201 unsigned int linear_tone_beep:1;
204 unsigned int eapd_mask;
205 unsigned int gpio_mask;
206 unsigned int gpio_dir;
207 unsigned int gpio_data;
208 unsigned int gpio_mute;
209 unsigned int gpio_led;
210 unsigned int gpio_led_polarity;
211 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
212 unsigned int vref_led;
215 unsigned int stream_delay;
217 /* analog loopback */
218 const struct snd_kcontrol_new *aloopback_ctl;
219 unsigned char aloopback_mask;
220 unsigned char aloopback_shift;
222 /* power management */
223 unsigned int num_pwrs;
224 const hda_nid_t *pwr_nids;
225 const hda_nid_t *dac_list;
228 struct hda_input_mux *mono_mux;
229 unsigned int cur_mmux;
230 struct hda_multi_out multiout;
231 hda_nid_t dac_nids[5];
232 hda_nid_t hp_dacs[5];
233 hda_nid_t speaker_dacs[5];
238 const hda_nid_t *adc_nids;
239 unsigned int num_adcs;
240 const hda_nid_t *mux_nids;
241 unsigned int num_muxes;
242 const hda_nid_t *dmic_nids;
243 unsigned int num_dmics;
244 const hda_nid_t *dmux_nids;
245 unsigned int num_dmuxes;
246 const hda_nid_t *smux_nids;
247 unsigned int num_smuxes;
248 unsigned int num_analog_muxes;
250 const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
251 const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
252 unsigned int num_caps; /* number of capture volume/switch elements */
254 struct sigmatel_mic_route ext_mic;
255 struct sigmatel_mic_route int_mic;
256 struct sigmatel_mic_route dock_mic;
258 const char * const *spdif_labels;
260 hda_nid_t dig_in_nid;
262 hda_nid_t anabeep_nid;
263 hda_nid_t digbeep_nid;
266 const hda_nid_t *pin_nids;
267 unsigned int num_pins;
269 /* codec specific stuff */
270 const struct hda_verb *init;
271 const struct snd_kcontrol_new *mixer;
274 struct hda_input_mux *dinput_mux;
275 unsigned int cur_dmux[2];
276 struct hda_input_mux *input_mux;
277 unsigned int cur_mux[3];
278 struct hda_input_mux *sinput_mux;
279 unsigned int cur_smux[2];
280 unsigned int cur_amux;
282 unsigned int powerdown_adcs;
285 unsigned int io_switch[2];
286 unsigned int clfe_swap;
287 hda_nid_t line_switch; /* shared line-in for input and output */
288 hda_nid_t mic_switch; /* shared mic-in for input and output */
289 hda_nid_t hp_switch; /* NID of HP as line-out */
290 unsigned int aloopback;
292 struct hda_pcm pcm_rec[2]; /* PCM information */
294 /* dynamic controls and input_mux */
295 struct auto_pin_cfg autocfg;
296 struct snd_array kctls;
297 struct hda_input_mux private_dimux;
298 struct hda_input_mux private_imux;
299 struct hda_input_mux private_smux;
300 struct hda_input_mux private_mono_mux;
303 unsigned auto_pin_cnt;
304 hda_nid_t auto_pin_nids[MAX_PINS_NUM];
305 unsigned auto_adc_cnt;
306 hda_nid_t auto_adc_nids[MAX_ADCS_NUM];
307 hda_nid_t auto_mux_nids[MAX_ADCS_NUM];
308 hda_nid_t auto_dmux_nids[MAX_ADCS_NUM];
309 unsigned long auto_capvols[MAX_ADCS_NUM];
310 unsigned auto_dmic_cnt;
311 hda_nid_t auto_dmic_nids[MAX_DMICS_NUM];
314 static const hda_nid_t stac9200_adc_nids[1] = {
318 static const hda_nid_t stac9200_mux_nids[1] = {
322 static const hda_nid_t stac9200_dac_nids[1] = {
326 static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
327 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
331 static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
335 static const hda_nid_t stac92hd73xx_adc_nids[2] = {
339 #define STAC92HD73XX_NUM_DMICS 2
340 static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
344 #define STAC92HD73_DAC_COUNT 5
346 static const hda_nid_t stac92hd73xx_mux_nids[2] = {
350 static const hda_nid_t stac92hd73xx_dmux_nids[2] = {
354 static const hda_nid_t stac92hd73xx_smux_nids[2] = {
358 #define STAC92HD73XX_NUM_CAPS 2
359 static const unsigned long stac92hd73xx_capvols[] = {
360 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
361 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
363 #define stac92hd73xx_capsws stac92hd73xx_capvols
365 #define STAC92HD83_DAC_COUNT 3
367 static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
368 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
372 static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
376 static const hda_nid_t stac92hd83xxx_dmic_nids[] = {
380 static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
384 static const hda_nid_t stac92hd71bxx_adc_nids[2] = {
388 static const hda_nid_t stac92hd71bxx_mux_nids[2] = {
392 static const hda_nid_t stac92hd71bxx_dmux_nids[2] = {
396 static const hda_nid_t stac92hd71bxx_smux_nids[2] = {
400 #define STAC92HD71BXX_NUM_DMICS 2
401 static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
405 static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = {
409 static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
413 #define STAC92HD71BXX_NUM_CAPS 2
414 static const unsigned long stac92hd71bxx_capvols[] = {
415 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
416 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
418 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
420 static const hda_nid_t stac925x_adc_nids[1] = {
424 static const hda_nid_t stac925x_mux_nids[1] = {
428 static const hda_nid_t stac925x_dac_nids[1] = {
432 #define STAC925X_NUM_DMICS 1
433 static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
437 static const hda_nid_t stac925x_dmux_nids[1] = {
441 static const unsigned long stac925x_capvols[] = {
442 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
444 static const unsigned long stac925x_capsws[] = {
445 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
448 static const hda_nid_t stac922x_adc_nids[2] = {
452 static const hda_nid_t stac922x_mux_nids[2] = {
456 #define STAC922X_NUM_CAPS 2
457 static const unsigned long stac922x_capvols[] = {
458 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
459 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
461 #define stac922x_capsws stac922x_capvols
463 static const hda_nid_t stac927x_slave_dig_outs[2] = {
467 static const hda_nid_t stac927x_adc_nids[3] = {
471 static const hda_nid_t stac927x_mux_nids[3] = {
475 static const hda_nid_t stac927x_smux_nids[1] = {
479 static const hda_nid_t stac927x_dac_nids[6] = {
480 0x02, 0x03, 0x04, 0x05, 0x06, 0
483 static const hda_nid_t stac927x_dmux_nids[1] = {
487 #define STAC927X_NUM_DMICS 2
488 static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
492 #define STAC927X_NUM_CAPS 3
493 static const unsigned long stac927x_capvols[] = {
494 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
495 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
496 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
498 static const unsigned long stac927x_capsws[] = {
499 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
500 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
501 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
504 static const char * const stac927x_spdif_labels[5] = {
505 "Digital Playback", "ADAT", "Analog Mux 1",
506 "Analog Mux 2", "Analog Mux 3"
509 static const hda_nid_t stac9205_adc_nids[2] = {
513 static const hda_nid_t stac9205_mux_nids[2] = {
517 static const hda_nid_t stac9205_dmux_nids[1] = {
521 static const hda_nid_t stac9205_smux_nids[1] = {
525 #define STAC9205_NUM_DMICS 2
526 static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
530 #define STAC9205_NUM_CAPS 2
531 static const unsigned long stac9205_capvols[] = {
532 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
533 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
535 static const unsigned long stac9205_capsws[] = {
536 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
537 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
540 static const hda_nid_t stac9200_pin_nids[8] = {
541 0x08, 0x09, 0x0d, 0x0e,
542 0x0f, 0x10, 0x11, 0x12,
545 static const hda_nid_t stac925x_pin_nids[8] = {
546 0x07, 0x08, 0x0a, 0x0b,
547 0x0c, 0x0d, 0x10, 0x11,
550 static const hda_nid_t stac922x_pin_nids[10] = {
551 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
552 0x0f, 0x10, 0x11, 0x15, 0x1b,
555 static const hda_nid_t stac92hd73xx_pin_nids[13] = {
556 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
557 0x0f, 0x10, 0x11, 0x12, 0x13,
561 #define STAC92HD71BXX_NUM_PINS 13
562 static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
563 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
564 0x00, 0x14, 0x18, 0x19, 0x1e,
567 static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
568 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
569 0x0f, 0x14, 0x18, 0x19, 0x1e,
573 static const hda_nid_t stac927x_pin_nids[14] = {
574 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
575 0x0f, 0x10, 0x11, 0x12, 0x13,
576 0x14, 0x21, 0x22, 0x23,
579 static const hda_nid_t stac9205_pin_nids[12] = {
580 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
581 0x0f, 0x14, 0x16, 0x17, 0x18,
585 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
586 struct snd_ctl_elem_info *uinfo)
588 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
589 struct sigmatel_spec *spec = codec->spec;
590 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
593 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
594 struct snd_ctl_elem_value *ucontrol)
596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
597 struct sigmatel_spec *spec = codec->spec;
598 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
600 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
604 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
605 struct snd_ctl_elem_value *ucontrol)
607 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
608 struct sigmatel_spec *spec = codec->spec;
609 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
611 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
612 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
615 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_info *uinfo)
618 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
619 struct sigmatel_spec *spec = codec->spec;
620 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
623 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
624 struct snd_ctl_elem_value *ucontrol)
626 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
627 struct sigmatel_spec *spec = codec->spec;
628 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
630 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
634 static int stac92xx_smux_enum_put(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 struct hda_input_mux *smux = &spec->private_smux;
640 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
644 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
645 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
649 if (spec->spdif_mute) {
651 nid = spec->multiout.dig_out_nid;
653 nid = codec->slave_dig_outs[smux_idx - 1];
654 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
658 /* un/mute SPDIF out */
659 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
665 #ifdef CONFIG_SND_HDA_POWER_SAVE
666 static int stac_vrefout_set(struct hda_codec *codec,
667 hda_nid_t nid, unsigned int new_vref)
671 snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
672 pinctl = snd_hda_codec_read(codec, nid, 0,
673 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
679 pinctl &= ~AC_PINCTL_VREFEN;
680 pinctl |= (new_vref & AC_PINCTL_VREFEN);
682 error = snd_hda_codec_write_cache(codec, nid, 0,
683 AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl);
691 static unsigned int stac92xx_vref_set(struct hda_codec *codec,
692 hda_nid_t nid, unsigned int new_vref)
696 pincfg = snd_hda_codec_read(codec, nid, 0,
697 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
700 pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
703 if (new_vref == AC_PINCTL_VREF_HIZ)
704 pincfg |= AC_PINCTL_OUT_EN;
706 pincfg |= AC_PINCTL_IN_EN;
708 error = snd_hda_codec_write_cache(codec, nid, 0,
709 AC_VERB_SET_PIN_WIDGET_CONTROL, pincfg);
716 static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid)
719 vref = snd_hda_codec_read(codec, nid, 0,
720 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
721 vref &= AC_PINCTL_VREFEN;
725 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
727 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
728 struct sigmatel_spec *spec = codec->spec;
729 return snd_hda_input_mux_info(spec->input_mux, uinfo);
732 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
734 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
735 struct sigmatel_spec *spec = codec->spec;
736 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
738 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
742 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
745 struct sigmatel_spec *spec = codec->spec;
746 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
747 const struct hda_input_mux *imux = spec->input_mux;
748 unsigned int idx, prev_idx, didx;
750 idx = ucontrol->value.enumerated.item[0];
751 if (idx >= imux->num_items)
752 idx = imux->num_items - 1;
753 prev_idx = spec->cur_mux[adc_idx];
756 if (idx < spec->num_analog_muxes) {
757 snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0,
758 AC_VERB_SET_CONNECT_SEL,
759 imux->items[idx].index);
760 if (prev_idx >= spec->num_analog_muxes &&
761 spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) {
762 imux = spec->dinput_mux;
764 snd_hda_codec_write_cache(codec,
765 spec->dmux_nids[adc_idx], 0,
766 AC_VERB_SET_CONNECT_SEL,
767 imux->items[0].index);
770 imux = spec->dinput_mux;
771 /* first dimux item is hardcoded to select analog imux,
774 didx = idx - spec->num_analog_muxes + 1;
775 snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0,
776 AC_VERB_SET_CONNECT_SEL,
777 imux->items[didx].index);
779 spec->cur_mux[adc_idx] = idx;
783 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
784 struct snd_ctl_elem_info *uinfo)
786 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
787 struct sigmatel_spec *spec = codec->spec;
788 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
791 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
792 struct snd_ctl_elem_value *ucontrol)
794 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
795 struct sigmatel_spec *spec = codec->spec;
797 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
801 static int stac92xx_mono_mux_enum_put(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 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
808 spec->mono_nid, &spec->cur_mmux);
811 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
813 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
814 struct snd_ctl_elem_value *ucontrol)
816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
817 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
818 struct sigmatel_spec *spec = codec->spec;
820 ucontrol->value.integer.value[0] = !!(spec->aloopback &
821 (spec->aloopback_mask << idx));
825 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
826 struct snd_ctl_elem_value *ucontrol)
828 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
829 struct sigmatel_spec *spec = codec->spec;
830 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
831 unsigned int dac_mode;
832 unsigned int val, idx_val;
834 idx_val = spec->aloopback_mask << idx;
835 if (ucontrol->value.integer.value[0])
836 val = spec->aloopback | idx_val;
838 val = spec->aloopback & ~idx_val;
839 if (spec->aloopback == val)
842 spec->aloopback = val;
844 /* Only return the bits defined by the shift value of the
845 * first two bytes of the mask
847 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
848 kcontrol->private_value & 0xFFFF, 0x0);
849 dac_mode >>= spec->aloopback_shift;
851 if (spec->aloopback & idx_val) {
852 snd_hda_power_up(codec);
855 snd_hda_power_down(codec);
856 dac_mode &= ~idx_val;
859 snd_hda_codec_write_cache(codec, codec->afg, 0,
860 kcontrol->private_value >> 16, dac_mode);
865 static const struct hda_verb stac9200_core_init[] = {
866 /* set dac0mux for dac converter */
867 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
871 static const struct hda_verb stac9200_eapd_init[] = {
872 /* set dac0mux for dac converter */
873 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
874 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
878 static const struct hda_verb dell_eq_core_init[] = {
879 /* set master volume to max value without distortion
880 * and direct control */
881 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
885 static const struct hda_verb stac92hd73xx_core_init[] = {
886 /* set master volume and direct control */
887 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
891 static const struct hda_verb stac92hd83xxx_core_init[] = {
892 /* power state controls amps */
893 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
897 static const struct hda_verb stac92hd71bxx_core_init[] = {
898 /* set master volume and direct control */
899 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
903 static const 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 const 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 const struct hda_verb stac922x_core_init[] = {
920 /* set master volume and direct control */
921 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
925 static const 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 const struct hda_verb dell_3st_core_init[] = {
936 /* don't set delta bit */
937 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
938 /* unmute node 0x1b */
939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
940 /* select node 0x03 as DAC */
941 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
945 static const struct hda_verb stac927x_core_init[] = {
946 /* set master volume and direct control */
947 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
948 /* enable analog pc beep path */
949 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
953 static const struct hda_verb stac927x_volknob_core_init[] = {
954 /* don't set delta bit */
955 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
956 /* enable analog pc beep path */
957 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
961 static const struct hda_verb stac9205_core_init[] = {
962 /* set master volume and direct control */
963 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
964 /* enable analog pc beep path */
965 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
969 #define STAC_MONO_MUX \
971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
972 .name = "Mono Mux", \
974 .info = stac92xx_mono_mux_enum_info, \
975 .get = stac92xx_mono_mux_enum_get, \
976 .put = stac92xx_mono_mux_enum_put, \
979 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
982 .name = "Analog Loopback", \
984 .info = stac92xx_aloopback_info, \
985 .get = stac92xx_aloopback_get, \
986 .put = stac92xx_aloopback_put, \
987 .private_value = verb_read | (verb_write << 16), \
990 #define DC_BIAS(xname, idx, nid) \
992 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
995 .info = stac92xx_dc_bias_info, \
996 .get = stac92xx_dc_bias_get, \
997 .put = stac92xx_dc_bias_put, \
998 .private_value = nid, \
1001 static const struct snd_kcontrol_new stac9200_mixer[] = {
1002 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
1003 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
1004 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1005 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1009 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
1010 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1014 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
1015 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1019 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1020 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1025 static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1026 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1029 static const struct snd_kcontrol_new stac925x_mixer[] = {
1030 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
1031 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1035 static const struct snd_kcontrol_new stac9205_loopback[] = {
1036 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1040 static const struct snd_kcontrol_new stac927x_loopback[] = {
1041 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1045 static struct snd_kcontrol_new stac_dmux_mixer = {
1046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1047 .name = "Digital Input Source",
1048 /* count set later */
1049 .info = stac92xx_dmux_enum_info,
1050 .get = stac92xx_dmux_enum_get,
1051 .put = stac92xx_dmux_enum_put,
1054 static struct snd_kcontrol_new stac_smux_mixer = {
1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1056 .name = "IEC958 Playback Source",
1057 /* count set later */
1058 .info = stac92xx_smux_enum_info,
1059 .get = stac92xx_smux_enum_get,
1060 .put = stac92xx_smux_enum_put,
1063 static const char * const slave_vols[] = {
1064 "Front Playback Volume",
1065 "Surround Playback Volume",
1066 "Center Playback Volume",
1067 "LFE Playback Volume",
1068 "Side Playback Volume",
1069 "Headphone Playback Volume",
1070 "Speaker Playback Volume",
1074 static const char * const slave_sws[] = {
1075 "Front Playback Switch",
1076 "Surround Playback Switch",
1077 "Center Playback Switch",
1078 "LFE Playback Switch",
1079 "Side Playback Switch",
1080 "Headphone Playback Switch",
1081 "Speaker Playback Switch",
1082 "IEC958 Playback Switch",
1086 static void stac92xx_free_kctls(struct hda_codec *codec);
1088 static int stac92xx_build_controls(struct hda_codec *codec)
1090 struct sigmatel_spec *spec = codec->spec;
1095 err = snd_hda_add_new_ctls(codec, spec->mixer);
1100 for (i = 0; i < spec->num_mixers; i++) {
1101 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1105 if (!spec->auto_mic && spec->num_dmuxes > 0 &&
1106 snd_hda_get_bool_hint(codec, "separate_dmux") == 1) {
1107 stac_dmux_mixer.count = spec->num_dmuxes;
1108 err = snd_hda_ctl_add(codec, 0,
1109 snd_ctl_new1(&stac_dmux_mixer, codec));
1113 if (spec->num_smuxes > 0) {
1114 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1115 struct hda_input_mux *smux = &spec->private_smux;
1116 /* check for mute support on SPDIF out */
1117 if (wcaps & AC_WCAP_OUT_AMP) {
1118 snd_hda_add_imux_item(smux, "Off", 0, NULL);
1119 spec->spdif_mute = 1;
1121 stac_smux_mixer.count = spec->num_smuxes;
1122 err = snd_hda_ctl_add(codec, 0,
1123 snd_ctl_new1(&stac_smux_mixer, codec));
1128 if (spec->multiout.dig_out_nid) {
1129 err = snd_hda_create_spdif_out_ctls(codec,
1130 spec->multiout.dig_out_nid,
1131 spec->multiout.dig_out_nid);
1134 err = snd_hda_create_spdif_share_sw(codec,
1138 spec->multiout.share_spdif = 1;
1140 if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) {
1141 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1146 /* if we have no master control, let's create it */
1147 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1148 unsigned int vmaster_tlv[4];
1149 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1150 HDA_OUTPUT, vmaster_tlv);
1151 /* correct volume offset */
1152 vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
1153 /* minimum value is actually mute */
1154 vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
1155 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1156 vmaster_tlv, slave_vols);
1160 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1161 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1167 if (spec->aloopback_ctl &&
1168 snd_hda_get_bool_hint(codec, "loopback") == 1) {
1169 err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl);
1174 stac92xx_free_kctls(codec); /* no longer needed */
1176 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1183 static const unsigned int ref9200_pin_configs[8] = {
1184 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1185 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1188 static const unsigned int gateway9200_m4_pin_configs[8] = {
1189 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1190 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1192 static const unsigned int gateway9200_m4_2_pin_configs[8] = {
1193 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1194 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1198 STAC 9200 pin configs for
1203 static const unsigned int dell9200_d21_pin_configs[8] = {
1204 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1205 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1209 STAC 9200 pin configs for
1213 static const unsigned int dell9200_d22_pin_configs[8] = {
1214 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1215 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1219 STAC 9200 pin configs for
1220 102801C4 (Dell Dimension E310)
1227 static const unsigned int dell9200_d23_pin_configs[8] = {
1228 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1229 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1234 STAC 9200-32 pin configs for
1235 102801B5 (Dell Inspiron 630m)
1236 102801D8 (Dell Inspiron 640m)
1238 static const unsigned int dell9200_m21_pin_configs[8] = {
1239 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1240 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1244 STAC 9200-32 pin configs for
1245 102801C2 (Dell Latitude D620)
1247 102801CC (Dell Latitude D820)
1251 static const unsigned int dell9200_m22_pin_configs[8] = {
1252 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1253 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1257 STAC 9200-32 pin configs for
1258 102801CE (Dell XPS M1710)
1259 102801CF (Dell Precision M90)
1261 static const unsigned int dell9200_m23_pin_configs[8] = {
1262 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1263 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1267 STAC 9200-32 pin configs for
1270 102801CB (Dell Latitude 120L)
1273 static const unsigned int dell9200_m24_pin_configs[8] = {
1274 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1275 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1279 STAC 9200-32 pin configs for
1280 102801BD (Dell Inspiron E1505n)
1284 static const unsigned int dell9200_m25_pin_configs[8] = {
1285 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1286 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1290 STAC 9200-32 pin configs for
1291 102801F5 (Dell Inspiron 1501)
1294 static const unsigned int dell9200_m26_pin_configs[8] = {
1295 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1296 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1301 102801CD (Dell Inspiron E1705/9400)
1303 static const unsigned int dell9200_m27_pin_configs[8] = {
1304 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1305 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1308 static const unsigned int oqo9200_pin_configs[8] = {
1309 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1310 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1314 static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1315 [STAC_REF] = ref9200_pin_configs,
1316 [STAC_9200_OQO] = oqo9200_pin_configs,
1317 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1318 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1319 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1320 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1321 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1322 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1323 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1324 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1325 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1326 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1327 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1328 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1329 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1332 static const char * const stac9200_models[STAC_9200_MODELS] = {
1333 [STAC_AUTO] = "auto",
1335 [STAC_9200_OQO] = "oqo",
1336 [STAC_9200_DELL_D21] = "dell-d21",
1337 [STAC_9200_DELL_D22] = "dell-d22",
1338 [STAC_9200_DELL_D23] = "dell-d23",
1339 [STAC_9200_DELL_M21] = "dell-m21",
1340 [STAC_9200_DELL_M22] = "dell-m22",
1341 [STAC_9200_DELL_M23] = "dell-m23",
1342 [STAC_9200_DELL_M24] = "dell-m24",
1343 [STAC_9200_DELL_M25] = "dell-m25",
1344 [STAC_9200_DELL_M26] = "dell-m26",
1345 [STAC_9200_DELL_M27] = "dell-m27",
1346 [STAC_9200_M4] = "gateway-m4",
1347 [STAC_9200_M4_2] = "gateway-m4-2",
1348 [STAC_9200_PANASONIC] = "panasonic",
1351 static const struct snd_pci_quirk stac9200_cfg_tbl[] = {
1352 /* SigmaTel reference board */
1353 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1354 "DFI LanParty", STAC_REF),
1355 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1356 "DFI LanParty", STAC_REF),
1357 /* Dell laptops have BIOS problem */
1358 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1359 "unknown Dell", STAC_9200_DELL_D21),
1360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1361 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1363 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1365 "unknown Dell", STAC_9200_DELL_D22),
1366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1367 "unknown Dell", STAC_9200_DELL_D22),
1368 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1369 "Dell Latitude D620", STAC_9200_DELL_M22),
1370 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1371 "unknown Dell", STAC_9200_DELL_D23),
1372 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1373 "unknown Dell", STAC_9200_DELL_D23),
1374 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1375 "unknown Dell", STAC_9200_DELL_M22),
1376 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1377 "unknown Dell", STAC_9200_DELL_M24),
1378 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1379 "unknown Dell", STAC_9200_DELL_M24),
1380 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1381 "Dell Latitude 120L", STAC_9200_DELL_M24),
1382 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1383 "Dell Latitude D820", STAC_9200_DELL_M22),
1384 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1385 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1386 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1387 "Dell XPS M1710", STAC_9200_DELL_M23),
1388 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1389 "Dell Precision M90", STAC_9200_DELL_M23),
1390 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1391 "unknown Dell", STAC_9200_DELL_M22),
1392 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1393 "unknown Dell", STAC_9200_DELL_M22),
1394 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1395 "unknown Dell", STAC_9200_DELL_M22),
1396 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1397 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1398 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1399 "unknown Dell", STAC_9200_DELL_D23),
1400 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1401 "unknown Dell", STAC_9200_DELL_D23),
1402 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1403 "unknown Dell", STAC_9200_DELL_D21),
1404 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1405 "unknown Dell", STAC_9200_DELL_D23),
1406 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1407 "unknown Dell", STAC_9200_DELL_D21),
1408 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1409 "unknown Dell", STAC_9200_DELL_M25),
1410 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1411 "unknown Dell", STAC_9200_DELL_M25),
1412 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1413 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1414 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1415 "unknown Dell", STAC_9200_DELL_M26),
1417 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1418 /* Gateway machines needs EAPD to be set on resume */
1419 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1420 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1421 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1423 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1427 static const unsigned int ref925x_pin_configs[8] = {
1428 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1429 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1432 static const unsigned int stac925xM1_pin_configs[8] = {
1433 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1434 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1437 static const unsigned int stac925xM1_2_pin_configs[8] = {
1438 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1439 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1442 static const unsigned int stac925xM2_pin_configs[8] = {
1443 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1444 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1447 static const unsigned int stac925xM2_2_pin_configs[8] = {
1448 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1449 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1452 static const unsigned int stac925xM3_pin_configs[8] = {
1453 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1454 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1457 static const unsigned int stac925xM5_pin_configs[8] = {
1458 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1459 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1462 static const unsigned int stac925xM6_pin_configs[8] = {
1463 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1464 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1467 static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1468 [STAC_REF] = ref925x_pin_configs,
1469 [STAC_M1] = stac925xM1_pin_configs,
1470 [STAC_M1_2] = stac925xM1_2_pin_configs,
1471 [STAC_M2] = stac925xM2_pin_configs,
1472 [STAC_M2_2] = stac925xM2_2_pin_configs,
1473 [STAC_M3] = stac925xM3_pin_configs,
1474 [STAC_M5] = stac925xM5_pin_configs,
1475 [STAC_M6] = stac925xM6_pin_configs,
1478 static const char * const stac925x_models[STAC_925x_MODELS] = {
1479 [STAC_925x_AUTO] = "auto",
1482 [STAC_M1_2] = "m1-2",
1484 [STAC_M2_2] = "m2-2",
1490 static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1491 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1492 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1493 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1494 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1495 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1496 /* Not sure about the brand name for those */
1497 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1498 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1499 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1500 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1504 static const struct snd_pci_quirk stac925x_cfg_tbl[] = {
1505 /* SigmaTel reference board */
1506 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1507 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1508 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1510 /* Default table for unknown ID */
1511 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1516 static const unsigned int ref92hd73xx_pin_configs[13] = {
1517 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1518 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1519 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1523 static const unsigned int dell_m6_pin_configs[13] = {
1524 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1525 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1526 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1530 static const unsigned int alienware_m17x_pin_configs[13] = {
1531 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1532 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1533 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1537 static const unsigned int intel_dg45id_pin_configs[13] = {
1538 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1539 0x01A19250, 0x01011212, 0x01016211
1542 static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1543 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1544 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1545 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1546 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1547 [STAC_DELL_EQ] = dell_m6_pin_configs,
1548 [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs,
1549 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs,
1552 static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1553 [STAC_92HD73XX_AUTO] = "auto",
1554 [STAC_92HD73XX_NO_JD] = "no-jd",
1555 [STAC_92HD73XX_REF] = "ref",
1556 [STAC_92HD73XX_INTEL] = "intel",
1557 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1558 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1559 [STAC_DELL_M6_BOTH] = "dell-m6",
1560 [STAC_DELL_EQ] = "dell-eq",
1561 [STAC_ALIENWARE_M17X] = "alienware",
1564 static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1565 /* SigmaTel reference board */
1566 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1567 "DFI LanParty", STAC_92HD73XX_REF),
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1569 "DFI LanParty", STAC_92HD73XX_REF),
1570 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1571 "Intel DG45ID", STAC_92HD73XX_INTEL),
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1573 "Intel DG45FC", STAC_92HD73XX_INTEL),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1575 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1577 "unknown Dell", STAC_DELL_M6_DMIC),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1579 "unknown Dell", STAC_DELL_M6_BOTH),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1581 "unknown Dell", STAC_DELL_M6_BOTH),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1583 "unknown Dell", STAC_DELL_M6_AMIC),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1585 "unknown Dell", STAC_DELL_M6_AMIC),
1586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1587 "unknown Dell", STAC_DELL_M6_DMIC),
1588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1589 "unknown Dell", STAC_DELL_M6_DMIC),
1590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1591 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1593 "Dell Studio 17", STAC_DELL_M6_DMIC),
1594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1595 "Dell Studio 1555", STAC_DELL_M6_DMIC),
1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1597 "Dell Studio 1557", STAC_DELL_M6_DMIC),
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1599 "Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1601 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1605 static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1607 "Alienware M17x", STAC_ALIENWARE_M17X),
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1609 "Alienware M17x", STAC_ALIENWARE_M17X),
1610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
1611 "Alienware M17x", STAC_ALIENWARE_M17X),
1615 static const unsigned int ref92hd83xxx_pin_configs[10] = {
1616 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1617 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1618 0x01451160, 0x98560170,
1621 static const unsigned int dell_s14_pin_configs[10] = {
1622 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1623 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1624 0x40f000f0, 0x40f000f0,
1627 static const unsigned int dell_vostro_3500_pin_configs[10] = {
1628 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110,
1629 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160,
1630 0x400000f4, 0x400000f5,
1633 static const unsigned int hp_dv7_4000_pin_configs[10] = {
1634 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1635 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1636 0x40f000f0, 0x40f000f0,
1639 static const unsigned int hp_cNB11_intquad_pin_configs[10] = {
1640 0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110,
1641 0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130,
1642 0x40f000f0, 0x40f000f0,
1645 static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1646 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1647 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1648 [STAC_DELL_S14] = dell_s14_pin_configs,
1649 [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs,
1650 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs,
1651 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs,
1654 static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1655 [STAC_92HD83XXX_AUTO] = "auto",
1656 [STAC_92HD83XXX_REF] = "ref",
1657 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1658 [STAC_DELL_S14] = "dell-s14",
1659 [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500",
1660 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad",
1661 [STAC_HP_DV7_4000] = "hp-dv7-4000",
1664 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1665 /* SigmaTel reference board */
1666 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1667 "DFI LanParty", STAC_92HD83XXX_REF),
1668 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1669 "DFI LanParty", STAC_92HD83XXX_REF),
1670 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
1671 "unknown Dell", STAC_DELL_S14),
1672 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
1673 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
1674 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
1675 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1676 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
1677 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1678 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
1679 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1680 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
1681 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
1683 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
1685 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1686 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
1687 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1688 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
1689 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1690 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
1691 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1692 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
1693 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1694 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
1695 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1696 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
1697 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1698 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
1699 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1700 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
1701 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1702 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
1703 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1704 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
1705 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1706 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
1707 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
1709 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1710 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
1711 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1712 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
1713 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1717 static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1718 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1719 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1720 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1724 static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1725 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1726 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1727 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1731 static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1732 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1733 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1734 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1738 static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1739 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1740 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1741 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1745 static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1746 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1747 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1748 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1749 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1750 [STAC_HP_M4] = NULL,
1751 [STAC_HP_DV4] = NULL,
1752 [STAC_HP_DV5] = NULL,
1753 [STAC_HP_HDX] = NULL,
1754 [STAC_HP_DV4_1222NR] = NULL,
1757 static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1758 [STAC_92HD71BXX_AUTO] = "auto",
1759 [STAC_92HD71BXX_REF] = "ref",
1760 [STAC_DELL_M4_1] = "dell-m4-1",
1761 [STAC_DELL_M4_2] = "dell-m4-2",
1762 [STAC_DELL_M4_3] = "dell-m4-3",
1763 [STAC_HP_M4] = "hp-m4",
1764 [STAC_HP_DV4] = "hp-dv4",
1765 [STAC_HP_DV5] = "hp-dv5",
1766 [STAC_HP_HDX] = "hp-hdx",
1767 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
1770 static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1771 /* SigmaTel reference board */
1772 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1773 "DFI LanParty", STAC_92HD71BXX_REF),
1774 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1775 "DFI LanParty", STAC_92HD71BXX_REF),
1776 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb,
1777 "HP dv4-1222nr", STAC_HP_DV4_1222NR),
1778 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
1780 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
1782 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
1783 "HP dv4-7", STAC_HP_DV4),
1784 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
1785 "HP dv4-7", STAC_HP_DV5),
1786 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
1787 "HP HDX", STAC_HP_HDX), /* HDX18 */
1788 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1789 "HP mini 1000", STAC_HP_M4),
1790 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
1791 "HP HDX", STAC_HP_HDX), /* HDX16 */
1792 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
1793 "HP dv6", STAC_HP_DV5),
1794 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
1795 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
1796 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
1797 "HP DV6", STAC_HP_DV5),
1798 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
1800 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1801 "unknown Dell", STAC_DELL_M4_1),
1802 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1803 "unknown Dell", STAC_DELL_M4_1),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1805 "unknown Dell", STAC_DELL_M4_1),
1806 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1807 "unknown Dell", STAC_DELL_M4_1),
1808 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1809 "unknown Dell", STAC_DELL_M4_1),
1810 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1811 "unknown Dell", STAC_DELL_M4_1),
1812 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1813 "unknown Dell", STAC_DELL_M4_1),
1814 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1815 "unknown Dell", STAC_DELL_M4_2),
1816 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1817 "unknown Dell", STAC_DELL_M4_2),
1818 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1819 "unknown Dell", STAC_DELL_M4_2),
1820 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1821 "unknown Dell", STAC_DELL_M4_2),
1822 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1823 "unknown Dell", STAC_DELL_M4_3),
1827 static const unsigned int ref922x_pin_configs[10] = {
1828 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1829 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1830 0x40000100, 0x40000100,
1834 STAC 922X pin configs for
1841 static const unsigned int dell_922x_d81_pin_configs[10] = {
1842 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1843 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1844 0x01813122, 0x400001f2,
1848 STAC 922X pin configs for
1852 static const unsigned int dell_922x_d82_pin_configs[10] = {
1853 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1854 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1855 0x01813122, 0x400001f1,
1859 STAC 922X pin configs for
1862 static const unsigned int dell_922x_m81_pin_configs[10] = {
1863 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1864 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1865 0x40C003f1, 0x405003f0,
1869 STAC 9221 A1 pin configs for
1870 102801D7 (Dell XPS M1210)
1872 static const unsigned int dell_922x_m82_pin_configs[10] = {
1873 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1874 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1875 0x508003f3, 0x405003f4,
1878 static const unsigned int d945gtp3_pin_configs[10] = {
1879 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1880 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1881 0x02a19120, 0x40000100,
1884 static const unsigned int d945gtp5_pin_configs[10] = {
1885 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1886 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1887 0x02a19320, 0x40000100,
1890 static const unsigned int intel_mac_v1_pin_configs[10] = {
1891 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1892 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1893 0x400000fc, 0x400000fb,
1896 static const unsigned int intel_mac_v2_pin_configs[10] = {
1897 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1898 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1899 0x400000fc, 0x400000fb,
1902 static const unsigned int intel_mac_v3_pin_configs[10] = {
1903 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1904 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1905 0x400000fc, 0x400000fb,
1908 static const unsigned int intel_mac_v4_pin_configs[10] = {
1909 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1910 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1911 0x400000fc, 0x400000fb,
1914 static const unsigned int intel_mac_v5_pin_configs[10] = {
1915 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1916 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1917 0x400000fc, 0x400000fb,
1920 static const unsigned int ecs202_pin_configs[10] = {
1921 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1922 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1923 0x9037012e, 0x40e000f2,
1926 static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1927 [STAC_D945_REF] = ref922x_pin_configs,
1928 [STAC_D945GTP3] = d945gtp3_pin_configs,
1929 [STAC_D945GTP5] = d945gtp5_pin_configs,
1930 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1931 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1932 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1933 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1934 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1935 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1936 /* for backward compatibility */
1937 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1938 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1939 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1940 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1941 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1942 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1943 [STAC_ECS_202] = ecs202_pin_configs,
1944 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1945 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1946 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1947 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1950 static const char * const stac922x_models[STAC_922X_MODELS] = {
1951 [STAC_922X_AUTO] = "auto",
1952 [STAC_D945_REF] = "ref",
1953 [STAC_D945GTP5] = "5stack",
1954 [STAC_D945GTP3] = "3stack",
1955 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1956 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1957 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1958 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1959 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1960 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1961 /* for backward compatibility */
1962 [STAC_MACMINI] = "macmini",
1963 [STAC_MACBOOK] = "macbook",
1964 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1965 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1966 [STAC_IMAC_INTEL] = "imac-intel",
1967 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1968 [STAC_ECS_202] = "ecs202",
1969 [STAC_922X_DELL_D81] = "dell-d81",
1970 [STAC_922X_DELL_D82] = "dell-d82",
1971 [STAC_922X_DELL_M81] = "dell-m81",
1972 [STAC_922X_DELL_M82] = "dell-m82",
1975 static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
1976 /* SigmaTel reference board */
1977 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1978 "DFI LanParty", STAC_D945_REF),
1979 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1980 "DFI LanParty", STAC_D945_REF),
1981 /* Intel 945G based systems */
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1983 "Intel D945G", STAC_D945GTP3),
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1985 "Intel D945G", STAC_D945GTP3),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1987 "Intel D945G", STAC_D945GTP3),
1988 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1989 "Intel D945G", STAC_D945GTP3),
1990 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1991 "Intel D945G", STAC_D945GTP3),
1992 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1993 "Intel D945G", STAC_D945GTP3),
1994 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1995 "Intel D945G", STAC_D945GTP3),
1996 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1997 "Intel D945G", STAC_D945GTP3),
1998 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1999 "Intel D945G", STAC_D945GTP3),
2000 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
2001 "Intel D945G", STAC_D945GTP3),
2002 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
2003 "Intel D945G", STAC_D945GTP3),
2004 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
2005 "Intel D945G", STAC_D945GTP3),
2006 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
2007 "Intel D945G", STAC_D945GTP3),
2008 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
2009 "Intel D945G", STAC_D945GTP3),
2010 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
2011 "Intel D945G", STAC_D945GTP3),
2012 /* Intel D945G 5-stack systems */
2013 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
2014 "Intel D945G", STAC_D945GTP5),
2015 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
2016 "Intel D945G", STAC_D945GTP5),
2017 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
2018 "Intel D945G", STAC_D945GTP5),
2019 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
2020 "Intel D945G", STAC_D945GTP5),
2021 /* Intel 945P based systems */
2022 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
2023 "Intel D945P", STAC_D945GTP3),
2024 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
2025 "Intel D945P", STAC_D945GTP3),
2026 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
2027 "Intel D945P", STAC_D945GTP3),
2028 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
2029 "Intel D945P", STAC_D945GTP3),
2030 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
2031 "Intel D945P", STAC_D945GTP3),
2032 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2033 "Intel D945P", STAC_D945GTP5),
2035 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
2036 "Intel D945", STAC_D945_REF),
2038 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2039 SND_PCI_QUIRK(0x8384, 0x7680,
2040 "Mac", STAC_INTEL_MAC_AUTO),
2042 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2043 "unknown Dell", STAC_922X_DELL_D81),
2044 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2045 "unknown Dell", STAC_922X_DELL_D81),
2046 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2047 "unknown Dell", STAC_922X_DELL_D81),
2048 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2049 "unknown Dell", STAC_922X_DELL_D82),
2050 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2051 "unknown Dell", STAC_922X_DELL_M81),
2052 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2053 "unknown Dell", STAC_922X_DELL_D82),
2054 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2055 "unknown Dell", STAC_922X_DELL_D81),
2056 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2057 "unknown Dell", STAC_922X_DELL_D81),
2058 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2059 "Dell XPS M1210", STAC_922X_DELL_M82),
2060 /* ECS/PC Chips boards */
2061 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2062 "ECS/PC chips", STAC_ECS_202),
2066 static const unsigned int ref927x_pin_configs[14] = {
2067 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2068 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2069 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2070 0x01c42190, 0x40000100,
2073 static const unsigned int d965_3st_pin_configs[14] = {
2074 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2075 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2076 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2077 0x40000100, 0x40000100
2080 static const unsigned int d965_5st_pin_configs[14] = {
2081 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2082 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2083 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2084 0x40000100, 0x40000100
2087 static const unsigned int d965_5st_no_fp_pin_configs[14] = {
2088 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2089 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2090 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2091 0x40000100, 0x40000100
2094 static const unsigned int dell_3st_pin_configs[14] = {
2095 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2096 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2097 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2098 0x40c003fc, 0x40000100
2101 static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2102 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2103 [STAC_D965_REF] = ref927x_pin_configs,
2104 [STAC_D965_3ST] = d965_3st_pin_configs,
2105 [STAC_D965_5ST] = d965_5st_pin_configs,
2106 [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs,
2107 [STAC_DELL_3ST] = dell_3st_pin_configs,
2108 [STAC_DELL_BIOS] = NULL,
2109 [STAC_927X_VOLKNOB] = NULL,
2112 static const char * const stac927x_models[STAC_927X_MODELS] = {
2113 [STAC_927X_AUTO] = "auto",
2114 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2115 [STAC_D965_REF] = "ref",
2116 [STAC_D965_3ST] = "3stack",
2117 [STAC_D965_5ST] = "5stack",
2118 [STAC_D965_5ST_NO_FP] = "5stack-no-fp",
2119 [STAC_DELL_3ST] = "dell-3stack",
2120 [STAC_DELL_BIOS] = "dell-bios",
2121 [STAC_927X_VOLKNOB] = "volknob",
2124 static const struct snd_pci_quirk stac927x_cfg_tbl[] = {
2125 /* SigmaTel reference board */
2126 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2127 "DFI LanParty", STAC_D965_REF),
2128 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2129 "DFI LanParty", STAC_D965_REF),
2130 /* Intel 946 based systems */
2131 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2132 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2133 /* 965 based 3 stack systems */
2134 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
2135 "Intel D965", STAC_D965_3ST),
2136 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
2137 "Intel D965", STAC_D965_3ST),
2138 /* Dell 3 stack systems */
2139 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2140 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2141 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2142 /* Dell 3 stack systems with verb table in BIOS */
2143 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2144 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
2145 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2146 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2147 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
2148 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2149 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2150 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2151 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2152 /* 965 based 5 stack systems */
2153 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
2154 "Intel D965", STAC_D965_5ST),
2155 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
2156 "Intel D965", STAC_D965_5ST),
2157 /* volume-knob fixes */
2158 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
2162 static const unsigned int ref9205_pin_configs[12] = {
2163 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2164 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2165 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2169 STAC 9205 pin configs for
2176 10280228 (Dell Vostro 1500)
2177 10280229 (Dell Vostro 1700)
2179 static const unsigned int dell_9205_m42_pin_configs[12] = {
2180 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2181 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2182 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2186 STAC 9205 pin configs for
2190 102801FF (Dell Precision M4300)
2195 static const unsigned int dell_9205_m43_pin_configs[12] = {
2196 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2197 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2198 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2201 static const unsigned int dell_9205_m44_pin_configs[12] = {
2202 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2203 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2204 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2207 static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2208 [STAC_9205_REF] = ref9205_pin_configs,
2209 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2210 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2211 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2212 [STAC_9205_EAPD] = NULL,
2215 static const char * const stac9205_models[STAC_9205_MODELS] = {
2216 [STAC_9205_AUTO] = "auto",
2217 [STAC_9205_REF] = "ref",
2218 [STAC_9205_DELL_M42] = "dell-m42",
2219 [STAC_9205_DELL_M43] = "dell-m43",
2220 [STAC_9205_DELL_M44] = "dell-m44",
2221 [STAC_9205_EAPD] = "eapd",
2224 static const struct snd_pci_quirk stac9205_cfg_tbl[] = {
2225 /* SigmaTel reference board */
2226 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2227 "DFI LanParty", STAC_9205_REF),
2228 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
2229 "SigmaTel", STAC_9205_REF),
2230 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2231 "DFI LanParty", STAC_9205_REF),
2233 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2234 "unknown Dell", STAC_9205_DELL_M42),
2235 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2236 "unknown Dell", STAC_9205_DELL_M42),
2237 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2238 "Dell Precision", STAC_9205_DELL_M43),
2239 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2240 "Dell Precision", STAC_9205_DELL_M43),
2241 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2242 "Dell Precision", STAC_9205_DELL_M43),
2243 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2244 "unknown Dell", STAC_9205_DELL_M42),
2245 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2246 "unknown Dell", STAC_9205_DELL_M42),
2247 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2248 "Dell Precision", STAC_9205_DELL_M43),
2249 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2250 "Dell Precision M4300", STAC_9205_DELL_M43),
2251 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2252 "unknown Dell", STAC_9205_DELL_M42),
2253 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2254 "Dell Precision", STAC_9205_DELL_M43),
2255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2256 "Dell Precision", STAC_9205_DELL_M43),
2257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2258 "Dell Precision", STAC_9205_DELL_M43),
2259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2260 "Dell Inspiron", STAC_9205_DELL_M44),
2261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2262 "Dell Vostro 1500", STAC_9205_DELL_M42),
2263 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
2264 "Dell Vostro 1700", STAC_9205_DELL_M42),
2266 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2267 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2271 static void stac92xx_set_config_regs(struct hda_codec *codec,
2272 const unsigned int *pincfgs)
2275 struct sigmatel_spec *spec = codec->spec;
2280 for (i = 0; i < spec->num_pins; i++)
2281 if (spec->pin_nids[i] && pincfgs[i])
2282 snd_hda_codec_set_pincfg(codec, spec->pin_nids[i],
2287 * Analog playback callbacks
2289 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2290 struct hda_codec *codec,
2291 struct snd_pcm_substream *substream)
2293 struct sigmatel_spec *spec = codec->spec;
2294 if (spec->stream_delay)
2295 msleep(spec->stream_delay);
2296 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2300 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2301 struct hda_codec *codec,
2302 unsigned int stream_tag,
2303 unsigned int format,
2304 struct snd_pcm_substream *substream)
2306 struct sigmatel_spec *spec = codec->spec;
2307 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2310 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2311 struct hda_codec *codec,
2312 struct snd_pcm_substream *substream)
2314 struct sigmatel_spec *spec = codec->spec;
2315 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2319 * Digital playback callbacks
2321 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2322 struct hda_codec *codec,
2323 struct snd_pcm_substream *substream)
2325 struct sigmatel_spec *spec = codec->spec;
2326 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2329 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2330 struct hda_codec *codec,
2331 struct snd_pcm_substream *substream)
2333 struct sigmatel_spec *spec = codec->spec;
2334 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2337 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2338 struct hda_codec *codec,
2339 unsigned int stream_tag,
2340 unsigned int format,
2341 struct snd_pcm_substream *substream)
2343 struct sigmatel_spec *spec = codec->spec;
2344 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2345 stream_tag, format, substream);
2348 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2349 struct hda_codec *codec,
2350 struct snd_pcm_substream *substream)
2352 struct sigmatel_spec *spec = codec->spec;
2353 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2358 * Analog capture callbacks
2360 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2361 struct hda_codec *codec,
2362 unsigned int stream_tag,
2363 unsigned int format,
2364 struct snd_pcm_substream *substream)
2366 struct sigmatel_spec *spec = codec->spec;
2367 hda_nid_t nid = spec->adc_nids[substream->number];
2369 if (spec->powerdown_adcs) {
2371 snd_hda_codec_write(codec, nid, 0,
2372 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2374 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2378 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2379 struct hda_codec *codec,
2380 struct snd_pcm_substream *substream)
2382 struct sigmatel_spec *spec = codec->spec;
2383 hda_nid_t nid = spec->adc_nids[substream->number];
2385 snd_hda_codec_cleanup_stream(codec, nid);
2386 if (spec->powerdown_adcs)
2387 snd_hda_codec_write(codec, nid, 0,
2388 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2392 static const struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2396 /* NID is set in stac92xx_build_pcms */
2398 .open = stac92xx_dig_playback_pcm_open,
2399 .close = stac92xx_dig_playback_pcm_close,
2400 .prepare = stac92xx_dig_playback_pcm_prepare,
2401 .cleanup = stac92xx_dig_playback_pcm_cleanup
2405 static const struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2409 /* NID is set in stac92xx_build_pcms */
2412 static const struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2416 .nid = 0x02, /* NID to query formats and rates */
2418 .open = stac92xx_playback_pcm_open,
2419 .prepare = stac92xx_playback_pcm_prepare,
2420 .cleanup = stac92xx_playback_pcm_cleanup
2424 static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2428 .nid = 0x06, /* NID to query formats and rates */
2430 .open = stac92xx_playback_pcm_open,
2431 .prepare = stac92xx_playback_pcm_prepare,
2432 .cleanup = stac92xx_playback_pcm_cleanup
2436 static const struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2439 /* NID + .substreams is set in stac92xx_build_pcms */
2441 .prepare = stac92xx_capture_pcm_prepare,
2442 .cleanup = stac92xx_capture_pcm_cleanup
2446 static int stac92xx_build_pcms(struct hda_codec *codec)
2448 struct sigmatel_spec *spec = codec->spec;
2449 struct hda_pcm *info = spec->pcm_rec;
2451 codec->num_pcms = 1;
2452 codec->pcm_info = info;
2454 info->name = "STAC92xx Analog";
2455 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2456 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2457 spec->multiout.dac_nids[0];
2458 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2459 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2460 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2462 if (spec->alt_switch) {
2465 info->name = "STAC92xx Analog Alt";
2466 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2469 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2472 info->name = "STAC92xx Digital";
2473 info->pcm_type = spec->autocfg.dig_out_type[0];
2474 if (spec->multiout.dig_out_nid) {
2475 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2476 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2478 if (spec->dig_in_nid) {
2479 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2480 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2487 static unsigned int stac92xx_get_default_vref(struct hda_codec *codec,
2490 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2491 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2492 if (pincap & AC_PINCAP_VREF_100)
2493 return AC_PINCTL_VREF_100;
2494 if (pincap & AC_PINCAP_VREF_80)
2495 return AC_PINCTL_VREF_80;
2496 if (pincap & AC_PINCAP_VREF_50)
2497 return AC_PINCTL_VREF_50;
2498 if (pincap & AC_PINCAP_VREF_GRD)
2499 return AC_PINCTL_VREF_GRD;
2503 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2506 snd_hda_codec_write_cache(codec, nid, 0,
2507 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2510 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2512 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2513 struct snd_ctl_elem_value *ucontrol)
2515 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2516 struct sigmatel_spec *spec = codec->spec;
2518 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2522 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid);
2524 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2525 struct snd_ctl_elem_value *ucontrol)
2527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2528 struct sigmatel_spec *spec = codec->spec;
2529 int nid = kcontrol->private_value;
2531 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2533 /* check to be sure that the ports are up to date with
2536 stac_issue_unsol_event(codec, nid);
2541 static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol,
2542 struct snd_ctl_elem_info *uinfo)
2545 static const char * const texts[] = {
2546 "Mic In", "Line In", "Line Out"
2549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2550 struct sigmatel_spec *spec = codec->spec;
2551 hda_nid_t nid = kcontrol->private_value;
2553 if (nid == spec->mic_switch || nid == spec->line_switch)
2558 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2559 uinfo->value.enumerated.items = i;
2561 if (uinfo->value.enumerated.item >= i)
2562 uinfo->value.enumerated.item = i-1;
2563 strcpy(uinfo->value.enumerated.name,
2564 texts[uinfo->value.enumerated.item]);
2569 static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol,
2570 struct snd_ctl_elem_value *ucontrol)
2572 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2573 hda_nid_t nid = kcontrol->private_value;
2574 unsigned int vref = stac92xx_vref_get(codec, nid);
2576 if (vref == stac92xx_get_default_vref(codec, nid))
2577 ucontrol->value.enumerated.item[0] = 0;
2578 else if (vref == AC_PINCTL_VREF_GRD)
2579 ucontrol->value.enumerated.item[0] = 1;
2580 else if (vref == AC_PINCTL_VREF_HIZ)
2581 ucontrol->value.enumerated.item[0] = 2;
2586 static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol,
2587 struct snd_ctl_elem_value *ucontrol)
2589 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2590 unsigned int new_vref = 0;
2592 hda_nid_t nid = kcontrol->private_value;
2594 if (ucontrol->value.enumerated.item[0] == 0)
2595 new_vref = stac92xx_get_default_vref(codec, nid);
2596 else if (ucontrol->value.enumerated.item[0] == 1)
2597 new_vref = AC_PINCTL_VREF_GRD;
2598 else if (ucontrol->value.enumerated.item[0] == 2)
2599 new_vref = AC_PINCTL_VREF_HIZ;
2603 if (new_vref != stac92xx_vref_get(codec, nid)) {
2604 error = stac92xx_vref_set(codec, nid, new_vref);
2611 static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol,
2612 struct snd_ctl_elem_info *uinfo)
2615 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2616 struct sigmatel_spec *spec = codec->spec;
2618 if (kcontrol->private_value == spec->line_switch)
2619 texts[0] = "Line In";
2621 texts[0] = "Mic In";
2622 texts[1] = "Line Out";
2623 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2624 uinfo->value.enumerated.items = 2;
2627 if (uinfo->value.enumerated.item >= 2)
2628 uinfo->value.enumerated.item = 1;
2629 strcpy(uinfo->value.enumerated.name,
2630 texts[uinfo->value.enumerated.item]);
2635 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2637 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2638 struct sigmatel_spec *spec = codec->spec;
2639 hda_nid_t nid = kcontrol->private_value;
2640 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2642 ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx];
2646 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2648 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2649 struct sigmatel_spec *spec = codec->spec;
2650 hda_nid_t nid = kcontrol->private_value;
2651 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2652 unsigned short val = !!ucontrol->value.enumerated.item[0];
2654 spec->io_switch[io_idx] = val;
2657 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2659 unsigned int pinctl = AC_PINCTL_IN_EN;
2660 if (io_idx) /* set VREF for mic */
2661 pinctl |= stac92xx_get_default_vref(codec, nid);
2662 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2665 /* check the auto-mute again: we need to mute/unmute the speaker
2666 * appropriately according to the pin direction
2668 if (spec->hp_detect)
2669 stac_issue_unsol_event(codec, nid);
2674 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2676 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2677 struct snd_ctl_elem_value *ucontrol)
2679 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2680 struct sigmatel_spec *spec = codec->spec;
2682 ucontrol->value.integer.value[0] = spec->clfe_swap;
2686 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2687 struct snd_ctl_elem_value *ucontrol)
2689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2690 struct sigmatel_spec *spec = codec->spec;
2691 hda_nid_t nid = kcontrol->private_value & 0xff;
2692 unsigned int val = !!ucontrol->value.integer.value[0];
2694 if (spec->clfe_swap == val)
2697 spec->clfe_swap = val;
2699 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2700 spec->clfe_swap ? 0x4 : 0x0);
2705 #define STAC_CODEC_HP_SWITCH(xname) \
2706 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2709 .info = stac92xx_hp_switch_info, \
2710 .get = stac92xx_hp_switch_get, \
2711 .put = stac92xx_hp_switch_put, \
2714 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2715 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2718 .info = stac92xx_io_switch_info, \
2719 .get = stac92xx_io_switch_get, \
2720 .put = stac92xx_io_switch_put, \
2721 .private_value = xpval, \
2724 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2725 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2728 .info = stac92xx_clfe_switch_info, \
2729 .get = stac92xx_clfe_switch_get, \
2730 .put = stac92xx_clfe_switch_put, \
2731 .private_value = xpval, \
2735 STAC_CTL_WIDGET_VOL,
2736 STAC_CTL_WIDGET_MUTE,
2737 STAC_CTL_WIDGET_MUTE_BEEP,
2738 STAC_CTL_WIDGET_MONO_MUX,
2739 STAC_CTL_WIDGET_HP_SWITCH,
2740 STAC_CTL_WIDGET_IO_SWITCH,
2741 STAC_CTL_WIDGET_CLFE_SWITCH,
2742 STAC_CTL_WIDGET_DC_BIAS
2745 static const struct snd_kcontrol_new stac92xx_control_templates[] = {
2746 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2747 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2748 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0),
2750 STAC_CODEC_HP_SWITCH(NULL),
2751 STAC_CODEC_IO_SWITCH(NULL, 0),
2752 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2753 DC_BIAS(NULL, 0, 0),
2756 /* add dynamic controls */
2757 static struct snd_kcontrol_new *
2758 stac_control_new(struct sigmatel_spec *spec,
2759 const struct snd_kcontrol_new *ktemp,
2761 unsigned int subdev)
2763 struct snd_kcontrol_new *knew;
2765 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2766 knew = snd_array_new(&spec->kctls);
2770 knew->name = kstrdup(name, GFP_KERNEL);
2773 memset(knew, 0, sizeof(*knew));
2774 spec->kctls.alloced--;
2777 knew->subdevice = subdev;
2781 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2782 const struct snd_kcontrol_new *ktemp,
2783 int idx, const char *name,
2786 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name,
2787 HDA_SUBDEV_AMP_FLAG);
2791 knew->private_value = val;
2795 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2796 int type, int idx, const char *name,
2799 return stac92xx_add_control_temp(spec,
2800 &stac92xx_control_templates[type],
2805 /* add dynamic controls */
2806 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2807 const char *name, unsigned long val)
2809 return stac92xx_add_control_idx(spec, type, 0, name, val);
2812 static const struct snd_kcontrol_new stac_input_src_temp = {
2813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2814 .name = "Input Source",
2815 .info = stac92xx_mux_enum_info,
2816 .get = stac92xx_mux_enum_get,
2817 .put = stac92xx_mux_enum_put,
2820 static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
2821 hda_nid_t nid, int idx)
2823 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
2825 struct sigmatel_spec *spec = codec->spec;
2828 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2829 if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD
2830 && nid == spec->line_switch)
2831 control = STAC_CTL_WIDGET_IO_SWITCH;
2832 else if (snd_hda_query_pin_caps(codec, nid)
2833 & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT))
2834 control = STAC_CTL_WIDGET_DC_BIAS;
2835 else if (nid == spec->mic_switch)
2836 control = STAC_CTL_WIDGET_IO_SWITCH;
2840 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
2841 name, sizeof(name), NULL);
2842 return stac92xx_add_control(codec->spec, control,
2843 strcat(name, " Jack Mode"), nid);
2849 static int stac92xx_add_input_source(struct sigmatel_spec *spec)
2851 struct snd_kcontrol_new *knew;
2852 struct hda_input_mux *imux = &spec->private_imux;
2855 return 0; /* no need for input source */
2856 if (!spec->num_adcs || imux->num_items <= 1)
2857 return 0; /* no need for input source control */
2858 knew = stac_control_new(spec, &stac_input_src_temp,
2859 stac_input_src_temp.name, 0);
2862 knew->count = spec->num_adcs;
2866 /* check whether the line-input can be used as line-out */
2867 static hda_nid_t check_line_out_switch(struct hda_codec *codec)
2869 struct sigmatel_spec *spec = codec->spec;
2870 struct auto_pin_cfg *cfg = &spec->autocfg;
2872 unsigned int pincap;
2875 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2877 for (i = 0; i < cfg->num_inputs; i++) {
2878 if (cfg->inputs[i].type == AUTO_PIN_LINE_IN) {
2879 nid = cfg->inputs[i].pin;
2880 pincap = snd_hda_query_pin_caps(codec, nid);
2881 if (pincap & AC_PINCAP_OUT)
2888 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid);
2890 /* check whether the mic-input can be used as line-out */
2891 static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac)
2893 struct sigmatel_spec *spec = codec->spec;
2894 struct auto_pin_cfg *cfg = &spec->autocfg;
2895 unsigned int def_conf, pincap;
2899 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2901 for (i = 0; i < cfg->num_inputs; i++) {
2902 hda_nid_t nid = cfg->inputs[i].pin;
2903 if (cfg->inputs[i].type != AUTO_PIN_MIC)
2905 def_conf = snd_hda_codec_get_pincfg(codec, nid);
2906 /* some laptops have an internal analog microphone
2907 * which can't be used as a output */
2908 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2909 pincap = snd_hda_query_pin_caps(codec, nid);
2910 if (pincap & AC_PINCAP_OUT) {
2911 *dac = get_unassigned_dac(codec, nid);
2920 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2924 for (i = 0; i < spec->multiout.num_dacs; i++) {
2925 if (spec->multiout.dac_nids[i] == nid)
2932 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2935 if (is_in_dac_nids(spec, nid))
2937 for (i = 0; i < spec->autocfg.hp_outs; i++)
2938 if (spec->hp_dacs[i] == nid)
2940 for (i = 0; i < spec->autocfg.speaker_outs; i++)
2941 if (spec->speaker_dacs[i] == nid)
2946 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
2948 struct sigmatel_spec *spec = codec->spec;
2949 struct auto_pin_cfg *cfg = &spec->autocfg;
2951 hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac;
2952 unsigned int wcaps, wtype;
2954 conn_len = snd_hda_get_connections(codec, nid, conn,
2955 HDA_MAX_CONNECTIONS);
2956 /* 92HD88: trace back up the link of nids to find the DAC */
2957 while (conn_len == 1 && (get_wcaps_type(get_wcaps(codec, conn[0]))
2958 != AC_WID_AUD_OUT)) {
2960 conn_len = snd_hda_get_connections(codec, nid, conn,
2961 HDA_MAX_CONNECTIONS);
2963 for (j = 0; j < conn_len; j++) {
2964 wcaps = get_wcaps(codec, conn[j]);
2965 wtype = get_wcaps_type(wcaps);
2966 /* we check only analog outputs */
2967 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))
2969 /* if this route has a free DAC, assign it */
2970 if (!check_all_dac_nids(spec, conn[j])) {
2972 /* select this DAC in the pin's input mux */
2973 snd_hda_codec_write_cache(codec, nid, 0,
2974 AC_VERB_SET_CONNECT_SEL, j);
2980 /* if all DACs are already assigned, connect to the primary DAC,
2981 unless we're assigning a secondary headphone */
2982 fallback_dac = spec->multiout.dac_nids[0];
2983 if (spec->multiout.hp_nid) {
2984 for (j = 0; j < cfg->hp_outs; j++)
2985 if (cfg->hp_pins[j] == nid) {
2986 fallback_dac = spec->multiout.hp_nid;
2992 for (j = 0; j < conn_len; j++) {
2993 if (conn[j] == fallback_dac) {
2994 snd_hda_codec_write_cache(codec, nid, 0,
2995 AC_VERB_SET_CONNECT_SEL, j);
3003 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3004 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3007 * Fill in the dac_nids table from the parsed pin configuration
3008 * This function only works when every pin in line_out_pins[]
3009 * contains atleast one DAC in its connection list. Some 92xx
3010 * codecs are not connected directly to a DAC, such as the 9200
3011 * and 9202/925x. For those, dac_nids[] must be hard-coded.
3013 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec)
3015 struct sigmatel_spec *spec = codec->spec;
3016 struct auto_pin_cfg *cfg = &spec->autocfg;
3020 for (i = 0; i < cfg->line_outs; i++) {
3021 nid = cfg->line_out_pins[i];
3022 dac = get_unassigned_dac(codec, nid);
3024 if (spec->multiout.num_dacs > 0) {
3025 /* we have already working output pins,
3026 * so let's drop the broken ones again
3028 cfg->line_outs = spec->multiout.num_dacs;
3031 /* error out, no available DAC found */
3033 "%s: No available DAC for pin 0x%x\n",
3037 add_spec_dacs(spec, dac);
3040 for (i = 0; i < cfg->hp_outs; i++) {
3041 nid = cfg->hp_pins[i];
3042 dac = get_unassigned_dac(codec, nid);
3044 if (!spec->multiout.hp_nid)
3045 spec->multiout.hp_nid = dac;
3047 add_spec_extra_dacs(spec, dac);
3049 spec->hp_dacs[i] = dac;
3052 for (i = 0; i < cfg->speaker_outs; i++) {
3053 nid = cfg->speaker_pins[i];
3054 dac = get_unassigned_dac(codec, nid);
3056 add_spec_extra_dacs(spec, dac);
3057 spec->speaker_dacs[i] = dac;
3060 /* add line-in as output */
3061 nid = check_line_out_switch(codec);
3063 dac = get_unassigned_dac(codec, nid);
3065 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
3066 nid, cfg->line_outs);
3067 cfg->line_out_pins[cfg->line_outs] = nid;
3069 spec->line_switch = nid;
3070 add_spec_dacs(spec, dac);
3073 /* add mic as output */
3074 nid = check_mic_out_switch(codec, &dac);
3076 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
3077 nid, cfg->line_outs);
3078 cfg->line_out_pins[cfg->line_outs] = nid;
3080 spec->mic_switch = nid;
3081 add_spec_dacs(spec, dac);
3084 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
3085 spec->multiout.num_dacs,
3086 spec->multiout.dac_nids[0],
3087 spec->multiout.dac_nids[1],
3088 spec->multiout.dac_nids[2],
3089 spec->multiout.dac_nids[3],
3090 spec->multiout.dac_nids[4]);
3095 /* create volume control/switch for the given prefx type */
3096 static int create_controls_idx(struct hda_codec *codec, const char *pfx,
3097 int idx, hda_nid_t nid, int chs)
3099 struct sigmatel_spec *spec = codec->spec;
3103 if (!spec->check_volume_offset) {
3104 unsigned int caps, step, nums, db_scale;
3105 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3106 step = (caps & AC_AMPCAP_STEP_SIZE) >>
3107 AC_AMPCAP_STEP_SIZE_SHIFT;
3108 step = (step + 1) * 25; /* in .01dB unit */
3109 nums = (caps & AC_AMPCAP_NUM_STEPS) >>
3110 AC_AMPCAP_NUM_STEPS_SHIFT;
3111 db_scale = nums * step;
3112 /* if dB scale is over -64dB, and finer enough,
3113 * let's reduce it to half
3115 if (db_scale > 6400 && nums >= 0x1f)
3116 spec->volume_offset = nums / 2;
3117 spec->check_volume_offset = 1;
3120 sprintf(name, "%s Playback Volume", pfx);
3121 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name,
3122 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT,
3123 spec->volume_offset));
3126 sprintf(name, "%s Playback Switch", pfx);
3127 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name,
3128 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
3134 #define create_controls(codec, pfx, nid, chs) \
3135 create_controls_idx(codec, pfx, 0, nid, chs)
3137 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3139 if (spec->multiout.num_dacs > 4) {
3140 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
3143 snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
3144 spec->dac_nids[spec->multiout.num_dacs] = nid;
3145 spec->multiout.num_dacs++;
3150 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3153 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) {
3154 if (!spec->multiout.extra_out_nid[i]) {
3155 spec->multiout.extra_out_nid[i] = nid;
3159 printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid);
3163 /* Create output controls
3164 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
3166 static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3167 const hda_nid_t *pins,
3168 const hda_nid_t *dac_nids,
3171 struct sigmatel_spec *spec = codec->spec;
3172 static const char * const chname[4] = {
3173 "Front", "Surround", NULL /*CLFE*/, "Side"
3177 unsigned int wid_caps;
3179 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
3180 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
3181 if (is_jack_detectable(codec, pins[i]))
3182 spec->hp_detect = 1;
3187 if (type != AUTO_PIN_HP_OUT && i == 2) {
3189 err = create_controls(codec, "Center", nid, 1);
3192 err = create_controls(codec, "LFE", nid, 2);
3196 wid_caps = get_wcaps(codec, nid);
3198 if (wid_caps & AC_WCAP_LR_SWAP) {
3199 err = stac92xx_add_control(spec,
3200 STAC_CTL_WIDGET_CLFE_SWITCH,
3201 "Swap Center/LFE Playback Switch", nid);
3211 case AUTO_PIN_HP_OUT:
3215 case AUTO_PIN_SPEAKER_OUT:
3224 err = create_controls_idx(codec, name, idx, nid, 3);
3232 static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol,
3233 unsigned long sw, int idx)
3236 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx,
3237 "Capture Volume", vol);
3240 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx,
3241 "Capture Switch", sw);
3247 /* add playback controls from the parsed DAC table */
3248 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
3249 const struct auto_pin_cfg *cfg)
3251 struct sigmatel_spec *spec = codec->spec;
3256 err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins,
3257 spec->multiout.dac_nids,
3258 cfg->line_out_type);
3262 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
3263 err = stac92xx_add_control(spec,
3264 STAC_CTL_WIDGET_HP_SWITCH,
3265 "Headphone as Line Out Switch",
3266 cfg->hp_pins[cfg->hp_outs - 1]);
3271 for (idx = 0; idx < cfg->num_inputs; idx++) {
3272 if (cfg->inputs[idx].type > AUTO_PIN_LINE_IN)
3274 nid = cfg->inputs[idx].pin;
3275 err = stac92xx_add_jack_mode_control(codec, nid, idx);
3283 /* add playback controls for Speaker and HP outputs */
3284 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3285 struct auto_pin_cfg *cfg)
3287 struct sigmatel_spec *spec = codec->spec;
3290 err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins,
3291 spec->hp_dacs, AUTO_PIN_HP_OUT);
3295 err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins,
3296 spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT);
3303 /* labels for mono mux outputs */
3304 static const char * const stac92xx_mono_labels[4] = {
3305 "DAC0", "DAC1", "Mixer", "DAC2"
3308 /* create mono mux for mono out on capable codecs */
3309 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3311 struct sigmatel_spec *spec = codec->spec;
3312 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3314 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3316 num_cons = snd_hda_get_connections(codec,
3319 HDA_MAX_NUM_INPUTS);
3320 if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3323 for (i = 0; i < num_cons; i++)
3324 snd_hda_add_imux_item(mono_mux, stac92xx_mono_labels[i], i,
3327 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3328 "Mono Mux", spec->mono_nid);
3331 /* create PC beep volume controls */
3332 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3335 struct sigmatel_spec *spec = codec->spec;
3336 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3337 int err, type = STAC_CTL_WIDGET_MUTE_BEEP;
3339 if (spec->anabeep_nid == nid)
3340 type = STAC_CTL_WIDGET_MUTE;
3342 /* check for mute support for the the amp */
3343 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3344 err = stac92xx_add_control(spec, type,
3345 "Beep Playback Switch",
3346 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3351 /* check to see if there is volume support for the amp */
3352 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3353 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3354 "Beep Playback Volume",
3355 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3362 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3363 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3365 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3366 struct snd_ctl_elem_value *ucontrol)
3368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3369 ucontrol->value.integer.value[0] = codec->beep->enabled;
3373 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3374 struct snd_ctl_elem_value *ucontrol)
3376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3377 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
3380 static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3382 .info = stac92xx_dig_beep_switch_info,
3383 .get = stac92xx_dig_beep_switch_get,
3384 .put = stac92xx_dig_beep_switch_put,
3387 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3389 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3390 0, "Beep Playback Switch", 0);
3394 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3396 struct sigmatel_spec *spec = codec->spec;
3399 for (i = 0; i < spec->num_muxes; i++) {
3404 nid = spec->mux_nids[i];
3405 wcaps = get_wcaps(codec, nid);
3406 if (!(wcaps & AC_WCAP_OUT_AMP))
3409 /* check whether already the same control was created as
3410 * normal Capture Volume.
3412 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
3413 for (j = 0; j < spec->num_caps; j++) {
3414 if (spec->capvols[j] == val)
3417 if (j < spec->num_caps)
3420 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, i,
3421 "Mux Capture Volume", val);
3428 static const char * const stac92xx_spdif_labels[3] = {
3429 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3432 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3434 struct sigmatel_spec *spec = codec->spec;
3435 struct hda_input_mux *spdif_mux = &spec->private_smux;
3436 const char * const *labels = spec->spdif_labels;
3438 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3440 num_cons = snd_hda_get_connections(codec,
3443 HDA_MAX_NUM_INPUTS);
3448 labels = stac92xx_spdif_labels;
3450 for (i = 0; i < num_cons; i++)
3451 snd_hda_add_imux_item(spdif_mux, labels[i], i, NULL);
3456 /* labels for dmic mux inputs */
3457 static const char * const stac92xx_dmic_labels[5] = {
3458 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3459 "Digital Mic 3", "Digital Mic 4"
3462 static hda_nid_t get_connected_node(struct hda_codec *codec, hda_nid_t mux,
3465 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
3467 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
3468 if (idx >= 0 && idx < nums)
3473 /* look for NID recursively */
3474 #define get_connection_index(codec, mux, nid) \
3475 snd_hda_get_conn_index(codec, mux, nid, 1)
3477 /* create a volume assigned to the given pin (only if supported) */
3478 /* return 1 if the volume control is created */
3479 static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid,
3480 const char *label, int idx, int direction)
3482 unsigned int caps, nums;
3486 if (direction == HDA_OUTPUT)
3487 caps = AC_WCAP_OUT_AMP;
3489 caps = AC_WCAP_IN_AMP;
3490 if (!(get_wcaps(codec, nid) & caps))
3492 caps = query_amp_caps(codec, nid, direction);
3493 nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;
3496 snprintf(name, sizeof(name), "%s Capture Volume", label);
3497 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, name,
3498 HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction));
3504 /* create playback/capture controls for input pins on dmic capable codecs */
3505 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3506 const struct auto_pin_cfg *cfg)
3508 struct sigmatel_spec *spec = codec->spec;
3509 struct hda_input_mux *imux = &spec->private_imux;
3510 struct hda_input_mux *dimux = &spec->private_dimux;
3512 unsigned int def_conf;
3514 snd_hda_add_imux_item(dimux, stac92xx_dmic_labels[0], 0, NULL);
3516 for (i = 0; i < spec->num_dmics; i++) {
3518 int index, type_idx;
3521 nid = spec->dmic_nids[i];
3522 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
3524 def_conf = snd_hda_codec_get_pincfg(codec, nid);
3525 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3528 index = get_connection_index(codec, spec->dmux_nids[0], nid);
3532 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
3533 label, sizeof(label), NULL);
3534 snd_hda_add_imux_item(dimux, label, index, &type_idx);
3535 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1)
3536 snd_hda_add_imux_item(imux, label, index, &type_idx);
3538 err = create_elem_capture_vol(codec, nid, label, type_idx,
3543 err = create_elem_capture_vol(codec, nid, label,
3544 type_idx, HDA_OUTPUT);
3548 nid = get_connected_node(codec,
3549 spec->dmux_nids[0], index);
3551 err = create_elem_capture_vol(codec,
3553 type_idx, HDA_INPUT);
3563 static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
3564 hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
3571 cfg = snd_hda_codec_get_pincfg(codec, nid);
3572 type = get_defcfg_device(cfg);
3573 switch (snd_hda_get_input_pin_attr(cfg)) {
3574 case INPUT_PIN_ATTR_INT:
3576 return 1; /* already occupied */
3577 if (type != AC_JACK_MIC_IN)
3578 return 1; /* invalid type */
3581 case INPUT_PIN_ATTR_UNUSED:
3583 case INPUT_PIN_ATTR_DOCK:
3585 return 1; /* already occupied */
3586 if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN)
3587 return 1; /* invalid type */
3592 return 1; /* already occupied */
3593 if (type != AC_JACK_MIC_IN)
3594 return 1; /* invalid type */
3601 static int set_mic_route(struct hda_codec *codec,
3602 struct sigmatel_mic_route *mic,
3605 struct sigmatel_spec *spec = codec->spec;
3606 struct auto_pin_cfg *cfg = &spec->autocfg;
3612 for (i = 0; i < cfg->num_inputs; i++) {
3613 if (pin == cfg->inputs[i].pin)
3616 if (i < cfg->num_inputs && cfg->inputs[i].type == AUTO_PIN_MIC) {
3618 i = get_connection_index(codec, spec->mux_nids[0], pin);
3623 if (spec->dmux_nids)
3624 mic->dmux_idx = get_connection_index(codec,
3627 } else if (spec->dmux_nids) {
3629 i = get_connection_index(codec, spec->dmux_nids[0], pin);
3635 mic->mux_idx = get_connection_index(codec,
3637 spec->dmux_nids[0]);
3642 /* return non-zero if the device is for automatic mic switch */
3643 static int stac_check_auto_mic(struct hda_codec *codec)
3645 struct sigmatel_spec *spec = codec->spec;
3646 struct auto_pin_cfg *cfg = &spec->autocfg;
3647 hda_nid_t fixed, ext, dock;
3650 fixed = ext = dock = 0;
3651 for (i = 0; i < cfg->num_inputs; i++)
3652 if (check_mic_pin(codec, cfg->inputs[i].pin,
3653 &fixed, &ext, &dock))
3655 for (i = 0; i < spec->num_dmics; i++)
3656 if (check_mic_pin(codec, spec->dmic_nids[i],
3657 &fixed, &ext, &dock))
3659 if (!fixed || (!ext && !dock))
3660 return 0; /* no input to switch */
3661 if (!is_jack_detectable(codec, ext))
3662 return 0; /* no unsol support */
3663 if (set_mic_route(codec, &spec->ext_mic, ext) ||
3664 set_mic_route(codec, &spec->int_mic, fixed) ||
3665 set_mic_route(codec, &spec->dock_mic, dock))
3666 return 0; /* something is wrong */
3670 /* create playback/capture controls for input pins */
3671 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3673 struct sigmatel_spec *spec = codec->spec;
3674 struct hda_input_mux *imux = &spec->private_imux;
3678 for (i = 0; i < cfg->num_inputs; i++) {
3679 hda_nid_t nid = cfg->inputs[i].pin;
3680 int index, err, type_idx;
3683 for (j = 0; j < spec->num_muxes; j++) {
3684 index = get_connection_index(codec, spec->mux_nids[j],
3692 label = hda_get_autocfg_input_label(codec, cfg, i);
3693 snd_hda_add_imux_item(imux, label, index, &type_idx);
3695 err = create_elem_capture_vol(codec, nid,
3701 spec->num_analog_muxes = imux->num_items;
3703 if (imux->num_items) {
3705 * Set the current input for the muxes.
3706 * The STAC9221 has two input muxes with identical source
3707 * NID lists. Hopefully this won't get confused.
3709 for (i = 0; i < spec->num_muxes; i++) {
3710 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3711 AC_VERB_SET_CONNECT_SEL,
3712 imux->items[0].index);
3719 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3721 struct sigmatel_spec *spec = codec->spec;
3724 for (i = 0; i < spec->autocfg.line_outs; i++) {
3725 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3726 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3730 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3732 struct sigmatel_spec *spec = codec->spec;
3735 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3737 pin = spec->autocfg.hp_pins[i];
3738 if (pin) /* connect to front */
3739 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3741 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3743 pin = spec->autocfg.speaker_pins[i];
3744 if (pin) /* connect to front */
3745 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3749 static int is_dual_headphones(struct hda_codec *codec)
3751 struct sigmatel_spec *spec = codec->spec;
3754 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT ||
3755 spec->autocfg.hp_outs <= 1)
3758 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3759 hda_nid_t nid = spec->autocfg.hp_pins[i];
3760 unsigned int cfg = snd_hda_codec_get_pincfg(codec, nid);
3761 if (get_defcfg_location(cfg) & AC_JACK_LOC_SEPARATE)
3765 return (valid_hps > 1);
3769 static int stac92xx_parse_auto_config(struct hda_codec *codec)
3771 struct sigmatel_spec *spec = codec->spec;
3772 hda_nid_t dig_out = 0, dig_in = 0;
3776 if ((err = snd_hda_parse_pin_def_config(codec,
3778 spec->dmic_nids)) < 0)
3780 if (! spec->autocfg.line_outs)
3781 return 0; /* can't find valid pin config */
3783 /* If we have no real line-out pin and multiple hp-outs, HPs should
3784 * be set up as multi-channel outputs.
3786 if (is_dual_headphones(codec)) {
3787 /* Copy hp_outs to line_outs, backup line_outs in
3788 * speaker_outs so that the following routines can handle
3789 * HP pins as primary outputs.
3791 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
3792 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3793 sizeof(spec->autocfg.line_out_pins));
3794 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3795 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3796 sizeof(spec->autocfg.hp_pins));
3797 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3798 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3799 spec->autocfg.hp_outs = 0;
3802 if (spec->autocfg.mono_out_pin) {
3803 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3804 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3805 u32 caps = query_amp_caps(codec,
3806 spec->autocfg.mono_out_pin, dir);
3807 hda_nid_t conn_list[1];
3809 /* get the mixer node and then the mono mux if it exists */
3810 if (snd_hda_get_connections(codec,
3811 spec->autocfg.mono_out_pin, conn_list, 1) &&
3812 snd_hda_get_connections(codec, conn_list[0],
3813 conn_list, 1) > 0) {
3815 int wcaps = get_wcaps(codec, conn_list[0]);
3816 int wid_type = get_wcaps_type(wcaps);
3817 /* LR swap check, some stac925x have a mux that
3818 * changes the DACs output path instead of the
3821 if (wid_type == AC_WID_AUD_SEL &&
3822 !(wcaps & AC_WCAP_LR_SWAP))
3823 spec->mono_nid = conn_list[0];
3826 hda_nid_t nid = spec->autocfg.mono_out_pin;
3828 /* most mono outs have a least a mute/unmute switch */
3829 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3830 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3831 "Mono Playback Switch",
3832 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3835 /* check for volume support for the amp */
3836 if ((caps & AC_AMPCAP_NUM_STEPS)
3837 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3838 err = stac92xx_add_control(spec,
3839 STAC_CTL_WIDGET_VOL,
3840 "Mono Playback Volume",
3841 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3847 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3851 if (!spec->multiout.num_dacs) {
3852 err = stac92xx_auto_fill_dac_nids(codec);
3855 err = stac92xx_auto_create_multi_out_ctls(codec,
3861 /* setup analog beep controls */
3862 if (spec->anabeep_nid > 0) {
3863 err = stac92xx_auto_create_beep_ctls(codec,
3869 /* setup digital beep controls and input device */
3870 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3871 if (spec->digbeep_nid > 0) {
3872 hda_nid_t nid = spec->digbeep_nid;
3875 err = stac92xx_auto_create_beep_ctls(codec, nid);
3878 err = snd_hda_attach_beep_device(codec, nid);
3882 /* IDT/STAC codecs have linear beep tone parameter */
3883 codec->beep->linear_tone = spec->linear_tone_beep;
3884 /* if no beep switch is available, make its own one */
3885 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3886 if (!(caps & AC_AMPCAP_MUTE)) {
3887 err = stac92xx_beep_switch_ctl(codec);
3895 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3899 /* All output parsing done, now restore the swapped hp pins */
3901 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3902 sizeof(spec->autocfg.hp_pins));
3903 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3904 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3905 spec->autocfg.line_outs = 0;
3908 if (stac_check_auto_mic(codec)) {
3910 /* only one capture for auto-mic */
3913 spec->num_muxes = 1;
3916 for (i = 0; i < spec->num_caps; i++) {
3917 err = stac92xx_add_capvol_ctls(codec, spec->capvols[i],
3918 spec->capsws[i], i);
3923 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3927 if (spec->mono_nid > 0) {
3928 err = stac92xx_auto_create_mono_output_ctls(codec);
3932 if (spec->num_dmics > 0 && !spec->dinput_mux)
3933 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3934 &spec->autocfg)) < 0)
3936 if (spec->num_muxes > 0) {
3937 err = stac92xx_auto_create_mux_input_ctls(codec);
3941 if (spec->num_smuxes > 0) {
3942 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3947 err = stac92xx_add_input_source(spec);
3951 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3952 if (spec->multiout.max_channels > 2)
3953 spec->surr_switch = 1;
3955 /* find digital out and in converters */
3956 for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) {
3957 unsigned int wid_caps = get_wcaps(codec, i);
3958 if (wid_caps & AC_WCAP_DIGITAL) {
3959 switch (get_wcaps_type(wid_caps)) {
3960 case AC_WID_AUD_OUT:
3971 if (spec->autocfg.dig_outs)
3972 spec->multiout.dig_out_nid = dig_out;
3973 if (dig_in && spec->autocfg.dig_in_pin)
3974 spec->dig_in_nid = dig_in;
3976 if (spec->kctls.list)
3977 spec->mixers[spec->num_mixers++] = spec->kctls.list;
3979 spec->input_mux = &spec->private_imux;
3980 if (!spec->dinput_mux)
3981 spec->dinput_mux = &spec->private_dimux;
3982 spec->sinput_mux = &spec->private_smux;
3983 spec->mono_mux = &spec->private_mono_mux;
3987 /* add playback controls for HP output */
3988 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3989 struct auto_pin_cfg *cfg)
3991 struct sigmatel_spec *spec = codec->spec;
3992 hda_nid_t pin = cfg->hp_pins[0];
3997 if (is_jack_detectable(codec, pin))
3998 spec->hp_detect = 1;
4003 /* add playback controls for LFE output */
4004 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
4005 struct auto_pin_cfg *cfg)
4007 struct sigmatel_spec *spec = codec->spec;
4009 hda_nid_t lfe_pin = 0x0;
4013 * search speaker outs and line outs for a mono speaker pin
4014 * with an amp. If one is found, add LFE controls
4017 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
4018 hda_nid_t pin = spec->autocfg.speaker_pins[i];
4019 unsigned int wcaps = get_wcaps(codec, pin);
4020 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
4021 if (wcaps == AC_WCAP_OUT_AMP)
4022 /* found a mono speaker with an amp, must be lfe */
4026 /* if speaker_outs is 0, then speakers may be in line_outs */
4027 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
4028 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
4029 hda_nid_t pin = spec->autocfg.line_out_pins[i];
4030 unsigned int defcfg;
4031 defcfg = snd_hda_codec_get_pincfg(codec, pin);
4032 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
4033 unsigned int wcaps = get_wcaps(codec, pin);
4034 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
4035 if (wcaps == AC_WCAP_OUT_AMP)
4036 /* found a mono speaker with an amp,
4044 err = create_controls(codec, "LFE", lfe_pin, 1);
4052 static int stac9200_parse_auto_config(struct hda_codec *codec)
4054 struct sigmatel_spec *spec = codec->spec;
4057 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
4060 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
4063 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
4066 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
4069 if (spec->num_muxes > 0) {
4070 err = stac92xx_auto_create_mux_input_ctls(codec);
4075 err = stac92xx_add_input_source(spec);
4079 if (spec->autocfg.dig_outs)
4080 spec->multiout.dig_out_nid = 0x05;
4081 if (spec->autocfg.dig_in_pin)
4082 spec->dig_in_nid = 0x04;
4084 if (spec->kctls.list)
4085 spec->mixers[spec->num_mixers++] = spec->kctls.list;
4087 spec->input_mux = &spec->private_imux;
4088 spec->dinput_mux = &spec->private_dimux;
4094 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
4095 * funky external mute control using GPIO pins.
4098 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
4099 unsigned int dir_mask, unsigned int data)
4101 unsigned int gpiostate, gpiomask, gpiodir;
4103 snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
4105 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
4106 AC_VERB_GET_GPIO_DATA, 0);
4107 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
4109 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
4110 AC_VERB_GET_GPIO_MASK, 0);
4113 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
4114 AC_VERB_GET_GPIO_DIRECTION, 0);
4115 gpiodir |= dir_mask;
4117 /* Configure GPIOx as CMOS */
4118 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
4120 snd_hda_codec_write(codec, codec->afg, 0,
4121 AC_VERB_SET_GPIO_MASK, gpiomask);
4122 snd_hda_codec_read(codec, codec->afg, 0,
4123 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
4127 snd_hda_codec_read(codec, codec->afg, 0,
4128 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
4131 static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
4132 unsigned char type, int data)
4134 struct hda_jack_tbl *event;
4136 event = snd_hda_jack_tbl_new(codec, nid);
4139 event->action = type;
4140 event->private_data = data;
4145 /* check if given nid is a valid pin and no other events are assigned
4146 * to it. If OK, assign the event, set the unsol flag, and returns 1.
4147 * Otherwise, returns zero.
4149 static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4152 struct hda_jack_tbl *event;
4154 if (!is_jack_detectable(codec, nid))
4156 event = snd_hda_jack_tbl_new(codec, nid);
4159 if (event->action && event->action != type)
4161 event->action = type;
4162 snd_hda_jack_detect_enable(codec, nid, 0);
4166 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
4169 for (i = 0; i < cfg->hp_outs; i++)
4170 if (cfg->hp_pins[i] == nid)
4171 return 1; /* nid is a HP-Out */
4173 return 0; /* nid is not a HP-Out */
4176 static void stac92xx_power_down(struct hda_codec *codec)
4178 struct sigmatel_spec *spec = codec->spec;
4180 /* power down inactive DACs */
4181 const hda_nid_t *dac;
4182 for (dac = spec->dac_list; *dac; dac++)
4183 if (!check_all_dac_nids(spec, *dac))
4184 snd_hda_codec_write(codec, *dac, 0,
4185 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
4188 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4191 static inline int get_int_hint(struct hda_codec *codec, const char *key,
4195 p = snd_hda_get_hint(codec, key);
4198 if (!strict_strtoul(p, 0, &val)) {
4206 /* override some hints from the hwdep entry */
4207 static void stac_store_hints(struct hda_codec *codec)
4209 struct sigmatel_spec *spec = codec->spec;
4212 val = snd_hda_get_bool_hint(codec, "hp_detect");
4214 spec->hp_detect = val;
4215 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
4216 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
4219 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
4220 spec->gpio_mask &= spec->gpio_mask;
4221 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
4222 spec->gpio_dir &= spec->gpio_mask;
4223 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
4224 spec->eapd_mask &= spec->gpio_mask;
4225 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
4226 spec->gpio_mute &= spec->gpio_mask;
4227 val = snd_hda_get_bool_hint(codec, "eapd_switch");
4229 spec->eapd_switch = val;
4230 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
4231 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4232 spec->gpio_mask |= spec->gpio_led;
4233 spec->gpio_dir |= spec->gpio_led;
4234 if (spec->gpio_led_polarity)
4235 spec->gpio_data |= spec->gpio_led;
4239 static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins,
4240 const hda_nid_t *pins)
4243 stac_issue_unsol_event(codec, *pins++);
4246 /* fake event to set up pins */
4247 static void stac_fake_hp_events(struct hda_codec *codec)
4249 struct sigmatel_spec *spec = codec->spec;
4251 if (spec->autocfg.hp_outs)
4252 stac_issue_unsol_events(codec, spec->autocfg.hp_outs,
4253 spec->autocfg.hp_pins);
4254 if (spec->autocfg.line_outs &&
4255 spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0])
4256 stac_issue_unsol_events(codec, spec->autocfg.line_outs,
4257 spec->autocfg.line_out_pins);
4260 static int stac92xx_init(struct hda_codec *codec)
4262 struct sigmatel_spec *spec = codec->spec;
4263 struct auto_pin_cfg *cfg = &spec->autocfg;
4267 snd_hda_sequence_write(codec, spec->init);
4269 /* power down adcs initially */
4270 if (spec->powerdown_adcs)
4271 for (i = 0; i < spec->num_adcs; i++)
4272 snd_hda_codec_write(codec,
4273 spec->adc_nids[i], 0,
4274 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
4276 /* override some hints */
4277 stac_store_hints(codec);
4280 gpio = spec->gpio_data;
4281 /* turn on EAPD statically when spec->eapd_switch isn't set.
4282 * otherwise, unsol event will turn it on/off dynamically
4284 if (!spec->eapd_switch)
4285 gpio |= spec->eapd_mask;
4286 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
4289 if (spec->hp_detect) {
4290 /* Enable unsolicited responses on the HP widget */
4291 for (i = 0; i < cfg->hp_outs; i++) {
4292 hda_nid_t nid = cfg->hp_pins[i];
4293 enable_pin_detect(codec, nid, STAC_HP_EVENT);
4295 if (cfg->line_out_type == AUTO_PIN_LINE_OUT &&
4296 cfg->speaker_outs > 0) {
4297 /* enable pin-detect for line-outs as well */
4298 for (i = 0; i < cfg->line_outs; i++) {
4299 hda_nid_t nid = cfg->line_out_pins[i];
4300 enable_pin_detect(codec, nid, STAC_LO_EVENT);
4304 /* force to enable the first line-out; the others are set up
4307 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
4309 /* fake event to set up pins */
4310 stac_fake_hp_events(codec);
4312 stac92xx_auto_init_multi_out(codec);
4313 stac92xx_auto_init_hp_out(codec);
4314 for (i = 0; i < cfg->hp_outs; i++)
4315 stac_toggle_power_map(codec, cfg->hp_pins[i], 1);
4317 if (spec->auto_mic) {
4318 /* initialize connection to analog input */
4319 if (spec->dmux_nids)
4320 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4321 AC_VERB_SET_CONNECT_SEL, 0);
4322 if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT))
4323 stac_issue_unsol_event(codec, spec->ext_mic.pin);
4324 if (enable_pin_detect(codec, spec->dock_mic.pin,
4326 stac_issue_unsol_event(codec, spec->dock_mic.pin);
4328 for (i = 0; i < cfg->num_inputs; i++) {
4329 hda_nid_t nid = cfg->inputs[i].pin;
4330 int type = cfg->inputs[i].type;
4331 unsigned int pinctl, conf;
4332 if (type == AUTO_PIN_MIC) {
4333 /* for mic pins, force to initialize */
4334 pinctl = stac92xx_get_default_vref(codec, nid);
4335 pinctl |= AC_PINCTL_IN_EN;
4336 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4338 pinctl = snd_hda_codec_read(codec, nid, 0,
4339 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4340 /* if PINCTL already set then skip */
4341 /* Also, if both INPUT and OUTPUT are set,
4342 * it must be a BIOS bug; need to override, too
4344 if (!(pinctl & AC_PINCTL_IN_EN) ||
4345 (pinctl & AC_PINCTL_OUT_EN)) {
4346 pinctl &= ~AC_PINCTL_OUT_EN;
4347 pinctl |= AC_PINCTL_IN_EN;
4348 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4351 conf = snd_hda_codec_get_pincfg(codec, nid);
4352 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) {
4353 if (enable_pin_detect(codec, nid, STAC_INSERT_EVENT))
4354 stac_issue_unsol_event(codec, nid);
4357 for (i = 0; i < spec->num_dmics; i++)
4358 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
4360 if (cfg->dig_out_pins[0])
4361 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0],
4363 if (cfg->dig_in_pin)
4364 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
4366 for (i = 0; i < spec->num_pwrs; i++) {
4367 hda_nid_t nid = spec->pwr_nids[i];
4368 int pinctl, def_conf;
4370 /* power on when no jack detection is available */
4371 /* or when the VREF is used for controlling LED */
4372 if (!spec->hp_detect ||
4373 spec->vref_mute_led_nid == nid) {
4374 stac_toggle_power_map(codec, nid, 1);
4378 if (is_nid_hp_pin(cfg, nid))
4379 continue; /* already has an unsol event */
4381 pinctl = snd_hda_codec_read(codec, nid, 0,
4382 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4383 /* outputs are only ports capable of power management
4384 * any attempts on powering down a input port cause the
4385 * referenced VREF to act quirky.
4387 if (pinctl & AC_PINCTL_IN_EN) {
4388 stac_toggle_power_map(codec, nid, 1);
4391 def_conf = snd_hda_codec_get_pincfg(codec, nid);
4392 def_conf = get_defcfg_connect(def_conf);
4393 /* skip any ports that don't have jacks since presence
4394 * detection is useless */
4395 if (def_conf != AC_JACK_PORT_COMPLEX) {
4396 if (def_conf != AC_JACK_PORT_NONE)
4397 stac_toggle_power_map(codec, nid, 1);
4400 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
4401 stac_issue_unsol_event(codec, nid);
4404 /* none of the above, turn the port OFF */
4405 stac_toggle_power_map(codec, nid, 0);
4408 snd_hda_jack_report_sync(codec);
4412 hda_call_check_power_status(codec, 0x01);
4414 stac92xx_power_down(codec);
4418 static void stac92xx_free_kctls(struct hda_codec *codec)
4420 struct sigmatel_spec *spec = codec->spec;
4422 if (spec->kctls.list) {
4423 struct snd_kcontrol_new *kctl = spec->kctls.list;
4425 for (i = 0; i < spec->kctls.used; i++)
4426 kfree(kctl[i].name);
4428 snd_array_free(&spec->kctls);
4431 static void stac92xx_shutup_pins(struct hda_codec *codec)
4433 unsigned int i, def_conf;
4435 if (codec->bus->shutdown)
4437 for (i = 0; i < codec->init_pins.used; i++) {
4438 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
4439 def_conf = snd_hda_codec_get_pincfg(codec, pin->nid);
4440 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE)
4441 snd_hda_codec_write(codec, pin->nid, 0,
4442 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
4446 static void stac92xx_shutup(struct hda_codec *codec)
4448 struct sigmatel_spec *spec = codec->spec;
4450 stac92xx_shutup_pins(codec);
4452 if (spec->eapd_mask)
4453 stac_gpio_set(codec, spec->gpio_mask,
4454 spec->gpio_dir, spec->gpio_data &
4458 static void stac92xx_free(struct hda_codec *codec)
4460 struct sigmatel_spec *spec = codec->spec;
4465 stac92xx_shutup(codec);
4468 snd_hda_detach_beep_device(codec);
4471 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4474 unsigned int old_ctl, pin_ctl;
4476 pin_ctl = snd_hda_codec_read(codec, nid,
4477 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4479 if (pin_ctl & AC_PINCTL_IN_EN) {
4481 * we need to check the current set-up direction of
4482 * shared input pins since they can be switched via
4483 * "xxx as Output" mixer switch
4485 struct sigmatel_spec *spec = codec->spec;
4486 if (nid == spec->line_switch || nid == spec->mic_switch)
4491 /* if setting pin direction bits, clear the current
4492 direction bits first */
4493 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4494 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4497 if (old_ctl != pin_ctl)
4498 snd_hda_codec_write_cache(codec, nid, 0,
4499 AC_VERB_SET_PIN_WIDGET_CONTROL,
4503 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4506 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4507 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4509 snd_hda_codec_write_cache(codec, nid, 0,
4510 AC_VERB_SET_PIN_WIDGET_CONTROL,
4514 static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4518 return snd_hda_jack_detect(codec, nid);
4521 static void stac92xx_line_out_detect(struct hda_codec *codec,
4524 struct sigmatel_spec *spec = codec->spec;
4525 struct auto_pin_cfg *cfg = &spec->autocfg;
4528 for (i = 0; i < cfg->line_outs; i++) {
4531 presence = get_pin_presence(codec, cfg->line_out_pins[i]);
4533 unsigned int pinctl;
4534 pinctl = snd_hda_codec_read(codec,
4535 cfg->line_out_pins[i], 0,
4536 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4537 if (pinctl & AC_PINCTL_IN_EN)
4538 presence = 0; /* mic- or line-input */
4543 /* disable speakers */
4544 for (i = 0; i < cfg->speaker_outs; i++)
4545 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4547 if (spec->eapd_mask && spec->eapd_switch)
4548 stac_gpio_set(codec, spec->gpio_mask,
4549 spec->gpio_dir, spec->gpio_data &
4552 /* enable speakers */
4553 for (i = 0; i < cfg->speaker_outs; i++)
4554 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4556 if (spec->eapd_mask && spec->eapd_switch)
4557 stac_gpio_set(codec, spec->gpio_mask,
4558 spec->gpio_dir, spec->gpio_data |
4563 /* return non-zero if the hp-pin of the given array index isn't
4564 * a jack-detection target
4566 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4568 struct auto_pin_cfg *cfg = &spec->autocfg;
4570 /* ignore sensing of shared line and mic jacks */
4571 if (cfg->hp_pins[i] == spec->line_switch)
4573 if (cfg->hp_pins[i] == spec->mic_switch)
4575 /* ignore if the pin is set as line-out */
4576 if (cfg->hp_pins[i] == spec->hp_switch)
4581 static void stac92xx_hp_detect(struct hda_codec *codec)
4583 struct sigmatel_spec *spec = codec->spec;
4584 struct auto_pin_cfg *cfg = &spec->autocfg;
4588 if (spec->gpio_mute)
4589 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4590 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4592 for (i = 0; i < cfg->hp_outs; i++) {
4595 if (no_hp_sensing(spec, i))
4597 presence = get_pin_presence(codec, cfg->hp_pins[i]);
4599 unsigned int pinctl;
4600 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
4601 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4602 if (pinctl & AC_PINCTL_IN_EN)
4603 presence = 0; /* mic- or line-input */
4608 /* disable lineouts */
4609 if (spec->hp_switch)
4610 stac92xx_reset_pinctl(codec, spec->hp_switch,
4612 for (i = 0; i < cfg->line_outs; i++)
4613 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4616 /* enable lineouts */
4617 if (spec->hp_switch)
4618 stac92xx_set_pinctl(codec, spec->hp_switch,
4620 for (i = 0; i < cfg->line_outs; i++)
4621 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4624 stac92xx_line_out_detect(codec, presence);
4625 /* toggle hp outs */
4626 for (i = 0; i < cfg->hp_outs; i++) {
4627 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4628 if (no_hp_sensing(spec, i))
4631 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4633 /* Resetting the pinctl like below may lead to (a sort of) regressions
4634 * on some devices since they use the HP pin actually for line/speaker
4635 * outs although the default pin config shows a different pin (that is
4636 * wrong and useless).
4638 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4639 * But, disabling the code below just works around it, and I'm too tired of
4640 * bug reports with such devices...
4643 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4648 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4651 struct sigmatel_spec *spec = codec->spec;
4652 unsigned int idx, val;
4654 for (idx = 0; idx < spec->num_pwrs; idx++) {
4655 if (spec->pwr_nids[idx] == nid)
4658 if (idx >= spec->num_pwrs)
4663 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4669 /* power down unused output ports */
4670 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4673 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4675 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid));
4678 /* get the pin connection (fixed, none, etc) */
4679 static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
4681 struct sigmatel_spec *spec = codec->spec;
4684 cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
4685 return get_defcfg_connect(cfg);
4688 static int stac92xx_connected_ports(struct hda_codec *codec,
4689 const hda_nid_t *nids, int num_nids)
4691 struct sigmatel_spec *spec = codec->spec;
4693 unsigned int def_conf;
4695 for (num = 0; num < num_nids; num++) {
4696 for (idx = 0; idx < spec->num_pins; idx++)
4697 if (spec->pin_nids[idx] == nids[num])
4699 if (idx >= spec->num_pins)
4701 def_conf = stac_get_defcfg_connect(codec, idx);
4702 if (def_conf == AC_JACK_PORT_NONE)
4708 static void stac92xx_mic_detect(struct hda_codec *codec)
4710 struct sigmatel_spec *spec = codec->spec;
4711 struct sigmatel_mic_route *mic;
4713 if (get_pin_presence(codec, spec->ext_mic.pin))
4714 mic = &spec->ext_mic;
4715 else if (get_pin_presence(codec, spec->dock_mic.pin))
4716 mic = &spec->dock_mic;
4718 mic = &spec->int_mic;
4719 if (mic->dmux_idx >= 0)
4720 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4721 AC_VERB_SET_CONNECT_SEL,
4723 if (mic->mux_idx >= 0)
4724 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
4725 AC_VERB_SET_CONNECT_SEL,
4729 static void handle_unsol_event(struct hda_codec *codec,
4730 struct hda_jack_tbl *event)
4732 struct sigmatel_spec *spec = codec->spec;
4735 switch (event->action) {
4738 stac92xx_hp_detect(codec);
4740 case STAC_MIC_EVENT:
4741 stac92xx_mic_detect(codec);
4745 switch (event->action) {
4748 case STAC_MIC_EVENT:
4749 case STAC_INSERT_EVENT:
4750 case STAC_PWR_EVENT:
4751 if (spec->num_pwrs > 0)
4752 stac92xx_pin_sense(codec, event->nid);
4754 switch (codec->subsystem_id) {
4756 if (event->nid == 0xb) {
4757 int pin = AC_PINCTL_IN_EN;
4759 if (get_pin_presence(codec, 0xa)
4760 && get_pin_presence(codec, 0xb))
4761 pin |= AC_PINCTL_VREF_80;
4762 if (!get_pin_presence(codec, 0xb))
4763 pin |= AC_PINCTL_VREF_80;
4765 /* toggle VREF state based on mic + hp pin
4768 stac92xx_auto_set_pinctl(codec, 0x0a, pin);
4772 case STAC_VREF_EVENT:
4773 data = snd_hda_codec_read(codec, codec->afg, 0,
4774 AC_VERB_GET_GPIO_DATA, 0);
4775 /* toggle VREF state based on GPIOx status */
4776 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4777 !!(data & (1 << event->private_data)));
4782 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid)
4784 struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid);
4787 handle_unsol_event(codec, event);
4790 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4792 struct hda_jack_tbl *event;
4795 tag = (res >> 26) & 0x7f;
4796 event = snd_hda_jack_tbl_get_from_tag(codec, tag);
4799 event->jack_dirty = 1;
4800 handle_unsol_event(codec, event);
4801 snd_hda_jack_report_sync(codec);
4804 static int hp_blike_system(u32 subsystem_id);
4806 static void set_hp_led_gpio(struct hda_codec *codec)
4808 struct sigmatel_spec *spec = codec->spec;
4814 gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
4815 gpio &= AC_GPIO_IO_COUNT;
4817 spec->gpio_led = 0x08; /* GPIO 3 */
4819 spec->gpio_led = 0x01; /* GPIO 0 */
4823 * This method searches for the mute LED GPIO configuration
4824 * provided as OEM string in SMBIOS. The format of that string
4825 * is HP_Mute_LED_P_G or HP_Mute_LED_P
4826 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
4827 * that corresponds to the NOT muted state of the master volume
4828 * and G is the index of the GPIO to use as the mute LED control (0..9)
4829 * If _G portion is missing it is assigned based on the codec ID
4831 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4832 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4835 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4836 * SMBIOS - at least the ones I have seen do not have them - which include
4837 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4838 * HP Pavilion dv9500t CTO.
4839 * Need more information on whether it is true across the entire series.
4842 static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
4844 struct sigmatel_spec *spec = codec->spec;
4845 const struct dmi_device *dev = NULL;
4847 if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) {
4848 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4850 if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
4851 &spec->gpio_led_polarity,
4852 &spec->gpio_led) == 2) {
4853 unsigned int max_gpio;
4854 max_gpio = snd_hda_param_read(codec, codec->afg,
4856 max_gpio &= AC_GPIO_IO_COUNT;
4857 if (spec->gpio_led < max_gpio)
4858 spec->gpio_led = 1 << spec->gpio_led;
4860 spec->vref_mute_led_nid = spec->gpio_led;
4863 if (sscanf(dev->name, "HP_Mute_LED_%d",
4864 &spec->gpio_led_polarity) == 1) {
4865 set_hp_led_gpio(codec);
4868 /* BIOS bug: unfilled OEM string */
4869 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
4870 set_hp_led_gpio(codec);
4871 spec->gpio_led_polarity = 1;
4877 * Fallback case - if we don't find the DMI strings,
4878 * we statically set the GPIO - if not a B-series system
4879 * and default polarity is provided
4881 if (!hp_blike_system(codec->subsystem_id) &&
4882 (default_polarity == 0 || default_polarity == 1)) {
4883 set_hp_led_gpio(codec);
4884 spec->gpio_led_polarity = default_polarity;
4891 static int hp_blike_system(u32 subsystem_id)
4893 switch (subsystem_id) {
4920 #ifdef CONFIG_PROC_FS
4921 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4922 struct hda_codec *codec, hda_nid_t nid)
4924 if (nid == codec->afg)
4925 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4926 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4929 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4930 struct hda_codec *codec,
4933 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4934 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4937 /* stac92hd71bxx, stac92hd73xx */
4938 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4939 struct hda_codec *codec, hda_nid_t nid)
4941 stac92hd_proc_hook(buffer, codec, nid);
4942 if (nid == codec->afg)
4943 analog_loop_proc_hook(buffer, codec, 0xfa0);
4946 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4947 struct hda_codec *codec, hda_nid_t nid)
4949 if (nid == codec->afg)
4950 analog_loop_proc_hook(buffer, codec, 0xfe0);
4953 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4954 struct hda_codec *codec, hda_nid_t nid)
4956 if (nid == codec->afg)
4957 analog_loop_proc_hook(buffer, codec, 0xfeb);
4960 #define stac92hd_proc_hook NULL
4961 #define stac92hd7x_proc_hook NULL
4962 #define stac9205_proc_hook NULL
4963 #define stac927x_proc_hook NULL
4967 static int stac92xx_resume(struct hda_codec *codec)
4969 stac92xx_init(codec);
4970 snd_hda_codec_resume_amp(codec);
4971 snd_hda_codec_resume_cache(codec);
4972 /* fake event to set up pins again to override cached values */
4973 stac_fake_hp_events(codec);
4977 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4979 stac92xx_shutup(codec);
4983 #ifdef CONFIG_SND_HDA_POWER_SAVE
4984 static int stac92xx_pre_resume(struct hda_codec *codec)
4986 struct sigmatel_spec *spec = codec->spec;
4989 if (spec->vref_mute_led_nid)
4990 stac_vrefout_set(codec, spec->vref_mute_led_nid,
4992 else if (spec->gpio_led)
4993 stac_gpio_set(codec, spec->gpio_mask,
4994 spec->gpio_dir, spec->gpio_data);
4998 static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
4999 unsigned int power_state)
5001 unsigned int afg_power_state = power_state;
5002 struct sigmatel_spec *spec = codec->spec;
5004 if (power_state == AC_PWRST_D3) {
5005 if (spec->vref_mute_led_nid) {
5006 /* with vref-out pin used for mute led control
5007 * codec AFG is prevented from D3 state
5009 afg_power_state = AC_PWRST_D1;
5011 /* this delay seems necessary to avoid click noise at power-down */
5014 snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
5016 snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
5020 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed
5021 * as mute LED state is updated in check_power_status hook
5023 static int stac92xx_update_led_status(struct hda_codec *codec)
5025 struct sigmatel_spec *spec = codec->spec;
5026 int i, num_ext_dacs, muted = 1;
5027 unsigned int muted_lvl, notmtd_lvl;
5030 if (!spec->gpio_led)
5033 for (i = 0; i < spec->multiout.num_dacs; i++) {
5034 nid = spec->multiout.dac_nids[i];
5035 if (!(snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
5037 muted = 0; /* something heard */
5041 if (muted && spec->multiout.hp_nid)
5042 if (!(snd_hda_codec_amp_read(codec,
5043 spec->multiout.hp_nid, 0, HDA_OUTPUT, 0) &
5045 muted = 0; /* HP is not muted */
5047 num_ext_dacs = ARRAY_SIZE(spec->multiout.extra_out_nid);
5048 for (i = 0; muted && i < num_ext_dacs; i++) {
5049 nid = spec->multiout.extra_out_nid[i];
5052 if (!(snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
5054 muted = 0; /* extra output is not muted */
5057 /*polarity defines *not* muted state level*/
5058 if (!spec->vref_mute_led_nid) {
5060 spec->gpio_data &= ~spec->gpio_led; /* orange */
5062 spec->gpio_data |= spec->gpio_led; /* white */
5064 if (!spec->gpio_led_polarity) {
5065 /* LED state is inverted on these systems */
5066 spec->gpio_data ^= spec->gpio_led;
5068 stac_gpio_set(codec, spec->gpio_mask,
5069 spec->gpio_dir, spec->gpio_data);
5071 notmtd_lvl = spec->gpio_led_polarity ?
5072 AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_GRD;
5073 muted_lvl = spec->gpio_led_polarity ?
5074 AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ;
5075 spec->vref_led = muted ? muted_lvl : notmtd_lvl;
5076 stac_vrefout_set(codec, spec->vref_mute_led_nid,
5083 * use power check for controlling mute led of HP notebooks
5085 static int stac92xx_check_power_status(struct hda_codec *codec,
5088 stac92xx_update_led_status(codec);
5092 #endif /* CONFIG_SND_HDA_POWER_SAVE */
5093 #endif /* CONFIG_PM */
5095 static const struct hda_codec_ops stac92xx_patch_ops = {
5096 .build_controls = stac92xx_build_controls,
5097 .build_pcms = stac92xx_build_pcms,
5098 .init = stac92xx_init,
5099 .free = stac92xx_free,
5100 .unsol_event = stac92xx_unsol_event,
5102 .suspend = stac92xx_suspend,
5103 .resume = stac92xx_resume,
5105 .reboot_notify = stac92xx_shutup,
5108 static int patch_stac9200(struct hda_codec *codec)
5110 struct sigmatel_spec *spec;
5113 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5117 codec->no_trigger_sense = 1;
5119 spec->linear_tone_beep = 1;
5120 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5121 spec->pin_nids = stac9200_pin_nids;
5122 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
5125 if (spec->board_config < 0)
5126 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5129 stac92xx_set_config_regs(codec,
5130 stac9200_brd_tbl[spec->board_config]);
5132 spec->multiout.max_channels = 2;
5133 spec->multiout.num_dacs = 1;
5134 spec->multiout.dac_nids = stac9200_dac_nids;
5135 spec->adc_nids = stac9200_adc_nids;
5136 spec->mux_nids = stac9200_mux_nids;
5137 spec->num_muxes = 1;
5138 spec->num_dmics = 0;
5142 if (spec->board_config == STAC_9200_M4 ||
5143 spec->board_config == STAC_9200_M4_2 ||
5144 spec->board_config == STAC_9200_OQO)
5145 spec->init = stac9200_eapd_init;
5147 spec->init = stac9200_core_init;
5148 spec->mixer = stac9200_mixer;
5150 if (spec->board_config == STAC_9200_PANASONIC) {
5151 spec->gpio_mask = spec->gpio_dir = 0x09;
5152 spec->gpio_data = 0x00;
5155 err = stac9200_parse_auto_config(codec);
5157 stac92xx_free(codec);
5161 /* CF-74 has no headphone detection, and the driver should *NOT*
5162 * do detection and HP/speaker toggle because the hardware does it.
5164 if (spec->board_config == STAC_9200_PANASONIC)
5165 spec->hp_detect = 0;
5167 codec->patch_ops = stac92xx_patch_ops;
5172 static int patch_stac925x(struct hda_codec *codec)
5174 struct sigmatel_spec *spec;
5177 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5181 codec->no_trigger_sense = 1;
5183 spec->linear_tone_beep = 1;
5184 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5185 spec->pin_nids = stac925x_pin_nids;
5187 /* Check first for codec ID */
5188 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
5191 stac925x_codec_id_cfg_tbl);
5193 /* Now checks for PCI ID, if codec ID is not found */
5194 if (spec->board_config < 0)
5195 spec->board_config = snd_hda_check_board_config(codec,
5200 if (spec->board_config < 0)
5201 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5204 stac92xx_set_config_regs(codec,
5205 stac925x_brd_tbl[spec->board_config]);
5207 spec->multiout.max_channels = 2;
5208 spec->multiout.num_dacs = 1;
5209 spec->multiout.dac_nids = stac925x_dac_nids;
5210 spec->adc_nids = stac925x_adc_nids;
5211 spec->mux_nids = stac925x_mux_nids;
5212 spec->num_muxes = 1;
5215 switch (codec->vendor_id) {
5216 case 0x83847632: /* STAC9202 */
5217 case 0x83847633: /* STAC9202D */
5218 case 0x83847636: /* STAC9251 */
5219 case 0x83847637: /* STAC9251D */
5220 spec->num_dmics = STAC925X_NUM_DMICS;
5221 spec->dmic_nids = stac925x_dmic_nids;
5222 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
5223 spec->dmux_nids = stac925x_dmux_nids;
5226 spec->num_dmics = 0;
5230 spec->init = stac925x_core_init;
5231 spec->mixer = stac925x_mixer;
5233 spec->capvols = stac925x_capvols;
5234 spec->capsws = stac925x_capsws;
5236 err = stac92xx_parse_auto_config(codec);
5238 if (spec->board_config < 0) {
5239 printk(KERN_WARNING "hda_codec: No auto-config is "
5240 "available, default to model=ref\n");
5241 spec->board_config = STAC_925x_REF;
5247 stac92xx_free(codec);
5251 codec->patch_ops = stac92xx_patch_ops;
5256 static int patch_stac92hd73xx(struct hda_codec *codec)
5258 struct sigmatel_spec *spec;
5259 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5263 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5267 codec->no_trigger_sense = 1;
5269 spec->linear_tone_beep = 0;
5270 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5271 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5272 spec->pin_nids = stac92hd73xx_pin_nids;
5273 spec->board_config = snd_hda_check_board_config(codec,
5274 STAC_92HD73XX_MODELS,
5275 stac92hd73xx_models,
5276 stac92hd73xx_cfg_tbl);
5277 /* check codec subsystem id if not found */
5278 if (spec->board_config < 0)
5279 spec->board_config =
5280 snd_hda_check_board_codec_sid_config(codec,
5281 STAC_92HD73XX_MODELS, stac92hd73xx_models,
5282 stac92hd73xx_codec_id_cfg_tbl);
5284 if (spec->board_config < 0)
5285 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5288 stac92xx_set_config_regs(codec,
5289 stac92hd73xx_brd_tbl[spec->board_config]);
5291 num_dacs = snd_hda_get_connections(codec, 0x0a,
5292 conn, STAC92HD73_DAC_COUNT + 2) - 1;
5294 if (num_dacs < 3 || num_dacs > 5) {
5295 printk(KERN_WARNING "hda_codec: Could not determine "
5296 "number of channels defaulting to DAC count\n");
5297 num_dacs = STAC92HD73_DAC_COUNT;
5299 spec->init = stac92hd73xx_core_init;
5301 case 0x3: /* 6 Channel */
5302 spec->aloopback_ctl = stac92hd73xx_6ch_loopback;
5304 case 0x4: /* 8 Channel */
5305 spec->aloopback_ctl = stac92hd73xx_8ch_loopback;
5307 case 0x5: /* 10 Channel */
5308 spec->aloopback_ctl = stac92hd73xx_10ch_loopback;
5311 spec->multiout.dac_nids = spec->dac_nids;
5313 spec->aloopback_mask = 0x01;
5314 spec->aloopback_shift = 8;
5316 spec->digbeep_nid = 0x1c;
5317 spec->mux_nids = stac92hd73xx_mux_nids;
5318 spec->adc_nids = stac92hd73xx_adc_nids;
5319 spec->dmic_nids = stac92hd73xx_dmic_nids;
5320 spec->dmux_nids = stac92hd73xx_dmux_nids;
5321 spec->smux_nids = stac92hd73xx_smux_nids;
5323 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
5324 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
5325 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
5327 spec->num_caps = STAC92HD73XX_NUM_CAPS;
5328 spec->capvols = stac92hd73xx_capvols;
5329 spec->capsws = stac92hd73xx_capsws;
5331 switch (spec->board_config) {
5333 spec->init = dell_eq_core_init;
5335 case STAC_DELL_M6_AMIC:
5336 case STAC_DELL_M6_DMIC:
5337 case STAC_DELL_M6_BOTH:
5338 spec->num_smuxes = 0;
5339 spec->eapd_switch = 0;
5341 switch (spec->board_config) {
5342 case STAC_DELL_M6_AMIC: /* Analog Mics */
5343 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
5344 spec->num_dmics = 0;
5346 case STAC_DELL_M6_DMIC: /* Digital Mics */
5347 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
5348 spec->num_dmics = 1;
5350 case STAC_DELL_M6_BOTH: /* Both */
5351 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
5352 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
5353 spec->num_dmics = 1;
5357 case STAC_ALIENWARE_M17X:
5358 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
5359 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
5360 spec->eapd_switch = 0;
5363 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
5364 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
5365 spec->eapd_switch = 1;
5368 if (spec->board_config != STAC_92HD73XX_REF) {
5369 /* GPIO0 High = Enable EAPD */
5370 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5371 spec->gpio_data = 0x01;
5374 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
5375 spec->pwr_nids = stac92hd73xx_pwr_nids;
5377 err = stac92xx_parse_auto_config(codec);
5380 if (spec->board_config < 0) {
5381 printk(KERN_WARNING "hda_codec: No auto-config is "
5382 "available, default to model=ref\n");
5383 spec->board_config = STAC_92HD73XX_REF;
5390 stac92xx_free(codec);
5394 if (spec->board_config == STAC_92HD73XX_NO_JD)
5395 spec->hp_detect = 0;
5397 codec->patch_ops = stac92xx_patch_ops;
5399 codec->proc_widget_hook = stac92hd7x_proc_hook;
5404 static int hp_bnb2011_with_dock(struct hda_codec *codec)
5406 if (codec->vendor_id != 0x111d7605 &&
5407 codec->vendor_id != 0x111d76d1)
5410 switch (codec->subsystem_id) {
5444 static void stac92hd8x_add_pin(struct hda_codec *codec, hda_nid_t nid)
5446 struct sigmatel_spec *spec = codec->spec;
5447 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
5450 spec->auto_pin_nids[spec->auto_pin_cnt] = nid;
5451 spec->auto_pin_cnt++;
5453 if (get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
5454 get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) {
5455 for (i = 0; i < ARRAY_SIZE(stac92hd83xxx_dmic_nids); i++) {
5456 if (nid == stac92hd83xxx_dmic_nids[i]) {
5457 spec->auto_dmic_nids[spec->auto_dmic_cnt] = nid;
5458 spec->auto_dmic_cnt++;
5464 static void stac92hd8x_add_adc(struct hda_codec *codec, hda_nid_t nid)
5466 struct sigmatel_spec *spec = codec->spec;
5468 spec->auto_adc_nids[spec->auto_adc_cnt] = nid;
5469 spec->auto_adc_cnt++;
5472 static void stac92hd8x_add_mux(struct hda_codec *codec, hda_nid_t nid)
5475 struct sigmatel_spec *spec = codec->spec;
5477 for (i = 0; i < spec->auto_adc_cnt; i++) {
5478 if (get_connection_index(codec,
5479 spec->auto_adc_nids[i], nid) >= 0) {
5480 /* mux and volume for adc_nids[i] */
5481 if (!spec->auto_mux_nids[i]) {
5482 spec->auto_mux_nids[i] = nid;
5483 /* 92hd codecs capture volume is in mux */
5484 spec->auto_capvols[i] = HDA_COMPOSE_AMP_VAL(nid,
5487 for (j = 0; j < spec->auto_dmic_cnt; j++) {
5488 if (get_connection_index(codec, nid,
5489 spec->auto_dmic_nids[j]) >= 0) {
5490 /* dmux for adc_nids[i] */
5491 if (!spec->auto_dmux_nids[i])
5492 spec->auto_dmux_nids[i] = nid;
5501 static void stac92hd8x_fill_auto_spec(struct hda_codec *codec)
5503 hda_nid_t nid, end_nid;
5504 unsigned int wid_caps, wid_type;
5505 struct sigmatel_spec *spec = codec->spec;
5507 end_nid = codec->start_nid + codec->num_nodes;
5509 for (nid = codec->start_nid; nid < end_nid; nid++) {
5510 wid_caps = get_wcaps(codec, nid);
5511 wid_type = get_wcaps_type(wid_caps);
5513 if (wid_type == AC_WID_PIN)
5514 stac92hd8x_add_pin(codec, nid);
5516 if (wid_type == AC_WID_AUD_IN && !(wid_caps & AC_WCAP_DIGITAL))
5517 stac92hd8x_add_adc(codec, nid);
5520 for (nid = codec->start_nid; nid < end_nid; nid++) {
5521 wid_caps = get_wcaps(codec, nid);
5522 wid_type = get_wcaps_type(wid_caps);
5524 if (wid_type == AC_WID_AUD_SEL)
5525 stac92hd8x_add_mux(codec, nid);
5528 spec->pin_nids = spec->auto_pin_nids;
5529 spec->num_pins = spec->auto_pin_cnt;
5530 spec->adc_nids = spec->auto_adc_nids;
5531 spec->num_adcs = spec->auto_adc_cnt;
5532 spec->capvols = spec->auto_capvols;
5533 spec->capsws = spec->auto_capvols;
5534 spec->num_caps = spec->auto_adc_cnt;
5535 spec->mux_nids = spec->auto_mux_nids;
5536 spec->num_muxes = spec->auto_adc_cnt;
5537 spec->dmux_nids = spec->auto_dmux_nids;
5538 spec->num_dmuxes = spec->auto_adc_cnt;
5539 spec->dmic_nids = spec->auto_dmic_nids;
5540 spec->num_dmics = spec->auto_dmic_cnt;
5543 static int patch_stac92hd83xxx(struct hda_codec *codec)
5545 struct sigmatel_spec *spec;
5548 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5552 if (hp_bnb2011_with_dock(codec)) {
5553 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
5554 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
5557 codec->no_trigger_sense = 1;
5560 stac92hd8x_fill_auto_spec(codec);
5562 spec->linear_tone_beep = 0;
5563 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5564 spec->digbeep_nid = 0x21;
5565 spec->pwr_nids = stac92hd83xxx_pwr_nids;
5566 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
5567 spec->multiout.dac_nids = spec->dac_nids;
5568 spec->init = stac92hd83xxx_core_init;
5570 spec->board_config = snd_hda_check_board_config(codec,
5571 STAC_92HD83XXX_MODELS,
5572 stac92hd83xxx_models,
5573 stac92hd83xxx_cfg_tbl);
5575 if (spec->board_config < 0)
5576 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5579 stac92xx_set_config_regs(codec,
5580 stac92hd83xxx_brd_tbl[spec->board_config]);
5582 codec->patch_ops = stac92xx_patch_ops;
5584 if (find_mute_led_cfg(codec, -1/*no default cfg*/))
5585 snd_printd("mute LED gpio %d polarity %d\n",
5587 spec->gpio_led_polarity);
5589 #ifdef CONFIG_SND_HDA_POWER_SAVE
5590 if (spec->gpio_led) {
5591 if (!spec->vref_mute_led_nid) {
5592 spec->gpio_mask |= spec->gpio_led;
5593 spec->gpio_dir |= spec->gpio_led;
5594 spec->gpio_data |= spec->gpio_led;
5596 codec->patch_ops.set_power_state =
5597 stac92xx_set_power_state;
5599 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5600 codec->patch_ops.check_power_status =
5601 stac92xx_check_power_status;
5605 err = stac92xx_parse_auto_config(codec);
5607 if (spec->board_config < 0) {
5608 printk(KERN_WARNING "hda_codec: No auto-config is "
5609 "available, default to model=ref\n");
5610 spec->board_config = STAC_92HD83XXX_REF;
5617 stac92xx_free(codec);
5621 codec->proc_widget_hook = stac92hd_proc_hook;
5626 static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
5629 struct sigmatel_spec *spec = codec->spec;
5632 for (idx = 0; idx < spec->num_pins; idx++)
5633 if (spec->pin_nids[idx] == dig0pin)
5635 if ((idx + 2) >= spec->num_pins)
5639 if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE)
5642 /* dig0pin + dig2pin case */
5643 if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE)
5645 if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE)
5651 /* HP dv7 bass switch - GPIO5 */
5652 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5653 static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
5654 struct snd_ctl_elem_value *ucontrol)
5656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5657 struct sigmatel_spec *spec = codec->spec;
5658 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
5662 static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
5663 struct snd_ctl_elem_value *ucontrol)
5665 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5666 struct sigmatel_spec *spec = codec->spec;
5667 unsigned int gpio_data;
5669 gpio_data = (spec->gpio_data & ~0x20) |
5670 (ucontrol->value.integer.value[0] ? 0x20 : 0);
5671 if (gpio_data == spec->gpio_data)
5673 spec->gpio_data = gpio_data;
5674 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5678 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5680 .info = stac_hp_bass_gpio_info,
5681 .get = stac_hp_bass_gpio_get,
5682 .put = stac_hp_bass_gpio_put,
5685 static int stac_add_hp_bass_switch(struct hda_codec *codec)
5687 struct sigmatel_spec *spec = codec->spec;
5689 if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl,
5690 "Bass Speaker Playback Switch", 0))
5693 spec->gpio_mask |= 0x20;
5694 spec->gpio_dir |= 0x20;
5695 spec->gpio_data |= 0x20;
5699 static int patch_stac92hd71bxx(struct hda_codec *codec)
5701 struct sigmatel_spec *spec;
5702 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5703 unsigned int pin_cfg;
5706 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5710 codec->no_trigger_sense = 1;
5712 spec->linear_tone_beep = 0;
5713 codec->patch_ops = stac92xx_patch_ops;
5714 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5715 switch (codec->vendor_id) {
5718 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5722 /* On 92HD75Bx 0x27 isn't a pin nid */
5726 spec->pin_nids = stac92hd71bxx_pin_nids_6port;
5728 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
5729 spec->board_config = snd_hda_check_board_config(codec,
5730 STAC_92HD71BXX_MODELS,
5731 stac92hd71bxx_models,
5732 stac92hd71bxx_cfg_tbl);
5734 if (spec->board_config < 0)
5735 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5738 stac92xx_set_config_regs(codec,
5739 stac92hd71bxx_brd_tbl[spec->board_config]);
5741 if (spec->board_config != STAC_92HD71BXX_REF) {
5743 spec->gpio_mask = 0x01;
5744 spec->gpio_dir = 0x01;
5745 spec->gpio_data = 0x01;
5748 spec->dmic_nids = stac92hd71bxx_dmic_nids;
5749 spec->dmux_nids = stac92hd71bxx_dmux_nids;
5751 spec->num_caps = STAC92HD71BXX_NUM_CAPS;
5752 spec->capvols = stac92hd71bxx_capvols;
5753 spec->capsws = stac92hd71bxx_capsws;
5755 switch (codec->vendor_id) {
5756 case 0x111d76b6: /* 4 Port without Analog Mixer */
5760 case 0x111d76b4: /* 6 Port without Analog Mixer */
5762 spec->init = stac92hd71bxx_core_init;
5763 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5764 spec->num_dmics = stac92xx_connected_ports(codec,
5765 stac92hd71bxx_dmic_nids,
5766 STAC92HD71BXX_NUM_DMICS);
5768 case 0x111d7608: /* 5 Port with Analog Mixer */
5769 switch (spec->board_config) {
5771 /* Enable VREF power saving on GPIO1 detect */
5772 err = stac_add_event(codec, codec->afg,
5773 STAC_VREF_EVENT, 0x02);
5776 snd_hda_codec_write_cache(codec, codec->afg, 0,
5777 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
5778 snd_hda_jack_detect_enable(codec, codec->afg, 0);
5779 spec->gpio_mask |= 0x02;
5782 if ((codec->revision_id & 0xf) == 0 ||
5783 (codec->revision_id & 0xf) == 1)
5784 spec->stream_delay = 40; /* 40 milliseconds */
5787 spec->init = stac92hd71bxx_core_init;
5789 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
5790 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
5791 spec->dmic_nids = stac92hd71bxx_dmic_5port_nids;
5792 spec->num_dmics = stac92xx_connected_ports(codec,
5793 stac92hd71bxx_dmic_5port_nids,
5794 STAC92HD71BXX_NUM_DMICS - 1);
5796 case 0x111d7603: /* 6 Port with Analog Mixer */
5797 if ((codec->revision_id & 0xf) == 1)
5798 spec->stream_delay = 40; /* 40 milliseconds */
5802 spec->init = stac92hd71bxx_core_init;
5803 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5804 spec->num_dmics = stac92xx_connected_ports(codec,
5805 stac92hd71bxx_dmic_nids,
5806 STAC92HD71BXX_NUM_DMICS);
5810 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
5811 snd_hda_sequence_write_cache(codec, unmute_init);
5813 spec->aloopback_ctl = stac92hd71bxx_loopback;
5814 spec->aloopback_mask = 0x50;
5815 spec->aloopback_shift = 0;
5817 spec->powerdown_adcs = 1;
5818 spec->digbeep_nid = 0x26;
5819 spec->mux_nids = stac92hd71bxx_mux_nids;
5820 spec->adc_nids = stac92hd71bxx_adc_nids;
5821 spec->smux_nids = stac92hd71bxx_smux_nids;
5822 spec->pwr_nids = stac92hd71bxx_pwr_nids;
5824 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
5825 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
5826 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5827 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5829 snd_printdd("Found board config: %d\n", spec->board_config);
5831 switch (spec->board_config) {
5833 /* enable internal microphone */
5834 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
5835 stac92xx_auto_set_pinctl(codec, 0x0e,
5836 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
5838 case STAC_DELL_M4_2:
5839 spec->num_dmics = 0;
5840 spec->num_smuxes = 0;
5841 spec->num_dmuxes = 0;
5843 case STAC_DELL_M4_1:
5844 case STAC_DELL_M4_3:
5845 spec->num_dmics = 1;
5846 spec->num_smuxes = 0;
5847 spec->num_dmuxes = 1;
5849 case STAC_HP_DV4_1222NR:
5850 spec->num_dmics = 1;
5851 /* I don't know if it needs 1 or 2 smuxes - will wait for
5852 * bug reports to fix if needed
5854 spec->num_smuxes = 1;
5855 spec->num_dmuxes = 1;
5858 spec->gpio_led = 0x01;
5861 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
5862 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
5863 /* HP dv6 gives the headphone pin as a line-out. Thus we
5864 * need to set hp_detect flag here to force to enable HP
5867 spec->hp_detect = 1;
5870 spec->num_dmics = 1;
5871 spec->num_dmuxes = 1;
5872 spec->num_smuxes = 1;
5873 spec->gpio_led = 0x08;
5877 if (hp_blike_system(codec->subsystem_id)) {
5878 pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
5879 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
5880 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
5881 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
5882 /* It was changed in the BIOS to just satisfy MS DTM.
5883 * Lets turn it back into slaved HP
5885 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
5886 | (AC_JACK_HP_OUT <<
5887 AC_DEFCFG_DEVICE_SHIFT);
5888 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
5889 | AC_DEFCFG_SEQUENCE)))
5891 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
5895 if (find_mute_led_cfg(codec, 1))
5896 snd_printd("mute LED gpio %d polarity %d\n",
5898 spec->gpio_led_polarity);
5900 #ifdef CONFIG_SND_HDA_POWER_SAVE
5901 if (spec->gpio_led) {
5902 if (!spec->vref_mute_led_nid) {
5903 spec->gpio_mask |= spec->gpio_led;
5904 spec->gpio_dir |= spec->gpio_led;
5905 spec->gpio_data |= spec->gpio_led;
5907 codec->patch_ops.set_power_state =
5908 stac92xx_set_power_state;
5910 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5911 codec->patch_ops.check_power_status =
5912 stac92xx_check_power_status;
5916 spec->multiout.dac_nids = spec->dac_nids;
5918 err = stac92xx_parse_auto_config(codec);
5920 if (spec->board_config < 0) {
5921 printk(KERN_WARNING "hda_codec: No auto-config is "
5922 "available, default to model=ref\n");
5923 spec->board_config = STAC_92HD71BXX_REF;
5930 stac92xx_free(codec);
5934 /* enable bass on HP dv7 */
5935 if (spec->board_config == STAC_HP_DV4 ||
5936 spec->board_config == STAC_HP_DV5) {
5938 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
5939 cap &= AC_GPIO_IO_COUNT;
5941 stac_add_hp_bass_switch(codec);
5944 codec->proc_widget_hook = stac92hd7x_proc_hook;
5949 static int patch_stac922x(struct hda_codec *codec)
5951 struct sigmatel_spec *spec;
5954 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5958 codec->no_trigger_sense = 1;
5960 spec->linear_tone_beep = 1;
5961 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5962 spec->pin_nids = stac922x_pin_nids;
5963 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
5966 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
5967 spec->gpio_mask = spec->gpio_dir = 0x03;
5968 spec->gpio_data = 0x03;
5969 /* Intel Macs have all same PCI SSID, so we need to check
5970 * codec SSID to distinguish the exact models
5972 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
5973 switch (codec->subsystem_id) {
5976 spec->board_config = STAC_INTEL_MAC_V1;
5980 spec->board_config = STAC_INTEL_MAC_V2;
5988 spec->board_config = STAC_INTEL_MAC_V3;
5992 spec->board_config = STAC_INTEL_MAC_V4;
5996 spec->board_config = STAC_INTEL_MAC_V5;
5999 spec->board_config = STAC_INTEL_MAC_V3;
6005 if (spec->board_config < 0)
6006 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6009 stac92xx_set_config_regs(codec,
6010 stac922x_brd_tbl[spec->board_config]);
6012 spec->adc_nids = stac922x_adc_nids;
6013 spec->mux_nids = stac922x_mux_nids;
6014 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
6015 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
6016 spec->num_dmics = 0;
6019 spec->init = stac922x_core_init;
6021 spec->num_caps = STAC922X_NUM_CAPS;
6022 spec->capvols = stac922x_capvols;
6023 spec->capsws = stac922x_capsws;
6025 spec->multiout.dac_nids = spec->dac_nids;
6027 err = stac92xx_parse_auto_config(codec);
6029 if (spec->board_config < 0) {
6030 printk(KERN_WARNING "hda_codec: No auto-config is "
6031 "available, default to model=ref\n");
6032 spec->board_config = STAC_D945_REF;
6038 stac92xx_free(codec);
6042 codec->patch_ops = stac92xx_patch_ops;
6044 /* Fix Mux capture level; max to 2 */
6045 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
6046 (0 << AC_AMPCAP_OFFSET_SHIFT) |
6047 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6048 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
6049 (0 << AC_AMPCAP_MUTE_SHIFT));
6054 static int patch_stac927x(struct hda_codec *codec)
6056 struct sigmatel_spec *spec;
6059 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6063 codec->no_trigger_sense = 1;
6065 spec->linear_tone_beep = 1;
6066 codec->slave_dig_outs = stac927x_slave_dig_outs;
6067 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6068 spec->pin_nids = stac927x_pin_nids;
6069 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
6073 if (spec->board_config < 0)
6074 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6077 stac92xx_set_config_regs(codec,
6078 stac927x_brd_tbl[spec->board_config]);
6080 spec->digbeep_nid = 0x23;
6081 spec->adc_nids = stac927x_adc_nids;
6082 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
6083 spec->mux_nids = stac927x_mux_nids;
6084 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
6085 spec->smux_nids = stac927x_smux_nids;
6086 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
6087 spec->spdif_labels = stac927x_spdif_labels;
6088 spec->dac_list = stac927x_dac_nids;
6089 spec->multiout.dac_nids = spec->dac_nids;
6091 if (spec->board_config != STAC_D965_REF) {
6092 /* GPIO0 High = Enable EAPD */
6093 spec->eapd_mask = spec->gpio_mask = 0x01;
6094 spec->gpio_dir = spec->gpio_data = 0x01;
6097 switch (spec->board_config) {
6100 /* GPIO0 High = Enable EAPD */
6101 spec->num_dmics = 0;
6102 spec->init = d965_core_init;
6104 case STAC_DELL_BIOS:
6105 switch (codec->subsystem_id) {
6108 /* correct the device field to SPDIF out */
6109 snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070);
6112 /* configure the analog microphone on some laptops */
6113 snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130);
6114 /* correct the front output jack as a hp out */
6115 snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f);
6116 /* correct the front input jack as a mic */
6117 snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130);
6120 if (codec->subsystem_id != 0x1028022f) {
6121 /* GPIO2 High = Enable EAPD */
6122 spec->eapd_mask = spec->gpio_mask = 0x04;
6123 spec->gpio_dir = spec->gpio_data = 0x04;
6125 spec->dmic_nids = stac927x_dmic_nids;
6126 spec->num_dmics = STAC927X_NUM_DMICS;
6128 spec->init = dell_3st_core_init;
6129 spec->dmux_nids = stac927x_dmux_nids;
6130 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
6132 case STAC_927X_VOLKNOB:
6133 spec->num_dmics = 0;
6134 spec->init = stac927x_volknob_core_init;
6137 spec->num_dmics = 0;
6138 spec->init = stac927x_core_init;
6142 spec->num_caps = STAC927X_NUM_CAPS;
6143 spec->capvols = stac927x_capvols;
6144 spec->capsws = stac927x_capsws;
6147 spec->aloopback_ctl = stac927x_loopback;
6148 spec->aloopback_mask = 0x40;
6149 spec->aloopback_shift = 0;
6150 spec->eapd_switch = 1;
6152 err = stac92xx_parse_auto_config(codec);
6154 if (spec->board_config < 0) {
6155 printk(KERN_WARNING "hda_codec: No auto-config is "
6156 "available, default to model=ref\n");
6157 spec->board_config = STAC_D965_REF;
6163 stac92xx_free(codec);
6167 codec->patch_ops = stac92xx_patch_ops;
6169 codec->proc_widget_hook = stac927x_proc_hook;
6173 * The STAC927x seem to require fairly long delays for certain
6174 * command sequences. With too short delays (even if the answer
6175 * is set to RIRB properly), it results in the silence output
6176 * on some hardwares like Dell.
6178 * The below flag enables the longer delay (see get_response
6181 codec->bus->needs_damn_long_delay = 1;
6183 /* no jack detecion for ref-no-jd model */
6184 if (spec->board_config == STAC_D965_REF_NO_JD)
6185 spec->hp_detect = 0;
6190 static int patch_stac9205(struct hda_codec *codec)
6192 struct sigmatel_spec *spec;
6195 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6199 codec->no_trigger_sense = 1;
6201 spec->linear_tone_beep = 1;
6202 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6203 spec->pin_nids = stac9205_pin_nids;
6204 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
6208 if (spec->board_config < 0)
6209 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6212 stac92xx_set_config_regs(codec,
6213 stac9205_brd_tbl[spec->board_config]);
6215 spec->digbeep_nid = 0x23;
6216 spec->adc_nids = stac9205_adc_nids;
6217 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
6218 spec->mux_nids = stac9205_mux_nids;
6219 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
6220 spec->smux_nids = stac9205_smux_nids;
6221 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
6222 spec->dmic_nids = stac9205_dmic_nids;
6223 spec->num_dmics = STAC9205_NUM_DMICS;
6224 spec->dmux_nids = stac9205_dmux_nids;
6225 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
6228 spec->init = stac9205_core_init;
6229 spec->aloopback_ctl = stac9205_loopback;
6231 spec->num_caps = STAC9205_NUM_CAPS;
6232 spec->capvols = stac9205_capvols;
6233 spec->capsws = stac9205_capsws;
6235 spec->aloopback_mask = 0x40;
6236 spec->aloopback_shift = 0;
6237 /* Turn on/off EAPD per HP plugging */
6238 if (spec->board_config != STAC_9205_EAPD)
6239 spec->eapd_switch = 1;
6240 spec->multiout.dac_nids = spec->dac_nids;
6242 switch (spec->board_config){
6243 case STAC_9205_DELL_M43:
6244 /* Enable SPDIF in/out */
6245 snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030);
6246 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
6248 /* Enable unsol response for GPIO4/Dock HP connection */
6249 err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01);
6252 snd_hda_codec_write_cache(codec, codec->afg, 0,
6253 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
6254 snd_hda_jack_detect_enable(codec, codec->afg, 0);
6256 spec->gpio_dir = 0x0b;
6257 spec->eapd_mask = 0x01;
6258 spec->gpio_mask = 0x1b;
6259 spec->gpio_mute = 0x10;
6260 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
6263 spec->gpio_data = 0x01;
6266 /* SPDIF-In enabled */
6269 /* GPIO0 High = EAPD */
6270 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
6271 spec->gpio_data = 0x01;
6275 err = stac92xx_parse_auto_config(codec);
6277 if (spec->board_config < 0) {
6278 printk(KERN_WARNING "hda_codec: No auto-config is "
6279 "available, default to model=ref\n");
6280 spec->board_config = STAC_9205_REF;
6286 stac92xx_free(codec);
6290 codec->patch_ops = stac92xx_patch_ops;
6292 codec->proc_widget_hook = stac9205_proc_hook;
6301 static const struct hda_verb stac9872_core_init[] = {
6302 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
6303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
6307 static const hda_nid_t stac9872_pin_nids[] = {
6308 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6312 static const hda_nid_t stac9872_adc_nids[] = {
6316 static const hda_nid_t stac9872_mux_nids[] = {
6320 static const unsigned long stac9872_capvols[] = {
6321 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
6323 #define stac9872_capsws stac9872_capvols
6325 static const unsigned int stac9872_vaio_pin_configs[9] = {
6326 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6327 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6331 static const char * const stac9872_models[STAC_9872_MODELS] = {
6332 [STAC_9872_AUTO] = "auto",
6333 [STAC_9872_VAIO] = "vaio",
6336 static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
6337 [STAC_9872_VAIO] = stac9872_vaio_pin_configs,
6340 static const struct snd_pci_quirk stac9872_cfg_tbl[] = {
6341 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6342 "Sony VAIO F/S", STAC_9872_VAIO),
6346 static int patch_stac9872(struct hda_codec *codec)
6348 struct sigmatel_spec *spec;
6351 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6354 codec->no_trigger_sense = 1;
6356 spec->linear_tone_beep = 1;
6357 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6358 spec->pin_nids = stac9872_pin_nids;
6360 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
6363 if (spec->board_config < 0)
6364 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6367 stac92xx_set_config_regs(codec,
6368 stac9872_brd_tbl[spec->board_config]);
6370 spec->multiout.dac_nids = spec->dac_nids;
6371 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
6372 spec->adc_nids = stac9872_adc_nids;
6373 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
6374 spec->mux_nids = stac9872_mux_nids;
6375 spec->init = stac9872_core_init;
6377 spec->capvols = stac9872_capvols;
6378 spec->capsws = stac9872_capsws;
6380 err = stac92xx_parse_auto_config(codec);
6382 stac92xx_free(codec);
6385 spec->input_mux = &spec->private_imux;
6386 codec->patch_ops = stac92xx_patch_ops;
6394 static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6395 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
6396 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
6397 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
6398 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
6399 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
6400 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
6401 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
6402 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
6403 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
6404 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
6405 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
6406 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
6407 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
6408 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
6409 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
6410 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
6411 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
6412 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
6413 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
6414 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
6415 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
6416 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
6417 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
6418 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
6419 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
6420 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
6421 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
6422 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
6423 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
6424 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
6425 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
6426 /* The following does not take into account .id=0x83847661 when subsys =
6427 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
6428 * currently not fully supported.
6430 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
6431 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
6432 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
6433 { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
6434 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
6435 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
6436 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
6437 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
6438 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
6439 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
6440 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
6441 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
6442 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
6443 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
6444 { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
6445 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
6446 { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
6447 { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
6448 { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
6449 { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
6450 { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
6451 { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
6452 { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
6453 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
6454 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
6455 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
6456 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
6457 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
6458 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
6459 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
6460 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
6461 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
6462 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
6463 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6464 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6465 { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
6466 { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
6467 { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
6468 { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
6469 { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
6470 { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
6471 { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
6472 { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
6473 { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
6474 { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
6475 { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
6476 { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
6477 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
6478 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
6479 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
6480 { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
6481 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
6482 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
6483 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
6484 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
6485 { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
6486 { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
6487 { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
6488 { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
6489 { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
6490 { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
6491 { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
6492 { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
6493 { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
6494 { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
6495 { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
6496 { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
6500 MODULE_ALIAS("snd-hda-codec-id:8384*");
6501 MODULE_ALIAS("snd-hda-codec-id:111d*");
6503 MODULE_LICENSE("GPL");
6504 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
6506 static struct hda_codec_preset_list sigmatel_list = {
6507 .preset = snd_hda_preset_sigmatel,
6508 .owner = THIS_MODULE,
6511 static int __init patch_sigmatel_init(void)
6513 return snd_hda_add_codec_preset(&sigmatel_list);
6516 static void __exit patch_sigmatel_exit(void)
6518 snd_hda_delete_codec_preset(&sigmatel_list);
6521 module_init(patch_sigmatel_init)
6522 module_exit(patch_sigmatel_exit)