2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for SigmaTel STAC92xx
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include <sound/asoundef.h>
33 #include "hda_codec.h"
34 #include "hda_local.h"
35 #include "hda_patch.h"
37 #define NUM_CONTROL_ALLOC 32
38 #define STAC_PWR_EVENT 0x20
39 #define STAC_HP_EVENT 0x30
97 /* for backward compatibility */
120 struct sigmatel_spec {
121 struct snd_kcontrol_new *mixers[4];
122 unsigned int num_mixers;
125 unsigned int surr_switch: 1;
126 unsigned int line_switch: 1;
127 unsigned int mic_switch: 1;
128 unsigned int alt_switch: 1;
129 unsigned int hp_detect: 1;
132 unsigned int gpio_mask;
133 unsigned int gpio_dir;
134 unsigned int gpio_data;
135 unsigned int gpio_mute;
137 /* analog loopback */
138 unsigned char aloopback_mask;
139 unsigned char aloopback_shift;
141 /* power management */
142 unsigned int num_pwrs;
147 struct hda_input_mux *mono_mux;
148 unsigned int cur_mmux;
149 struct hda_multi_out multiout;
150 hda_nid_t dac_nids[5];
154 unsigned int num_adcs;
156 unsigned int num_muxes;
157 hda_nid_t *dmic_nids;
158 unsigned int num_dmics;
159 hda_nid_t *dmux_nids;
160 unsigned int num_dmuxes;
161 hda_nid_t dig_in_nid;
166 unsigned int num_pins;
167 unsigned int *pin_configs;
168 unsigned int *bios_pin_configs;
170 /* codec specific stuff */
171 struct hda_verb *init;
172 struct snd_kcontrol_new *mixer;
175 struct hda_input_mux *dinput_mux;
176 unsigned int cur_dmux[2];
177 struct hda_input_mux *input_mux;
178 unsigned int cur_mux[3];
181 unsigned int io_switch[2];
182 unsigned int clfe_swap;
183 unsigned int aloopback;
185 struct hda_pcm pcm_rec[2]; /* PCM information */
187 /* dynamic controls and input_mux */
188 struct auto_pin_cfg autocfg;
189 unsigned int num_kctl_alloc, num_kctl_used;
190 struct snd_kcontrol_new *kctl_alloc;
191 struct hda_input_mux private_dimux;
192 struct hda_input_mux private_imux;
193 struct hda_input_mux private_mono_mux;
196 static hda_nid_t stac9200_adc_nids[1] = {
200 static hda_nid_t stac9200_mux_nids[1] = {
204 static hda_nid_t stac9200_dac_nids[1] = {
208 static hda_nid_t stac92hd73xx_pwr_nids[8] = {
209 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
213 static hda_nid_t stac92hd73xx_adc_nids[2] = {
217 #define STAC92HD73XX_NUM_DMICS 2
218 static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
222 #define STAC92HD73_DAC_COUNT 5
223 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {
224 0x15, 0x16, 0x17, 0x18, 0x19,
227 static hda_nid_t stac92hd73xx_mux_nids[4] = {
228 0x28, 0x29, 0x2a, 0x2b,
231 static hda_nid_t stac92hd73xx_dmux_nids[2] = {
235 static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
239 static hda_nid_t stac92hd71bxx_adc_nids[2] = {
243 static hda_nid_t stac92hd71bxx_mux_nids[2] = {
247 static hda_nid_t stac92hd71bxx_dmux_nids[1] = {
251 static hda_nid_t stac92hd71bxx_dac_nids[1] = {
255 #define STAC92HD71BXX_NUM_DMICS 2
256 static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
260 static hda_nid_t stac925x_adc_nids[1] = {
264 static hda_nid_t stac925x_mux_nids[1] = {
268 static hda_nid_t stac925x_dac_nids[1] = {
272 #define STAC925X_NUM_DMICS 1
273 static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
277 static hda_nid_t stac925x_dmux_nids[1] = {
281 static hda_nid_t stac922x_adc_nids[2] = {
285 static hda_nid_t stac922x_mux_nids[2] = {
289 static hda_nid_t stac927x_adc_nids[3] = {
293 static hda_nid_t stac927x_mux_nids[3] = {
297 static hda_nid_t stac927x_dac_nids[6] = {
298 0x02, 0x03, 0x04, 0x05, 0x06, 0
301 static hda_nid_t stac927x_dmux_nids[1] = {
305 #define STAC927X_NUM_DMICS 2
306 static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
310 static hda_nid_t stac9205_adc_nids[2] = {
314 static hda_nid_t stac9205_mux_nids[2] = {
318 static hda_nid_t stac9205_dmux_nids[1] = {
322 #define STAC9205_NUM_DMICS 2
323 static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
327 static hda_nid_t stac9200_pin_nids[8] = {
328 0x08, 0x09, 0x0d, 0x0e,
329 0x0f, 0x10, 0x11, 0x12,
332 static hda_nid_t stac925x_pin_nids[8] = {
333 0x07, 0x08, 0x0a, 0x0b,
334 0x0c, 0x0d, 0x10, 0x11,
337 static hda_nid_t stac922x_pin_nids[10] = {
338 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
339 0x0f, 0x10, 0x11, 0x15, 0x1b,
342 static hda_nid_t stac92hd73xx_pin_nids[13] = {
343 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
344 0x0f, 0x10, 0x11, 0x12, 0x13,
348 static hda_nid_t stac92hd71bxx_pin_nids[10] = {
349 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
350 0x0f, 0x14, 0x18, 0x19, 0x1e,
353 static hda_nid_t stac927x_pin_nids[14] = {
354 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
355 0x0f, 0x10, 0x11, 0x12, 0x13,
356 0x14, 0x21, 0x22, 0x23,
359 static hda_nid_t stac9205_pin_nids[12] = {
360 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
361 0x0f, 0x14, 0x16, 0x17, 0x18,
365 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_info *uinfo)
368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct sigmatel_spec *spec = codec->spec;
370 return snd_hda_input_mux_info(spec->dinput_mux, uinfo);
373 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol,
374 struct snd_ctl_elem_value *ucontrol)
376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
377 struct sigmatel_spec *spec = codec->spec;
378 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
380 ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx];
384 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol,
385 struct snd_ctl_elem_value *ucontrol)
387 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
388 struct sigmatel_spec *spec = codec->spec;
389 unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
391 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol,
392 spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]);
395 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
398 struct sigmatel_spec *spec = codec->spec;
399 return snd_hda_input_mux_info(spec->input_mux, uinfo);
402 static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
405 struct sigmatel_spec *spec = codec->spec;
406 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
408 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
412 static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
414 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
415 struct sigmatel_spec *spec = codec->spec;
416 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
418 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
419 spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]);
422 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol,
423 struct snd_ctl_elem_info *uinfo)
425 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
426 struct sigmatel_spec *spec = codec->spec;
427 return snd_hda_input_mux_info(spec->mono_mux, uinfo);
430 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_value *ucontrol)
433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
434 struct sigmatel_spec *spec = codec->spec;
436 ucontrol->value.enumerated.item[0] = spec->cur_mmux;
440 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol,
441 struct snd_ctl_elem_value *ucontrol)
443 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
444 struct sigmatel_spec *spec = codec->spec;
446 return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol,
447 spec->mono_nid, &spec->cur_mmux);
450 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
452 static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol,
453 struct snd_ctl_elem_value *ucontrol)
455 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
456 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
457 struct sigmatel_spec *spec = codec->spec;
459 ucontrol->value.integer.value[0] = !!(spec->aloopback &
460 (spec->aloopback_mask << idx));
464 static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 struct sigmatel_spec *spec = codec->spec;
469 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
470 unsigned int dac_mode;
471 unsigned int val, idx_val;
473 idx_val = spec->aloopback_mask << idx;
474 if (ucontrol->value.integer.value[0])
475 val = spec->aloopback | idx_val;
477 val = spec->aloopback & ~idx_val;
478 if (spec->aloopback == val)
481 spec->aloopback = val;
483 /* Only return the bits defined by the shift value of the
484 * first two bytes of the mask
486 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
487 kcontrol->private_value & 0xFFFF, 0x0);
488 dac_mode >>= spec->aloopback_shift;
490 if (spec->aloopback & idx_val) {
491 snd_hda_power_up(codec);
494 snd_hda_power_down(codec);
495 dac_mode &= ~idx_val;
498 snd_hda_codec_write_cache(codec, codec->afg, 0,
499 kcontrol->private_value >> 16, dac_mode);
504 static struct hda_verb stac9200_core_init[] = {
505 /* set dac0mux for dac converter */
506 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
510 static struct hda_verb stac9200_eapd_init[] = {
511 /* set dac0mux for dac converter */
512 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
513 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
517 static struct hda_verb stac92hd73xx_6ch_core_init[] = {
518 /* set master volume and direct control */
519 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
520 /* setup audio connections */
521 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
522 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
523 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
524 /* setup adcs to point to mixer */
525 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
526 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
527 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
528 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
529 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
530 /* setup import muxs */
531 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
532 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
533 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
534 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
538 static struct hda_verb dell_eq_core_init[] = {
539 /* set master volume to max value without distortion
540 * and direct control */
541 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
542 /* setup audio connections */
543 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
544 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
545 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
546 /* setup adcs to point to mixer */
547 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
548 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
549 /* setup import muxs */
550 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
551 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
552 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
553 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
557 static struct hda_verb dell_m6_core_init[] = {
558 /* set master volume and direct control */
559 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
560 /* setup audio connections */
561 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
562 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
563 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
564 /* setup adcs to point to mixer */
565 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
566 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
567 /* setup import muxs */
568 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
569 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
570 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
571 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00},
575 static struct hda_verb stac92hd73xx_8ch_core_init[] = {
576 /* set master volume and direct control */
577 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
578 /* setup audio connections */
579 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},
580 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},
581 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},
582 /* connect hp ports to dac3 */
583 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},
584 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},
585 /* setup adcs to point to mixer */
586 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
587 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
588 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
589 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
590 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
591 /* setup import muxs */
592 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
593 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
594 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
595 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
599 static struct hda_verb stac92hd73xx_10ch_core_init[] = {
600 /* set master volume and direct control */
601 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
602 /* setup audio connections */
603 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
604 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },
605 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },
606 /* dac3 is connected to import3 mux */
607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f},
608 /* connect hp ports to dac4 */
609 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},
610 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},
611 /* setup adcs to point to mixer */
612 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
613 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
614 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
615 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
616 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
617 /* setup import muxs */
618 { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01},
619 { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01},
620 { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01},
621 { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03},
625 static struct hda_verb stac92hd71bxx_core_init[] = {
626 /* set master volume and direct control */
627 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
628 /* connect headphone jack to dac1 */
629 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
630 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
631 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
632 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
633 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
634 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
637 static struct hda_verb stac92hd71bxx_analog_core_init[] = {
638 /* set master volume and direct control */
639 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
640 /* connect headphone jack to dac1 */
641 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
642 /* connect ports 0d and 0f to audio mixer */
643 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
644 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
645 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
646 /* unmute dac0 input in audio mixer */
647 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
648 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
649 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
650 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
651 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
655 static struct hda_verb stac925x_core_init[] = {
656 /* set dac0mux for dac converter */
657 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
661 static struct hda_verb stac922x_core_init[] = {
662 /* set master volume and direct control */
663 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
667 static struct hda_verb d965_core_init[] = {
668 /* set master volume and direct control */
669 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
670 /* unmute node 0x1b */
671 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
672 /* select node 0x03 as DAC */
673 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
677 static struct hda_verb stac927x_core_init[] = {
678 /* set master volume and direct control */
679 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
683 static struct hda_verb stac9205_core_init[] = {
684 /* set master volume and direct control */
685 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
689 #define STAC_MONO_MUX \
691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
692 .name = "Mono Mux", \
694 .info = stac92xx_mono_mux_enum_info, \
695 .get = stac92xx_mono_mux_enum_get, \
696 .put = stac92xx_mono_mux_enum_put, \
699 #define STAC_INPUT_SOURCE(cnt) \
701 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
702 .name = "Input Source", \
704 .info = stac92xx_mux_enum_info, \
705 .get = stac92xx_mux_enum_get, \
706 .put = stac92xx_mux_enum_put, \
709 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
711 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
712 .name = "Analog Loopback", \
714 .info = stac92xx_aloopback_info, \
715 .get = stac92xx_aloopback_get, \
716 .put = stac92xx_aloopback_put, \
717 .private_value = verb_read | (verb_write << 16), \
720 static struct snd_kcontrol_new stac9200_mixer[] = {
721 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
722 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
723 STAC_INPUT_SOURCE(1),
724 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
725 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
726 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
730 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
731 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
733 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
734 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
736 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
737 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
739 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
740 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
742 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
743 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
745 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
746 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
748 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
749 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
751 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
752 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
756 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
757 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
759 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
760 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
762 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
763 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
765 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
766 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
768 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
769 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
771 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
772 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
774 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
775 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
777 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
778 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
782 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
783 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
785 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
786 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
788 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
789 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
791 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
792 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
794 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
795 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
797 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
798 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
800 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
801 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
803 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
804 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
808 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
809 STAC_INPUT_SOURCE(2),
811 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
812 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
813 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
815 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
816 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
817 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
819 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT),
820 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT),
824 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
825 STAC_INPUT_SOURCE(2),
826 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
828 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
829 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
830 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
832 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT),
833 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT),
834 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT),
838 static struct snd_kcontrol_new stac925x_mixer[] = {
839 STAC_INPUT_SOURCE(1),
840 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
841 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
842 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
846 static struct snd_kcontrol_new stac9205_mixer[] = {
847 STAC_INPUT_SOURCE(2),
848 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
850 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
851 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
852 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
854 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
855 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
856 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
861 /* This needs to be generated dynamically based on sequence */
862 static struct snd_kcontrol_new stac922x_mixer[] = {
863 STAC_INPUT_SOURCE(2),
864 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
865 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
866 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
868 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
869 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
870 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
875 static struct snd_kcontrol_new stac927x_mixer[] = {
876 STAC_INPUT_SOURCE(3),
877 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
879 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
880 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
881 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
883 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
884 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
885 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
887 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
888 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
889 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
893 static struct snd_kcontrol_new stac_dmux_mixer = {
894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
895 .name = "Digital Input Source",
896 /* count set later */
897 .info = stac92xx_dmux_enum_info,
898 .get = stac92xx_dmux_enum_get,
899 .put = stac92xx_dmux_enum_put,
902 static const char *slave_vols[] = {
903 "Front Playback Volume",
904 "Surround Playback Volume",
905 "Center Playback Volume",
906 "LFE Playback Volume",
907 "Side Playback Volume",
908 "Headphone Playback Volume",
909 "Headphone Playback Volume",
910 "Speaker Playback Volume",
911 "External Speaker Playback Volume",
912 "Speaker2 Playback Volume",
916 static const char *slave_sws[] = {
917 "Front Playback Switch",
918 "Surround Playback Switch",
919 "Center Playback Switch",
920 "LFE Playback Switch",
921 "Side Playback Switch",
922 "Headphone Playback Switch",
923 "Headphone Playback Switch",
924 "Speaker Playback Switch",
925 "External Speaker Playback Switch",
926 "Speaker2 Playback Switch",
927 "IEC958 Playback Switch",
931 static int stac92xx_build_controls(struct hda_codec *codec)
933 struct sigmatel_spec *spec = codec->spec;
937 err = snd_hda_add_new_ctls(codec, spec->mixer);
941 for (i = 0; i < spec->num_mixers; i++) {
942 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
946 if (spec->num_dmuxes > 0) {
947 stac_dmux_mixer.count = spec->num_dmuxes;
948 err = snd_ctl_add(codec->bus->card,
949 snd_ctl_new1(&stac_dmux_mixer, codec));
954 if (spec->multiout.dig_out_nid) {
955 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid);
958 err = snd_hda_create_spdif_share_sw(codec,
962 spec->multiout.share_spdif = 1;
964 if (spec->dig_in_nid) {
965 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
970 /* if we have no master control, let's create it */
971 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
972 unsigned int vmaster_tlv[4];
973 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
974 HDA_OUTPUT, vmaster_tlv);
975 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
976 vmaster_tlv, slave_vols);
980 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
981 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
990 static unsigned int ref9200_pin_configs[8] = {
991 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
992 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
996 STAC 9200 pin configs for
1001 static unsigned int dell9200_d21_pin_configs[8] = {
1002 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1003 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1007 STAC 9200 pin configs for
1011 static unsigned int dell9200_d22_pin_configs[8] = {
1012 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1013 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1017 STAC 9200 pin configs for
1018 102801C4 (Dell Dimension E310)
1025 static unsigned int dell9200_d23_pin_configs[8] = {
1026 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1027 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1032 STAC 9200-32 pin configs for
1033 102801B5 (Dell Inspiron 630m)
1034 102801D8 (Dell Inspiron 640m)
1036 static unsigned int dell9200_m21_pin_configs[8] = {
1037 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1038 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1042 STAC 9200-32 pin configs for
1043 102801C2 (Dell Latitude D620)
1045 102801CC (Dell Latitude D820)
1049 static unsigned int dell9200_m22_pin_configs[8] = {
1050 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1051 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1055 STAC 9200-32 pin configs for
1056 102801CE (Dell XPS M1710)
1057 102801CF (Dell Precision M90)
1059 static unsigned int dell9200_m23_pin_configs[8] = {
1060 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1061 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1065 STAC 9200-32 pin configs for
1068 102801CB (Dell Latitude 120L)
1071 static unsigned int dell9200_m24_pin_configs[8] = {
1072 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1073 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1077 STAC 9200-32 pin configs for
1078 102801BD (Dell Inspiron E1505n)
1082 static unsigned int dell9200_m25_pin_configs[8] = {
1083 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1084 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1088 STAC 9200-32 pin configs for
1089 102801F5 (Dell Inspiron 1501)
1092 static unsigned int dell9200_m26_pin_configs[8] = {
1093 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1094 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1099 102801CD (Dell Inspiron E1705/9400)
1101 static unsigned int dell9200_m27_pin_configs[8] = {
1102 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1103 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1106 static unsigned int oqo9200_pin_configs[8] = {
1107 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1108 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1112 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1113 [STAC_REF] = ref9200_pin_configs,
1114 [STAC_9200_OQO] = oqo9200_pin_configs,
1115 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
1116 [STAC_9200_DELL_D22] = dell9200_d22_pin_configs,
1117 [STAC_9200_DELL_D23] = dell9200_d23_pin_configs,
1118 [STAC_9200_DELL_M21] = dell9200_m21_pin_configs,
1119 [STAC_9200_DELL_M22] = dell9200_m22_pin_configs,
1120 [STAC_9200_DELL_M23] = dell9200_m23_pin_configs,
1121 [STAC_9200_DELL_M24] = dell9200_m24_pin_configs,
1122 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1123 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1124 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1125 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1128 static const char *stac9200_models[STAC_9200_MODELS] = {
1130 [STAC_9200_OQO] = "oqo",
1131 [STAC_9200_DELL_D21] = "dell-d21",
1132 [STAC_9200_DELL_D22] = "dell-d22",
1133 [STAC_9200_DELL_D23] = "dell-d23",
1134 [STAC_9200_DELL_M21] = "dell-m21",
1135 [STAC_9200_DELL_M22] = "dell-m22",
1136 [STAC_9200_DELL_M23] = "dell-m23",
1137 [STAC_9200_DELL_M24] = "dell-m24",
1138 [STAC_9200_DELL_M25] = "dell-m25",
1139 [STAC_9200_DELL_M26] = "dell-m26",
1140 [STAC_9200_DELL_M27] = "dell-m27",
1141 [STAC_9200_GATEWAY] = "gateway",
1142 [STAC_9200_PANASONIC] = "panasonic",
1145 static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1146 /* SigmaTel reference board */
1147 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1148 "DFI LanParty", STAC_REF),
1149 /* Dell laptops have BIOS problem */
1150 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1151 "unknown Dell", STAC_9200_DELL_D21),
1152 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
1153 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1154 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1155 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1156 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1157 "unknown Dell", STAC_9200_DELL_D22),
1158 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1159 "unknown Dell", STAC_9200_DELL_D22),
1160 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
1161 "Dell Latitude D620", STAC_9200_DELL_M22),
1162 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1163 "unknown Dell", STAC_9200_DELL_D23),
1164 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1165 "unknown Dell", STAC_9200_DELL_D23),
1166 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1167 "unknown Dell", STAC_9200_DELL_M22),
1168 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1169 "unknown Dell", STAC_9200_DELL_M24),
1170 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1171 "unknown Dell", STAC_9200_DELL_M24),
1172 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
1173 "Dell Latitude 120L", STAC_9200_DELL_M24),
1174 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
1175 "Dell Latitude D820", STAC_9200_DELL_M22),
1176 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
1177 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
1178 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
1179 "Dell XPS M1710", STAC_9200_DELL_M23),
1180 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
1181 "Dell Precision M90", STAC_9200_DELL_M23),
1182 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1183 "unknown Dell", STAC_9200_DELL_M22),
1184 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1185 "unknown Dell", STAC_9200_DELL_M22),
1186 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
1187 "unknown Dell", STAC_9200_DELL_M22),
1188 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
1189 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1190 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1191 "unknown Dell", STAC_9200_DELL_D23),
1192 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1193 "unknown Dell", STAC_9200_DELL_D23),
1194 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1195 "unknown Dell", STAC_9200_DELL_D21),
1196 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1197 "unknown Dell", STAC_9200_DELL_D23),
1198 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1199 "unknown Dell", STAC_9200_DELL_D21),
1200 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1201 "unknown Dell", STAC_9200_DELL_M25),
1202 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1203 "unknown Dell", STAC_9200_DELL_M25),
1204 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
1205 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1206 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1207 "unknown Dell", STAC_9200_DELL_M26),
1209 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1210 /* Gateway machines needs EAPD to be set on resume */
1211 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY),
1212 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1214 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1217 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1221 static unsigned int ref925x_pin_configs[8] = {
1222 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1223 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1226 static unsigned int stac925x_MA6_pin_configs[8] = {
1227 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1228 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1231 static unsigned int stac925x_PA6_pin_configs[8] = {
1232 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1233 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1236 static unsigned int stac925xM2_2_pin_configs[8] = {
1237 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1238 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1241 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1242 [STAC_REF] = ref925x_pin_configs,
1243 [STAC_M2_2] = stac925xM2_2_pin_configs,
1244 [STAC_MA6] = stac925x_MA6_pin_configs,
1245 [STAC_PA6] = stac925x_PA6_pin_configs,
1248 static const char *stac925x_models[STAC_925x_MODELS] = {
1250 [STAC_M2_2] = "m2-2",
1255 static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1256 /* SigmaTel reference board */
1257 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1258 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1259 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
1260 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
1261 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
1262 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
1263 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1267 static unsigned int ref92hd73xx_pin_configs[13] = {
1268 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1269 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1270 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1274 static unsigned int dell_m6_pin_configs[13] = {
1275 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1276 0x03a11020, 0x03011050, 0x4f0000f0, 0x4f0000f0,
1277 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1281 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1282 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1283 [STAC_DELL_M6] = dell_m6_pin_configs,
1286 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1287 [STAC_92HD73XX_REF] = "ref",
1288 [STAC_DELL_M6] = "dell-m6",
1291 static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1292 /* SigmaTel reference board */
1293 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1294 "DFI LanParty", STAC_92HD73XX_REF),
1295 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1296 "unknown Dell", STAC_DELL_M6),
1297 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1298 "unknown Dell", STAC_DELL_M6),
1299 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1300 "unknown Dell", STAC_DELL_M6),
1301 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1302 "unknown Dell", STAC_DELL_M6),
1303 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1304 "unknown Dell", STAC_DELL_M6),
1305 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1306 "unknown Dell", STAC_DELL_M6),
1307 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1308 "unknown Dell", STAC_DELL_M6),
1312 static unsigned int ref92hd71bxx_pin_configs[10] = {
1313 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1314 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1315 0x90a000f0, 0x01452050,
1318 static unsigned int dell_m4_1_pin_configs[13] = {
1319 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1320 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1321 0x40f000f0, 0x4f0000f0,
1324 static unsigned int dell_m4_2_pin_configs[13] = {
1325 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1326 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1327 0x40f000f0, 0x044413b0,
1330 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1331 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1332 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1333 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1336 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1337 [STAC_92HD71BXX_REF] = "ref",
1338 [STAC_DELL_M4_1] = "dell-m4-1",
1339 [STAC_DELL_M4_2] = "dell-m4-2",
1342 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1343 /* SigmaTel reference board */
1344 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1345 "DFI LanParty", STAC_92HD71BXX_REF),
1346 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1347 "unknown Dell", STAC_DELL_M4_1),
1348 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
1349 "unknown Dell", STAC_DELL_M4_1),
1350 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
1351 "unknown Dell", STAC_DELL_M4_1),
1352 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
1353 "unknown Dell", STAC_DELL_M4_1),
1354 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
1355 "unknown Dell", STAC_DELL_M4_1),
1356 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
1357 "unknown Dell", STAC_DELL_M4_1),
1358 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
1359 "unknown Dell", STAC_DELL_M4_1),
1360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
1361 "unknown Dell", STAC_DELL_M4_2),
1362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
1363 "unknown Dell", STAC_DELL_M4_2),
1364 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
1365 "unknown Dell", STAC_DELL_M4_2),
1366 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1367 "unknown Dell", STAC_DELL_M4_2),
1371 static unsigned int ref922x_pin_configs[10] = {
1372 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1373 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1374 0x40000100, 0x40000100,
1378 STAC 922X pin configs for
1385 static unsigned int dell_922x_d81_pin_configs[10] = {
1386 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1387 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1388 0x01813122, 0x400001f2,
1392 STAC 922X pin configs for
1396 static unsigned int dell_922x_d82_pin_configs[10] = {
1397 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1398 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1399 0x01813122, 0x400001f1,
1403 STAC 922X pin configs for
1406 static unsigned int dell_922x_m81_pin_configs[10] = {
1407 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1408 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1409 0x40C003f1, 0x405003f0,
1413 STAC 9221 A1 pin configs for
1414 102801D7 (Dell XPS M1210)
1416 static unsigned int dell_922x_m82_pin_configs[10] = {
1417 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1418 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1419 0x508003f3, 0x405003f4,
1422 static unsigned int d945gtp3_pin_configs[10] = {
1423 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1424 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1425 0x02a19120, 0x40000100,
1428 static unsigned int d945gtp5_pin_configs[10] = {
1429 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1430 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1431 0x02a19320, 0x40000100,
1434 static unsigned int intel_mac_v1_pin_configs[10] = {
1435 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1436 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1437 0x400000fc, 0x400000fb,
1440 static unsigned int intel_mac_v2_pin_configs[10] = {
1441 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1442 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1443 0x400000fc, 0x400000fb,
1446 static unsigned int intel_mac_v3_pin_configs[10] = {
1447 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1448 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1449 0x400000fc, 0x400000fb,
1452 static unsigned int intel_mac_v4_pin_configs[10] = {
1453 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1454 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1455 0x400000fc, 0x400000fb,
1458 static unsigned int intel_mac_v5_pin_configs[10] = {
1459 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1460 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1461 0x400000fc, 0x400000fb,
1465 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1466 [STAC_D945_REF] = ref922x_pin_configs,
1467 [STAC_D945GTP3] = d945gtp3_pin_configs,
1468 [STAC_D945GTP5] = d945gtp5_pin_configs,
1469 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
1470 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
1471 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
1472 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
1473 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
1474 /* for backward compatibility */
1475 [STAC_MACMINI] = intel_mac_v3_pin_configs,
1476 [STAC_MACBOOK] = intel_mac_v5_pin_configs,
1477 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
1478 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
1479 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
1480 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
1481 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
1482 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
1483 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
1484 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1487 static const char *stac922x_models[STAC_922X_MODELS] = {
1488 [STAC_D945_REF] = "ref",
1489 [STAC_D945GTP5] = "5stack",
1490 [STAC_D945GTP3] = "3stack",
1491 [STAC_INTEL_MAC_V1] = "intel-mac-v1",
1492 [STAC_INTEL_MAC_V2] = "intel-mac-v2",
1493 [STAC_INTEL_MAC_V3] = "intel-mac-v3",
1494 [STAC_INTEL_MAC_V4] = "intel-mac-v4",
1495 [STAC_INTEL_MAC_V5] = "intel-mac-v5",
1496 /* for backward compatibility */
1497 [STAC_MACMINI] = "macmini",
1498 [STAC_MACBOOK] = "macbook",
1499 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
1500 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
1501 [STAC_IMAC_INTEL] = "imac-intel",
1502 [STAC_IMAC_INTEL_20] = "imac-intel-20",
1503 [STAC_922X_DELL_D81] = "dell-d81",
1504 [STAC_922X_DELL_D82] = "dell-d82",
1505 [STAC_922X_DELL_M81] = "dell-m81",
1506 [STAC_922X_DELL_M82] = "dell-m82",
1509 static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1510 /* SigmaTel reference board */
1511 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1512 "DFI LanParty", STAC_D945_REF),
1513 /* Intel 945G based systems */
1514 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
1515 "Intel D945G", STAC_D945GTP3),
1516 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
1517 "Intel D945G", STAC_D945GTP3),
1518 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
1519 "Intel D945G", STAC_D945GTP3),
1520 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
1521 "Intel D945G", STAC_D945GTP3),
1522 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
1523 "Intel D945G", STAC_D945GTP3),
1524 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
1525 "Intel D945G", STAC_D945GTP3),
1526 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
1527 "Intel D945G", STAC_D945GTP3),
1528 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
1529 "Intel D945G", STAC_D945GTP3),
1530 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
1531 "Intel D945G", STAC_D945GTP3),
1532 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
1533 "Intel D945G", STAC_D945GTP3),
1534 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
1535 "Intel D945G", STAC_D945GTP3),
1536 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
1537 "Intel D945G", STAC_D945GTP3),
1538 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
1539 "Intel D945G", STAC_D945GTP3),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
1541 "Intel D945G", STAC_D945GTP3),
1542 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
1543 "Intel D945G", STAC_D945GTP3),
1544 /* Intel D945G 5-stack systems */
1545 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
1546 "Intel D945G", STAC_D945GTP5),
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
1548 "Intel D945G", STAC_D945GTP5),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
1550 "Intel D945G", STAC_D945GTP5),
1551 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
1552 "Intel D945G", STAC_D945GTP5),
1553 /* Intel 945P based systems */
1554 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
1555 "Intel D945P", STAC_D945GTP3),
1556 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
1557 "Intel D945P", STAC_D945GTP3),
1558 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
1559 "Intel D945P", STAC_D945GTP3),
1560 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
1561 "Intel D945P", STAC_D945GTP3),
1562 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
1563 "Intel D945P", STAC_D945GTP3),
1564 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
1565 "Intel D945P", STAC_D945GTP5),
1567 /* Apple Mac Mini (early 2006) */
1568 SND_PCI_QUIRK(0x8384, 0x7680,
1569 "Mac Mini", STAC_INTEL_MAC_V3),
1571 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
1572 "unknown Dell", STAC_922X_DELL_D81),
1573 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
1574 "unknown Dell", STAC_922X_DELL_D81),
1575 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
1576 "unknown Dell", STAC_922X_DELL_D81),
1577 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
1578 "unknown Dell", STAC_922X_DELL_D82),
1579 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
1580 "unknown Dell", STAC_922X_DELL_M81),
1581 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
1582 "unknown Dell", STAC_922X_DELL_D82),
1583 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
1584 "unknown Dell", STAC_922X_DELL_D81),
1585 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
1586 "unknown Dell", STAC_922X_DELL_D81),
1587 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
1588 "Dell XPS M1210", STAC_922X_DELL_M82),
1592 static unsigned int ref927x_pin_configs[14] = {
1593 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1594 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1595 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1596 0x01c42190, 0x40000100,
1599 static unsigned int d965_3st_pin_configs[14] = {
1600 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1601 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1602 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1603 0x40000100, 0x40000100
1606 static unsigned int d965_5st_pin_configs[14] = {
1607 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1608 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1609 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1610 0x40000100, 0x40000100
1613 static unsigned int dell_3st_pin_configs[14] = {
1614 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1615 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1616 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1617 0x40c003fc, 0x40000100
1620 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1621 [STAC_D965_REF] = ref927x_pin_configs,
1622 [STAC_D965_3ST] = d965_3st_pin_configs,
1623 [STAC_D965_5ST] = d965_5st_pin_configs,
1624 [STAC_DELL_3ST] = dell_3st_pin_configs,
1625 [STAC_DELL_BIOS] = NULL,
1628 static const char *stac927x_models[STAC_927X_MODELS] = {
1629 [STAC_D965_REF] = "ref",
1630 [STAC_D965_3ST] = "3stack",
1631 [STAC_D965_5ST] = "5stack",
1632 [STAC_DELL_3ST] = "dell-3stack",
1633 [STAC_DELL_BIOS] = "dell-bios",
1636 static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1637 /* SigmaTel reference board */
1638 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1639 "DFI LanParty", STAC_D965_REF),
1640 /* Intel 946 based systems */
1641 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
1642 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
1643 /* 965 based 3 stack systems */
1644 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST),
1645 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST),
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST),
1647 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST),
1648 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST),
1649 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST),
1650 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST),
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST),
1652 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST),
1653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST),
1654 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST),
1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST),
1656 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST),
1657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST),
1658 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST),
1659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST),
1660 /* Dell 3 stack systems */
1661 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
1662 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
1663 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
1664 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
1665 /* Dell 3 stack systems with verb table in BIOS */
1666 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1667 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1668 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS),
1669 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1670 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1671 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1672 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
1673 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS),
1674 /* 965 based 5 stack systems */
1675 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST),
1676 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST),
1677 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST),
1678 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST),
1679 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST),
1680 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST),
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST),
1682 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST),
1683 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST),
1687 static unsigned int ref9205_pin_configs[12] = {
1688 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1689 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1690 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1694 STAC 9205 pin configs for
1701 10280228 (Dell Vostro 1500)
1703 static unsigned int dell_9205_m42_pin_configs[12] = {
1704 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1705 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1706 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1710 STAC 9205 pin configs for
1714 102801FF (Dell Precision M4300)
1719 static unsigned int dell_9205_m43_pin_configs[12] = {
1720 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1721 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1722 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1725 static unsigned int dell_9205_m44_pin_configs[12] = {
1726 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1727 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1728 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1731 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
1732 [STAC_9205_REF] = ref9205_pin_configs,
1733 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
1734 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
1735 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs,
1738 static const char *stac9205_models[STAC_9205_MODELS] = {
1739 [STAC_9205_REF] = "ref",
1740 [STAC_9205_DELL_M42] = "dell-m42",
1741 [STAC_9205_DELL_M43] = "dell-m43",
1742 [STAC_9205_DELL_M44] = "dell-m44",
1745 static struct snd_pci_quirk stac9205_cfg_tbl[] = {
1746 /* SigmaTel reference board */
1747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1748 "DFI LanParty", STAC_9205_REF),
1749 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1750 "unknown Dell", STAC_9205_DELL_M42),
1751 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1752 "unknown Dell", STAC_9205_DELL_M42),
1753 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
1754 "Dell Precision", STAC_9205_DELL_M43),
1755 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
1756 "Dell Precision", STAC_9205_DELL_M43),
1757 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
1758 "Dell Precision", STAC_9205_DELL_M43),
1759 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
1760 "Dell Precision", STAC_9205_DELL_M43),
1761 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
1762 "Dell Precision", STAC_9205_DELL_M43),
1763 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1764 "unknown Dell", STAC_9205_DELL_M42),
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1766 "unknown Dell", STAC_9205_DELL_M42),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
1768 "Dell Precision", STAC_9205_DELL_M43),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
1770 "Dell Precision M4300", STAC_9205_DELL_M43),
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
1772 "Dell Precision", STAC_9205_DELL_M43),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
1774 "Dell Inspiron", STAC_9205_DELL_M44),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
1776 "Dell Inspiron", STAC_9205_DELL_M44),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
1778 "Dell Inspiron", STAC_9205_DELL_M44),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
1780 "Dell Inspiron", STAC_9205_DELL_M44),
1781 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
1782 "unknown Dell", STAC_9205_DELL_M42),
1783 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
1784 "Dell Inspiron", STAC_9205_DELL_M44),
1785 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
1786 "Dell Vostro 1500", STAC_9205_DELL_M42),
1790 static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
1793 struct sigmatel_spec *spec = codec->spec;
1795 if (! spec->bios_pin_configs) {
1796 spec->bios_pin_configs = kcalloc(spec->num_pins,
1797 sizeof(*spec->bios_pin_configs), GFP_KERNEL);
1798 if (! spec->bios_pin_configs)
1802 for (i = 0; i < spec->num_pins; i++) {
1803 hda_nid_t nid = spec->pin_nids[i];
1804 unsigned int pin_cfg;
1806 pin_cfg = snd_hda_codec_read(codec, nid, 0,
1807 AC_VERB_GET_CONFIG_DEFAULT, 0x00);
1808 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1810 spec->bios_pin_configs[i] = pin_cfg;
1816 static void stac92xx_set_config_reg(struct hda_codec *codec,
1817 hda_nid_t pin_nid, unsigned int pin_config)
1820 snd_hda_codec_write(codec, pin_nid, 0,
1821 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
1822 pin_config & 0x000000ff);
1823 snd_hda_codec_write(codec, pin_nid, 0,
1824 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
1825 (pin_config & 0x0000ff00) >> 8);
1826 snd_hda_codec_write(codec, pin_nid, 0,
1827 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
1828 (pin_config & 0x00ff0000) >> 16);
1829 snd_hda_codec_write(codec, pin_nid, 0,
1830 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
1832 i = snd_hda_codec_read(codec, pin_nid, 0,
1833 AC_VERB_GET_CONFIG_DEFAULT,
1835 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
1839 static void stac92xx_set_config_regs(struct hda_codec *codec)
1842 struct sigmatel_spec *spec = codec->spec;
1844 if (!spec->pin_configs)
1847 for (i = 0; i < spec->num_pins; i++)
1848 stac92xx_set_config_reg(codec, spec->pin_nids[i],
1849 spec->pin_configs[i]);
1853 * Analog playback callbacks
1855 static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo,
1856 struct hda_codec *codec,
1857 struct snd_pcm_substream *substream)
1859 struct sigmatel_spec *spec = codec->spec;
1860 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
1864 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1865 struct hda_codec *codec,
1866 unsigned int stream_tag,
1867 unsigned int format,
1868 struct snd_pcm_substream *substream)
1870 struct sigmatel_spec *spec = codec->spec;
1871 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream);
1874 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1875 struct hda_codec *codec,
1876 struct snd_pcm_substream *substream)
1878 struct sigmatel_spec *spec = codec->spec;
1879 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
1883 * Digital playback callbacks
1885 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
1886 struct hda_codec *codec,
1887 struct snd_pcm_substream *substream)
1889 struct sigmatel_spec *spec = codec->spec;
1890 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
1893 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
1894 struct hda_codec *codec,
1895 struct snd_pcm_substream *substream)
1897 struct sigmatel_spec *spec = codec->spec;
1898 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
1901 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1902 struct hda_codec *codec,
1903 unsigned int stream_tag,
1904 unsigned int format,
1905 struct snd_pcm_substream *substream)
1907 struct sigmatel_spec *spec = codec->spec;
1908 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
1909 stream_tag, format, substream);
1914 * Analog capture callbacks
1916 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
1917 struct hda_codec *codec,
1918 unsigned int stream_tag,
1919 unsigned int format,
1920 struct snd_pcm_substream *substream)
1922 struct sigmatel_spec *spec = codec->spec;
1924 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
1925 stream_tag, 0, format);
1929 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1930 struct hda_codec *codec,
1931 struct snd_pcm_substream *substream)
1933 struct sigmatel_spec *spec = codec->spec;
1935 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
1939 static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
1943 /* NID is set in stac92xx_build_pcms */
1945 .open = stac92xx_dig_playback_pcm_open,
1946 .close = stac92xx_dig_playback_pcm_close,
1947 .prepare = stac92xx_dig_playback_pcm_prepare
1951 static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
1955 /* NID is set in stac92xx_build_pcms */
1958 static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
1962 .nid = 0x02, /* NID to query formats and rates */
1964 .open = stac92xx_playback_pcm_open,
1965 .prepare = stac92xx_playback_pcm_prepare,
1966 .cleanup = stac92xx_playback_pcm_cleanup
1970 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
1974 .nid = 0x06, /* NID to query formats and rates */
1976 .open = stac92xx_playback_pcm_open,
1977 .prepare = stac92xx_playback_pcm_prepare,
1978 .cleanup = stac92xx_playback_pcm_cleanup
1982 static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
1985 /* NID + .substreams is set in stac92xx_build_pcms */
1987 .prepare = stac92xx_capture_pcm_prepare,
1988 .cleanup = stac92xx_capture_pcm_cleanup
1992 static int stac92xx_build_pcms(struct hda_codec *codec)
1994 struct sigmatel_spec *spec = codec->spec;
1995 struct hda_pcm *info = spec->pcm_rec;
1997 codec->num_pcms = 1;
1998 codec->pcm_info = info;
2000 info->name = "STAC92xx Analog";
2001 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2002 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2003 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2004 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
2006 if (spec->alt_switch) {
2009 info->name = "STAC92xx Analog Alt";
2010 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback;
2013 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2016 info->name = "STAC92xx Digital";
2017 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2018 if (spec->multiout.dig_out_nid) {
2019 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
2020 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2022 if (spec->dig_in_nid) {
2023 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture;
2024 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2031 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2033 unsigned int pincap = snd_hda_param_read(codec, nid,
2035 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2036 if (pincap & AC_PINCAP_VREF_100)
2037 return AC_PINCTL_VREF_100;
2038 if (pincap & AC_PINCAP_VREF_80)
2039 return AC_PINCTL_VREF_80;
2040 if (pincap & AC_PINCAP_VREF_50)
2041 return AC_PINCTL_VREF_50;
2042 if (pincap & AC_PINCAP_VREF_GRD)
2043 return AC_PINCTL_VREF_GRD;
2047 static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2050 snd_hda_codec_write_cache(codec, nid, 0,
2051 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
2054 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2056 static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2058 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2059 struct sigmatel_spec *spec = codec->spec;
2060 int io_idx = kcontrol-> private_value & 0xff;
2062 ucontrol->value.integer.value[0] = spec->io_switch[io_idx];
2066 static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2068 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2069 struct sigmatel_spec *spec = codec->spec;
2070 hda_nid_t nid = kcontrol->private_value >> 8;
2071 int io_idx = kcontrol-> private_value & 0xff;
2072 unsigned short val = !!ucontrol->value.integer.value[0];
2074 spec->io_switch[io_idx] = val;
2077 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2079 unsigned int pinctl = AC_PINCTL_IN_EN;
2080 if (io_idx) /* set VREF for mic */
2081 pinctl |= stac92xx_get_vref(codec, nid);
2082 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2085 /* check the auto-mute again: we need to mute/unmute the speaker
2086 * appropriately according to the pin direction
2088 if (spec->hp_detect)
2089 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
2094 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2096 static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol,
2097 struct snd_ctl_elem_value *ucontrol)
2099 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2100 struct sigmatel_spec *spec = codec->spec;
2102 ucontrol->value.integer.value[0] = spec->clfe_swap;
2106 static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol,
2107 struct snd_ctl_elem_value *ucontrol)
2109 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2110 struct sigmatel_spec *spec = codec->spec;
2111 hda_nid_t nid = kcontrol->private_value & 0xff;
2112 unsigned int val = !!ucontrol->value.integer.value[0];
2114 if (spec->clfe_swap == val)
2117 spec->clfe_swap = val;
2119 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
2120 spec->clfe_swap ? 0x4 : 0x0);
2125 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2126 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2129 .info = stac92xx_io_switch_info, \
2130 .get = stac92xx_io_switch_get, \
2131 .put = stac92xx_io_switch_put, \
2132 .private_value = xpval, \
2135 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2136 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2139 .info = stac92xx_clfe_switch_info, \
2140 .get = stac92xx_clfe_switch_get, \
2141 .put = stac92xx_clfe_switch_put, \
2142 .private_value = xpval, \
2146 STAC_CTL_WIDGET_VOL,
2147 STAC_CTL_WIDGET_MUTE,
2148 STAC_CTL_WIDGET_MONO_MUX,
2149 STAC_CTL_WIDGET_IO_SWITCH,
2150 STAC_CTL_WIDGET_CLFE_SWITCH
2153 static struct snd_kcontrol_new stac92xx_control_templates[] = {
2154 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2155 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2157 STAC_CODEC_IO_SWITCH(NULL, 0),
2158 STAC_CODEC_CLFE_SWITCH(NULL, 0),
2161 /* add dynamic controls */
2162 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val)
2164 struct snd_kcontrol_new *knew;
2166 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2167 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2169 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */
2172 if (spec->kctl_alloc) {
2173 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc);
2174 kfree(spec->kctl_alloc);
2176 spec->kctl_alloc = knew;
2177 spec->num_kctl_alloc = num;
2180 knew = &spec->kctl_alloc[spec->num_kctl_used];
2181 *knew = stac92xx_control_templates[type];
2182 knew->name = kstrdup(name, GFP_KERNEL);
2185 knew->private_value = val;
2186 spec->num_kctl_used++;
2190 /* flag inputs as additional dynamic lineouts */
2191 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg)
2193 struct sigmatel_spec *spec = codec->spec;
2194 unsigned int wcaps, wtype;
2195 int i, num_dacs = 0;
2197 /* use the wcaps cache to count all DACs available for line-outs */
2198 for (i = 0; i < codec->num_nodes; i++) {
2199 wcaps = codec->wcaps[i];
2200 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2202 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL))
2206 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs);
2208 switch (cfg->line_outs) {
2210 /* add line-in as side */
2211 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
2212 cfg->line_out_pins[cfg->line_outs] =
2213 cfg->input_pins[AUTO_PIN_LINE];
2214 spec->line_switch = 1;
2219 /* add line-in as clfe and mic as side */
2220 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
2221 cfg->line_out_pins[cfg->line_outs] =
2222 cfg->input_pins[AUTO_PIN_LINE];
2223 spec->line_switch = 1;
2226 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
2227 cfg->line_out_pins[cfg->line_outs] =
2228 cfg->input_pins[AUTO_PIN_MIC];
2229 spec->mic_switch = 1;
2234 /* add line-in as surr and mic as clfe */
2235 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
2236 cfg->line_out_pins[cfg->line_outs] =
2237 cfg->input_pins[AUTO_PIN_LINE];
2238 spec->line_switch = 1;
2241 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
2242 cfg->line_out_pins[cfg->line_outs] =
2243 cfg->input_pins[AUTO_PIN_MIC];
2244 spec->mic_switch = 1;
2254 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2258 for (i = 0; i < spec->multiout.num_dacs; i++) {
2259 if (spec->multiout.dac_nids[i] == nid)
2267 * Fill in the dac_nids table from the parsed pin configuration
2268 * This function only works when every pin in line_out_pins[]
2269 * contains atleast one DAC in its connection list. Some 92xx
2270 * codecs are not connected directly to a DAC, such as the 9200
2271 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2273 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
2274 struct auto_pin_cfg *cfg)
2276 struct sigmatel_spec *spec = codec->spec;
2277 int i, j, conn_len = 0;
2278 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS];
2279 unsigned int wcaps, wtype;
2281 for (i = 0; i < cfg->line_outs; i++) {
2282 nid = cfg->line_out_pins[i];
2283 conn_len = snd_hda_get_connections(codec, nid, conn,
2284 HDA_MAX_CONNECTIONS);
2285 for (j = 0; j < conn_len; j++) {
2286 wcaps = snd_hda_param_read(codec, conn[j],
2287 AC_PAR_AUDIO_WIDGET_CAP);
2288 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2289 if (wtype != AC_WID_AUD_OUT ||
2290 (wcaps & AC_WCAP_DIGITAL))
2292 /* conn[j] is a DAC routed to this line-out */
2293 if (!is_in_dac_nids(spec, conn[j]))
2297 if (j == conn_len) {
2298 if (spec->multiout.num_dacs > 0) {
2299 /* we have already working output pins,
2300 * so let's drop the broken ones again
2302 cfg->line_outs = spec->multiout.num_dacs;
2305 /* error out, no available DAC found */
2307 "%s: No available DAC for pin 0x%x\n",
2312 spec->multiout.dac_nids[i] = conn[j];
2313 spec->multiout.num_dacs++;
2315 /* select this DAC in the pin's input mux */
2316 snd_hda_codec_write_cache(codec, nid, 0,
2317 AC_VERB_SET_CONNECT_SEL, j);
2322 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2323 spec->multiout.num_dacs,
2324 spec->multiout.dac_nids[0],
2325 spec->multiout.dac_nids[1],
2326 spec->multiout.dac_nids[2],
2327 spec->multiout.dac_nids[3],
2328 spec->multiout.dac_nids[4]);
2332 /* create volume control/switch for the given prefx type */
2333 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs)
2338 sprintf(name, "%s Playback Volume", pfx);
2339 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name,
2340 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2343 sprintf(name, "%s Playback Switch", pfx);
2344 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name,
2345 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
2351 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2353 if (!spec->multiout.hp_nid)
2354 spec->multiout.hp_nid = nid;
2355 else if (spec->multiout.num_dacs > 4) {
2356 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
2359 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
2360 spec->multiout.num_dacs++;
2365 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
2367 if (is_in_dac_nids(spec, nid))
2369 if (spec->multiout.hp_nid == nid)
2374 /* add playback controls from the parsed DAC table */
2375 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2376 const struct auto_pin_cfg *cfg)
2378 static const char *chname[4] = {
2379 "Front", "Surround", NULL /*CLFE*/, "Side"
2384 struct sigmatel_spec *spec = codec->spec;
2385 unsigned int wid_caps, pincap;
2388 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) {
2389 if (!spec->multiout.dac_nids[i])
2392 nid = spec->multiout.dac_nids[i];
2396 err = create_controls(spec, "Center", nid, 1);
2399 err = create_controls(spec, "LFE", nid, 2);
2403 wid_caps = get_wcaps(codec, nid);
2405 if (wid_caps & AC_WCAP_LR_SWAP) {
2406 err = stac92xx_add_control(spec,
2407 STAC_CTL_WIDGET_CLFE_SWITCH,
2408 "Swap Center/LFE Playback Switch", nid);
2415 err = create_controls(spec, chname[i], nid, 3);
2421 if (spec->line_switch) {
2422 nid = cfg->input_pins[AUTO_PIN_LINE];
2423 pincap = snd_hda_param_read(codec, nid,
2425 if (pincap & AC_PINCAP_OUT) {
2426 err = stac92xx_add_control(spec,
2427 STAC_CTL_WIDGET_IO_SWITCH,
2428 "Line In as Output Switch", nid << 8);
2434 if (spec->mic_switch) {
2435 unsigned int def_conf;
2436 unsigned int mic_pin = AUTO_PIN_MIC;
2438 nid = cfg->input_pins[mic_pin];
2439 def_conf = snd_hda_codec_read(codec, nid, 0,
2440 AC_VERB_GET_CONFIG_DEFAULT, 0);
2441 /* some laptops have an internal analog microphone
2442 * which can't be used as a output */
2443 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2444 pincap = snd_hda_param_read(codec, nid,
2446 if (pincap & AC_PINCAP_OUT) {
2447 err = stac92xx_add_control(spec,
2448 STAC_CTL_WIDGET_IO_SWITCH,
2449 "Mic as Output Switch", (nid << 8) | 1);
2450 nid = snd_hda_codec_read(codec, nid, 0,
2451 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2452 if (!check_in_dac_nids(spec, nid))
2453 add_spec_dacs(spec, nid);
2457 } else if (mic_pin == AUTO_PIN_MIC) {
2458 mic_pin = AUTO_PIN_FRONT_MIC;
2466 /* add playback controls for Speaker and HP outputs */
2467 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
2468 struct auto_pin_cfg *cfg)
2470 struct sigmatel_spec *spec = codec->spec;
2472 int i, old_num_dacs, err;
2474 old_num_dacs = spec->multiout.num_dacs;
2475 for (i = 0; i < cfg->hp_outs; i++) {
2476 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]);
2477 if (wid_caps & AC_WCAP_UNSOL_CAP)
2478 spec->hp_detect = 1;
2479 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0,
2480 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2481 if (check_in_dac_nids(spec, nid))
2485 add_spec_dacs(spec, nid);
2487 for (i = 0; i < cfg->speaker_outs; i++) {
2488 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0,
2489 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2490 if (check_in_dac_nids(spec, nid))
2494 add_spec_dacs(spec, nid);
2496 for (i = 0; i < cfg->line_outs; i++) {
2497 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
2498 AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
2499 if (check_in_dac_nids(spec, nid))
2503 add_spec_dacs(spec, nid);
2505 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
2506 static const char *pfxs[] = {
2507 "Speaker", "External Speaker", "Speaker2",
2509 err = create_controls(spec, pfxs[i - old_num_dacs],
2510 spec->multiout.dac_nids[i], 3);
2514 if (spec->multiout.hp_nid) {
2515 err = create_controls(spec, "Headphone",
2516 spec->multiout.hp_nid, 3);
2524 /* labels for mono mux outputs */
2525 static const char *stac92xx_mono_labels[3] = {
2526 "DAC0", "DAC1", "Mixer"
2529 /* create mono mux for mono out on capable codecs */
2530 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
2532 struct sigmatel_spec *spec = codec->spec;
2533 struct hda_input_mux *mono_mux = &spec->private_mono_mux;
2535 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)];
2537 num_cons = snd_hda_get_connections(codec,
2540 HDA_MAX_NUM_INPUTS);
2541 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels))
2544 for (i = 0; i < num_cons; i++) {
2545 mono_mux->items[mono_mux->num_items].label =
2546 stac92xx_mono_labels[i];
2547 mono_mux->items[mono_mux->num_items].index = i;
2548 mono_mux->num_items++;
2551 return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX,
2552 "Mono Mux", spec->mono_nid);
2555 /* labels for dmic mux inputs */
2556 static const char *stac92xx_dmic_labels[5] = {
2557 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2558 "Digital Mic 3", "Digital Mic 4"
2561 /* create playback/capture controls for input pins on dmic capable codecs */
2562 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2563 const struct auto_pin_cfg *cfg)
2565 struct sigmatel_spec *spec = codec->spec;
2566 struct hda_input_mux *dimux = &spec->private_dimux;
2567 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2571 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2572 dimux->items[dimux->num_items].index = 0;
2575 for (i = 0; i < spec->num_dmics; i++) {
2580 unsigned int def_conf;
2582 def_conf = snd_hda_codec_read(codec,
2585 AC_VERB_GET_CONFIG_DEFAULT,
2587 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2590 nid = spec->dmic_nids[i];
2591 num_cons = snd_hda_get_connections(codec,
2594 HDA_MAX_NUM_INPUTS);
2595 for (j = 0; j < num_cons; j++)
2596 if (con_lst[j] == nid) {
2602 wcaps = get_wcaps(codec, nid);
2604 if (wcaps & AC_WCAP_OUT_AMP) {
2605 sprintf(name, "%s Capture Volume",
2606 stac92xx_dmic_labels[dimux->num_items]);
2608 err = stac92xx_add_control(spec,
2609 STAC_CTL_WIDGET_VOL,
2611 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
2616 dimux->items[dimux->num_items].label =
2617 stac92xx_dmic_labels[dimux->num_items];
2618 dimux->items[dimux->num_items].index = index;
2625 /* create playback/capture controls for input pins */
2626 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg)
2628 struct sigmatel_spec *spec = codec->spec;
2629 struct hda_input_mux *imux = &spec->private_imux;
2630 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2633 for (i = 0; i < AUTO_PIN_LAST; i++) {
2636 if (!cfg->input_pins[i])
2639 for (j = 0; j < spec->num_muxes; j++) {
2641 num_cons = snd_hda_get_connections(codec,
2644 HDA_MAX_NUM_INPUTS);
2645 for (k = 0; k < num_cons; k++)
2646 if (con_lst[k] == cfg->input_pins[i]) {
2653 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
2654 imux->items[imux->num_items].index = index;
2658 if (imux->num_items) {
2660 * Set the current input for the muxes.
2661 * The STAC9221 has two input muxes with identical source
2662 * NID lists. Hopefully this won't get confused.
2664 for (i = 0; i < spec->num_muxes; i++) {
2665 snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0,
2666 AC_VERB_SET_CONNECT_SEL,
2667 imux->items[0].index);
2674 static void stac92xx_auto_init_multi_out(struct hda_codec *codec)
2676 struct sigmatel_spec *spec = codec->spec;
2679 for (i = 0; i < spec->autocfg.line_outs; i++) {
2680 hda_nid_t nid = spec->autocfg.line_out_pins[i];
2681 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN);
2685 static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
2687 struct sigmatel_spec *spec = codec->spec;
2690 for (i = 0; i < spec->autocfg.hp_outs; i++) {
2692 pin = spec->autocfg.hp_pins[i];
2693 if (pin) /* connect to front */
2694 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
2696 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
2698 pin = spec->autocfg.speaker_pins[i];
2699 if (pin) /* connect to front */
2700 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN);
2704 static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
2706 struct sigmatel_spec *spec = codec->spec;
2708 int hp_speaker_swap = 0;
2710 if ((err = snd_hda_parse_pin_def_config(codec,
2712 spec->dmic_nids)) < 0)
2714 if (! spec->autocfg.line_outs)
2715 return 0; /* can't find valid pin config */
2717 /* If we have no real line-out pin and multiple hp-outs, HPs should
2718 * be set up as multi-channel outputs.
2720 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2721 spec->autocfg.hp_outs > 1) {
2722 /* Copy hp_outs to line_outs, backup line_outs in
2723 * speaker_outs so that the following routines can handle
2724 * HP pins as primary outputs.
2726 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
2727 sizeof(spec->autocfg.line_out_pins));
2728 spec->autocfg.speaker_outs = spec->autocfg.line_outs;
2729 memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
2730 sizeof(spec->autocfg.hp_pins));
2731 spec->autocfg.line_outs = spec->autocfg.hp_outs;
2732 hp_speaker_swap = 1;
2734 if (spec->autocfg.mono_out_pin) {
2735 int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin)
2736 & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
2737 u32 caps = query_amp_caps(codec,
2738 spec->autocfg.mono_out_pin, dir);
2739 hda_nid_t conn_list[1];
2741 /* get the mixer node and then the mono mux if it exists */
2742 if (snd_hda_get_connections(codec,
2743 spec->autocfg.mono_out_pin, conn_list, 1) &&
2744 snd_hda_get_connections(codec, conn_list[0],
2747 int wcaps = get_wcaps(codec, conn_list[0]);
2748 int wid_type = (wcaps & AC_WCAP_TYPE)
2749 >> AC_WCAP_TYPE_SHIFT;
2750 /* LR swap check, some stac925x have a mux that
2751 * changes the DACs output path instead of the
2754 if (wid_type == AC_WID_AUD_SEL &&
2755 !(wcaps & AC_WCAP_LR_SWAP))
2756 spec->mono_nid = conn_list[0];
2758 /* all mono outs have a least a mute/unmute switch */
2759 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
2760 "Mono Playback Switch",
2761 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2765 /* check to see if there is volume support for the amp */
2766 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
2767 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
2768 "Mono Playback Volume",
2769 HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
2775 stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
2779 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
2781 if (spec->multiout.num_dacs == 0)
2782 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
2785 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
2790 if (hp_speaker_swap == 1) {
2791 /* Restore the hp_outs and line_outs */
2792 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
2793 sizeof(spec->autocfg.line_out_pins));
2794 spec->autocfg.hp_outs = spec->autocfg.line_outs;
2795 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
2796 sizeof(spec->autocfg.speaker_pins));
2797 spec->autocfg.line_outs = spec->autocfg.speaker_outs;
2798 memset(spec->autocfg.speaker_pins, 0,
2799 sizeof(spec->autocfg.speaker_pins));
2800 spec->autocfg.speaker_outs = 0;
2803 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
2808 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg);
2813 if (spec->mono_nid > 0) {
2814 err = stac92xx_auto_create_mono_output_ctls(codec);
2819 if (spec->num_dmics > 0)
2820 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
2821 &spec->autocfg)) < 0)
2824 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
2825 if (spec->multiout.max_channels > 2)
2826 spec->surr_switch = 1;
2828 if (spec->autocfg.dig_out_pin)
2829 spec->multiout.dig_out_nid = dig_out;
2830 if (spec->autocfg.dig_in_pin)
2831 spec->dig_in_nid = dig_in;
2833 if (spec->kctl_alloc)
2834 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2836 spec->input_mux = &spec->private_imux;
2837 if (!spec->dinput_mux)
2838 spec->dinput_mux = &spec->private_dimux;
2839 spec->mono_mux = &spec->private_mono_mux;
2844 /* add playback controls for HP output */
2845 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
2846 struct auto_pin_cfg *cfg)
2848 struct sigmatel_spec *spec = codec->spec;
2849 hda_nid_t pin = cfg->hp_pins[0];
2850 unsigned int wid_caps;
2855 wid_caps = get_wcaps(codec, pin);
2856 if (wid_caps & AC_WCAP_UNSOL_CAP)
2857 spec->hp_detect = 1;
2862 /* add playback controls for LFE output */
2863 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
2864 struct auto_pin_cfg *cfg)
2866 struct sigmatel_spec *spec = codec->spec;
2868 hda_nid_t lfe_pin = 0x0;
2872 * search speaker outs and line outs for a mono speaker pin
2873 * with an amp. If one is found, add LFE controls
2876 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
2877 hda_nid_t pin = spec->autocfg.speaker_pins[i];
2878 unsigned int wcaps = get_wcaps(codec, pin);
2879 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2880 if (wcaps == AC_WCAP_OUT_AMP)
2881 /* found a mono speaker with an amp, must be lfe */
2885 /* if speaker_outs is 0, then speakers may be in line_outs */
2886 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
2887 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
2888 hda_nid_t pin = spec->autocfg.line_out_pins[i];
2889 unsigned int defcfg;
2890 defcfg = snd_hda_codec_read(codec, pin, 0,
2891 AC_VERB_GET_CONFIG_DEFAULT,
2893 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
2894 unsigned int wcaps = get_wcaps(codec, pin);
2895 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
2896 if (wcaps == AC_WCAP_OUT_AMP)
2897 /* found a mono speaker with an amp,
2905 err = create_controls(spec, "LFE", lfe_pin, 1);
2913 static int stac9200_parse_auto_config(struct hda_codec *codec)
2915 struct sigmatel_spec *spec = codec->spec;
2918 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0)
2921 if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0)
2924 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
2927 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
2930 if (spec->autocfg.dig_out_pin)
2931 spec->multiout.dig_out_nid = 0x05;
2932 if (spec->autocfg.dig_in_pin)
2933 spec->dig_in_nid = 0x04;
2935 if (spec->kctl_alloc)
2936 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
2938 spec->input_mux = &spec->private_imux;
2939 spec->dinput_mux = &spec->private_dimux;
2945 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
2946 * funky external mute control using GPIO pins.
2949 static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
2950 unsigned int dir_mask, unsigned int data)
2952 unsigned int gpiostate, gpiomask, gpiodir;
2954 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
2955 AC_VERB_GET_GPIO_DATA, 0);
2956 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
2958 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
2959 AC_VERB_GET_GPIO_MASK, 0);
2962 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
2963 AC_VERB_GET_GPIO_DIRECTION, 0);
2964 gpiodir |= dir_mask;
2966 /* Configure GPIOx as CMOS */
2967 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
2969 snd_hda_codec_write(codec, codec->afg, 0,
2970 AC_VERB_SET_GPIO_MASK, gpiomask);
2971 snd_hda_codec_read(codec, codec->afg, 0,
2972 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
2976 snd_hda_codec_read(codec, codec->afg, 0,
2977 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
2980 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
2983 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)
2984 snd_hda_codec_write_cache(codec, nid, 0,
2985 AC_VERB_SET_UNSOLICITED_ENABLE,
2986 (AC_USRSP_EN | event));
2989 static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
2992 for (i = 0; i < cfg->hp_outs; i++)
2993 if (cfg->hp_pins[i] == nid)
2994 return 1; /* nid is a HP-Out */
2996 return 0; /* nid is not a HP-Out */
2999 static void stac92xx_power_down(struct hda_codec *codec)
3001 struct sigmatel_spec *spec = codec->spec;
3003 /* power down inactive DACs */
3005 for (dac = spec->dac_list; *dac; dac++)
3006 if (!is_in_dac_nids(spec, *dac) &&
3007 spec->multiout.hp_nid != *dac)
3008 snd_hda_codec_write_cache(codec, *dac, 0,
3009 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3012 static int stac92xx_init(struct hda_codec *codec)
3014 struct sigmatel_spec *spec = codec->spec;
3015 struct auto_pin_cfg *cfg = &spec->autocfg;
3018 snd_hda_sequence_write(codec, spec->init);
3021 if (spec->hp_detect) {
3022 /* Enable unsolicited responses on the HP widget */
3023 for (i = 0; i < cfg->hp_outs; i++)
3024 enable_pin_detect(codec, cfg->hp_pins[i],
3026 /* force to enable the first line-out; the others are set up
3029 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
3031 stac92xx_auto_init_hp_out(codec);
3032 /* fake event to set up pins */
3033 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3035 stac92xx_auto_init_multi_out(codec);
3036 stac92xx_auto_init_hp_out(codec);
3038 for (i = 0; i < AUTO_PIN_LAST; i++) {
3039 hda_nid_t nid = cfg->input_pins[i];
3041 unsigned int pinctl = AC_PINCTL_IN_EN;
3042 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC)
3043 pinctl |= stac92xx_get_vref(codec, nid);
3044 stac92xx_auto_set_pinctl(codec, nid, pinctl);
3047 for (i = 0; i < spec->num_dmics; i++)
3048 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3050 for (i = 0; i < spec->num_pwrs; i++) {
3051 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i])
3052 ? STAC_HP_EVENT : STAC_PWR_EVENT;
3053 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i],
3054 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3055 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i],
3056 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
3057 /* outputs are only ports capable of power management
3058 * any attempts on powering down a input port cause the
3059 * referenced VREF to act quirky.
3061 if (pinctl & AC_PINCTL_IN_EN)
3063 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED)
3065 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3066 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3069 stac92xx_power_down(codec);
3070 if (cfg->dig_out_pin)
3071 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3073 if (cfg->dig_in_pin)
3074 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3077 stac_gpio_set(codec, spec->gpio_mask,
3078 spec->gpio_dir, spec->gpio_data);
3083 static void stac92xx_free(struct hda_codec *codec)
3085 struct sigmatel_spec *spec = codec->spec;
3091 if (spec->kctl_alloc) {
3092 for (i = 0; i < spec->num_kctl_used; i++)
3093 kfree(spec->kctl_alloc[i].name);
3094 kfree(spec->kctl_alloc);
3097 if (spec->bios_pin_configs)
3098 kfree(spec->bios_pin_configs);
3103 static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
3106 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3107 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3109 if (pin_ctl & AC_PINCTL_IN_EN) {
3111 * we need to check the current set-up direction of
3112 * shared input pins since they can be switched via
3113 * "xxx as Output" mixer switch
3115 struct sigmatel_spec *spec = codec->spec;
3116 struct auto_pin_cfg *cfg = &spec->autocfg;
3117 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
3118 spec->line_switch) ||
3119 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
3124 /* if setting pin direction bits, clear the current
3125 direction bits first */
3126 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
3127 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
3129 snd_hda_codec_write_cache(codec, nid, 0,
3130 AC_VERB_SET_PIN_WIDGET_CONTROL,
3134 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
3137 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
3138 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
3139 snd_hda_codec_write_cache(codec, nid, 0,
3140 AC_VERB_SET_PIN_WIDGET_CONTROL,
3144 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid)
3148 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00)
3150 unsigned int pinctl;
3151 pinctl = snd_hda_codec_read(codec, nid, 0,
3152 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3153 if (pinctl & AC_PINCTL_IN_EN)
3154 return 0; /* mic- or line-input */
3156 return 1; /* HP-output */
3161 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3163 struct sigmatel_spec *spec = codec->spec;
3164 struct auto_pin_cfg *cfg = &spec->autocfg;
3168 if (spec->gpio_mute)
3169 presence = !(snd_hda_codec_read(codec, codec->afg, 0,
3170 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
3172 for (i = 0; i < cfg->hp_outs; i++) {
3175 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]);
3179 /* disable lineouts, enable hp */
3180 for (i = 0; i < cfg->line_outs; i++)
3181 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i],
3183 for (i = 0; i < cfg->speaker_outs; i++)
3184 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3187 /* enable lineouts, disable hp */
3188 for (i = 0; i < cfg->line_outs; i++)
3189 stac92xx_set_pinctl(codec, cfg->line_out_pins[i],
3191 for (i = 0; i < cfg->speaker_outs; i++)
3192 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3197 static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3199 struct sigmatel_spec *spec = codec->spec;
3200 hda_nid_t nid = spec->pwr_nids[idx];
3202 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0)
3204 presence = get_hp_pin_presence(codec, nid);
3212 /* power down unused output ports */
3213 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3216 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3218 struct sigmatel_spec *spec = codec->spec;
3219 int idx = res >> 26 & 0x0f;
3221 switch ((res >> 26) & 0x30) {
3223 stac92xx_hp_detect(codec, res);
3225 case STAC_PWR_EVENT:
3226 if (spec->num_pwrs > 0)
3227 stac92xx_pin_sense(codec, idx);
3231 #ifdef SND_HDA_NEEDS_RESUME
3232 static int stac92xx_resume(struct hda_codec *codec)
3234 struct sigmatel_spec *spec = codec->spec;
3236 stac92xx_set_config_regs(codec);
3237 snd_hda_sequence_write(codec, spec->init);
3238 stac_gpio_set(codec, spec->gpio_mask,
3239 spec->gpio_dir, spec->gpio_data);
3240 snd_hda_codec_resume_amp(codec);
3241 snd_hda_codec_resume_cache(codec);
3242 /* power down inactive DACs */
3244 stac92xx_power_down(codec);
3245 /* invoke unsolicited event to reset the HP state */
3246 if (spec->hp_detect)
3247 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
3252 static struct hda_codec_ops stac92xx_patch_ops = {
3253 .build_controls = stac92xx_build_controls,
3254 .build_pcms = stac92xx_build_pcms,
3255 .init = stac92xx_init,
3256 .free = stac92xx_free,
3257 .unsol_event = stac92xx_unsol_event,
3258 #ifdef SND_HDA_NEEDS_RESUME
3259 .resume = stac92xx_resume,
3263 static int patch_stac9200(struct hda_codec *codec)
3265 struct sigmatel_spec *spec;
3268 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3273 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
3274 spec->pin_nids = stac9200_pin_nids;
3275 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
3278 if (spec->board_config < 0) {
3279 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3280 err = stac92xx_save_bios_config_regs(codec);
3282 stac92xx_free(codec);
3285 spec->pin_configs = spec->bios_pin_configs;
3287 spec->pin_configs = stac9200_brd_tbl[spec->board_config];
3288 stac92xx_set_config_regs(codec);
3291 spec->multiout.max_channels = 2;
3292 spec->multiout.num_dacs = 1;
3293 spec->multiout.dac_nids = stac9200_dac_nids;
3294 spec->adc_nids = stac9200_adc_nids;
3295 spec->mux_nids = stac9200_mux_nids;
3296 spec->num_muxes = 1;
3297 spec->num_dmics = 0;
3301 if (spec->board_config == STAC_9200_GATEWAY ||
3302 spec->board_config == STAC_9200_OQO)
3303 spec->init = stac9200_eapd_init;
3305 spec->init = stac9200_core_init;
3306 spec->mixer = stac9200_mixer;
3308 if (spec->board_config == STAC_9200_PANASONIC) {
3309 spec->gpio_mask = spec->gpio_dir = 0x09;
3310 spec->gpio_data = 0x00;
3313 err = stac9200_parse_auto_config(codec);
3315 stac92xx_free(codec);
3319 codec->patch_ops = stac92xx_patch_ops;
3324 static int patch_stac925x(struct hda_codec *codec)
3326 struct sigmatel_spec *spec;
3329 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3334 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
3335 spec->pin_nids = stac925x_pin_nids;
3336 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
3340 if (spec->board_config < 0) {
3341 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
3342 "using BIOS defaults\n");
3343 err = stac92xx_save_bios_config_regs(codec);
3345 stac92xx_free(codec);
3348 spec->pin_configs = spec->bios_pin_configs;
3349 } else if (stac925x_brd_tbl[spec->board_config] != NULL){
3350 spec->pin_configs = stac925x_brd_tbl[spec->board_config];
3351 stac92xx_set_config_regs(codec);
3354 spec->multiout.max_channels = 2;
3355 spec->multiout.num_dacs = 1;
3356 spec->multiout.dac_nids = stac925x_dac_nids;
3357 spec->adc_nids = stac925x_adc_nids;
3358 spec->mux_nids = stac925x_mux_nids;
3359 spec->num_muxes = 1;
3362 switch (codec->vendor_id) {
3363 case 0x83847632: /* STAC9202 */
3364 case 0x83847633: /* STAC9202D */
3365 case 0x83847636: /* STAC9251 */
3366 case 0x83847637: /* STAC9251D */
3367 spec->num_dmics = STAC925X_NUM_DMICS;
3368 spec->dmic_nids = stac925x_dmic_nids;
3369 spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids);
3370 spec->dmux_nids = stac925x_dmux_nids;
3373 spec->num_dmics = 0;
3377 spec->init = stac925x_core_init;
3378 spec->mixer = stac925x_mixer;
3380 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
3382 if (spec->board_config < 0) {
3383 printk(KERN_WARNING "hda_codec: No auto-config is "
3384 "available, default to model=ref\n");
3385 spec->board_config = STAC_925x_REF;
3391 stac92xx_free(codec);
3395 codec->patch_ops = stac92xx_patch_ops;
3400 static struct hda_input_mux stac92hd73xx_dmux = {
3403 { "Analog Inputs", 0x0b },
3405 { "Digital Mic 1", 0x09 },
3406 { "Digital Mic 2", 0x0a },
3410 static int patch_stac92hd73xx(struct hda_codec *codec)
3412 struct sigmatel_spec *spec;
3413 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
3416 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3421 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
3422 spec->pin_nids = stac92hd73xx_pin_nids;
3423 spec->board_config = snd_hda_check_board_config(codec,
3424 STAC_92HD73XX_MODELS,
3425 stac92hd73xx_models,
3426 stac92hd73xx_cfg_tbl);
3428 if (spec->board_config < 0) {
3429 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3430 " STAC92HD73XX, using BIOS defaults\n");
3431 err = stac92xx_save_bios_config_regs(codec);
3433 stac92xx_free(codec);
3436 spec->pin_configs = spec->bios_pin_configs;
3438 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config];
3439 stac92xx_set_config_regs(codec);
3442 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a,
3443 conn, STAC92HD73_DAC_COUNT + 2) - 1;
3445 if (spec->multiout.num_dacs < 0) {
3446 printk(KERN_WARNING "hda_codec: Could not determine "
3447 "number of channels defaulting to DAC count\n");
3448 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT;
3451 switch (spec->multiout.num_dacs) {
3452 case 0x3: /* 6 Channel */
3453 spec->mixer = stac92hd73xx_6ch_mixer;
3454 spec->init = stac92hd73xx_6ch_core_init;
3456 case 0x4: /* 8 Channel */
3457 spec->multiout.hp_nid = 0x18;
3458 spec->mixer = stac92hd73xx_8ch_mixer;
3459 spec->init = stac92hd73xx_8ch_core_init;
3461 case 0x5: /* 10 Channel */
3462 spec->multiout.hp_nid = 0x19;
3463 spec->mixer = stac92hd73xx_10ch_mixer;
3464 spec->init = stac92hd73xx_10ch_core_init;
3467 spec->multiout.dac_nids = stac92hd73xx_dac_nids;
3468 spec->aloopback_mask = 0x01;
3469 spec->aloopback_shift = 8;
3471 spec->mux_nids = stac92hd73xx_mux_nids;
3472 spec->adc_nids = stac92hd73xx_adc_nids;
3473 spec->dmic_nids = stac92hd73xx_dmic_nids;
3474 spec->dmux_nids = stac92hd73xx_dmux_nids;
3476 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
3477 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
3478 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3479 spec->dinput_mux = &stac92hd73xx_dmux;
3480 /* GPIO0 High = Enable EAPD */
3481 spec->gpio_mask = spec->gpio_dir = 0x1;
3482 spec->gpio_data = 0x01;
3484 switch (spec->board_config) {
3486 spec->init = dell_eq_core_init;
3487 switch (codec->subsystem_id) {
3488 case 0x1028025e: /* Analog Mics */
3490 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3491 spec->num_dmics = 0;
3493 case 0x10280271: /* Digital Mics */
3495 spec->init = dell_m6_core_init;
3499 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3500 spec->num_dmics = 1;
3502 case 0x10280256: /* Both */
3504 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
3505 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
3506 spec->num_dmics = 1;
3511 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
3514 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3515 spec->pwr_nids = stac92hd73xx_pwr_nids;
3517 err = stac92xx_parse_auto_config(codec, 0x22, 0x24);
3520 if (spec->board_config < 0) {
3521 printk(KERN_WARNING "hda_codec: No auto-config is "
3522 "available, default to model=ref\n");
3523 spec->board_config = STAC_92HD73XX_REF;
3530 stac92xx_free(codec);
3534 codec->patch_ops = stac92xx_patch_ops;
3539 static int patch_stac92hd71bxx(struct hda_codec *codec)
3541 struct sigmatel_spec *spec;
3544 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3549 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
3550 spec->pin_nids = stac92hd71bxx_pin_nids;
3551 spec->board_config = snd_hda_check_board_config(codec,
3552 STAC_92HD71BXX_MODELS,
3553 stac92hd71bxx_models,
3554 stac92hd71bxx_cfg_tbl);
3556 if (spec->board_config < 0) {
3557 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3558 " STAC92HD71BXX, using BIOS defaults\n");
3559 err = stac92xx_save_bios_config_regs(codec);
3561 stac92xx_free(codec);
3564 spec->pin_configs = spec->bios_pin_configs;
3566 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config];
3567 stac92xx_set_config_regs(codec);
3570 switch (codec->vendor_id) {
3571 case 0x111d76b6: /* 4 Port without Analog Mixer */
3573 case 0x111d76b4: /* 6 Port without Analog Mixer */
3575 spec->mixer = stac92hd71bxx_mixer;
3576 spec->init = stac92hd71bxx_core_init;
3579 spec->mixer = stac92hd71bxx_analog_mixer;
3580 spec->init = stac92hd71bxx_analog_core_init;
3583 spec->aloopback_mask = 0x20;
3584 spec->aloopback_shift = 0;
3586 /* GPIO0 High = EAPD */
3587 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1;
3589 spec->mux_nids = stac92hd71bxx_mux_nids;
3590 spec->adc_nids = stac92hd71bxx_adc_nids;
3591 spec->dmic_nids = stac92hd71bxx_dmic_nids;
3592 spec->dmux_nids = stac92hd71bxx_dmux_nids;
3594 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
3595 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
3596 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
3597 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
3599 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
3600 spec->pwr_nids = stac92hd71bxx_pwr_nids;
3602 spec->multiout.num_dacs = 1;
3603 spec->multiout.hp_nid = 0x11;
3604 spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
3606 err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
3608 if (spec->board_config < 0) {
3609 printk(KERN_WARNING "hda_codec: No auto-config is "
3610 "available, default to model=ref\n");
3611 spec->board_config = STAC_92HD71BXX_REF;
3618 stac92xx_free(codec);
3622 codec->patch_ops = stac92xx_patch_ops;
3627 static int patch_stac922x(struct hda_codec *codec)
3629 struct sigmatel_spec *spec;
3632 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3637 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
3638 spec->pin_nids = stac922x_pin_nids;
3639 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
3642 if (spec->board_config == STAC_INTEL_MAC_V3) {
3643 spec->gpio_mask = spec->gpio_dir = 0x03;
3644 spec->gpio_data = 0x03;
3645 /* Intel Macs have all same PCI SSID, so we need to check
3646 * codec SSID to distinguish the exact models
3648 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
3649 switch (codec->subsystem_id) {
3652 spec->board_config = STAC_INTEL_MAC_V1;
3656 spec->board_config = STAC_INTEL_MAC_V2;
3664 spec->board_config = STAC_INTEL_MAC_V3;
3668 spec->board_config = STAC_INTEL_MAC_V4;
3672 spec->board_config = STAC_INTEL_MAC_V5;
3678 if (spec->board_config < 0) {
3679 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
3680 "using BIOS defaults\n");
3681 err = stac92xx_save_bios_config_regs(codec);
3683 stac92xx_free(codec);
3686 spec->pin_configs = spec->bios_pin_configs;
3687 } else if (stac922x_brd_tbl[spec->board_config] != NULL) {
3688 spec->pin_configs = stac922x_brd_tbl[spec->board_config];
3689 stac92xx_set_config_regs(codec);
3692 spec->adc_nids = stac922x_adc_nids;
3693 spec->mux_nids = stac922x_mux_nids;
3694 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
3695 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
3696 spec->num_dmics = 0;
3699 spec->init = stac922x_core_init;
3700 spec->mixer = stac922x_mixer;
3702 spec->multiout.dac_nids = spec->dac_nids;
3704 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
3706 if (spec->board_config < 0) {
3707 printk(KERN_WARNING "hda_codec: No auto-config is "
3708 "available, default to model=ref\n");
3709 spec->board_config = STAC_D945_REF;
3715 stac92xx_free(codec);
3719 codec->patch_ops = stac92xx_patch_ops;
3721 /* Fix Mux capture level; max to 2 */
3722 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
3723 (0 << AC_AMPCAP_OFFSET_SHIFT) |
3724 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
3725 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3726 (0 << AC_AMPCAP_MUTE_SHIFT));
3731 static int patch_stac927x(struct hda_codec *codec)
3733 struct sigmatel_spec *spec;
3736 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3741 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
3742 spec->pin_nids = stac927x_pin_nids;
3743 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
3747 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) {
3748 if (spec->board_config < 0)
3749 snd_printdd(KERN_INFO "hda_codec: Unknown model for"
3750 "STAC927x, using BIOS defaults\n");
3751 err = stac92xx_save_bios_config_regs(codec);
3753 stac92xx_free(codec);
3756 spec->pin_configs = spec->bios_pin_configs;
3758 spec->pin_configs = stac927x_brd_tbl[spec->board_config];
3759 stac92xx_set_config_regs(codec);
3762 spec->adc_nids = stac927x_adc_nids;
3763 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
3764 spec->mux_nids = stac927x_mux_nids;
3765 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
3766 spec->dac_list = stac927x_dac_nids;
3767 spec->multiout.dac_nids = spec->dac_nids;
3769 switch (spec->board_config) {
3772 /* GPIO0 High = Enable EAPD */
3773 spec->gpio_mask = spec->gpio_dir = 0x01;
3774 spec->gpio_data = 0x01;
3775 spec->num_dmics = 0;
3777 spec->init = d965_core_init;
3778 spec->mixer = stac927x_mixer;
3780 case STAC_DELL_BIOS:
3781 switch (codec->subsystem_id) {
3784 /* correct the device field to SPDIF out */
3785 stac92xx_set_config_reg(codec, 0x21, 0x01442070);
3788 /* configure the analog microphone on some laptops */
3789 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130);
3790 /* correct the front output jack as a hp out */
3791 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f);
3792 /* correct the front input jack as a mic */
3793 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130);
3796 /* GPIO2 High = Enable EAPD */
3797 spec->gpio_mask = spec->gpio_dir = 0x04;
3798 spec->gpio_data = 0x04;
3799 spec->dmic_nids = stac927x_dmic_nids;
3800 spec->num_dmics = STAC927X_NUM_DMICS;
3802 spec->init = d965_core_init;
3803 spec->mixer = stac927x_mixer;
3804 spec->dmux_nids = stac927x_dmux_nids;
3805 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
3808 /* GPIO0 High = Enable EAPD */
3809 spec->gpio_mask = spec->gpio_dir = 0x1;
3810 spec->gpio_data = 0x01;
3811 spec->num_dmics = 0;
3813 spec->init = stac927x_core_init;
3814 spec->mixer = stac927x_mixer;
3818 spec->aloopback_mask = 0x40;
3819 spec->aloopback_shift = 0;
3821 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
3823 if (spec->board_config < 0) {
3824 printk(KERN_WARNING "hda_codec: No auto-config is "
3825 "available, default to model=ref\n");
3826 spec->board_config = STAC_D965_REF;
3832 stac92xx_free(codec);
3836 codec->patch_ops = stac92xx_patch_ops;
3840 * The STAC927x seem to require fairly long delays for certain
3841 * command sequences. With too short delays (even if the answer
3842 * is set to RIRB properly), it results in the silence output
3843 * on some hardwares like Dell.
3845 * The below flag enables the longer delay (see get_response
3848 codec->bus->needs_damn_long_delay = 1;
3853 static int patch_stac9205(struct hda_codec *codec)
3855 struct sigmatel_spec *spec;
3858 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3863 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
3864 spec->pin_nids = stac9205_pin_nids;
3865 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
3869 if (spec->board_config < 0) {
3870 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
3871 err = stac92xx_save_bios_config_regs(codec);
3873 stac92xx_free(codec);
3876 spec->pin_configs = spec->bios_pin_configs;
3878 spec->pin_configs = stac9205_brd_tbl[spec->board_config];
3879 stac92xx_set_config_regs(codec);
3882 spec->adc_nids = stac9205_adc_nids;
3883 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
3884 spec->mux_nids = stac9205_mux_nids;
3885 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
3886 spec->dmic_nids = stac9205_dmic_nids;
3887 spec->num_dmics = STAC9205_NUM_DMICS;
3888 spec->dmux_nids = stac9205_dmux_nids;
3889 spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids);
3892 spec->init = stac9205_core_init;
3893 spec->mixer = stac9205_mixer;
3895 spec->aloopback_mask = 0x40;
3896 spec->aloopback_shift = 0;
3897 spec->multiout.dac_nids = spec->dac_nids;
3899 switch (spec->board_config){
3900 case STAC_9205_DELL_M43:
3901 /* Enable SPDIF in/out */
3902 stac92xx_set_config_reg(codec, 0x1f, 0x01441030);
3903 stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
3905 /* Enable unsol response for GPIO4/Dock HP connection */
3906 snd_hda_codec_write(codec, codec->afg, 0,
3907 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
3908 snd_hda_codec_write_cache(codec, codec->afg, 0,
3909 AC_VERB_SET_UNSOLICITED_ENABLE,
3910 (AC_USRSP_EN | STAC_HP_EVENT));
3912 spec->gpio_dir = 0x0b;
3913 spec->gpio_mask = 0x1b;
3914 spec->gpio_mute = 0x10;
3915 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3918 spec->gpio_data = 0x01;
3921 /* GPIO0 High = EAPD */
3922 spec->gpio_mask = spec->gpio_dir = 0x1;
3923 spec->gpio_data = 0x01;
3927 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
3929 if (spec->board_config < 0) {
3930 printk(KERN_WARNING "hda_codec: No auto-config is "
3931 "available, default to model=ref\n");
3932 spec->board_config = STAC_9205_REF;
3938 stac92xx_free(codec);
3942 codec->patch_ops = stac92xx_patch_ops;
3951 /* static config for Sony VAIO FE550G and Sony VAIO AR */
3952 static hda_nid_t vaio_dacs[] = { 0x2 };
3953 #define VAIO_HP_DAC 0x5
3954 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
3955 static hda_nid_t vaio_mux_nids[] = { 0x15 };
3957 static struct hda_input_mux vaio_mux = {
3960 /* { "HP", 0x0 }, */
3961 { "Mic Jack", 0x1 },
3962 { "Internal Mic", 0x2 },
3967 static struct hda_verb vaio_init[] = {
3968 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3969 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
3970 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3971 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3972 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3974 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3975 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3976 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
3983 static struct hda_verb vaio_ar_init[] = {
3984 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
3985 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
3986 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
3987 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
3988 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
3989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
3990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
3991 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
3992 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
3993 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
3994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
3995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
3996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4000 /* bind volumes of both NID 0x02 and 0x05 */
4001 static struct hda_bind_ctls vaio_bind_master_vol = {
4002 .ops = &snd_hda_bind_vol,
4004 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4005 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4010 /* bind volumes of both NID 0x02 and 0x05 */
4011 static struct hda_bind_ctls vaio_bind_master_sw = {
4012 .ops = &snd_hda_bind_sw,
4014 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
4015 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
4020 static struct snd_kcontrol_new vaio_mixer[] = {
4021 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4022 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4023 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4024 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4025 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4028 .name = "Capture Source",
4030 .info = stac92xx_mux_enum_info,
4031 .get = stac92xx_mux_enum_get,
4032 .put = stac92xx_mux_enum_put,
4037 static struct snd_kcontrol_new vaio_ar_mixer[] = {
4038 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol),
4039 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw),
4040 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4041 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
4042 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
4043 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4044 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4047 .name = "Capture Source",
4049 .info = stac92xx_mux_enum_info,
4050 .get = stac92xx_mux_enum_get,
4051 .put = stac92xx_mux_enum_put,
4056 static struct hda_codec_ops stac9872_patch_ops = {
4057 .build_controls = stac92xx_build_controls,
4058 .build_pcms = stac92xx_build_pcms,
4059 .init = stac92xx_init,
4060 .free = stac92xx_free,
4061 #ifdef SND_HDA_NEEDS_RESUME
4062 .resume = stac92xx_resume,
4066 static int stac9872_vaio_init(struct hda_codec *codec)
4070 err = stac92xx_init(codec);
4073 if (codec->patch_ops.unsol_event)
4074 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
4078 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
4080 if (get_hp_pin_presence(codec, 0x0a)) {
4081 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4082 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4084 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
4085 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
4089 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
4091 switch (res >> 26) {
4093 stac9872_vaio_hp_detect(codec, res);
4098 static struct hda_codec_ops stac9872_vaio_patch_ops = {
4099 .build_controls = stac92xx_build_controls,
4100 .build_pcms = stac92xx_build_pcms,
4101 .init = stac9872_vaio_init,
4102 .free = stac92xx_free,
4103 .unsol_event = stac9872_vaio_unsol_event,
4105 .resume = stac92xx_resume,
4109 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4111 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4113 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4115 /* AR Series. id=0x83847664 and subsys=104D1300 */
4120 static const char *stac9872_models[STAC_9872_MODELS] = {
4121 [CXD9872RD_VAIO] = "vaio",
4122 [CXD9872AKD_VAIO] = "vaio-ar",
4125 static struct snd_pci_quirk stac9872_cfg_tbl[] = {
4126 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
4127 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
4128 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
4129 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
4133 static int patch_stac9872(struct hda_codec *codec)
4135 struct sigmatel_spec *spec;
4138 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
4141 if (board_config < 0)
4142 /* unknown config, let generic-parser do its job... */
4143 return snd_hda_parse_generic_codec(codec);
4145 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4150 switch (board_config) {
4151 case CXD9872RD_VAIO:
4152 case STAC9872AK_VAIO:
4153 case STAC9872K_VAIO:
4154 spec->mixer = vaio_mixer;
4155 spec->init = vaio_init;
4156 spec->multiout.max_channels = 2;
4157 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4158 spec->multiout.dac_nids = vaio_dacs;
4159 spec->multiout.hp_nid = VAIO_HP_DAC;
4160 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4161 spec->adc_nids = vaio_adcs;
4163 spec->input_mux = &vaio_mux;
4164 spec->mux_nids = vaio_mux_nids;
4165 codec->patch_ops = stac9872_vaio_patch_ops;
4168 case CXD9872AKD_VAIO:
4169 spec->mixer = vaio_ar_mixer;
4170 spec->init = vaio_ar_init;
4171 spec->multiout.max_channels = 2;
4172 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
4173 spec->multiout.dac_nids = vaio_dacs;
4174 spec->multiout.hp_nid = VAIO_HP_DAC;
4175 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
4177 spec->adc_nids = vaio_adcs;
4178 spec->input_mux = &vaio_mux;
4179 spec->mux_nids = vaio_mux_nids;
4180 codec->patch_ops = stac9872_patch_ops;
4191 struct hda_codec_preset snd_hda_preset_sigmatel[] = {
4192 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4193 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4194 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4195 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4196 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4197 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4198 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
4199 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4200 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4201 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4202 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4203 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4204 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
4205 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4206 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4207 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4208 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4209 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4210 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4211 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4212 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4213 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4214 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
4215 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4216 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4217 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4218 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4219 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4220 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
4221 /* The following does not take into account .id=0x83847661 when subsys =
4222 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4223 * currently not fully supported.
4225 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4226 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4227 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
4228 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4229 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4230 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4231 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4232 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4233 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4234 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4235 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
4236 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4237 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
4238 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4239 { .id = 0x111d7608, .name = "92HD71BXX", .patch = patch_stac92hd71bxx },
4240 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4241 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4242 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4243 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4244 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4245 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4246 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4247 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },