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,
103 STAC_92HD83XXX_HP_LED,
104 STAC_92HD83XXX_MODELS
118 STAC_92HD71BXX_MODELS
144 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
145 * is given, one of the above models will be
146 * chosen according to the subsystem id. */
147 /* for backward compatibility */
164 STAC_D965_REF_NO_JD, /* no jack-detection */
181 struct sigmatel_mic_route {
184 signed char dmux_idx;
187 #define MAX_PINS_NUM 16
188 #define MAX_ADCS_NUM 4
189 #define MAX_DMICS_NUM 4
191 struct sigmatel_spec {
192 struct snd_kcontrol_new *mixers[4];
193 unsigned int num_mixers;
196 unsigned int eapd_switch: 1;
197 unsigned int surr_switch: 1;
198 unsigned int alt_switch: 1;
199 unsigned int hp_detect: 1;
200 unsigned int spdif_mute: 1;
201 unsigned int check_volume_offset:1;
202 unsigned int auto_mic:1;
203 unsigned int linear_tone_beep:1;
206 unsigned int eapd_mask;
207 unsigned int gpio_mask;
208 unsigned int gpio_dir;
209 unsigned int gpio_data;
210 unsigned int gpio_mute;
211 unsigned int gpio_led;
212 unsigned int gpio_led_polarity;
213 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
214 unsigned int vref_led;
217 unsigned int stream_delay;
219 /* analog loopback */
220 const struct snd_kcontrol_new *aloopback_ctl;
221 unsigned char aloopback_mask;
222 unsigned char aloopback_shift;
224 /* power management */
225 unsigned int num_pwrs;
226 const hda_nid_t *pwr_nids;
227 const hda_nid_t *dac_list;
230 struct hda_input_mux *mono_mux;
231 unsigned int cur_mmux;
232 struct hda_multi_out multiout;
233 hda_nid_t dac_nids[5];
234 hda_nid_t hp_dacs[5];
235 hda_nid_t speaker_dacs[5];
240 const hda_nid_t *adc_nids;
241 unsigned int num_adcs;
242 const hda_nid_t *mux_nids;
243 unsigned int num_muxes;
244 const hda_nid_t *dmic_nids;
245 unsigned int num_dmics;
246 const hda_nid_t *dmux_nids;
247 unsigned int num_dmuxes;
248 const hda_nid_t *smux_nids;
249 unsigned int num_smuxes;
250 unsigned int num_analog_muxes;
252 const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
253 const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
254 unsigned int num_caps; /* number of capture volume/switch elements */
256 struct sigmatel_mic_route ext_mic;
257 struct sigmatel_mic_route int_mic;
258 struct sigmatel_mic_route dock_mic;
260 const char * const *spdif_labels;
262 hda_nid_t dig_in_nid;
264 hda_nid_t anabeep_nid;
265 hda_nid_t digbeep_nid;
268 const hda_nid_t *pin_nids;
269 unsigned int num_pins;
271 /* codec specific stuff */
272 const struct hda_verb *init;
273 const struct snd_kcontrol_new *mixer;
276 struct hda_input_mux *dinput_mux;
277 unsigned int cur_dmux[2];
278 struct hda_input_mux *input_mux;
279 unsigned int cur_mux[3];
280 struct hda_input_mux *sinput_mux;
281 unsigned int cur_smux[2];
282 unsigned int cur_amux;
284 unsigned int powerdown_adcs;
287 unsigned int io_switch[2];
288 unsigned int clfe_swap;
289 hda_nid_t line_switch; /* shared line-in for input and output */
290 hda_nid_t mic_switch; /* shared mic-in for input and output */
291 hda_nid_t hp_switch; /* NID of HP as line-out */
292 unsigned int aloopback;
294 struct hda_pcm pcm_rec[2]; /* PCM information */
296 /* dynamic controls and input_mux */
297 struct auto_pin_cfg autocfg;
298 struct snd_array kctls;
299 struct hda_input_mux private_dimux;
300 struct hda_input_mux private_imux;
301 struct hda_input_mux private_smux;
302 struct hda_input_mux private_mono_mux;
305 unsigned auto_pin_cnt;
306 hda_nid_t auto_pin_nids[MAX_PINS_NUM];
307 unsigned auto_adc_cnt;
308 hda_nid_t auto_adc_nids[MAX_ADCS_NUM];
309 hda_nid_t auto_mux_nids[MAX_ADCS_NUM];
310 hda_nid_t auto_dmux_nids[MAX_ADCS_NUM];
311 unsigned long auto_capvols[MAX_ADCS_NUM];
312 unsigned auto_dmic_cnt;
313 hda_nid_t auto_dmic_nids[MAX_DMICS_NUM];
315 struct hda_vmaster_mute_hook vmaster_mute;
318 static const hda_nid_t stac9200_adc_nids[1] = {
322 static const hda_nid_t stac9200_mux_nids[1] = {
326 static const hda_nid_t stac9200_dac_nids[1] = {
330 static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
331 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
335 static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
339 static const hda_nid_t stac92hd73xx_adc_nids[2] = {
343 #define STAC92HD73XX_NUM_DMICS 2
344 static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
348 #define STAC92HD73_DAC_COUNT 5
350 static const hda_nid_t stac92hd73xx_mux_nids[2] = {
354 static const hda_nid_t stac92hd73xx_dmux_nids[2] = {
358 static const hda_nid_t stac92hd73xx_smux_nids[2] = {
362 #define STAC92HD73XX_NUM_CAPS 2
363 static const unsigned long stac92hd73xx_capvols[] = {
364 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
365 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
367 #define stac92hd73xx_capsws stac92hd73xx_capvols
369 #define STAC92HD83_DAC_COUNT 3
371 static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
372 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
376 static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
380 static const hda_nid_t stac92hd83xxx_dmic_nids[] = {
384 static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
388 static const hda_nid_t stac92hd71bxx_adc_nids[2] = {
392 static const hda_nid_t stac92hd71bxx_mux_nids[2] = {
396 static const hda_nid_t stac92hd71bxx_dmux_nids[2] = {
400 static const hda_nid_t stac92hd71bxx_smux_nids[2] = {
404 #define STAC92HD71BXX_NUM_DMICS 2
405 static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
409 static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = {
413 static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
417 #define STAC92HD71BXX_NUM_CAPS 2
418 static const unsigned long stac92hd71bxx_capvols[] = {
419 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
420 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
422 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
424 static const hda_nid_t stac925x_adc_nids[1] = {
428 static const hda_nid_t stac925x_mux_nids[1] = {
432 static const hda_nid_t stac925x_dac_nids[1] = {
436 #define STAC925X_NUM_DMICS 1
437 static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
441 static const hda_nid_t stac925x_dmux_nids[1] = {
445 static const unsigned long stac925x_capvols[] = {
446 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
448 static const unsigned long stac925x_capsws[] = {
449 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
452 static const hda_nid_t stac922x_adc_nids[2] = {
456 static const hda_nid_t stac922x_mux_nids[2] = {
460 #define STAC922X_NUM_CAPS 2
461 static const unsigned long stac922x_capvols[] = {
462 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
463 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
465 #define stac922x_capsws stac922x_capvols
467 static const hda_nid_t stac927x_slave_dig_outs[2] = {
471 static const hda_nid_t stac927x_adc_nids[3] = {
475 static const hda_nid_t stac927x_mux_nids[3] = {
479 static const hda_nid_t stac927x_smux_nids[1] = {
483 static const hda_nid_t stac927x_dac_nids[6] = {
484 0x02, 0x03, 0x04, 0x05, 0x06, 0
487 static const hda_nid_t stac927x_dmux_nids[1] = {
491 #define STAC927X_NUM_DMICS 2
492 static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
496 #define STAC927X_NUM_CAPS 3
497 static const unsigned long stac927x_capvols[] = {
498 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
499 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
500 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
502 static const unsigned long stac927x_capsws[] = {
503 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
504 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
505 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
508 static const char * const stac927x_spdif_labels[5] = {
509 "Digital Playback", "ADAT", "Analog Mux 1",
510 "Analog Mux 2", "Analog Mux 3"
513 static const hda_nid_t stac9205_adc_nids[2] = {
517 static const hda_nid_t stac9205_mux_nids[2] = {
521 static const hda_nid_t stac9205_dmux_nids[1] = {
525 static const hda_nid_t stac9205_smux_nids[1] = {
529 #define STAC9205_NUM_DMICS 2
530 static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
534 #define STAC9205_NUM_CAPS 2
535 static const unsigned long stac9205_capvols[] = {
536 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
537 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
539 static const unsigned long stac9205_capsws[] = {
540 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
541 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
544 static const hda_nid_t stac9200_pin_nids[8] = {
545 0x08, 0x09, 0x0d, 0x0e,
546 0x0f, 0x10, 0x11, 0x12,
549 static const hda_nid_t stac925x_pin_nids[8] = {
550 0x07, 0x08, 0x0a, 0x0b,
551 0x0c, 0x0d, 0x10, 0x11,
554 static const hda_nid_t stac922x_pin_nids[10] = {
555 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
556 0x0f, 0x10, 0x11, 0x15, 0x1b,
559 static const hda_nid_t stac92hd73xx_pin_nids[13] = {
560 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
561 0x0f, 0x10, 0x11, 0x12, 0x13,
565 #define STAC92HD71BXX_NUM_PINS 13
566 static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
567 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
568 0x00, 0x14, 0x18, 0x19, 0x1e,
571 static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
572 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
573 0x0f, 0x14, 0x18, 0x19, 0x1e,
577 static const hda_nid_t stac927x_pin_nids[14] = {
578 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
579 0x0f, 0x10, 0x11, 0x12, 0x13,
580 0x14, 0x21, 0x22, 0x23,
583 static const hda_nid_t stac9205_pin_nids[12] = {
584 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
585 0x0f, 0x14, 0x16, 0x17, 0x18,
589 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
590 struct snd_ctl_elem_info *uinfo)
592 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
593 struct sigmatel_spec *spec = codec->spec;
594 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
597 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
598 struct snd_ctl_elem_value *ucontrol)
600 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
601 struct sigmatel_spec *spec = codec->spec;
602 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
604 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
608 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
609 struct snd_ctl_elem_value *ucontrol)
611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
612 struct sigmatel_spec *spec = codec->spec;
613 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
615 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
616 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
619 static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol,
620 struct snd_ctl_elem_info *uinfo)
622 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
623 struct sigmatel_spec *spec = codec->spec;
624 return snd_hda_input_mux_info(spec->sinput_mux, uinfo);
627 static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol,
628 struct snd_ctl_elem_value *ucontrol)
630 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
631 struct sigmatel_spec *spec = codec->spec;
632 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
634 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
638 static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
639 struct snd_ctl_elem_value *ucontrol)
641 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
642 struct sigmatel_spec *spec = codec->spec;
643 struct hda_input_mux *smux = &spec->private_smux;
644 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
648 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
649 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
653 if (spec->spdif_mute) {
655 nid = spec->multiout.dig_out_nid;
657 nid = codec->slave_dig_outs[smux_idx - 1];
658 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
662 /* un/mute SPDIF out */
663 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
669 static int stac_vrefout_set(struct hda_codec *codec,
670 hda_nid_t nid, unsigned int new_vref)
674 snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
675 pinctl = snd_hda_codec_read(codec, nid, 0,
676 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
682 pinctl &= ~AC_PINCTL_VREFEN;
683 pinctl |= (new_vref & AC_PINCTL_VREFEN);
685 error = snd_hda_codec_write_cache(codec, nid, 0,
686 AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl);
693 static unsigned int stac92xx_vref_set(struct hda_codec *codec,
694 hda_nid_t nid, unsigned int new_vref)
698 pincfg = snd_hda_codec_read(codec, nid, 0,
699 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
702 pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
705 if (new_vref == AC_PINCTL_VREF_HIZ)
706 pincfg |= AC_PINCTL_OUT_EN;
708 pincfg |= AC_PINCTL_IN_EN;
710 error = snd_hda_codec_write_cache(codec, nid, 0,
711 AC_VERB_SET_PIN_WIDGET_CONTROL, pincfg);
718 static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid)
721 vref = snd_hda_codec_read(codec, nid, 0,
722 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
723 vref &= AC_PINCTL_VREFEN;
727 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
729 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
730 struct sigmatel_spec *spec = codec->spec;
731 return snd_hda_input_mux_info(spec->input_mux, uinfo);
734 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
736 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
737 struct sigmatel_spec *spec = codec->spec;
738 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
740 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
744 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
746 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
747 struct sigmatel_spec *spec = codec->spec;
748 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
749 const struct hda_input_mux *imux = spec->input_mux;
750 unsigned int idx, prev_idx, didx;
752 idx = ucontrol->value.enumerated.item[0];
753 if (idx >= imux->num_items)
754 idx = imux->num_items - 1;
755 prev_idx = spec->cur_mux[adc_idx];
758 if (idx < spec->num_analog_muxes) {
759 snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0,
760 AC_VERB_SET_CONNECT_SEL,
761 imux->items[idx].index);
762 if (prev_idx >= spec->num_analog_muxes &&
763 spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) {
764 imux = spec->dinput_mux;
766 snd_hda_codec_write_cache(codec,
767 spec->dmux_nids[adc_idx], 0,
768 AC_VERB_SET_CONNECT_SEL,
769 imux->items[0].index);
772 imux = spec->dinput_mux;
773 /* first dimux item is hardcoded to select analog imux,
776 didx = idx - spec->num_analog_muxes + 1;
777 snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0,
778 AC_VERB_SET_CONNECT_SEL,
779 imux->items[didx].index);
781 spec->cur_mux[adc_idx] = idx;
785 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
786 struct snd_ctl_elem_info *uinfo)
788 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
789 struct sigmatel_spec *spec = codec->spec;
790 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
793 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
797 struct sigmatel_spec *spec = codec->spec;
799 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
803 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
804 struct snd_ctl_elem_value *ucontrol)
806 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
807 struct sigmatel_spec *spec = codec->spec;
809 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
810 spec->mono_nid, &spec->cur_mmux);
813 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
815 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
816 struct snd_ctl_elem_value *ucontrol)
818 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
819 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
820 struct sigmatel_spec *spec = codec->spec;
822 ucontrol->value.integer.value[0] = !!(spec->aloopback &
823 (spec->aloopback_mask << idx));
827 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
828 struct snd_ctl_elem_value *ucontrol)
830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
831 struct sigmatel_spec *spec = codec->spec;
832 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
833 unsigned int dac_mode;
834 unsigned int val, idx_val;
836 idx_val = spec->aloopback_mask << idx;
837 if (ucontrol->value.integer.value[0])
838 val = spec->aloopback | idx_val;
840 val = spec->aloopback & ~idx_val;
841 if (spec->aloopback == val)
844 spec->aloopback = val;
846 /* Only return the bits defined by the shift value of the
847 * first two bytes of the mask
849 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
850 kcontrol->private_value & 0xFFFF, 0x0);
851 dac_mode >>= spec->aloopback_shift;
853 if (spec->aloopback & idx_val) {
854 snd_hda_power_up(codec);
857 snd_hda_power_down(codec);
858 dac_mode &= ~idx_val;
861 snd_hda_codec_write_cache(codec, codec->afg, 0,
862 kcontrol->private_value >> 16, dac_mode);
867 static const struct hda_verb stac9200_core_init[] = {
868 /* set dac0mux for dac converter */
869 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
873 static const struct hda_verb stac9200_eapd_init[] = {
874 /* set dac0mux for dac converter */
875 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
876 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
880 static const struct hda_verb dell_eq_core_init[] = {
881 /* set master volume to max value without distortion
882 * and direct control */
883 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
887 static const struct hda_verb stac92hd73xx_core_init[] = {
888 /* set master volume and direct control */
889 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
893 static const struct hda_verb stac92hd83xxx_core_init[] = {
894 /* power state controls amps */
895 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
899 static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
900 { 0x22, 0x785, 0x43 },
901 { 0x22, 0x782, 0xe0 },
902 { 0x22, 0x795, 0x00 },
906 static const struct hda_verb stac92hd71bxx_core_init[] = {
907 /* set master volume and direct control */
908 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
912 static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
913 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
914 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
915 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
916 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
920 static const struct hda_verb stac925x_core_init[] = {
921 /* set dac0mux for dac converter */
922 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
923 /* mute the master volume */
924 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
928 static const struct hda_verb stac922x_core_init[] = {
929 /* set master volume and direct control */
930 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
934 static const struct hda_verb d965_core_init[] = {
935 /* set master volume and direct control */
936 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
937 /* unmute node 0x1b */
938 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
939 /* select node 0x03 as DAC */
940 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
944 static const struct hda_verb dell_3st_core_init[] = {
945 /* don't set delta bit */
946 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
947 /* unmute node 0x1b */
948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
949 /* select node 0x03 as DAC */
950 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
954 static const struct hda_verb stac927x_core_init[] = {
955 /* set master volume and direct control */
956 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
957 /* enable analog pc beep path */
958 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
962 static const struct hda_verb stac927x_volknob_core_init[] = {
963 /* don't set delta bit */
964 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
965 /* enable analog pc beep path */
966 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
970 static const struct hda_verb stac9205_core_init[] = {
971 /* set master volume and direct control */
972 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
973 /* enable analog pc beep path */
974 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
978 #define STAC_MONO_MUX \
980 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
981 .name = "Mono Mux", \
983 .info = stac92xx_mono_mux_enum_info, \
984 .get = stac92xx_mono_mux_enum_get, \
985 .put = stac92xx_mono_mux_enum_put, \
988 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
991 .name = "Analog Loopback", \
993 .info = stac92xx_aloopback_info, \
994 .get = stac92xx_aloopback_get, \
995 .put = stac92xx_aloopback_put, \
996 .private_value = verb_read | (verb_write << 16), \
999 #define DC_BIAS(xname, idx, nid) \
1001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1004 .info = stac92xx_dc_bias_info, \
1005 .get = stac92xx_dc_bias_get, \
1006 .put = stac92xx_dc_bias_put, \
1007 .private_value = nid, \
1010 static const struct snd_kcontrol_new stac9200_mixer[] = {
1011 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xb, 0, HDA_OUTPUT),
1012 HDA_CODEC_MUTE("PCM Playback Switch", 0xb, 0, HDA_OUTPUT),
1013 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
1014 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
1018 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
1019 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1023 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
1024 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1028 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1029 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1034 static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1035 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1038 static const struct snd_kcontrol_new stac925x_mixer[] = {
1039 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xe, 0, HDA_OUTPUT),
1040 HDA_CODEC_MUTE("PCM Playback Switch", 0x0e, 0, HDA_OUTPUT),
1044 static const struct snd_kcontrol_new stac9205_loopback[] = {
1045 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1049 static const struct snd_kcontrol_new stac927x_loopback[] = {
1050 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1054 static struct snd_kcontrol_new stac_dmux_mixer = {
1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1056 .name = "Digital Input Source",
1057 /* count set later */
1058 .info = stac92xx_dmux_enum_info,
1059 .get = stac92xx_dmux_enum_get,
1060 .put = stac92xx_dmux_enum_put,
1063 static struct snd_kcontrol_new stac_smux_mixer = {
1064 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1065 .name = "IEC958 Playback Source",
1066 /* count set later */
1067 .info = stac92xx_smux_enum_info,
1068 .get = stac92xx_smux_enum_get,
1069 .put = stac92xx_smux_enum_put,
1072 static const char * const slave_pfxs[] = {
1073 "Front", "Surround", "Center", "LFE", "Side",
1074 "Headphone", "Speaker", "IEC958",
1078 static void stac92xx_update_led_status(struct hda_codec *codec, int enabled);
1080 static void stac92xx_vmaster_hook(void *private_data, int val)
1082 stac92xx_update_led_status(private_data, val);
1085 static void stac92xx_free_kctls(struct hda_codec *codec);
1087 static int stac92xx_build_controls(struct hda_codec *codec)
1089 struct sigmatel_spec *spec = codec->spec;
1090 unsigned int vmaster_tlv[4];
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 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
1148 HDA_OUTPUT, vmaster_tlv);
1149 /* correct volume offset */
1150 vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
1151 /* minimum value is actually mute */
1152 vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
1153 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1154 vmaster_tlv, slave_pfxs,
1159 err = __snd_hda_add_vmaster(codec, "Master Playback Switch",
1161 "Playback Switch", true,
1162 &spec->vmaster_mute.sw_kctl);
1166 if (spec->gpio_led) {
1167 spec->vmaster_mute.hook = stac92xx_vmaster_hook;
1168 err = snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
1173 if (spec->aloopback_ctl &&
1174 snd_hda_get_bool_hint(codec, "loopback") == 1) {
1175 err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl);
1180 stac92xx_free_kctls(codec); /* no longer needed */
1182 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1189 static const unsigned int ref9200_pin_configs[8] = {
1190 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1191 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1194 static const unsigned int gateway9200_m4_pin_configs[8] = {
1195 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1196 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1198 static const unsigned int gateway9200_m4_2_pin_configs[8] = {
1199 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1200 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1204 STAC 9200 pin configs for
1209 static const unsigned int dell9200_d21_pin_configs[8] = {
1210 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1211 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1215 STAC 9200 pin configs for
1219 static const unsigned int dell9200_d22_pin_configs[8] = {
1220 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1221 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1225 STAC 9200 pin configs for
1226 102801C4 (Dell Dimension E310)
1233 static const unsigned int dell9200_d23_pin_configs[8] = {
1234 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1235 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1240 STAC 9200-32 pin configs for
1241 102801B5 (Dell Inspiron 630m)
1242 102801D8 (Dell Inspiron 640m)
1244 static const unsigned int dell9200_m21_pin_configs[8] = {
1245 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1246 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1250 STAC 9200-32 pin configs for
1251 102801C2 (Dell Latitude D620)
1253 102801CC (Dell Latitude D820)
1257 static const unsigned int dell9200_m22_pin_configs[8] = {
1258 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1259 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1263 STAC 9200-32 pin configs for
1264 102801CE (Dell XPS M1710)
1265 102801CF (Dell Precision M90)
1267 static const unsigned int dell9200_m23_pin_configs[8] = {
1268 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1269 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1273 STAC 9200-32 pin configs for
1276 102801CB (Dell Latitude 120L)
1279 static const unsigned int dell9200_m24_pin_configs[8] = {
1280 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1281 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1285 STAC 9200-32 pin configs for
1286 102801BD (Dell Inspiron E1505n)
1290 static const unsigned int dell9200_m25_pin_configs[8] = {
1291 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1292 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1296 STAC 9200-32 pin configs for
1297 102801F5 (Dell Inspiron 1501)
1300 static const unsigned int dell9200_m26_pin_configs[8] = {
1301 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1302 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1307 102801CD (Dell Inspiron E1705/9400)
1309 static const unsigned int dell9200_m27_pin_configs[8] = {
1310 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1311 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1314 static const unsigned int oqo9200_pin_configs[8] = {
1315 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1316 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1320 static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1321 [STAC_REF] = ref9200_pin_configs,
1322 [STAC_9200_OQO] = oqo9200_pin_configs,
1323 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1324 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1325 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1326 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1327 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1328 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1329 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1330 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1331 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1332 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1333 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1334 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1335 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1338 static const char * const stac9200_models[STAC_9200_MODELS] = {
1339 [STAC_AUTO] = "auto",
1341 [STAC_9200_OQO] = "oqo",
1342 [STAC_9200_DELL_D21] = "dell-d21",
1343 [STAC_9200_DELL_D22] = "dell-d22",
1344 [STAC_9200_DELL_D23] = "dell-d23",
1345 [STAC_9200_DELL_M21] = "dell-m21",
1346 [STAC_9200_DELL_M22] = "dell-m22",
1347 [STAC_9200_DELL_M23] = "dell-m23",
1348 [STAC_9200_DELL_M24] = "dell-m24",
1349 [STAC_9200_DELL_M25] = "dell-m25",
1350 [STAC_9200_DELL_M26] = "dell-m26",
1351 [STAC_9200_DELL_M27] = "dell-m27",
1352 [STAC_9200_M4] = "gateway-m4",
1353 [STAC_9200_M4_2] = "gateway-m4-2",
1354 [STAC_9200_PANASONIC] = "panasonic",
1357 static const struct snd_pci_quirk stac9200_cfg_tbl[] = {
1358 /* SigmaTel reference board */
1359 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1360 "DFI LanParty", STAC_REF),
1361 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1362 "DFI LanParty", STAC_REF),
1363 /* Dell laptops have BIOS problem */
1364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1365 "unknown Dell", STAC_9200_DELL_D21),
1366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1367 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1368 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1369 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1370 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1371 "unknown Dell", STAC_9200_DELL_D22),
1372 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1373 "unknown Dell", STAC_9200_DELL_D22),
1374 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1375 "Dell Latitude D620", STAC_9200_DELL_M22),
1376 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1377 "unknown Dell", STAC_9200_DELL_D23),
1378 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1379 "unknown Dell", STAC_9200_DELL_D23),
1380 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1381 "unknown Dell", STAC_9200_DELL_M22),
1382 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1383 "unknown Dell", STAC_9200_DELL_M24),
1384 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1385 "unknown Dell", STAC_9200_DELL_M24),
1386 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1387 "Dell Latitude 120L", STAC_9200_DELL_M24),
1388 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1389 "Dell Latitude D820", STAC_9200_DELL_M22),
1390 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1391 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1392 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1393 "Dell XPS M1710", STAC_9200_DELL_M23),
1394 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1395 "Dell Precision M90", STAC_9200_DELL_M23),
1396 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1397 "unknown Dell", STAC_9200_DELL_M22),
1398 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1399 "unknown Dell", STAC_9200_DELL_M22),
1400 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1401 "unknown Dell", STAC_9200_DELL_M22),
1402 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1403 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1404 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1405 "unknown Dell", STAC_9200_DELL_D23),
1406 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1407 "unknown Dell", STAC_9200_DELL_D23),
1408 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1409 "unknown Dell", STAC_9200_DELL_D21),
1410 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1411 "unknown Dell", STAC_9200_DELL_D23),
1412 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1413 "unknown Dell", STAC_9200_DELL_D21),
1414 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1415 "unknown Dell", STAC_9200_DELL_M25),
1416 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1417 "unknown Dell", STAC_9200_DELL_M25),
1418 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1419 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1420 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1421 "unknown Dell", STAC_9200_DELL_M26),
1423 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1424 /* Gateway machines needs EAPD to be set on resume */
1425 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1426 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1427 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1429 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1433 static const unsigned int ref925x_pin_configs[8] = {
1434 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1435 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1438 static const unsigned int stac925xM1_pin_configs[8] = {
1439 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1440 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1443 static const unsigned int stac925xM1_2_pin_configs[8] = {
1444 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1445 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1448 static const unsigned int stac925xM2_pin_configs[8] = {
1449 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1450 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1453 static const unsigned int stac925xM2_2_pin_configs[8] = {
1454 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1455 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1458 static const unsigned int stac925xM3_pin_configs[8] = {
1459 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1460 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1463 static const unsigned int stac925xM5_pin_configs[8] = {
1464 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1465 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1468 static const unsigned int stac925xM6_pin_configs[8] = {
1469 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1470 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1473 static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1474 [STAC_REF] = ref925x_pin_configs,
1475 [STAC_M1] = stac925xM1_pin_configs,
1476 [STAC_M1_2] = stac925xM1_2_pin_configs,
1477 [STAC_M2] = stac925xM2_pin_configs,
1478 [STAC_M2_2] = stac925xM2_2_pin_configs,
1479 [STAC_M3] = stac925xM3_pin_configs,
1480 [STAC_M5] = stac925xM5_pin_configs,
1481 [STAC_M6] = stac925xM6_pin_configs,
1484 static const char * const stac925x_models[STAC_925x_MODELS] = {
1485 [STAC_925x_AUTO] = "auto",
1488 [STAC_M1_2] = "m1-2",
1490 [STAC_M2_2] = "m2-2",
1496 static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1497 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1498 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1499 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1500 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1501 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1502 /* Not sure about the brand name for those */
1503 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1504 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1505 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1506 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1510 static const struct snd_pci_quirk stac925x_cfg_tbl[] = {
1511 /* SigmaTel reference board */
1512 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1513 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1514 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1516 /* Default table for unknown ID */
1517 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1522 static const unsigned int ref92hd73xx_pin_configs[13] = {
1523 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1524 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1525 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1529 static const unsigned int dell_m6_pin_configs[13] = {
1530 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1531 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1532 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1536 static const unsigned int alienware_m17x_pin_configs[13] = {
1537 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1538 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1539 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1543 static const unsigned int intel_dg45id_pin_configs[13] = {
1544 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1545 0x01A19250, 0x01011212, 0x01016211
1548 static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1549 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1550 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1551 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1552 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1553 [STAC_DELL_EQ] = dell_m6_pin_configs,
1554 [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs,
1555 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs,
1558 static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1559 [STAC_92HD73XX_AUTO] = "auto",
1560 [STAC_92HD73XX_NO_JD] = "no-jd",
1561 [STAC_92HD73XX_REF] = "ref",
1562 [STAC_92HD73XX_INTEL] = "intel",
1563 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1564 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1565 [STAC_DELL_M6_BOTH] = "dell-m6",
1566 [STAC_DELL_EQ] = "dell-eq",
1567 [STAC_ALIENWARE_M17X] = "alienware",
1570 static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1571 /* SigmaTel reference board */
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1573 "DFI LanParty", STAC_92HD73XX_REF),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1575 "DFI LanParty", STAC_92HD73XX_REF),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1577 "Intel DG45ID", STAC_92HD73XX_INTEL),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1579 "Intel DG45FC", STAC_92HD73XX_INTEL),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1581 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1583 "unknown Dell", STAC_DELL_M6_DMIC),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1585 "unknown Dell", STAC_DELL_M6_BOTH),
1586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1587 "unknown Dell", STAC_DELL_M6_BOTH),
1588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1589 "unknown Dell", STAC_DELL_M6_AMIC),
1590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1591 "unknown Dell", STAC_DELL_M6_AMIC),
1592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1593 "unknown Dell", STAC_DELL_M6_DMIC),
1594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1595 "unknown Dell", STAC_DELL_M6_DMIC),
1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1597 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1599 "Dell Studio 17", STAC_DELL_M6_DMIC),
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1601 "Dell Studio 1555", STAC_DELL_M6_DMIC),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1603 "Dell Studio 1557", STAC_DELL_M6_DMIC),
1604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1605 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
1606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1607 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1611 static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1612 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1613 "Alienware M17x", STAC_ALIENWARE_M17X),
1614 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1615 "Alienware M17x", STAC_ALIENWARE_M17X),
1616 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
1617 "Alienware M17x R3", STAC_DELL_EQ),
1621 static const unsigned int ref92hd83xxx_pin_configs[10] = {
1622 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1623 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1624 0x01451160, 0x98560170,
1627 static const unsigned int dell_s14_pin_configs[10] = {
1628 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1629 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1630 0x40f000f0, 0x40f000f0,
1633 static const unsigned int dell_vostro_3500_pin_configs[10] = {
1634 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110,
1635 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160,
1636 0x400000f4, 0x400000f5,
1639 static const unsigned int hp_dv7_4000_pin_configs[10] = {
1640 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1641 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1642 0x40f000f0, 0x40f000f0,
1645 static const unsigned int hp_zephyr_pin_configs[10] = {
1646 0x01813050, 0x0421201f, 0x04a1205e, 0x96130310,
1647 0x96130310, 0x0101401f, 0x1111611f, 0xd5a30130,
1651 static const unsigned int hp_cNB11_intquad_pin_configs[10] = {
1652 0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110,
1653 0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130,
1654 0x40f000f0, 0x40f000f0,
1657 static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1658 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1659 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1660 [STAC_DELL_S14] = dell_s14_pin_configs,
1661 [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs,
1662 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs,
1663 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs,
1664 [STAC_HP_ZEPHYR] = hp_zephyr_pin_configs,
1667 static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1668 [STAC_92HD83XXX_AUTO] = "auto",
1669 [STAC_92HD83XXX_REF] = "ref",
1670 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1671 [STAC_DELL_S14] = "dell-s14",
1672 [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500",
1673 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad",
1674 [STAC_HP_DV7_4000] = "hp-dv7-4000",
1675 [STAC_HP_ZEPHYR] = "hp-zephyr",
1676 [STAC_92HD83XXX_HP_LED] = "hp-led",
1679 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1680 /* SigmaTel reference board */
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1682 "DFI LanParty", STAC_92HD83XXX_REF),
1683 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1684 "DFI LanParty", STAC_92HD83XXX_REF),
1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
1686 "unknown Dell", STAC_DELL_S14),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
1688 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
1690 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
1692 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1693 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
1694 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1695 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
1696 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1697 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
1698 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1699 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
1700 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1701 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
1702 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1703 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
1704 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1705 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
1706 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1707 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
1708 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1709 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
1710 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1711 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
1712 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1713 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
1714 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1715 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
1716 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
1718 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1719 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
1720 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1721 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
1722 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1723 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
1724 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1725 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
1726 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1727 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
1728 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1729 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
1730 "HP", STAC_HP_ZEPHYR),
1731 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
1732 "HP Mini", STAC_92HD83XXX_HP_LED),
1736 static const struct snd_pci_quirk stac92hd83xxx_codec_id_cfg_tbl[] = {
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
1738 "HP", STAC_HP_ZEPHYR),
1742 static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1743 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1744 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1745 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1749 static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1750 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1751 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1752 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1756 static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1757 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1758 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1759 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1763 static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1764 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1765 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1766 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1770 static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1771 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1772 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1773 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1774 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1775 [STAC_HP_M4] = NULL,
1776 [STAC_HP_DV4] = NULL,
1777 [STAC_HP_DV5] = NULL,
1778 [STAC_HP_HDX] = NULL,
1779 [STAC_HP_DV4_1222NR] = NULL,
1782 static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1783 [STAC_92HD71BXX_AUTO] = "auto",
1784 [STAC_92HD71BXX_REF] = "ref",
1785 [STAC_DELL_M4_1] = "dell-m4-1",
1786 [STAC_DELL_M4_2] = "dell-m4-2",
1787 [STAC_DELL_M4_3] = "dell-m4-3",
1788 [STAC_HP_M4] = "hp-m4",
1789 [STAC_HP_DV4] = "hp-dv4",
1790 [STAC_HP_DV5] = "hp-dv5",
1791 [STAC_HP_HDX] = "hp-hdx",
1792 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
1795 static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1796 /* SigmaTel reference board */
1797 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1798 "DFI LanParty", STAC_92HD71BXX_REF),
1799 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1800 "DFI LanParty", STAC_92HD71BXX_REF),
1801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb,
1802 "HP dv4-1222nr", STAC_HP_DV4_1222NR),
1803 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
1805 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
1807 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
1808 "HP dv4-7", STAC_HP_DV4),
1809 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
1810 "HP dv4-7", STAC_HP_DV5),
1811 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
1812 "HP HDX", STAC_HP_HDX), /* HDX18 */
1813 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1814 "HP mini 1000", STAC_HP_M4),
1815 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
1816 "HP HDX", STAC_HP_HDX), /* HDX16 */
1817 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
1818 "HP dv6", STAC_HP_DV5),
1819 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
1820 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
1821 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
1822 "HP DV6", STAC_HP_DV5),
1823 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
1825 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1826 "unknown Dell", STAC_DELL_M4_1),
1827 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1828 "unknown Dell", STAC_DELL_M4_1),
1829 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1830 "unknown Dell", STAC_DELL_M4_1),
1831 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1832 "unknown Dell", STAC_DELL_M4_1),
1833 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1834 "unknown Dell", STAC_DELL_M4_1),
1835 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1836 "unknown Dell", STAC_DELL_M4_1),
1837 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1838 "unknown Dell", STAC_DELL_M4_1),
1839 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1840 "unknown Dell", STAC_DELL_M4_2),
1841 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1842 "unknown Dell", STAC_DELL_M4_2),
1843 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1844 "unknown Dell", STAC_DELL_M4_2),
1845 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1846 "unknown Dell", STAC_DELL_M4_2),
1847 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1848 "unknown Dell", STAC_DELL_M4_3),
1852 static const unsigned int ref922x_pin_configs[10] = {
1853 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1854 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1855 0x40000100, 0x40000100,
1859 STAC 922X pin configs for
1866 static const unsigned int dell_922x_d81_pin_configs[10] = {
1867 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1868 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1869 0x01813122, 0x400001f2,
1873 STAC 922X pin configs for
1877 static const unsigned int dell_922x_d82_pin_configs[10] = {
1878 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1879 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1880 0x01813122, 0x400001f1,
1884 STAC 922X pin configs for
1887 static const unsigned int dell_922x_m81_pin_configs[10] = {
1888 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1889 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1890 0x40C003f1, 0x405003f0,
1894 STAC 9221 A1 pin configs for
1895 102801D7 (Dell XPS M1210)
1897 static const unsigned int dell_922x_m82_pin_configs[10] = {
1898 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1899 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1900 0x508003f3, 0x405003f4,
1903 static const unsigned int d945gtp3_pin_configs[10] = {
1904 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1905 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1906 0x02a19120, 0x40000100,
1909 static const unsigned int d945gtp5_pin_configs[10] = {
1910 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1911 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1912 0x02a19320, 0x40000100,
1915 static const unsigned int intel_mac_v1_pin_configs[10] = {
1916 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1917 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1918 0x400000fc, 0x400000fb,
1921 static const unsigned int intel_mac_v2_pin_configs[10] = {
1922 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1923 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1924 0x400000fc, 0x400000fb,
1927 static const unsigned int intel_mac_v3_pin_configs[10] = {
1928 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1929 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1930 0x400000fc, 0x400000fb,
1933 static const unsigned int intel_mac_v4_pin_configs[10] = {
1934 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1935 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1936 0x400000fc, 0x400000fb,
1939 static const unsigned int intel_mac_v5_pin_configs[10] = {
1940 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1941 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1942 0x400000fc, 0x400000fb,
1945 static const unsigned int ecs202_pin_configs[10] = {
1946 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1947 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1948 0x9037012e, 0x40e000f2,
1951 static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1952 [STAC_D945_REF] = ref922x_pin_configs,
1953 [STAC_D945GTP3] = d945gtp3_pin_configs,
1954 [STAC_D945GTP5] = d945gtp5_pin_configs,
1955 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1956 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1957 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1958 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1959 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1960 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
1961 /* for backward compatibility */
1962 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1963 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1964 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1965 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1966 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1967 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1968 [STAC_ECS_202] = ecs202_pin_configs,
1969 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1970 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1971 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1972 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1975 static const char * const stac922x_models[STAC_922X_MODELS] = {
1976 [STAC_922X_AUTO] = "auto",
1977 [STAC_D945_REF] = "ref",
1978 [STAC_D945GTP5] = "5stack",
1979 [STAC_D945GTP3] = "3stack",
1980 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1981 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1982 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1983 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1984 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1985 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
1986 /* for backward compatibility */
1987 [STAC_MACMINI] = "macmini",
1988 [STAC_MACBOOK] = "macbook",
1989 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1990 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1991 [STAC_IMAC_INTEL] = "imac-intel",
1992 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1993 [STAC_ECS_202] = "ecs202",
1994 [STAC_922X_DELL_D81] = "dell-d81",
1995 [STAC_922X_DELL_D82] = "dell-d82",
1996 [STAC_922X_DELL_M81] = "dell-m81",
1997 [STAC_922X_DELL_M82] = "dell-m82",
2000 static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
2001 /* SigmaTel reference board */
2002 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2003 "DFI LanParty", STAC_D945_REF),
2004 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2005 "DFI LanParty", STAC_D945_REF),
2006 /* Intel 945G based systems */
2007 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
2008 "Intel D945G", STAC_D945GTP3),
2009 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
2010 "Intel D945G", STAC_D945GTP3),
2011 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
2012 "Intel D945G", STAC_D945GTP3),
2013 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
2014 "Intel D945G", STAC_D945GTP3),
2015 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
2016 "Intel D945G", STAC_D945GTP3),
2017 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
2018 "Intel D945G", STAC_D945GTP3),
2019 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
2020 "Intel D945G", STAC_D945GTP3),
2021 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
2022 "Intel D945G", STAC_D945GTP3),
2023 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
2024 "Intel D945G", STAC_D945GTP3),
2025 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
2026 "Intel D945G", STAC_D945GTP3),
2027 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
2028 "Intel D945G", STAC_D945GTP3),
2029 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
2030 "Intel D945G", STAC_D945GTP3),
2031 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
2032 "Intel D945G", STAC_D945GTP3),
2033 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
2034 "Intel D945G", STAC_D945GTP3),
2035 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
2036 "Intel D945G", STAC_D945GTP3),
2037 /* Intel D945G 5-stack systems */
2038 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
2039 "Intel D945G", STAC_D945GTP5),
2040 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
2041 "Intel D945G", STAC_D945GTP5),
2042 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
2043 "Intel D945G", STAC_D945GTP5),
2044 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
2045 "Intel D945G", STAC_D945GTP5),
2046 /* Intel 945P based systems */
2047 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
2048 "Intel D945P", STAC_D945GTP3),
2049 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
2050 "Intel D945P", STAC_D945GTP3),
2051 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
2052 "Intel D945P", STAC_D945GTP3),
2053 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
2054 "Intel D945P", STAC_D945GTP3),
2055 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
2056 "Intel D945P", STAC_D945GTP3),
2057 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
2058 "Intel D945P", STAC_D945GTP5),
2060 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
2061 "Intel D945", STAC_D945_REF),
2063 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2064 SND_PCI_QUIRK(0x8384, 0x7680,
2065 "Mac", STAC_INTEL_MAC_AUTO),
2067 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2068 "unknown Dell", STAC_922X_DELL_D81),
2069 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
2070 "unknown Dell", STAC_922X_DELL_D81),
2071 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
2072 "unknown Dell", STAC_922X_DELL_D81),
2073 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
2074 "unknown Dell", STAC_922X_DELL_D82),
2075 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
2076 "unknown Dell", STAC_922X_DELL_M81),
2077 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
2078 "unknown Dell", STAC_922X_DELL_D82),
2079 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
2080 "unknown Dell", STAC_922X_DELL_D81),
2081 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
2082 "unknown Dell", STAC_922X_DELL_D81),
2083 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2084 "Dell XPS M1210", STAC_922X_DELL_M82),
2085 /* ECS/PC Chips boards */
2086 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2087 "ECS/PC chips", STAC_ECS_202),
2091 static const unsigned int ref927x_pin_configs[14] = {
2092 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2093 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2094 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2095 0x01c42190, 0x40000100,
2098 static const unsigned int d965_3st_pin_configs[14] = {
2099 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2100 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2101 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2102 0x40000100, 0x40000100
2105 static const unsigned int d965_5st_pin_configs[14] = {
2106 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2107 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2108 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2109 0x40000100, 0x40000100
2112 static const unsigned int d965_5st_no_fp_pin_configs[14] = {
2113 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2114 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2115 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2116 0x40000100, 0x40000100
2119 static const unsigned int dell_3st_pin_configs[14] = {
2120 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2121 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2122 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2123 0x40c003fc, 0x40000100
2126 static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2127 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2128 [STAC_D965_REF] = ref927x_pin_configs,
2129 [STAC_D965_3ST] = d965_3st_pin_configs,
2130 [STAC_D965_5ST] = d965_5st_pin_configs,
2131 [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs,
2132 [STAC_DELL_3ST] = dell_3st_pin_configs,
2133 [STAC_DELL_BIOS] = NULL,
2134 [STAC_927X_VOLKNOB] = NULL,
2137 static const char * const stac927x_models[STAC_927X_MODELS] = {
2138 [STAC_927X_AUTO] = "auto",
2139 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2140 [STAC_D965_REF] = "ref",
2141 [STAC_D965_3ST] = "3stack",
2142 [STAC_D965_5ST] = "5stack",
2143 [STAC_D965_5ST_NO_FP] = "5stack-no-fp",
2144 [STAC_DELL_3ST] = "dell-3stack",
2145 [STAC_DELL_BIOS] = "dell-bios",
2146 [STAC_927X_VOLKNOB] = "volknob",
2149 static const struct snd_pci_quirk stac927x_cfg_tbl[] = {
2150 /* SigmaTel reference board */
2151 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2152 "DFI LanParty", STAC_D965_REF),
2153 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2154 "DFI LanParty", STAC_D965_REF),
2155 /* Intel 946 based systems */
2156 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
2157 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
2158 /* 965 based 3 stack systems */
2159 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
2160 "Intel D965", STAC_D965_3ST),
2161 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
2162 "Intel D965", STAC_D965_3ST),
2163 /* Dell 3 stack systems */
2164 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2165 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2166 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2167 /* Dell 3 stack systems with verb table in BIOS */
2168 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2169 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
2170 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2171 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2172 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
2173 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
2174 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
2175 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
2176 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
2177 /* 965 based 5 stack systems */
2178 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
2179 "Intel D965", STAC_D965_5ST),
2180 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
2181 "Intel D965", STAC_D965_5ST),
2182 /* volume-knob fixes */
2183 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
2187 static const unsigned int ref9205_pin_configs[12] = {
2188 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2189 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2190 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2194 STAC 9205 pin configs for
2201 10280228 (Dell Vostro 1500)
2202 10280229 (Dell Vostro 1700)
2204 static const unsigned int dell_9205_m42_pin_configs[12] = {
2205 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2206 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2207 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2211 STAC 9205 pin configs for
2215 102801FF (Dell Precision M4300)
2220 static const unsigned int dell_9205_m43_pin_configs[12] = {
2221 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2222 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2223 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2226 static const unsigned int dell_9205_m44_pin_configs[12] = {
2227 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2228 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2229 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2232 static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2233 [STAC_9205_REF] = ref9205_pin_configs,
2234 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2235 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
2236 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
2237 [STAC_9205_EAPD] = NULL,
2240 static const char * const stac9205_models[STAC_9205_MODELS] = {
2241 [STAC_9205_AUTO] = "auto",
2242 [STAC_9205_REF] = "ref",
2243 [STAC_9205_DELL_M42] = "dell-m42",
2244 [STAC_9205_DELL_M43] = "dell-m43",
2245 [STAC_9205_DELL_M44] = "dell-m44",
2246 [STAC_9205_EAPD] = "eapd",
2249 static const struct snd_pci_quirk stac9205_cfg_tbl[] = {
2250 /* SigmaTel reference board */
2251 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2252 "DFI LanParty", STAC_9205_REF),
2253 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
2254 "SigmaTel", STAC_9205_REF),
2255 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2256 "DFI LanParty", STAC_9205_REF),
2258 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
2259 "unknown Dell", STAC_9205_DELL_M42),
2260 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
2261 "unknown Dell", STAC_9205_DELL_M42),
2262 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
2263 "Dell Precision", STAC_9205_DELL_M43),
2264 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
2265 "Dell Precision", STAC_9205_DELL_M43),
2266 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
2267 "Dell Precision", STAC_9205_DELL_M43),
2268 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
2269 "unknown Dell", STAC_9205_DELL_M42),
2270 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
2271 "unknown Dell", STAC_9205_DELL_M42),
2272 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
2273 "Dell Precision", STAC_9205_DELL_M43),
2274 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
2275 "Dell Precision M4300", STAC_9205_DELL_M43),
2276 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
2277 "unknown Dell", STAC_9205_DELL_M42),
2278 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
2279 "Dell Precision", STAC_9205_DELL_M43),
2280 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
2281 "Dell Precision", STAC_9205_DELL_M43),
2282 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
2283 "Dell Precision", STAC_9205_DELL_M43),
2284 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
2285 "Dell Inspiron", STAC_9205_DELL_M44),
2286 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2287 "Dell Vostro 1500", STAC_9205_DELL_M42),
2288 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
2289 "Dell Vostro 1700", STAC_9205_DELL_M42),
2291 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2292 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2296 static void stac92xx_set_config_regs(struct hda_codec *codec,
2297 const unsigned int *pincfgs)
2300 struct sigmatel_spec *spec = codec->spec;
2305 for (i = 0; i < spec->num_pins; i++)
2306 if (spec->pin_nids[i] && pincfgs[i])
2307 snd_hda_codec_set_pincfg(codec, spec->pin_nids[i],
2312 * Analog playback callbacks
2314 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
2315 struct hda_codec *codec,
2316 struct snd_pcm_substream *substream)
2318 struct sigmatel_spec *spec = codec->spec;
2319 if (spec->stream_delay)
2320 msleep(spec->stream_delay);
2321 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2325 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2326 struct hda_codec *codec,
2327 unsigned int stream_tag,
2328 unsigned int format,
2329 struct snd_pcm_substream *substream)
2331 struct sigmatel_spec *spec = codec->spec;
2332 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
2335 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2336 struct hda_codec *codec,
2337 struct snd_pcm_substream *substream)
2339 struct sigmatel_spec *spec = codec->spec;
2340 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2344 * Digital playback callbacks
2346 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2347 struct hda_codec *codec,
2348 struct snd_pcm_substream *substream)
2350 struct sigmatel_spec *spec = codec->spec;
2351 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2354 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2355 struct hda_codec *codec,
2356 struct snd_pcm_substream *substream)
2358 struct sigmatel_spec *spec = codec->spec;
2359 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2362 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2363 struct hda_codec *codec,
2364 unsigned int stream_tag,
2365 unsigned int format,
2366 struct snd_pcm_substream *substream)
2368 struct sigmatel_spec *spec = codec->spec;
2369 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2370 stream_tag, format, substream);
2373 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2374 struct hda_codec *codec,
2375 struct snd_pcm_substream *substream)
2377 struct sigmatel_spec *spec = codec->spec;
2378 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2383 * Analog capture callbacks
2385 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2386 struct hda_codec *codec,
2387 unsigned int stream_tag,
2388 unsigned int format,
2389 struct snd_pcm_substream *substream)
2391 struct sigmatel_spec *spec = codec->spec;
2392 hda_nid_t nid = spec->adc_nids[substream->number];
2394 if (spec->powerdown_adcs) {
2396 snd_hda_codec_write(codec, nid, 0,
2397 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
2399 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
2403 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2404 struct hda_codec *codec,
2405 struct snd_pcm_substream *substream)
2407 struct sigmatel_spec *spec = codec->spec;
2408 hda_nid_t nid = spec->adc_nids[substream->number];
2410 snd_hda_codec_cleanup_stream(codec, nid);
2411 if (spec->powerdown_adcs)
2412 snd_hda_codec_write(codec, nid, 0,
2413 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2417 static const struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2421 /* NID is set in stac92xx_build_pcms */
2423 .open = stac92xx_dig_playback_pcm_open,
2424 .close = stac92xx_dig_playback_pcm_close,
2425 .prepare = stac92xx_dig_playback_pcm_prepare,
2426 .cleanup = stac92xx_dig_playback_pcm_cleanup
2430 static const struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2434 /* NID is set in stac92xx_build_pcms */
2437 static const struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2441 .nid = 0x02, /* NID to query formats and rates */
2443 .open = stac92xx_playback_pcm_open,
2444 .prepare = stac92xx_playback_pcm_prepare,
2445 .cleanup = stac92xx_playback_pcm_cleanup
2449 static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2453 .nid = 0x06, /* NID to query formats and rates */
2455 .open = stac92xx_playback_pcm_open,
2456 .prepare = stac92xx_playback_pcm_prepare,
2457 .cleanup = stac92xx_playback_pcm_cleanup
2461 static const struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2464 /* NID + .substreams is set in stac92xx_build_pcms */
2466 .prepare = stac92xx_capture_pcm_prepare,
2467 .cleanup = stac92xx_capture_pcm_cleanup
2471 static int stac92xx_build_pcms(struct hda_codec *codec)
2473 struct sigmatel_spec *spec = codec->spec;
2474 struct hda_pcm *info = spec->pcm_rec;
2476 codec->num_pcms = 1;
2477 codec->pcm_info = info;
2479 info->name = "STAC92xx Analog";
2480 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2481 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2482 spec->multiout.dac_nids[0];
2483 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2484 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2485 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2487 if (spec->alt_switch) {
2490 info->name = "STAC92xx Analog Alt";
2491 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2494 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2497 info->name = "STAC92xx Digital";
2498 info->pcm_type = spec->autocfg.dig_out_type[0];
2499 if (spec->multiout.dig_out_nid) {
2500 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2501 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2503 if (spec->dig_in_nid) {
2504 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2505 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2512 static unsigned int stac92xx_get_default_vref(struct hda_codec *codec,
2515 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2516 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2517 if (pincap & AC_PINCAP_VREF_100)
2518 return AC_PINCTL_VREF_100;
2519 if (pincap & AC_PINCAP_VREF_80)
2520 return AC_PINCTL_VREF_80;
2521 if (pincap & AC_PINCAP_VREF_50)
2522 return AC_PINCTL_VREF_50;
2523 if (pincap & AC_PINCAP_VREF_GRD)
2524 return AC_PINCTL_VREF_GRD;
2528 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2531 snd_hda_codec_write_cache(codec, nid, 0,
2532 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2535 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2537 static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol,
2538 struct snd_ctl_elem_value *ucontrol)
2540 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2541 struct sigmatel_spec *spec = codec->spec;
2543 ucontrol->value.integer.value[0] = !!spec->hp_switch;
2547 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid);
2549 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol,
2550 struct snd_ctl_elem_value *ucontrol)
2552 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2553 struct sigmatel_spec *spec = codec->spec;
2554 int nid = kcontrol->private_value;
2556 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0;
2558 /* check to be sure that the ports are up to date with
2561 stac_issue_unsol_event(codec, nid);
2566 static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol,
2567 struct snd_ctl_elem_info *uinfo)
2570 static const char * const texts[] = {
2571 "Mic In", "Line In", "Line Out"
2574 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2575 struct sigmatel_spec *spec = codec->spec;
2576 hda_nid_t nid = kcontrol->private_value;
2578 if (nid == spec->mic_switch || nid == spec->line_switch)
2583 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2584 uinfo->value.enumerated.items = i;
2586 if (uinfo->value.enumerated.item >= i)
2587 uinfo->value.enumerated.item = i-1;
2588 strcpy(uinfo->value.enumerated.name,
2589 texts[uinfo->value.enumerated.item]);
2594 static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol,
2595 struct snd_ctl_elem_value *ucontrol)
2597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2598 hda_nid_t nid = kcontrol->private_value;
2599 unsigned int vref = stac92xx_vref_get(codec, nid);
2601 if (vref == stac92xx_get_default_vref(codec, nid))
2602 ucontrol->value.enumerated.item[0] = 0;
2603 else if (vref == AC_PINCTL_VREF_GRD)
2604 ucontrol->value.enumerated.item[0] = 1;
2605 else if (vref == AC_PINCTL_VREF_HIZ)
2606 ucontrol->value.enumerated.item[0] = 2;
2611 static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol,
2612 struct snd_ctl_elem_value *ucontrol)
2614 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2615 unsigned int new_vref = 0;
2617 hda_nid_t nid = kcontrol->private_value;
2619 if (ucontrol->value.enumerated.item[0] == 0)
2620 new_vref = stac92xx_get_default_vref(codec, nid);
2621 else if (ucontrol->value.enumerated.item[0] == 1)
2622 new_vref = AC_PINCTL_VREF_GRD;
2623 else if (ucontrol->value.enumerated.item[0] == 2)
2624 new_vref = AC_PINCTL_VREF_HIZ;
2628 if (new_vref != stac92xx_vref_get(codec, nid)) {
2629 error = stac92xx_vref_set(codec, nid, new_vref);
2636 static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol,
2637 struct snd_ctl_elem_info *uinfo)
2640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2641 struct sigmatel_spec *spec = codec->spec;
2643 if (kcontrol->private_value == spec->line_switch)
2644 texts[0] = "Line In";
2646 texts[0] = "Mic In";
2647 texts[1] = "Line Out";
2648 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2649 uinfo->value.enumerated.items = 2;
2652 if (uinfo->value.enumerated.item >= 2)
2653 uinfo->value.enumerated.item = 1;
2654 strcpy(uinfo->value.enumerated.name,
2655 texts[uinfo->value.enumerated.item]);
2660 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2663 struct sigmatel_spec *spec = codec->spec;
2664 hda_nid_t nid = kcontrol->private_value;
2665 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2667 ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx];
2671 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2673 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2674 struct sigmatel_spec *spec = codec->spec;
2675 hda_nid_t nid = kcontrol->private_value;
2676 int io_idx = (nid == spec->mic_switch) ? 1 : 0;
2677 unsigned short val = !!ucontrol->value.enumerated.item[0];
2679 spec->io_switch[io_idx] = val;
2682 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2684 unsigned int pinctl = AC_PINCTL_IN_EN;
2685 if (io_idx) /* set VREF for mic */
2686 pinctl |= stac92xx_get_default_vref(codec, nid);
2687 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2690 /* check the auto-mute again: we need to mute/unmute the speaker
2691 * appropriately according to the pin direction
2693 if (spec->hp_detect)
2694 stac_issue_unsol_event(codec, nid);
2699 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2701 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2702 struct snd_ctl_elem_value *ucontrol)
2704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2705 struct sigmatel_spec *spec = codec->spec;
2707 ucontrol->value.integer.value[0] = spec->clfe_swap;
2711 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2712 struct snd_ctl_elem_value *ucontrol)
2714 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2715 struct sigmatel_spec *spec = codec->spec;
2716 hda_nid_t nid = kcontrol->private_value & 0xff;
2717 unsigned int val = !!ucontrol->value.integer.value[0];
2719 if (spec->clfe_swap == val)
2722 spec->clfe_swap = val;
2724 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2725 spec->clfe_swap ? 0x4 : 0x0);
2730 #define STAC_CODEC_HP_SWITCH(xname) \
2731 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2734 .info = stac92xx_hp_switch_info, \
2735 .get = stac92xx_hp_switch_get, \
2736 .put = stac92xx_hp_switch_put, \
2739 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2740 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2743 .info = stac92xx_io_switch_info, \
2744 .get = stac92xx_io_switch_get, \
2745 .put = stac92xx_io_switch_put, \
2746 .private_value = xpval, \
2749 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2750 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2753 .info = stac92xx_clfe_switch_info, \
2754 .get = stac92xx_clfe_switch_get, \
2755 .put = stac92xx_clfe_switch_put, \
2756 .private_value = xpval, \
2760 STAC_CTL_WIDGET_VOL,
2761 STAC_CTL_WIDGET_MUTE,
2762 STAC_CTL_WIDGET_MUTE_BEEP,
2763 STAC_CTL_WIDGET_MONO_MUX,
2764 STAC_CTL_WIDGET_HP_SWITCH,
2765 STAC_CTL_WIDGET_IO_SWITCH,
2766 STAC_CTL_WIDGET_CLFE_SWITCH,
2767 STAC_CTL_WIDGET_DC_BIAS
2770 static const struct snd_kcontrol_new stac92xx_control_templates[] = {
2771 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2772 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2773 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0),
2775 STAC_CODEC_HP_SWITCH(NULL),
2776 STAC_CODEC_IO_SWITCH(NULL, 0),
2777 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2778 DC_BIAS(NULL, 0, 0),
2781 /* add dynamic controls */
2782 static struct snd_kcontrol_new *
2783 stac_control_new(struct sigmatel_spec *spec,
2784 const struct snd_kcontrol_new *ktemp,
2786 unsigned int subdev)
2788 struct snd_kcontrol_new *knew;
2790 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2791 knew = snd_array_new(&spec->kctls);
2795 knew->name = kstrdup(name, GFP_KERNEL);
2798 memset(knew, 0, sizeof(*knew));
2799 spec->kctls.alloced--;
2802 knew->subdevice = subdev;
2806 static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2807 const struct snd_kcontrol_new *ktemp,
2808 int idx, const char *name,
2811 struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name,
2812 HDA_SUBDEV_AMP_FLAG);
2816 knew->private_value = val;
2820 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
2821 int type, int idx, const char *name,
2824 return stac92xx_add_control_temp(spec,
2825 &stac92xx_control_templates[type],
2830 /* add dynamic controls */
2831 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2832 const char *name, unsigned long val)
2834 return stac92xx_add_control_idx(spec, type, 0, name, val);
2837 static const struct snd_kcontrol_new stac_input_src_temp = {
2838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2839 .name = "Input Source",
2840 .info = stac92xx_mux_enum_info,
2841 .get = stac92xx_mux_enum_get,
2842 .put = stac92xx_mux_enum_put,
2845 static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
2846 hda_nid_t nid, int idx)
2848 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
2850 struct sigmatel_spec *spec = codec->spec;
2853 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2854 if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD
2855 && nid == spec->line_switch)
2856 control = STAC_CTL_WIDGET_IO_SWITCH;
2857 else if (snd_hda_query_pin_caps(codec, nid)
2858 & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT))
2859 control = STAC_CTL_WIDGET_DC_BIAS;
2860 else if (nid == spec->mic_switch)
2861 control = STAC_CTL_WIDGET_IO_SWITCH;
2865 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
2866 name, sizeof(name), NULL);
2867 return stac92xx_add_control(codec->spec, control,
2868 strcat(name, " Jack Mode"), nid);
2874 static int stac92xx_add_input_source(struct sigmatel_spec *spec)
2876 struct snd_kcontrol_new *knew;
2877 struct hda_input_mux *imux = &spec->private_imux;
2880 return 0; /* no need for input source */
2881 if (!spec->num_adcs || imux->num_items <= 1)
2882 return 0; /* no need for input source control */
2883 knew = stac_control_new(spec, &stac_input_src_temp,
2884 stac_input_src_temp.name, 0);
2887 knew->count = spec->num_adcs;
2891 /* check whether the line-input can be used as line-out */
2892 static hda_nid_t check_line_out_switch(struct hda_codec *codec)
2894 struct sigmatel_spec *spec = codec->spec;
2895 struct auto_pin_cfg *cfg = &spec->autocfg;
2897 unsigned int pincap;
2900 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2902 for (i = 0; i < cfg->num_inputs; i++) {
2903 if (cfg->inputs[i].type == AUTO_PIN_LINE_IN) {
2904 nid = cfg->inputs[i].pin;
2905 pincap = snd_hda_query_pin_caps(codec, nid);
2906 if (pincap & AC_PINCAP_OUT)
2913 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid);
2915 /* check whether the mic-input can be used as line-out */
2916 static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac)
2918 struct sigmatel_spec *spec = codec->spec;
2919 struct auto_pin_cfg *cfg = &spec->autocfg;
2920 unsigned int def_conf, pincap;
2924 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2926 for (i = 0; i < cfg->num_inputs; i++) {
2927 hda_nid_t nid = cfg->inputs[i].pin;
2928 if (cfg->inputs[i].type != AUTO_PIN_MIC)
2930 def_conf = snd_hda_codec_get_pincfg(codec, nid);
2931 /* some laptops have an internal analog microphone
2932 * which can't be used as a output */
2933 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2934 pincap = snd_hda_query_pin_caps(codec, nid);
2935 if (pincap & AC_PINCAP_OUT) {
2936 *dac = get_unassigned_dac(codec, nid);
2945 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2949 for (i = 0; i < spec->multiout.num_dacs; i++) {
2950 if (spec->multiout.dac_nids[i] == nid)
2957 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2960 if (is_in_dac_nids(spec, nid))
2962 for (i = 0; i < spec->autocfg.hp_outs; i++)
2963 if (spec->hp_dacs[i] == nid)
2965 for (i = 0; i < spec->autocfg.speaker_outs; i++)
2966 if (spec->speaker_dacs[i] == nid)
2971 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
2973 struct sigmatel_spec *spec = codec->spec;
2974 struct auto_pin_cfg *cfg = &spec->autocfg;
2976 hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac;
2977 unsigned int wcaps, wtype;
2979 conn_len = snd_hda_get_connections(codec, nid, conn,
2980 HDA_MAX_CONNECTIONS);
2981 /* 92HD88: trace back up the link of nids to find the DAC */
2982 while (conn_len == 1 && (get_wcaps_type(get_wcaps(codec, conn[0]))
2983 != AC_WID_AUD_OUT)) {
2985 conn_len = snd_hda_get_connections(codec, nid, conn,
2986 HDA_MAX_CONNECTIONS);
2988 for (j = 0; j < conn_len; j++) {
2989 wcaps = get_wcaps(codec, conn[j]);
2990 wtype = get_wcaps_type(wcaps);
2991 /* we check only analog outputs */
2992 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))
2994 /* if this route has a free DAC, assign it */
2995 if (!check_all_dac_nids(spec, conn[j])) {
2997 /* select this DAC in the pin's input mux */
2998 snd_hda_codec_write_cache(codec, nid, 0,
2999 AC_VERB_SET_CONNECT_SEL, j);
3005 /* if all DACs are already assigned, connect to the primary DAC,
3006 unless we're assigning a secondary headphone */
3007 fallback_dac = spec->multiout.dac_nids[0];
3008 if (spec->multiout.hp_nid) {
3009 for (j = 0; j < cfg->hp_outs; j++)
3010 if (cfg->hp_pins[j] == nid) {
3011 fallback_dac = spec->multiout.hp_nid;
3017 for (j = 0; j < conn_len; j++) {
3018 if (conn[j] == fallback_dac) {
3019 snd_hda_codec_write_cache(codec, nid, 0,
3020 AC_VERB_SET_CONNECT_SEL, j);
3028 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3029 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid);
3032 * Fill in the dac_nids table from the parsed pin configuration
3033 * This function only works when every pin in line_out_pins[]
3034 * contains atleast one DAC in its connection list. Some 92xx
3035 * codecs are not connected directly to a DAC, such as the 9200
3036 * and 9202/925x. For those, dac_nids[] must be hard-coded.
3038 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec)
3040 struct sigmatel_spec *spec = codec->spec;
3041 struct auto_pin_cfg *cfg = &spec->autocfg;
3045 for (i = 0; i < cfg->line_outs; i++) {
3046 nid = cfg->line_out_pins[i];
3047 dac = get_unassigned_dac(codec, nid);
3049 if (spec->multiout.num_dacs > 0) {
3050 /* we have already working output pins,
3051 * so let's drop the broken ones again
3053 cfg->line_outs = spec->multiout.num_dacs;
3056 /* error out, no available DAC found */
3058 "%s: No available DAC for pin 0x%x\n",
3062 add_spec_dacs(spec, dac);
3065 for (i = 0; i < cfg->hp_outs; i++) {
3066 nid = cfg->hp_pins[i];
3067 dac = get_unassigned_dac(codec, nid);
3069 if (!spec->multiout.hp_nid)
3070 spec->multiout.hp_nid = dac;
3072 add_spec_extra_dacs(spec, dac);
3074 spec->hp_dacs[i] = dac;
3077 for (i = 0; i < cfg->speaker_outs; i++) {
3078 nid = cfg->speaker_pins[i];
3079 dac = get_unassigned_dac(codec, nid);
3081 add_spec_extra_dacs(spec, dac);
3082 spec->speaker_dacs[i] = dac;
3085 /* add line-in as output */
3086 nid = check_line_out_switch(codec);
3088 dac = get_unassigned_dac(codec, nid);
3090 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
3091 nid, cfg->line_outs);
3092 cfg->line_out_pins[cfg->line_outs] = nid;
3094 spec->line_switch = nid;
3095 add_spec_dacs(spec, dac);
3098 /* add mic as output */
3099 nid = check_mic_out_switch(codec, &dac);
3101 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
3102 nid, cfg->line_outs);
3103 cfg->line_out_pins[cfg->line_outs] = nid;
3105 spec->mic_switch = nid;
3106 add_spec_dacs(spec, dac);
3109 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
3110 spec->multiout.num_dacs,
3111 spec->multiout.dac_nids[0],
3112 spec->multiout.dac_nids[1],
3113 spec->multiout.dac_nids[2],
3114 spec->multiout.dac_nids[3],
3115 spec->multiout.dac_nids[4]);
3120 /* create volume control/switch for the given prefx type */
3121 static int create_controls_idx(struct hda_codec *codec, const char *pfx,
3122 int idx, hda_nid_t nid, int chs)
3124 struct sigmatel_spec *spec = codec->spec;
3128 if (!spec->check_volume_offset) {
3129 unsigned int caps, step, nums, db_scale;
3130 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3131 step = (caps & AC_AMPCAP_STEP_SIZE) >>
3132 AC_AMPCAP_STEP_SIZE_SHIFT;
3133 step = (step + 1) * 25; /* in .01dB unit */
3134 nums = (caps & AC_AMPCAP_NUM_STEPS) >>
3135 AC_AMPCAP_NUM_STEPS_SHIFT;
3136 db_scale = nums * step;
3137 /* if dB scale is over -64dB, and finer enough,
3138 * let's reduce it to half
3140 if (db_scale > 6400 && nums >= 0x1f)
3141 spec->volume_offset = nums / 2;
3142 spec->check_volume_offset = 1;
3145 sprintf(name, "%s Playback Volume", pfx);
3146 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name,
3147 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT,
3148 spec->volume_offset));
3151 sprintf(name, "%s Playback Switch", pfx);
3152 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name,
3153 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
3159 #define create_controls(codec, pfx, nid, chs) \
3160 create_controls_idx(codec, pfx, 0, nid, chs)
3162 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3164 if (spec->multiout.num_dacs > 4) {
3165 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
3168 snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
3169 spec->dac_nids[spec->multiout.num_dacs] = nid;
3170 spec->multiout.num_dacs++;
3175 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3178 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) {
3179 if (!spec->multiout.extra_out_nid[i]) {
3180 spec->multiout.extra_out_nid[i] = nid;
3184 printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid);
3188 /* Create output controls
3189 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
3191 static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3192 const hda_nid_t *pins,
3193 const hda_nid_t *dac_nids,
3196 struct sigmatel_spec *spec = codec->spec;
3197 static const char * const chname[4] = {
3198 "Front", "Surround", NULL /*CLFE*/, "Side"
3202 unsigned int wid_caps;
3204 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
3205 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
3206 if (is_jack_detectable(codec, pins[i]))
3207 spec->hp_detect = 1;
3212 if (type != AUTO_PIN_HP_OUT && i == 2) {
3214 err = create_controls(codec, "Center", nid, 1);
3217 err = create_controls(codec, "LFE", nid, 2);
3221 wid_caps = get_wcaps(codec, nid);
3223 if (wid_caps & AC_WCAP_LR_SWAP) {
3224 err = stac92xx_add_control(spec,
3225 STAC_CTL_WIDGET_CLFE_SWITCH,
3226 "Swap Center/LFE Playback Switch", nid);
3236 case AUTO_PIN_HP_OUT:
3240 case AUTO_PIN_SPEAKER_OUT:
3249 err = create_controls_idx(codec, name, idx, nid, 3);
3257 static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol,
3258 unsigned long sw, int idx)
3261 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx,
3262 "Capture Volume", vol);
3265 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx,
3266 "Capture Switch", sw);
3272 /* add playback controls from the parsed DAC table */
3273 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
3274 const struct auto_pin_cfg *cfg)
3276 struct sigmatel_spec *spec = codec->spec;
3281 err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins,
3282 spec->multiout.dac_nids,
3283 cfg->line_out_type);
3287 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
3288 err = stac92xx_add_control(spec,
3289 STAC_CTL_WIDGET_HP_SWITCH,
3290 "Headphone as Line Out Switch",
3291 cfg->hp_pins[cfg->hp_outs - 1]);
3296 for (idx = 0; idx < cfg->num_inputs; idx++) {
3297 if (cfg->inputs[idx].type > AUTO_PIN_LINE_IN)
3299 nid = cfg->inputs[idx].pin;
3300 err = stac92xx_add_jack_mode_control(codec, nid, idx);
3308 /* add playback controls for Speaker and HP outputs */
3309 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3310 struct auto_pin_cfg *cfg)
3312 struct sigmatel_spec *spec = codec->spec;
3315 err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins,
3316 spec->hp_dacs, AUTO_PIN_HP_OUT);
3320 err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins,
3321 spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT);
3328 /* labels for mono mux outputs */
3329 static const char * const stac92xx_mono_labels[4] = {
3330 "DAC0", "DAC1", "Mixer", "DAC2"
3333 /* create mono mux for mono out on capable codecs */
3334 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3336 struct sigmatel_spec *spec = codec->spec;
3337 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
3339 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
3341 num_cons = snd_hda_get_connections(codec,
3344 HDA_MAX_NUM_INPUTS);
3345 if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
3348 for (i = 0; i < num_cons; i++)
3349 snd_hda_add_imux_item(mono_mux, stac92xx_mono_labels[i], i,
3352 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
3353 "Mono Mux", spec->mono_nid);
3356 /* create PC beep volume controls */
3357 static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
3360 struct sigmatel_spec *spec = codec->spec;
3361 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3362 int err, type = STAC_CTL_WIDGET_MUTE_BEEP;
3364 if (spec->anabeep_nid == nid)
3365 type = STAC_CTL_WIDGET_MUTE;
3367 /* check for mute support for the the amp */
3368 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
3369 err = stac92xx_add_control(spec, type,
3370 "Beep Playback Switch",
3371 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3376 /* check to see if there is volume support for the amp */
3377 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3378 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
3379 "Beep Playback Volume",
3380 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT));
3387 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3388 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3390 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
3391 struct snd_ctl_elem_value *ucontrol)
3393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3394 ucontrol->value.integer.value[0] = codec->beep->enabled;
3398 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3399 struct snd_ctl_elem_value *ucontrol)
3401 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3402 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
3405 static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3407 .info = stac92xx_dig_beep_switch_info,
3408 .get = stac92xx_dig_beep_switch_get,
3409 .put = stac92xx_dig_beep_switch_put,
3412 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
3414 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
3415 0, "Beep Playback Switch", 0);
3419 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3421 struct sigmatel_spec *spec = codec->spec;
3424 for (i = 0; i < spec->num_muxes; i++) {
3429 nid = spec->mux_nids[i];
3430 wcaps = get_wcaps(codec, nid);
3431 if (!(wcaps & AC_WCAP_OUT_AMP))
3434 /* check whether already the same control was created as
3435 * normal Capture Volume.
3437 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
3438 for (j = 0; j < spec->num_caps; j++) {
3439 if (spec->capvols[j] == val)
3442 if (j < spec->num_caps)
3445 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, i,
3446 "Mux Capture Volume", val);
3453 static const char * const stac92xx_spdif_labels[3] = {
3454 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3457 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3459 struct sigmatel_spec *spec = codec->spec;
3460 struct hda_input_mux *spdif_mux = &spec->private_smux;
3461 const char * const *labels = spec->spdif_labels;
3463 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3465 num_cons = snd_hda_get_connections(codec,
3468 HDA_MAX_NUM_INPUTS);
3473 labels = stac92xx_spdif_labels;
3475 for (i = 0; i < num_cons; i++)
3476 snd_hda_add_imux_item(spdif_mux, labels[i], i, NULL);
3481 /* labels for dmic mux inputs */
3482 static const char * const stac92xx_dmic_labels[5] = {
3483 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3484 "Digital Mic 3", "Digital Mic 4"
3487 static hda_nid_t get_connected_node(struct hda_codec *codec, hda_nid_t mux,
3490 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
3492 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
3493 if (idx >= 0 && idx < nums)
3498 /* look for NID recursively */
3499 #define get_connection_index(codec, mux, nid) \
3500 snd_hda_get_conn_index(codec, mux, nid, 1)
3502 /* create a volume assigned to the given pin (only if supported) */
3503 /* return 1 if the volume control is created */
3504 static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid,
3505 const char *label, int idx, int direction)
3507 unsigned int caps, nums;
3511 if (direction == HDA_OUTPUT)
3512 caps = AC_WCAP_OUT_AMP;
3514 caps = AC_WCAP_IN_AMP;
3515 if (!(get_wcaps(codec, nid) & caps))
3517 caps = query_amp_caps(codec, nid, direction);
3518 nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;
3521 snprintf(name, sizeof(name), "%s Capture Volume", label);
3522 err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, name,
3523 HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction));
3529 /* create playback/capture controls for input pins on dmic capable codecs */
3530 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3531 const struct auto_pin_cfg *cfg)
3533 struct sigmatel_spec *spec = codec->spec;
3534 struct hda_input_mux *imux = &spec->private_imux;
3535 struct hda_input_mux *dimux = &spec->private_dimux;
3537 unsigned int def_conf;
3539 snd_hda_add_imux_item(dimux, stac92xx_dmic_labels[0], 0, NULL);
3541 for (i = 0; i < spec->num_dmics; i++) {
3543 int index, type_idx;
3546 nid = spec->dmic_nids[i];
3547 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
3549 def_conf = snd_hda_codec_get_pincfg(codec, nid);
3550 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
3553 index = get_connection_index(codec, spec->dmux_nids[0], nid);
3557 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
3558 label, sizeof(label), NULL);
3559 snd_hda_add_imux_item(dimux, label, index, &type_idx);
3560 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1)
3561 snd_hda_add_imux_item(imux, label, index, &type_idx);
3563 err = create_elem_capture_vol(codec, nid, label, type_idx,
3568 err = create_elem_capture_vol(codec, nid, label,
3569 type_idx, HDA_OUTPUT);
3573 nid = get_connected_node(codec,
3574 spec->dmux_nids[0], index);
3576 err = create_elem_capture_vol(codec,
3578 type_idx, HDA_INPUT);
3588 static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
3589 hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
3596 cfg = snd_hda_codec_get_pincfg(codec, nid);
3597 type = get_defcfg_device(cfg);
3598 switch (snd_hda_get_input_pin_attr(cfg)) {
3599 case INPUT_PIN_ATTR_INT:
3601 return 1; /* already occupied */
3602 if (type != AC_JACK_MIC_IN)
3603 return 1; /* invalid type */
3606 case INPUT_PIN_ATTR_UNUSED:
3608 case INPUT_PIN_ATTR_DOCK:
3610 return 1; /* already occupied */
3611 if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN)
3612 return 1; /* invalid type */
3617 return 1; /* already occupied */
3618 if (type != AC_JACK_MIC_IN)
3619 return 1; /* invalid type */
3626 static int set_mic_route(struct hda_codec *codec,
3627 struct sigmatel_mic_route *mic,
3630 struct sigmatel_spec *spec = codec->spec;
3631 struct auto_pin_cfg *cfg = &spec->autocfg;
3637 for (i = 0; i < cfg->num_inputs; i++) {
3638 if (pin == cfg->inputs[i].pin)
3641 if (i < cfg->num_inputs && cfg->inputs[i].type == AUTO_PIN_MIC) {
3643 i = get_connection_index(codec, spec->mux_nids[0], pin);
3648 if (spec->dmux_nids)
3649 mic->dmux_idx = get_connection_index(codec,
3652 } else if (spec->dmux_nids) {
3654 i = get_connection_index(codec, spec->dmux_nids[0], pin);
3660 mic->mux_idx = get_connection_index(codec,
3662 spec->dmux_nids[0]);
3667 /* return non-zero if the device is for automatic mic switch */
3668 static int stac_check_auto_mic(struct hda_codec *codec)
3670 struct sigmatel_spec *spec = codec->spec;
3671 struct auto_pin_cfg *cfg = &spec->autocfg;
3672 hda_nid_t fixed, ext, dock;
3675 fixed = ext = dock = 0;
3676 for (i = 0; i < cfg->num_inputs; i++)
3677 if (check_mic_pin(codec, cfg->inputs[i].pin,
3678 &fixed, &ext, &dock))
3680 for (i = 0; i < spec->num_dmics; i++)
3681 if (check_mic_pin(codec, spec->dmic_nids[i],
3682 &fixed, &ext, &dock))
3684 if (!fixed || (!ext && !dock))
3685 return 0; /* no input to switch */
3686 if (!is_jack_detectable(codec, ext))
3687 return 0; /* no unsol support */
3688 if (set_mic_route(codec, &spec->ext_mic, ext) ||
3689 set_mic_route(codec, &spec->int_mic, fixed) ||
3690 set_mic_route(codec, &spec->dock_mic, dock))
3691 return 0; /* something is wrong */
3695 /* create playback/capture controls for input pins */
3696 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
3698 struct sigmatel_spec *spec = codec->spec;
3699 struct hda_input_mux *imux = &spec->private_imux;
3703 for (i = 0; i < cfg->num_inputs; i++) {
3704 hda_nid_t nid = cfg->inputs[i].pin;
3705 int index, err, type_idx;
3708 for (j = 0; j < spec->num_muxes; j++) {
3709 index = get_connection_index(codec, spec->mux_nids[j],
3717 label = hda_get_autocfg_input_label(codec, cfg, i);
3718 snd_hda_add_imux_item(imux, label, index, &type_idx);
3720 err = create_elem_capture_vol(codec, nid,
3726 spec->num_analog_muxes = imux->num_items;
3728 if (imux->num_items) {
3730 * Set the current input for the muxes.
3731 * The STAC9221 has two input muxes with identical source
3732 * NID lists. Hopefully this won't get confused.
3734 for (i = 0; i < spec->num_muxes; i++) {
3735 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
3736 AC_VERB_SET_CONNECT_SEL,
3737 imux->items[0].index);
3744 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
3746 struct sigmatel_spec *spec = codec->spec;
3749 for (i = 0; i < spec->autocfg.line_outs; i++) {
3750 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3751 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
3755 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3757 struct sigmatel_spec *spec = codec->spec;
3760 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3762 pin = spec->autocfg.hp_pins[i];
3763 if (pin) /* connect to front */
3764 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3766 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3768 pin = spec->autocfg.speaker_pins[i];
3769 if (pin) /* connect to front */
3770 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
3774 static int is_dual_headphones(struct hda_codec *codec)
3776 struct sigmatel_spec *spec = codec->spec;
3779 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT ||
3780 spec->autocfg.hp_outs <= 1)
3783 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3784 hda_nid_t nid = spec->autocfg.hp_pins[i];
3785 unsigned int cfg = snd_hda_codec_get_pincfg(codec, nid);
3786 if (get_defcfg_location(cfg) & AC_JACK_LOC_SEPARATE)
3790 return (valid_hps > 1);
3794 static int stac92xx_parse_auto_config(struct hda_codec *codec)
3796 struct sigmatel_spec *spec = codec->spec;
3797 hda_nid_t dig_out = 0, dig_in = 0;
3801 if ((err = snd_hda_parse_pin_def_config(codec,
3803 spec->dmic_nids)) < 0)
3805 if (! spec->autocfg.line_outs)
3806 return 0; /* can't find valid pin config */
3808 /* If we have no real line-out pin and multiple hp-outs, HPs should
3809 * be set up as multi-channel outputs.
3811 if (is_dual_headphones(codec)) {
3812 /* Copy hp_outs to line_outs, backup line_outs in
3813 * speaker_outs so that the following routines can handle
3814 * HP pins as primary outputs.
3816 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
3817 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
3818 sizeof(spec->autocfg.line_out_pins));
3819 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
3820 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
3821 sizeof(spec->autocfg.hp_pins));
3822 spec->autocfg.line_outs = spec->autocfg.hp_outs;
3823 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3824 spec->autocfg.hp_outs = 0;
3827 if (spec->autocfg.mono_out_pin) {
3828 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3829 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
3830 u32 caps = query_amp_caps(codec,
3831 spec->autocfg.mono_out_pin, dir);
3832 hda_nid_t conn_list[1];
3834 /* get the mixer node and then the mono mux if it exists */
3835 if (snd_hda_get_connections(codec,
3836 spec->autocfg.mono_out_pin, conn_list, 1) &&
3837 snd_hda_get_connections(codec, conn_list[0],
3838 conn_list, 1) > 0) {
3840 int wcaps = get_wcaps(codec, conn_list[0]);
3841 int wid_type = get_wcaps_type(wcaps);
3842 /* LR swap check, some stac925x have a mux that
3843 * changes the DACs output path instead of the
3846 if (wid_type == AC_WID_AUD_SEL &&
3847 !(wcaps & AC_WCAP_LR_SWAP))
3848 spec->mono_nid = conn_list[0];
3851 hda_nid_t nid = spec->autocfg.mono_out_pin;
3853 /* most mono outs have a least a mute/unmute switch */
3854 dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
3855 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
3856 "Mono Playback Switch",
3857 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3860 /* check for volume support for the amp */
3861 if ((caps & AC_AMPCAP_NUM_STEPS)
3862 >> AC_AMPCAP_NUM_STEPS_SHIFT) {
3863 err = stac92xx_add_control(spec,
3864 STAC_CTL_WIDGET_VOL,
3865 "Mono Playback Volume",
3866 HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir));
3872 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
3876 if (!spec->multiout.num_dacs) {
3877 err = stac92xx_auto_fill_dac_nids(codec);
3880 err = stac92xx_auto_create_multi_out_ctls(codec,
3886 /* setup analog beep controls */
3887 if (spec->anabeep_nid > 0) {
3888 err = stac92xx_auto_create_beep_ctls(codec,
3894 /* setup digital beep controls and input device */
3895 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3896 if (spec->digbeep_nid > 0) {
3897 hda_nid_t nid = spec->digbeep_nid;
3900 err = stac92xx_auto_create_beep_ctls(codec, nid);
3903 err = snd_hda_attach_beep_device(codec, nid);
3907 /* IDT/STAC codecs have linear beep tone parameter */
3908 codec->beep->linear_tone = spec->linear_tone_beep;
3909 /* if no beep switch is available, make its own one */
3910 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3911 if (!(caps & AC_AMPCAP_MUTE)) {
3912 err = stac92xx_beep_switch_ctl(codec);
3920 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
3924 /* All output parsing done, now restore the swapped hp pins */
3926 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
3927 sizeof(spec->autocfg.hp_pins));
3928 spec->autocfg.hp_outs = spec->autocfg.line_outs;
3929 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3930 spec->autocfg.line_outs = 0;
3933 if (stac_check_auto_mic(codec)) {
3935 /* only one capture for auto-mic */
3938 spec->num_muxes = 1;
3941 for (i = 0; i < spec->num_caps; i++) {
3942 err = stac92xx_add_capvol_ctls(codec, spec->capvols[i],
3943 spec->capsws[i], i);
3948 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
3952 if (spec->mono_nid > 0) {
3953 err = stac92xx_auto_create_mono_output_ctls(codec);
3957 if (spec->num_dmics > 0 && !spec->dinput_mux)
3958 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3959 &spec->autocfg)) < 0)
3961 if (spec->num_muxes > 0) {
3962 err = stac92xx_auto_create_mux_input_ctls(codec);
3966 if (spec->num_smuxes > 0) {
3967 err = stac92xx_auto_create_spdif_mux_ctls(codec);
3972 err = stac92xx_add_input_source(spec);
3976 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3977 if (spec->multiout.max_channels > 2)
3978 spec->surr_switch = 1;
3980 /* find digital out and in converters */
3981 for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) {
3982 unsigned int wid_caps = get_wcaps(codec, i);
3983 if (wid_caps & AC_WCAP_DIGITAL) {
3984 switch (get_wcaps_type(wid_caps)) {
3985 case AC_WID_AUD_OUT:
3996 if (spec->autocfg.dig_outs)
3997 spec->multiout.dig_out_nid = dig_out;
3998 if (dig_in && spec->autocfg.dig_in_pin)
3999 spec->dig_in_nid = dig_in;
4001 if (spec->kctls.list)
4002 spec->mixers[spec->num_mixers++] = spec->kctls.list;
4004 spec->input_mux = &spec->private_imux;
4005 if (!spec->dinput_mux)
4006 spec->dinput_mux = &spec->private_dimux;
4007 spec->sinput_mux = &spec->private_smux;
4008 spec->mono_mux = &spec->private_mono_mux;
4012 /* add playback controls for HP output */
4013 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
4014 struct auto_pin_cfg *cfg)
4016 struct sigmatel_spec *spec = codec->spec;
4017 hda_nid_t pin = cfg->hp_pins[0];
4022 if (is_jack_detectable(codec, pin))
4023 spec->hp_detect = 1;
4028 /* add playback controls for LFE output */
4029 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
4030 struct auto_pin_cfg *cfg)
4032 struct sigmatel_spec *spec = codec->spec;
4034 hda_nid_t lfe_pin = 0x0;
4038 * search speaker outs and line outs for a mono speaker pin
4039 * with an amp. If one is found, add LFE controls
4042 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
4043 hda_nid_t pin = spec->autocfg.speaker_pins[i];
4044 unsigned int wcaps = get_wcaps(codec, pin);
4045 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
4046 if (wcaps == AC_WCAP_OUT_AMP)
4047 /* found a mono speaker with an amp, must be lfe */
4051 /* if speaker_outs is 0, then speakers may be in line_outs */
4052 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
4053 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
4054 hda_nid_t pin = spec->autocfg.line_out_pins[i];
4055 unsigned int defcfg;
4056 defcfg = snd_hda_codec_get_pincfg(codec, pin);
4057 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
4058 unsigned int wcaps = get_wcaps(codec, pin);
4059 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
4060 if (wcaps == AC_WCAP_OUT_AMP)
4061 /* found a mono speaker with an amp,
4069 err = create_controls(codec, "LFE", lfe_pin, 1);
4077 static int stac9200_parse_auto_config(struct hda_codec *codec)
4079 struct sigmatel_spec *spec = codec->spec;
4082 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
4085 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
4088 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
4091 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
4094 if (spec->num_muxes > 0) {
4095 err = stac92xx_auto_create_mux_input_ctls(codec);
4100 err = stac92xx_add_input_source(spec);
4104 if (spec->autocfg.dig_outs)
4105 spec->multiout.dig_out_nid = 0x05;
4106 if (spec->autocfg.dig_in_pin)
4107 spec->dig_in_nid = 0x04;
4109 if (spec->kctls.list)
4110 spec->mixers[spec->num_mixers++] = spec->kctls.list;
4112 spec->input_mux = &spec->private_imux;
4113 spec->dinput_mux = &spec->private_dimux;
4119 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
4120 * funky external mute control using GPIO pins.
4123 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
4124 unsigned int dir_mask, unsigned int data)
4126 unsigned int gpiostate, gpiomask, gpiodir;
4128 snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
4130 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
4131 AC_VERB_GET_GPIO_DATA, 0);
4132 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
4134 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
4135 AC_VERB_GET_GPIO_MASK, 0);
4138 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
4139 AC_VERB_GET_GPIO_DIRECTION, 0);
4140 gpiodir |= dir_mask;
4142 /* Configure GPIOx as CMOS */
4143 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
4145 snd_hda_codec_write(codec, codec->afg, 0,
4146 AC_VERB_SET_GPIO_MASK, gpiomask);
4147 snd_hda_codec_read(codec, codec->afg, 0,
4148 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
4152 snd_hda_codec_read(codec, codec->afg, 0,
4153 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
4156 static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
4157 unsigned char type, int data)
4159 struct hda_jack_tbl *event;
4161 event = snd_hda_jack_tbl_new(codec, nid);
4164 event->action = type;
4165 event->private_data = data;
4170 /* check if given nid is a valid pin and no other events are assigned
4171 * to it. If OK, assign the event, set the unsol flag, and returns 1.
4172 * Otherwise, returns zero.
4174 static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4177 struct hda_jack_tbl *event;
4179 if (!is_jack_detectable(codec, nid))
4181 event = snd_hda_jack_tbl_new(codec, nid);
4184 if (event->action && event->action != type)
4186 event->action = type;
4187 snd_hda_jack_detect_enable(codec, nid, 0);
4191 static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
4194 for (i = 0; i < cfg->hp_outs; i++)
4195 if (cfg->hp_pins[i] == nid)
4196 return 1; /* nid is a HP-Out */
4197 for (i = 0; i < cfg->line_outs; i++)
4198 if (cfg->line_out_pins[i] == nid)
4199 return 1; /* nid is a line-Out */
4200 return 0; /* nid is not a HP-Out */
4203 static void stac92xx_power_down(struct hda_codec *codec)
4205 struct sigmatel_spec *spec = codec->spec;
4207 /* power down inactive DACs */
4208 const hda_nid_t *dac;
4209 for (dac = spec->dac_list; *dac; dac++)
4210 if (!check_all_dac_nids(spec, *dac))
4211 snd_hda_codec_write(codec, *dac, 0,
4212 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
4215 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4218 static inline int get_int_hint(struct hda_codec *codec, const char *key,
4222 p = snd_hda_get_hint(codec, key);
4225 if (!strict_strtoul(p, 0, &val)) {
4233 /* override some hints from the hwdep entry */
4234 static void stac_store_hints(struct hda_codec *codec)
4236 struct sigmatel_spec *spec = codec->spec;
4239 val = snd_hda_get_bool_hint(codec, "hp_detect");
4241 spec->hp_detect = val;
4242 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
4243 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
4246 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
4247 spec->gpio_mask &= spec->gpio_mask;
4248 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
4249 spec->gpio_dir &= spec->gpio_mask;
4250 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
4251 spec->eapd_mask &= spec->gpio_mask;
4252 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
4253 spec->gpio_mute &= spec->gpio_mask;
4254 val = snd_hda_get_bool_hint(codec, "eapd_switch");
4256 spec->eapd_switch = val;
4257 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
4258 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4259 spec->gpio_mask |= spec->gpio_led;
4260 spec->gpio_dir |= spec->gpio_led;
4261 if (spec->gpio_led_polarity)
4262 spec->gpio_data |= spec->gpio_led;
4266 static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins,
4267 const hda_nid_t *pins)
4270 stac_issue_unsol_event(codec, *pins++);
4273 /* fake event to set up pins */
4274 static void stac_fake_hp_events(struct hda_codec *codec)
4276 struct sigmatel_spec *spec = codec->spec;
4278 if (spec->autocfg.hp_outs)
4279 stac_issue_unsol_events(codec, spec->autocfg.hp_outs,
4280 spec->autocfg.hp_pins);
4281 if (spec->autocfg.line_outs &&
4282 spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0])
4283 stac_issue_unsol_events(codec, spec->autocfg.line_outs,
4284 spec->autocfg.line_out_pins);
4287 static int stac92xx_init(struct hda_codec *codec)
4289 struct sigmatel_spec *spec = codec->spec;
4290 struct auto_pin_cfg *cfg = &spec->autocfg;
4294 snd_hda_sequence_write(codec, spec->init);
4296 /* power down adcs initially */
4297 if (spec->powerdown_adcs)
4298 for (i = 0; i < spec->num_adcs; i++)
4299 snd_hda_codec_write(codec,
4300 spec->adc_nids[i], 0,
4301 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
4303 /* override some hints */
4304 stac_store_hints(codec);
4307 gpio = spec->gpio_data;
4308 /* turn on EAPD statically when spec->eapd_switch isn't set.
4309 * otherwise, unsol event will turn it on/off dynamically
4311 if (!spec->eapd_switch)
4312 gpio |= spec->eapd_mask;
4313 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
4316 if (spec->hp_detect) {
4317 /* Enable unsolicited responses on the HP widget */
4318 for (i = 0; i < cfg->hp_outs; i++) {
4319 hda_nid_t nid = cfg->hp_pins[i];
4320 enable_pin_detect(codec, nid, STAC_HP_EVENT);
4322 if (cfg->line_out_type == AUTO_PIN_LINE_OUT &&
4323 cfg->speaker_outs > 0) {
4324 /* enable pin-detect for line-outs as well */
4325 for (i = 0; i < cfg->line_outs; i++) {
4326 hda_nid_t nid = cfg->line_out_pins[i];
4327 enable_pin_detect(codec, nid, STAC_LO_EVENT);
4331 /* force to enable the first line-out; the others are set up
4334 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
4336 /* fake event to set up pins */
4337 stac_fake_hp_events(codec);
4339 stac92xx_auto_init_multi_out(codec);
4340 stac92xx_auto_init_hp_out(codec);
4341 for (i = 0; i < cfg->hp_outs; i++)
4342 stac_toggle_power_map(codec, cfg->hp_pins[i], 1);
4344 if (spec->auto_mic) {
4345 /* initialize connection to analog input */
4346 if (spec->dmux_nids)
4347 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4348 AC_VERB_SET_CONNECT_SEL, 0);
4349 if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT))
4350 stac_issue_unsol_event(codec, spec->ext_mic.pin);
4351 if (enable_pin_detect(codec, spec->dock_mic.pin,
4353 stac_issue_unsol_event(codec, spec->dock_mic.pin);
4355 for (i = 0; i < cfg->num_inputs; i++) {
4356 hda_nid_t nid = cfg->inputs[i].pin;
4357 int type = cfg->inputs[i].type;
4358 unsigned int pinctl, conf;
4359 if (type == AUTO_PIN_MIC) {
4360 /* for mic pins, force to initialize */
4361 pinctl = stac92xx_get_default_vref(codec, nid);
4362 pinctl |= AC_PINCTL_IN_EN;
4363 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4365 pinctl = snd_hda_codec_read(codec, nid, 0,
4366 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4367 /* if PINCTL already set then skip */
4368 /* Also, if both INPUT and OUTPUT are set,
4369 * it must be a BIOS bug; need to override, too
4371 if (!(pinctl & AC_PINCTL_IN_EN) ||
4372 (pinctl & AC_PINCTL_OUT_EN)) {
4373 pinctl &= ~AC_PINCTL_OUT_EN;
4374 pinctl |= AC_PINCTL_IN_EN;
4375 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4378 conf = snd_hda_codec_get_pincfg(codec, nid);
4379 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) {
4380 if (enable_pin_detect(codec, nid, STAC_INSERT_EVENT))
4381 stac_issue_unsol_event(codec, nid);
4384 for (i = 0; i < spec->num_dmics; i++)
4385 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
4387 if (cfg->dig_out_pins[0])
4388 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0],
4390 if (cfg->dig_in_pin)
4391 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
4393 for (i = 0; i < spec->num_pwrs; i++) {
4394 hda_nid_t nid = spec->pwr_nids[i];
4395 unsigned int pinctl, def_conf;
4397 /* power on when no jack detection is available */
4398 /* or when the VREF is used for controlling LED */
4399 if (!spec->hp_detect ||
4400 spec->vref_mute_led_nid == nid) {
4401 stac_toggle_power_map(codec, nid, 1);
4405 if (is_nid_out_jack_pin(cfg, nid))
4406 continue; /* already has an unsol event */
4408 pinctl = snd_hda_codec_read(codec, nid, 0,
4409 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4410 /* outputs are only ports capable of power management
4411 * any attempts on powering down a input port cause the
4412 * referenced VREF to act quirky.
4414 if (pinctl & AC_PINCTL_IN_EN) {
4415 stac_toggle_power_map(codec, nid, 1);
4418 def_conf = snd_hda_codec_get_pincfg(codec, nid);
4419 def_conf = get_defcfg_connect(def_conf);
4420 /* skip any ports that don't have jacks since presence
4421 * detection is useless */
4422 if (def_conf != AC_JACK_PORT_COMPLEX ||
4423 !is_jack_detectable(codec, nid)) {
4424 stac_toggle_power_map(codec, nid, 1);
4427 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
4428 stac_issue_unsol_event(codec, nid);
4431 /* none of the above, turn the port OFF */
4432 stac_toggle_power_map(codec, nid, 0);
4435 snd_hda_jack_report_sync(codec);
4438 snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
4440 stac92xx_power_down(codec);
4444 static void stac92xx_free_kctls(struct hda_codec *codec)
4446 struct sigmatel_spec *spec = codec->spec;
4448 if (spec->kctls.list) {
4449 struct snd_kcontrol_new *kctl = spec->kctls.list;
4451 for (i = 0; i < spec->kctls.used; i++)
4452 kfree(kctl[i].name);
4454 snd_array_free(&spec->kctls);
4457 static void stac92xx_shutup_pins(struct hda_codec *codec)
4459 unsigned int i, def_conf;
4461 if (codec->bus->shutdown)
4463 for (i = 0; i < codec->init_pins.used; i++) {
4464 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
4465 def_conf = snd_hda_codec_get_pincfg(codec, pin->nid);
4466 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE)
4467 snd_hda_codec_write(codec, pin->nid, 0,
4468 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
4472 static void stac92xx_shutup(struct hda_codec *codec)
4474 struct sigmatel_spec *spec = codec->spec;
4476 stac92xx_shutup_pins(codec);
4478 if (spec->eapd_mask)
4479 stac_gpio_set(codec, spec->gpio_mask,
4480 spec->gpio_dir, spec->gpio_data &
4484 static void stac92xx_free(struct hda_codec *codec)
4486 struct sigmatel_spec *spec = codec->spec;
4491 stac92xx_shutup(codec);
4494 snd_hda_detach_beep_device(codec);
4497 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
4500 unsigned int old_ctl, pin_ctl;
4502 pin_ctl = snd_hda_codec_read(codec, nid,
4503 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4505 if (pin_ctl & AC_PINCTL_IN_EN) {
4507 * we need to check the current set-up direction of
4508 * shared input pins since they can be switched via
4509 * "xxx as Output" mixer switch
4511 struct sigmatel_spec *spec = codec->spec;
4512 if (nid == spec->line_switch || nid == spec->mic_switch)
4517 /* if setting pin direction bits, clear the current
4518 direction bits first */
4519 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
4520 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
4523 if (old_ctl != pin_ctl)
4524 snd_hda_codec_write_cache(codec, nid, 0,
4525 AC_VERB_SET_PIN_WIDGET_CONTROL,
4529 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
4532 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
4533 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
4535 snd_hda_codec_write_cache(codec, nid, 0,
4536 AC_VERB_SET_PIN_WIDGET_CONTROL,
4540 static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4544 return snd_hda_jack_detect(codec, nid);
4547 static void stac92xx_line_out_detect(struct hda_codec *codec,
4550 struct sigmatel_spec *spec = codec->spec;
4551 struct auto_pin_cfg *cfg = &spec->autocfg;
4554 for (i = 0; i < cfg->line_outs; i++) {
4557 presence = get_pin_presence(codec, cfg->line_out_pins[i]);
4559 unsigned int pinctl;
4560 pinctl = snd_hda_codec_read(codec,
4561 cfg->line_out_pins[i], 0,
4562 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4563 if (pinctl & AC_PINCTL_IN_EN)
4564 presence = 0; /* mic- or line-input */
4569 /* disable speakers */
4570 for (i = 0; i < cfg->speaker_outs; i++)
4571 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
4573 if (spec->eapd_mask && spec->eapd_switch)
4574 stac_gpio_set(codec, spec->gpio_mask,
4575 spec->gpio_dir, spec->gpio_data &
4578 /* enable speakers */
4579 for (i = 0; i < cfg->speaker_outs; i++)
4580 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
4582 if (spec->eapd_mask && spec->eapd_switch)
4583 stac_gpio_set(codec, spec->gpio_mask,
4584 spec->gpio_dir, spec->gpio_data |
4589 /* return non-zero if the hp-pin of the given array index isn't
4590 * a jack-detection target
4592 static int no_hp_sensing(struct sigmatel_spec *spec, int i)
4594 struct auto_pin_cfg *cfg = &spec->autocfg;
4596 /* ignore sensing of shared line and mic jacks */
4597 if (cfg->hp_pins[i] == spec->line_switch)
4599 if (cfg->hp_pins[i] == spec->mic_switch)
4601 /* ignore if the pin is set as line-out */
4602 if (cfg->hp_pins[i] == spec->hp_switch)
4607 static void stac92xx_hp_detect(struct hda_codec *codec)
4609 struct sigmatel_spec *spec = codec->spec;
4610 struct auto_pin_cfg *cfg = &spec->autocfg;
4614 if (spec->gpio_mute)
4615 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
4616 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
4618 for (i = 0; i < cfg->hp_outs; i++) {
4621 if (no_hp_sensing(spec, i))
4623 presence = get_pin_presence(codec, cfg->hp_pins[i]);
4625 unsigned int pinctl;
4626 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
4627 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4628 if (pinctl & AC_PINCTL_IN_EN)
4629 presence = 0; /* mic- or line-input */
4634 /* disable lineouts */
4635 if (spec->hp_switch)
4636 stac92xx_reset_pinctl(codec, spec->hp_switch,
4638 for (i = 0; i < cfg->line_outs; i++)
4639 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
4642 /* enable lineouts */
4643 if (spec->hp_switch)
4644 stac92xx_set_pinctl(codec, spec->hp_switch,
4646 for (i = 0; i < cfg->line_outs; i++)
4647 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
4650 stac92xx_line_out_detect(codec, presence);
4651 /* toggle hp outs */
4652 for (i = 0; i < cfg->hp_outs; i++) {
4653 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4654 if (no_hp_sensing(spec, i))
4657 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4659 /* Resetting the pinctl like below may lead to (a sort of) regressions
4660 * on some devices since they use the HP pin actually for line/speaker
4661 * outs although the default pin config shows a different pin (that is
4662 * wrong and useless).
4664 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4665 * But, disabling the code below just works around it, and I'm too tired of
4666 * bug reports with such devices...
4669 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4674 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4677 struct sigmatel_spec *spec = codec->spec;
4678 unsigned int idx, val;
4680 for (idx = 0; idx < spec->num_pwrs; idx++) {
4681 if (spec->pwr_nids[idx] == nid)
4684 if (idx >= spec->num_pwrs)
4689 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4695 /* power down unused output ports */
4696 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
4699 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4701 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid));
4704 /* get the pin connection (fixed, none, etc) */
4705 static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
4707 struct sigmatel_spec *spec = codec->spec;
4710 cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
4711 return get_defcfg_connect(cfg);
4714 static int stac92xx_connected_ports(struct hda_codec *codec,
4715 const hda_nid_t *nids, int num_nids)
4717 struct sigmatel_spec *spec = codec->spec;
4719 unsigned int def_conf;
4721 for (num = 0; num < num_nids; num++) {
4722 for (idx = 0; idx < spec->num_pins; idx++)
4723 if (spec->pin_nids[idx] == nids[num])
4725 if (idx >= spec->num_pins)
4727 def_conf = stac_get_defcfg_connect(codec, idx);
4728 if (def_conf == AC_JACK_PORT_NONE)
4734 static void stac92xx_mic_detect(struct hda_codec *codec)
4736 struct sigmatel_spec *spec = codec->spec;
4737 struct sigmatel_mic_route *mic;
4739 if (get_pin_presence(codec, spec->ext_mic.pin))
4740 mic = &spec->ext_mic;
4741 else if (get_pin_presence(codec, spec->dock_mic.pin))
4742 mic = &spec->dock_mic;
4744 mic = &spec->int_mic;
4745 if (mic->dmux_idx >= 0)
4746 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4747 AC_VERB_SET_CONNECT_SEL,
4749 if (mic->mux_idx >= 0)
4750 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
4751 AC_VERB_SET_CONNECT_SEL,
4755 static void handle_unsol_event(struct hda_codec *codec,
4756 struct hda_jack_tbl *event)
4758 struct sigmatel_spec *spec = codec->spec;
4761 switch (event->action) {
4764 stac92xx_hp_detect(codec);
4766 case STAC_MIC_EVENT:
4767 stac92xx_mic_detect(codec);
4771 switch (event->action) {
4774 case STAC_MIC_EVENT:
4775 case STAC_INSERT_EVENT:
4776 case STAC_PWR_EVENT:
4777 if (spec->num_pwrs > 0)
4778 stac92xx_pin_sense(codec, event->nid);
4780 switch (codec->subsystem_id) {
4782 if (event->nid == 0xb) {
4783 int pin = AC_PINCTL_IN_EN;
4785 if (get_pin_presence(codec, 0xa)
4786 && get_pin_presence(codec, 0xb))
4787 pin |= AC_PINCTL_VREF_80;
4788 if (!get_pin_presence(codec, 0xb))
4789 pin |= AC_PINCTL_VREF_80;
4791 /* toggle VREF state based on mic + hp pin
4794 stac92xx_auto_set_pinctl(codec, 0x0a, pin);
4798 case STAC_VREF_EVENT:
4799 data = snd_hda_codec_read(codec, codec->afg, 0,
4800 AC_VERB_GET_GPIO_DATA, 0);
4801 /* toggle VREF state based on GPIOx status */
4802 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4803 !!(data & (1 << event->private_data)));
4808 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid)
4810 struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid);
4813 handle_unsol_event(codec, event);
4816 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4818 struct hda_jack_tbl *event;
4821 tag = (res >> 26) & 0x7f;
4822 event = snd_hda_jack_tbl_get_from_tag(codec, tag);
4825 event->jack_dirty = 1;
4826 handle_unsol_event(codec, event);
4827 snd_hda_jack_report_sync(codec);
4830 static int hp_blike_system(u32 subsystem_id);
4832 static void set_hp_led_gpio(struct hda_codec *codec)
4834 struct sigmatel_spec *spec = codec->spec;
4840 gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
4841 gpio &= AC_GPIO_IO_COUNT;
4843 spec->gpio_led = 0x08; /* GPIO 3 */
4845 spec->gpio_led = 0x01; /* GPIO 0 */
4849 * This method searches for the mute LED GPIO configuration
4850 * provided as OEM string in SMBIOS. The format of that string
4851 * is HP_Mute_LED_P_G or HP_Mute_LED_P
4852 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
4853 * that corresponds to the NOT muted state of the master volume
4854 * and G is the index of the GPIO to use as the mute LED control (0..9)
4855 * If _G portion is missing it is assigned based on the codec ID
4857 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4858 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4861 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4862 * SMBIOS - at least the ones I have seen do not have them - which include
4863 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4864 * HP Pavilion dv9500t CTO.
4865 * Need more information on whether it is true across the entire series.
4868 static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
4870 struct sigmatel_spec *spec = codec->spec;
4871 const struct dmi_device *dev = NULL;
4873 if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) {
4874 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4876 if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
4877 &spec->gpio_led_polarity,
4878 &spec->gpio_led) == 2) {
4879 unsigned int max_gpio;
4880 max_gpio = snd_hda_param_read(codec, codec->afg,
4882 max_gpio &= AC_GPIO_IO_COUNT;
4883 if (spec->gpio_led < max_gpio)
4884 spec->gpio_led = 1 << spec->gpio_led;
4886 spec->vref_mute_led_nid = spec->gpio_led;
4889 if (sscanf(dev->name, "HP_Mute_LED_%d",
4890 &spec->gpio_led_polarity) == 1) {
4891 set_hp_led_gpio(codec);
4894 /* BIOS bug: unfilled OEM string */
4895 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
4896 set_hp_led_gpio(codec);
4897 switch (codec->subsystem_id) {
4899 spec->gpio_led_polarity = 0;
4902 spec->gpio_led_polarity = 1;
4910 * Fallback case - if we don't find the DMI strings,
4911 * we statically set the GPIO - if not a B-series system
4912 * and default polarity is provided
4914 if (!hp_blike_system(codec->subsystem_id) &&
4915 (default_polarity == 0 || default_polarity == 1)) {
4916 set_hp_led_gpio(codec);
4917 spec->gpio_led_polarity = default_polarity;
4924 static int hp_blike_system(u32 subsystem_id)
4926 switch (subsystem_id) {
4953 #ifdef CONFIG_PROC_FS
4954 static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4955 struct hda_codec *codec, hda_nid_t nid)
4957 if (nid == codec->afg)
4958 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
4959 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0));
4962 static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4963 struct hda_codec *codec,
4966 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4967 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4970 /* stac92hd71bxx, stac92hd73xx */
4971 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4972 struct hda_codec *codec, hda_nid_t nid)
4974 stac92hd_proc_hook(buffer, codec, nid);
4975 if (nid == codec->afg)
4976 analog_loop_proc_hook(buffer, codec, 0xfa0);
4979 static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4980 struct hda_codec *codec, hda_nid_t nid)
4982 if (nid == codec->afg)
4983 analog_loop_proc_hook(buffer, codec, 0xfe0);
4986 static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4987 struct hda_codec *codec, hda_nid_t nid)
4989 if (nid == codec->afg)
4990 analog_loop_proc_hook(buffer, codec, 0xfeb);
4993 #define stac92hd_proc_hook NULL
4994 #define stac92hd7x_proc_hook NULL
4995 #define stac9205_proc_hook NULL
4996 #define stac927x_proc_hook NULL
5000 static int stac92xx_resume(struct hda_codec *codec)
5002 stac92xx_init(codec);
5003 snd_hda_codec_resume_amp(codec);
5004 snd_hda_codec_resume_cache(codec);
5005 /* fake event to set up pins again to override cached values */
5006 stac_fake_hp_events(codec);
5010 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
5012 stac92xx_shutup(codec);
5016 static int stac92xx_pre_resume(struct hda_codec *codec)
5018 struct sigmatel_spec *spec = codec->spec;
5021 if (spec->vref_mute_led_nid)
5022 stac_vrefout_set(codec, spec->vref_mute_led_nid,
5024 else if (spec->gpio_led)
5025 stac_gpio_set(codec, spec->gpio_mask,
5026 spec->gpio_dir, spec->gpio_data);
5030 static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
5031 unsigned int power_state)
5033 unsigned int afg_power_state = power_state;
5034 struct sigmatel_spec *spec = codec->spec;
5036 if (power_state == AC_PWRST_D3) {
5037 if (spec->vref_mute_led_nid) {
5038 /* with vref-out pin used for mute led control
5039 * codec AFG is prevented from D3 state
5041 afg_power_state = AC_PWRST_D1;
5043 /* this delay seems necessary to avoid click noise at power-down */
5046 snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
5048 snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
5051 #define stac92xx_suspend NULL
5052 #define stac92xx_resume NULL
5053 #define stac92xx_pre_resume NULL
5054 #define stac92xx_set_power_state NULL
5055 #endif /* CONFIG_PM */
5057 /* update mute-LED accoring to the master switch */
5058 static void stac92xx_update_led_status(struct hda_codec *codec, int enabled)
5060 struct sigmatel_spec *spec = codec->spec;
5061 int muted = !enabled;
5063 if (!spec->gpio_led)
5066 /* LED state is inverted on these systems */
5067 if (spec->gpio_led_polarity)
5070 if (!spec->vref_mute_led_nid) {
5072 spec->gpio_data |= spec->gpio_led;
5074 spec->gpio_data &= ~spec->gpio_led;
5075 stac_gpio_set(codec, spec->gpio_mask,
5076 spec->gpio_dir, spec->gpio_data);
5078 spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
5079 stac_vrefout_set(codec, spec->vref_mute_led_nid,
5084 static const struct hda_codec_ops stac92xx_patch_ops = {
5085 .build_controls = stac92xx_build_controls,
5086 .build_pcms = stac92xx_build_pcms,
5087 .init = stac92xx_init,
5088 .free = stac92xx_free,
5089 .unsol_event = stac92xx_unsol_event,
5091 .suspend = stac92xx_suspend,
5092 .resume = stac92xx_resume,
5094 .reboot_notify = stac92xx_shutup,
5097 static int patch_stac9200(struct hda_codec *codec)
5099 struct sigmatel_spec *spec;
5102 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5106 codec->no_trigger_sense = 1;
5108 spec->linear_tone_beep = 1;
5109 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5110 spec->pin_nids = stac9200_pin_nids;
5111 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
5114 if (spec->board_config < 0)
5115 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5118 stac92xx_set_config_regs(codec,
5119 stac9200_brd_tbl[spec->board_config]);
5121 spec->multiout.max_channels = 2;
5122 spec->multiout.num_dacs = 1;
5123 spec->multiout.dac_nids = stac9200_dac_nids;
5124 spec->adc_nids = stac9200_adc_nids;
5125 spec->mux_nids = stac9200_mux_nids;
5126 spec->num_muxes = 1;
5127 spec->num_dmics = 0;
5131 if (spec->board_config == STAC_9200_M4 ||
5132 spec->board_config == STAC_9200_M4_2 ||
5133 spec->board_config == STAC_9200_OQO)
5134 spec->init = stac9200_eapd_init;
5136 spec->init = stac9200_core_init;
5137 spec->mixer = stac9200_mixer;
5139 if (spec->board_config == STAC_9200_PANASONIC) {
5140 spec->gpio_mask = spec->gpio_dir = 0x09;
5141 spec->gpio_data = 0x00;
5144 err = stac9200_parse_auto_config(codec);
5146 stac92xx_free(codec);
5150 /* CF-74 has no headphone detection, and the driver should *NOT*
5151 * do detection and HP/speaker toggle because the hardware does it.
5153 if (spec->board_config == STAC_9200_PANASONIC)
5154 spec->hp_detect = 0;
5156 codec->patch_ops = stac92xx_patch_ops;
5161 static int patch_stac925x(struct hda_codec *codec)
5163 struct sigmatel_spec *spec;
5166 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5170 codec->no_trigger_sense = 1;
5172 spec->linear_tone_beep = 1;
5173 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5174 spec->pin_nids = stac925x_pin_nids;
5176 /* Check first for codec ID */
5177 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
5180 stac925x_codec_id_cfg_tbl);
5182 /* Now checks for PCI ID, if codec ID is not found */
5183 if (spec->board_config < 0)
5184 spec->board_config = snd_hda_check_board_config(codec,
5189 if (spec->board_config < 0)
5190 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5193 stac92xx_set_config_regs(codec,
5194 stac925x_brd_tbl[spec->board_config]);
5196 spec->multiout.max_channels = 2;
5197 spec->multiout.num_dacs = 1;
5198 spec->multiout.dac_nids = stac925x_dac_nids;
5199 spec->adc_nids = stac925x_adc_nids;
5200 spec->mux_nids = stac925x_mux_nids;
5201 spec->num_muxes = 1;
5204 switch (codec->vendor_id) {
5205 case 0x83847632: /* STAC9202 */
5206 case 0x83847633: /* STAC9202D */
5207 case 0x83847636: /* STAC9251 */
5208 case 0x83847637: /* STAC9251D */
5209 spec->num_dmics = STAC925X_NUM_DMICS;
5210 spec->dmic_nids = stac925x_dmic_nids;
5211 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
5212 spec->dmux_nids = stac925x_dmux_nids;
5215 spec->num_dmics = 0;
5219 spec->init = stac925x_core_init;
5220 spec->mixer = stac925x_mixer;
5222 spec->capvols = stac925x_capvols;
5223 spec->capsws = stac925x_capsws;
5225 err = stac92xx_parse_auto_config(codec);
5227 if (spec->board_config < 0) {
5228 printk(KERN_WARNING "hda_codec: No auto-config is "
5229 "available, default to model=ref\n");
5230 spec->board_config = STAC_925x_REF;
5236 stac92xx_free(codec);
5240 codec->patch_ops = stac92xx_patch_ops;
5245 static int patch_stac92hd73xx(struct hda_codec *codec)
5247 struct sigmatel_spec *spec;
5248 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5252 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5256 codec->no_trigger_sense = 1;
5258 spec->linear_tone_beep = 0;
5259 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5260 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5261 spec->pin_nids = stac92hd73xx_pin_nids;
5262 spec->board_config = snd_hda_check_board_config(codec,
5263 STAC_92HD73XX_MODELS,
5264 stac92hd73xx_models,
5265 stac92hd73xx_cfg_tbl);
5266 /* check codec subsystem id if not found */
5267 if (spec->board_config < 0)
5268 spec->board_config =
5269 snd_hda_check_board_codec_sid_config(codec,
5270 STAC_92HD73XX_MODELS, stac92hd73xx_models,
5271 stac92hd73xx_codec_id_cfg_tbl);
5273 if (spec->board_config < 0)
5274 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5277 stac92xx_set_config_regs(codec,
5278 stac92hd73xx_brd_tbl[spec->board_config]);
5280 num_dacs = snd_hda_get_connections(codec, 0x0a,
5281 conn, STAC92HD73_DAC_COUNT + 2) - 1;
5283 if (num_dacs < 3 || num_dacs > 5) {
5284 printk(KERN_WARNING "hda_codec: Could not determine "
5285 "number of channels defaulting to DAC count\n");
5286 num_dacs = STAC92HD73_DAC_COUNT;
5288 spec->init = stac92hd73xx_core_init;
5290 case 0x3: /* 6 Channel */
5291 spec->aloopback_ctl = stac92hd73xx_6ch_loopback;
5293 case 0x4: /* 8 Channel */
5294 spec->aloopback_ctl = stac92hd73xx_8ch_loopback;
5296 case 0x5: /* 10 Channel */
5297 spec->aloopback_ctl = stac92hd73xx_10ch_loopback;
5300 spec->multiout.dac_nids = spec->dac_nids;
5302 spec->aloopback_mask = 0x01;
5303 spec->aloopback_shift = 8;
5305 spec->digbeep_nid = 0x1c;
5306 spec->mux_nids = stac92hd73xx_mux_nids;
5307 spec->adc_nids = stac92hd73xx_adc_nids;
5308 spec->dmic_nids = stac92hd73xx_dmic_nids;
5309 spec->dmux_nids = stac92hd73xx_dmux_nids;
5310 spec->smux_nids = stac92hd73xx_smux_nids;
5312 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
5313 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
5314 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
5316 spec->num_caps = STAC92HD73XX_NUM_CAPS;
5317 spec->capvols = stac92hd73xx_capvols;
5318 spec->capsws = stac92hd73xx_capsws;
5320 switch (spec->board_config) {
5322 spec->init = dell_eq_core_init;
5324 case STAC_DELL_M6_AMIC:
5325 case STAC_DELL_M6_DMIC:
5326 case STAC_DELL_M6_BOTH:
5327 spec->num_smuxes = 0;
5328 spec->eapd_switch = 0;
5330 switch (spec->board_config) {
5331 case STAC_DELL_M6_AMIC: /* Analog Mics */
5332 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
5333 spec->num_dmics = 0;
5335 case STAC_DELL_M6_DMIC: /* Digital Mics */
5336 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
5337 spec->num_dmics = 1;
5339 case STAC_DELL_M6_BOTH: /* Both */
5340 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
5341 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
5342 spec->num_dmics = 1;
5346 case STAC_ALIENWARE_M17X:
5347 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
5348 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
5349 spec->eapd_switch = 0;
5352 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
5353 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
5354 spec->eapd_switch = 1;
5357 if (spec->board_config != STAC_92HD73XX_REF) {
5358 /* GPIO0 High = Enable EAPD */
5359 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
5360 spec->gpio_data = 0x01;
5363 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
5364 spec->pwr_nids = stac92hd73xx_pwr_nids;
5366 err = stac92xx_parse_auto_config(codec);
5369 if (spec->board_config < 0) {
5370 printk(KERN_WARNING "hda_codec: No auto-config is "
5371 "available, default to model=ref\n");
5372 spec->board_config = STAC_92HD73XX_REF;
5379 stac92xx_free(codec);
5383 if (spec->board_config == STAC_92HD73XX_NO_JD)
5384 spec->hp_detect = 0;
5386 codec->patch_ops = stac92xx_patch_ops;
5388 codec->proc_widget_hook = stac92hd7x_proc_hook;
5393 static int hp_bnb2011_with_dock(struct hda_codec *codec)
5395 if (codec->vendor_id != 0x111d7605 &&
5396 codec->vendor_id != 0x111d76d1)
5399 switch (codec->subsystem_id) {
5433 static void stac92hd8x_add_pin(struct hda_codec *codec, hda_nid_t nid)
5435 struct sigmatel_spec *spec = codec->spec;
5436 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
5439 spec->auto_pin_nids[spec->auto_pin_cnt] = nid;
5440 spec->auto_pin_cnt++;
5442 if (get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
5443 get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) {
5444 for (i = 0; i < ARRAY_SIZE(stac92hd83xxx_dmic_nids); i++) {
5445 if (nid == stac92hd83xxx_dmic_nids[i]) {
5446 spec->auto_dmic_nids[spec->auto_dmic_cnt] = nid;
5447 spec->auto_dmic_cnt++;
5453 static void stac92hd8x_add_adc(struct hda_codec *codec, hda_nid_t nid)
5455 struct sigmatel_spec *spec = codec->spec;
5457 spec->auto_adc_nids[spec->auto_adc_cnt] = nid;
5458 spec->auto_adc_cnt++;
5461 static void stac92hd8x_add_mux(struct hda_codec *codec, hda_nid_t nid)
5464 struct sigmatel_spec *spec = codec->spec;
5466 for (i = 0; i < spec->auto_adc_cnt; i++) {
5467 if (get_connection_index(codec,
5468 spec->auto_adc_nids[i], nid) >= 0) {
5469 /* mux and volume for adc_nids[i] */
5470 if (!spec->auto_mux_nids[i]) {
5471 spec->auto_mux_nids[i] = nid;
5472 /* 92hd codecs capture volume is in mux */
5473 spec->auto_capvols[i] = HDA_COMPOSE_AMP_VAL(nid,
5476 for (j = 0; j < spec->auto_dmic_cnt; j++) {
5477 if (get_connection_index(codec, nid,
5478 spec->auto_dmic_nids[j]) >= 0) {
5479 /* dmux for adc_nids[i] */
5480 if (!spec->auto_dmux_nids[i])
5481 spec->auto_dmux_nids[i] = nid;
5490 static void stac92hd8x_fill_auto_spec(struct hda_codec *codec)
5492 hda_nid_t nid, end_nid;
5493 unsigned int wid_caps, wid_type;
5494 struct sigmatel_spec *spec = codec->spec;
5496 end_nid = codec->start_nid + codec->num_nodes;
5498 for (nid = codec->start_nid; nid < end_nid; nid++) {
5499 wid_caps = get_wcaps(codec, nid);
5500 wid_type = get_wcaps_type(wid_caps);
5502 if (wid_type == AC_WID_PIN)
5503 stac92hd8x_add_pin(codec, nid);
5505 if (wid_type == AC_WID_AUD_IN && !(wid_caps & AC_WCAP_DIGITAL))
5506 stac92hd8x_add_adc(codec, nid);
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_AUD_SEL)
5514 stac92hd8x_add_mux(codec, nid);
5517 spec->pin_nids = spec->auto_pin_nids;
5518 spec->num_pins = spec->auto_pin_cnt;
5519 spec->adc_nids = spec->auto_adc_nids;
5520 spec->num_adcs = spec->auto_adc_cnt;
5521 spec->capvols = spec->auto_capvols;
5522 spec->capsws = spec->auto_capvols;
5523 spec->num_caps = spec->auto_adc_cnt;
5524 spec->mux_nids = spec->auto_mux_nids;
5525 spec->num_muxes = spec->auto_adc_cnt;
5526 spec->dmux_nids = spec->auto_dmux_nids;
5527 spec->num_dmuxes = spec->auto_adc_cnt;
5528 spec->dmic_nids = spec->auto_dmic_nids;
5529 spec->num_dmics = spec->auto_dmic_cnt;
5532 static int patch_stac92hd83xxx(struct hda_codec *codec)
5534 struct sigmatel_spec *spec;
5535 int default_polarity = -1; /* no default cfg */
5538 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5542 if (hp_bnb2011_with_dock(codec)) {
5543 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
5544 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
5547 codec->no_trigger_sense = 1;
5550 stac92hd8x_fill_auto_spec(codec);
5552 spec->linear_tone_beep = 0;
5553 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5554 spec->digbeep_nid = 0x21;
5555 spec->pwr_nids = stac92hd83xxx_pwr_nids;
5556 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
5557 spec->multiout.dac_nids = spec->dac_nids;
5558 spec->init = stac92hd83xxx_core_init;
5560 spec->board_config = snd_hda_check_board_config(codec,
5561 STAC_92HD83XXX_MODELS,
5562 stac92hd83xxx_models,
5563 stac92hd83xxx_cfg_tbl);
5564 /* check codec subsystem id if not found */
5565 if (spec->board_config < 0)
5566 spec->board_config =
5567 snd_hda_check_board_codec_sid_config(codec,
5568 STAC_92HD83XXX_MODELS, stac92hd83xxx_models,
5569 stac92hd83xxx_codec_id_cfg_tbl);
5571 if (spec->board_config < 0)
5572 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5575 stac92xx_set_config_regs(codec,
5576 stac92hd83xxx_brd_tbl[spec->board_config]);
5578 codec->patch_ops = stac92xx_patch_ops;
5580 switch (spec->board_config) {
5581 case STAC_HP_ZEPHYR:
5582 spec->init = stac92hd83xxx_hp_zephyr_init;
5584 case STAC_92HD83XXX_HP_LED:
5585 default_polarity = 1;
5589 if (find_mute_led_cfg(codec, default_polarity))
5590 snd_printd("mute LED gpio %d polarity %d\n",
5592 spec->gpio_led_polarity);
5594 if (spec->gpio_led) {
5595 if (!spec->vref_mute_led_nid) {
5596 spec->gpio_mask |= spec->gpio_led;
5597 spec->gpio_dir |= spec->gpio_led;
5598 spec->gpio_data |= spec->gpio_led;
5600 codec->patch_ops.set_power_state =
5601 stac92xx_set_power_state;
5604 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5608 err = stac92xx_parse_auto_config(codec);
5610 if (spec->board_config < 0) {
5611 printk(KERN_WARNING "hda_codec: No auto-config is "
5612 "available, default to model=ref\n");
5613 spec->board_config = STAC_92HD83XXX_REF;
5620 stac92xx_free(codec);
5624 codec->proc_widget_hook = stac92hd_proc_hook;
5629 static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
5632 struct sigmatel_spec *spec = codec->spec;
5635 for (idx = 0; idx < spec->num_pins; idx++)
5636 if (spec->pin_nids[idx] == dig0pin)
5638 if ((idx + 2) >= spec->num_pins)
5642 if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE)
5645 /* dig0pin + dig2pin case */
5646 if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE)
5648 if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE)
5654 /* HP dv7 bass switch - GPIO5 */
5655 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5656 static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
5657 struct snd_ctl_elem_value *ucontrol)
5659 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5660 struct sigmatel_spec *spec = codec->spec;
5661 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
5665 static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
5666 struct snd_ctl_elem_value *ucontrol)
5668 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5669 struct sigmatel_spec *spec = codec->spec;
5670 unsigned int gpio_data;
5672 gpio_data = (spec->gpio_data & ~0x20) |
5673 (ucontrol->value.integer.value[0] ? 0x20 : 0);
5674 if (gpio_data == spec->gpio_data)
5676 spec->gpio_data = gpio_data;
5677 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5681 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5683 .info = stac_hp_bass_gpio_info,
5684 .get = stac_hp_bass_gpio_get,
5685 .put = stac_hp_bass_gpio_put,
5688 static int stac_add_hp_bass_switch(struct hda_codec *codec)
5690 struct sigmatel_spec *spec = codec->spec;
5692 if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl,
5693 "Bass Speaker Playback Switch", 0))
5696 spec->gpio_mask |= 0x20;
5697 spec->gpio_dir |= 0x20;
5698 spec->gpio_data |= 0x20;
5702 static int patch_stac92hd71bxx(struct hda_codec *codec)
5704 struct sigmatel_spec *spec;
5705 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5706 unsigned int pin_cfg;
5709 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5713 codec->no_trigger_sense = 1;
5715 spec->linear_tone_beep = 0;
5716 codec->patch_ops = stac92xx_patch_ops;
5717 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5718 switch (codec->vendor_id) {
5721 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5725 /* On 92HD75Bx 0x27 isn't a pin nid */
5729 spec->pin_nids = stac92hd71bxx_pin_nids_6port;
5731 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
5732 spec->board_config = snd_hda_check_board_config(codec,
5733 STAC_92HD71BXX_MODELS,
5734 stac92hd71bxx_models,
5735 stac92hd71bxx_cfg_tbl);
5737 if (spec->board_config < 0)
5738 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5741 stac92xx_set_config_regs(codec,
5742 stac92hd71bxx_brd_tbl[spec->board_config]);
5744 if (spec->board_config != STAC_92HD71BXX_REF) {
5746 spec->gpio_mask = 0x01;
5747 spec->gpio_dir = 0x01;
5748 spec->gpio_data = 0x01;
5751 spec->dmic_nids = stac92hd71bxx_dmic_nids;
5752 spec->dmux_nids = stac92hd71bxx_dmux_nids;
5754 spec->num_caps = STAC92HD71BXX_NUM_CAPS;
5755 spec->capvols = stac92hd71bxx_capvols;
5756 spec->capsws = stac92hd71bxx_capsws;
5758 switch (codec->vendor_id) {
5759 case 0x111d76b6: /* 4 Port without Analog Mixer */
5763 case 0x111d76b4: /* 6 Port without Analog Mixer */
5765 spec->init = stac92hd71bxx_core_init;
5766 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5767 spec->num_dmics = stac92xx_connected_ports(codec,
5768 stac92hd71bxx_dmic_nids,
5769 STAC92HD71BXX_NUM_DMICS);
5771 case 0x111d7608: /* 5 Port with Analog Mixer */
5772 switch (spec->board_config) {
5774 /* Enable VREF power saving on GPIO1 detect */
5775 err = stac_add_event(codec, codec->afg,
5776 STAC_VREF_EVENT, 0x02);
5779 snd_hda_codec_write_cache(codec, codec->afg, 0,
5780 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
5781 snd_hda_jack_detect_enable(codec, codec->afg, 0);
5782 spec->gpio_mask |= 0x02;
5785 if ((codec->revision_id & 0xf) == 0 ||
5786 (codec->revision_id & 0xf) == 1)
5787 spec->stream_delay = 40; /* 40 milliseconds */
5790 spec->init = stac92hd71bxx_core_init;
5792 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
5793 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
5794 spec->dmic_nids = stac92hd71bxx_dmic_5port_nids;
5795 spec->num_dmics = stac92xx_connected_ports(codec,
5796 stac92hd71bxx_dmic_5port_nids,
5797 STAC92HD71BXX_NUM_DMICS - 1);
5799 case 0x111d7603: /* 6 Port with Analog Mixer */
5800 if ((codec->revision_id & 0xf) == 1)
5801 spec->stream_delay = 40; /* 40 milliseconds */
5805 spec->init = stac92hd71bxx_core_init;
5806 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
5807 spec->num_dmics = stac92xx_connected_ports(codec,
5808 stac92hd71bxx_dmic_nids,
5809 STAC92HD71BXX_NUM_DMICS);
5813 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
5814 snd_hda_sequence_write_cache(codec, unmute_init);
5816 spec->aloopback_ctl = stac92hd71bxx_loopback;
5817 spec->aloopback_mask = 0x50;
5818 spec->aloopback_shift = 0;
5820 spec->powerdown_adcs = 1;
5821 spec->digbeep_nid = 0x26;
5822 spec->mux_nids = stac92hd71bxx_mux_nids;
5823 spec->adc_nids = stac92hd71bxx_adc_nids;
5824 spec->smux_nids = stac92hd71bxx_smux_nids;
5825 spec->pwr_nids = stac92hd71bxx_pwr_nids;
5827 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
5828 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
5829 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5830 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5832 snd_printdd("Found board config: %d\n", spec->board_config);
5834 switch (spec->board_config) {
5836 /* enable internal microphone */
5837 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
5838 stac92xx_auto_set_pinctl(codec, 0x0e,
5839 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
5841 case STAC_DELL_M4_2:
5842 spec->num_dmics = 0;
5843 spec->num_smuxes = 0;
5844 spec->num_dmuxes = 0;
5846 case STAC_DELL_M4_1:
5847 case STAC_DELL_M4_3:
5848 spec->num_dmics = 1;
5849 spec->num_smuxes = 0;
5850 spec->num_dmuxes = 1;
5852 case STAC_HP_DV4_1222NR:
5853 spec->num_dmics = 1;
5854 /* I don't know if it needs 1 or 2 smuxes - will wait for
5855 * bug reports to fix if needed
5857 spec->num_smuxes = 1;
5858 spec->num_dmuxes = 1;
5861 spec->gpio_led = 0x01;
5864 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
5865 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
5866 /* HP dv6 gives the headphone pin as a line-out. Thus we
5867 * need to set hp_detect flag here to force to enable HP
5870 spec->hp_detect = 1;
5873 spec->num_dmics = 1;
5874 spec->num_dmuxes = 1;
5875 spec->num_smuxes = 1;
5876 spec->gpio_led = 0x08;
5880 if (hp_blike_system(codec->subsystem_id)) {
5881 pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
5882 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
5883 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
5884 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
5885 /* It was changed in the BIOS to just satisfy MS DTM.
5886 * Lets turn it back into slaved HP
5888 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
5889 | (AC_JACK_HP_OUT <<
5890 AC_DEFCFG_DEVICE_SHIFT);
5891 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
5892 | AC_DEFCFG_SEQUENCE)))
5894 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
5898 if (find_mute_led_cfg(codec, 1))
5899 snd_printd("mute LED gpio %d polarity %d\n",
5901 spec->gpio_led_polarity);
5903 if (spec->gpio_led) {
5904 if (!spec->vref_mute_led_nid) {
5905 spec->gpio_mask |= spec->gpio_led;
5906 spec->gpio_dir |= spec->gpio_led;
5907 spec->gpio_data |= spec->gpio_led;
5909 codec->patch_ops.set_power_state =
5910 stac92xx_set_power_state;
5913 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5917 spec->multiout.dac_nids = spec->dac_nids;
5919 err = stac92xx_parse_auto_config(codec);
5921 if (spec->board_config < 0) {
5922 printk(KERN_WARNING "hda_codec: No auto-config is "
5923 "available, default to model=ref\n");
5924 spec->board_config = STAC_92HD71BXX_REF;
5931 stac92xx_free(codec);
5935 /* enable bass on HP dv7 */
5936 if (spec->board_config == STAC_HP_DV4 ||
5937 spec->board_config == STAC_HP_DV5) {
5939 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
5940 cap &= AC_GPIO_IO_COUNT;
5942 stac_add_hp_bass_switch(codec);
5945 codec->proc_widget_hook = stac92hd7x_proc_hook;
5950 static int patch_stac922x(struct hda_codec *codec)
5952 struct sigmatel_spec *spec;
5955 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5959 codec->no_trigger_sense = 1;
5961 spec->linear_tone_beep = 1;
5962 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5963 spec->pin_nids = stac922x_pin_nids;
5964 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
5967 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
5968 spec->gpio_mask = spec->gpio_dir = 0x03;
5969 spec->gpio_data = 0x03;
5970 /* Intel Macs have all same PCI SSID, so we need to check
5971 * codec SSID to distinguish the exact models
5973 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
5974 switch (codec->subsystem_id) {
5977 spec->board_config = STAC_INTEL_MAC_V1;
5981 spec->board_config = STAC_INTEL_MAC_V2;
5989 spec->board_config = STAC_INTEL_MAC_V3;
5993 spec->board_config = STAC_INTEL_MAC_V4;
5997 spec->board_config = STAC_INTEL_MAC_V5;
6000 spec->board_config = STAC_INTEL_MAC_V3;
6006 if (spec->board_config < 0)
6007 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6010 stac92xx_set_config_regs(codec,
6011 stac922x_brd_tbl[spec->board_config]);
6013 spec->adc_nids = stac922x_adc_nids;
6014 spec->mux_nids = stac922x_mux_nids;
6015 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
6016 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
6017 spec->num_dmics = 0;
6020 spec->init = stac922x_core_init;
6022 spec->num_caps = STAC922X_NUM_CAPS;
6023 spec->capvols = stac922x_capvols;
6024 spec->capsws = stac922x_capsws;
6026 spec->multiout.dac_nids = spec->dac_nids;
6028 err = stac92xx_parse_auto_config(codec);
6030 if (spec->board_config < 0) {
6031 printk(KERN_WARNING "hda_codec: No auto-config is "
6032 "available, default to model=ref\n");
6033 spec->board_config = STAC_D945_REF;
6039 stac92xx_free(codec);
6043 codec->patch_ops = stac92xx_patch_ops;
6045 /* Fix Mux capture level; max to 2 */
6046 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
6047 (0 << AC_AMPCAP_OFFSET_SHIFT) |
6048 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6049 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
6050 (0 << AC_AMPCAP_MUTE_SHIFT));
6055 static int patch_stac927x(struct hda_codec *codec)
6057 struct sigmatel_spec *spec;
6060 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6064 codec->no_trigger_sense = 1;
6066 spec->linear_tone_beep = 1;
6067 codec->slave_dig_outs = stac927x_slave_dig_outs;
6068 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6069 spec->pin_nids = stac927x_pin_nids;
6070 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
6074 if (spec->board_config < 0)
6075 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6078 stac92xx_set_config_regs(codec,
6079 stac927x_brd_tbl[spec->board_config]);
6081 spec->digbeep_nid = 0x23;
6082 spec->adc_nids = stac927x_adc_nids;
6083 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
6084 spec->mux_nids = stac927x_mux_nids;
6085 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
6086 spec->smux_nids = stac927x_smux_nids;
6087 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
6088 spec->spdif_labels = stac927x_spdif_labels;
6089 spec->dac_list = stac927x_dac_nids;
6090 spec->multiout.dac_nids = spec->dac_nids;
6092 if (spec->board_config != STAC_D965_REF) {
6093 /* GPIO0 High = Enable EAPD */
6094 spec->eapd_mask = spec->gpio_mask = 0x01;
6095 spec->gpio_dir = spec->gpio_data = 0x01;
6098 switch (spec->board_config) {
6101 /* GPIO0 High = Enable EAPD */
6102 spec->num_dmics = 0;
6103 spec->init = d965_core_init;
6105 case STAC_DELL_BIOS:
6106 switch (codec->subsystem_id) {
6109 /* correct the device field to SPDIF out */
6110 snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070);
6113 /* configure the analog microphone on some laptops */
6114 snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130);
6115 /* correct the front output jack as a hp out */
6116 snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f);
6117 /* correct the front input jack as a mic */
6118 snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130);
6121 if (codec->subsystem_id != 0x1028022f) {
6122 /* GPIO2 High = Enable EAPD */
6123 spec->eapd_mask = spec->gpio_mask = 0x04;
6124 spec->gpio_dir = spec->gpio_data = 0x04;
6126 spec->dmic_nids = stac927x_dmic_nids;
6127 spec->num_dmics = STAC927X_NUM_DMICS;
6129 spec->init = dell_3st_core_init;
6130 spec->dmux_nids = stac927x_dmux_nids;
6131 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
6133 case STAC_927X_VOLKNOB:
6134 spec->num_dmics = 0;
6135 spec->init = stac927x_volknob_core_init;
6138 spec->num_dmics = 0;
6139 spec->init = stac927x_core_init;
6143 spec->num_caps = STAC927X_NUM_CAPS;
6144 spec->capvols = stac927x_capvols;
6145 spec->capsws = stac927x_capsws;
6148 spec->aloopback_ctl = stac927x_loopback;
6149 spec->aloopback_mask = 0x40;
6150 spec->aloopback_shift = 0;
6151 spec->eapd_switch = 1;
6153 err = stac92xx_parse_auto_config(codec);
6155 if (spec->board_config < 0) {
6156 printk(KERN_WARNING "hda_codec: No auto-config is "
6157 "available, default to model=ref\n");
6158 spec->board_config = STAC_D965_REF;
6164 stac92xx_free(codec);
6168 codec->patch_ops = stac92xx_patch_ops;
6170 codec->proc_widget_hook = stac927x_proc_hook;
6174 * The STAC927x seem to require fairly long delays for certain
6175 * command sequences. With too short delays (even if the answer
6176 * is set to RIRB properly), it results in the silence output
6177 * on some hardwares like Dell.
6179 * The below flag enables the longer delay (see get_response
6182 codec->bus->needs_damn_long_delay = 1;
6184 /* no jack detecion for ref-no-jd model */
6185 if (spec->board_config == STAC_D965_REF_NO_JD)
6186 spec->hp_detect = 0;
6191 static int patch_stac9205(struct hda_codec *codec)
6193 struct sigmatel_spec *spec;
6196 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6200 codec->no_trigger_sense = 1;
6202 spec->linear_tone_beep = 1;
6203 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6204 spec->pin_nids = stac9205_pin_nids;
6205 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
6209 if (spec->board_config < 0)
6210 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6213 stac92xx_set_config_regs(codec,
6214 stac9205_brd_tbl[spec->board_config]);
6216 spec->digbeep_nid = 0x23;
6217 spec->adc_nids = stac9205_adc_nids;
6218 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
6219 spec->mux_nids = stac9205_mux_nids;
6220 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
6221 spec->smux_nids = stac9205_smux_nids;
6222 spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids);
6223 spec->dmic_nids = stac9205_dmic_nids;
6224 spec->num_dmics = STAC9205_NUM_DMICS;
6225 spec->dmux_nids = stac9205_dmux_nids;
6226 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
6229 spec->init = stac9205_core_init;
6230 spec->aloopback_ctl = stac9205_loopback;
6232 spec->num_caps = STAC9205_NUM_CAPS;
6233 spec->capvols = stac9205_capvols;
6234 spec->capsws = stac9205_capsws;
6236 spec->aloopback_mask = 0x40;
6237 spec->aloopback_shift = 0;
6238 /* Turn on/off EAPD per HP plugging */
6239 if (spec->board_config != STAC_9205_EAPD)
6240 spec->eapd_switch = 1;
6241 spec->multiout.dac_nids = spec->dac_nids;
6243 switch (spec->board_config){
6244 case STAC_9205_DELL_M43:
6245 /* Enable SPDIF in/out */
6246 snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030);
6247 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
6249 /* Enable unsol response for GPIO4/Dock HP connection */
6250 err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01);
6253 snd_hda_codec_write_cache(codec, codec->afg, 0,
6254 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
6255 snd_hda_jack_detect_enable(codec, codec->afg, 0);
6257 spec->gpio_dir = 0x0b;
6258 spec->eapd_mask = 0x01;
6259 spec->gpio_mask = 0x1b;
6260 spec->gpio_mute = 0x10;
6261 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
6264 spec->gpio_data = 0x01;
6267 /* SPDIF-In enabled */
6270 /* GPIO0 High = EAPD */
6271 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
6272 spec->gpio_data = 0x01;
6276 err = stac92xx_parse_auto_config(codec);
6278 if (spec->board_config < 0) {
6279 printk(KERN_WARNING "hda_codec: No auto-config is "
6280 "available, default to model=ref\n");
6281 spec->board_config = STAC_9205_REF;
6287 stac92xx_free(codec);
6291 codec->patch_ops = stac92xx_patch_ops;
6293 codec->proc_widget_hook = stac9205_proc_hook;
6302 static const struct hda_verb stac9872_core_init[] = {
6303 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
6304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
6308 static const hda_nid_t stac9872_pin_nids[] = {
6309 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6313 static const hda_nid_t stac9872_adc_nids[] = {
6317 static const hda_nid_t stac9872_mux_nids[] = {
6321 static const unsigned long stac9872_capvols[] = {
6322 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
6324 #define stac9872_capsws stac9872_capvols
6326 static const unsigned int stac9872_vaio_pin_configs[9] = {
6327 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6328 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6332 static const char * const stac9872_models[STAC_9872_MODELS] = {
6333 [STAC_9872_AUTO] = "auto",
6334 [STAC_9872_VAIO] = "vaio",
6337 static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
6338 [STAC_9872_VAIO] = stac9872_vaio_pin_configs,
6341 static const struct snd_pci_quirk stac9872_cfg_tbl[] = {
6342 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6343 "Sony VAIO F/S", STAC_9872_VAIO),
6347 static int patch_stac9872(struct hda_codec *codec)
6349 struct sigmatel_spec *spec;
6352 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6355 codec->no_trigger_sense = 1;
6357 spec->linear_tone_beep = 1;
6358 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6359 spec->pin_nids = stac9872_pin_nids;
6361 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
6364 if (spec->board_config < 0)
6365 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6368 stac92xx_set_config_regs(codec,
6369 stac9872_brd_tbl[spec->board_config]);
6371 spec->multiout.dac_nids = spec->dac_nids;
6372 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
6373 spec->adc_nids = stac9872_adc_nids;
6374 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
6375 spec->mux_nids = stac9872_mux_nids;
6376 spec->init = stac9872_core_init;
6378 spec->capvols = stac9872_capvols;
6379 spec->capsws = stac9872_capsws;
6381 err = stac92xx_parse_auto_config(codec);
6383 stac92xx_free(codec);
6386 spec->input_mux = &spec->private_imux;
6387 codec->patch_ops = stac92xx_patch_ops;
6395 static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6396 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
6397 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
6398 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
6399 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
6400 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
6401 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
6402 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
6403 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
6404 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
6405 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
6406 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
6407 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
6408 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
6409 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
6410 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
6411 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
6412 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
6413 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
6414 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
6415 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
6416 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
6417 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
6418 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
6419 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
6420 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
6421 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
6422 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
6423 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
6424 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
6425 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
6426 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
6427 /* The following does not take into account .id=0x83847661 when subsys =
6428 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
6429 * currently not fully supported.
6431 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
6432 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
6433 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
6434 { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
6435 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
6436 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
6437 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
6438 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
6439 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
6440 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
6441 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
6442 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
6443 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
6444 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
6445 { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
6446 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
6447 { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
6448 { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
6449 { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
6450 { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
6451 { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
6452 { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
6453 { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
6454 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
6455 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
6456 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
6457 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
6458 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
6459 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
6460 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
6461 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
6462 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
6463 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
6464 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6465 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6466 { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
6467 { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
6468 { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
6469 { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
6470 { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
6471 { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
6472 { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
6473 { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
6474 { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
6475 { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
6476 { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
6477 { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
6478 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
6479 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
6480 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
6481 { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
6482 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
6483 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
6484 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
6485 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
6486 { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
6487 { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
6488 { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
6489 { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
6490 { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
6491 { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
6492 { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
6493 { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
6494 { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
6495 { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
6496 { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
6497 { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
6501 MODULE_ALIAS("snd-hda-codec-id:8384*");
6502 MODULE_ALIAS("snd-hda-codec-id:111d*");
6504 MODULE_LICENSE("GPL");
6505 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
6507 static struct hda_codec_preset_list sigmatel_list = {
6508 .preset = snd_hda_preset_sigmatel,
6509 .owner = THIS_MODULE,
6512 static int __init patch_sigmatel_init(void)
6514 return snd_hda_add_codec_preset(&sigmatel_list);
6517 static void __exit patch_sigmatel_exit(void)
6519 snd_hda_delete_codec_preset(&sigmatel_list);
6522 module_init(patch_sigmatel_init)
6523 module_exit(patch_sigmatel_exit)