2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for SigmaTel STAC92xx
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <linux/dmi.h>
32 #include <sound/core.h>
33 #include <sound/asoundef.h>
34 #include <sound/jack.h>
35 #include <sound/tlv.h>
36 #include "hda_codec.h"
37 #include "hda_local.h"
81 STAC_92HD73XX_NO_JD
, /* no jack-detection */
95 STAC_92HD83XXX_PWR_REF
,
113 STAC_92HD71BXX_MODELS
139 STAC_INTEL_MAC_AUTO
, /* This model is selected if no module parameter
140 * is given, one of the above models will be
141 * chosen according to the subsystem id. */
142 /* for backward compatibility */
159 STAC_D965_REF_NO_JD
, /* no jack-detection */
176 struct sigmatel_event
{
183 struct sigmatel_jack
{
186 struct snd_jack
*jack
;
189 struct sigmatel_mic_route
{
192 signed char dmux_idx
;
195 struct sigmatel_spec
{
196 struct snd_kcontrol_new
*mixers
[4];
197 unsigned int num_mixers
;
200 unsigned int eapd_switch
: 1;
201 unsigned int surr_switch
: 1;
202 unsigned int alt_switch
: 1;
203 unsigned int hp_detect
: 1;
204 unsigned int spdif_mute
: 1;
205 unsigned int check_volume_offset
:1;
206 unsigned int auto_mic
:1;
207 unsigned int linear_tone_beep
:1;
210 unsigned int eapd_mask
;
211 unsigned int gpio_mask
;
212 unsigned int gpio_dir
;
213 unsigned int gpio_data
;
214 unsigned int gpio_mute
;
215 unsigned int gpio_led
;
216 unsigned int gpio_led_polarity
;
219 unsigned int stream_delay
;
221 /* analog loopback */
222 struct snd_kcontrol_new
*aloopback_ctl
;
223 unsigned char aloopback_mask
;
224 unsigned char aloopback_shift
;
226 /* power management */
227 unsigned int num_pwrs
;
228 unsigned int *pwr_mapping
;
233 struct snd_array jacks
;
236 struct snd_array events
;
239 struct hda_input_mux
*mono_mux
;
240 unsigned int cur_mmux
;
241 struct hda_multi_out multiout
;
242 hda_nid_t dac_nids
[5];
243 hda_nid_t hp_dacs
[5];
244 hda_nid_t speaker_dacs
[5];
250 unsigned int num_adcs
;
252 unsigned int num_muxes
;
253 hda_nid_t
*dmic_nids
;
254 unsigned int num_dmics
;
255 hda_nid_t
*dmux_nids
;
256 unsigned int num_dmuxes
;
257 hda_nid_t
*smux_nids
;
258 unsigned int num_smuxes
;
259 unsigned int num_analog_muxes
;
261 unsigned long *capvols
; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
262 unsigned long *capsws
; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
263 unsigned int num_caps
; /* number of capture volume/switch elements */
265 struct sigmatel_mic_route ext_mic
;
266 struct sigmatel_mic_route int_mic
;
267 struct sigmatel_mic_route dock_mic
;
269 const char **spdif_labels
;
271 hda_nid_t dig_in_nid
;
273 hda_nid_t anabeep_nid
;
274 hda_nid_t digbeep_nid
;
278 unsigned int num_pins
;
280 /* codec specific stuff */
281 struct hda_verb
*init
;
282 struct snd_kcontrol_new
*mixer
;
285 struct hda_input_mux
*dinput_mux
;
286 unsigned int cur_dmux
[2];
287 struct hda_input_mux
*input_mux
;
288 unsigned int cur_mux
[3];
289 struct hda_input_mux
*sinput_mux
;
290 unsigned int cur_smux
[2];
291 unsigned int cur_amux
;
293 unsigned int powerdown_adcs
;
296 unsigned int io_switch
[2];
297 unsigned int clfe_swap
;
298 hda_nid_t line_switch
; /* shared line-in for input and output */
299 hda_nid_t mic_switch
; /* shared mic-in for input and output */
300 hda_nid_t hp_switch
; /* NID of HP as line-out */
301 unsigned int aloopback
;
303 struct hda_pcm pcm_rec
[2]; /* PCM information */
305 /* dynamic controls and input_mux */
306 struct auto_pin_cfg autocfg
;
307 struct snd_array kctls
;
308 struct hda_input_mux private_dimux
;
309 struct hda_input_mux private_imux
;
310 struct hda_input_mux private_smux
;
311 struct hda_input_mux private_mono_mux
;
314 static hda_nid_t stac9200_adc_nids
[1] = {
318 static hda_nid_t stac9200_mux_nids
[1] = {
322 static hda_nid_t stac9200_dac_nids
[1] = {
326 static hda_nid_t stac92hd73xx_pwr_nids
[8] = {
327 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
331 static hda_nid_t stac92hd73xx_slave_dig_outs
[2] = {
335 static hda_nid_t stac92hd73xx_adc_nids
[2] = {
339 #define STAC92HD73XX_NUM_DMICS 2
340 static hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
344 #define STAC92HD73_DAC_COUNT 5
346 static hda_nid_t stac92hd73xx_mux_nids
[2] = {
350 static hda_nid_t stac92hd73xx_dmux_nids
[2] = {
354 static hda_nid_t stac92hd73xx_smux_nids
[2] = {
358 #define STAC92HD73XX_NUM_CAPS 2
359 static unsigned long stac92hd73xx_capvols
[] = {
360 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT
),
361 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
363 #define stac92hd73xx_capsws stac92hd73xx_capvols
365 #define STAC92HD83_DAC_COUNT 3
367 static hda_nid_t stac92hd83xxx_mux_nids
[2] = {
371 static hda_nid_t stac92hd83xxx_adc_nids
[2] = {
375 static hda_nid_t stac92hd83xxx_pwr_nids
[4] = {
379 static hda_nid_t stac92hd83xxx_slave_dig_outs
[2] = {
383 static unsigned int stac92hd83xxx_pwr_mapping
[4] = {
384 0x03, 0x0c, 0x20, 0x40,
387 #define STAC92HD83XXX_NUM_DMICS 2
388 static hda_nid_t stac92hd83xxx_dmic_nids
[STAC92HD83XXX_NUM_DMICS
+ 1] = {
392 #define STAC92HD83XXX_NUM_CAPS 2
393 static unsigned long stac92hd83xxx_capvols
[] = {
394 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
395 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_OUTPUT
),
397 #define stac92hd83xxx_capsws stac92hd83xxx_capvols
399 static hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
403 static hda_nid_t stac92hd71bxx_adc_nids
[2] = {
407 static hda_nid_t stac92hd71bxx_mux_nids
[2] = {
411 static hda_nid_t stac92hd71bxx_dmux_nids
[2] = {
415 static hda_nid_t stac92hd71bxx_smux_nids
[2] = {
419 #define STAC92HD71BXX_NUM_DMICS 2
420 static hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
424 static hda_nid_t stac92hd71bxx_slave_dig_outs
[2] = {
428 #define STAC92HD71BXX_NUM_CAPS 2
429 static unsigned long stac92hd71bxx_capvols
[] = {
430 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
431 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
433 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
435 static hda_nid_t stac925x_adc_nids
[1] = {
439 static hda_nid_t stac925x_mux_nids
[1] = {
443 static hda_nid_t stac925x_dac_nids
[1] = {
447 #define STAC925X_NUM_DMICS 1
448 static hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
452 static hda_nid_t stac925x_dmux_nids
[1] = {
456 static unsigned long stac925x_capvols
[] = {
457 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
459 static unsigned long stac925x_capsws
[] = {
460 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
463 static hda_nid_t stac922x_adc_nids
[2] = {
467 static hda_nid_t stac922x_mux_nids
[2] = {
471 #define STAC922X_NUM_CAPS 2
472 static unsigned long stac922x_capvols
[] = {
473 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT
),
474 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
476 #define stac922x_capsws stac922x_capvols
478 static hda_nid_t stac927x_slave_dig_outs
[2] = {
482 static hda_nid_t stac927x_adc_nids
[3] = {
486 static hda_nid_t stac927x_mux_nids
[3] = {
490 static hda_nid_t stac927x_smux_nids
[1] = {
494 static hda_nid_t stac927x_dac_nids
[6] = {
495 0x02, 0x03, 0x04, 0x05, 0x06, 0
498 static hda_nid_t stac927x_dmux_nids
[1] = {
502 #define STAC927X_NUM_DMICS 2
503 static hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
507 #define STAC927X_NUM_CAPS 3
508 static unsigned long stac927x_capvols
[] = {
509 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
510 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT
),
511 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT
),
513 static unsigned long stac927x_capsws
[] = {
514 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
515 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
516 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
519 static const char *stac927x_spdif_labels
[5] = {
520 "Digital Playback", "ADAT", "Analog Mux 1",
521 "Analog Mux 2", "Analog Mux 3"
524 static hda_nid_t stac9205_adc_nids
[2] = {
528 static hda_nid_t stac9205_mux_nids
[2] = {
532 static hda_nid_t stac9205_dmux_nids
[1] = {
536 static hda_nid_t stac9205_smux_nids
[1] = {
540 #define STAC9205_NUM_DMICS 2
541 static hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
545 #define STAC9205_NUM_CAPS 2
546 static unsigned long stac9205_capvols
[] = {
547 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT
),
548 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT
),
550 static unsigned long stac9205_capsws
[] = {
551 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
552 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT
),
555 static hda_nid_t stac9200_pin_nids
[8] = {
556 0x08, 0x09, 0x0d, 0x0e,
557 0x0f, 0x10, 0x11, 0x12,
560 static hda_nid_t stac925x_pin_nids
[8] = {
561 0x07, 0x08, 0x0a, 0x0b,
562 0x0c, 0x0d, 0x10, 0x11,
565 static hda_nid_t stac922x_pin_nids
[10] = {
566 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
567 0x0f, 0x10, 0x11, 0x15, 0x1b,
570 static hda_nid_t stac92hd73xx_pin_nids
[13] = {
571 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
572 0x0f, 0x10, 0x11, 0x12, 0x13,
576 static hda_nid_t stac92hd83xxx_pin_nids
[10] = {
577 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
578 0x0f, 0x10, 0x11, 0x1f, 0x20,
581 static hda_nid_t stac92hd88xxx_pin_nids
[10] = {
582 0x0a, 0x0b, 0x0c, 0x0d,
583 0x0f, 0x11, 0x1f, 0x20,
586 #define STAC92HD71BXX_NUM_PINS 13
587 static hda_nid_t stac92hd71bxx_pin_nids_4port
[STAC92HD71BXX_NUM_PINS
] = {
588 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
589 0x00, 0x14, 0x18, 0x19, 0x1e,
592 static hda_nid_t stac92hd71bxx_pin_nids_6port
[STAC92HD71BXX_NUM_PINS
] = {
593 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
594 0x0f, 0x14, 0x18, 0x19, 0x1e,
598 static hda_nid_t stac927x_pin_nids
[14] = {
599 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
600 0x0f, 0x10, 0x11, 0x12, 0x13,
601 0x14, 0x21, 0x22, 0x23,
604 static hda_nid_t stac9205_pin_nids
[12] = {
605 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
606 0x0f, 0x14, 0x16, 0x17, 0x18,
610 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
611 struct snd_ctl_elem_info
*uinfo
)
613 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
614 struct sigmatel_spec
*spec
= codec
->spec
;
615 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
618 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
619 struct snd_ctl_elem_value
*ucontrol
)
621 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
622 struct sigmatel_spec
*spec
= codec
->spec
;
623 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
625 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
629 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
630 struct snd_ctl_elem_value
*ucontrol
)
632 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
633 struct sigmatel_spec
*spec
= codec
->spec
;
634 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
636 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
637 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
640 static int stac92xx_smux_enum_info(struct snd_kcontrol
*kcontrol
,
641 struct snd_ctl_elem_info
*uinfo
)
643 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
644 struct sigmatel_spec
*spec
= codec
->spec
;
645 return snd_hda_input_mux_info(spec
->sinput_mux
, uinfo
);
648 static int stac92xx_smux_enum_get(struct snd_kcontrol
*kcontrol
,
649 struct snd_ctl_elem_value
*ucontrol
)
651 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
652 struct sigmatel_spec
*spec
= codec
->spec
;
653 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
655 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_smux
[smux_idx
];
659 static int stac92xx_smux_enum_put(struct snd_kcontrol
*kcontrol
,
660 struct snd_ctl_elem_value
*ucontrol
)
662 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
663 struct sigmatel_spec
*spec
= codec
->spec
;
664 struct hda_input_mux
*smux
= &spec
->private_smux
;
665 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
669 err
= snd_hda_input_mux_put(codec
, spec
->sinput_mux
, ucontrol
,
670 spec
->smux_nids
[smux_idx
], &spec
->cur_smux
[smux_idx
]);
674 if (spec
->spdif_mute
) {
676 nid
= spec
->multiout
.dig_out_nid
;
678 nid
= codec
->slave_dig_outs
[smux_idx
- 1];
679 if (spec
->cur_smux
[smux_idx
] == smux
->num_items
- 1)
683 /* un/mute SPDIF out */
684 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
690 static unsigned int stac92xx_vref_set(struct hda_codec
*codec
,
691 hda_nid_t nid
, unsigned int new_vref
)
695 pincfg
= snd_hda_codec_read(codec
, nid
, 0,
696 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
699 pincfg
&= ~(AC_PINCTL_VREFEN
| AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
702 if (new_vref
== AC_PINCTL_VREF_HIZ
)
703 pincfg
|= AC_PINCTL_OUT_EN
;
705 pincfg
|= AC_PINCTL_IN_EN
;
707 error
= snd_hda_codec_write_cache(codec
, nid
, 0,
708 AC_VERB_SET_PIN_WIDGET_CONTROL
, pincfg
);
715 static unsigned int stac92xx_vref_get(struct hda_codec
*codec
, hda_nid_t nid
)
718 vref
= snd_hda_codec_read(codec
, nid
, 0,
719 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
720 vref
&= AC_PINCTL_VREFEN
;
724 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
726 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
727 struct sigmatel_spec
*spec
= codec
->spec
;
728 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
731 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
733 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
734 struct sigmatel_spec
*spec
= codec
->spec
;
735 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
737 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
741 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
743 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
744 struct sigmatel_spec
*spec
= codec
->spec
;
745 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
746 const struct hda_input_mux
*imux
= spec
->input_mux
;
747 unsigned int idx
, prev_idx
;
749 idx
= ucontrol
->value
.enumerated
.item
[0];
750 if (idx
>= imux
->num_items
)
751 idx
= imux
->num_items
- 1;
752 prev_idx
= spec
->cur_mux
[adc_idx
];
755 if (idx
< spec
->num_analog_muxes
) {
756 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[adc_idx
], 0,
757 AC_VERB_SET_CONNECT_SEL
,
758 imux
->items
[idx
].index
);
759 if (prev_idx
>= spec
->num_analog_muxes
) {
760 imux
= spec
->dinput_mux
;
762 snd_hda_codec_write_cache(codec
,
763 spec
->dmux_nids
[adc_idx
], 0,
764 AC_VERB_SET_CONNECT_SEL
,
765 imux
->items
[0].index
);
768 imux
= spec
->dinput_mux
;
769 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[adc_idx
], 0,
770 AC_VERB_SET_CONNECT_SEL
,
771 imux
->items
[idx
- 1].index
);
773 spec
->cur_mux
[adc_idx
] = idx
;
777 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
778 struct snd_ctl_elem_info
*uinfo
)
780 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
781 struct sigmatel_spec
*spec
= codec
->spec
;
782 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
785 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
786 struct snd_ctl_elem_value
*ucontrol
)
788 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
789 struct sigmatel_spec
*spec
= codec
->spec
;
791 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
795 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
796 struct snd_ctl_elem_value
*ucontrol
)
798 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
799 struct sigmatel_spec
*spec
= codec
->spec
;
801 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
802 spec
->mono_nid
, &spec
->cur_mmux
);
805 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
807 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
808 struct snd_ctl_elem_value
*ucontrol
)
810 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
811 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
812 struct sigmatel_spec
*spec
= codec
->spec
;
814 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
815 (spec
->aloopback_mask
<< idx
));
819 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
820 struct snd_ctl_elem_value
*ucontrol
)
822 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
823 struct sigmatel_spec
*spec
= codec
->spec
;
824 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
825 unsigned int dac_mode
;
826 unsigned int val
, idx_val
;
828 idx_val
= spec
->aloopback_mask
<< idx
;
829 if (ucontrol
->value
.integer
.value
[0])
830 val
= spec
->aloopback
| idx_val
;
832 val
= spec
->aloopback
& ~idx_val
;
833 if (spec
->aloopback
== val
)
836 spec
->aloopback
= val
;
838 /* Only return the bits defined by the shift value of the
839 * first two bytes of the mask
841 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
842 kcontrol
->private_value
& 0xFFFF, 0x0);
843 dac_mode
>>= spec
->aloopback_shift
;
845 if (spec
->aloopback
& idx_val
) {
846 snd_hda_power_up(codec
);
849 snd_hda_power_down(codec
);
850 dac_mode
&= ~idx_val
;
853 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
854 kcontrol
->private_value
>> 16, dac_mode
);
859 static struct hda_verb stac9200_core_init
[] = {
860 /* set dac0mux for dac converter */
861 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
865 static struct hda_verb stac9200_eapd_init
[] = {
866 /* set dac0mux for dac converter */
867 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
868 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
872 static struct hda_verb dell_eq_core_init
[] = {
873 /* set master volume to max value without distortion
874 * and direct control */
875 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
879 static struct hda_verb stac92hd73xx_core_init
[] = {
880 /* set master volume and direct control */
881 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
885 static struct hda_verb stac92hd83xxx_core_init
[] = {
886 /* power state controls amps */
887 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
891 static struct hda_verb stac92hd71bxx_core_init
[] = {
892 /* set master volume and direct control */
893 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
897 static struct hda_verb stac92hd71bxx_unmute_core_init
[] = {
898 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
899 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
900 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
901 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
905 static struct hda_verb stac925x_core_init
[] = {
906 /* set dac0mux for dac converter */
907 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
908 /* mute the master volume */
909 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
913 static struct hda_verb stac922x_core_init
[] = {
914 /* set master volume and direct control */
915 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
919 static struct hda_verb d965_core_init
[] = {
920 /* set master volume and direct control */
921 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
922 /* unmute node 0x1b */
923 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
924 /* select node 0x03 as DAC */
925 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
929 static struct hda_verb dell_3st_core_init
[] = {
930 /* don't set delta bit */
931 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
932 /* unmute node 0x1b */
933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
934 /* select node 0x03 as DAC */
935 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
939 static struct hda_verb stac927x_core_init
[] = {
940 /* set master volume and direct control */
941 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
942 /* enable analog pc beep path */
943 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
947 static struct hda_verb stac927x_volknob_core_init
[] = {
948 /* don't set delta bit */
949 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
950 /* enable analog pc beep path */
951 {0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
955 static struct hda_verb stac9205_core_init
[] = {
956 /* set master volume and direct control */
957 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
958 /* enable analog pc beep path */
959 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
963 #define STAC_MONO_MUX \
965 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
966 .name = "Mono Mux", \
968 .info = stac92xx_mono_mux_enum_info, \
969 .get = stac92xx_mono_mux_enum_get, \
970 .put = stac92xx_mono_mux_enum_put, \
973 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
975 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
976 .name = "Analog Loopback", \
978 .info = stac92xx_aloopback_info, \
979 .get = stac92xx_aloopback_get, \
980 .put = stac92xx_aloopback_put, \
981 .private_value = verb_read | (verb_write << 16), \
984 #define DC_BIAS(xname, idx, nid) \
986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
989 .info = stac92xx_dc_bias_info, \
990 .get = stac92xx_dc_bias_get, \
991 .put = stac92xx_dc_bias_put, \
992 .private_value = nid, \
995 static struct snd_kcontrol_new stac9200_mixer
[] = {
996 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT
),
997 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT
),
998 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
999 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
1003 static struct snd_kcontrol_new stac92hd73xx_6ch_loopback
[] = {
1004 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1008 static struct snd_kcontrol_new stac92hd73xx_8ch_loopback
[] = {
1009 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1013 static struct snd_kcontrol_new stac92hd73xx_10ch_loopback
[] = {
1014 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1019 static struct snd_kcontrol_new stac92hd71bxx_loopback
[] = {
1020 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1023 static struct snd_kcontrol_new stac925x_mixer
[] = {
1024 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT
),
1025 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT
),
1029 static struct snd_kcontrol_new stac9205_loopback
[] = {
1030 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1034 static struct snd_kcontrol_new stac927x_loopback
[] = {
1035 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1039 static struct snd_kcontrol_new stac_dmux_mixer
= {
1040 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1041 .name
= "Digital Input Source",
1042 /* count set later */
1043 .info
= stac92xx_dmux_enum_info
,
1044 .get
= stac92xx_dmux_enum_get
,
1045 .put
= stac92xx_dmux_enum_put
,
1048 static struct snd_kcontrol_new stac_smux_mixer
= {
1049 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1050 .name
= "IEC958 Playback Source",
1051 /* count set later */
1052 .info
= stac92xx_smux_enum_info
,
1053 .get
= stac92xx_smux_enum_get
,
1054 .put
= stac92xx_smux_enum_put
,
1057 static const char *slave_vols
[] = {
1058 "Front Playback Volume",
1059 "Surround Playback Volume",
1060 "Center Playback Volume",
1061 "LFE Playback Volume",
1062 "Side Playback Volume",
1063 "Headphone Playback Volume",
1064 "Speaker Playback Volume",
1068 static const char *slave_sws
[] = {
1069 "Front Playback Switch",
1070 "Surround Playback Switch",
1071 "Center Playback Switch",
1072 "LFE Playback Switch",
1073 "Side Playback Switch",
1074 "Headphone Playback Switch",
1075 "Speaker Playback Switch",
1076 "IEC958 Playback Switch",
1080 static void stac92xx_free_kctls(struct hda_codec
*codec
);
1081 static int stac92xx_add_jack(struct hda_codec
*codec
, hda_nid_t nid
, int type
);
1083 static int stac92xx_build_controls(struct hda_codec
*codec
)
1085 struct sigmatel_spec
*spec
= codec
->spec
;
1086 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1092 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1097 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1098 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1102 if (!spec
->auto_mic
&& spec
->num_dmuxes
> 0 &&
1103 snd_hda_get_bool_hint(codec
, "separate_dmux") == 1) {
1104 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1105 err
= snd_hda_ctl_add(codec
, 0,
1106 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1110 if (spec
->num_smuxes
> 0) {
1111 int wcaps
= get_wcaps(codec
, spec
->multiout
.dig_out_nid
);
1112 struct hda_input_mux
*smux
= &spec
->private_smux
;
1113 /* check for mute support on SPDIF out */
1114 if (wcaps
& AC_WCAP_OUT_AMP
) {
1115 snd_hda_add_imux_item(smux
, "Off", 0, NULL
);
1116 spec
->spdif_mute
= 1;
1118 stac_smux_mixer
.count
= spec
->num_smuxes
;
1119 err
= snd_hda_ctl_add(codec
, 0,
1120 snd_ctl_new1(&stac_smux_mixer
, codec
));
1125 if (spec
->multiout
.dig_out_nid
) {
1126 err
= snd_hda_create_spdif_out_ctls(codec
, spec
->multiout
.dig_out_nid
);
1129 err
= snd_hda_create_spdif_share_sw(codec
,
1133 spec
->multiout
.share_spdif
= 1;
1135 if (spec
->dig_in_nid
&& !(spec
->gpio_dir
& 0x01)) {
1136 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1141 /* if we have no master control, let's create it */
1142 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1143 unsigned int vmaster_tlv
[4];
1144 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1145 HDA_OUTPUT
, vmaster_tlv
);
1146 /* correct volume offset */
1147 vmaster_tlv
[2] += vmaster_tlv
[3] * spec
->volume_offset
;
1148 /* minimum value is actually mute */
1149 vmaster_tlv
[3] |= TLV_DB_SCALE_MUTE
;
1150 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1151 vmaster_tlv
, slave_vols
);
1155 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1156 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1162 if (spec
->aloopback_ctl
&&
1163 snd_hda_get_bool_hint(codec
, "loopback") == 1) {
1164 err
= snd_hda_add_new_ctls(codec
, spec
->aloopback_ctl
);
1169 stac92xx_free_kctls(codec
); /* no longer needed */
1171 /* create jack input elements */
1172 if (spec
->hp_detect
) {
1173 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1174 int type
= SND_JACK_HEADPHONE
;
1175 nid
= cfg
->hp_pins
[i
];
1176 /* jack detection */
1177 if (cfg
->hp_outs
== i
)
1178 type
|= SND_JACK_LINEOUT
;
1179 err
= stac92xx_add_jack(codec
, nid
, type
);
1184 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1185 err
= stac92xx_add_jack(codec
, cfg
->line_out_pins
[i
],
1190 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1191 nid
= cfg
->inputs
[i
].pin
;
1192 err
= stac92xx_add_jack(codec
, nid
, SND_JACK_MICROPHONE
);
1200 static unsigned int ref9200_pin_configs
[8] = {
1201 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1202 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1205 static unsigned int gateway9200_m4_pin_configs
[8] = {
1206 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1207 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1209 static unsigned int gateway9200_m4_2_pin_configs
[8] = {
1210 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1211 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1215 STAC 9200 pin configs for
1220 static unsigned int dell9200_d21_pin_configs
[8] = {
1221 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1222 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1226 STAC 9200 pin configs for
1230 static unsigned int dell9200_d22_pin_configs
[8] = {
1231 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1232 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1236 STAC 9200 pin configs for
1237 102801C4 (Dell Dimension E310)
1244 static unsigned int dell9200_d23_pin_configs
[8] = {
1245 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1246 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1251 STAC 9200-32 pin configs for
1252 102801B5 (Dell Inspiron 630m)
1253 102801D8 (Dell Inspiron 640m)
1255 static unsigned int dell9200_m21_pin_configs
[8] = {
1256 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1257 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1261 STAC 9200-32 pin configs for
1262 102801C2 (Dell Latitude D620)
1264 102801CC (Dell Latitude D820)
1268 static unsigned int dell9200_m22_pin_configs
[8] = {
1269 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1270 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1274 STAC 9200-32 pin configs for
1275 102801CE (Dell XPS M1710)
1276 102801CF (Dell Precision M90)
1278 static unsigned int dell9200_m23_pin_configs
[8] = {
1279 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1280 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1284 STAC 9200-32 pin configs for
1287 102801CB (Dell Latitude 120L)
1290 static unsigned int dell9200_m24_pin_configs
[8] = {
1291 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1292 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1296 STAC 9200-32 pin configs for
1297 102801BD (Dell Inspiron E1505n)
1301 static unsigned int dell9200_m25_pin_configs
[8] = {
1302 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1303 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1307 STAC 9200-32 pin configs for
1308 102801F5 (Dell Inspiron 1501)
1311 static unsigned int dell9200_m26_pin_configs
[8] = {
1312 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1313 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1318 102801CD (Dell Inspiron E1705/9400)
1320 static unsigned int dell9200_m27_pin_configs
[8] = {
1321 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1322 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1325 static unsigned int oqo9200_pin_configs
[8] = {
1326 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1327 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1331 static unsigned int *stac9200_brd_tbl
[STAC_9200_MODELS
] = {
1332 [STAC_REF
] = ref9200_pin_configs
,
1333 [STAC_9200_OQO
] = oqo9200_pin_configs
,
1334 [STAC_9200_DELL_D21
] = dell9200_d21_pin_configs
,
1335 [STAC_9200_DELL_D22
] = dell9200_d22_pin_configs
,
1336 [STAC_9200_DELL_D23
] = dell9200_d23_pin_configs
,
1337 [STAC_9200_DELL_M21
] = dell9200_m21_pin_configs
,
1338 [STAC_9200_DELL_M22
] = dell9200_m22_pin_configs
,
1339 [STAC_9200_DELL_M23
] = dell9200_m23_pin_configs
,
1340 [STAC_9200_DELL_M24
] = dell9200_m24_pin_configs
,
1341 [STAC_9200_DELL_M25
] = dell9200_m25_pin_configs
,
1342 [STAC_9200_DELL_M26
] = dell9200_m26_pin_configs
,
1343 [STAC_9200_DELL_M27
] = dell9200_m27_pin_configs
,
1344 [STAC_9200_M4
] = gateway9200_m4_pin_configs
,
1345 [STAC_9200_M4_2
] = gateway9200_m4_2_pin_configs
,
1346 [STAC_9200_PANASONIC
] = ref9200_pin_configs
,
1349 static const char *stac9200_models
[STAC_9200_MODELS
] = {
1350 [STAC_AUTO
] = "auto",
1352 [STAC_9200_OQO
] = "oqo",
1353 [STAC_9200_DELL_D21
] = "dell-d21",
1354 [STAC_9200_DELL_D22
] = "dell-d22",
1355 [STAC_9200_DELL_D23
] = "dell-d23",
1356 [STAC_9200_DELL_M21
] = "dell-m21",
1357 [STAC_9200_DELL_M22
] = "dell-m22",
1358 [STAC_9200_DELL_M23
] = "dell-m23",
1359 [STAC_9200_DELL_M24
] = "dell-m24",
1360 [STAC_9200_DELL_M25
] = "dell-m25",
1361 [STAC_9200_DELL_M26
] = "dell-m26",
1362 [STAC_9200_DELL_M27
] = "dell-m27",
1363 [STAC_9200_M4
] = "gateway-m4",
1364 [STAC_9200_M4_2
] = "gateway-m4-2",
1365 [STAC_9200_PANASONIC
] = "panasonic",
1368 static struct snd_pci_quirk stac9200_cfg_tbl
[] = {
1369 /* SigmaTel reference board */
1370 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1371 "DFI LanParty", STAC_REF
),
1372 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1373 "DFI LanParty", STAC_REF
),
1374 /* Dell laptops have BIOS problem */
1375 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1376 "unknown Dell", STAC_9200_DELL_D21
),
1377 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1378 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1379 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1380 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1381 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1382 "unknown Dell", STAC_9200_DELL_D22
),
1383 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1384 "unknown Dell", STAC_9200_DELL_D22
),
1385 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1386 "Dell Latitude D620", STAC_9200_DELL_M22
),
1387 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1388 "unknown Dell", STAC_9200_DELL_D23
),
1389 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1390 "unknown Dell", STAC_9200_DELL_D23
),
1391 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1392 "unknown Dell", STAC_9200_DELL_M22
),
1393 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1394 "unknown Dell", STAC_9200_DELL_M24
),
1395 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1396 "unknown Dell", STAC_9200_DELL_M24
),
1397 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1398 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1399 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1400 "Dell Latitude D820", STAC_9200_DELL_M22
),
1401 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1402 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1403 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1404 "Dell XPS M1710", STAC_9200_DELL_M23
),
1405 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1406 "Dell Precision M90", STAC_9200_DELL_M23
),
1407 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1408 "unknown Dell", STAC_9200_DELL_M22
),
1409 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1410 "unknown Dell", STAC_9200_DELL_M22
),
1411 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1412 "unknown Dell", STAC_9200_DELL_M22
),
1413 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1414 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1415 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1416 "unknown Dell", STAC_9200_DELL_D23
),
1417 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1418 "unknown Dell", STAC_9200_DELL_D23
),
1419 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1420 "unknown Dell", STAC_9200_DELL_D21
),
1421 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1422 "unknown Dell", STAC_9200_DELL_D23
),
1423 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1424 "unknown Dell", STAC_9200_DELL_D21
),
1425 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1426 "unknown Dell", STAC_9200_DELL_M25
),
1427 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1428 "unknown Dell", STAC_9200_DELL_M25
),
1429 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1430 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1431 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1432 "unknown Dell", STAC_9200_DELL_M26
),
1434 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1435 /* Gateway machines needs EAPD to be set on resume */
1436 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4
),
1437 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2
),
1438 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2
),
1440 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1444 static unsigned int ref925x_pin_configs
[8] = {
1445 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1446 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1449 static unsigned int stac925xM1_pin_configs
[8] = {
1450 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1451 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1454 static unsigned int stac925xM1_2_pin_configs
[8] = {
1455 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1456 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1459 static unsigned int stac925xM2_pin_configs
[8] = {
1460 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1461 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1464 static unsigned int stac925xM2_2_pin_configs
[8] = {
1465 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1466 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1469 static unsigned int stac925xM3_pin_configs
[8] = {
1470 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1471 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1474 static unsigned int stac925xM5_pin_configs
[8] = {
1475 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1476 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1479 static unsigned int stac925xM6_pin_configs
[8] = {
1480 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1481 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1484 static unsigned int *stac925x_brd_tbl
[STAC_925x_MODELS
] = {
1485 [STAC_REF
] = ref925x_pin_configs
,
1486 [STAC_M1
] = stac925xM1_pin_configs
,
1487 [STAC_M1_2
] = stac925xM1_2_pin_configs
,
1488 [STAC_M2
] = stac925xM2_pin_configs
,
1489 [STAC_M2_2
] = stac925xM2_2_pin_configs
,
1490 [STAC_M3
] = stac925xM3_pin_configs
,
1491 [STAC_M5
] = stac925xM5_pin_configs
,
1492 [STAC_M6
] = stac925xM6_pin_configs
,
1495 static const char *stac925x_models
[STAC_925x_MODELS
] = {
1496 [STAC_925x_AUTO
] = "auto",
1499 [STAC_M1_2
] = "m1-2",
1501 [STAC_M2_2
] = "m2-2",
1507 static struct snd_pci_quirk stac925x_codec_id_cfg_tbl
[] = {
1508 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2
),
1509 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5
),
1510 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1
),
1511 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2
),
1512 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2
),
1513 /* Not sure about the brand name for those */
1514 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1
),
1515 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3
),
1516 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6
),
1517 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2
),
1521 static struct snd_pci_quirk stac925x_cfg_tbl
[] = {
1522 /* SigmaTel reference board */
1523 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1524 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101, "DFI LanParty", STAC_REF
),
1525 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1527 /* Default table for unknown ID */
1528 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2
),
1533 static unsigned int ref92hd73xx_pin_configs
[13] = {
1534 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1535 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1536 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1540 static unsigned int dell_m6_pin_configs
[13] = {
1541 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1542 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1543 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1547 static unsigned int alienware_m17x_pin_configs
[13] = {
1548 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1549 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1550 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1554 static unsigned int intel_dg45id_pin_configs
[13] = {
1555 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1556 0x01A19250, 0x01011212, 0x01016211
1559 static unsigned int *stac92hd73xx_brd_tbl
[STAC_92HD73XX_MODELS
] = {
1560 [STAC_92HD73XX_REF
] = ref92hd73xx_pin_configs
,
1561 [STAC_DELL_M6_AMIC
] = dell_m6_pin_configs
,
1562 [STAC_DELL_M6_DMIC
] = dell_m6_pin_configs
,
1563 [STAC_DELL_M6_BOTH
] = dell_m6_pin_configs
,
1564 [STAC_DELL_EQ
] = dell_m6_pin_configs
,
1565 [STAC_ALIENWARE_M17X
] = alienware_m17x_pin_configs
,
1566 [STAC_92HD73XX_INTEL
] = intel_dg45id_pin_configs
,
1569 static const char *stac92hd73xx_models
[STAC_92HD73XX_MODELS
] = {
1570 [STAC_92HD73XX_AUTO
] = "auto",
1571 [STAC_92HD73XX_NO_JD
] = "no-jd",
1572 [STAC_92HD73XX_REF
] = "ref",
1573 [STAC_92HD73XX_INTEL
] = "intel",
1574 [STAC_DELL_M6_AMIC
] = "dell-m6-amic",
1575 [STAC_DELL_M6_DMIC
] = "dell-m6-dmic",
1576 [STAC_DELL_M6_BOTH
] = "dell-m6",
1577 [STAC_DELL_EQ
] = "dell-eq",
1578 [STAC_ALIENWARE_M17X
] = "alienware",
1581 static struct snd_pci_quirk stac92hd73xx_cfg_tbl
[] = {
1582 /* SigmaTel reference board */
1583 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1584 "DFI LanParty", STAC_92HD73XX_REF
),
1585 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1586 "DFI LanParty", STAC_92HD73XX_REF
),
1587 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5002,
1588 "Intel DG45ID", STAC_92HD73XX_INTEL
),
1589 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5003,
1590 "Intel DG45FC", STAC_92HD73XX_INTEL
),
1591 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
1592 "Dell Studio 1535", STAC_DELL_M6_DMIC
),
1593 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
1594 "unknown Dell", STAC_DELL_M6_DMIC
),
1595 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
1596 "unknown Dell", STAC_DELL_M6_BOTH
),
1597 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
1598 "unknown Dell", STAC_DELL_M6_BOTH
),
1599 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
1600 "unknown Dell", STAC_DELL_M6_AMIC
),
1601 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
1602 "unknown Dell", STAC_DELL_M6_AMIC
),
1603 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
1604 "unknown Dell", STAC_DELL_M6_DMIC
),
1605 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0272,
1606 "unknown Dell", STAC_DELL_M6_DMIC
),
1607 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x029f,
1608 "Dell Studio 1537", STAC_DELL_M6_DMIC
),
1609 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a0,
1610 "Dell Studio 17", STAC_DELL_M6_DMIC
),
1611 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02be,
1612 "Dell Studio 1555", STAC_DELL_M6_DMIC
),
1613 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02bd,
1614 "Dell Studio 1557", STAC_DELL_M6_DMIC
),
1615 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02fe,
1616 "Dell Studio XPS 1645", STAC_DELL_M6_BOTH
),
1617 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0413,
1618 "Dell Studio 1558", STAC_DELL_M6_BOTH
),
1622 static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl
[] = {
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a1,
1624 "Alienware M17x", STAC_ALIENWARE_M17X
),
1628 static unsigned int ref92hd83xxx_pin_configs
[10] = {
1629 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1630 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1631 0x01451160, 0x98560170,
1634 static unsigned int dell_s14_pin_configs
[10] = {
1635 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1636 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1637 0x40f000f0, 0x40f000f0,
1640 static unsigned int hp_dv7_4000_pin_configs
[10] = {
1641 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1642 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1643 0x40f000f0, 0x40f000f0,
1646 static unsigned int *stac92hd83xxx_brd_tbl
[STAC_92HD83XXX_MODELS
] = {
1647 [STAC_92HD83XXX_REF
] = ref92hd83xxx_pin_configs
,
1648 [STAC_92HD83XXX_PWR_REF
] = ref92hd83xxx_pin_configs
,
1649 [STAC_DELL_S14
] = dell_s14_pin_configs
,
1650 [STAC_HP_DV7_4000
] = hp_dv7_4000_pin_configs
,
1653 static const char *stac92hd83xxx_models
[STAC_92HD83XXX_MODELS
] = {
1654 [STAC_92HD83XXX_AUTO
] = "auto",
1655 [STAC_92HD83XXX_REF
] = "ref",
1656 [STAC_92HD83XXX_PWR_REF
] = "mic-ref",
1657 [STAC_DELL_S14
] = "dell-s14",
1658 [STAC_92HD83XXX_HP
] = "hp",
1659 [STAC_HP_DV7_4000
] = "hp-dv7-4000",
1662 static struct snd_pci_quirk stac92hd83xxx_cfg_tbl
[] = {
1663 /* SigmaTel reference board */
1664 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1665 "DFI LanParty", STAC_92HD83XXX_REF
),
1666 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1667 "DFI LanParty", STAC_92HD83XXX_REF
),
1668 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ba,
1669 "unknown Dell", STAC_DELL_S14
),
1670 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xff00, 0x3600,
1671 "HP", STAC_92HD83XXX_HP
),
1675 static unsigned int ref92hd71bxx_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
1676 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1677 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1678 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1682 static unsigned int dell_m4_1_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
1683 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1684 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1685 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1689 static unsigned int dell_m4_2_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
1690 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1691 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1692 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1696 static unsigned int dell_m4_3_pin_configs
[STAC92HD71BXX_NUM_PINS
] = {
1697 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1698 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1699 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1703 static unsigned int *stac92hd71bxx_brd_tbl
[STAC_92HD71BXX_MODELS
] = {
1704 [STAC_92HD71BXX_REF
] = ref92hd71bxx_pin_configs
,
1705 [STAC_DELL_M4_1
] = dell_m4_1_pin_configs
,
1706 [STAC_DELL_M4_2
] = dell_m4_2_pin_configs
,
1707 [STAC_DELL_M4_3
] = dell_m4_3_pin_configs
,
1708 [STAC_HP_M4
] = NULL
,
1709 [STAC_HP_DV4
] = NULL
,
1710 [STAC_HP_DV5
] = NULL
,
1711 [STAC_HP_HDX
] = NULL
,
1712 [STAC_HP_DV4_1222NR
] = NULL
,
1715 static const char *stac92hd71bxx_models
[STAC_92HD71BXX_MODELS
] = {
1716 [STAC_92HD71BXX_AUTO
] = "auto",
1717 [STAC_92HD71BXX_REF
] = "ref",
1718 [STAC_DELL_M4_1
] = "dell-m4-1",
1719 [STAC_DELL_M4_2
] = "dell-m4-2",
1720 [STAC_DELL_M4_3
] = "dell-m4-3",
1721 [STAC_HP_M4
] = "hp-m4",
1722 [STAC_HP_DV4
] = "hp-dv4",
1723 [STAC_HP_DV5
] = "hp-dv5",
1724 [STAC_HP_HDX
] = "hp-hdx",
1725 [STAC_HP_DV4_1222NR
] = "hp-dv4-1222nr",
1728 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl
[] = {
1729 /* SigmaTel reference board */
1730 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1731 "DFI LanParty", STAC_92HD71BXX_REF
),
1732 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1733 "DFI LanParty", STAC_92HD71BXX_REF
),
1734 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x30fb,
1735 "HP dv4-1222nr", STAC_HP_DV4_1222NR
),
1736 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x1720,
1738 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3080,
1740 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x30f0,
1741 "HP dv4-7", STAC_HP_DV4
),
1742 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3600,
1743 "HP dv4-7", STAC_HP_DV5
),
1744 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3610,
1745 "HP HDX", STAC_HP_HDX
), /* HDX18 */
1746 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361a,
1747 "HP mini 1000", STAC_HP_M4
),
1748 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361b,
1749 "HP HDX", STAC_HP_HDX
), /* HDX16 */
1750 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3620,
1751 "HP dv6", STAC_HP_DV5
),
1752 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3061,
1753 "HP dv6", STAC_HP_DV5
), /* HP dv6-1110ax */
1754 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x363e,
1755 "HP DV6", STAC_HP_DV5
),
1756 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x7010,
1758 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
1759 "unknown Dell", STAC_DELL_M4_1
),
1760 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
1761 "unknown Dell", STAC_DELL_M4_1
),
1762 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
1763 "unknown Dell", STAC_DELL_M4_1
),
1764 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
1765 "unknown Dell", STAC_DELL_M4_1
),
1766 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
1767 "unknown Dell", STAC_DELL_M4_1
),
1768 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
1769 "unknown Dell", STAC_DELL_M4_1
),
1770 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
1771 "unknown Dell", STAC_DELL_M4_1
),
1772 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
1773 "unknown Dell", STAC_DELL_M4_2
),
1774 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
1775 "unknown Dell", STAC_DELL_M4_2
),
1776 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
1777 "unknown Dell", STAC_DELL_M4_2
),
1778 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
1779 "unknown Dell", STAC_DELL_M4_2
),
1780 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02aa,
1781 "unknown Dell", STAC_DELL_M4_3
),
1785 static unsigned int ref922x_pin_configs
[10] = {
1786 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1787 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1788 0x40000100, 0x40000100,
1792 STAC 922X pin configs for
1799 static unsigned int dell_922x_d81_pin_configs
[10] = {
1800 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1801 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1802 0x01813122, 0x400001f2,
1806 STAC 922X pin configs for
1810 static unsigned int dell_922x_d82_pin_configs
[10] = {
1811 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1812 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1813 0x01813122, 0x400001f1,
1817 STAC 922X pin configs for
1820 static unsigned int dell_922x_m81_pin_configs
[10] = {
1821 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1822 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1823 0x40C003f1, 0x405003f0,
1827 STAC 9221 A1 pin configs for
1828 102801D7 (Dell XPS M1210)
1830 static unsigned int dell_922x_m82_pin_configs
[10] = {
1831 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1832 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1833 0x508003f3, 0x405003f4,
1836 static unsigned int d945gtp3_pin_configs
[10] = {
1837 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1838 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1839 0x02a19120, 0x40000100,
1842 static unsigned int d945gtp5_pin_configs
[10] = {
1843 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1844 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1845 0x02a19320, 0x40000100,
1848 static unsigned int intel_mac_v1_pin_configs
[10] = {
1849 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1850 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1851 0x400000fc, 0x400000fb,
1854 static unsigned int intel_mac_v2_pin_configs
[10] = {
1855 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1856 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1857 0x400000fc, 0x400000fb,
1860 static unsigned int intel_mac_v3_pin_configs
[10] = {
1861 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1862 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1863 0x400000fc, 0x400000fb,
1866 static unsigned int intel_mac_v4_pin_configs
[10] = {
1867 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1868 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1869 0x400000fc, 0x400000fb,
1872 static unsigned int intel_mac_v5_pin_configs
[10] = {
1873 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1874 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1875 0x400000fc, 0x400000fb,
1878 static unsigned int ecs202_pin_configs
[10] = {
1879 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1880 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1881 0x9037012e, 0x40e000f2,
1884 static unsigned int *stac922x_brd_tbl
[STAC_922X_MODELS
] = {
1885 [STAC_D945_REF
] = ref922x_pin_configs
,
1886 [STAC_D945GTP3
] = d945gtp3_pin_configs
,
1887 [STAC_D945GTP5
] = d945gtp5_pin_configs
,
1888 [STAC_INTEL_MAC_V1
] = intel_mac_v1_pin_configs
,
1889 [STAC_INTEL_MAC_V2
] = intel_mac_v2_pin_configs
,
1890 [STAC_INTEL_MAC_V3
] = intel_mac_v3_pin_configs
,
1891 [STAC_INTEL_MAC_V4
] = intel_mac_v4_pin_configs
,
1892 [STAC_INTEL_MAC_V5
] = intel_mac_v5_pin_configs
,
1893 [STAC_INTEL_MAC_AUTO
] = intel_mac_v3_pin_configs
,
1894 /* for backward compatibility */
1895 [STAC_MACMINI
] = intel_mac_v3_pin_configs
,
1896 [STAC_MACBOOK
] = intel_mac_v5_pin_configs
,
1897 [STAC_MACBOOK_PRO_V1
] = intel_mac_v3_pin_configs
,
1898 [STAC_MACBOOK_PRO_V2
] = intel_mac_v3_pin_configs
,
1899 [STAC_IMAC_INTEL
] = intel_mac_v2_pin_configs
,
1900 [STAC_IMAC_INTEL_20
] = intel_mac_v3_pin_configs
,
1901 [STAC_ECS_202
] = ecs202_pin_configs
,
1902 [STAC_922X_DELL_D81
] = dell_922x_d81_pin_configs
,
1903 [STAC_922X_DELL_D82
] = dell_922x_d82_pin_configs
,
1904 [STAC_922X_DELL_M81
] = dell_922x_m81_pin_configs
,
1905 [STAC_922X_DELL_M82
] = dell_922x_m82_pin_configs
,
1908 static const char *stac922x_models
[STAC_922X_MODELS
] = {
1909 [STAC_922X_AUTO
] = "auto",
1910 [STAC_D945_REF
] = "ref",
1911 [STAC_D945GTP5
] = "5stack",
1912 [STAC_D945GTP3
] = "3stack",
1913 [STAC_INTEL_MAC_V1
] = "intel-mac-v1",
1914 [STAC_INTEL_MAC_V2
] = "intel-mac-v2",
1915 [STAC_INTEL_MAC_V3
] = "intel-mac-v3",
1916 [STAC_INTEL_MAC_V4
] = "intel-mac-v4",
1917 [STAC_INTEL_MAC_V5
] = "intel-mac-v5",
1918 [STAC_INTEL_MAC_AUTO
] = "intel-mac-auto",
1919 /* for backward compatibility */
1920 [STAC_MACMINI
] = "macmini",
1921 [STAC_MACBOOK
] = "macbook",
1922 [STAC_MACBOOK_PRO_V1
] = "macbook-pro-v1",
1923 [STAC_MACBOOK_PRO_V2
] = "macbook-pro",
1924 [STAC_IMAC_INTEL
] = "imac-intel",
1925 [STAC_IMAC_INTEL_20
] = "imac-intel-20",
1926 [STAC_ECS_202
] = "ecs202",
1927 [STAC_922X_DELL_D81
] = "dell-d81",
1928 [STAC_922X_DELL_D82
] = "dell-d82",
1929 [STAC_922X_DELL_M81
] = "dell-m81",
1930 [STAC_922X_DELL_M82
] = "dell-m82",
1933 static struct snd_pci_quirk stac922x_cfg_tbl
[] = {
1934 /* SigmaTel reference board */
1935 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1936 "DFI LanParty", STAC_D945_REF
),
1937 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1938 "DFI LanParty", STAC_D945_REF
),
1939 /* Intel 945G based systems */
1940 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
1941 "Intel D945G", STAC_D945GTP3
),
1942 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
1943 "Intel D945G", STAC_D945GTP3
),
1944 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
1945 "Intel D945G", STAC_D945GTP3
),
1946 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
1947 "Intel D945G", STAC_D945GTP3
),
1948 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
1949 "Intel D945G", STAC_D945GTP3
),
1950 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
1951 "Intel D945G", STAC_D945GTP3
),
1952 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
1953 "Intel D945G", STAC_D945GTP3
),
1954 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
1955 "Intel D945G", STAC_D945GTP3
),
1956 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
1957 "Intel D945G", STAC_D945GTP3
),
1958 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
1959 "Intel D945G", STAC_D945GTP3
),
1960 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
1961 "Intel D945G", STAC_D945GTP3
),
1962 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
1963 "Intel D945G", STAC_D945GTP3
),
1964 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
1965 "Intel D945G", STAC_D945GTP3
),
1966 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
1967 "Intel D945G", STAC_D945GTP3
),
1968 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
1969 "Intel D945G", STAC_D945GTP3
),
1970 /* Intel D945G 5-stack systems */
1971 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
1972 "Intel D945G", STAC_D945GTP5
),
1973 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
1974 "Intel D945G", STAC_D945GTP5
),
1975 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
1976 "Intel D945G", STAC_D945GTP5
),
1977 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
1978 "Intel D945G", STAC_D945GTP5
),
1979 /* Intel 945P based systems */
1980 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
1981 "Intel D945P", STAC_D945GTP3
),
1982 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
1983 "Intel D945P", STAC_D945GTP3
),
1984 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
1985 "Intel D945P", STAC_D945GTP3
),
1986 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
1987 "Intel D945P", STAC_D945GTP3
),
1988 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
1989 "Intel D945P", STAC_D945GTP3
),
1990 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
1991 "Intel D945P", STAC_D945GTP5
),
1993 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0204,
1994 "Intel D945", STAC_D945_REF
),
1996 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
1997 SND_PCI_QUIRK(0x8384, 0x7680,
1998 "Mac", STAC_INTEL_MAC_AUTO
),
2000 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
2001 "unknown Dell", STAC_922X_DELL_D81
),
2002 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
2003 "unknown Dell", STAC_922X_DELL_D81
),
2004 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
2005 "unknown Dell", STAC_922X_DELL_D81
),
2006 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
2007 "unknown Dell", STAC_922X_DELL_D82
),
2008 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
2009 "unknown Dell", STAC_922X_DELL_M81
),
2010 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
2011 "unknown Dell", STAC_922X_DELL_D82
),
2012 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
2013 "unknown Dell", STAC_922X_DELL_D81
),
2014 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
2015 "unknown Dell", STAC_922X_DELL_D81
),
2016 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
2017 "Dell XPS M1210", STAC_922X_DELL_M82
),
2018 /* ECS/PC Chips boards */
2019 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
2020 "ECS/PC chips", STAC_ECS_202
),
2024 static unsigned int ref927x_pin_configs
[14] = {
2025 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2026 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2027 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2028 0x01c42190, 0x40000100,
2031 static unsigned int d965_3st_pin_configs
[14] = {
2032 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2033 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2034 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2035 0x40000100, 0x40000100
2038 static unsigned int d965_5st_pin_configs
[14] = {
2039 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2040 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2041 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2042 0x40000100, 0x40000100
2045 static unsigned int d965_5st_no_fp_pin_configs
[14] = {
2046 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2047 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2048 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2049 0x40000100, 0x40000100
2052 static unsigned int dell_3st_pin_configs
[14] = {
2053 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2054 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2055 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2056 0x40c003fc, 0x40000100
2059 static unsigned int *stac927x_brd_tbl
[STAC_927X_MODELS
] = {
2060 [STAC_D965_REF_NO_JD
] = ref927x_pin_configs
,
2061 [STAC_D965_REF
] = ref927x_pin_configs
,
2062 [STAC_D965_3ST
] = d965_3st_pin_configs
,
2063 [STAC_D965_5ST
] = d965_5st_pin_configs
,
2064 [STAC_D965_5ST_NO_FP
] = d965_5st_no_fp_pin_configs
,
2065 [STAC_DELL_3ST
] = dell_3st_pin_configs
,
2066 [STAC_DELL_BIOS
] = NULL
,
2067 [STAC_927X_VOLKNOB
] = NULL
,
2070 static const char *stac927x_models
[STAC_927X_MODELS
] = {
2071 [STAC_927X_AUTO
] = "auto",
2072 [STAC_D965_REF_NO_JD
] = "ref-no-jd",
2073 [STAC_D965_REF
] = "ref",
2074 [STAC_D965_3ST
] = "3stack",
2075 [STAC_D965_5ST
] = "5stack",
2076 [STAC_D965_5ST_NO_FP
] = "5stack-no-fp",
2077 [STAC_DELL_3ST
] = "dell-3stack",
2078 [STAC_DELL_BIOS
] = "dell-bios",
2079 [STAC_927X_VOLKNOB
] = "volknob",
2082 static struct snd_pci_quirk stac927x_cfg_tbl
[] = {
2083 /* SigmaTel reference board */
2084 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2085 "DFI LanParty", STAC_D965_REF
),
2086 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2087 "DFI LanParty", STAC_D965_REF
),
2088 /* Intel 946 based systems */
2089 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
2090 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
2091 /* 965 based 3 stack systems */
2092 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2100,
2093 "Intel D965", STAC_D965_3ST
),
2094 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2000,
2095 "Intel D965", STAC_D965_3ST
),
2096 /* Dell 3 stack systems */
2097 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
2098 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
2099 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
2100 /* Dell 3 stack systems with verb table in BIOS */
2101 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
2102 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS
),
2103 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
2104 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS
),
2105 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS
),
2106 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
2107 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
2108 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
2109 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS
),
2110 /* 965 based 5 stack systems */
2111 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2300,
2112 "Intel D965", STAC_D965_5ST
),
2113 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2500,
2114 "Intel D965", STAC_D965_5ST
),
2115 /* volume-knob fixes */
2116 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB
),
2120 static unsigned int ref9205_pin_configs
[12] = {
2121 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2122 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2123 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
2127 STAC 9205 pin configs for
2134 10280228 (Dell Vostro 1500)
2135 10280229 (Dell Vostro 1700)
2137 static unsigned int dell_9205_m42_pin_configs
[12] = {
2138 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2139 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2140 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
2144 STAC 9205 pin configs for
2148 102801FF (Dell Precision M4300)
2153 static unsigned int dell_9205_m43_pin_configs
[12] = {
2154 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2155 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2156 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2159 static unsigned int dell_9205_m44_pin_configs
[12] = {
2160 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2161 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2162 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2165 static unsigned int *stac9205_brd_tbl
[STAC_9205_MODELS
] = {
2166 [STAC_9205_REF
] = ref9205_pin_configs
,
2167 [STAC_9205_DELL_M42
] = dell_9205_m42_pin_configs
,
2168 [STAC_9205_DELL_M43
] = dell_9205_m43_pin_configs
,
2169 [STAC_9205_DELL_M44
] = dell_9205_m44_pin_configs
,
2170 [STAC_9205_EAPD
] = NULL
,
2173 static const char *stac9205_models
[STAC_9205_MODELS
] = {
2174 [STAC_9205_AUTO
] = "auto",
2175 [STAC_9205_REF
] = "ref",
2176 [STAC_9205_DELL_M42
] = "dell-m42",
2177 [STAC_9205_DELL_M43
] = "dell-m43",
2178 [STAC_9205_DELL_M44
] = "dell-m44",
2179 [STAC_9205_EAPD
] = "eapd",
2182 static struct snd_pci_quirk stac9205_cfg_tbl
[] = {
2183 /* SigmaTel reference board */
2184 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2185 "DFI LanParty", STAC_9205_REF
),
2186 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xfb30,
2187 "SigmaTel", STAC_9205_REF
),
2188 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2189 "DFI LanParty", STAC_9205_REF
),
2191 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
2192 "unknown Dell", STAC_9205_DELL_M42
),
2193 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
2194 "unknown Dell", STAC_9205_DELL_M42
),
2195 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
2196 "Dell Precision", STAC_9205_DELL_M43
),
2197 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
2198 "Dell Precision", STAC_9205_DELL_M43
),
2199 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
2200 "Dell Precision", STAC_9205_DELL_M43
),
2201 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
2202 "unknown Dell", STAC_9205_DELL_M42
),
2203 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
2204 "unknown Dell", STAC_9205_DELL_M42
),
2205 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
2206 "Dell Precision", STAC_9205_DELL_M43
),
2207 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
2208 "Dell Precision M4300", STAC_9205_DELL_M43
),
2209 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
2210 "unknown Dell", STAC_9205_DELL_M42
),
2211 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
2212 "Dell Precision", STAC_9205_DELL_M43
),
2213 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
2214 "Dell Precision", STAC_9205_DELL_M43
),
2215 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
2216 "Dell Precision", STAC_9205_DELL_M43
),
2217 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
2218 "Dell Inspiron", STAC_9205_DELL_M44
),
2219 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
2220 "Dell Vostro 1500", STAC_9205_DELL_M42
),
2221 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0229,
2222 "Dell Vostro 1700", STAC_9205_DELL_M42
),
2224 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD
),
2225 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD
),
2229 static void stac92xx_set_config_regs(struct hda_codec
*codec
,
2230 unsigned int *pincfgs
)
2233 struct sigmatel_spec
*spec
= codec
->spec
;
2238 for (i
= 0; i
< spec
->num_pins
; i
++)
2239 if (spec
->pin_nids
[i
] && pincfgs
[i
])
2240 snd_hda_codec_set_pincfg(codec
, spec
->pin_nids
[i
],
2245 * Analog playback callbacks
2247 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2248 struct hda_codec
*codec
,
2249 struct snd_pcm_substream
*substream
)
2251 struct sigmatel_spec
*spec
= codec
->spec
;
2252 if (spec
->stream_delay
)
2253 msleep(spec
->stream_delay
);
2254 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2258 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2259 struct hda_codec
*codec
,
2260 unsigned int stream_tag
,
2261 unsigned int format
,
2262 struct snd_pcm_substream
*substream
)
2264 struct sigmatel_spec
*spec
= codec
->spec
;
2265 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
2268 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2269 struct hda_codec
*codec
,
2270 struct snd_pcm_substream
*substream
)
2272 struct sigmatel_spec
*spec
= codec
->spec
;
2273 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2277 * Digital playback callbacks
2279 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2280 struct hda_codec
*codec
,
2281 struct snd_pcm_substream
*substream
)
2283 struct sigmatel_spec
*spec
= codec
->spec
;
2284 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2287 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2288 struct hda_codec
*codec
,
2289 struct snd_pcm_substream
*substream
)
2291 struct sigmatel_spec
*spec
= codec
->spec
;
2292 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2295 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2296 struct hda_codec
*codec
,
2297 unsigned int stream_tag
,
2298 unsigned int format
,
2299 struct snd_pcm_substream
*substream
)
2301 struct sigmatel_spec
*spec
= codec
->spec
;
2302 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2303 stream_tag
, format
, substream
);
2306 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2307 struct hda_codec
*codec
,
2308 struct snd_pcm_substream
*substream
)
2310 struct sigmatel_spec
*spec
= codec
->spec
;
2311 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
2316 * Analog capture callbacks
2318 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2319 struct hda_codec
*codec
,
2320 unsigned int stream_tag
,
2321 unsigned int format
,
2322 struct snd_pcm_substream
*substream
)
2324 struct sigmatel_spec
*spec
= codec
->spec
;
2325 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2327 if (spec
->powerdown_adcs
) {
2329 snd_hda_codec_write(codec
, nid
, 0,
2330 AC_VERB_SET_POWER_STATE
, AC_PWRST_D0
);
2332 snd_hda_codec_setup_stream(codec
, nid
, stream_tag
, 0, format
);
2336 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2337 struct hda_codec
*codec
,
2338 struct snd_pcm_substream
*substream
)
2340 struct sigmatel_spec
*spec
= codec
->spec
;
2341 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
2343 snd_hda_codec_cleanup_stream(codec
, nid
);
2344 if (spec
->powerdown_adcs
)
2345 snd_hda_codec_write(codec
, nid
, 0,
2346 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
2350 static struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
2354 /* NID is set in stac92xx_build_pcms */
2356 .open
= stac92xx_dig_playback_pcm_open
,
2357 .close
= stac92xx_dig_playback_pcm_close
,
2358 .prepare
= stac92xx_dig_playback_pcm_prepare
,
2359 .cleanup
= stac92xx_dig_playback_pcm_cleanup
2363 static struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
2367 /* NID is set in stac92xx_build_pcms */
2370 static struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
2374 .nid
= 0x02, /* NID to query formats and rates */
2376 .open
= stac92xx_playback_pcm_open
,
2377 .prepare
= stac92xx_playback_pcm_prepare
,
2378 .cleanup
= stac92xx_playback_pcm_cleanup
2382 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
2386 .nid
= 0x06, /* NID to query formats and rates */
2388 .open
= stac92xx_playback_pcm_open
,
2389 .prepare
= stac92xx_playback_pcm_prepare
,
2390 .cleanup
= stac92xx_playback_pcm_cleanup
2394 static struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
2397 /* NID + .substreams is set in stac92xx_build_pcms */
2399 .prepare
= stac92xx_capture_pcm_prepare
,
2400 .cleanup
= stac92xx_capture_pcm_cleanup
2404 static int stac92xx_build_pcms(struct hda_codec
*codec
)
2406 struct sigmatel_spec
*spec
= codec
->spec
;
2407 struct hda_pcm
*info
= spec
->pcm_rec
;
2409 codec
->num_pcms
= 1;
2410 codec
->pcm_info
= info
;
2412 info
->name
= "STAC92xx Analog";
2413 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
2414 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2415 spec
->multiout
.dac_nids
[0];
2416 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
2417 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2418 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
2420 if (spec
->alt_switch
) {
2423 info
->name
= "STAC92xx Analog Alt";
2424 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
2427 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2430 info
->name
= "STAC92xx Digital";
2431 info
->pcm_type
= spec
->autocfg
.dig_out_type
[0];
2432 if (spec
->multiout
.dig_out_nid
) {
2433 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
2434 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2436 if (spec
->dig_in_nid
) {
2437 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
2438 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2445 static unsigned int stac92xx_get_default_vref(struct hda_codec
*codec
,
2448 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
2449 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
2450 if (pincap
& AC_PINCAP_VREF_100
)
2451 return AC_PINCTL_VREF_100
;
2452 if (pincap
& AC_PINCAP_VREF_80
)
2453 return AC_PINCTL_VREF_80
;
2454 if (pincap
& AC_PINCAP_VREF_50
)
2455 return AC_PINCTL_VREF_50
;
2456 if (pincap
& AC_PINCAP_VREF_GRD
)
2457 return AC_PINCTL_VREF_GRD
;
2461 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
2464 snd_hda_codec_write_cache(codec
, nid
, 0,
2465 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2468 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
2470 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
2471 struct snd_ctl_elem_value
*ucontrol
)
2473 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2474 struct sigmatel_spec
*spec
= codec
->spec
;
2476 ucontrol
->value
.integer
.value
[0] = !!spec
->hp_switch
;
2480 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
);
2482 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
2483 struct snd_ctl_elem_value
*ucontrol
)
2485 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2486 struct sigmatel_spec
*spec
= codec
->spec
;
2487 int nid
= kcontrol
->private_value
;
2489 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0] ? nid
: 0;
2491 /* check to be sure that the ports are upto date with
2494 stac_issue_unsol_event(codec
, nid
);
2499 static int stac92xx_dc_bias_info(struct snd_kcontrol
*kcontrol
,
2500 struct snd_ctl_elem_info
*uinfo
)
2503 static char *texts
[] = {
2504 "Mic In", "Line In", "Line Out"
2507 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2508 struct sigmatel_spec
*spec
= codec
->spec
;
2509 hda_nid_t nid
= kcontrol
->private_value
;
2511 if (nid
== spec
->mic_switch
|| nid
== spec
->line_switch
)
2516 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2517 uinfo
->value
.enumerated
.items
= i
;
2519 if (uinfo
->value
.enumerated
.item
>= i
)
2520 uinfo
->value
.enumerated
.item
= i
-1;
2521 strcpy(uinfo
->value
.enumerated
.name
,
2522 texts
[uinfo
->value
.enumerated
.item
]);
2527 static int stac92xx_dc_bias_get(struct snd_kcontrol
*kcontrol
,
2528 struct snd_ctl_elem_value
*ucontrol
)
2530 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2531 hda_nid_t nid
= kcontrol
->private_value
;
2532 unsigned int vref
= stac92xx_vref_get(codec
, nid
);
2534 if (vref
== stac92xx_get_default_vref(codec
, nid
))
2535 ucontrol
->value
.enumerated
.item
[0] = 0;
2536 else if (vref
== AC_PINCTL_VREF_GRD
)
2537 ucontrol
->value
.enumerated
.item
[0] = 1;
2538 else if (vref
== AC_PINCTL_VREF_HIZ
)
2539 ucontrol
->value
.enumerated
.item
[0] = 2;
2544 static int stac92xx_dc_bias_put(struct snd_kcontrol
*kcontrol
,
2545 struct snd_ctl_elem_value
*ucontrol
)
2547 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2548 unsigned int new_vref
= 0;
2550 hda_nid_t nid
= kcontrol
->private_value
;
2552 if (ucontrol
->value
.enumerated
.item
[0] == 0)
2553 new_vref
= stac92xx_get_default_vref(codec
, nid
);
2554 else if (ucontrol
->value
.enumerated
.item
[0] == 1)
2555 new_vref
= AC_PINCTL_VREF_GRD
;
2556 else if (ucontrol
->value
.enumerated
.item
[0] == 2)
2557 new_vref
= AC_PINCTL_VREF_HIZ
;
2561 if (new_vref
!= stac92xx_vref_get(codec
, nid
)) {
2562 error
= stac92xx_vref_set(codec
, nid
, new_vref
);
2569 static int stac92xx_io_switch_info(struct snd_kcontrol
*kcontrol
,
2570 struct snd_ctl_elem_info
*uinfo
)
2572 static char *texts
[2];
2573 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2574 struct sigmatel_spec
*spec
= codec
->spec
;
2576 if (kcontrol
->private_value
== spec
->line_switch
)
2577 texts
[0] = "Line In";
2579 texts
[0] = "Mic In";
2580 texts
[1] = "Line Out";
2581 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2582 uinfo
->value
.enumerated
.items
= 2;
2585 if (uinfo
->value
.enumerated
.item
>= 2)
2586 uinfo
->value
.enumerated
.item
= 1;
2587 strcpy(uinfo
->value
.enumerated
.name
,
2588 texts
[uinfo
->value
.enumerated
.item
]);
2593 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2595 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2596 struct sigmatel_spec
*spec
= codec
->spec
;
2597 hda_nid_t nid
= kcontrol
->private_value
;
2598 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
2600 ucontrol
->value
.enumerated
.item
[0] = spec
->io_switch
[io_idx
];
2604 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
2606 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2607 struct sigmatel_spec
*spec
= codec
->spec
;
2608 hda_nid_t nid
= kcontrol
->private_value
;
2609 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
2610 unsigned short val
= !!ucontrol
->value
.enumerated
.item
[0];
2612 spec
->io_switch
[io_idx
] = val
;
2615 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
2617 unsigned int pinctl
= AC_PINCTL_IN_EN
;
2618 if (io_idx
) /* set VREF for mic */
2619 pinctl
|= stac92xx_get_default_vref(codec
, nid
);
2620 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
2623 /* check the auto-mute again: we need to mute/unmute the speaker
2624 * appropriately according to the pin direction
2626 if (spec
->hp_detect
)
2627 stac_issue_unsol_event(codec
, nid
);
2632 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
2634 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
2635 struct snd_ctl_elem_value
*ucontrol
)
2637 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2638 struct sigmatel_spec
*spec
= codec
->spec
;
2640 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
2644 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
2645 struct snd_ctl_elem_value
*ucontrol
)
2647 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2648 struct sigmatel_spec
*spec
= codec
->spec
;
2649 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
2650 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
2652 if (spec
->clfe_swap
== val
)
2655 spec
->clfe_swap
= val
;
2657 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
2658 spec
->clfe_swap
? 0x4 : 0x0);
2663 #define STAC_CODEC_HP_SWITCH(xname) \
2664 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2667 .info = stac92xx_hp_switch_info, \
2668 .get = stac92xx_hp_switch_get, \
2669 .put = stac92xx_hp_switch_put, \
2672 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
2673 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2676 .info = stac92xx_io_switch_info, \
2677 .get = stac92xx_io_switch_get, \
2678 .put = stac92xx_io_switch_put, \
2679 .private_value = xpval, \
2682 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
2683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2686 .info = stac92xx_clfe_switch_info, \
2687 .get = stac92xx_clfe_switch_get, \
2688 .put = stac92xx_clfe_switch_put, \
2689 .private_value = xpval, \
2693 STAC_CTL_WIDGET_VOL
,
2694 STAC_CTL_WIDGET_MUTE
,
2695 STAC_CTL_WIDGET_MUTE_BEEP
,
2696 STAC_CTL_WIDGET_MONO_MUX
,
2697 STAC_CTL_WIDGET_HP_SWITCH
,
2698 STAC_CTL_WIDGET_IO_SWITCH
,
2699 STAC_CTL_WIDGET_CLFE_SWITCH
,
2700 STAC_CTL_WIDGET_DC_BIAS
2703 static struct snd_kcontrol_new stac92xx_control_templates
[] = {
2704 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2705 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2706 HDA_CODEC_MUTE_BEEP(NULL
, 0, 0, 0),
2708 STAC_CODEC_HP_SWITCH(NULL
),
2709 STAC_CODEC_IO_SWITCH(NULL
, 0),
2710 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
2711 DC_BIAS(NULL
, 0, 0),
2714 /* add dynamic controls */
2715 static struct snd_kcontrol_new
*
2716 stac_control_new(struct sigmatel_spec
*spec
,
2717 struct snd_kcontrol_new
*ktemp
,
2719 unsigned int subdev
)
2721 struct snd_kcontrol_new
*knew
;
2723 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
2724 knew
= snd_array_new(&spec
->kctls
);
2728 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2731 memset(knew
, 0, sizeof(*knew
));
2732 spec
->kctls
.alloced
--;
2735 knew
->subdevice
= subdev
;
2739 static int stac92xx_add_control_temp(struct sigmatel_spec
*spec
,
2740 struct snd_kcontrol_new
*ktemp
,
2741 int idx
, const char *name
,
2744 struct snd_kcontrol_new
*knew
= stac_control_new(spec
, ktemp
, name
,
2745 HDA_SUBDEV_AMP_FLAG
);
2749 knew
->private_value
= val
;
2753 static inline int stac92xx_add_control_idx(struct sigmatel_spec
*spec
,
2754 int type
, int idx
, const char *name
,
2757 return stac92xx_add_control_temp(spec
,
2758 &stac92xx_control_templates
[type
],
2763 /* add dynamic controls */
2764 static inline int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
,
2765 const char *name
, unsigned long val
)
2767 return stac92xx_add_control_idx(spec
, type
, 0, name
, val
);
2770 static struct snd_kcontrol_new stac_input_src_temp
= {
2771 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2772 .name
= "Input Source",
2773 .info
= stac92xx_mux_enum_info
,
2774 .get
= stac92xx_mux_enum_get
,
2775 .put
= stac92xx_mux_enum_put
,
2778 static inline int stac92xx_add_jack_mode_control(struct hda_codec
*codec
,
2779 hda_nid_t nid
, int idx
)
2781 int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
2783 struct sigmatel_spec
*spec
= codec
->spec
;
2786 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
2787 if (stac92xx_get_default_vref(codec
, nid
) == AC_PINCTL_VREF_GRD
2788 && nid
== spec
->line_switch
)
2789 control
= STAC_CTL_WIDGET_IO_SWITCH
;
2790 else if (snd_hda_query_pin_caps(codec
, nid
)
2791 & (AC_PINCAP_VREF_GRD
<< AC_PINCAP_VREF_SHIFT
))
2792 control
= STAC_CTL_WIDGET_DC_BIAS
;
2793 else if (nid
== spec
->mic_switch
)
2794 control
= STAC_CTL_WIDGET_IO_SWITCH
;
2798 strcpy(name
, hda_get_input_pin_label(codec
, nid
, 1));
2799 return stac92xx_add_control(codec
->spec
, control
,
2800 strcat(name
, " Jack Mode"), nid
);
2806 static int stac92xx_add_input_source(struct sigmatel_spec
*spec
)
2808 struct snd_kcontrol_new
*knew
;
2809 struct hda_input_mux
*imux
= &spec
->private_imux
;
2812 return 0; /* no need for input source */
2813 if (!spec
->num_adcs
|| imux
->num_items
<= 1)
2814 return 0; /* no need for input source control */
2815 knew
= stac_control_new(spec
, &stac_input_src_temp
,
2816 stac_input_src_temp
.name
, 0);
2819 knew
->count
= spec
->num_adcs
;
2823 /* check whether the line-input can be used as line-out */
2824 static hda_nid_t
check_line_out_switch(struct hda_codec
*codec
)
2826 struct sigmatel_spec
*spec
= codec
->spec
;
2827 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
2829 unsigned int pincap
;
2832 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
2834 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
2835 if (cfg
->inputs
[i
].type
== AUTO_PIN_LINE_IN
) {
2836 nid
= cfg
->inputs
[i
].pin
;
2837 pincap
= snd_hda_query_pin_caps(codec
, nid
);
2838 if (pincap
& AC_PINCAP_OUT
)
2845 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
);
2847 /* check whether the mic-input can be used as line-out */
2848 static hda_nid_t
check_mic_out_switch(struct hda_codec
*codec
, hda_nid_t
*dac
)
2850 struct sigmatel_spec
*spec
= codec
->spec
;
2851 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
2852 unsigned int def_conf
, pincap
;
2856 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
2858 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
2859 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
2860 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
2862 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
2863 /* some laptops have an internal analog microphone
2864 * which can't be used as a output */
2865 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
2866 pincap
= snd_hda_query_pin_caps(codec
, nid
);
2867 if (pincap
& AC_PINCAP_OUT
) {
2868 *dac
= get_unassigned_dac(codec
, nid
);
2877 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2881 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
2882 if (spec
->multiout
.dac_nids
[i
] == nid
)
2889 static int check_all_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
2892 if (is_in_dac_nids(spec
, nid
))
2894 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++)
2895 if (spec
->hp_dacs
[i
] == nid
)
2897 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++)
2898 if (spec
->speaker_dacs
[i
] == nid
)
2903 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
)
2905 struct sigmatel_spec
*spec
= codec
->spec
;
2907 hda_nid_t conn
[HDA_MAX_CONNECTIONS
];
2908 unsigned int wcaps
, wtype
;
2910 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
2911 HDA_MAX_CONNECTIONS
);
2912 /* 92HD88: trace back up the link of nids to find the DAC */
2913 while (conn_len
== 1 && (get_wcaps_type(get_wcaps(codec
, conn
[0]))
2914 != AC_WID_AUD_OUT
)) {
2916 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
2917 HDA_MAX_CONNECTIONS
);
2919 for (j
= 0; j
< conn_len
; j
++) {
2920 wcaps
= get_wcaps(codec
, conn
[j
]);
2921 wtype
= get_wcaps_type(wcaps
);
2922 /* we check only analog outputs */
2923 if (wtype
!= AC_WID_AUD_OUT
|| (wcaps
& AC_WCAP_DIGITAL
))
2925 /* if this route has a free DAC, assign it */
2926 if (!check_all_dac_nids(spec
, conn
[j
])) {
2928 /* select this DAC in the pin's input mux */
2929 snd_hda_codec_write_cache(codec
, nid
, 0,
2930 AC_VERB_SET_CONNECT_SEL
, j
);
2935 /* if all DACs are already assigned, connect to the primary DAC */
2937 for (j
= 0; j
< conn_len
; j
++) {
2938 if (conn
[j
] == spec
->multiout
.dac_nids
[0]) {
2939 snd_hda_codec_write_cache(codec
, nid
, 0,
2940 AC_VERB_SET_CONNECT_SEL
, j
);
2948 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
2949 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
2952 * Fill in the dac_nids table from the parsed pin configuration
2953 * This function only works when every pin in line_out_pins[]
2954 * contains atleast one DAC in its connection list. Some 92xx
2955 * codecs are not connected directly to a DAC, such as the 9200
2956 * and 9202/925x. For those, dac_nids[] must be hard-coded.
2958 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
)
2960 struct sigmatel_spec
*spec
= codec
->spec
;
2961 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
2965 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2966 nid
= cfg
->line_out_pins
[i
];
2967 dac
= get_unassigned_dac(codec
, nid
);
2969 if (spec
->multiout
.num_dacs
> 0) {
2970 /* we have already working output pins,
2971 * so let's drop the broken ones again
2973 cfg
->line_outs
= spec
->multiout
.num_dacs
;
2976 /* error out, no available DAC found */
2978 "%s: No available DAC for pin 0x%x\n",
2982 add_spec_dacs(spec
, dac
);
2985 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
2986 nid
= cfg
->hp_pins
[i
];
2987 dac
= get_unassigned_dac(codec
, nid
);
2989 if (!spec
->multiout
.hp_nid
)
2990 spec
->multiout
.hp_nid
= dac
;
2992 add_spec_extra_dacs(spec
, dac
);
2994 spec
->hp_dacs
[i
] = dac
;
2997 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
2998 nid
= cfg
->speaker_pins
[i
];
2999 dac
= get_unassigned_dac(codec
, nid
);
3001 add_spec_extra_dacs(spec
, dac
);
3002 spec
->speaker_dacs
[i
] = dac
;
3005 /* add line-in as output */
3006 nid
= check_line_out_switch(codec
);
3008 dac
= get_unassigned_dac(codec
, nid
);
3010 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
3011 nid
, cfg
->line_outs
);
3012 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
3014 spec
->line_switch
= nid
;
3015 add_spec_dacs(spec
, dac
);
3018 /* add mic as output */
3019 nid
= check_mic_out_switch(codec
, &dac
);
3021 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
3022 nid
, cfg
->line_outs
);
3023 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
3025 spec
->mic_switch
= nid
;
3026 add_spec_dacs(spec
, dac
);
3029 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
3030 spec
->multiout
.num_dacs
,
3031 spec
->multiout
.dac_nids
[0],
3032 spec
->multiout
.dac_nids
[1],
3033 spec
->multiout
.dac_nids
[2],
3034 spec
->multiout
.dac_nids
[3],
3035 spec
->multiout
.dac_nids
[4]);
3040 /* create volume control/switch for the given prefx type */
3041 static int create_controls_idx(struct hda_codec
*codec
, const char *pfx
,
3042 int idx
, hda_nid_t nid
, int chs
)
3044 struct sigmatel_spec
*spec
= codec
->spec
;
3048 if (!spec
->check_volume_offset
) {
3049 unsigned int caps
, step
, nums
, db_scale
;
3050 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
3051 step
= (caps
& AC_AMPCAP_STEP_SIZE
) >>
3052 AC_AMPCAP_STEP_SIZE_SHIFT
;
3053 step
= (step
+ 1) * 25; /* in .01dB unit */
3054 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >>
3055 AC_AMPCAP_NUM_STEPS_SHIFT
;
3056 db_scale
= nums
* step
;
3057 /* if dB scale is over -64dB, and finer enough,
3058 * let's reduce it to half
3060 if (db_scale
> 6400 && nums
>= 0x1f)
3061 spec
->volume_offset
= nums
/ 2;
3062 spec
->check_volume_offset
= 1;
3065 sprintf(name
, "%s Playback Volume", pfx
);
3066 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
3067 HDA_COMPOSE_AMP_VAL_OFS(nid
, chs
, 0, HDA_OUTPUT
,
3068 spec
->volume_offset
));
3071 sprintf(name
, "%s Playback Switch", pfx
);
3072 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_MUTE
, idx
, name
,
3073 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
3079 #define create_controls(codec, pfx, nid, chs) \
3080 create_controls_idx(codec, pfx, 0, nid, chs)
3082 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3084 if (spec
->multiout
.num_dacs
> 4) {
3085 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
3088 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
] = nid
;
3089 spec
->multiout
.num_dacs
++;
3094 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
3097 for (i
= 0; i
< ARRAY_SIZE(spec
->multiout
.extra_out_nid
); i
++) {
3098 if (!spec
->multiout
.extra_out_nid
[i
]) {
3099 spec
->multiout
.extra_out_nid
[i
] = nid
;
3103 printk(KERN_WARNING
"stac92xx: No space for extra DAC 0x%x\n", nid
);
3107 /* Create output controls
3108 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
3110 static int create_multi_out_ctls(struct hda_codec
*codec
, int num_outs
,
3111 const hda_nid_t
*pins
,
3112 const hda_nid_t
*dac_nids
,
3115 struct sigmatel_spec
*spec
= codec
->spec
;
3116 static const char *chname
[4] = {
3117 "Front", "Surround", NULL
/*CLFE*/, "Side"
3121 unsigned int wid_caps
;
3123 for (i
= 0; i
< num_outs
&& i
< ARRAY_SIZE(chname
); i
++) {
3124 if (type
== AUTO_PIN_HP_OUT
&& !spec
->hp_detect
) {
3125 wid_caps
= get_wcaps(codec
, pins
[i
]);
3126 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
3127 spec
->hp_detect
= 1;
3132 if (type
!= AUTO_PIN_HP_OUT
&& i
== 2) {
3134 err
= create_controls(codec
, "Center", nid
, 1);
3137 err
= create_controls(codec
, "LFE", nid
, 2);
3141 wid_caps
= get_wcaps(codec
, nid
);
3143 if (wid_caps
& AC_WCAP_LR_SWAP
) {
3144 err
= stac92xx_add_control(spec
,
3145 STAC_CTL_WIDGET_CLFE_SWITCH
,
3146 "Swap Center/LFE Playback Switch", nid
);
3156 case AUTO_PIN_HP_OUT
:
3160 case AUTO_PIN_SPEAKER_OUT
:
3169 err
= create_controls_idx(codec
, name
, idx
, nid
, 3);
3177 static int stac92xx_add_capvol_ctls(struct hda_codec
*codec
, unsigned long vol
,
3178 unsigned long sw
, int idx
)
3181 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
,
3182 "Capture Volume", vol
);
3185 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_MUTE
, idx
,
3186 "Capture Switch", sw
);
3192 /* add playback controls from the parsed DAC table */
3193 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
3194 const struct auto_pin_cfg
*cfg
)
3196 struct sigmatel_spec
*spec
= codec
->spec
;
3201 err
= create_multi_out_ctls(codec
, cfg
->line_outs
, cfg
->line_out_pins
,
3202 spec
->multiout
.dac_nids
,
3203 cfg
->line_out_type
);
3207 if (cfg
->hp_outs
> 1 && cfg
->line_out_type
== AUTO_PIN_LINE_OUT
) {
3208 err
= stac92xx_add_control(spec
,
3209 STAC_CTL_WIDGET_HP_SWITCH
,
3210 "Headphone as Line Out Switch",
3211 cfg
->hp_pins
[cfg
->hp_outs
- 1]);
3216 for (idx
= 0; idx
< cfg
->num_inputs
; idx
++) {
3217 if (cfg
->inputs
[idx
].type
> AUTO_PIN_LINE_IN
)
3219 nid
= cfg
->inputs
[idx
].pin
;
3220 err
= stac92xx_add_jack_mode_control(codec
, nid
, idx
);
3228 /* add playback controls for Speaker and HP outputs */
3229 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
3230 struct auto_pin_cfg
*cfg
)
3232 struct sigmatel_spec
*spec
= codec
->spec
;
3235 err
= create_multi_out_ctls(codec
, cfg
->hp_outs
, cfg
->hp_pins
,
3236 spec
->hp_dacs
, AUTO_PIN_HP_OUT
);
3240 err
= create_multi_out_ctls(codec
, cfg
->speaker_outs
, cfg
->speaker_pins
,
3241 spec
->speaker_dacs
, AUTO_PIN_SPEAKER_OUT
);
3248 /* labels for mono mux outputs */
3249 static const char *stac92xx_mono_labels
[4] = {
3250 "DAC0", "DAC1", "Mixer", "DAC2"
3253 /* create mono mux for mono out on capable codecs */
3254 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
3256 struct sigmatel_spec
*spec
= codec
->spec
;
3257 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
3259 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
3261 num_cons
= snd_hda_get_connections(codec
,
3264 HDA_MAX_NUM_INPUTS
);
3265 if (num_cons
<= 0 || num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
3268 for (i
= 0; i
< num_cons
; i
++)
3269 snd_hda_add_imux_item(mono_mux
, stac92xx_mono_labels
[i
], i
,
3272 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
3273 "Mono Mux", spec
->mono_nid
);
3276 /* create PC beep volume controls */
3277 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
3280 struct sigmatel_spec
*spec
= codec
->spec
;
3281 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
3282 int err
, type
= STAC_CTL_WIDGET_MUTE_BEEP
;
3284 if (spec
->anabeep_nid
== nid
)
3285 type
= STAC_CTL_WIDGET_MUTE
;
3287 /* check for mute support for the the amp */
3288 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
3289 err
= stac92xx_add_control(spec
, type
,
3290 "Beep Playback Switch",
3291 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
3296 /* check to see if there is volume support for the amp */
3297 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
3298 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
3299 "Beep Playback Volume",
3300 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
3307 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3308 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
3310 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol
*kcontrol
,
3311 struct snd_ctl_elem_value
*ucontrol
)
3313 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3314 ucontrol
->value
.integer
.value
[0] = codec
->beep
->enabled
;
3318 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol
*kcontrol
,
3319 struct snd_ctl_elem_value
*ucontrol
)
3321 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3322 return snd_hda_enable_beep_device(codec
, ucontrol
->value
.integer
.value
[0]);
3325 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl
= {
3326 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3327 .info
= stac92xx_dig_beep_switch_info
,
3328 .get
= stac92xx_dig_beep_switch_get
,
3329 .put
= stac92xx_dig_beep_switch_put
,
3332 static int stac92xx_beep_switch_ctl(struct hda_codec
*codec
)
3334 return stac92xx_add_control_temp(codec
->spec
, &stac92xx_dig_beep_ctrl
,
3335 0, "Beep Playback Switch", 0);
3339 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec
*codec
)
3341 struct sigmatel_spec
*spec
= codec
->spec
;
3344 for (i
= 0; i
< spec
->num_muxes
; i
++) {
3349 nid
= spec
->mux_nids
[i
];
3350 wcaps
= get_wcaps(codec
, nid
);
3351 if (!(wcaps
& AC_WCAP_OUT_AMP
))
3354 /* check whether already the same control was created as
3355 * normal Capture Volume.
3357 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3358 for (j
= 0; j
< spec
->num_caps
; j
++) {
3359 if (spec
->capvols
[j
] == val
)
3362 if (j
< spec
->num_caps
)
3365 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, i
,
3366 "Mux Capture Volume", val
);
3373 static const char *stac92xx_spdif_labels
[3] = {
3374 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3377 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec
*codec
)
3379 struct sigmatel_spec
*spec
= codec
->spec
;
3380 struct hda_input_mux
*spdif_mux
= &spec
->private_smux
;
3381 const char **labels
= spec
->spdif_labels
;
3383 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
3385 num_cons
= snd_hda_get_connections(codec
,
3388 HDA_MAX_NUM_INPUTS
);
3393 labels
= stac92xx_spdif_labels
;
3395 for (i
= 0; i
< num_cons
; i
++)
3396 snd_hda_add_imux_item(spdif_mux
, labels
[i
], i
, NULL
);
3401 /* labels for dmic mux inputs */
3402 static const char *stac92xx_dmic_labels
[5] = {
3403 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3404 "Digital Mic 3", "Digital Mic 4"
3407 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
3410 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
3413 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
3414 for (i
= 0; i
< nums
; i
++)
3420 /* create a volume assigned to the given pin (only if supported) */
3421 /* return 1 if the volume control is created */
3422 static int create_elem_capture_vol(struct hda_codec
*codec
, hda_nid_t nid
,
3423 const char *label
, int idx
, int direction
)
3425 unsigned int caps
, nums
;
3429 if (direction
== HDA_OUTPUT
)
3430 caps
= AC_WCAP_OUT_AMP
;
3432 caps
= AC_WCAP_IN_AMP
;
3433 if (!(get_wcaps(codec
, nid
) & caps
))
3435 caps
= query_amp_caps(codec
, nid
, direction
);
3436 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
;
3439 snprintf(name
, sizeof(name
), "%s Capture Volume", label
);
3440 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
3441 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, direction
));
3447 /* create playback/capture controls for input pins on dmic capable codecs */
3448 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
3449 const struct auto_pin_cfg
*cfg
)
3451 struct sigmatel_spec
*spec
= codec
->spec
;
3452 struct hda_input_mux
*imux
= &spec
->private_imux
;
3453 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
3455 unsigned int def_conf
;
3457 snd_hda_add_imux_item(dimux
, stac92xx_dmic_labels
[0], 0, NULL
);
3459 for (i
= 0; i
< spec
->num_dmics
; i
++) {
3461 int index
, type_idx
;
3464 nid
= spec
->dmic_nids
[i
];
3465 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
3467 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
3468 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
3471 index
= get_connection_index(codec
, spec
->dmux_nids
[0], nid
);
3475 label
= hda_get_input_pin_label(codec
, nid
, 1);
3476 snd_hda_add_imux_item(dimux
, label
, index
, &type_idx
);
3478 err
= create_elem_capture_vol(codec
, nid
, label
, type_idx
,
3483 err
= create_elem_capture_vol(codec
, nid
, label
,
3484 type_idx
, HDA_OUTPUT
);
3489 if (snd_hda_get_bool_hint(codec
, "separate_dmux") != 1) {
3490 snd_hda_add_imux_item(imux
, label
, index
, NULL
);
3491 spec
->num_analog_muxes
++;
3498 static int check_mic_pin(struct hda_codec
*codec
, hda_nid_t nid
,
3499 hda_nid_t
*fixed
, hda_nid_t
*ext
, hda_nid_t
*dock
)
3505 cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
3506 switch (snd_hda_get_input_pin_attr(cfg
)) {
3507 case INPUT_PIN_ATTR_INT
:
3509 return 1; /* already occupied */
3512 case INPUT_PIN_ATTR_UNUSED
:
3514 case INPUT_PIN_ATTR_DOCK
:
3516 return 1; /* already occupied */
3521 return 1; /* already occupied */
3528 static int set_mic_route(struct hda_codec
*codec
,
3529 struct sigmatel_mic_route
*mic
,
3532 struct sigmatel_spec
*spec
= codec
->spec
;
3533 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3539 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3540 if (pin
== cfg
->inputs
[i
].pin
)
3543 if (i
< cfg
->num_inputs
&& cfg
->inputs
[i
].type
== AUTO_PIN_MIC
) {
3545 i
= get_connection_index(codec
, spec
->mux_nids
[0], pin
);
3550 if (spec
->dmux_nids
)
3551 mic
->dmux_idx
= get_connection_index(codec
,
3554 } else if (spec
->dmux_nids
) {
3556 i
= get_connection_index(codec
, spec
->dmux_nids
[0], pin
);
3562 mic
->mux_idx
= get_connection_index(codec
,
3564 spec
->dmux_nids
[0]);
3569 /* return non-zero if the device is for automatic mic switch */
3570 static int stac_check_auto_mic(struct hda_codec
*codec
)
3572 struct sigmatel_spec
*spec
= codec
->spec
;
3573 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
3574 hda_nid_t fixed
, ext
, dock
;
3577 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3578 if (cfg
->inputs
[i
].type
>= AUTO_PIN_LINE_IN
)
3579 return 0; /* must be exclusively mics */
3581 fixed
= ext
= dock
= 0;
3582 for (i
= 0; i
< cfg
->num_inputs
; i
++)
3583 if (check_mic_pin(codec
, cfg
->inputs
[i
].pin
,
3584 &fixed
, &ext
, &dock
))
3586 for (i
= 0; i
< spec
->num_dmics
; i
++)
3587 if (check_mic_pin(codec
, spec
->dmic_nids
[i
],
3588 &fixed
, &ext
, &dock
))
3590 if (!fixed
&& !ext
&& !dock
)
3591 return 0; /* no input to switch */
3592 if (!(get_wcaps(codec
, ext
) & AC_WCAP_UNSOL_CAP
))
3593 return 0; /* no unsol support */
3594 if (set_mic_route(codec
, &spec
->ext_mic
, ext
) ||
3595 set_mic_route(codec
, &spec
->int_mic
, fixed
) ||
3596 set_mic_route(codec
, &spec
->dock_mic
, dock
))
3597 return 0; /* something is wrong */
3601 /* create playback/capture controls for input pins */
3602 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
3604 struct sigmatel_spec
*spec
= codec
->spec
;
3605 struct hda_input_mux
*imux
= &spec
->private_imux
;
3609 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3610 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
3611 int index
, err
, type_idx
;
3614 for (j
= 0; j
< spec
->num_muxes
; j
++) {
3615 index
= get_connection_index(codec
, spec
->mux_nids
[j
],
3623 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
3624 snd_hda_add_imux_item(imux
, label
, index
, &type_idx
);
3626 err
= create_elem_capture_vol(codec
, nid
,
3632 spec
->num_analog_muxes
= imux
->num_items
;
3634 if (imux
->num_items
) {
3636 * Set the current input for the muxes.
3637 * The STAC9221 has two input muxes with identical source
3638 * NID lists. Hopefully this won't get confused.
3640 for (i
= 0; i
< spec
->num_muxes
; i
++) {
3641 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
3642 AC_VERB_SET_CONNECT_SEL
,
3643 imux
->items
[0].index
);
3650 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
3652 struct sigmatel_spec
*spec
= codec
->spec
;
3655 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3656 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3657 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3661 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
3663 struct sigmatel_spec
*spec
= codec
->spec
;
3666 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
3668 pin
= spec
->autocfg
.hp_pins
[i
];
3669 if (pin
) /* connect to front */
3670 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
3672 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
3674 pin
= spec
->autocfg
.speaker_pins
[i
];
3675 if (pin
) /* connect to front */
3676 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
3680 static int is_dual_headphones(struct hda_codec
*codec
)
3682 struct sigmatel_spec
*spec
= codec
->spec
;
3685 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
||
3686 spec
->autocfg
.hp_outs
<= 1)
3689 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
3690 hda_nid_t nid
= spec
->autocfg
.hp_pins
[i
];
3691 unsigned int cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
3692 if (get_defcfg_location(cfg
) & AC_JACK_LOC_SEPARATE
)
3696 return (valid_hps
> 1);
3700 static int stac92xx_parse_auto_config(struct hda_codec
*codec
, hda_nid_t dig_out
, hda_nid_t dig_in
)
3702 struct sigmatel_spec
*spec
= codec
->spec
;
3706 if ((err
= snd_hda_parse_pin_def_config(codec
,
3708 spec
->dmic_nids
)) < 0)
3710 if (! spec
->autocfg
.line_outs
)
3711 return 0; /* can't find valid pin config */
3713 /* If we have no real line-out pin and multiple hp-outs, HPs should
3714 * be set up as multi-channel outputs.
3716 if (is_dual_headphones(codec
)) {
3717 /* Copy hp_outs to line_outs, backup line_outs in
3718 * speaker_outs so that the following routines can handle
3719 * HP pins as primary outputs.
3721 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
3722 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
3723 sizeof(spec
->autocfg
.line_out_pins
));
3724 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
3725 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
3726 sizeof(spec
->autocfg
.hp_pins
));
3727 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
3728 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
3729 spec
->autocfg
.hp_outs
= 0;
3732 if (spec
->autocfg
.mono_out_pin
) {
3733 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
3734 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
3735 u32 caps
= query_amp_caps(codec
,
3736 spec
->autocfg
.mono_out_pin
, dir
);
3737 hda_nid_t conn_list
[1];
3739 /* get the mixer node and then the mono mux if it exists */
3740 if (snd_hda_get_connections(codec
,
3741 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
3742 snd_hda_get_connections(codec
, conn_list
[0],
3743 conn_list
, 1) > 0) {
3745 int wcaps
= get_wcaps(codec
, conn_list
[0]);
3746 int wid_type
= get_wcaps_type(wcaps
);
3747 /* LR swap check, some stac925x have a mux that
3748 * changes the DACs output path instead of the
3751 if (wid_type
== AC_WID_AUD_SEL
&&
3752 !(wcaps
& AC_WCAP_LR_SWAP
))
3753 spec
->mono_nid
= conn_list
[0];
3756 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
3758 /* most mono outs have a least a mute/unmute switch */
3759 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
3760 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
3761 "Mono Playback Switch",
3762 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3765 /* check for volume support for the amp */
3766 if ((caps
& AC_AMPCAP_NUM_STEPS
)
3767 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
3768 err
= stac92xx_add_control(spec
,
3769 STAC_CTL_WIDGET_VOL
,
3770 "Mono Playback Volume",
3771 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
3777 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
3781 if (!spec
->multiout
.num_dacs
) {
3782 err
= stac92xx_auto_fill_dac_nids(codec
);
3785 err
= stac92xx_auto_create_multi_out_ctls(codec
,
3791 /* setup analog beep controls */
3792 if (spec
->anabeep_nid
> 0) {
3793 err
= stac92xx_auto_create_beep_ctls(codec
,
3799 /* setup digital beep controls and input device */
3800 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3801 if (spec
->digbeep_nid
> 0) {
3802 hda_nid_t nid
= spec
->digbeep_nid
;
3805 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
3808 err
= snd_hda_attach_beep_device(codec
, nid
);
3812 /* IDT/STAC codecs have linear beep tone parameter */
3813 codec
->beep
->linear_tone
= spec
->linear_tone_beep
;
3814 /* if no beep switch is available, make its own one */
3815 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
3816 if (!(caps
& AC_AMPCAP_MUTE
)) {
3817 err
= stac92xx_beep_switch_ctl(codec
);
3825 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
3829 /* All output parsing done, now restore the swapped hp pins */
3831 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
3832 sizeof(spec
->autocfg
.hp_pins
));
3833 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
3834 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
3835 spec
->autocfg
.line_outs
= 0;
3838 if (stac_check_auto_mic(codec
)) {
3840 /* only one capture for auto-mic */
3843 spec
->num_muxes
= 1;
3846 for (i
= 0; i
< spec
->num_caps
; i
++) {
3847 err
= stac92xx_add_capvol_ctls(codec
, spec
->capvols
[i
],
3848 spec
->capsws
[i
], i
);
3853 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
3857 if (spec
->mono_nid
> 0) {
3858 err
= stac92xx_auto_create_mono_output_ctls(codec
);
3862 if (spec
->num_dmics
> 0 && !spec
->dinput_mux
)
3863 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
3864 &spec
->autocfg
)) < 0)
3866 if (spec
->num_muxes
> 0) {
3867 err
= stac92xx_auto_create_mux_input_ctls(codec
);
3871 if (spec
->num_smuxes
> 0) {
3872 err
= stac92xx_auto_create_spdif_mux_ctls(codec
);
3877 err
= stac92xx_add_input_source(spec
);
3881 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3882 if (spec
->multiout
.max_channels
> 2)
3883 spec
->surr_switch
= 1;
3885 if (spec
->autocfg
.dig_outs
)
3886 spec
->multiout
.dig_out_nid
= dig_out
;
3887 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
3888 spec
->dig_in_nid
= dig_in
;
3890 if (spec
->kctls
.list
)
3891 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
3893 spec
->input_mux
= &spec
->private_imux
;
3894 if (!spec
->dinput_mux
)
3895 spec
->dinput_mux
= &spec
->private_dimux
;
3896 spec
->sinput_mux
= &spec
->private_smux
;
3897 spec
->mono_mux
= &spec
->private_mono_mux
;
3901 /* add playback controls for HP output */
3902 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
3903 struct auto_pin_cfg
*cfg
)
3905 struct sigmatel_spec
*spec
= codec
->spec
;
3906 hda_nid_t pin
= cfg
->hp_pins
[0];
3907 unsigned int wid_caps
;
3912 wid_caps
= get_wcaps(codec
, pin
);
3913 if (wid_caps
& AC_WCAP_UNSOL_CAP
)
3914 spec
->hp_detect
= 1;
3919 /* add playback controls for LFE output */
3920 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
3921 struct auto_pin_cfg
*cfg
)
3923 struct sigmatel_spec
*spec
= codec
->spec
;
3925 hda_nid_t lfe_pin
= 0x0;
3929 * search speaker outs and line outs for a mono speaker pin
3930 * with an amp. If one is found, add LFE controls
3933 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
3934 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
3935 unsigned int wcaps
= get_wcaps(codec
, pin
);
3936 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3937 if (wcaps
== AC_WCAP_OUT_AMP
)
3938 /* found a mono speaker with an amp, must be lfe */
3942 /* if speaker_outs is 0, then speakers may be in line_outs */
3943 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
3944 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
3945 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
3946 unsigned int defcfg
;
3947 defcfg
= snd_hda_codec_get_pincfg(codec
, pin
);
3948 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
3949 unsigned int wcaps
= get_wcaps(codec
, pin
);
3950 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
3951 if (wcaps
== AC_WCAP_OUT_AMP
)
3952 /* found a mono speaker with an amp,
3960 err
= create_controls(codec
, "LFE", lfe_pin
, 1);
3968 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
3970 struct sigmatel_spec
*spec
= codec
->spec
;
3973 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
3976 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
3979 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
3982 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
3985 if (spec
->num_muxes
> 0) {
3986 err
= stac92xx_auto_create_mux_input_ctls(codec
);
3991 err
= stac92xx_add_input_source(spec
);
3995 if (spec
->autocfg
.dig_outs
)
3996 spec
->multiout
.dig_out_nid
= 0x05;
3997 if (spec
->autocfg
.dig_in_pin
)
3998 spec
->dig_in_nid
= 0x04;
4000 if (spec
->kctls
.list
)
4001 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
4003 spec
->input_mux
= &spec
->private_imux
;
4004 spec
->dinput_mux
= &spec
->private_dimux
;
4010 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
4011 * funky external mute control using GPIO pins.
4014 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
4015 unsigned int dir_mask
, unsigned int data
)
4017 unsigned int gpiostate
, gpiomask
, gpiodir
;
4019 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4020 AC_VERB_GET_GPIO_DATA
, 0);
4021 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
4023 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4024 AC_VERB_GET_GPIO_MASK
, 0);
4027 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4028 AC_VERB_GET_GPIO_DIRECTION
, 0);
4029 gpiodir
|= dir_mask
;
4031 /* Configure GPIOx as CMOS */
4032 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
4034 snd_hda_codec_write(codec
, codec
->afg
, 0,
4035 AC_VERB_SET_GPIO_MASK
, gpiomask
);
4036 snd_hda_codec_read(codec
, codec
->afg
, 0,
4037 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
4041 snd_hda_codec_read(codec
, codec
->afg
, 0,
4042 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
4045 #ifdef CONFIG_SND_HDA_INPUT_JACK
4046 static void stac92xx_free_jack_priv(struct snd_jack
*jack
)
4048 struct sigmatel_jack
*jacks
= jack
->private_data
;
4054 static int stac92xx_add_jack(struct hda_codec
*codec
,
4055 hda_nid_t nid
, int type
)
4057 #ifdef CONFIG_SND_HDA_INPUT_JACK
4058 struct sigmatel_spec
*spec
= codec
->spec
;
4059 struct sigmatel_jack
*jack
;
4060 int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4061 int connectivity
= get_defcfg_connect(def_conf
);
4065 if (connectivity
&& connectivity
!= AC_JACK_PORT_FIXED
)
4068 snd_array_init(&spec
->jacks
, sizeof(*jack
), 32);
4069 jack
= snd_array_new(&spec
->jacks
);
4075 snprintf(name
, sizeof(name
), "%s at %s %s Jack",
4076 snd_hda_get_jack_type(def_conf
),
4077 snd_hda_get_jack_connectivity(def_conf
),
4078 snd_hda_get_jack_location(def_conf
));
4080 err
= snd_jack_new(codec
->bus
->card
, name
, type
, &jack
->jack
);
4085 jack
->jack
->private_data
= jack
;
4086 jack
->jack
->private_free
= stac92xx_free_jack_priv
;
4091 static int stac_add_event(struct sigmatel_spec
*spec
, hda_nid_t nid
,
4092 unsigned char type
, int data
)
4094 struct sigmatel_event
*event
;
4096 snd_array_init(&spec
->events
, sizeof(*event
), 32);
4097 event
= snd_array_new(&spec
->events
);
4102 event
->tag
= spec
->events
.used
;
4108 static struct sigmatel_event
*stac_get_event(struct hda_codec
*codec
,
4111 struct sigmatel_spec
*spec
= codec
->spec
;
4112 struct sigmatel_event
*event
= spec
->events
.list
;
4115 for (i
= 0; i
< spec
->events
.used
; i
++, event
++) {
4116 if (event
->nid
== nid
)
4122 static struct sigmatel_event
*stac_get_event_from_tag(struct hda_codec
*codec
,
4125 struct sigmatel_spec
*spec
= codec
->spec
;
4126 struct sigmatel_event
*event
= spec
->events
.list
;
4129 for (i
= 0; i
< spec
->events
.used
; i
++, event
++) {
4130 if (event
->tag
== tag
)
4136 /* check if given nid is a valid pin and no other events are assigned
4137 * to it. If OK, assign the event, set the unsol flag, and returns 1.
4138 * Otherwise, returns zero.
4140 static int enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
4143 struct sigmatel_event
*event
;
4146 if (!(get_wcaps(codec
, nid
) & AC_WCAP_UNSOL_CAP
))
4148 event
= stac_get_event(codec
, nid
);
4150 if (event
->type
!= type
)
4154 tag
= stac_add_event(codec
->spec
, nid
, type
, 0);
4158 snd_hda_codec_write_cache(codec
, nid
, 0,
4159 AC_VERB_SET_UNSOLICITED_ENABLE
,
4164 static int is_nid_hp_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
4167 for (i
= 0; i
< cfg
->hp_outs
; i
++)
4168 if (cfg
->hp_pins
[i
] == nid
)
4169 return 1; /* nid is a HP-Out */
4171 return 0; /* nid is not a HP-Out */
4174 static void stac92xx_power_down(struct hda_codec
*codec
)
4176 struct sigmatel_spec
*spec
= codec
->spec
;
4178 /* power down inactive DACs */
4180 for (dac
= spec
->dac_list
; *dac
; dac
++)
4181 if (!check_all_dac_nids(spec
, *dac
))
4182 snd_hda_codec_write(codec
, *dac
, 0,
4183 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
4186 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
4189 static inline int get_int_hint(struct hda_codec
*codec
, const char *key
,
4193 p
= snd_hda_get_hint(codec
, key
);
4196 if (!strict_strtoul(p
, 0, &val
)) {
4204 /* override some hints from the hwdep entry */
4205 static void stac_store_hints(struct hda_codec
*codec
)
4207 struct sigmatel_spec
*spec
= codec
->spec
;
4210 val
= snd_hda_get_bool_hint(codec
, "hp_detect");
4212 spec
->hp_detect
= val
;
4213 if (get_int_hint(codec
, "gpio_mask", &spec
->gpio_mask
)) {
4214 spec
->eapd_mask
= spec
->gpio_dir
= spec
->gpio_data
=
4217 if (get_int_hint(codec
, "gpio_dir", &spec
->gpio_dir
))
4218 spec
->gpio_mask
&= spec
->gpio_mask
;
4219 if (get_int_hint(codec
, "gpio_data", &spec
->gpio_data
))
4220 spec
->gpio_dir
&= spec
->gpio_mask
;
4221 if (get_int_hint(codec
, "eapd_mask", &spec
->eapd_mask
))
4222 spec
->eapd_mask
&= spec
->gpio_mask
;
4223 if (get_int_hint(codec
, "gpio_mute", &spec
->gpio_mute
))
4224 spec
->gpio_mute
&= spec
->gpio_mask
;
4225 val
= snd_hda_get_bool_hint(codec
, "eapd_switch");
4227 spec
->eapd_switch
= val
;
4228 get_int_hint(codec
, "gpio_led_polarity", &spec
->gpio_led_polarity
);
4229 if (get_int_hint(codec
, "gpio_led", &spec
->gpio_led
)) {
4230 spec
->gpio_mask
|= spec
->gpio_led
;
4231 spec
->gpio_dir
|= spec
->gpio_led
;
4232 if (spec
->gpio_led_polarity
)
4233 spec
->gpio_data
|= spec
->gpio_led
;
4237 static int stac92xx_init(struct hda_codec
*codec
)
4239 struct sigmatel_spec
*spec
= codec
->spec
;
4240 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4244 snd_hda_sequence_write(codec
, spec
->init
);
4246 /* power down adcs initially */
4247 if (spec
->powerdown_adcs
)
4248 for (i
= 0; i
< spec
->num_adcs
; i
++)
4249 snd_hda_codec_write(codec
,
4250 spec
->adc_nids
[i
], 0,
4251 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
4253 /* override some hints */
4254 stac_store_hints(codec
);
4257 gpio
= spec
->gpio_data
;
4258 /* turn on EAPD statically when spec->eapd_switch isn't set.
4259 * otherwise, unsol event will turn it on/off dynamically
4261 if (!spec
->eapd_switch
)
4262 gpio
|= spec
->eapd_mask
;
4263 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, gpio
);
4266 if (spec
->hp_detect
) {
4267 /* Enable unsolicited responses on the HP widget */
4268 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4269 hda_nid_t nid
= cfg
->hp_pins
[i
];
4270 enable_pin_detect(codec
, nid
, STAC_HP_EVENT
);
4272 if (cfg
->line_out_type
== AUTO_PIN_LINE_OUT
&&
4273 cfg
->speaker_outs
> 0) {
4274 /* enable pin-detect for line-outs as well */
4275 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4276 hda_nid_t nid
= cfg
->line_out_pins
[i
];
4277 enable_pin_detect(codec
, nid
, STAC_LO_EVENT
);
4281 /* force to enable the first line-out; the others are set up
4284 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
4286 /* fake event to set up pins */
4287 if (cfg
->hp_pins
[0])
4288 stac_issue_unsol_event(codec
, cfg
->hp_pins
[0]);
4289 else if (cfg
->line_out_pins
[0])
4290 stac_issue_unsol_event(codec
, cfg
->line_out_pins
[0]);
4292 stac92xx_auto_init_multi_out(codec
);
4293 stac92xx_auto_init_hp_out(codec
);
4294 for (i
= 0; i
< cfg
->hp_outs
; i
++)
4295 stac_toggle_power_map(codec
, cfg
->hp_pins
[i
], 1);
4297 if (spec
->auto_mic
) {
4298 /* initialize connection to analog input */
4299 if (spec
->dmux_nids
)
4300 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
4301 AC_VERB_SET_CONNECT_SEL
, 0);
4302 if (enable_pin_detect(codec
, spec
->ext_mic
.pin
, STAC_MIC_EVENT
))
4303 stac_issue_unsol_event(codec
, spec
->ext_mic
.pin
);
4304 if (enable_pin_detect(codec
, spec
->dock_mic
.pin
,
4306 stac_issue_unsol_event(codec
, spec
->dock_mic
.pin
);
4308 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4309 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
4310 int type
= cfg
->inputs
[i
].type
;
4311 unsigned int pinctl
, conf
;
4312 if (type
== AUTO_PIN_MIC
) {
4313 /* for mic pins, force to initialize */
4314 pinctl
= stac92xx_get_default_vref(codec
, nid
);
4315 pinctl
|= AC_PINCTL_IN_EN
;
4316 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
4318 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
4319 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4320 /* if PINCTL already set then skip */
4321 /* Also, if both INPUT and OUTPUT are set,
4322 * it must be a BIOS bug; need to override, too
4324 if (!(pinctl
& AC_PINCTL_IN_EN
) ||
4325 (pinctl
& AC_PINCTL_OUT_EN
)) {
4326 pinctl
&= ~AC_PINCTL_OUT_EN
;
4327 pinctl
|= AC_PINCTL_IN_EN
;
4328 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
4331 conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4332 if (get_defcfg_connect(conf
) != AC_JACK_PORT_FIXED
) {
4333 if (enable_pin_detect(codec
, nid
, STAC_INSERT_EVENT
))
4334 stac_issue_unsol_event(codec
, nid
);
4337 for (i
= 0; i
< spec
->num_dmics
; i
++)
4338 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
4340 if (cfg
->dig_out_pins
[0])
4341 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pins
[0],
4343 if (cfg
->dig_in_pin
)
4344 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
4346 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
4347 hda_nid_t nid
= spec
->pwr_nids
[i
];
4348 int pinctl
, def_conf
;
4350 /* power on when no jack detection is available */
4351 if (!spec
->hp_detect
) {
4352 stac_toggle_power_map(codec
, nid
, 1);
4356 if (is_nid_hp_pin(cfg
, nid
))
4357 continue; /* already has an unsol event */
4359 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
4360 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4361 /* outputs are only ports capable of power management
4362 * any attempts on powering down a input port cause the
4363 * referenced VREF to act quirky.
4365 if (pinctl
& AC_PINCTL_IN_EN
) {
4366 stac_toggle_power_map(codec
, nid
, 1);
4369 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4370 def_conf
= get_defcfg_connect(def_conf
);
4371 /* skip any ports that don't have jacks since presence
4372 * detection is useless */
4373 if (def_conf
!= AC_JACK_PORT_COMPLEX
) {
4374 if (def_conf
!= AC_JACK_PORT_NONE
)
4375 stac_toggle_power_map(codec
, nid
, 1);
4378 if (enable_pin_detect(codec
, nid
, STAC_PWR_EVENT
))
4379 stac_issue_unsol_event(codec
, nid
);
4384 hda_call_check_power_status(codec
, 0x01);
4386 stac92xx_power_down(codec
);
4390 static void stac92xx_free_jacks(struct hda_codec
*codec
)
4392 #ifdef CONFIG_SND_HDA_INPUT_JACK
4393 /* free jack instances manually when clearing/reconfiguring */
4394 struct sigmatel_spec
*spec
= codec
->spec
;
4395 if (!codec
->bus
->shutdown
&& spec
->jacks
.list
) {
4396 struct sigmatel_jack
*jacks
= spec
->jacks
.list
;
4398 for (i
= 0; i
< spec
->jacks
.used
; i
++, jacks
++) {
4400 snd_device_free(codec
->bus
->card
, jacks
->jack
);
4403 snd_array_free(&spec
->jacks
);
4407 static void stac92xx_free_kctls(struct hda_codec
*codec
)
4409 struct sigmatel_spec
*spec
= codec
->spec
;
4411 if (spec
->kctls
.list
) {
4412 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4414 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4415 kfree(kctl
[i
].name
);
4417 snd_array_free(&spec
->kctls
);
4420 static void stac92xx_shutup(struct hda_codec
*codec
)
4422 struct sigmatel_spec
*spec
= codec
->spec
;
4424 snd_hda_shutup_pins(codec
);
4426 if (spec
->eapd_mask
)
4427 stac_gpio_set(codec
, spec
->gpio_mask
,
4428 spec
->gpio_dir
, spec
->gpio_data
&
4432 static void stac92xx_free(struct hda_codec
*codec
)
4434 struct sigmatel_spec
*spec
= codec
->spec
;
4439 stac92xx_shutup(codec
);
4440 stac92xx_free_jacks(codec
);
4441 snd_array_free(&spec
->events
);
4444 snd_hda_detach_beep_device(codec
);
4447 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
4450 unsigned int old_ctl
, pin_ctl
;
4452 pin_ctl
= snd_hda_codec_read(codec
, nid
,
4453 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
4455 if (pin_ctl
& AC_PINCTL_IN_EN
) {
4457 * we need to check the current set-up direction of
4458 * shared input pins since they can be switched via
4459 * "xxx as Output" mixer switch
4461 struct sigmatel_spec
*spec
= codec
->spec
;
4462 if (nid
== spec
->line_switch
|| nid
== spec
->mic_switch
)
4467 /* if setting pin direction bits, clear the current
4468 direction bits first */
4469 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
4470 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
4473 if (old_ctl
!= pin_ctl
)
4474 snd_hda_codec_write_cache(codec
, nid
, 0,
4475 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4479 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
4482 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
4483 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
4485 snd_hda_codec_write_cache(codec
, nid
, 0,
4486 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4490 static inline int get_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
4494 return snd_hda_jack_detect(codec
, nid
);
4497 static void stac92xx_line_out_detect(struct hda_codec
*codec
,
4500 struct sigmatel_spec
*spec
= codec
->spec
;
4501 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4504 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4507 presence
= get_pin_presence(codec
, cfg
->line_out_pins
[i
]);
4509 unsigned int pinctl
;
4510 pinctl
= snd_hda_codec_read(codec
,
4511 cfg
->line_out_pins
[i
], 0,
4512 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4513 if (pinctl
& AC_PINCTL_IN_EN
)
4514 presence
= 0; /* mic- or line-input */
4519 /* disable speakers */
4520 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
4521 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
4523 if (spec
->eapd_mask
&& spec
->eapd_switch
)
4524 stac_gpio_set(codec
, spec
->gpio_mask
,
4525 spec
->gpio_dir
, spec
->gpio_data
&
4528 /* enable speakers */
4529 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
4530 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
4532 if (spec
->eapd_mask
&& spec
->eapd_switch
)
4533 stac_gpio_set(codec
, spec
->gpio_mask
,
4534 spec
->gpio_dir
, spec
->gpio_data
|
4539 /* return non-zero if the hp-pin of the given array index isn't
4540 * a jack-detection target
4542 static int no_hp_sensing(struct sigmatel_spec
*spec
, int i
)
4544 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4546 /* ignore sensing of shared line and mic jacks */
4547 if (cfg
->hp_pins
[i
] == spec
->line_switch
)
4549 if (cfg
->hp_pins
[i
] == spec
->mic_switch
)
4551 /* ignore if the pin is set as line-out */
4552 if (cfg
->hp_pins
[i
] == spec
->hp_switch
)
4557 static void stac92xx_hp_detect(struct hda_codec
*codec
)
4559 struct sigmatel_spec
*spec
= codec
->spec
;
4560 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4564 if (spec
->gpio_mute
)
4565 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
4566 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
4568 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4571 if (no_hp_sensing(spec
, i
))
4573 presence
= get_pin_presence(codec
, cfg
->hp_pins
[i
]);
4575 unsigned int pinctl
;
4576 pinctl
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
4577 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4578 if (pinctl
& AC_PINCTL_IN_EN
)
4579 presence
= 0; /* mic- or line-input */
4584 /* disable lineouts */
4585 if (spec
->hp_switch
)
4586 stac92xx_reset_pinctl(codec
, spec
->hp_switch
,
4588 for (i
= 0; i
< cfg
->line_outs
; i
++)
4589 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
4592 /* enable lineouts */
4593 if (spec
->hp_switch
)
4594 stac92xx_set_pinctl(codec
, spec
->hp_switch
,
4596 for (i
= 0; i
< cfg
->line_outs
; i
++)
4597 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
4600 stac92xx_line_out_detect(codec
, presence
);
4601 /* toggle hp outs */
4602 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4603 unsigned int val
= AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
;
4604 if (no_hp_sensing(spec
, i
))
4607 stac92xx_set_pinctl(codec
, cfg
->hp_pins
[i
], val
);
4609 /* Resetting the pinctl like below may lead to (a sort of) regressions
4610 * on some devices since they use the HP pin actually for line/speaker
4611 * outs although the default pin config shows a different pin (that is
4612 * wrong and useless).
4614 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4615 * But, disabling the code below just works around it, and I'm too tired of
4616 * bug reports with such devices...
4619 stac92xx_reset_pinctl(codec
, cfg
->hp_pins
[i
], val
);
4624 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
4627 struct sigmatel_spec
*spec
= codec
->spec
;
4628 unsigned int idx
, val
;
4630 for (idx
= 0; idx
< spec
->num_pwrs
; idx
++) {
4631 if (spec
->pwr_nids
[idx
] == nid
)
4634 if (idx
>= spec
->num_pwrs
)
4637 /* several codecs have two power down bits */
4638 if (spec
->pwr_mapping
)
4639 idx
= spec
->pwr_mapping
[idx
];
4643 val
= snd_hda_codec_read(codec
, codec
->afg
, 0, 0x0fec, 0x0) & 0xff;
4649 /* power down unused output ports */
4650 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7ec, val
);
4653 static void stac92xx_pin_sense(struct hda_codec
*codec
, hda_nid_t nid
)
4655 stac_toggle_power_map(codec
, nid
, get_pin_presence(codec
, nid
));
4658 static void stac92xx_report_jack(struct hda_codec
*codec
, hda_nid_t nid
)
4660 struct sigmatel_spec
*spec
= codec
->spec
;
4661 struct sigmatel_jack
*jacks
= spec
->jacks
.list
;
4665 for (i
= 0; i
< spec
->jacks
.used
; i
++) {
4666 if (jacks
->nid
== nid
) {
4667 unsigned int pin_ctl
=
4668 snd_hda_codec_read(codec
, nid
,
4669 0, AC_VERB_GET_PIN_WIDGET_CONTROL
,
4671 int type
= jacks
->type
;
4672 if (type
== (SND_JACK_LINEOUT
4673 | SND_JACK_HEADPHONE
))
4674 type
= (pin_ctl
& AC_PINCTL_HP_EN
)
4675 ? SND_JACK_HEADPHONE
: SND_JACK_LINEOUT
;
4676 snd_jack_report(jacks
->jack
,
4677 get_pin_presence(codec
, nid
)
4685 /* get the pin connection (fixed, none, etc) */
4686 static unsigned int stac_get_defcfg_connect(struct hda_codec
*codec
, int idx
)
4688 struct sigmatel_spec
*spec
= codec
->spec
;
4691 cfg
= snd_hda_codec_get_pincfg(codec
, spec
->pin_nids
[idx
]);
4692 return get_defcfg_connect(cfg
);
4695 static int stac92xx_connected_ports(struct hda_codec
*codec
,
4696 hda_nid_t
*nids
, int num_nids
)
4698 struct sigmatel_spec
*spec
= codec
->spec
;
4700 unsigned int def_conf
;
4702 for (num
= 0; num
< num_nids
; num
++) {
4703 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
4704 if (spec
->pin_nids
[idx
] == nids
[num
])
4706 if (idx
>= spec
->num_pins
)
4708 def_conf
= stac_get_defcfg_connect(codec
, idx
);
4709 if (def_conf
== AC_JACK_PORT_NONE
)
4715 static void stac92xx_mic_detect(struct hda_codec
*codec
)
4717 struct sigmatel_spec
*spec
= codec
->spec
;
4718 struct sigmatel_mic_route
*mic
;
4720 if (get_pin_presence(codec
, spec
->ext_mic
.pin
))
4721 mic
= &spec
->ext_mic
;
4722 else if (get_pin_presence(codec
, spec
->dock_mic
.pin
))
4723 mic
= &spec
->dock_mic
;
4725 mic
= &spec
->int_mic
;
4726 if (mic
->dmux_idx
>= 0)
4727 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
4728 AC_VERB_SET_CONNECT_SEL
,
4730 if (mic
->mux_idx
>= 0)
4731 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[0], 0,
4732 AC_VERB_SET_CONNECT_SEL
,
4736 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
)
4738 struct sigmatel_event
*event
= stac_get_event(codec
, nid
);
4741 codec
->patch_ops
.unsol_event(codec
, (unsigned)event
->tag
<< 26);
4744 static void stac92xx_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4746 struct sigmatel_spec
*spec
= codec
->spec
;
4747 struct sigmatel_event
*event
;
4750 tag
= (res
>> 26) & 0x7f;
4751 event
= stac_get_event_from_tag(codec
, tag
);
4755 switch (event
->type
) {
4758 stac92xx_hp_detect(codec
);
4760 case STAC_MIC_EVENT
:
4761 stac92xx_mic_detect(codec
);
4765 switch (event
->type
) {
4768 case STAC_MIC_EVENT
:
4769 case STAC_INSERT_EVENT
:
4770 case STAC_PWR_EVENT
:
4771 if (spec
->num_pwrs
> 0)
4772 stac92xx_pin_sense(codec
, event
->nid
);
4773 stac92xx_report_jack(codec
, event
->nid
);
4775 switch (codec
->subsystem_id
) {
4777 if (event
->nid
== 0xb) {
4778 int pin
= AC_PINCTL_IN_EN
;
4780 if (get_pin_presence(codec
, 0xa)
4781 && get_pin_presence(codec
, 0xb))
4782 pin
|= AC_PINCTL_VREF_80
;
4783 if (!get_pin_presence(codec
, 0xb))
4784 pin
|= AC_PINCTL_VREF_80
;
4786 /* toggle VREF state based on mic + hp pin
4789 stac92xx_auto_set_pinctl(codec
, 0x0a, pin
);
4793 case STAC_VREF_EVENT
:
4794 data
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4795 AC_VERB_GET_GPIO_DATA
, 0);
4796 /* toggle VREF state based on GPIOx status */
4797 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e0,
4798 !!(data
& (1 << event
->data
)));
4803 static int hp_blike_system(u32 subsystem_id
);
4805 static void set_hp_led_gpio(struct hda_codec
*codec
)
4807 struct sigmatel_spec
*spec
= codec
->spec
;
4813 gpio
= snd_hda_param_read(codec
, codec
->afg
, AC_PAR_GPIO_CAP
);
4814 gpio
&= AC_GPIO_IO_COUNT
;
4816 spec
->gpio_led
= 0x08; /* GPIO 3 */
4818 spec
->gpio_led
= 0x01; /* GPIO 0 */
4822 * This method searches for the mute LED GPIO configuration
4823 * provided as OEM string in SMBIOS. The format of that string
4824 * is HP_Mute_LED_P_G or HP_Mute_LED_P
4825 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
4826 * that corresponds to the NOT muted state of the master volume
4827 * and G is the index of the GPIO to use as the mute LED control (0..9)
4828 * If _G portion is missing it is assigned based on the codec ID
4830 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4831 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4834 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4835 * SMBIOS - at least the ones I have seen do not have them - which include
4836 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4837 * HP Pavilion dv9500t CTO.
4838 * Need more information on whether it is true across the entire series.
4841 static int find_mute_led_gpio(struct hda_codec
*codec
, int default_polarity
)
4843 struct sigmatel_spec
*spec
= codec
->spec
;
4844 const struct dmi_device
*dev
= NULL
;
4846 if ((codec
->subsystem_id
>> 16) == PCI_VENDOR_ID_HP
) {
4847 while ((dev
= dmi_find_device(DMI_DEV_TYPE_OEM_STRING
,
4849 if (sscanf(dev
->name
, "HP_Mute_LED_%d_%d",
4850 &spec
->gpio_led_polarity
,
4851 &spec
->gpio_led
) == 2) {
4852 spec
->gpio_led
= 1 << spec
->gpio_led
;
4855 if (sscanf(dev
->name
, "HP_Mute_LED_%d",
4856 &spec
->gpio_led_polarity
) == 1) {
4857 set_hp_led_gpio(codec
);
4863 * Fallback case - if we don't find the DMI strings,
4864 * we statically set the GPIO - if not a B-series system.
4866 if (!hp_blike_system(codec
->subsystem_id
)) {
4867 set_hp_led_gpio(codec
);
4868 spec
->gpio_led_polarity
= default_polarity
;
4875 static int hp_blike_system(u32 subsystem_id
)
4877 switch (subsystem_id
) {
4904 #ifdef CONFIG_PROC_FS
4905 static void stac92hd_proc_hook(struct snd_info_buffer
*buffer
,
4906 struct hda_codec
*codec
, hda_nid_t nid
)
4908 if (nid
== codec
->afg
)
4909 snd_iprintf(buffer
, "Power-Map: 0x%02x\n",
4910 snd_hda_codec_read(codec
, nid
, 0, 0x0fec, 0x0));
4913 static void analog_loop_proc_hook(struct snd_info_buffer
*buffer
,
4914 struct hda_codec
*codec
,
4917 snd_iprintf(buffer
, "Analog Loopback: 0x%02x\n",
4918 snd_hda_codec_read(codec
, codec
->afg
, 0, verb
, 0));
4921 /* stac92hd71bxx, stac92hd73xx */
4922 static void stac92hd7x_proc_hook(struct snd_info_buffer
*buffer
,
4923 struct hda_codec
*codec
, hda_nid_t nid
)
4925 stac92hd_proc_hook(buffer
, codec
, nid
);
4926 if (nid
== codec
->afg
)
4927 analog_loop_proc_hook(buffer
, codec
, 0xfa0);
4930 static void stac9205_proc_hook(struct snd_info_buffer
*buffer
,
4931 struct hda_codec
*codec
, hda_nid_t nid
)
4933 if (nid
== codec
->afg
)
4934 analog_loop_proc_hook(buffer
, codec
, 0xfe0);
4937 static void stac927x_proc_hook(struct snd_info_buffer
*buffer
,
4938 struct hda_codec
*codec
, hda_nid_t nid
)
4940 if (nid
== codec
->afg
)
4941 analog_loop_proc_hook(buffer
, codec
, 0xfeb);
4944 #define stac92hd_proc_hook NULL
4945 #define stac92hd7x_proc_hook NULL
4946 #define stac9205_proc_hook NULL
4947 #define stac927x_proc_hook NULL
4950 #ifdef SND_HDA_NEEDS_RESUME
4951 static int stac92xx_resume(struct hda_codec
*codec
)
4953 struct sigmatel_spec
*spec
= codec
->spec
;
4955 stac92xx_init(codec
);
4956 snd_hda_codec_resume_amp(codec
);
4957 snd_hda_codec_resume_cache(codec
);
4958 /* fake event to set up pins again to override cached values */
4959 if (spec
->hp_detect
) {
4960 if (spec
->autocfg
.hp_pins
[0])
4961 stac_issue_unsol_event(codec
, spec
->autocfg
.hp_pins
[0]);
4962 else if (spec
->autocfg
.line_out_pins
[0])
4963 stac_issue_unsol_event(codec
,
4964 spec
->autocfg
.line_out_pins
[0]);
4968 hda_call_check_power_status(codec
, 0x01);
4973 * using power check for controlling mute led of HP notebooks
4974 * check for mute state only on Speakers (nid = 0x10)
4976 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise
4977 * the LED is NOT working properly !
4979 * Changed name to reflect that it now works for any designated
4980 * model, not just HP HDX.
4983 #ifdef CONFIG_SND_HDA_POWER_SAVE
4984 static int stac92xx_hp_check_power_status(struct hda_codec
*codec
,
4987 struct sigmatel_spec
*spec
= codec
->spec
;
4990 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
4991 nid
= spec
->multiout
.dac_nids
[i
];
4992 if (!(snd_hda_codec_amp_read(codec
, nid
, 0, HDA_OUTPUT
, 0) &
4994 muted
= 0; /* something heard */
4999 spec
->gpio_data
&= ~spec
->gpio_led
; /* orange */
5001 spec
->gpio_data
|= spec
->gpio_led
; /* white */
5003 if (!spec
->gpio_led_polarity
) {
5004 /* LED state is inverted on these systems */
5005 spec
->gpio_data
^= spec
->gpio_led
;
5008 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, spec
->gpio_data
);
5013 static int stac92xx_suspend(struct hda_codec
*codec
, pm_message_t state
)
5015 stac92xx_shutup(codec
);
5020 static struct hda_codec_ops stac92xx_patch_ops
= {
5021 .build_controls
= stac92xx_build_controls
,
5022 .build_pcms
= stac92xx_build_pcms
,
5023 .init
= stac92xx_init
,
5024 .free
= stac92xx_free
,
5025 .unsol_event
= stac92xx_unsol_event
,
5026 #ifdef SND_HDA_NEEDS_RESUME
5027 .suspend
= stac92xx_suspend
,
5028 .resume
= stac92xx_resume
,
5030 .reboot_notify
= stac92xx_shutup
,
5033 static int patch_stac9200(struct hda_codec
*codec
)
5035 struct sigmatel_spec
*spec
;
5038 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5042 codec
->no_trigger_sense
= 1;
5044 spec
->linear_tone_beep
= 1;
5045 spec
->num_pins
= ARRAY_SIZE(stac9200_pin_nids
);
5046 spec
->pin_nids
= stac9200_pin_nids
;
5047 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9200_MODELS
,
5050 if (spec
->board_config
< 0)
5051 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5054 stac92xx_set_config_regs(codec
,
5055 stac9200_brd_tbl
[spec
->board_config
]);
5057 spec
->multiout
.max_channels
= 2;
5058 spec
->multiout
.num_dacs
= 1;
5059 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
5060 spec
->adc_nids
= stac9200_adc_nids
;
5061 spec
->mux_nids
= stac9200_mux_nids
;
5062 spec
->num_muxes
= 1;
5063 spec
->num_dmics
= 0;
5067 if (spec
->board_config
== STAC_9200_M4
||
5068 spec
->board_config
== STAC_9200_M4_2
||
5069 spec
->board_config
== STAC_9200_OQO
)
5070 spec
->init
= stac9200_eapd_init
;
5072 spec
->init
= stac9200_core_init
;
5073 spec
->mixer
= stac9200_mixer
;
5075 if (spec
->board_config
== STAC_9200_PANASONIC
) {
5076 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
5077 spec
->gpio_data
= 0x00;
5080 err
= stac9200_parse_auto_config(codec
);
5082 stac92xx_free(codec
);
5086 /* CF-74 has no headphone detection, and the driver should *NOT*
5087 * do detection and HP/speaker toggle because the hardware does it.
5089 if (spec
->board_config
== STAC_9200_PANASONIC
)
5090 spec
->hp_detect
= 0;
5092 codec
->patch_ops
= stac92xx_patch_ops
;
5097 static int patch_stac925x(struct hda_codec
*codec
)
5099 struct sigmatel_spec
*spec
;
5102 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5106 codec
->no_trigger_sense
= 1;
5108 spec
->linear_tone_beep
= 1;
5109 spec
->num_pins
= ARRAY_SIZE(stac925x_pin_nids
);
5110 spec
->pin_nids
= stac925x_pin_nids
;
5112 /* Check first for codec ID */
5113 spec
->board_config
= snd_hda_check_board_codec_sid_config(codec
,
5116 stac925x_codec_id_cfg_tbl
);
5118 /* Now checks for PCI ID, if codec ID is not found */
5119 if (spec
->board_config
< 0)
5120 spec
->board_config
= snd_hda_check_board_config(codec
,
5125 if (spec
->board_config
< 0)
5126 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5129 stac92xx_set_config_regs(codec
,
5130 stac925x_brd_tbl
[spec
->board_config
]);
5132 spec
->multiout
.max_channels
= 2;
5133 spec
->multiout
.num_dacs
= 1;
5134 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
5135 spec
->adc_nids
= stac925x_adc_nids
;
5136 spec
->mux_nids
= stac925x_mux_nids
;
5137 spec
->num_muxes
= 1;
5140 switch (codec
->vendor_id
) {
5141 case 0x83847632: /* STAC9202 */
5142 case 0x83847633: /* STAC9202D */
5143 case 0x83847636: /* STAC9251 */
5144 case 0x83847637: /* STAC9251D */
5145 spec
->num_dmics
= STAC925X_NUM_DMICS
;
5146 spec
->dmic_nids
= stac925x_dmic_nids
;
5147 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
5148 spec
->dmux_nids
= stac925x_dmux_nids
;
5151 spec
->num_dmics
= 0;
5155 spec
->init
= stac925x_core_init
;
5156 spec
->mixer
= stac925x_mixer
;
5158 spec
->capvols
= stac925x_capvols
;
5159 spec
->capsws
= stac925x_capsws
;
5161 err
= stac92xx_parse_auto_config(codec
, 0x8, 0x7);
5163 if (spec
->board_config
< 0) {
5164 printk(KERN_WARNING
"hda_codec: No auto-config is "
5165 "available, default to model=ref\n");
5166 spec
->board_config
= STAC_925x_REF
;
5172 stac92xx_free(codec
);
5176 codec
->patch_ops
= stac92xx_patch_ops
;
5181 static int patch_stac92hd73xx(struct hda_codec
*codec
)
5183 struct sigmatel_spec
*spec
;
5184 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
5188 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5192 codec
->no_trigger_sense
= 1;
5194 spec
->linear_tone_beep
= 0;
5195 codec
->slave_dig_outs
= stac92hd73xx_slave_dig_outs
;
5196 spec
->num_pins
= ARRAY_SIZE(stac92hd73xx_pin_nids
);
5197 spec
->pin_nids
= stac92hd73xx_pin_nids
;
5198 spec
->board_config
= snd_hda_check_board_config(codec
,
5199 STAC_92HD73XX_MODELS
,
5200 stac92hd73xx_models
,
5201 stac92hd73xx_cfg_tbl
);
5202 /* check codec subsystem id if not found */
5203 if (spec
->board_config
< 0)
5204 spec
->board_config
=
5205 snd_hda_check_board_codec_sid_config(codec
,
5206 STAC_92HD73XX_MODELS
, stac92hd73xx_models
,
5207 stac92hd73xx_codec_id_cfg_tbl
);
5209 if (spec
->board_config
< 0)
5210 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5213 stac92xx_set_config_regs(codec
,
5214 stac92hd73xx_brd_tbl
[spec
->board_config
]);
5216 num_dacs
= snd_hda_get_connections(codec
, 0x0a,
5217 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
5219 if (num_dacs
< 3 || num_dacs
> 5) {
5220 printk(KERN_WARNING
"hda_codec: Could not determine "
5221 "number of channels defaulting to DAC count\n");
5222 num_dacs
= STAC92HD73_DAC_COUNT
;
5224 spec
->init
= stac92hd73xx_core_init
;
5226 case 0x3: /* 6 Channel */
5227 spec
->aloopback_ctl
= stac92hd73xx_6ch_loopback
;
5229 case 0x4: /* 8 Channel */
5230 spec
->aloopback_ctl
= stac92hd73xx_8ch_loopback
;
5232 case 0x5: /* 10 Channel */
5233 spec
->aloopback_ctl
= stac92hd73xx_10ch_loopback
;
5236 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5238 spec
->aloopback_mask
= 0x01;
5239 spec
->aloopback_shift
= 8;
5241 spec
->digbeep_nid
= 0x1c;
5242 spec
->mux_nids
= stac92hd73xx_mux_nids
;
5243 spec
->adc_nids
= stac92hd73xx_adc_nids
;
5244 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
5245 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
5246 spec
->smux_nids
= stac92hd73xx_smux_nids
;
5248 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
5249 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
5250 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
5252 spec
->num_caps
= STAC92HD73XX_NUM_CAPS
;
5253 spec
->capvols
= stac92hd73xx_capvols
;
5254 spec
->capsws
= stac92hd73xx_capsws
;
5256 switch (spec
->board_config
) {
5258 spec
->init
= dell_eq_core_init
;
5260 case STAC_DELL_M6_AMIC
:
5261 case STAC_DELL_M6_DMIC
:
5262 case STAC_DELL_M6_BOTH
:
5263 spec
->num_smuxes
= 0;
5264 spec
->eapd_switch
= 0;
5266 switch (spec
->board_config
) {
5267 case STAC_DELL_M6_AMIC
: /* Analog Mics */
5268 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
5269 spec
->num_dmics
= 0;
5271 case STAC_DELL_M6_DMIC
: /* Digital Mics */
5272 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
5273 spec
->num_dmics
= 1;
5275 case STAC_DELL_M6_BOTH
: /* Both */
5276 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
5277 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
5278 spec
->num_dmics
= 1;
5282 case STAC_ALIENWARE_M17X
:
5283 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
5284 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
5285 spec
->eapd_switch
= 0;
5288 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
5289 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
5290 spec
->eapd_switch
= 1;
5293 if (spec
->board_config
!= STAC_92HD73XX_REF
) {
5294 /* GPIO0 High = Enable EAPD */
5295 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
5296 spec
->gpio_data
= 0x01;
5299 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
5300 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
5302 err
= stac92xx_parse_auto_config(codec
, 0x25, 0x27);
5305 if (spec
->board_config
< 0) {
5306 printk(KERN_WARNING
"hda_codec: No auto-config is "
5307 "available, default to model=ref\n");
5308 spec
->board_config
= STAC_92HD73XX_REF
;
5315 stac92xx_free(codec
);
5319 if (spec
->board_config
== STAC_92HD73XX_NO_JD
)
5320 spec
->hp_detect
= 0;
5322 codec
->patch_ops
= stac92xx_patch_ops
;
5324 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
5329 static int stac92hd83xxx_set_system_btl_amp(struct hda_codec
*codec
)
5331 if (codec
->vendor_id
!= 0x111d7605 &&
5332 codec
->vendor_id
!= 0x111d76d1)
5335 switch (codec
->subsystem_id
) {
5398 /* set BTL amp level to 13.43dB for louder speaker output */
5399 return snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
5405 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
5407 struct sigmatel_spec
*spec
;
5408 hda_nid_t conn
[STAC92HD83_DAC_COUNT
+ 1];
5412 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5416 /* reset pin power-down; Windows may leave these bits after reboot */
5417 snd_hda_codec_write_cache(codec
, codec
->afg
, 0, 0x7EC, 0);
5418 snd_hda_codec_write_cache(codec
, codec
->afg
, 0, 0x7ED, 0);
5419 codec
->no_trigger_sense
= 1;
5421 spec
->linear_tone_beep
= 1;
5422 codec
->slave_dig_outs
= stac92hd83xxx_slave_dig_outs
;
5423 spec
->digbeep_nid
= 0x21;
5424 spec
->dmic_nids
= stac92hd83xxx_dmic_nids
;
5425 spec
->dmux_nids
= stac92hd83xxx_mux_nids
;
5426 spec
->mux_nids
= stac92hd83xxx_mux_nids
;
5427 spec
->num_muxes
= ARRAY_SIZE(stac92hd83xxx_mux_nids
);
5428 spec
->adc_nids
= stac92hd83xxx_adc_nids
;
5429 spec
->num_adcs
= ARRAY_SIZE(stac92hd83xxx_adc_nids
);
5430 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
5431 spec
->pwr_mapping
= stac92hd83xxx_pwr_mapping
;
5432 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
5433 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5435 spec
->init
= stac92hd83xxx_core_init
;
5436 spec
->num_pins
= ARRAY_SIZE(stac92hd83xxx_pin_nids
);
5437 spec
->pin_nids
= stac92hd83xxx_pin_nids
;
5438 spec
->num_caps
= STAC92HD83XXX_NUM_CAPS
;
5439 spec
->capvols
= stac92hd83xxx_capvols
;
5440 spec
->capsws
= stac92hd83xxx_capsws
;
5442 spec
->board_config
= snd_hda_check_board_config(codec
,
5443 STAC_92HD83XXX_MODELS
,
5444 stac92hd83xxx_models
,
5445 stac92hd83xxx_cfg_tbl
);
5447 if (spec
->board_config
< 0)
5448 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5451 stac92xx_set_config_regs(codec
,
5452 stac92hd83xxx_brd_tbl
[spec
->board_config
]);
5454 switch (codec
->vendor_id
) {
5461 spec
->num_pins
= ARRAY_SIZE(stac92hd88xxx_pin_nids
);
5462 spec
->pin_nids
= stac92hd88xxx_pin_nids
;
5464 spec
->digbeep_nid
= 0;
5472 if (spec
->board_config
== STAC_92HD83XXX_PWR_REF
)
5475 spec
->num_dmics
= stac92xx_connected_ports(codec
,
5476 stac92hd83xxx_dmic_nids
,
5477 STAC92HD83XXX_NUM_DMICS
);
5481 codec
->patch_ops
= stac92xx_patch_ops
;
5483 if (find_mute_led_gpio(codec
, 0))
5484 snd_printd("mute LED gpio %d polarity %d\n",
5486 spec
->gpio_led_polarity
);
5488 #ifdef CONFIG_SND_HDA_POWER_SAVE
5489 if (spec
->gpio_led
) {
5490 spec
->gpio_mask
|= spec
->gpio_led
;
5491 spec
->gpio_dir
|= spec
->gpio_led
;
5492 spec
->gpio_data
|= spec
->gpio_led
;
5493 /* register check_power_status callback. */
5494 codec
->patch_ops
.check_power_status
=
5495 stac92xx_hp_check_power_status
;
5499 err
= stac92xx_parse_auto_config(codec
, 0x1d, 0);
5501 if (spec
->board_config
< 0) {
5502 printk(KERN_WARNING
"hda_codec: No auto-config is "
5503 "available, default to model=ref\n");
5504 spec
->board_config
= STAC_92HD83XXX_REF
;
5511 stac92xx_free(codec
);
5515 /* docking output support */
5516 num_dacs
= snd_hda_get_connections(codec
, 0xF,
5517 conn
, STAC92HD83_DAC_COUNT
+ 1) - 1;
5518 /* skip non-DAC connections */
5519 while (num_dacs
>= 0 &&
5520 (get_wcaps_type(get_wcaps(codec
, conn
[num_dacs
]))
5523 /* set port E and F to select the last DAC */
5524 if (num_dacs
>= 0) {
5525 snd_hda_codec_write_cache(codec
, 0xE, 0,
5526 AC_VERB_SET_CONNECT_SEL
, num_dacs
);
5527 snd_hda_codec_write_cache(codec
, 0xF, 0,
5528 AC_VERB_SET_CONNECT_SEL
, num_dacs
);
5531 stac92hd83xxx_set_system_btl_amp(codec
);
5533 codec
->proc_widget_hook
= stac92hd_proc_hook
;
5538 static int stac92hd71bxx_connected_smuxes(struct hda_codec
*codec
,
5541 struct sigmatel_spec
*spec
= codec
->spec
;
5544 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
5545 if (spec
->pin_nids
[idx
] == dig0pin
)
5547 if ((idx
+ 2) >= spec
->num_pins
)
5551 if (stac_get_defcfg_connect(codec
, idx
+ 1) != AC_JACK_PORT_NONE
)
5554 /* dig0pin + dig2pin case */
5555 if (stac_get_defcfg_connect(codec
, idx
+ 2) != AC_JACK_PORT_NONE
)
5557 if (stac_get_defcfg_connect(codec
, idx
) != AC_JACK_PORT_NONE
)
5563 /* HP dv7 bass switch - GPIO5 */
5564 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5565 static int stac_hp_bass_gpio_get(struct snd_kcontrol
*kcontrol
,
5566 struct snd_ctl_elem_value
*ucontrol
)
5568 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5569 struct sigmatel_spec
*spec
= codec
->spec
;
5570 ucontrol
->value
.integer
.value
[0] = !!(spec
->gpio_data
& 0x20);
5574 static int stac_hp_bass_gpio_put(struct snd_kcontrol
*kcontrol
,
5575 struct snd_ctl_elem_value
*ucontrol
)
5577 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5578 struct sigmatel_spec
*spec
= codec
->spec
;
5579 unsigned int gpio_data
;
5581 gpio_data
= (spec
->gpio_data
& ~0x20) |
5582 (ucontrol
->value
.integer
.value
[0] ? 0x20 : 0);
5583 if (gpio_data
== spec
->gpio_data
)
5585 spec
->gpio_data
= gpio_data
;
5586 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, spec
->gpio_data
);
5590 static struct snd_kcontrol_new stac_hp_bass_sw_ctrl
= {
5591 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5592 .info
= stac_hp_bass_gpio_info
,
5593 .get
= stac_hp_bass_gpio_get
,
5594 .put
= stac_hp_bass_gpio_put
,
5597 static int stac_add_hp_bass_switch(struct hda_codec
*codec
)
5599 struct sigmatel_spec
*spec
= codec
->spec
;
5601 if (!stac_control_new(spec
, &stac_hp_bass_sw_ctrl
,
5602 "Bass Speaker Playback Switch", 0))
5605 spec
->gpio_mask
|= 0x20;
5606 spec
->gpio_dir
|= 0x20;
5607 spec
->gpio_data
|= 0x20;
5611 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
5613 struct sigmatel_spec
*spec
;
5614 struct hda_verb
*unmute_init
= stac92hd71bxx_unmute_core_init
;
5615 unsigned int pin_cfg
;
5618 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5622 codec
->no_trigger_sense
= 1;
5624 spec
->linear_tone_beep
= 0;
5625 codec
->patch_ops
= stac92xx_patch_ops
;
5626 spec
->num_pins
= STAC92HD71BXX_NUM_PINS
;
5627 switch (codec
->vendor_id
) {
5630 spec
->pin_nids
= stac92hd71bxx_pin_nids_4port
;
5634 /* On 92HD75Bx 0x27 isn't a pin nid */
5638 spec
->pin_nids
= stac92hd71bxx_pin_nids_6port
;
5640 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
5641 spec
->board_config
= snd_hda_check_board_config(codec
,
5642 STAC_92HD71BXX_MODELS
,
5643 stac92hd71bxx_models
,
5644 stac92hd71bxx_cfg_tbl
);
5646 if (spec
->board_config
< 0)
5647 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5650 stac92xx_set_config_regs(codec
,
5651 stac92hd71bxx_brd_tbl
[spec
->board_config
]);
5653 if (spec
->board_config
!= STAC_92HD71BXX_REF
) {
5655 spec
->gpio_mask
= 0x01;
5656 spec
->gpio_dir
= 0x01;
5657 spec
->gpio_data
= 0x01;
5660 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
5661 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
5663 spec
->num_caps
= STAC92HD71BXX_NUM_CAPS
;
5664 spec
->capvols
= stac92hd71bxx_capvols
;
5665 spec
->capsws
= stac92hd71bxx_capsws
;
5667 switch (codec
->vendor_id
) {
5668 case 0x111d76b6: /* 4 Port without Analog Mixer */
5672 case 0x111d76b4: /* 6 Port without Analog Mixer */
5674 spec
->init
= stac92hd71bxx_core_init
;
5675 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
5676 spec
->num_dmics
= stac92xx_connected_ports(codec
,
5677 stac92hd71bxx_dmic_nids
,
5678 STAC92HD71BXX_NUM_DMICS
);
5680 case 0x111d7608: /* 5 Port with Analog Mixer */
5681 switch (spec
->board_config
) {
5683 /* Enable VREF power saving on GPIO1 detect */
5684 err
= stac_add_event(spec
, codec
->afg
,
5685 STAC_VREF_EVENT
, 0x02);
5688 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
5689 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x02);
5690 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
5691 AC_VERB_SET_UNSOLICITED_ENABLE
,
5693 spec
->gpio_mask
|= 0x02;
5696 if ((codec
->revision_id
& 0xf) == 0 ||
5697 (codec
->revision_id
& 0xf) == 1)
5698 spec
->stream_delay
= 40; /* 40 milliseconds */
5700 /* no output amps */
5703 spec
->init
= stac92hd71bxx_core_init
;
5705 snd_hda_codec_set_pincfg(codec
, 0x0f, 0x40f000f0);
5706 snd_hda_codec_set_pincfg(codec
, 0x19, 0x40f000f3);
5707 stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
- 1] = 0;
5708 spec
->num_dmics
= stac92xx_connected_ports(codec
,
5709 stac92hd71bxx_dmic_nids
,
5710 STAC92HD71BXX_NUM_DMICS
- 1);
5712 case 0x111d7603: /* 6 Port with Analog Mixer */
5713 if ((codec
->revision_id
& 0xf) == 1)
5714 spec
->stream_delay
= 40; /* 40 milliseconds */
5716 /* no output amps */
5720 spec
->init
= stac92hd71bxx_core_init
;
5721 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
5722 spec
->num_dmics
= stac92xx_connected_ports(codec
,
5723 stac92hd71bxx_dmic_nids
,
5724 STAC92HD71BXX_NUM_DMICS
);
5728 if (get_wcaps(codec
, 0xa) & AC_WCAP_IN_AMP
)
5729 snd_hda_sequence_write_cache(codec
, unmute_init
);
5731 /* Some HP machines seem to have unstable codec communications
5732 * especially with ATI fglrx driver. For recovering from the
5733 * CORB/RIRB stall, allow the BUS reset and keep always sync
5735 if (spec
->board_config
== STAC_HP_DV5
) {
5736 codec
->bus
->sync_write
= 1;
5737 codec
->bus
->allow_bus_reset
= 1;
5740 spec
->aloopback_ctl
= stac92hd71bxx_loopback
;
5741 spec
->aloopback_mask
= 0x50;
5742 spec
->aloopback_shift
= 0;
5744 spec
->powerdown_adcs
= 1;
5745 spec
->digbeep_nid
= 0x26;
5746 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
5747 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
5748 spec
->smux_nids
= stac92hd71bxx_smux_nids
;
5749 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
5751 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
5752 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
5753 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
5754 spec
->num_smuxes
= stac92hd71bxx_connected_smuxes(codec
, 0x1e);
5756 snd_printdd("Found board config: %d\n", spec
->board_config
);
5758 switch (spec
->board_config
) {
5760 /* enable internal microphone */
5761 snd_hda_codec_set_pincfg(codec
, 0x0e, 0x01813040);
5762 stac92xx_auto_set_pinctl(codec
, 0x0e,
5763 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
);
5765 case STAC_DELL_M4_2
:
5766 spec
->num_dmics
= 0;
5767 spec
->num_smuxes
= 0;
5768 spec
->num_dmuxes
= 0;
5770 case STAC_DELL_M4_1
:
5771 case STAC_DELL_M4_3
:
5772 spec
->num_dmics
= 1;
5773 spec
->num_smuxes
= 0;
5774 spec
->num_dmuxes
= 1;
5776 case STAC_HP_DV4_1222NR
:
5777 spec
->num_dmics
= 1;
5778 /* I don't know if it needs 1 or 2 smuxes - will wait for
5779 * bug reports to fix if needed
5781 spec
->num_smuxes
= 1;
5782 spec
->num_dmuxes
= 1;
5785 spec
->gpio_led
= 0x01;
5788 snd_hda_codec_set_pincfg(codec
, 0x0d, 0x90170010);
5789 stac92xx_auto_set_pinctl(codec
, 0x0d, AC_PINCTL_OUT_EN
);
5790 /* HP dv6 gives the headphone pin as a line-out. Thus we
5791 * need to set hp_detect flag here to force to enable HP
5794 spec
->hp_detect
= 1;
5797 spec
->num_dmics
= 1;
5798 spec
->num_dmuxes
= 1;
5799 spec
->num_smuxes
= 1;
5800 spec
->gpio_led
= 0x08;
5804 if (hp_blike_system(codec
->subsystem_id
)) {
5805 pin_cfg
= snd_hda_codec_get_pincfg(codec
, 0x0f);
5806 if (get_defcfg_device(pin_cfg
) == AC_JACK_LINE_OUT
||
5807 get_defcfg_device(pin_cfg
) == AC_JACK_SPEAKER
||
5808 get_defcfg_device(pin_cfg
) == AC_JACK_HP_OUT
) {
5809 /* It was changed in the BIOS to just satisfy MS DTM.
5810 * Lets turn it back into slaved HP
5812 pin_cfg
= (pin_cfg
& (~AC_DEFCFG_DEVICE
))
5813 | (AC_JACK_HP_OUT
<<
5814 AC_DEFCFG_DEVICE_SHIFT
);
5815 pin_cfg
= (pin_cfg
& (~(AC_DEFCFG_DEF_ASSOC
5816 | AC_DEFCFG_SEQUENCE
)))
5818 snd_hda_codec_set_pincfg(codec
, 0x0f, pin_cfg
);
5822 if (find_mute_led_gpio(codec
, 1))
5823 snd_printd("mute LED gpio %d polarity %d\n",
5825 spec
->gpio_led_polarity
);
5827 #ifdef CONFIG_SND_HDA_POWER_SAVE
5828 if (spec
->gpio_led
) {
5829 spec
->gpio_mask
|= spec
->gpio_led
;
5830 spec
->gpio_dir
|= spec
->gpio_led
;
5831 spec
->gpio_data
|= spec
->gpio_led
;
5832 /* register check_power_status callback. */
5833 codec
->patch_ops
.check_power_status
=
5834 stac92xx_hp_check_power_status
;
5838 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5840 err
= stac92xx_parse_auto_config(codec
, 0x21, 0);
5842 if (spec
->board_config
< 0) {
5843 printk(KERN_WARNING
"hda_codec: No auto-config is "
5844 "available, default to model=ref\n");
5845 spec
->board_config
= STAC_92HD71BXX_REF
;
5852 stac92xx_free(codec
);
5856 /* enable bass on HP dv7 */
5857 if (spec
->board_config
== STAC_HP_DV4
||
5858 spec
->board_config
== STAC_HP_DV5
) {
5860 cap
= snd_hda_param_read(codec
, 0x1, AC_PAR_GPIO_CAP
);
5861 cap
&= AC_GPIO_IO_COUNT
;
5863 stac_add_hp_bass_switch(codec
);
5866 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
5871 static int patch_stac922x(struct hda_codec
*codec
)
5873 struct sigmatel_spec
*spec
;
5876 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5880 codec
->no_trigger_sense
= 1;
5882 spec
->linear_tone_beep
= 1;
5883 spec
->num_pins
= ARRAY_SIZE(stac922x_pin_nids
);
5884 spec
->pin_nids
= stac922x_pin_nids
;
5885 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_922X_MODELS
,
5888 if (spec
->board_config
== STAC_INTEL_MAC_AUTO
) {
5889 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
5890 spec
->gpio_data
= 0x03;
5891 /* Intel Macs have all same PCI SSID, so we need to check
5892 * codec SSID to distinguish the exact models
5894 printk(KERN_INFO
"hda_codec: STAC922x, Apple subsys_id=%x\n", codec
->subsystem_id
);
5895 switch (codec
->subsystem_id
) {
5898 spec
->board_config
= STAC_INTEL_MAC_V1
;
5902 spec
->board_config
= STAC_INTEL_MAC_V2
;
5910 spec
->board_config
= STAC_INTEL_MAC_V3
;
5914 spec
->board_config
= STAC_INTEL_MAC_V4
;
5918 spec
->board_config
= STAC_INTEL_MAC_V5
;
5921 spec
->board_config
= STAC_INTEL_MAC_V3
;
5927 if (spec
->board_config
< 0)
5928 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5931 stac92xx_set_config_regs(codec
,
5932 stac922x_brd_tbl
[spec
->board_config
]);
5934 spec
->adc_nids
= stac922x_adc_nids
;
5935 spec
->mux_nids
= stac922x_mux_nids
;
5936 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
5937 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
5938 spec
->num_dmics
= 0;
5941 spec
->init
= stac922x_core_init
;
5943 spec
->num_caps
= STAC922X_NUM_CAPS
;
5944 spec
->capvols
= stac922x_capvols
;
5945 spec
->capsws
= stac922x_capsws
;
5947 spec
->multiout
.dac_nids
= spec
->dac_nids
;
5949 err
= stac92xx_parse_auto_config(codec
, 0x08, 0x09);
5951 if (spec
->board_config
< 0) {
5952 printk(KERN_WARNING
"hda_codec: No auto-config is "
5953 "available, default to model=ref\n");
5954 spec
->board_config
= STAC_D945_REF
;
5960 stac92xx_free(codec
);
5964 codec
->patch_ops
= stac92xx_patch_ops
;
5966 /* Fix Mux capture level; max to 2 */
5967 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
5968 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
5969 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
5970 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
5971 (0 << AC_AMPCAP_MUTE_SHIFT
));
5976 static int patch_stac927x(struct hda_codec
*codec
)
5978 struct sigmatel_spec
*spec
;
5981 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5985 codec
->no_trigger_sense
= 1;
5987 spec
->linear_tone_beep
= 1;
5988 codec
->slave_dig_outs
= stac927x_slave_dig_outs
;
5989 spec
->num_pins
= ARRAY_SIZE(stac927x_pin_nids
);
5990 spec
->pin_nids
= stac927x_pin_nids
;
5991 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_927X_MODELS
,
5995 if (spec
->board_config
< 0)
5996 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5999 stac92xx_set_config_regs(codec
,
6000 stac927x_brd_tbl
[spec
->board_config
]);
6002 spec
->digbeep_nid
= 0x23;
6003 spec
->adc_nids
= stac927x_adc_nids
;
6004 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
6005 spec
->mux_nids
= stac927x_mux_nids
;
6006 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
6007 spec
->smux_nids
= stac927x_smux_nids
;
6008 spec
->num_smuxes
= ARRAY_SIZE(stac927x_smux_nids
);
6009 spec
->spdif_labels
= stac927x_spdif_labels
;
6010 spec
->dac_list
= stac927x_dac_nids
;
6011 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6013 if (spec
->board_config
!= STAC_D965_REF
) {
6014 /* GPIO0 High = Enable EAPD */
6015 spec
->eapd_mask
= spec
->gpio_mask
= 0x01;
6016 spec
->gpio_dir
= spec
->gpio_data
= 0x01;
6019 switch (spec
->board_config
) {
6022 /* GPIO0 High = Enable EAPD */
6023 spec
->num_dmics
= 0;
6024 spec
->init
= d965_core_init
;
6026 case STAC_DELL_BIOS
:
6027 switch (codec
->subsystem_id
) {
6030 /* correct the device field to SPDIF out */
6031 snd_hda_codec_set_pincfg(codec
, 0x21, 0x01442070);
6034 /* configure the analog microphone on some laptops */
6035 snd_hda_codec_set_pincfg(codec
, 0x0c, 0x90a79130);
6036 /* correct the front output jack as a hp out */
6037 snd_hda_codec_set_pincfg(codec
, 0x0f, 0x0227011f);
6038 /* correct the front input jack as a mic */
6039 snd_hda_codec_set_pincfg(codec
, 0x0e, 0x02a79130);
6042 if (codec
->subsystem_id
!= 0x1028022f) {
6043 /* GPIO2 High = Enable EAPD */
6044 spec
->eapd_mask
= spec
->gpio_mask
= 0x04;
6045 spec
->gpio_dir
= spec
->gpio_data
= 0x04;
6047 spec
->dmic_nids
= stac927x_dmic_nids
;
6048 spec
->num_dmics
= STAC927X_NUM_DMICS
;
6050 spec
->init
= dell_3st_core_init
;
6051 spec
->dmux_nids
= stac927x_dmux_nids
;
6052 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
6054 case STAC_927X_VOLKNOB
:
6055 spec
->num_dmics
= 0;
6056 spec
->init
= stac927x_volknob_core_init
;
6059 spec
->num_dmics
= 0;
6060 spec
->init
= stac927x_core_init
;
6064 spec
->num_caps
= STAC927X_NUM_CAPS
;
6065 spec
->capvols
= stac927x_capvols
;
6066 spec
->capsws
= stac927x_capsws
;
6069 spec
->aloopback_ctl
= stac927x_loopback
;
6070 spec
->aloopback_mask
= 0x40;
6071 spec
->aloopback_shift
= 0;
6072 spec
->eapd_switch
= 1;
6074 err
= stac92xx_parse_auto_config(codec
, 0x1e, 0x20);
6076 if (spec
->board_config
< 0) {
6077 printk(KERN_WARNING
"hda_codec: No auto-config is "
6078 "available, default to model=ref\n");
6079 spec
->board_config
= STAC_D965_REF
;
6085 stac92xx_free(codec
);
6089 codec
->patch_ops
= stac92xx_patch_ops
;
6091 codec
->proc_widget_hook
= stac927x_proc_hook
;
6095 * The STAC927x seem to require fairly long delays for certain
6096 * command sequences. With too short delays (even if the answer
6097 * is set to RIRB properly), it results in the silence output
6098 * on some hardwares like Dell.
6100 * The below flag enables the longer delay (see get_response
6103 codec
->bus
->needs_damn_long_delay
= 1;
6105 /* no jack detecion for ref-no-jd model */
6106 if (spec
->board_config
== STAC_D965_REF_NO_JD
)
6107 spec
->hp_detect
= 0;
6112 static int patch_stac9205(struct hda_codec
*codec
)
6114 struct sigmatel_spec
*spec
;
6117 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6121 codec
->no_trigger_sense
= 1;
6123 spec
->linear_tone_beep
= 1;
6124 spec
->num_pins
= ARRAY_SIZE(stac9205_pin_nids
);
6125 spec
->pin_nids
= stac9205_pin_nids
;
6126 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9205_MODELS
,
6130 if (spec
->board_config
< 0)
6131 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6134 stac92xx_set_config_regs(codec
,
6135 stac9205_brd_tbl
[spec
->board_config
]);
6137 spec
->digbeep_nid
= 0x23;
6138 spec
->adc_nids
= stac9205_adc_nids
;
6139 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
6140 spec
->mux_nids
= stac9205_mux_nids
;
6141 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
6142 spec
->smux_nids
= stac9205_smux_nids
;
6143 spec
->num_smuxes
= ARRAY_SIZE(stac9205_smux_nids
);
6144 spec
->dmic_nids
= stac9205_dmic_nids
;
6145 spec
->num_dmics
= STAC9205_NUM_DMICS
;
6146 spec
->dmux_nids
= stac9205_dmux_nids
;
6147 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
6150 spec
->init
= stac9205_core_init
;
6151 spec
->aloopback_ctl
= stac9205_loopback
;
6153 spec
->num_caps
= STAC9205_NUM_CAPS
;
6154 spec
->capvols
= stac9205_capvols
;
6155 spec
->capsws
= stac9205_capsws
;
6157 spec
->aloopback_mask
= 0x40;
6158 spec
->aloopback_shift
= 0;
6159 /* Turn on/off EAPD per HP plugging */
6160 if (spec
->board_config
!= STAC_9205_EAPD
)
6161 spec
->eapd_switch
= 1;
6162 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6164 switch (spec
->board_config
){
6165 case STAC_9205_DELL_M43
:
6166 /* Enable SPDIF in/out */
6167 snd_hda_codec_set_pincfg(codec
, 0x1f, 0x01441030);
6168 snd_hda_codec_set_pincfg(codec
, 0x20, 0x1c410030);
6170 /* Enable unsol response for GPIO4/Dock HP connection */
6171 err
= stac_add_event(spec
, codec
->afg
, STAC_VREF_EVENT
, 0x01);
6174 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
6175 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
6176 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
6177 AC_VERB_SET_UNSOLICITED_ENABLE
,
6180 spec
->gpio_dir
= 0x0b;
6181 spec
->eapd_mask
= 0x01;
6182 spec
->gpio_mask
= 0x1b;
6183 spec
->gpio_mute
= 0x10;
6184 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
6187 spec
->gpio_data
= 0x01;
6190 /* SPDIF-In enabled */
6193 /* GPIO0 High = EAPD */
6194 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
6195 spec
->gpio_data
= 0x01;
6199 err
= stac92xx_parse_auto_config(codec
, 0x1f, 0x20);
6201 if (spec
->board_config
< 0) {
6202 printk(KERN_WARNING
"hda_codec: No auto-config is "
6203 "available, default to model=ref\n");
6204 spec
->board_config
= STAC_9205_REF
;
6210 stac92xx_free(codec
);
6214 codec
->patch_ops
= stac92xx_patch_ops
;
6216 codec
->proc_widget_hook
= stac9205_proc_hook
;
6225 static struct hda_verb stac9872_core_init
[] = {
6226 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
6227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
6231 static hda_nid_t stac9872_pin_nids
[] = {
6232 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6236 static hda_nid_t stac9872_adc_nids
[] = {
6240 static hda_nid_t stac9872_mux_nids
[] = {
6244 static unsigned long stac9872_capvols
[] = {
6245 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
6247 #define stac9872_capsws stac9872_capvols
6249 static unsigned int stac9872_vaio_pin_configs
[9] = {
6250 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6251 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6255 static const char *stac9872_models
[STAC_9872_MODELS
] = {
6256 [STAC_9872_AUTO
] = "auto",
6257 [STAC_9872_VAIO
] = "vaio",
6260 static unsigned int *stac9872_brd_tbl
[STAC_9872_MODELS
] = {
6261 [STAC_9872_VAIO
] = stac9872_vaio_pin_configs
,
6264 static struct snd_pci_quirk stac9872_cfg_tbl
[] = {
6265 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6266 "Sony VAIO F/S", STAC_9872_VAIO
),
6270 static int patch_stac9872(struct hda_codec
*codec
)
6272 struct sigmatel_spec
*spec
;
6275 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6278 codec
->no_trigger_sense
= 1;
6280 spec
->linear_tone_beep
= 1;
6281 spec
->num_pins
= ARRAY_SIZE(stac9872_pin_nids
);
6282 spec
->pin_nids
= stac9872_pin_nids
;
6284 spec
->board_config
= snd_hda_check_board_config(codec
, STAC_9872_MODELS
,
6287 if (spec
->board_config
< 0)
6288 snd_printdd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6291 stac92xx_set_config_regs(codec
,
6292 stac9872_brd_tbl
[spec
->board_config
]);
6294 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6295 spec
->num_adcs
= ARRAY_SIZE(stac9872_adc_nids
);
6296 spec
->adc_nids
= stac9872_adc_nids
;
6297 spec
->num_muxes
= ARRAY_SIZE(stac9872_mux_nids
);
6298 spec
->mux_nids
= stac9872_mux_nids
;
6299 spec
->init
= stac9872_core_init
;
6301 spec
->capvols
= stac9872_capvols
;
6302 spec
->capsws
= stac9872_capsws
;
6304 err
= stac92xx_parse_auto_config(codec
, 0x10, 0x12);
6306 stac92xx_free(codec
);
6309 spec
->input_mux
= &spec
->private_imux
;
6310 codec
->patch_ops
= stac92xx_patch_ops
;
6318 static struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
6319 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
6320 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
6321 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
6322 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
6323 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
6324 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
6325 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
6326 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
6327 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
6328 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
6329 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
6330 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
6331 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
6332 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
6333 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
6334 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
6335 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
6336 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
6337 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
6338 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
6339 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
6340 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
6341 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
6342 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
6343 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
6344 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
6345 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
6346 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
6347 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
6348 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
6349 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
6350 /* The following does not take into account .id=0x83847661 when subsys =
6351 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
6352 * currently not fully supported.
6354 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
6355 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
6356 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
6357 { .id
= 0x83847698, .name
= "STAC9205", .patch
= patch_stac9205
},
6358 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
6359 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
6360 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
6361 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
6362 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
6363 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
6364 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
6365 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
6366 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
6367 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
6368 { .id
= 0x111d76d4, .name
= "92HD83C1C5", .patch
= patch_stac92hd83xxx
},
6369 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
6370 { .id
= 0x111d76d5, .name
= "92HD81B1C5", .patch
= patch_stac92hd83xxx
},
6371 { .id
= 0x111d76d1, .name
= "92HD87B1/3", .patch
= patch_stac92hd83xxx
},
6372 { .id
= 0x111d76d9, .name
= "92HD87B2/4", .patch
= patch_stac92hd83xxx
},
6373 { .id
= 0x111d7666, .name
= "92HD88B3", .patch
= patch_stac92hd83xxx
},
6374 { .id
= 0x111d7667, .name
= "92HD88B1", .patch
= patch_stac92hd83xxx
},
6375 { .id
= 0x111d7668, .name
= "92HD88B2", .patch
= patch_stac92hd83xxx
},
6376 { .id
= 0x111d7669, .name
= "92HD88B4", .patch
= patch_stac92hd83xxx
},
6377 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
6378 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
6379 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
6380 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
6381 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
6382 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
6383 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
6384 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
6385 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
6386 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
6387 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
6388 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
6389 { .id
= 0x111d76c0, .name
= "92HD89C3", .patch
= patch_stac92hd73xx
},
6390 { .id
= 0x111d76c1, .name
= "92HD89C2", .patch
= patch_stac92hd73xx
},
6391 { .id
= 0x111d76c2, .name
= "92HD89C1", .patch
= patch_stac92hd73xx
},
6392 { .id
= 0x111d76c3, .name
= "92HD89B3", .patch
= patch_stac92hd73xx
},
6393 { .id
= 0x111d76c4, .name
= "92HD89B2", .patch
= patch_stac92hd73xx
},
6394 { .id
= 0x111d76c5, .name
= "92HD89B1", .patch
= patch_stac92hd73xx
},
6395 { .id
= 0x111d76c6, .name
= "92HD89E3", .patch
= patch_stac92hd73xx
},
6396 { .id
= 0x111d76c7, .name
= "92HD89E2", .patch
= patch_stac92hd73xx
},
6397 { .id
= 0x111d76c8, .name
= "92HD89E1", .patch
= patch_stac92hd73xx
},
6398 { .id
= 0x111d76c9, .name
= "92HD89D3", .patch
= patch_stac92hd73xx
},
6399 { .id
= 0x111d76ca, .name
= "92HD89D2", .patch
= patch_stac92hd73xx
},
6400 { .id
= 0x111d76cb, .name
= "92HD89D1", .patch
= patch_stac92hd73xx
},
6401 { .id
= 0x111d76cc, .name
= "92HD89F3", .patch
= patch_stac92hd73xx
},
6402 { .id
= 0x111d76cd, .name
= "92HD89F2", .patch
= patch_stac92hd73xx
},
6403 { .id
= 0x111d76ce, .name
= "92HD89F1", .patch
= patch_stac92hd73xx
},
6404 { .id
= 0x111d76e0, .name
= "92HD91BXX", .patch
= patch_stac92hd83xxx
},
6405 { .id
= 0x111d76e7, .name
= "92HD90BXX", .patch
= patch_stac92hd83xxx
},
6409 MODULE_ALIAS("snd-hda-codec-id:8384*");
6410 MODULE_ALIAS("snd-hda-codec-id:111d*");
6412 MODULE_LICENSE("GPL");
6413 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
6415 static struct hda_codec_preset_list sigmatel_list
= {
6416 .preset
= snd_hda_preset_sigmatel
,
6417 .owner
= THIS_MODULE
,
6420 static int __init
patch_sigmatel_init(void)
6422 return snd_hda_add_codec_preset(&sigmatel_list
);
6425 static void __exit
patch_sigmatel_exit(void)
6427 snd_hda_delete_codec_preset(&sigmatel_list
);
6430 module_init(patch_sigmatel_init
)
6431 module_exit(patch_sigmatel_exit
)