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"
38 #define NUM_CONTROL_ALLOC 32
39 #define STAC_PWR_EVENT 0x20
40 #define STAC_HP_EVENT 0x30
103 STAC_INTEL_MAC_AUTO
, /* This model is selected if no module parameter
104 * is given, one of the above models will be
105 * chosen according to the subsystem id. */
106 /* for backward compatibility */
129 struct sigmatel_spec
{
130 struct snd_kcontrol_new
*mixers
[4];
131 unsigned int num_mixers
;
134 unsigned int surr_switch
: 1;
135 unsigned int line_switch
: 1;
136 unsigned int mic_switch
: 1;
137 unsigned int alt_switch
: 1;
138 unsigned int hp_detect
: 1;
141 unsigned int eapd_mask
;
142 unsigned int gpio_mask
;
143 unsigned int gpio_dir
;
144 unsigned int gpio_data
;
145 unsigned int gpio_mute
;
147 /* analog loopback */
148 unsigned char aloopback_mask
;
149 unsigned char aloopback_shift
;
151 /* power management */
152 unsigned int num_pwrs
;
153 unsigned int *pwr_mapping
;
158 struct hda_input_mux
*mono_mux
;
159 unsigned int cur_mmux
;
160 struct hda_multi_out multiout
;
161 hda_nid_t dac_nids
[5];
165 unsigned int num_adcs
;
167 unsigned int num_muxes
;
168 hda_nid_t
*dmic_nids
;
169 unsigned int num_dmics
;
170 hda_nid_t
*dmux_nids
;
171 unsigned int num_dmuxes
;
172 hda_nid_t dig_in_nid
;
174 hda_nid_t anabeep_nid
;
175 hda_nid_t digbeep_nid
;
179 unsigned int num_pins
;
180 unsigned int *pin_configs
;
181 unsigned int *bios_pin_configs
;
183 /* codec specific stuff */
184 struct hda_verb
*init
;
185 struct snd_kcontrol_new
*mixer
;
188 struct hda_input_mux
*dinput_mux
;
189 unsigned int cur_dmux
[2];
190 struct hda_input_mux
*input_mux
;
191 unsigned int cur_mux
[3];
194 unsigned int io_switch
[2];
195 unsigned int clfe_swap
;
196 unsigned int hp_switch
;
197 unsigned int aloopback
;
199 struct hda_pcm pcm_rec
[2]; /* PCM information */
201 /* dynamic controls and input_mux */
202 struct auto_pin_cfg autocfg
;
203 unsigned int num_kctl_alloc
, num_kctl_used
;
204 struct snd_kcontrol_new
*kctl_alloc
;
205 struct hda_input_mux private_dimux
;
206 struct hda_input_mux private_imux
;
207 struct hda_input_mux private_mono_mux
;
210 static hda_nid_t stac9200_adc_nids
[1] = {
214 static hda_nid_t stac9200_mux_nids
[1] = {
218 static hda_nid_t stac9200_dac_nids
[1] = {
222 static hda_nid_t stac92hd73xx_pwr_nids
[8] = {
223 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
227 static hda_nid_t stac92hd73xx_adc_nids
[2] = {
231 #define STAC92HD73XX_NUM_DMICS 2
232 static hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
236 #define STAC92HD73_DAC_COUNT 5
237 static hda_nid_t stac92hd73xx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
238 0x15, 0x16, 0x17, 0x18, 0x19,
241 static hda_nid_t stac92hd73xx_mux_nids
[4] = {
242 0x28, 0x29, 0x2a, 0x2b,
245 static hda_nid_t stac92hd73xx_dmux_nids
[2] = {
249 #define STAC92HD83XXX_NUM_DMICS 2
250 static hda_nid_t stac92hd83xxx_dmic_nids
[STAC92HD83XXX_NUM_DMICS
+ 1] = {
254 #define STAC92HD81_DAC_COUNT 2
255 #define STAC92HD83_DAC_COUNT 3
256 static hda_nid_t stac92hd83xxx_dac_nids
[STAC92HD73_DAC_COUNT
] = {
260 static hda_nid_t stac92hd83xxx_dmux_nids
[2] = {
264 static hda_nid_t stac92hd83xxx_adc_nids
[2] = {
268 static hda_nid_t stac92hd83xxx_pwr_nids
[4] = {
272 static unsigned int stac92hd83xxx_pwr_mapping
[4] = {
273 0x03, 0x0c, 0x10, 0x40,
276 static hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
280 static hda_nid_t stac92hd71bxx_adc_nids
[2] = {
284 static hda_nid_t stac92hd71bxx_mux_nids
[2] = {
288 static hda_nid_t stac92hd71bxx_dmux_nids
[1] = {
292 static hda_nid_t stac92hd71bxx_dac_nids
[1] = {
296 #define STAC92HD71BXX_NUM_DMICS 2
297 static hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
301 static hda_nid_t stac925x_adc_nids
[1] = {
305 static hda_nid_t stac925x_mux_nids
[1] = {
309 static hda_nid_t stac925x_dac_nids
[1] = {
313 #define STAC925X_NUM_DMICS 1
314 static hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
318 static hda_nid_t stac925x_dmux_nids
[1] = {
322 static hda_nid_t stac922x_adc_nids
[2] = {
326 static hda_nid_t stac922x_mux_nids
[2] = {
330 static hda_nid_t stac927x_adc_nids
[3] = {
334 static hda_nid_t stac927x_mux_nids
[3] = {
338 static hda_nid_t stac927x_dac_nids
[6] = {
339 0x02, 0x03, 0x04, 0x05, 0x06, 0
342 static hda_nid_t stac927x_dmux_nids
[1] = {
346 #define STAC927X_NUM_DMICS 2
347 static hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
351 static hda_nid_t stac9205_adc_nids
[2] = {
355 static hda_nid_t stac9205_mux_nids
[2] = {
359 static hda_nid_t stac9205_dmux_nids
[1] = {
363 #define STAC9205_NUM_DMICS 2
364 static hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
368 static hda_nid_t stac9200_pin_nids
[8] = {
369 0x08, 0x09, 0x0d, 0x0e,
370 0x0f, 0x10, 0x11, 0x12,
373 static hda_nid_t stac925x_pin_nids
[8] = {
374 0x07, 0x08, 0x0a, 0x0b,
375 0x0c, 0x0d, 0x10, 0x11,
378 static hda_nid_t stac922x_pin_nids
[10] = {
379 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
380 0x0f, 0x10, 0x11, 0x15, 0x1b,
383 static hda_nid_t stac92hd73xx_pin_nids
[13] = {
384 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
385 0x0f, 0x10, 0x11, 0x12, 0x13,
389 static hda_nid_t stac92hd83xxx_pin_nids
[14] = {
390 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
391 0x0f, 0x10, 0x11, 0x12, 0x13,
392 0x1d, 0x1e, 0x1f, 0x20
394 static hda_nid_t stac92hd71bxx_pin_nids
[10] = {
395 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
396 0x0f, 0x14, 0x18, 0x19, 0x1e,
399 static hda_nid_t stac927x_pin_nids
[14] = {
400 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
401 0x0f, 0x10, 0x11, 0x12, 0x13,
402 0x14, 0x21, 0x22, 0x23,
405 static hda_nid_t stac9205_pin_nids
[12] = {
406 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
407 0x0f, 0x14, 0x16, 0x17, 0x18,
411 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
412 struct snd_ctl_elem_info
*uinfo
)
414 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
415 struct sigmatel_spec
*spec
= codec
->spec
;
416 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
419 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
420 struct snd_ctl_elem_value
*ucontrol
)
422 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
423 struct sigmatel_spec
*spec
= codec
->spec
;
424 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
426 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
430 static int stac92xx_dmux_enum_put(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
;
435 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
437 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
438 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
441 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
443 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
444 struct sigmatel_spec
*spec
= codec
->spec
;
445 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
448 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
450 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
451 struct sigmatel_spec
*spec
= codec
->spec
;
452 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
454 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
458 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
460 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
461 struct sigmatel_spec
*spec
= codec
->spec
;
462 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
464 return snd_hda_input_mux_put(codec
, spec
->input_mux
, ucontrol
,
465 spec
->mux_nids
[adc_idx
], &spec
->cur_mux
[adc_idx
]);
468 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
469 struct snd_ctl_elem_info
*uinfo
)
471 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
472 struct sigmatel_spec
*spec
= codec
->spec
;
473 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
476 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
477 struct snd_ctl_elem_value
*ucontrol
)
479 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
480 struct sigmatel_spec
*spec
= codec
->spec
;
482 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
486 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
487 struct snd_ctl_elem_value
*ucontrol
)
489 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
490 struct sigmatel_spec
*spec
= codec
->spec
;
492 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
493 spec
->mono_nid
, &spec
->cur_mmux
);
496 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
498 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
499 struct snd_ctl_elem_value
*ucontrol
)
501 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
502 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
503 struct sigmatel_spec
*spec
= codec
->spec
;
505 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
506 (spec
->aloopback_mask
<< idx
));
510 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
511 struct snd_ctl_elem_value
*ucontrol
)
513 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
514 struct sigmatel_spec
*spec
= codec
->spec
;
515 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
516 unsigned int dac_mode
;
517 unsigned int val
, idx_val
;
519 idx_val
= spec
->aloopback_mask
<< idx
;
520 if (ucontrol
->value
.integer
.value
[0])
521 val
= spec
->aloopback
| idx_val
;
523 val
= spec
->aloopback
& ~idx_val
;
524 if (spec
->aloopback
== val
)
527 spec
->aloopback
= val
;
529 /* Only return the bits defined by the shift value of the
530 * first two bytes of the mask
532 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
533 kcontrol
->private_value
& 0xFFFF, 0x0);
534 dac_mode
>>= spec
->aloopback_shift
;
536 if (spec
->aloopback
& idx_val
) {
537 snd_hda_power_up(codec
);
540 snd_hda_power_down(codec
);
541 dac_mode
&= ~idx_val
;
544 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
545 kcontrol
->private_value
>> 16, dac_mode
);
550 static struct hda_verb stac9200_core_init
[] = {
551 /* set dac0mux for dac converter */
552 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
556 static struct hda_verb stac9200_eapd_init
[] = {
557 /* set dac0mux for dac converter */
558 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
559 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
563 static struct hda_verb stac92hd73xx_6ch_core_init
[] = {
564 /* set master volume and direct control */
565 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
566 /* setup audio connections */
567 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
568 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
569 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
570 /* setup adcs to point to mixer */
571 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
572 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
573 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
574 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
575 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
576 /* setup import muxs */
577 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
578 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
579 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
580 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
584 static struct hda_verb dell_eq_core_init
[] = {
585 /* set master volume to max value without distortion
586 * and direct control */
587 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
588 /* setup audio connections */
589 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
590 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
591 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
592 /* setup adcs to point to mixer */
593 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
594 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
595 /* setup import muxs */
596 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
597 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
598 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
599 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
603 static struct hda_verb dell_m6_core_init
[] = {
604 /* set master volume to max value without distortion
605 * and direct control */
606 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
607 /* setup audio connections */
608 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
609 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
610 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x02},
611 /* setup adcs to point to mixer */
612 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
613 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
614 /* setup import muxs */
615 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
616 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
617 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
618 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x00},
622 static struct hda_verb stac92hd73xx_8ch_core_init
[] = {
623 /* set master volume and direct control */
624 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
625 /* setup audio connections */
626 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00},
627 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01},
628 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02},
629 /* connect hp ports to dac3 */
630 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x03},
631 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x03},
632 /* setup adcs to point to mixer */
633 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
634 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
635 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
636 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
637 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
638 /* setup import muxs */
639 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
640 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
641 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
642 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x03},
646 static struct hda_verb stac92hd73xx_10ch_core_init
[] = {
647 /* set master volume and direct control */
648 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
649 /* setup audio connections */
650 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
651 { 0x10, AC_VERB_SET_CONNECT_SEL
, 0x01 },
652 { 0x11, AC_VERB_SET_CONNECT_SEL
, 0x02 },
653 /* dac3 is connected to import3 mux */
654 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb07f},
655 /* connect hp ports to dac4 */
656 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x04},
657 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x04},
658 /* setup adcs to point to mixer */
659 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x0b},
660 { 0x21, AC_VERB_SET_CONNECT_SEL
, 0x0b},
661 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
662 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
663 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
664 /* setup import muxs */
665 { 0x28, AC_VERB_SET_CONNECT_SEL
, 0x01},
666 { 0x29, AC_VERB_SET_CONNECT_SEL
, 0x01},
667 { 0x2a, AC_VERB_SET_CONNECT_SEL
, 0x01},
668 { 0x2b, AC_VERB_SET_CONNECT_SEL
, 0x03},
672 static struct hda_verb stac92hd83xxx_core_init
[] = {
673 /* start of config #1 */
674 { 0xe, AC_VERB_SET_CONNECT_SEL
, 0x3},
676 /* start of config #2 */
677 { 0xa, AC_VERB_SET_CONNECT_SEL
, 0x0},
678 { 0xb, AC_VERB_SET_CONNECT_SEL
, 0x0},
679 { 0xd, AC_VERB_SET_CONNECT_SEL
, 0x1},
681 /* power state controls amps */
682 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
685 static struct hda_verb stac92hd71bxx_core_init
[] = {
686 /* set master volume and direct control */
687 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
688 /* connect headphone jack to dac1 */
689 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
690 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
691 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
692 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
693 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
694 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
697 #define HD_DISABLE_PORTF 3
698 static struct hda_verb stac92hd71bxx_analog_core_init
[] = {
699 /* start of config #1 */
701 /* connect port 0f to audio mixer */
702 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x2},
703 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker */
704 /* unmute right and left channels for node 0x0f */
705 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
706 /* start of config #2 */
708 /* set master volume and direct control */
709 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
710 /* connect headphone jack to dac1 */
711 { 0x0a, AC_VERB_SET_CONNECT_SEL
, 0x01},
712 /* connect port 0d to audio mixer */
713 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x2},
714 /* unmute dac0 input in audio mixer */
715 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
716 /* unmute right and left channels for nodes 0x0a, 0xd */
717 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
718 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
722 static struct hda_verb stac925x_core_init
[] = {
723 /* set dac0mux for dac converter */
724 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
728 static struct hda_verb stac922x_core_init
[] = {
729 /* set master volume and direct control */
730 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
734 static struct hda_verb d965_core_init
[] = {
735 /* set master volume and direct control */
736 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
737 /* unmute node 0x1b */
738 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
739 /* select node 0x03 as DAC */
740 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
744 static struct hda_verb stac927x_core_init
[] = {
745 /* set master volume and direct control */
746 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
747 /* enable analog pc beep path */
748 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
752 static struct hda_verb stac9205_core_init
[] = {
753 /* set master volume and direct control */
754 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
755 /* enable analog pc beep path */
756 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
760 #define STAC_MONO_MUX \
762 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
763 .name = "Mono Mux", \
765 .info = stac92xx_mono_mux_enum_info, \
766 .get = stac92xx_mono_mux_enum_get, \
767 .put = stac92xx_mono_mux_enum_put, \
770 #define STAC_INPUT_SOURCE(cnt) \
772 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
773 .name = "Input Source", \
775 .info = stac92xx_mux_enum_info, \
776 .get = stac92xx_mux_enum_get, \
777 .put = stac92xx_mux_enum_put, \
780 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
783 .name = "Analog Loopback", \
785 .info = stac92xx_aloopback_info, \
786 .get = stac92xx_aloopback_get, \
787 .put = stac92xx_aloopback_put, \
788 .private_value = verb_read | (verb_write << 16), \
791 static struct snd_kcontrol_new stac9200_mixer
[] = {
792 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT
),
793 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT
),
794 STAC_INPUT_SOURCE(1),
795 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
796 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
797 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT
),
801 static struct snd_kcontrol_new stac92hd73xx_6ch_mixer
[] = {
802 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
804 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
805 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
807 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
808 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
810 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
811 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
813 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
814 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
816 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
817 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
819 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
820 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
822 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
823 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
827 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer
[] = {
828 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
830 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
831 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
833 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
834 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
836 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
837 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
839 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
840 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
842 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
843 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
845 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
846 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
848 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
849 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
853 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer
[] = {
854 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
856 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT
),
857 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT
),
859 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT
),
860 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT
),
862 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT
),
863 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT
),
865 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT
),
866 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT
),
868 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT
),
869 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT
),
871 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT
),
872 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT
),
874 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT
),
875 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT
),
880 static struct snd_kcontrol_new stac92hd83xxx_mixer
[] = {
881 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT
),
882 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT
),
884 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT
),
885 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT
),
887 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT
),
888 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT
),
890 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT
),
891 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT
),
893 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT
),
894 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT
),
896 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT
),
897 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT
),
900 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT),
901 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT),
906 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer
[] = {
907 STAC_INPUT_SOURCE(2),
909 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
910 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
911 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT
),
913 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
914 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
915 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT
),
917 /* analog pc-beep replaced with digital beep support */
919 HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT),
920 HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
923 HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT
),
924 HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT
),
928 static struct snd_kcontrol_new stac92hd71bxx_mixer
[] = {
929 STAC_INPUT_SOURCE(2),
930 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
932 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
933 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT
),
934 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT
),
936 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
937 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT
),
938 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT
),
942 static struct snd_kcontrol_new stac925x_mixer
[] = {
943 STAC_INPUT_SOURCE(1),
944 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT
),
945 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT
),
946 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT
),
950 static struct snd_kcontrol_new stac9205_mixer
[] = {
951 STAC_INPUT_SOURCE(2),
952 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
954 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT
),
955 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT
),
956 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT
),
958 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT
),
959 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT
),
960 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT
),
965 /* This needs to be generated dynamically based on sequence */
966 static struct snd_kcontrol_new stac922x_mixer
[] = {
967 STAC_INPUT_SOURCE(2),
968 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT
),
969 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT
),
970 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT
),
972 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT
),
973 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT
),
974 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT
),
979 static struct snd_kcontrol_new stac927x_mixer
[] = {
980 STAC_INPUT_SOURCE(3),
981 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
983 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT
),
984 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT
),
985 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT
),
987 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT
),
988 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT
),
989 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT
),
991 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT
),
992 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT
),
993 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT
),
997 static struct snd_kcontrol_new stac_dmux_mixer
= {
998 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
999 .name
= "Digital Input Source",
1000 /* count set later */
1001 .info
= stac92xx_dmux_enum_info
,
1002 .get
= stac92xx_dmux_enum_get
,
1003 .put
= stac92xx_dmux_enum_put
,
1006 static const char *slave_vols
[] = {
1007 "Front Playback Volume",
1008 "Surround Playback Volume",
1009 "Center Playback Volume",
1010 "LFE Playback Volume",
1011 "Side Playback Volume",
1012 "Headphone Playback Volume",
1013 "Headphone Playback Volume",
1014 "Speaker Playback Volume",
1015 "External Speaker Playback Volume",
1016 "Speaker2 Playback Volume",
1020 static const char *slave_sws
[] = {
1021 "Front Playback Switch",
1022 "Surround Playback Switch",
1023 "Center Playback Switch",
1024 "LFE Playback Switch",
1025 "Side Playback Switch",
1026 "Headphone Playback Switch",
1027 "Headphone Playback Switch",
1028 "Speaker Playback Switch",
1029 "External Speaker Playback Switch",
1030 "Speaker2 Playback Switch",
1031 "IEC958 Playback Switch",
1035 static int stac92xx_build_controls(struct hda_codec
*codec
)
1037 struct sigmatel_spec
*spec
= codec
->spec
;
1041 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1045 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1046 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1050 if (spec
->num_dmuxes
> 0) {
1051 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1052 err
= snd_ctl_add(codec
->bus
->card
,
1053 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1058 if (spec
->multiout
.dig_out_nid
) {
1059 err
= snd_hda_create_spdif_out_ctls(codec
, spec
->multiout
.dig_out_nid
);
1062 err
= snd_hda_create_spdif_share_sw(codec
,
1066 spec
->multiout
.share_spdif
= 1;
1068 if (spec
->dig_in_nid
) {
1069 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1074 /* if we have no master control, let's create it */
1075 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1076 unsigned int vmaster_tlv
[4];
1077 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1078 HDA_OUTPUT
, vmaster_tlv
);
1079 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1080 vmaster_tlv
, slave_vols
);
1084 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1085 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1094 static unsigned int ref9200_pin_configs
[8] = {
1095 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1096 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1100 STAC 9200 pin configs for
1105 static unsigned int dell9200_d21_pin_configs
[8] = {
1106 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1107 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1111 STAC 9200 pin configs for
1115 static unsigned int dell9200_d22_pin_configs
[8] = {
1116 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1117 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1121 STAC 9200 pin configs for
1122 102801C4 (Dell Dimension E310)
1129 static unsigned int dell9200_d23_pin_configs
[8] = {
1130 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1131 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1136 STAC 9200-32 pin configs for
1137 102801B5 (Dell Inspiron 630m)
1138 102801D8 (Dell Inspiron 640m)
1140 static unsigned int dell9200_m21_pin_configs
[8] = {
1141 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1142 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1146 STAC 9200-32 pin configs for
1147 102801C2 (Dell Latitude D620)
1149 102801CC (Dell Latitude D820)
1153 static unsigned int dell9200_m22_pin_configs
[8] = {
1154 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1155 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1159 STAC 9200-32 pin configs for
1160 102801CE (Dell XPS M1710)
1161 102801CF (Dell Precision M90)
1163 static unsigned int dell9200_m23_pin_configs
[8] = {
1164 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1165 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1169 STAC 9200-32 pin configs for
1172 102801CB (Dell Latitude 120L)
1175 static unsigned int dell9200_m24_pin_configs
[8] = {
1176 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1177 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1181 STAC 9200-32 pin configs for
1182 102801BD (Dell Inspiron E1505n)
1186 static unsigned int dell9200_m25_pin_configs
[8] = {
1187 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1188 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1192 STAC 9200-32 pin configs for
1193 102801F5 (Dell Inspiron 1501)
1196 static unsigned int dell9200_m26_pin_configs
[8] = {
1197 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1198 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1203 102801CD (Dell Inspiron E1705/9400)
1205 static unsigned int dell9200_m27_pin_configs
[8] = {
1206 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1207 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1210 static unsigned int oqo9200_pin_configs
[8] = {
1211 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1212 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1216 static unsigned int *stac9200_brd_tbl
[STAC_9200_MODELS
] = {
1217 [STAC_REF
] = ref9200_pin_configs
,
1218 [STAC_9200_OQO
] = oqo9200_pin_configs
,
1219 [STAC_9200_DELL_D21
] = dell9200_d21_pin_configs
,
1220 [STAC_9200_DELL_D22
] = dell9200_d22_pin_configs
,
1221 [STAC_9200_DELL_D23
] = dell9200_d23_pin_configs
,
1222 [STAC_9200_DELL_M21
] = dell9200_m21_pin_configs
,
1223 [STAC_9200_DELL_M22
] = dell9200_m22_pin_configs
,
1224 [STAC_9200_DELL_M23
] = dell9200_m23_pin_configs
,
1225 [STAC_9200_DELL_M24
] = dell9200_m24_pin_configs
,
1226 [STAC_9200_DELL_M25
] = dell9200_m25_pin_configs
,
1227 [STAC_9200_DELL_M26
] = dell9200_m26_pin_configs
,
1228 [STAC_9200_DELL_M27
] = dell9200_m27_pin_configs
,
1229 [STAC_9200_PANASONIC
] = ref9200_pin_configs
,
1232 static const char *stac9200_models
[STAC_9200_MODELS
] = {
1234 [STAC_9200_OQO
] = "oqo",
1235 [STAC_9200_DELL_D21
] = "dell-d21",
1236 [STAC_9200_DELL_D22
] = "dell-d22",
1237 [STAC_9200_DELL_D23
] = "dell-d23",
1238 [STAC_9200_DELL_M21
] = "dell-m21",
1239 [STAC_9200_DELL_M22
] = "dell-m22",
1240 [STAC_9200_DELL_M23
] = "dell-m23",
1241 [STAC_9200_DELL_M24
] = "dell-m24",
1242 [STAC_9200_DELL_M25
] = "dell-m25",
1243 [STAC_9200_DELL_M26
] = "dell-m26",
1244 [STAC_9200_DELL_M27
] = "dell-m27",
1245 [STAC_9200_GATEWAY
] = "gateway",
1246 [STAC_9200_PANASONIC
] = "panasonic",
1249 static struct snd_pci_quirk stac9200_cfg_tbl
[] = {
1250 /* SigmaTel reference board */
1251 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1252 "DFI LanParty", STAC_REF
),
1253 /* Dell laptops have BIOS problem */
1254 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1255 "unknown Dell", STAC_9200_DELL_D21
),
1256 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1257 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1258 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1259 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1260 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1261 "unknown Dell", STAC_9200_DELL_D22
),
1262 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1263 "unknown Dell", STAC_9200_DELL_D22
),
1264 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1265 "Dell Latitude D620", STAC_9200_DELL_M22
),
1266 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1267 "unknown Dell", STAC_9200_DELL_D23
),
1268 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1269 "unknown Dell", STAC_9200_DELL_D23
),
1270 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1271 "unknown Dell", STAC_9200_DELL_M22
),
1272 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1273 "unknown Dell", STAC_9200_DELL_M24
),
1274 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1275 "unknown Dell", STAC_9200_DELL_M24
),
1276 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1277 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1278 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1279 "Dell Latitude D820", STAC_9200_DELL_M22
),
1280 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1281 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1282 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1283 "Dell XPS M1710", STAC_9200_DELL_M23
),
1284 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1285 "Dell Precision M90", STAC_9200_DELL_M23
),
1286 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1287 "unknown Dell", STAC_9200_DELL_M22
),
1288 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1289 "unknown Dell", STAC_9200_DELL_M22
),
1290 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1291 "unknown Dell", STAC_9200_DELL_M22
),
1292 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1293 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1294 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1295 "unknown Dell", STAC_9200_DELL_D23
),
1296 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1297 "unknown Dell", STAC_9200_DELL_D23
),
1298 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1299 "unknown Dell", STAC_9200_DELL_D21
),
1300 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1301 "unknown Dell", STAC_9200_DELL_D23
),
1302 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1303 "unknown Dell", STAC_9200_DELL_D21
),
1304 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1305 "unknown Dell", STAC_9200_DELL_M25
),
1306 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1307 "unknown Dell", STAC_9200_DELL_M25
),
1308 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1309 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1310 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1311 "unknown Dell", STAC_9200_DELL_M26
),
1313 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1314 /* Gateway machines needs EAPD to be set on resume */
1315 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY
),
1316 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*",
1318 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1321 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1325 static unsigned int ref925x_pin_configs
[8] = {
1326 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1327 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1330 static unsigned int stac925x_MA6_pin_configs
[8] = {
1331 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1332 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
1335 static unsigned int stac925x_PA6_pin_configs
[8] = {
1336 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1337 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
1340 static unsigned int stac925xM2_2_pin_configs
[8] = {
1341 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
1342 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
1345 static unsigned int *stac925x_brd_tbl
[STAC_925x_MODELS
] = {
1346 [STAC_REF
] = ref925x_pin_configs
,
1347 [STAC_M2_2
] = stac925xM2_2_pin_configs
,
1348 [STAC_MA6
] = stac925x_MA6_pin_configs
,
1349 [STAC_PA6
] = stac925x_PA6_pin_configs
,
1352 static const char *stac925x_models
[STAC_925x_MODELS
] = {
1354 [STAC_M2_2
] = "m2-2",
1359 static struct snd_pci_quirk stac925x_cfg_tbl
[] = {
1360 /* SigmaTel reference board */
1361 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1362 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1363 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF
),
1364 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF
),
1365 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6
),
1366 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6
),
1367 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2
),
1371 static unsigned int ref92hd73xx_pin_configs
[13] = {
1372 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1373 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1374 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1378 static unsigned int dell_m6_pin_configs
[13] = {
1379 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1380 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1381 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1385 static unsigned int *stac92hd73xx_brd_tbl
[STAC_92HD73XX_MODELS
] = {
1386 [STAC_92HD73XX_REF
] = ref92hd73xx_pin_configs
,
1387 [STAC_DELL_M6
] = dell_m6_pin_configs
,
1390 static const char *stac92hd73xx_models
[STAC_92HD73XX_MODELS
] = {
1391 [STAC_92HD73XX_REF
] = "ref",
1392 [STAC_DELL_M6
] = "dell-m6",
1395 static struct snd_pci_quirk stac92hd73xx_cfg_tbl
[] = {
1396 /* SigmaTel reference board */
1397 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1398 "DFI LanParty", STAC_92HD73XX_REF
),
1399 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
1400 "unknown Dell", STAC_DELL_M6
),
1401 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
1402 "unknown Dell", STAC_DELL_M6
),
1403 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
1404 "unknown Dell", STAC_DELL_M6
),
1405 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
1406 "unknown Dell", STAC_DELL_M6
),
1407 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
1408 "unknown Dell", STAC_DELL_M6
),
1409 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
1410 "unknown Dell", STAC_DELL_M6
),
1411 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
1412 "unknown Dell", STAC_DELL_M6
),
1416 static unsigned int ref92hd83xxx_pin_configs
[14] = {
1417 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1418 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1419 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,
1420 0x01451160, 0x98560170,
1423 static unsigned int *stac92hd83xxx_brd_tbl
[STAC_92HD83XXX_MODELS
] = {
1424 [STAC_92HD83XXX_REF
] = ref92hd83xxx_pin_configs
,
1427 static const char *stac92hd83xxx_models
[STAC_92HD83XXX_MODELS
] = {
1428 [STAC_92HD83XXX_REF
] = "ref",
1431 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl
[] = {
1432 /* SigmaTel reference board */
1433 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1434 "DFI LanParty", STAC_92HD71BXX_REF
),
1437 static unsigned int ref92hd71bxx_pin_configs
[10] = {
1438 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1439 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0,
1440 0x90a000f0, 0x01452050,
1443 static unsigned int dell_m4_1_pin_configs
[10] = {
1444 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1445 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1446 0x40f000f0, 0x4f0000f0,
1449 static unsigned int dell_m4_2_pin_configs
[10] = {
1450 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1451 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1452 0x40f000f0, 0x044413b0,
1455 static unsigned int *stac92hd71bxx_brd_tbl
[STAC_92HD71BXX_MODELS
] = {
1456 [STAC_92HD71BXX_REF
] = ref92hd71bxx_pin_configs
,
1457 [STAC_DELL_M4_1
] = dell_m4_1_pin_configs
,
1458 [STAC_DELL_M4_2
] = dell_m4_2_pin_configs
,
1461 static const char *stac92hd71bxx_models
[STAC_92HD71BXX_MODELS
] = {
1462 [STAC_92HD71BXX_REF
] = "ref",
1463 [STAC_DELL_M4_1
] = "dell-m4-1",
1464 [STAC_DELL_M4_2
] = "dell-m4-2",
1467 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl
[] = {
1468 /* SigmaTel reference board */
1469 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1470 "DFI LanParty", STAC_92HD71BXX_REF
),
1471 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
1472 "unknown Dell", STAC_DELL_M4_1
),
1473 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
1474 "unknown Dell", STAC_DELL_M4_1
),
1475 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
1476 "unknown Dell", STAC_DELL_M4_1
),
1477 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
1478 "unknown Dell", STAC_DELL_M4_1
),
1479 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
1480 "unknown Dell", STAC_DELL_M4_1
),
1481 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
1482 "unknown Dell", STAC_DELL_M4_1
),
1483 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
1484 "unknown Dell", STAC_DELL_M4_1
),
1485 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
1486 "unknown Dell", STAC_DELL_M4_2
),
1487 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
1488 "unknown Dell", STAC_DELL_M4_2
),
1489 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
1490 "unknown Dell", STAC_DELL_M4_2
),
1491 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
1492 "unknown Dell", STAC_DELL_M4_2
),
1496 static unsigned int ref922x_pin_configs
[10] = {
1497 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1498 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1499 0x40000100, 0x40000100,
1503 STAC 922X pin configs for
1510 static unsigned int dell_922x_d81_pin_configs
[10] = {
1511 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1512 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1513 0x01813122, 0x400001f2,
1517 STAC 922X pin configs for
1521 static unsigned int dell_922x_d82_pin_configs
[10] = {
1522 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1523 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1524 0x01813122, 0x400001f1,
1528 STAC 922X pin configs for
1531 static unsigned int dell_922x_m81_pin_configs
[10] = {
1532 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1533 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1534 0x40C003f1, 0x405003f0,
1538 STAC 9221 A1 pin configs for
1539 102801D7 (Dell XPS M1210)
1541 static unsigned int dell_922x_m82_pin_configs
[10] = {
1542 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1543 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1544 0x508003f3, 0x405003f4,
1547 static unsigned int d945gtp3_pin_configs
[10] = {
1548 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1549 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1550 0x02a19120, 0x40000100,
1553 static unsigned int d945gtp5_pin_configs
[10] = {
1554 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1555 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1556 0x02a19320, 0x40000100,
1559 static unsigned int intel_mac_v1_pin_configs
[10] = {
1560 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1561 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1562 0x400000fc, 0x400000fb,
1565 static unsigned int intel_mac_v2_pin_configs
[10] = {
1566 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1567 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1568 0x400000fc, 0x400000fb,
1571 static unsigned int intel_mac_v3_pin_configs
[10] = {
1572 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1573 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1574 0x400000fc, 0x400000fb,
1577 static unsigned int intel_mac_v4_pin_configs
[10] = {
1578 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1579 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1580 0x400000fc, 0x400000fb,
1583 static unsigned int intel_mac_v5_pin_configs
[10] = {
1584 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1585 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1586 0x400000fc, 0x400000fb,
1590 static unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
1591 [STAC_D945_REF
] = ref922x_pin_configs
,
1592 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
1593 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
1594 [STAC_INTEL_MAC_V1
] = intel_mac_v1_pin_configs
,
1595 [STAC_INTEL_MAC_V2
] = intel_mac_v2_pin_configs
,
1596 [STAC_INTEL_MAC_V3
] = intel_mac_v3_pin_configs
,
1597 [STAC_INTEL_MAC_V4
] = intel_mac_v4_pin_configs
,
1598 [STAC_INTEL_MAC_V5
] = intel_mac_v5_pin_configs
,
1599 [STAC_INTEL_MAC_AUTO
] = intel_mac_v3_pin_configs
,
1600 /* for backward compatibility */
1601 [STAC_MACMINI
] = intel_mac_v3_pin_configs
,
1602 [STAC_MACBOOK
] = intel_mac_v5_pin_configs
,
1603 [STAC_MACBOOK_PRO_V1
] = intel_mac_v3_pin_configs
,
1604 [STAC_MACBOOK_PRO_V2
] = intel_mac_v3_pin_configs
,
1605 [STAC_IMAC_INTEL
] = intel_mac_v2_pin_configs
,
1606 [STAC_IMAC_INTEL_20
] = intel_mac_v3_pin_configs
,
1607 [STAC_922X_DELL_D81
] = dell_922x_d81_pin_configs
,
1608 [STAC_922X_DELL_D82
] = dell_922x_d82_pin_configs
,
1609 [STAC_922X_DELL_M81
] = dell_922x_m81_pin_configs
,
1610 [STAC_922X_DELL_M82
] = dell_922x_m82_pin_configs
,
1613 static const char *stac922x_models
[STAC_922X_MODELS
] = {
1614 [STAC_D945_REF
] = "ref",
1615 [STAC_D945GTP5
] = "5stack",
1616 [STAC_D945GTP3
] = "3stack",
1617 [STAC_INTEL_MAC_V1
] = "intel-mac-v1",
1618 [STAC_INTEL_MAC_V2
] = "intel-mac-v2",
1619 [STAC_INTEL_MAC_V3
] = "intel-mac-v3",
1620 [STAC_INTEL_MAC_V4
] = "intel-mac-v4",
1621 [STAC_INTEL_MAC_V5
] = "intel-mac-v5",
1622 [STAC_INTEL_MAC_AUTO
] = "intel-mac-auto",
1623 /* for backward compatibility */
1624 [STAC_MACMINI
] = "macmini",
1625 [STAC_MACBOOK
] = "macbook",
1626 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
1627 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
1628 [STAC_IMAC_INTEL
] = "imac-intel",
1629 [STAC_IMAC_INTEL_20
] = "imac-intel-20",
1630 [STAC_922X_DELL_D81
] = "dell-d81",
1631 [STAC_922X_DELL_D82
] = "dell-d82",
1632 [STAC_922X_DELL_M81
] = "dell-m81",
1633 [STAC_922X_DELL_M82
] = "dell-m82",
1636 static struct snd_pci_quirk stac922x_cfg_tbl
[] = {
1637 /* SigmaTel reference board */
1638 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1639 "DFI LanParty", STAC_D945_REF
),
1640 /* Intel 945G based systems */
1641 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
1642 "Intel D945G", STAC_D945GTP3
),
1643 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
1644 "Intel D945G", STAC_D945GTP3
),
1645 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
1646 "Intel D945G", STAC_D945GTP3
),
1647 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
1648 "Intel D945G", STAC_D945GTP3
),
1649 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
1650 "Intel D945G", STAC_D945GTP3
),
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
1652 "Intel D945G", STAC_D945GTP3
),
1653 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
1654 "Intel D945G", STAC_D945GTP3
),
1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
1656 "Intel D945G", STAC_D945GTP3
),
1657 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
1658 "Intel D945G", STAC_D945GTP3
),
1659 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
1660 "Intel D945G", STAC_D945GTP3
),
1661 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
1662 "Intel D945G", STAC_D945GTP3
),
1663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
1664 "Intel D945G", STAC_D945GTP3
),
1665 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
1666 "Intel D945G", STAC_D945GTP3
),
1667 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
1668 "Intel D945G", STAC_D945GTP3
),
1669 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
1670 "Intel D945G", STAC_D945GTP3
),
1671 /* Intel D945G 5-stack systems */
1672 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
1673 "Intel D945G", STAC_D945GTP5
),
1674 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
1675 "Intel D945G", STAC_D945GTP5
),
1676 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
1677 "Intel D945G", STAC_D945GTP5
),
1678 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
1679 "Intel D945G", STAC_D945GTP5
),
1680 /* Intel 945P based systems */
1681 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
1682 "Intel D945P", STAC_D945GTP3
),
1683 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
1684 "Intel D945P", STAC_D945GTP3
),
1685 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
1686 "Intel D945P", STAC_D945GTP3
),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
1688 "Intel D945P", STAC_D945GTP3
),
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
1690 "Intel D945P", STAC_D945GTP3
),
1691 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
1692 "Intel D945P", STAC_D945GTP5
),
1694 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1695 SND_PCI_QUIRK(0x8384, 0x7680,
1696 "Mac", STAC_INTEL_MAC_AUTO
),
1698 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
1699 "unknown Dell", STAC_922X_DELL_D81
),
1700 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
1701 "unknown Dell", STAC_922X_DELL_D81
),
1702 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
1703 "unknown Dell", STAC_922X_DELL_D81
),
1704 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
1705 "unknown Dell", STAC_922X_DELL_D82
),
1706 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
1707 "unknown Dell", STAC_922X_DELL_M81
),
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
1709 "unknown Dell", STAC_922X_DELL_D82
),
1710 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
1711 "unknown Dell", STAC_922X_DELL_D81
),
1712 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
1713 "unknown Dell", STAC_922X_DELL_D81
),
1714 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
1715 "Dell XPS M1210", STAC_922X_DELL_M82
),
1719 static unsigned int ref927x_pin_configs
[14] = {
1720 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1721 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
1722 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
1723 0x01c42190, 0x40000100,
1726 static unsigned int d965_3st_pin_configs
[14] = {
1727 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
1728 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
1729 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1730 0x40000100, 0x40000100
1733 static unsigned int d965_5st_pin_configs
[14] = {
1734 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
1735 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
1736 0x40000100, 0x40000100, 0x40000100, 0x01442070,
1737 0x40000100, 0x40000100
1740 static unsigned int dell_3st_pin_configs
[14] = {
1741 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
1742 0x01111212, 0x01116211, 0x01813050, 0x01112214,
1743 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
1744 0x40c003fc, 0x40000100
1747 static unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
1748 [STAC_D965_REF
] = ref927x_pin_configs
,
1749 [STAC_D965_3ST
] = d965_3st_pin_configs
,
1750 [STAC_D965_5ST
] = d965_5st_pin_configs
,
1751 [STAC_DELL_3ST
] = dell_3st_pin_configs
,
1752 [STAC_DELL_BIOS
] = NULL
,
1755 static const char *stac927x_models
[STAC_927X_MODELS
] = {
1756 [STAC_D965_REF
] = "ref",
1757 [STAC_D965_3ST
] = "3stack",
1758 [STAC_D965_5ST
] = "5stack",
1759 [STAC_DELL_3ST
] = "dell-3stack",
1760 [STAC_DELL_BIOS
] = "dell-bios",
1763 static struct snd_pci_quirk stac927x_cfg_tbl
[] = {
1764 /* SigmaTel reference board */
1765 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1766 "DFI LanParty", STAC_D965_REF
),
1767 /* Intel 946 based systems */
1768 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
1769 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
1770 /* 965 based 3 stack systems */
1771 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2116, "Intel D965", STAC_D965_3ST
),
1772 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2115, "Intel D965", STAC_D965_3ST
),
1773 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2114, "Intel D965", STAC_D965_3ST
),
1774 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2113, "Intel D965", STAC_D965_3ST
),
1775 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2112, "Intel D965", STAC_D965_3ST
),
1776 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2111, "Intel D965", STAC_D965_3ST
),
1777 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2110, "Intel D965", STAC_D965_3ST
),
1778 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2009, "Intel D965", STAC_D965_3ST
),
1779 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2008, "Intel D965", STAC_D965_3ST
),
1780 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2007, "Intel D965", STAC_D965_3ST
),
1781 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2006, "Intel D965", STAC_D965_3ST
),
1782 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2005, "Intel D965", STAC_D965_3ST
),
1783 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2004, "Intel D965", STAC_D965_3ST
),
1784 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2003, "Intel D965", STAC_D965_3ST
),
1785 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2002, "Intel D965", STAC_D965_3ST
),
1786 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2001, "Intel D965", STAC_D965_3ST
),
1787 /* Dell 3 stack systems */
1788 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST
),
1789 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
1790 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
1791 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
1792 /* Dell 3 stack systems with verb table in BIOS */
1793 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
1794 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
1795 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS
),
1796 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST
),
1797 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
1798 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
1799 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
1800 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS
),
1801 /* 965 based 5 stack systems */
1802 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2301, "Intel D965", STAC_D965_5ST
),
1803 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2302, "Intel D965", STAC_D965_5ST
),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2303, "Intel D965", STAC_D965_5ST
),
1805 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2304, "Intel D965", STAC_D965_5ST
),
1806 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2305, "Intel D965", STAC_D965_5ST
),
1807 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2501, "Intel D965", STAC_D965_5ST
),
1808 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2502, "Intel D965", STAC_D965_5ST
),
1809 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2503, "Intel D965", STAC_D965_5ST
),
1810 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2504, "Intel D965", STAC_D965_5ST
),
1814 static unsigned int ref9205_pin_configs
[12] = {
1815 0x40000100, 0x40000100, 0x01016011, 0x01014010,
1816 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
1817 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
1821 STAC 9205 pin configs for
1828 10280228 (Dell Vostro 1500)
1830 static unsigned int dell_9205_m42_pin_configs
[12] = {
1831 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
1832 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
1833 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
1837 STAC 9205 pin configs for
1841 102801FF (Dell Precision M4300)
1846 static unsigned int dell_9205_m43_pin_configs
[12] = {
1847 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
1848 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
1849 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
1852 static unsigned int dell_9205_m44_pin_configs
[12] = {
1853 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
1854 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
1855 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
1858 static unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
1859 [STAC_9205_REF
] = ref9205_pin_configs
,
1860 [STAC_9205_DELL_M42
] = dell_9205_m42_pin_configs
,
1861 [STAC_9205_DELL_M43
] = dell_9205_m43_pin_configs
,
1862 [STAC_9205_DELL_M44
] = dell_9205_m44_pin_configs
,
1865 static const char *stac9205_models
[STAC_9205_MODELS
] = {
1866 [STAC_9205_REF
] = "ref",
1867 [STAC_9205_DELL_M42
] = "dell-m42",
1868 [STAC_9205_DELL_M43
] = "dell-m43",
1869 [STAC_9205_DELL_M44
] = "dell-m44",
1872 static struct snd_pci_quirk stac9205_cfg_tbl
[] = {
1873 /* SigmaTel reference board */
1874 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1875 "DFI LanParty", STAC_9205_REF
),
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
1877 "unknown Dell", STAC_9205_DELL_M42
),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
1879 "unknown Dell", STAC_9205_DELL_M42
),
1880 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
1881 "Dell Precision", STAC_9205_DELL_M43
),
1882 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
1883 "Dell Precision", STAC_9205_DELL_M43
),
1884 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
1885 "Dell Precision", STAC_9205_DELL_M43
),
1886 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
1887 "unknown Dell", STAC_9205_DELL_M42
),
1888 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
1889 "unknown Dell", STAC_9205_DELL_M42
),
1890 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
1891 "Dell Precision", STAC_9205_DELL_M43
),
1892 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
1893 "Dell Precision M4300", STAC_9205_DELL_M43
),
1894 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
1895 "unknown Dell", STAC_9205_DELL_M42
),
1896 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
1897 "Dell Precision", STAC_9205_DELL_M43
),
1898 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
1899 "Dell Precision", STAC_9205_DELL_M43
),
1900 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
1901 "Dell Precision", STAC_9205_DELL_M43
),
1902 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
1903 "Dell Inspiron", STAC_9205_DELL_M44
),
1904 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
1905 "Dell Vostro 1500", STAC_9205_DELL_M42
),
1909 static int stac92xx_save_bios_config_regs(struct hda_codec
*codec
)
1912 struct sigmatel_spec
*spec
= codec
->spec
;
1914 if (! spec
->bios_pin_configs
) {
1915 spec
->bios_pin_configs
= kcalloc(spec
->num_pins
,
1916 sizeof(*spec
->bios_pin_configs
), GFP_KERNEL
);
1917 if (! spec
->bios_pin_configs
)
1921 for (i
= 0; i
< spec
->num_pins
; i
++) {
1922 hda_nid_t nid
= spec
->pin_nids
[i
];
1923 unsigned int pin_cfg
;
1925 pin_cfg
= snd_hda_codec_read(codec
, nid
, 0,
1926 AC_VERB_GET_CONFIG_DEFAULT
, 0x00);
1927 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x bios pin config %8.8x\n",
1929 spec
->bios_pin_configs
[i
] = pin_cfg
;
1935 static void stac92xx_set_config_reg(struct hda_codec
*codec
,
1936 hda_nid_t pin_nid
, unsigned int pin_config
)
1939 snd_hda_codec_write(codec
, pin_nid
, 0,
1940 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
,
1941 pin_config
& 0x000000ff);
1942 snd_hda_codec_write(codec
, pin_nid
, 0,
1943 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
,
1944 (pin_config
& 0x0000ff00) >> 8);
1945 snd_hda_codec_write(codec
, pin_nid
, 0,
1946 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
,
1947 (pin_config
& 0x00ff0000) >> 16);
1948 snd_hda_codec_write(codec
, pin_nid
, 0,
1949 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
,
1951 i
= snd_hda_codec_read(codec
, pin_nid
, 0,
1952 AC_VERB_GET_CONFIG_DEFAULT
,
1954 snd_printdd(KERN_INFO
"hda_codec: pin nid %2.2x pin config %8.8x\n",
1958 static void stac92xx_set_config_regs(struct hda_codec
*codec
)
1961 struct sigmatel_spec
*spec
= codec
->spec
;
1963 if (!spec
->pin_configs
)
1966 for (i
= 0; i
< spec
->num_pins
; i
++)
1967 stac92xx_set_config_reg(codec
, spec
->pin_nids
[i
],
1968 spec
->pin_configs
[i
]);
1972 * Analog playback callbacks
1974 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1975 struct hda_codec
*codec
,
1976 struct snd_pcm_substream
*substream
)
1978 struct sigmatel_spec
*spec
= codec
->spec
;
1979 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
1983 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1984 struct hda_codec
*codec
,
1985 unsigned int stream_tag
,
1986 unsigned int format
,
1987 struct snd_pcm_substream
*substream
)
1989 struct sigmatel_spec
*spec
= codec
->spec
;
1990 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
1993 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1994 struct hda_codec
*codec
,
1995 struct snd_pcm_substream
*substream
)
1997 struct sigmatel_spec
*spec
= codec
->spec
;
1998 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2002 * Digital playback callbacks
2004 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2005 struct hda_codec
*codec
,
2006 struct snd_pcm_substream
*substream
)
2008 struct sigmatel_spec
*spec
= codec
->spec
;
2009 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2012 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2013 struct hda_codec
*codec
,
2014 struct snd_pcm_substream
*substream
)
2016 struct sigmatel_spec
*spec
= codec
->spec
;
2017 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2020 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2021 struct hda_codec
*codec
,
2022 unsigned int stream_tag
,
2023 unsigned int format
,
2024 struct snd_pcm_substream
*substream
)
2026 struct sigmatel_spec
*spec
= codec
->spec
;
2027 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2028 stream_tag
, format
, substream
);
2033 * Analog capture callbacks
2035 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2036 struct hda_codec
*codec
,
2037 unsigned int stream_tag
,
2038 unsigned int format
,
2039 struct snd_pcm_substream
*substream
)
2041 struct sigmatel_spec
*spec
= codec
->spec
;
2043 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2044 stream_tag
, 0, format
);
2048 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2049 struct hda_codec
*codec
,
2050 struct snd_pcm_substream
*substream
)
2052 struct sigmatel_spec
*spec
= codec
->spec
;
2054 snd_hda_codec_cleanup_stream(codec
, spec
->adc_nids
[substream
->number
]);
2058 static struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
2062 /* NID is set in stac92xx_build_pcms */
2064 .open
= stac92xx_dig_playback_pcm_open
,
2065 .close
= stac92xx_dig_playback_pcm_close
,
2066 .prepare
= stac92xx_dig_playback_pcm_prepare
2070 static struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
2074 /* NID is set in stac92xx_build_pcms */
2077 static struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
2081 .nid
= 0x02, /* NID to query formats and rates */
2083 .open
= stac92xx_playback_pcm_open
,
2084 .prepare
= stac92xx_playback_pcm_prepare
,
2085 .cleanup
= stac92xx_playback_pcm_cleanup
2089 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
2093 .nid
= 0x06, /* NID to query formats and rates */
2095 .open
= stac92xx_playback_pcm_open
,
2096 .prepare
= stac92xx_playback_pcm_prepare
,
2097 .cleanup
= stac92xx_playback_pcm_cleanup
2101 static struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
2104 /* NID + .substreams is set in stac92xx_build_pcms */
2106 .prepare
= stac92xx_capture_pcm_prepare
,
2107 .cleanup
= stac92xx_capture_pcm_cleanup
2111 static int stac92xx_build_pcms(struct hda_codec
*codec
)
2113 struct sigmatel_spec
*spec
= codec
->spec
;
2114 struct hda_pcm
*info
= spec
->pcm_rec
;
2116 codec
->num_pcms
= 1;
2117 codec
->pcm_info
= info
;
2119 info
->name
= "STAC92xx Analog";
2120 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
2121 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
2122 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2123 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
2125 if (spec
->alt_switch
) {
2128 info
->name
= "STAC92xx Analog Alt";
2129 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
2132 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2135 info
->name
= "STAC92xx Digital";
2136 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2137 if (spec
->multiout
.dig_out_nid
) {
2138 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
2139 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2141 if (spec
->dig_in_nid
) {
2142 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
2143 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2150 static unsigned int stac92xx_get_vref(struct hda_codec
*codec
, hda_nid_t nid
)
2152 unsigned int pincap
= snd_hda_param_read(codec
, nid
,
2154 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
2155 if (pincap
& AC_PINCAP_VREF_100
)
2156 return AC_PINCTL_VREF_100
;
2157 if (pincap
& AC_PINCAP_VREF_80
)
2158 return AC_PINCTL_VREF_80
;
2159 if (pincap
& AC_PINCAP_VREF_50
)
2160 return AC_PINCTL_VREF_50
;
2161 if (pincap
& AC_PINCAP_VREF_GRD
)
2162 return AC_PINCTL_VREF_GRD
;
2166 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
2169 snd_hda_codec_write_cache(codec
, nid
, 0,
2170 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2173 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2175 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
2176 struct snd_ctl_elem_value
*ucontrol
)
2178 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2179 struct sigmatel_spec
*spec
= codec
->spec
;
2181 ucontrol
->value
.integer
.value
[0] = spec
->hp_switch
;
2185 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
2186 struct snd_ctl_elem_value
*ucontrol
)
2188 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2189 struct sigmatel_spec
*spec
= codec
->spec
;
2191 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0];
2193 /* check to be sure that the ports are upto date with
2196 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2201 #define stac92xx_io_switch_info snd_ctl_boolean_mono_info
2203 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2205 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2206 struct sigmatel_spec
*spec
= codec
->spec
;
2207 int io_idx
= kcontrol
-> private_value
& 0xff;
2209 ucontrol
->value
.integer
.value
[0] = spec
->io_switch
[io_idx
];
2213 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2215 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2216 struct sigmatel_spec
*spec
= codec
->spec
;
2217 hda_nid_t nid
= kcontrol
->private_value
>> 8;
2218 int io_idx
= kcontrol
-> private_value
& 0xff;
2219 unsigned short val
= !!ucontrol
->value
.integer
.value
[0];
2221 spec
->io_switch
[io_idx
] = val
;
2224 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2226 unsigned int pinctl
= AC_PINCTL_IN_EN
;
2227 if (io_idx
) /* set VREF for mic */
2228 pinctl
|= stac92xx_get_vref(codec
, nid
);
2229 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
2232 /* check the auto-mute again: we need to mute/unmute the speaker
2233 * appropriately according to the pin direction
2235 if (spec
->hp_detect
)
2236 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
2241 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2243 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
2244 struct snd_ctl_elem_value
*ucontrol
)
2246 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2247 struct sigmatel_spec
*spec
= codec
->spec
;
2249 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
2253 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
2254 struct snd_ctl_elem_value
*ucontrol
)
2256 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2257 struct sigmatel_spec
*spec
= codec
->spec
;
2258 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
2259 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
2261 if (spec
->clfe_swap
== val
)
2264 spec
->clfe_swap
= val
;
2266 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
2267 spec
->clfe_swap
? 0x4 : 0x0);
2272 #define STAC_CODEC_HP_SWITCH(xname) \
2273 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2276 .info = stac92xx_hp_switch_info, \
2277 .get = stac92xx_hp_switch_get, \
2278 .put = stac92xx_hp_switch_put, \
2281 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2282 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2285 .info = stac92xx_io_switch_info, \
2286 .get = stac92xx_io_switch_get, \
2287 .put = stac92xx_io_switch_put, \
2288 .private_value = xpval, \
2291 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2292 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2295 .info = stac92xx_clfe_switch_info, \
2296 .get = stac92xx_clfe_switch_get, \
2297 .put = stac92xx_clfe_switch_put, \
2298 .private_value = xpval, \
2302 STAC_CTL_WIDGET_VOL
,
2303 STAC_CTL_WIDGET_MUTE
,
2304 STAC_CTL_WIDGET_MONO_MUX
,
2305 STAC_CTL_WIDGET_HP_SWITCH
,
2306 STAC_CTL_WIDGET_IO_SWITCH
,
2307 STAC_CTL_WIDGET_CLFE_SWITCH
2310 static struct snd_kcontrol_new stac92xx_control_templates
[] = {
2311 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2312 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2314 STAC_CODEC_HP_SWITCH(NULL
),
2315 STAC_CODEC_IO_SWITCH(NULL
, 0),
2316 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
2319 /* add dynamic controls */
2320 static int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
, const char *name
, unsigned long val
)
2322 struct snd_kcontrol_new
*knew
;
2324 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2325 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2327 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2330 if (spec
->kctl_alloc
) {
2331 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2332 kfree(spec
->kctl_alloc
);
2334 spec
->kctl_alloc
= knew
;
2335 spec
->num_kctl_alloc
= num
;
2338 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2339 *knew
= stac92xx_control_templates
[type
];
2340 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2343 knew
->private_value
= val
;
2344 spec
->num_kctl_used
++;
2348 /* flag inputs as additional dynamic lineouts */
2349 static int stac92xx_add_dyn_out_pins(struct hda_codec
*codec
, struct auto_pin_cfg
*cfg
)
2351 struct sigmatel_spec
*spec
= codec
->spec
;
2352 unsigned int wcaps
, wtype
;
2353 int i
, num_dacs
= 0;
2355 /* use the wcaps cache to count all DACs available for line-outs */
2356 for (i
= 0; i
< codec
->num_nodes
; i
++) {
2357 wcaps
= codec
->wcaps
[i
];
2358 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2360 if (wtype
== AC_WID_AUD_OUT
&& !(wcaps
& AC_WCAP_DIGITAL
))
2364 snd_printdd("%s: total dac count=%d\n", __func__
, num_dacs
);
2366 switch (cfg
->line_outs
) {
2368 /* add line-in as side */
2369 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 3) {
2370 cfg
->line_out_pins
[cfg
->line_outs
] =
2371 cfg
->input_pins
[AUTO_PIN_LINE
];
2372 spec
->line_switch
= 1;
2377 /* add line-in as clfe and mic as side */
2378 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 2) {
2379 cfg
->line_out_pins
[cfg
->line_outs
] =
2380 cfg
->input_pins
[AUTO_PIN_LINE
];
2381 spec
->line_switch
= 1;
2384 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 3) {
2385 cfg
->line_out_pins
[cfg
->line_outs
] =
2386 cfg
->input_pins
[AUTO_PIN_MIC
];
2387 spec
->mic_switch
= 1;
2392 /* add line-in as surr and mic as clfe */
2393 if (cfg
->input_pins
[AUTO_PIN_LINE
] && num_dacs
> 1) {
2394 cfg
->line_out_pins
[cfg
->line_outs
] =
2395 cfg
->input_pins
[AUTO_PIN_LINE
];
2396 spec
->line_switch
= 1;
2399 if (cfg
->input_pins
[AUTO_PIN_MIC
] && num_dacs
> 2) {
2400 cfg
->line_out_pins
[cfg
->line_outs
] =
2401 cfg
->input_pins
[AUTO_PIN_MIC
];
2402 spec
->mic_switch
= 1;
2412 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2416 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
2417 if (spec
->multiout
.dac_nids
[i
] == nid
)
2425 * Fill in the dac_nids table from the parsed pin configuration
2426 * This function only works when every pin in line_out_pins[]
2427 * contains atleast one DAC in its connection list. Some 92xx
2428 * codecs are not connected directly to a DAC, such as the 9200
2429 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2431 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
,
2432 struct auto_pin_cfg
*cfg
)
2434 struct sigmatel_spec
*spec
= codec
->spec
;
2435 int i
, j
, conn_len
= 0;
2436 hda_nid_t nid
, conn
[HDA_MAX_CONNECTIONS
];
2437 unsigned int wcaps
, wtype
;
2439 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2440 nid
= cfg
->line_out_pins
[i
];
2441 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
2442 HDA_MAX_CONNECTIONS
);
2443 for (j
= 0; j
< conn_len
; j
++) {
2444 wcaps
= snd_hda_param_read(codec
, conn
[j
],
2445 AC_PAR_AUDIO_WIDGET_CAP
);
2446 wtype
= (wcaps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
2447 if (wtype
!= AC_WID_AUD_OUT
||
2448 (wcaps
& AC_WCAP_DIGITAL
))
2450 /* conn[j] is a DAC routed to this line-out */
2451 if (!is_in_dac_nids(spec
, conn
[j
]))
2455 if (j
== conn_len
) {
2456 if (spec
->multiout
.num_dacs
> 0) {
2457 /* we have already working output pins,
2458 * so let's drop the broken ones again
2460 cfg
->line_outs
= spec
->multiout
.num_dacs
;
2463 /* error out, no available DAC found */
2465 "%s: No available DAC for pin 0x%x\n",
2470 spec
->multiout
.dac_nids
[i
] = conn
[j
];
2471 spec
->multiout
.num_dacs
++;
2473 /* select this DAC in the pin's input mux */
2474 snd_hda_codec_write_cache(codec
, nid
, 0,
2475 AC_VERB_SET_CONNECT_SEL
, j
);
2480 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
2481 spec
->multiout
.num_dacs
,
2482 spec
->multiout
.dac_nids
[0],
2483 spec
->multiout
.dac_nids
[1],
2484 spec
->multiout
.dac_nids
[2],
2485 spec
->multiout
.dac_nids
[3],
2486 spec
->multiout
.dac_nids
[4]);
2490 /* create volume control/switch for the given prefx type */
2491 static int create_controls(struct sigmatel_spec
*spec
, const char *pfx
, hda_nid_t nid
, int chs
)
2496 sprintf(name
, "%s Playback Volume", pfx
);
2497 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
, name
,
2498 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2501 sprintf(name
, "%s Playback Switch", pfx
);
2502 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
, name
,
2503 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
2509 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2511 if (!spec
->multiout
.hp_nid
)
2512 spec
->multiout
.hp_nid
= nid
;
2513 else if (spec
->multiout
.num_dacs
> 4) {
2514 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
2517 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
] = nid
;
2518 spec
->multiout
.num_dacs
++;
2523 static int check_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2525 if (is_in_dac_nids(spec
, nid
))
2527 if (spec
->multiout
.hp_nid
== nid
)
2532 /* add playback controls from the parsed DAC table */
2533 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
2534 const struct auto_pin_cfg
*cfg
)
2536 static const char *chname
[4] = {
2537 "Front", "Surround", NULL
/*CLFE*/, "Side"
2542 struct sigmatel_spec
*spec
= codec
->spec
;
2543 unsigned int wid_caps
, pincap
;
2546 for (i
= 0; i
< cfg
->line_outs
&& i
< spec
->multiout
.num_dacs
; i
++) {
2547 if (!spec
->multiout
.dac_nids
[i
])
2550 nid
= spec
->multiout
.dac_nids
[i
];
2554 err
= create_controls(spec
, "Center", nid
, 1);
2557 err
= create_controls(spec
, "LFE", nid
, 2);
2561 wid_caps
= get_wcaps(codec
, nid
);
2563 if (wid_caps
& AC_WCAP_LR_SWAP
) {
2564 err
= stac92xx_add_control(spec
,
2565 STAC_CTL_WIDGET_CLFE_SWITCH
,
2566 "Swap Center/LFE Playback Switch", nid
);
2573 err
= create_controls(spec
, chname
[i
], nid
, 3);
2579 if (cfg
->hp_outs
> 1) {
2580 err
= stac92xx_add_control(spec
,
2581 STAC_CTL_WIDGET_HP_SWITCH
,
2582 "Headphone as Line Out Switch", 0);
2587 if (spec
->line_switch
) {
2588 nid
= cfg
->input_pins
[AUTO_PIN_LINE
];
2589 pincap
= snd_hda_param_read(codec
, nid
,
2591 if (pincap
& AC_PINCAP_OUT
) {
2592 err
= stac92xx_add_control(spec
,
2593 STAC_CTL_WIDGET_IO_SWITCH
,
2594 "Line In as Output Switch", nid
<< 8);
2600 if (spec
->mic_switch
) {
2601 unsigned int def_conf
;
2602 unsigned int mic_pin
= AUTO_PIN_MIC
;
2604 nid
= cfg
->input_pins
[mic_pin
];
2605 def_conf
= snd_hda_codec_read(codec
, nid
, 0,
2606 AC_VERB_GET_CONFIG_DEFAULT
, 0);
2607 /* some laptops have an internal analog microphone
2608 * which can't be used as a output */
2609 if (get_defcfg_connect(def_conf
) != AC_JACK_PORT_FIXED
) {
2610 pincap
= snd_hda_param_read(codec
, nid
,
2612 if (pincap
& AC_PINCAP_OUT
) {
2613 err
= stac92xx_add_control(spec
,
2614 STAC_CTL_WIDGET_IO_SWITCH
,
2615 "Mic as Output Switch", (nid
<< 8) | 1);
2616 nid
= snd_hda_codec_read(codec
, nid
, 0,
2617 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2618 if (!check_in_dac_nids(spec
, nid
))
2619 add_spec_dacs(spec
, nid
);
2623 } else if (mic_pin
== AUTO_PIN_MIC
) {
2624 mic_pin
= AUTO_PIN_FRONT_MIC
;
2632 /* add playback controls for Speaker and HP outputs */
2633 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
2634 struct auto_pin_cfg
*cfg
)
2636 struct sigmatel_spec
*spec
= codec
->spec
;
2638 int i
, old_num_dacs
, err
;
2640 old_num_dacs
= spec
->multiout
.num_dacs
;
2641 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
2642 unsigned int wid_caps
= get_wcaps(codec
, cfg
->hp_pins
[i
]);
2643 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
2644 spec
->hp_detect
= 1;
2645 nid
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
2646 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2647 if (check_in_dac_nids(spec
, nid
))
2651 add_spec_dacs(spec
, nid
);
2653 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
2654 nid
= snd_hda_codec_read(codec
, cfg
->speaker_pins
[i
], 0,
2655 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2656 if (check_in_dac_nids(spec
, nid
))
2660 add_spec_dacs(spec
, nid
);
2662 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2663 nid
= snd_hda_codec_read(codec
, cfg
->line_out_pins
[i
], 0,
2664 AC_VERB_GET_CONNECT_LIST
, 0) & 0xff;
2665 if (check_in_dac_nids(spec
, nid
))
2669 add_spec_dacs(spec
, nid
);
2671 for (i
= old_num_dacs
; i
< spec
->multiout
.num_dacs
; i
++) {
2672 static const char *pfxs
[] = {
2673 "Speaker", "External Speaker", "Speaker2",
2675 err
= create_controls(spec
, pfxs
[i
- old_num_dacs
],
2676 spec
->multiout
.dac_nids
[i
], 3);
2680 if (spec
->multiout
.hp_nid
) {
2681 err
= create_controls(spec
, "Headphone",
2682 spec
->multiout
.hp_nid
, 3);
2690 /* labels for mono mux outputs */
2691 static const char *stac92xx_mono_labels
[4] = {
2692 "DAC0", "DAC1", "Mixer", "DAC2"
2695 /* create mono mux for mono out on capable codecs */
2696 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
2698 struct sigmatel_spec
*spec
= codec
->spec
;
2699 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
2701 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
2703 num_cons
= snd_hda_get_connections(codec
,
2706 HDA_MAX_NUM_INPUTS
);
2707 if (!num_cons
|| num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
2710 for (i
= 0; i
< num_cons
; i
++) {
2711 mono_mux
->items
[mono_mux
->num_items
].label
=
2712 stac92xx_mono_labels
[i
];
2713 mono_mux
->items
[mono_mux
->num_items
].index
= i
;
2714 mono_mux
->num_items
++;
2717 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
2718 "Mono Mux", spec
->mono_nid
);
2721 /* create PC beep volume controls */
2722 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
2725 struct sigmatel_spec
*spec
= codec
->spec
;
2726 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
2729 /* check for mute support for the the amp */
2730 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
2731 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
2732 "PC Beep Playback Switch",
2733 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2738 /* check to see if there is volume support for the amp */
2739 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
2740 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
2741 "PC Beep Playback Volume",
2742 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
2749 /* labels for dmic mux inputs */
2750 static const char *stac92xx_dmic_labels
[5] = {
2751 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
2752 "Digital Mic 3", "Digital Mic 4"
2755 /* create playback/capture controls for input pins on dmic capable codecs */
2756 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
2757 const struct auto_pin_cfg
*cfg
)
2759 struct sigmatel_spec
*spec
= codec
->spec
;
2760 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
2761 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
2765 dimux
->items
[dimux
->num_items
].label
= stac92xx_dmic_labels
[0];
2766 dimux
->items
[dimux
->num_items
].index
= 0;
2769 for (i
= 0; i
< spec
->num_dmics
; i
++) {
2774 unsigned int def_conf
;
2776 def_conf
= snd_hda_codec_read(codec
,
2779 AC_VERB_GET_CONFIG_DEFAULT
,
2781 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
2784 nid
= spec
->dmic_nids
[i
];
2785 num_cons
= snd_hda_get_connections(codec
,
2788 HDA_MAX_NUM_INPUTS
);
2789 for (j
= 0; j
< num_cons
; j
++)
2790 if (con_lst
[j
] == nid
) {
2796 wcaps
= get_wcaps(codec
, nid
) &
2797 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
2800 sprintf(name
, "%s Capture Volume",
2801 stac92xx_dmic_labels
[dimux
->num_items
]);
2803 err
= stac92xx_add_control(spec
,
2804 STAC_CTL_WIDGET_VOL
,
2806 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
2807 (wcaps
& AC_WCAP_OUT_AMP
) ?
2808 HDA_OUTPUT
: HDA_INPUT
));
2813 dimux
->items
[dimux
->num_items
].label
=
2814 stac92xx_dmic_labels
[dimux
->num_items
];
2815 dimux
->items
[dimux
->num_items
].index
= index
;
2822 /* create playback/capture controls for input pins */
2823 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
2825 struct sigmatel_spec
*spec
= codec
->spec
;
2826 struct hda_input_mux
*imux
= &spec
->private_imux
;
2827 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
2830 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2833 if (!cfg
->input_pins
[i
])
2836 for (j
= 0; j
< spec
->num_muxes
; j
++) {
2838 num_cons
= snd_hda_get_connections(codec
,
2841 HDA_MAX_NUM_INPUTS
);
2842 for (k
= 0; k
< num_cons
; k
++)
2843 if (con_lst
[k
] == cfg
->input_pins
[i
]) {
2850 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
2851 imux
->items
[imux
->num_items
].index
= index
;
2855 if (imux
->num_items
) {
2857 * Set the current input for the muxes.
2858 * The STAC9221 has two input muxes with identical source
2859 * NID lists. Hopefully this won't get confused.
2861 for (i
= 0; i
< spec
->num_muxes
; i
++) {
2862 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
2863 AC_VERB_SET_CONNECT_SEL
,
2864 imux
->items
[0].index
);
2871 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
2873 struct sigmatel_spec
*spec
= codec
->spec
;
2876 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
2877 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
2878 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2882 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
2884 struct sigmatel_spec
*spec
= codec
->spec
;
2887 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
2889 pin
= spec
->autocfg
.hp_pins
[i
];
2890 if (pin
) /* connect to front */
2891 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
2893 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
2895 pin
= spec
->autocfg
.speaker_pins
[i
];
2896 if (pin
) /* connect to front */
2897 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
2901 static int stac92xx_parse_auto_config(struct hda_codec
*codec
, hda_nid_t dig_out
, hda_nid_t dig_in
)
2903 struct sigmatel_spec
*spec
= codec
->spec
;
2905 int hp_speaker_swap
= 0;
2907 if ((err
= snd_hda_parse_pin_def_config(codec
,
2909 spec
->dmic_nids
)) < 0)
2911 if (! spec
->autocfg
.line_outs
)
2912 return 0; /* can't find valid pin config */
2914 /* If we have no real line-out pin and multiple hp-outs, HPs should
2915 * be set up as multi-channel outputs.
2917 if (spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
&&
2918 spec
->autocfg
.hp_outs
> 1) {
2919 /* Copy hp_outs to line_outs, backup line_outs in
2920 * speaker_outs so that the following routines can handle
2921 * HP pins as primary outputs.
2923 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
2924 sizeof(spec
->autocfg
.line_out_pins
));
2925 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
2926 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
2927 sizeof(spec
->autocfg
.hp_pins
));
2928 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
2929 hp_speaker_swap
= 1;
2931 if (spec
->autocfg
.mono_out_pin
) {
2932 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
2933 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
2934 u32 caps
= query_amp_caps(codec
,
2935 spec
->autocfg
.mono_out_pin
, dir
);
2936 hda_nid_t conn_list
[1];
2938 /* get the mixer node and then the mono mux if it exists */
2939 if (snd_hda_get_connections(codec
,
2940 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
2941 snd_hda_get_connections(codec
, conn_list
[0],
2944 int wcaps
= get_wcaps(codec
, conn_list
[0]);
2945 int wid_type
= (wcaps
& AC_WCAP_TYPE
)
2946 >> AC_WCAP_TYPE_SHIFT
;
2947 /* LR swap check, some stac925x have a mux that
2948 * changes the DACs output path instead of the
2951 if (wid_type
== AC_WID_AUD_SEL
&&
2952 !(wcaps
& AC_WCAP_LR_SWAP
))
2953 spec
->mono_nid
= conn_list
[0];
2956 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
2958 /* most mono outs have a least a mute/unmute switch */
2959 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
2960 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
2961 "Mono Playback Switch",
2962 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
2965 /* check for volume support for the amp */
2966 if ((caps
& AC_AMPCAP_NUM_STEPS
)
2967 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
2968 err
= stac92xx_add_control(spec
,
2969 STAC_CTL_WIDGET_VOL
,
2970 "Mono Playback Volume",
2971 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
2977 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
2981 if ((err
= stac92xx_add_dyn_out_pins(codec
, &spec
->autocfg
)) < 0)
2983 if (spec
->multiout
.num_dacs
== 0)
2984 if ((err
= stac92xx_auto_fill_dac_nids(codec
, &spec
->autocfg
)) < 0)
2987 err
= stac92xx_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
2992 /* setup analog beep controls */
2993 if (spec
->anabeep_nid
> 0) {
2994 err
= stac92xx_auto_create_beep_ctls(codec
,
3000 /* setup digital beep controls and input device */
3001 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3002 if (spec
->digbeep_nid
> 0) {
3003 hda_nid_t nid
= spec
->digbeep_nid
;
3005 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
3008 err
= snd_hda_attach_beep_device(codec
, nid
);
3014 if (hp_speaker_swap
== 1) {
3015 /* Restore the hp_outs and line_outs */
3016 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
3017 sizeof(spec
->autocfg
.line_out_pins
));
3018 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
3019 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.speaker_pins
,
3020 sizeof(spec
->autocfg
.speaker_pins
));
3021 spec
->autocfg
.line_outs
= spec
->autocfg
.speaker_outs
;
3022 memset(spec
->autocfg
.speaker_pins
, 0,
3023 sizeof(spec
->autocfg
.speaker_pins
));
3024 spec
->autocfg
.speaker_outs
= 0;
3027 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
3032 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
3037 if (spec
->mono_nid
> 0) {
3038 err
= stac92xx_auto_create_mono_output_ctls(codec
);
3043 if (spec
->num_dmics
> 0)
3044 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
3045 &spec
->autocfg
)) < 0)
3048 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3049 if (spec
->multiout
.max_channels
> 2)
3050 spec
->surr_switch
= 1;
3052 if (spec
->autocfg
.dig_out_pin
)
3053 spec
->multiout
.dig_out_nid
= dig_out
;
3054 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
3055 spec
->dig_in_nid
= dig_in
;
3057 if (spec
->kctl_alloc
)
3058 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3060 spec
->input_mux
= &spec
->private_imux
;
3061 if (!spec
->dinput_mux
)
3062 spec
->dinput_mux
= &spec
->private_dimux
;
3063 spec
->mono_mux
= &spec
->private_mono_mux
;
3068 /* add playback controls for HP output */
3069 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
3070 struct auto_pin_cfg
*cfg
)
3072 struct sigmatel_spec
*spec
= codec
->spec
;
3073 hda_nid_t pin
= cfg
->hp_pins
[0];
3074 unsigned int wid_caps
;
3079 wid_caps
= get_wcaps(codec
, pin
);
3080 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
3081 spec
->hp_detect
= 1;
3086 /* add playback controls for LFE output */
3087 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
3088 struct auto_pin_cfg
*cfg
)
3090 struct sigmatel_spec
*spec
= codec
->spec
;
3092 hda_nid_t lfe_pin
= 0x0;
3096 * search speaker outs and line outs for a mono speaker pin
3097 * with an amp. If one is found, add LFE controls
3100 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
3101 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
3102 unsigned int wcaps
= get_wcaps(codec
, pin
);
3103 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3104 if (wcaps
== AC_WCAP_OUT_AMP
)
3105 /* found a mono speaker with an amp, must be lfe */
3109 /* if speaker_outs is 0, then speakers may be in line_outs */
3110 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
3111 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
3112 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
3113 unsigned int defcfg
;
3114 defcfg
= snd_hda_codec_read(codec
, pin
, 0,
3115 AC_VERB_GET_CONFIG_DEFAULT
,
3117 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
3118 unsigned int wcaps
= get_wcaps(codec
, pin
);
3119 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3120 if (wcaps
== AC_WCAP_OUT_AMP
)
3121 /* found a mono speaker with an amp,
3129 err
= create_controls(spec
, "LFE", lfe_pin
, 1);
3137 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
3139 struct sigmatel_spec
*spec
= codec
->spec
;
3142 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
3145 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
3148 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
3151 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
3154 if (spec
->autocfg
.dig_out_pin
)
3155 spec
->multiout
.dig_out_nid
= 0x05;
3156 if (spec
->autocfg
.dig_in_pin
)
3157 spec
->dig_in_nid
= 0x04;
3159 if (spec
->kctl_alloc
)
3160 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3162 spec
->input_mux
= &spec
->private_imux
;
3163 spec
->dinput_mux
= &spec
->private_dimux
;
3169 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
3170 * funky external mute control using GPIO pins.
3173 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
3174 unsigned int dir_mask
, unsigned int data
)
3176 unsigned int gpiostate
, gpiomask
, gpiodir
;
3178 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3179 AC_VERB_GET_GPIO_DATA
, 0);
3180 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
3182 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3183 AC_VERB_GET_GPIO_MASK
, 0);
3186 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
3187 AC_VERB_GET_GPIO_DIRECTION
, 0);
3188 gpiodir
|= dir_mask
;
3190 /* Configure GPIOx as CMOS */
3191 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
3193 snd_hda_codec_write(codec
, codec
->afg
, 0,
3194 AC_VERB_SET_GPIO_MASK
, gpiomask
);
3195 snd_hda_codec_read(codec
, codec
->afg
, 0,
3196 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
3200 snd_hda_codec_read(codec
, codec
->afg
, 0,
3201 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
3204 static void enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
3207 if (get_wcaps(codec
, nid
) & AC_WCAP_UNSOL_CAP
)
3208 snd_hda_codec_write_cache(codec
, nid
, 0,
3209 AC_VERB_SET_UNSOLICITED_ENABLE
,
3210 (AC_USRSP_EN
| event
));
3213 static int is_nid_hp_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
3216 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3217 if (cfg
->hp_pins
[i
] == nid
)
3218 return 1; /* nid is a HP-Out */
3220 return 0; /* nid is not a HP-Out */
3223 static void stac92xx_power_down(struct hda_codec
*codec
)
3225 struct sigmatel_spec
*spec
= codec
->spec
;
3227 /* power down inactive DACs */
3229 for (dac
= spec
->dac_list
; *dac
; dac
++)
3230 if (!is_in_dac_nids(spec
, *dac
) &&
3231 spec
->multiout
.hp_nid
!= *dac
)
3232 snd_hda_codec_write_cache(codec
, *dac
, 0,
3233 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
3236 static int stac92xx_init(struct hda_codec
*codec
)
3238 struct sigmatel_spec
*spec
= codec
->spec
;
3239 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3242 snd_hda_sequence_write(codec
, spec
->init
);
3245 if (spec
->hp_detect
) {
3246 /* Enable unsolicited responses on the HP widget */
3247 for (i
= 0; i
< cfg
->hp_outs
; i
++)
3248 enable_pin_detect(codec
, cfg
->hp_pins
[i
],
3250 /* force to enable the first line-out; the others are set up
3253 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
3255 stac92xx_auto_init_hp_out(codec
);
3256 /* fake event to set up pins */
3257 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3259 stac92xx_auto_init_multi_out(codec
);
3260 stac92xx_auto_init_hp_out(codec
);
3262 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3263 hda_nid_t nid
= cfg
->input_pins
[i
];
3265 unsigned int pinctl
= AC_PINCTL_IN_EN
;
3266 if (i
== AUTO_PIN_MIC
|| i
== AUTO_PIN_FRONT_MIC
)
3267 pinctl
|= stac92xx_get_vref(codec
, nid
);
3268 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
3271 for (i
= 0; i
< spec
->num_dmics
; i
++)
3272 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
3274 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
3275 int event
= is_nid_hp_pin(cfg
, spec
->pwr_nids
[i
])
3276 ? STAC_HP_EVENT
: STAC_PWR_EVENT
;
3277 int pinctl
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3278 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3279 int def_conf
= snd_hda_codec_read(codec
, spec
->pwr_nids
[i
],
3280 0, AC_VERB_GET_CONFIG_DEFAULT
, 0);
3281 def_conf
= get_defcfg_connect(def_conf
);
3282 /* outputs are only ports capable of power management
3283 * any attempts on powering down a input port cause the
3284 * referenced VREF to act quirky.
3286 if (pinctl
& AC_PINCTL_IN_EN
)
3288 /* skip any ports that don't have jacks since presence
3289 * detection is useless */
3290 if (def_conf
&& def_conf
!= AC_JACK_PORT_FIXED
)
3292 enable_pin_detect(codec
, spec
->pwr_nids
[i
], event
| i
);
3293 codec
->patch_ops
.unsol_event(codec
, (event
| i
) << 26);
3296 stac92xx_power_down(codec
);
3297 if (cfg
->dig_out_pin
)
3298 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pin
,
3300 if (cfg
->dig_in_pin
)
3301 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
3304 stac_gpio_set(codec
, spec
->gpio_mask
,
3305 spec
->gpio_dir
, spec
->gpio_data
);
3310 static void stac92xx_free(struct hda_codec
*codec
)
3312 struct sigmatel_spec
*spec
= codec
->spec
;
3318 if (spec
->kctl_alloc
) {
3319 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
3320 kfree(spec
->kctl_alloc
[i
].name
);
3321 kfree(spec
->kctl_alloc
);
3324 if (spec
->bios_pin_configs
)
3325 kfree(spec
->bios_pin_configs
);
3328 snd_hda_detach_beep_device(codec
);
3331 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3334 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3335 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3337 if (pin_ctl
& AC_PINCTL_IN_EN
) {
3339 * we need to check the current set-up direction of
3340 * shared input pins since they can be switched via
3341 * "xxx as Output" mixer switch
3343 struct sigmatel_spec
*spec
= codec
->spec
;
3344 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3345 if ((nid
== cfg
->input_pins
[AUTO_PIN_LINE
] &&
3346 spec
->line_switch
) ||
3347 (nid
== cfg
->input_pins
[AUTO_PIN_MIC
] &&
3352 /* if setting pin direction bits, clear the current
3353 direction bits first */
3354 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
3355 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
3357 snd_hda_codec_write_cache(codec
, nid
, 0,
3358 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3362 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
3365 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
3366 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
3367 snd_hda_codec_write_cache(codec
, nid
, 0,
3368 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3372 static int get_hp_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
3376 if (snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PIN_SENSE
, 0x00)
3378 unsigned int pinctl
;
3379 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
3380 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3381 if (pinctl
& AC_PINCTL_IN_EN
)
3382 return 0; /* mic- or line-input */
3384 return 1; /* HP-output */
3389 static void stac92xx_hp_detect(struct hda_codec
*codec
, unsigned int res
)
3391 struct sigmatel_spec
*spec
= codec
->spec
;
3392 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3393 int nid
= cfg
->hp_pins
[cfg
->hp_outs
- 1];
3397 if (spec
->gpio_mute
)
3398 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
3399 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
3401 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
3404 if (spec
->hp_switch
&& cfg
->hp_pins
[i
] == nid
)
3406 presence
= get_hp_pin_presence(codec
, cfg
->hp_pins
[i
]);
3410 /* disable lineouts, enable hp */
3411 if (spec
->hp_switch
)
3412 stac92xx_reset_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3413 for (i
= 0; i
< cfg
->line_outs
; i
++)
3414 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
3416 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3417 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
3419 if (spec
->eapd_mask
)
3420 stac_gpio_set(codec
, spec
->gpio_mask
,
3421 spec
->gpio_dir
, spec
->gpio_data
&
3424 /* enable lineouts, disable hp */
3425 if (spec
->hp_switch
)
3426 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3427 for (i
= 0; i
< cfg
->line_outs
; i
++)
3428 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
3430 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
3431 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
3433 if (spec
->eapd_mask
)
3434 stac_gpio_set(codec
, spec
->gpio_mask
,
3435 spec
->gpio_dir
, spec
->gpio_data
|
3438 if (!spec
->hp_switch
&& cfg
->hp_outs
> 1 && presence
)
3439 stac92xx_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3442 static void stac92xx_pin_sense(struct hda_codec
*codec
, int idx
)
3444 struct sigmatel_spec
*spec
= codec
->spec
;
3445 hda_nid_t nid
= spec
->pwr_nids
[idx
];
3447 val
= snd_hda_codec_read(codec
, codec
->afg
, 0, 0x0fec, 0x0)
3449 presence
= get_hp_pin_presence(codec
, nid
);
3451 /* several codecs have two power down bits */
3452 if (spec
->pwr_mapping
)
3453 idx
= spec
->pwr_mapping
[idx
];
3462 /* power down unused output ports */
3463 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7ec, val
);
3466 static void stac92xx_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3468 struct sigmatel_spec
*spec
= codec
->spec
;
3469 int idx
= res
>> 26 & 0x0f;
3471 switch ((res
>> 26) & 0x30) {
3473 stac92xx_hp_detect(codec
, res
);
3475 case STAC_PWR_EVENT
:
3476 if (spec
->num_pwrs
> 0)
3477 stac92xx_pin_sense(codec
, idx
);
3481 #ifdef SND_HDA_NEEDS_RESUME
3482 static int stac92xx_resume(struct hda_codec
*codec
)
3484 struct sigmatel_spec
*spec
= codec
->spec
;
3486 stac92xx_set_config_regs(codec
);
3487 snd_hda_sequence_write(codec
, spec
->init
);
3488 stac_gpio_set(codec
, spec
->gpio_mask
,
3489 spec
->gpio_dir
, spec
->gpio_data
);
3490 snd_hda_codec_resume_amp(codec
);
3491 snd_hda_codec_resume_cache(codec
);
3492 /* power down inactive DACs */
3494 stac92xx_power_down(codec
);
3495 /* invoke unsolicited event to reset the HP state */
3496 if (spec
->hp_detect
)
3497 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
3502 static struct hda_codec_ops stac92xx_patch_ops
= {
3503 .build_controls
= stac92xx_build_controls
,
3504 .build_pcms
= stac92xx_build_pcms
,
3505 .init
= stac92xx_init
,
3506 .free
= stac92xx_free
,
3507 .unsol_event
= stac92xx_unsol_event
,
3508 #ifdef SND_HDA_NEEDS_RESUME
3509 .resume
= stac92xx_resume
,
3513 static int patch_stac9200(struct hda_codec
*codec
)
3515 struct sigmatel_spec
*spec
;
3518 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3523 spec
->num_pins
= ARRAY_SIZE(stac9200_pin_nids
);
3524 spec
->pin_nids
= stac9200_pin_nids
;
3525 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9200_MODELS
,
3528 if (spec
->board_config
< 0) {
3529 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
3530 err
= stac92xx_save_bios_config_regs(codec
);
3532 stac92xx_free(codec
);
3535 spec
->pin_configs
= spec
->bios_pin_configs
;
3537 spec
->pin_configs
= stac9200_brd_tbl
[spec
->board_config
];
3538 stac92xx_set_config_regs(codec
);
3541 spec
->multiout
.max_channels
= 2;
3542 spec
->multiout
.num_dacs
= 1;
3543 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
3544 spec
->adc_nids
= stac9200_adc_nids
;
3545 spec
->mux_nids
= stac9200_mux_nids
;
3546 spec
->num_muxes
= 1;
3547 spec
->num_dmics
= 0;
3551 if (spec
->board_config
== STAC_9200_GATEWAY
||
3552 spec
->board_config
== STAC_9200_OQO
)
3553 spec
->init
= stac9200_eapd_init
;
3555 spec
->init
= stac9200_core_init
;
3556 spec
->mixer
= stac9200_mixer
;
3558 if (spec
->board_config
== STAC_9200_PANASONIC
) {
3559 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
3560 spec
->gpio_data
= 0x00;
3563 err
= stac9200_parse_auto_config(codec
);
3565 stac92xx_free(codec
);
3569 codec
->patch_ops
= stac92xx_patch_ops
;
3574 static int patch_stac925x(struct hda_codec
*codec
)
3576 struct sigmatel_spec
*spec
;
3579 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3584 spec
->num_pins
= ARRAY_SIZE(stac925x_pin_nids
);
3585 spec
->pin_nids
= stac925x_pin_nids
;
3586 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_925x_MODELS
,
3590 if (spec
->board_config
< 0) {
3591 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC925x,"
3592 "using BIOS defaults\n");
3593 err
= stac92xx_save_bios_config_regs(codec
);
3595 stac92xx_free(codec
);
3598 spec
->pin_configs
= spec
->bios_pin_configs
;
3599 } else if (stac925x_brd_tbl
[spec
->board_config
] != NULL
){
3600 spec
->pin_configs
= stac925x_brd_tbl
[spec
->board_config
];
3601 stac92xx_set_config_regs(codec
);
3604 spec
->multiout
.max_channels
= 2;
3605 spec
->multiout
.num_dacs
= 1;
3606 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
3607 spec
->adc_nids
= stac925x_adc_nids
;
3608 spec
->mux_nids
= stac925x_mux_nids
;
3609 spec
->num_muxes
= 1;
3612 switch (codec
->vendor_id
) {
3613 case 0x83847632: /* STAC9202 */
3614 case 0x83847633: /* STAC9202D */
3615 case 0x83847636: /* STAC9251 */
3616 case 0x83847637: /* STAC9251D */
3617 spec
->num_dmics
= STAC925X_NUM_DMICS
;
3618 spec
->dmic_nids
= stac925x_dmic_nids
;
3619 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
3620 spec
->dmux_nids
= stac925x_dmux_nids
;
3623 spec
->num_dmics
= 0;
3627 spec
->init
= stac925x_core_init
;
3628 spec
->mixer
= stac925x_mixer
;
3630 err
= stac92xx_parse_auto_config(codec
, 0x8, 0x7);
3632 if (spec
->board_config
< 0) {
3633 printk(KERN_WARNING
"hda_codec: No auto-config is "
3634 "available, default to model=ref\n");
3635 spec
->board_config
= STAC_925x_REF
;
3641 stac92xx_free(codec
);
3645 codec
->patch_ops
= stac92xx_patch_ops
;
3650 static struct hda_input_mux stac92hd73xx_dmux
= {
3653 { "Analog Inputs", 0x0b },
3655 { "Digital Mic 1", 0x09 },
3656 { "Digital Mic 2", 0x0a },
3660 static int patch_stac92hd73xx(struct hda_codec
*codec
)
3662 struct sigmatel_spec
*spec
;
3663 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
3666 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3671 spec
->num_pins
= ARRAY_SIZE(stac92hd73xx_pin_nids
);
3672 spec
->pin_nids
= stac92hd73xx_pin_nids
;
3673 spec
->board_config
= snd_hda_check_board_config(codec
,
3674 STAC_92HD73XX_MODELS
,
3675 stac92hd73xx_models
,
3676 stac92hd73xx_cfg_tbl
);
3678 if (spec
->board_config
< 0) {
3679 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3680 " STAC92HD73XX, using BIOS defaults\n");
3681 err
= stac92xx_save_bios_config_regs(codec
);
3683 stac92xx_free(codec
);
3686 spec
->pin_configs
= spec
->bios_pin_configs
;
3688 spec
->pin_configs
= stac92hd73xx_brd_tbl
[spec
->board_config
];
3689 stac92xx_set_config_regs(codec
);
3692 spec
->multiout
.num_dacs
= snd_hda_get_connections(codec
, 0x0a,
3693 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
3695 if (spec
->multiout
.num_dacs
< 0) {
3696 printk(KERN_WARNING
"hda_codec: Could not determine "
3697 "number of channels defaulting to DAC count\n");
3698 spec
->multiout
.num_dacs
= STAC92HD73_DAC_COUNT
;
3701 switch (spec
->multiout
.num_dacs
) {
3702 case 0x3: /* 6 Channel */
3703 spec
->multiout
.hp_nid
= 0x17;
3704 spec
->mixer
= stac92hd73xx_6ch_mixer
;
3705 spec
->init
= stac92hd73xx_6ch_core_init
;
3707 case 0x4: /* 8 Channel */
3708 spec
->multiout
.hp_nid
= 0x18;
3709 spec
->mixer
= stac92hd73xx_8ch_mixer
;
3710 spec
->init
= stac92hd73xx_8ch_core_init
;
3712 case 0x5: /* 10 Channel */
3713 spec
->multiout
.hp_nid
= 0x19;
3714 spec
->mixer
= stac92hd73xx_10ch_mixer
;
3715 spec
->init
= stac92hd73xx_10ch_core_init
;
3718 spec
->multiout
.dac_nids
= stac92hd73xx_dac_nids
;
3719 spec
->aloopback_mask
= 0x01;
3720 spec
->aloopback_shift
= 8;
3722 spec
->digbeep_nid
= 0x1c;
3723 spec
->mux_nids
= stac92hd73xx_mux_nids
;
3724 spec
->adc_nids
= stac92hd73xx_adc_nids
;
3725 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
3726 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
3728 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
3729 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
3730 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
3731 spec
->dinput_mux
= &stac92hd73xx_dmux
;
3732 /* GPIO0 High = Enable EAPD */
3733 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
3734 spec
->gpio_data
= 0x01;
3736 switch (spec
->board_config
) {
3738 spec
->init
= dell_eq_core_init
;
3739 switch (codec
->subsystem_id
) {
3740 case 0x1028025e: /* Analog Mics */
3742 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3743 spec
->num_dmics
= 0;
3745 case 0x10280271: /* Digital Mics */
3747 spec
->init
= dell_m6_core_init
;
3751 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3752 spec
->num_dmics
= 1;
3754 case 0x10280256: /* Both */
3756 stac92xx_set_config_reg(codec
, 0x0b, 0x90A70170);
3757 stac92xx_set_config_reg(codec
, 0x13, 0x90A60160);
3758 spec
->num_dmics
= 1;
3763 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
3766 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
3767 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
3769 err
= stac92xx_parse_auto_config(codec
, 0x22, 0x24);
3772 if (spec
->board_config
< 0) {
3773 printk(KERN_WARNING
"hda_codec: No auto-config is "
3774 "available, default to model=ref\n");
3775 spec
->board_config
= STAC_92HD73XX_REF
;
3782 stac92xx_free(codec
);
3786 codec
->patch_ops
= stac92xx_patch_ops
;
3791 static struct hda_input_mux stac92hd83xxx_dmux
= {
3794 { "Analog Inputs", 0x03 },
3795 { "Digital Mic 1", 0x04 },
3796 { "Digital Mic 2", 0x05 },
3800 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
3802 struct sigmatel_spec
*spec
;
3805 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3810 spec
->mono_nid
= 0x19;
3811 spec
->digbeep_nid
= 0x21;
3812 spec
->dmic_nids
= stac92hd83xxx_dmic_nids
;
3813 spec
->dmux_nids
= stac92hd83xxx_dmux_nids
;
3814 spec
->adc_nids
= stac92hd83xxx_adc_nids
;
3815 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
3816 spec
->pwr_mapping
= stac92hd83xxx_pwr_mapping
;
3817 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
3818 spec
->multiout
.dac_nids
= stac92hd83xxx_dac_nids
;
3820 spec
->init
= stac92hd83xxx_core_init
;
3821 switch (codec
->vendor_id
) {
3823 spec
->multiout
.num_dacs
= STAC92HD81_DAC_COUNT
;
3827 spec
->init
++; /* switch to config #2 */
3828 spec
->multiout
.num_dacs
= STAC92HD83_DAC_COUNT
;
3831 spec
->mixer
= stac92hd83xxx_mixer
;
3832 spec
->num_pins
= ARRAY_SIZE(stac92hd83xxx_pin_nids
);
3833 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd83xxx_dmux_nids
);
3834 spec
->num_adcs
= ARRAY_SIZE(stac92hd83xxx_adc_nids
);
3835 spec
->num_dmics
= STAC92HD83XXX_NUM_DMICS
;
3836 spec
->dinput_mux
= &stac92hd83xxx_dmux
;
3837 spec
->pin_nids
= stac92hd83xxx_pin_nids
;
3838 spec
->board_config
= snd_hda_check_board_config(codec
,
3839 STAC_92HD83XXX_MODELS
,
3840 stac92hd83xxx_models
,
3841 stac92hd83xxx_cfg_tbl
);
3843 if (spec
->board_config
< 0) {
3844 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3845 " STAC92HD83XXX, using BIOS defaults\n");
3846 err
= stac92xx_save_bios_config_regs(codec
);
3848 stac92xx_free(codec
);
3851 spec
->pin_configs
= spec
->bios_pin_configs
;
3853 spec
->pin_configs
= stac92hd83xxx_brd_tbl
[spec
->board_config
];
3854 stac92xx_set_config_regs(codec
);
3857 err
= stac92xx_parse_auto_config(codec
, 0x1d, 0);
3859 if (spec
->board_config
< 0) {
3860 printk(KERN_WARNING
"hda_codec: No auto-config is "
3861 "available, default to model=ref\n");
3862 spec
->board_config
= STAC_92HD83XXX_REF
;
3869 stac92xx_free(codec
);
3873 codec
->patch_ops
= stac92xx_patch_ops
;
3879 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
3881 struct sigmatel_spec
*spec
;
3884 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3889 spec
->num_pins
= ARRAY_SIZE(stac92hd71bxx_pin_nids
);
3890 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
3891 spec
->pin_nids
= stac92hd71bxx_pin_nids
;
3892 spec
->board_config
= snd_hda_check_board_config(codec
,
3893 STAC_92HD71BXX_MODELS
,
3894 stac92hd71bxx_models
,
3895 stac92hd71bxx_cfg_tbl
);
3897 if (spec
->board_config
< 0) {
3898 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
3899 " STAC92HD71BXX, using BIOS defaults\n");
3900 err
= stac92xx_save_bios_config_regs(codec
);
3902 stac92xx_free(codec
);
3905 spec
->pin_configs
= spec
->bios_pin_configs
;
3907 spec
->pin_configs
= stac92hd71bxx_brd_tbl
[spec
->board_config
];
3908 stac92xx_set_config_regs(codec
);
3911 switch (codec
->vendor_id
) {
3912 case 0x111d76b6: /* 4 Port without Analog Mixer */
3914 case 0x111d76b4: /* 6 Port without Analog Mixer */
3916 spec
->mixer
= stac92hd71bxx_mixer
;
3917 spec
->init
= stac92hd71bxx_core_init
;
3919 case 0x111d7608: /* 5 Port with Analog Mixer */
3920 /* no output amps */
3922 spec
->mixer
= stac92hd71bxx_analog_mixer
;
3925 spec
->init
= &stac92hd71bxx_analog_core_init
[HD_DISABLE_PORTF
];
3926 stac92xx_set_config_reg(codec
, 0xf, 0x40f000f0);
3928 case 0x111d7603: /* 6 Port with Analog Mixer */
3929 /* no output amps */
3933 spec
->mixer
= stac92hd71bxx_analog_mixer
;
3934 spec
->init
= stac92hd71bxx_analog_core_init
;
3937 spec
->aloopback_mask
= 0x20;
3938 spec
->aloopback_shift
= 0;
3940 /* GPIO0 High = EAPD */
3941 spec
->gpio_mask
= 0x01;
3942 spec
->gpio_dir
= 0x01;
3943 spec
->gpio_data
= 0x01;
3945 spec
->digbeep_nid
= 0x26;
3946 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
3947 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
3948 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
3949 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
3950 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
3952 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
3953 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
3954 spec
->num_dmics
= STAC92HD71BXX_NUM_DMICS
;
3955 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
3957 spec
->multiout
.num_dacs
= 1;
3958 spec
->multiout
.hp_nid
= 0x11;
3959 spec
->multiout
.dac_nids
= stac92hd71bxx_dac_nids
;
3961 err
= stac92xx_parse_auto_config(codec
, 0x21, 0x23);
3963 if (spec
->board_config
< 0) {
3964 printk(KERN_WARNING
"hda_codec: No auto-config is "
3965 "available, default to model=ref\n");
3966 spec
->board_config
= STAC_92HD71BXX_REF
;
3973 stac92xx_free(codec
);
3977 codec
->patch_ops
= stac92xx_patch_ops
;
3982 static int patch_stac922x(struct hda_codec
*codec
)
3984 struct sigmatel_spec
*spec
;
3987 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3992 spec
->num_pins
= ARRAY_SIZE(stac922x_pin_nids
);
3993 spec
->pin_nids
= stac922x_pin_nids
;
3994 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
3997 if (spec
->board_config
== STAC_INTEL_MAC_AUTO
) {
3998 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
3999 spec
->gpio_data
= 0x03;
4000 /* Intel Macs have all same PCI SSID, so we need to check
4001 * codec SSID to distinguish the exact models
4003 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
4004 switch (codec
->subsystem_id
) {
4007 spec
->board_config
= STAC_INTEL_MAC_V1
;
4011 spec
->board_config
= STAC_INTEL_MAC_V2
;
4019 spec
->board_config
= STAC_INTEL_MAC_V3
;
4023 spec
->board_config
= STAC_INTEL_MAC_V4
;
4027 spec
->board_config
= STAC_INTEL_MAC_V5
;
4030 spec
->board_config
= STAC_INTEL_MAC_V3
;
4036 if (spec
->board_config
< 0) {
4037 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC922x, "
4038 "using BIOS defaults\n");
4039 err
= stac92xx_save_bios_config_regs(codec
);
4041 stac92xx_free(codec
);
4044 spec
->pin_configs
= spec
->bios_pin_configs
;
4045 } else if (stac922x_brd_tbl
[spec
->board_config
] != NULL
) {
4046 spec
->pin_configs
= stac922x_brd_tbl
[spec
->board_config
];
4047 stac92xx_set_config_regs(codec
);
4050 spec
->adc_nids
= stac922x_adc_nids
;
4051 spec
->mux_nids
= stac922x_mux_nids
;
4052 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
4053 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
4054 spec
->num_dmics
= 0;
4057 spec
->init
= stac922x_core_init
;
4058 spec
->mixer
= stac922x_mixer
;
4060 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4062 err
= stac92xx_parse_auto_config(codec
, 0x08, 0x09);
4064 if (spec
->board_config
< 0) {
4065 printk(KERN_WARNING
"hda_codec: No auto-config is "
4066 "available, default to model=ref\n");
4067 spec
->board_config
= STAC_D945_REF
;
4073 stac92xx_free(codec
);
4077 codec
->patch_ops
= stac92xx_patch_ops
;
4079 /* Fix Mux capture level; max to 2 */
4080 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
4081 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
4082 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
4083 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
4084 (0 << AC_AMPCAP_MUTE_SHIFT
));
4089 static int patch_stac927x(struct hda_codec
*codec
)
4091 struct sigmatel_spec
*spec
;
4094 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4099 spec
->num_pins
= ARRAY_SIZE(stac927x_pin_nids
);
4100 spec
->pin_nids
= stac927x_pin_nids
;
4101 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
4105 if (spec
->board_config
< 0 || !stac927x_brd_tbl
[spec
->board_config
]) {
4106 if (spec
->board_config
< 0)
4107 snd_printdd(KERN_INFO
"hda_codec: Unknown model for"
4108 "STAC927x, using BIOS defaults\n");
4109 err
= stac92xx_save_bios_config_regs(codec
);
4111 stac92xx_free(codec
);
4114 spec
->pin_configs
= spec
->bios_pin_configs
;
4116 spec
->pin_configs
= stac927x_brd_tbl
[spec
->board_config
];
4117 stac92xx_set_config_regs(codec
);
4120 spec
->digbeep_nid
= 0x23;
4121 spec
->adc_nids
= stac927x_adc_nids
;
4122 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
4123 spec
->mux_nids
= stac927x_mux_nids
;
4124 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
4125 spec
->dac_list
= stac927x_dac_nids
;
4126 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4128 switch (spec
->board_config
) {
4131 /* GPIO0 High = Enable EAPD */
4132 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x01;
4133 spec
->gpio_data
= 0x01;
4134 spec
->num_dmics
= 0;
4136 spec
->init
= d965_core_init
;
4137 spec
->mixer
= stac927x_mixer
;
4139 case STAC_DELL_BIOS
:
4140 switch (codec
->subsystem_id
) {
4143 /* correct the device field to SPDIF out */
4144 stac92xx_set_config_reg(codec
, 0x21, 0x01442070);
4147 /* configure the analog microphone on some laptops */
4148 stac92xx_set_config_reg(codec
, 0x0c, 0x90a79130);
4149 /* correct the front output jack as a hp out */
4150 stac92xx_set_config_reg(codec
, 0x0f, 0x0227011f);
4151 /* correct the front input jack as a mic */
4152 stac92xx_set_config_reg(codec
, 0x0e, 0x02a79130);
4155 /* GPIO2 High = Enable EAPD */
4156 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x04;
4157 spec
->gpio_data
= 0x04;
4158 spec
->dmic_nids
= stac927x_dmic_nids
;
4159 spec
->num_dmics
= STAC927X_NUM_DMICS
;
4161 spec
->init
= d965_core_init
;
4162 spec
->mixer
= stac927x_mixer
;
4163 spec
->dmux_nids
= stac927x_dmux_nids
;
4164 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
4167 /* GPIO0 High = Enable EAPD */
4168 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4169 spec
->gpio_data
= 0x01;
4170 spec
->num_dmics
= 0;
4172 spec
->init
= stac927x_core_init
;
4173 spec
->mixer
= stac927x_mixer
;
4177 spec
->aloopback_mask
= 0x40;
4178 spec
->aloopback_shift
= 0;
4180 err
= stac92xx_parse_auto_config(codec
, 0x1e, 0x20);
4182 if (spec
->board_config
< 0) {
4183 printk(KERN_WARNING
"hda_codec: No auto-config is "
4184 "available, default to model=ref\n");
4185 spec
->board_config
= STAC_D965_REF
;
4191 stac92xx_free(codec
);
4195 codec
->patch_ops
= stac92xx_patch_ops
;
4199 * The STAC927x seem to require fairly long delays for certain
4200 * command sequences. With too short delays (even if the answer
4201 * is set to RIRB properly), it results in the silence output
4202 * on some hardwares like Dell.
4204 * The below flag enables the longer delay (see get_response
4207 codec
->bus
->needs_damn_long_delay
= 1;
4212 static int patch_stac9205(struct hda_codec
*codec
)
4214 struct sigmatel_spec
*spec
;
4217 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4222 spec
->num_pins
= ARRAY_SIZE(stac9205_pin_nids
);
4223 spec
->pin_nids
= stac9205_pin_nids
;
4224 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
4228 if (spec
->board_config
< 0) {
4229 snd_printdd(KERN_INFO
"hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
4230 err
= stac92xx_save_bios_config_regs(codec
);
4232 stac92xx_free(codec
);
4235 spec
->pin_configs
= spec
->bios_pin_configs
;
4237 spec
->pin_configs
= stac9205_brd_tbl
[spec
->board_config
];
4238 stac92xx_set_config_regs(codec
);
4241 spec
->digbeep_nid
= 0x23;
4242 spec
->adc_nids
= stac9205_adc_nids
;
4243 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
4244 spec
->mux_nids
= stac9205_mux_nids
;
4245 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
4246 spec
->dmic_nids
= stac9205_dmic_nids
;
4247 spec
->num_dmics
= STAC9205_NUM_DMICS
;
4248 spec
->dmux_nids
= stac9205_dmux_nids
;
4249 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
4252 spec
->init
= stac9205_core_init
;
4253 spec
->mixer
= stac9205_mixer
;
4255 spec
->aloopback_mask
= 0x40;
4256 spec
->aloopback_shift
= 0;
4257 spec
->multiout
.dac_nids
= spec
->dac_nids
;
4259 switch (spec
->board_config
){
4260 case STAC_9205_DELL_M43
:
4261 /* Enable SPDIF in/out */
4262 stac92xx_set_config_reg(codec
, 0x1f, 0x01441030);
4263 stac92xx_set_config_reg(codec
, 0x20, 0x1c410030);
4265 /* Enable unsol response for GPIO4/Dock HP connection */
4266 snd_hda_codec_write(codec
, codec
->afg
, 0,
4267 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
4268 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
4269 AC_VERB_SET_UNSOLICITED_ENABLE
,
4270 (AC_USRSP_EN
| STAC_HP_EVENT
));
4272 spec
->gpio_dir
= 0x0b;
4273 spec
->eapd_mask
= 0x01;
4274 spec
->gpio_mask
= 0x1b;
4275 spec
->gpio_mute
= 0x10;
4276 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
4279 spec
->gpio_data
= 0x01;
4282 /* GPIO0 High = EAPD */
4283 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
4284 spec
->gpio_data
= 0x01;
4288 err
= stac92xx_parse_auto_config(codec
, 0x1f, 0x20);
4290 if (spec
->board_config
< 0) {
4291 printk(KERN_WARNING
"hda_codec: No auto-config is "
4292 "available, default to model=ref\n");
4293 spec
->board_config
= STAC_9205_REF
;
4299 stac92xx_free(codec
);
4303 codec
->patch_ops
= stac92xx_patch_ops
;
4312 /* static config for Sony VAIO FE550G and Sony VAIO AR */
4313 static hda_nid_t vaio_dacs
[] = { 0x2 };
4314 #define VAIO_HP_DAC 0x5
4315 static hda_nid_t vaio_adcs
[] = { 0x8 /*,0x6*/ };
4316 static hda_nid_t vaio_mux_nids
[] = { 0x15 };
4318 static struct hda_input_mux vaio_mux
= {
4321 /* { "HP", 0x0 }, */
4322 { "Mic Jack", 0x1 },
4323 { "Internal Mic", 0x2 },
4328 static struct hda_verb vaio_init
[] = {
4329 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4330 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| STAC_HP_EVENT
},
4331 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4332 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4333 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4335 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4336 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4337 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4344 static struct hda_verb vaio_ar_init
[] = {
4345 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP <- 0x2 */
4346 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Speaker <- 0x5 */
4347 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? (<- 0x2) */
4348 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD */
4349 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
4350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Mic? */
4351 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
4352 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* HP */
4353 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Speaker */
4354 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
4355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
4356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
4357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
4361 /* bind volumes of both NID 0x02 and 0x05 */
4362 static struct hda_bind_ctls vaio_bind_master_vol
= {
4363 .ops
= &snd_hda_bind_vol
,
4365 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4366 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4371 /* bind volumes of both NID 0x02 and 0x05 */
4372 static struct hda_bind_ctls vaio_bind_master_sw
= {
4373 .ops
= &snd_hda_bind_sw
,
4375 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
4376 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT
),
4381 static struct snd_kcontrol_new vaio_mixer
[] = {
4382 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4383 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4384 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4385 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4386 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4388 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4389 .name
= "Capture Source",
4391 .info
= stac92xx_mux_enum_info
,
4392 .get
= stac92xx_mux_enum_get
,
4393 .put
= stac92xx_mux_enum_put
,
4398 static struct snd_kcontrol_new vaio_ar_mixer
[] = {
4399 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol
),
4400 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw
),
4401 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
4402 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT
),
4403 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT
),
4404 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
4405 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
4407 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4408 .name
= "Capture Source",
4410 .info
= stac92xx_mux_enum_info
,
4411 .get
= stac92xx_mux_enum_get
,
4412 .put
= stac92xx_mux_enum_put
,
4417 static struct hda_codec_ops stac9872_patch_ops
= {
4418 .build_controls
= stac92xx_build_controls
,
4419 .build_pcms
= stac92xx_build_pcms
,
4420 .init
= stac92xx_init
,
4421 .free
= stac92xx_free
,
4422 #ifdef SND_HDA_NEEDS_RESUME
4423 .resume
= stac92xx_resume
,
4427 static int stac9872_vaio_init(struct hda_codec
*codec
)
4431 err
= stac92xx_init(codec
);
4434 if (codec
->patch_ops
.unsol_event
)
4435 codec
->patch_ops
.unsol_event(codec
, STAC_HP_EVENT
<< 26);
4439 static void stac9872_vaio_hp_detect(struct hda_codec
*codec
, unsigned int res
)
4441 if (get_hp_pin_presence(codec
, 0x0a)) {
4442 stac92xx_reset_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4443 stac92xx_set_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4445 stac92xx_reset_pinctl(codec
, 0x0a, AC_PINCTL_OUT_EN
);
4446 stac92xx_set_pinctl(codec
, 0x0f, AC_PINCTL_OUT_EN
);
4450 static void stac9872_vaio_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4452 switch (res
>> 26) {
4454 stac9872_vaio_hp_detect(codec
, res
);
4459 static struct hda_codec_ops stac9872_vaio_patch_ops
= {
4460 .build_controls
= stac92xx_build_controls
,
4461 .build_pcms
= stac92xx_build_pcms
,
4462 .init
= stac9872_vaio_init
,
4463 .free
= stac92xx_free
,
4464 .unsol_event
= stac9872_vaio_unsol_event
,
4466 .resume
= stac92xx_resume
,
4470 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
4472 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
4474 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
4476 /* AR Series. id=0x83847664 and subsys=104D1300 */
4481 static const char *stac9872_models
[STAC_9872_MODELS
] = {
4482 [CXD9872RD_VAIO
] = "vaio",
4483 [CXD9872AKD_VAIO
] = "vaio-ar",
4486 static struct snd_pci_quirk stac9872_cfg_tbl
[] = {
4487 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO
),
4488 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO
),
4489 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO
),
4490 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO
),
4494 static int patch_stac9872(struct hda_codec
*codec
)
4496 struct sigmatel_spec
*spec
;
4499 board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
4502 if (board_config
< 0)
4503 /* unknown config, let generic-parser do its job... */
4504 return snd_hda_parse_generic_codec(codec
);
4506 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4511 switch (board_config
) {
4512 case CXD9872RD_VAIO
:
4513 case STAC9872AK_VAIO
:
4514 case STAC9872K_VAIO
:
4515 spec
->mixer
= vaio_mixer
;
4516 spec
->init
= vaio_init
;
4517 spec
->multiout
.max_channels
= 2;
4518 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4519 spec
->multiout
.dac_nids
= vaio_dacs
;
4520 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4521 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4522 spec
->adc_nids
= vaio_adcs
;
4524 spec
->input_mux
= &vaio_mux
;
4525 spec
->mux_nids
= vaio_mux_nids
;
4526 codec
->patch_ops
= stac9872_vaio_patch_ops
;
4529 case CXD9872AKD_VAIO
:
4530 spec
->mixer
= vaio_ar_mixer
;
4531 spec
->init
= vaio_ar_init
;
4532 spec
->multiout
.max_channels
= 2;
4533 spec
->multiout
.num_dacs
= ARRAY_SIZE(vaio_dacs
);
4534 spec
->multiout
.dac_nids
= vaio_dacs
;
4535 spec
->multiout
.hp_nid
= VAIO_HP_DAC
;
4536 spec
->num_adcs
= ARRAY_SIZE(vaio_adcs
);
4538 spec
->adc_nids
= vaio_adcs
;
4539 spec
->input_mux
= &vaio_mux
;
4540 spec
->mux_nids
= vaio_mux_nids
;
4541 codec
->patch_ops
= stac9872_patch_ops
;
4552 struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
4553 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
4554 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
4555 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
4556 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
4557 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
4558 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
4559 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
4560 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
4561 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
4562 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
4563 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
4564 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
4565 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
4566 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
4567 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
4568 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
4569 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
4570 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
4571 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
4572 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
4573 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
4574 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
4575 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
4576 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
4577 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
4578 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
4579 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
4580 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
4581 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
4582 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
4583 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
4584 /* The following does not take into account .id=0x83847661 when subsys =
4585 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4586 * currently not fully supported.
4588 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
4589 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
4590 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
4591 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
4592 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
4593 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
4594 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
4595 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
4596 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
4597 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
4598 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
4599 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
4600 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
4601 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
4602 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
4603 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
4604 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
4605 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
4606 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4607 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
4608 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4609 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
4610 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4611 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
4612 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
4613 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},