2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for SigmaTel STAC92xx
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
7 * Matt Porter <mporter@embeddedalley.com>
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <linux/dmi.h>
32 #include <linux/module.h>
33 #include <sound/core.h>
34 #include <sound/asoundef.h>
35 #include <sound/jack.h>
36 #include <sound/tlv.h>
37 #include "hda_codec.h"
38 #include "hda_local.h"
39 #include "hda_auto_parser.h"
82 STAC_92HD73XX_NO_JD
, /* no jack-detection */
95 STAC_92HD83XXX_PWR_REF
,
97 STAC_DELL_VOSTRO_3500
,
98 STAC_92HD83XXX_HP_cNB11_INTQUAD
,
101 STAC_92HD83XXX_HP_LED
,
102 STAC_92HD83XXX_HP_INV_LED
,
103 STAC_92HD83XXX_HP_MIC_LED
,
104 STAC_92HD83XXX_HEADSET_JACK
,
106 STAC_92HD83XXX_MODELS
120 STAC_92HD71BXX_NO_DMIC
,
121 STAC_92HD71BXX_NO_SMUX
,
122 STAC_92HD71BXX_MODELS
152 STAC_922X_INTEL_MAC_GPIO
,
157 STAC_D965_REF_NO_JD
, /* no jack-detection */
165 STAC_DELL_BIOS_SPDIF
,
176 struct sigmatel_mic_route
{
179 signed char dmux_idx
;
182 #define MAX_PINS_NUM 16
183 #define MAX_ADCS_NUM 4
184 #define MAX_DMICS_NUM 4
186 struct sigmatel_spec
{
187 struct snd_kcontrol_new
*mixers
[4];
188 unsigned int num_mixers
;
191 unsigned int eapd_switch
: 1;
192 unsigned int surr_switch
: 1;
193 unsigned int alt_switch
: 1;
194 unsigned int hp_detect
: 1;
195 unsigned int spdif_mute
: 1;
196 unsigned int check_volume_offset
:1;
197 unsigned int auto_mic
:1;
198 unsigned int linear_tone_beep
:1;
199 unsigned int headset_jack
:1; /* 4-pin headset jack (hp + mono mic) */
200 unsigned int volknob_init
:1; /* special volume-knob initialization */
203 unsigned int eapd_mask
;
204 unsigned int gpio_mask
;
205 unsigned int gpio_dir
;
206 unsigned int gpio_data
;
207 unsigned int gpio_mute
;
208 unsigned int gpio_led
;
209 unsigned int gpio_led_polarity
;
210 unsigned int vref_mute_led_nid
; /* pin NID for mute-LED vref control */
211 unsigned int vref_led
;
212 int default_polarity
;
214 unsigned int mic_mute_led_gpio
; /* capture mute LED GPIO */
215 bool mic_mute_led_on
; /* current mic mute state */
218 unsigned int stream_delay
;
220 /* analog loopback */
221 const struct snd_kcontrol_new
*aloopback_ctl
;
222 unsigned char aloopback_mask
;
223 unsigned char aloopback_shift
;
225 /* power management */
226 unsigned int power_map_bits
;
227 unsigned int num_pwrs
;
228 const hda_nid_t
*pwr_nids
;
229 const hda_nid_t
*dac_list
;
232 struct hda_input_mux
*mono_mux
;
233 unsigned int cur_mmux
;
234 struct hda_multi_out multiout
;
235 hda_nid_t dac_nids
[5];
236 hda_nid_t hp_dacs
[5];
237 hda_nid_t speaker_dacs
[5];
242 const hda_nid_t
*adc_nids
;
243 unsigned int num_adcs
;
244 const hda_nid_t
*mux_nids
;
245 unsigned int num_muxes
;
246 const hda_nid_t
*dmic_nids
;
247 unsigned int num_dmics
;
248 const hda_nid_t
*dmux_nids
;
249 unsigned int num_dmuxes
;
250 const hda_nid_t
*smux_nids
;
251 unsigned int num_smuxes
;
252 unsigned int num_analog_muxes
;
254 const unsigned long *capvols
; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
255 const unsigned long *capsws
; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
256 unsigned int num_caps
; /* number of capture volume/switch elements */
258 struct sigmatel_mic_route ext_mic
;
259 struct sigmatel_mic_route int_mic
;
260 struct sigmatel_mic_route dock_mic
;
262 const char * const *spdif_labels
;
264 hda_nid_t dig_in_nid
;
266 hda_nid_t anabeep_nid
;
267 hda_nid_t digbeep_nid
;
270 const hda_nid_t
*pin_nids
;
271 unsigned int num_pins
;
273 /* codec specific stuff */
274 const struct hda_verb
*init
;
275 const struct snd_kcontrol_new
*mixer
;
278 struct hda_input_mux
*dinput_mux
;
279 unsigned int cur_dmux
[2];
280 struct hda_input_mux
*input_mux
;
281 unsigned int cur_mux
[3];
282 struct hda_input_mux
*sinput_mux
;
283 unsigned int cur_smux
[2];
284 unsigned int cur_amux
;
286 unsigned int powerdown_adcs
;
289 unsigned int io_switch
[2];
290 unsigned int clfe_swap
;
291 hda_nid_t line_switch
; /* shared line-in for input and output */
292 hda_nid_t mic_switch
; /* shared mic-in for input and output */
293 hda_nid_t hp_switch
; /* NID of HP as line-out */
294 unsigned int aloopback
;
296 struct hda_pcm pcm_rec
[2]; /* PCM information */
298 /* dynamic controls and input_mux */
299 struct auto_pin_cfg autocfg
;
300 struct snd_array kctls
;
301 struct hda_input_mux private_dimux
;
302 struct hda_input_mux private_imux
;
303 struct hda_input_mux private_smux
;
304 struct hda_input_mux private_mono_mux
;
307 unsigned auto_pin_cnt
;
308 hda_nid_t auto_pin_nids
[MAX_PINS_NUM
];
309 unsigned auto_adc_cnt
;
310 hda_nid_t auto_adc_nids
[MAX_ADCS_NUM
];
311 hda_nid_t auto_mux_nids
[MAX_ADCS_NUM
];
312 hda_nid_t auto_dmux_nids
[MAX_ADCS_NUM
];
313 unsigned long auto_capvols
[MAX_ADCS_NUM
];
314 unsigned auto_dmic_cnt
;
315 hda_nid_t auto_dmic_nids
[MAX_DMICS_NUM
];
317 struct hda_vmaster_mute_hook vmaster_mute
;
320 #define AC_VERB_IDT_SET_POWER_MAP 0x7ec
321 #define AC_VERB_IDT_GET_POWER_MAP 0xfec
323 static const hda_nid_t stac9200_adc_nids
[1] = {
327 static const hda_nid_t stac9200_mux_nids
[1] = {
331 static const hda_nid_t stac9200_dac_nids
[1] = {
335 static const hda_nid_t stac92hd73xx_pwr_nids
[8] = {
336 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
340 static const hda_nid_t stac92hd73xx_slave_dig_outs
[2] = {
344 static const hda_nid_t stac92hd73xx_adc_nids
[2] = {
348 #define STAC92HD73XX_NUM_DMICS 2
349 static const hda_nid_t stac92hd73xx_dmic_nids
[STAC92HD73XX_NUM_DMICS
+ 1] = {
353 #define STAC92HD73_DAC_COUNT 5
355 static const hda_nid_t stac92hd73xx_mux_nids
[2] = {
359 static const hda_nid_t stac92hd73xx_dmux_nids
[2] = {
363 static const hda_nid_t stac92hd73xx_smux_nids
[2] = {
367 #define STAC92HD73XX_NUM_CAPS 2
368 static const unsigned long stac92hd73xx_capvols
[] = {
369 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT
),
370 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
372 #define stac92hd73xx_capsws stac92hd73xx_capvols
374 #define STAC92HD83_DAC_COUNT 3
376 static const hda_nid_t stac92hd83xxx_pwr_nids
[7] = {
377 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
381 static const hda_nid_t stac92hd83xxx_slave_dig_outs
[2] = {
385 static const hda_nid_t stac92hd83xxx_dmic_nids
[] = {
389 static const hda_nid_t stac92hd71bxx_pwr_nids
[3] = {
393 static const hda_nid_t stac92hd71bxx_adc_nids
[2] = {
397 static const hda_nid_t stac92hd71bxx_mux_nids
[2] = {
401 static const hda_nid_t stac92hd71bxx_dmux_nids
[2] = {
405 static const hda_nid_t stac92hd71bxx_smux_nids
[2] = {
409 #define STAC92HD71BXX_NUM_DMICS 2
410 static const hda_nid_t stac92hd71bxx_dmic_nids
[STAC92HD71BXX_NUM_DMICS
+ 1] = {
414 static const hda_nid_t stac92hd71bxx_dmic_5port_nids
[STAC92HD71BXX_NUM_DMICS
] = {
418 static const hda_nid_t stac92hd71bxx_slave_dig_outs
[2] = {
422 #define STAC92HD71BXX_NUM_CAPS 2
423 static const unsigned long stac92hd71bxx_capvols
[] = {
424 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
425 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
427 #define stac92hd71bxx_capsws stac92hd71bxx_capvols
429 static const hda_nid_t stac925x_adc_nids
[1] = {
433 static const hda_nid_t stac925x_mux_nids
[1] = {
437 static const hda_nid_t stac925x_dac_nids
[1] = {
441 #define STAC925X_NUM_DMICS 1
442 static const hda_nid_t stac925x_dmic_nids
[STAC925X_NUM_DMICS
+ 1] = {
446 static const hda_nid_t stac925x_dmux_nids
[1] = {
450 static const unsigned long stac925x_capvols
[] = {
451 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
453 static const unsigned long stac925x_capsws
[] = {
454 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
457 static const hda_nid_t stac922x_adc_nids
[2] = {
461 static const hda_nid_t stac922x_mux_nids
[2] = {
465 #define STAC922X_NUM_CAPS 2
466 static const unsigned long stac922x_capvols
[] = {
467 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT
),
468 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
470 #define stac922x_capsws stac922x_capvols
472 static const hda_nid_t stac927x_slave_dig_outs
[2] = {
476 static const hda_nid_t stac927x_adc_nids
[3] = {
480 static const hda_nid_t stac927x_mux_nids
[3] = {
484 static const hda_nid_t stac927x_smux_nids
[1] = {
488 static const hda_nid_t stac927x_dac_nids
[6] = {
489 0x02, 0x03, 0x04, 0x05, 0x06, 0
492 static const hda_nid_t stac927x_dmux_nids
[1] = {
496 #define STAC927X_NUM_DMICS 2
497 static const hda_nid_t stac927x_dmic_nids
[STAC927X_NUM_DMICS
+ 1] = {
501 #define STAC927X_NUM_CAPS 3
502 static const unsigned long stac927x_capvols
[] = {
503 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT
),
504 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT
),
505 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT
),
507 static const unsigned long stac927x_capsws
[] = {
508 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
509 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT
),
510 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
513 static const char * const stac927x_spdif_labels
[5] = {
514 "Digital Playback", "ADAT", "Analog Mux 1",
515 "Analog Mux 2", "Analog Mux 3"
518 static const hda_nid_t stac9205_adc_nids
[2] = {
522 static const hda_nid_t stac9205_mux_nids
[2] = {
526 static const hda_nid_t stac9205_dmux_nids
[1] = {
530 static const hda_nid_t stac9205_smux_nids
[1] = {
534 #define STAC9205_NUM_DMICS 2
535 static const hda_nid_t stac9205_dmic_nids
[STAC9205_NUM_DMICS
+ 1] = {
539 #define STAC9205_NUM_CAPS 2
540 static const unsigned long stac9205_capvols
[] = {
541 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT
),
542 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT
),
544 static const unsigned long stac9205_capsws
[] = {
545 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT
),
546 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT
),
549 static const hda_nid_t stac9200_pin_nids
[8] = {
550 0x08, 0x09, 0x0d, 0x0e,
551 0x0f, 0x10, 0x11, 0x12,
554 static const hda_nid_t stac925x_pin_nids
[8] = {
555 0x07, 0x08, 0x0a, 0x0b,
556 0x0c, 0x0d, 0x10, 0x11,
559 static const hda_nid_t stac922x_pin_nids
[10] = {
560 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
561 0x0f, 0x10, 0x11, 0x15, 0x1b,
564 static const hda_nid_t stac92hd73xx_pin_nids
[13] = {
565 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
566 0x0f, 0x10, 0x11, 0x12, 0x13,
570 #define STAC92HD71BXX_NUM_PINS 13
571 static const hda_nid_t stac92hd71bxx_pin_nids_4port
[STAC92HD71BXX_NUM_PINS
] = {
572 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
573 0x00, 0x14, 0x18, 0x19, 0x1e,
576 static const hda_nid_t stac92hd71bxx_pin_nids_6port
[STAC92HD71BXX_NUM_PINS
] = {
577 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
578 0x0f, 0x14, 0x18, 0x19, 0x1e,
582 static const hda_nid_t stac927x_pin_nids
[14] = {
583 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
584 0x0f, 0x10, 0x11, 0x12, 0x13,
585 0x14, 0x21, 0x22, 0x23,
588 static const hda_nid_t stac9205_pin_nids
[12] = {
589 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
590 0x0f, 0x14, 0x16, 0x17, 0x18,
594 static int stac_add_event(struct hda_codec
*codec
, hda_nid_t nid
,
595 unsigned char type
, int data
);
596 static int stac_add_hp_bass_switch(struct hda_codec
*codec
);
597 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
,
598 hda_nid_t nid
, int pin_type
);
599 static int hp_bnb2011_with_dock(struct hda_codec
*codec
);
600 static int hp_blike_system(u32 subsystem_id
);
601 static int find_mute_led_cfg(struct hda_codec
*codec
, int default_polarity
);
603 static int stac92xx_dmux_enum_info(struct snd_kcontrol
*kcontrol
,
604 struct snd_ctl_elem_info
*uinfo
)
606 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
607 struct sigmatel_spec
*spec
= codec
->spec
;
608 return snd_hda_input_mux_info(spec
->dinput_mux
, uinfo
);
611 static int stac92xx_dmux_enum_get(struct snd_kcontrol
*kcontrol
,
612 struct snd_ctl_elem_value
*ucontrol
)
614 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
615 struct sigmatel_spec
*spec
= codec
->spec
;
616 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
618 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_dmux
[dmux_idx
];
622 static int stac92xx_dmux_enum_put(struct snd_kcontrol
*kcontrol
,
623 struct snd_ctl_elem_value
*ucontrol
)
625 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
626 struct sigmatel_spec
*spec
= codec
->spec
;
627 unsigned int dmux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
629 return snd_hda_input_mux_put(codec
, spec
->dinput_mux
, ucontrol
,
630 spec
->dmux_nids
[dmux_idx
], &spec
->cur_dmux
[dmux_idx
]);
633 static int stac92xx_smux_enum_info(struct snd_kcontrol
*kcontrol
,
634 struct snd_ctl_elem_info
*uinfo
)
636 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
637 struct sigmatel_spec
*spec
= codec
->spec
;
638 return snd_hda_input_mux_info(spec
->sinput_mux
, uinfo
);
641 static int stac92xx_smux_enum_get(struct snd_kcontrol
*kcontrol
,
642 struct snd_ctl_elem_value
*ucontrol
)
644 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
645 struct sigmatel_spec
*spec
= codec
->spec
;
646 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
648 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_smux
[smux_idx
];
652 static int stac92xx_smux_enum_put(struct snd_kcontrol
*kcontrol
,
653 struct snd_ctl_elem_value
*ucontrol
)
655 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
656 struct sigmatel_spec
*spec
= codec
->spec
;
657 struct hda_input_mux
*smux
= &spec
->private_smux
;
658 unsigned int smux_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
662 err
= snd_hda_input_mux_put(codec
, spec
->sinput_mux
, ucontrol
,
663 spec
->smux_nids
[smux_idx
], &spec
->cur_smux
[smux_idx
]);
667 if (spec
->spdif_mute
) {
669 nid
= spec
->multiout
.dig_out_nid
;
671 nid
= codec
->slave_dig_outs
[smux_idx
- 1];
672 if (spec
->cur_smux
[smux_idx
] == smux
->num_items
- 1)
676 /* un/mute SPDIF out */
677 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
683 static int stac_vrefout_set(struct hda_codec
*codec
,
684 hda_nid_t nid
, unsigned int new_vref
)
688 snd_printdd("%s, nid %x ctl %x\n", __func__
, nid
, new_vref
);
689 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
690 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
696 pinctl
&= ~AC_PINCTL_VREFEN
;
697 pinctl
|= (new_vref
& AC_PINCTL_VREFEN
);
699 error
= snd_hda_set_pin_ctl_cache(codec
, nid
, pinctl
);
706 static unsigned int stac92xx_vref_set(struct hda_codec
*codec
,
707 hda_nid_t nid
, unsigned int new_vref
)
711 pincfg
= snd_hda_codec_read(codec
, nid
, 0,
712 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
715 pincfg
&= ~(AC_PINCTL_VREFEN
| AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
718 if (new_vref
== AC_PINCTL_VREF_HIZ
)
719 pincfg
|= AC_PINCTL_OUT_EN
;
721 pincfg
|= AC_PINCTL_IN_EN
;
723 error
= snd_hda_set_pin_ctl_cache(codec
, nid
, pincfg
);
730 static unsigned int stac92xx_vref_get(struct hda_codec
*codec
, hda_nid_t nid
)
733 vref
= snd_hda_codec_read(codec
, nid
, 0,
734 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
735 vref
&= AC_PINCTL_VREFEN
;
739 static int stac92xx_mux_enum_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
741 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
742 struct sigmatel_spec
*spec
= codec
->spec
;
743 return snd_hda_input_mux_info(spec
->input_mux
, uinfo
);
746 static int stac92xx_mux_enum_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
748 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
749 struct sigmatel_spec
*spec
= codec
->spec
;
750 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
752 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
756 static int stac92xx_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
758 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
759 struct sigmatel_spec
*spec
= codec
->spec
;
760 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
761 const struct hda_input_mux
*imux
= spec
->input_mux
;
762 unsigned int idx
, prev_idx
, didx
;
764 idx
= ucontrol
->value
.enumerated
.item
[0];
765 if (idx
>= imux
->num_items
)
766 idx
= imux
->num_items
- 1;
767 prev_idx
= spec
->cur_mux
[adc_idx
];
770 if (idx
< spec
->num_analog_muxes
) {
771 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[adc_idx
], 0,
772 AC_VERB_SET_CONNECT_SEL
,
773 imux
->items
[idx
].index
);
774 if (prev_idx
>= spec
->num_analog_muxes
&&
775 spec
->mux_nids
[adc_idx
] != spec
->dmux_nids
[adc_idx
]) {
776 imux
= spec
->dinput_mux
;
778 snd_hda_codec_write_cache(codec
,
779 spec
->dmux_nids
[adc_idx
], 0,
780 AC_VERB_SET_CONNECT_SEL
,
781 imux
->items
[0].index
);
784 imux
= spec
->dinput_mux
;
785 /* first dimux item is hardcoded to select analog imux,
788 didx
= idx
- spec
->num_analog_muxes
+ 1;
789 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[adc_idx
], 0,
790 AC_VERB_SET_CONNECT_SEL
,
791 imux
->items
[didx
].index
);
793 spec
->cur_mux
[adc_idx
] = idx
;
797 static int stac92xx_mono_mux_enum_info(struct snd_kcontrol
*kcontrol
,
798 struct snd_ctl_elem_info
*uinfo
)
800 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
801 struct sigmatel_spec
*spec
= codec
->spec
;
802 return snd_hda_input_mux_info(spec
->mono_mux
, uinfo
);
805 static int stac92xx_mono_mux_enum_get(struct snd_kcontrol
*kcontrol
,
806 struct snd_ctl_elem_value
*ucontrol
)
808 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
809 struct sigmatel_spec
*spec
= codec
->spec
;
811 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mmux
;
815 static int stac92xx_mono_mux_enum_put(struct snd_kcontrol
*kcontrol
,
816 struct snd_ctl_elem_value
*ucontrol
)
818 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
819 struct sigmatel_spec
*spec
= codec
->spec
;
821 return snd_hda_input_mux_put(codec
, spec
->mono_mux
, ucontrol
,
822 spec
->mono_nid
, &spec
->cur_mmux
);
825 #define stac92xx_aloopback_info snd_ctl_boolean_mono_info
827 static int stac92xx_aloopback_get(struct snd_kcontrol
*kcontrol
,
828 struct snd_ctl_elem_value
*ucontrol
)
830 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
831 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
832 struct sigmatel_spec
*spec
= codec
->spec
;
834 ucontrol
->value
.integer
.value
[0] = !!(spec
->aloopback
&
835 (spec
->aloopback_mask
<< idx
));
839 static int stac92xx_aloopback_put(struct snd_kcontrol
*kcontrol
,
840 struct snd_ctl_elem_value
*ucontrol
)
842 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
843 struct sigmatel_spec
*spec
= codec
->spec
;
844 unsigned int idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
845 unsigned int dac_mode
;
846 unsigned int val
, idx_val
;
848 idx_val
= spec
->aloopback_mask
<< idx
;
849 if (ucontrol
->value
.integer
.value
[0])
850 val
= spec
->aloopback
| idx_val
;
852 val
= spec
->aloopback
& ~idx_val
;
853 if (spec
->aloopback
== val
)
856 spec
->aloopback
= val
;
858 /* Only return the bits defined by the shift value of the
859 * first two bytes of the mask
861 dac_mode
= snd_hda_codec_read(codec
, codec
->afg
, 0,
862 kcontrol
->private_value
& 0xFFFF, 0x0);
863 dac_mode
>>= spec
->aloopback_shift
;
865 if (spec
->aloopback
& idx_val
) {
866 snd_hda_power_up(codec
);
869 snd_hda_power_down(codec
);
870 dac_mode
&= ~idx_val
;
873 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
874 kcontrol
->private_value
>> 16, dac_mode
);
879 static const struct hda_verb stac9200_core_init
[] = {
880 /* set dac0mux for dac converter */
881 { 0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
885 static const struct hda_verb stac9200_eapd_init
[] = {
886 /* set dac0mux for dac converter */
887 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
888 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
892 static const struct hda_verb dell_eq_core_init
[] = {
893 /* set master volume to max value without distortion
894 * and direct control */
895 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xec},
899 static const struct hda_verb stac92hd73xx_core_init
[] = {
900 /* set master volume and direct control */
901 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
905 static const struct hda_verb stac92hd83xxx_core_init
[] = {
906 /* power state controls amps */
907 { 0x01, AC_VERB_SET_EAPD
, 1 << 2},
911 static const struct hda_verb stac92hd83xxx_hp_zephyr_init
[] = {
912 { 0x22, 0x785, 0x43 },
913 { 0x22, 0x782, 0xe0 },
914 { 0x22, 0x795, 0x00 },
918 static const struct hda_verb stac92hd71bxx_core_init
[] = {
919 /* set master volume and direct control */
920 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
924 static const struct hda_verb stac92hd71bxx_unmute_core_init
[] = {
925 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
926 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
927 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
928 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
932 static const struct hda_verb stac925x_core_init
[] = {
933 /* set dac0mux for dac converter */
934 { 0x06, AC_VERB_SET_CONNECT_SEL
, 0x00},
935 /* mute the master volume */
936 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
940 static const struct hda_verb stac922x_core_init
[] = {
941 /* set master volume and direct control */
942 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
946 static const struct hda_verb d965_core_init
[] = {
947 /* unmute node 0x1b */
948 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
949 /* select node 0x03 as DAC */
950 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
954 static const struct hda_verb dell_3st_core_init
[] = {
955 /* don't set delta bit */
956 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
957 /* unmute node 0x1b */
958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
959 /* select node 0x03 as DAC */
960 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x01},
964 static const struct hda_verb stac927x_core_init
[] = {
965 /* set master volume and direct control */
966 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
967 /* enable analog pc beep path */
968 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
972 static const struct hda_verb stac927x_volknob_core_init
[] = {
973 /* don't set delta bit */
974 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0x7f},
975 /* enable analog pc beep path */
976 {0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
980 static const struct hda_verb stac9205_core_init
[] = {
981 /* set master volume and direct control */
982 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL
, 0xff},
983 /* enable analog pc beep path */
984 { 0x01, AC_VERB_SET_DIGI_CONVERT_2
, 1 << 5},
988 #define STAC_MONO_MUX \
990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
991 .name = "Mono Mux", \
993 .info = stac92xx_mono_mux_enum_info, \
994 .get = stac92xx_mono_mux_enum_get, \
995 .put = stac92xx_mono_mux_enum_put, \
998 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
1000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1001 .name = "Analog Loopback", \
1003 .info = stac92xx_aloopback_info, \
1004 .get = stac92xx_aloopback_get, \
1005 .put = stac92xx_aloopback_put, \
1006 .private_value = verb_read | (verb_write << 16), \
1009 #define DC_BIAS(xname, idx, nid) \
1011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1014 .info = stac92xx_dc_bias_info, \
1015 .get = stac92xx_dc_bias_get, \
1016 .put = stac92xx_dc_bias_put, \
1017 .private_value = nid, \
1020 static const struct snd_kcontrol_new stac9200_mixer
[] = {
1021 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xb, 0, HDA_OUTPUT
),
1022 HDA_CODEC_MUTE("PCM Playback Switch", 0xb, 0, HDA_OUTPUT
),
1023 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT
),
1024 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT
),
1028 static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback
[] = {
1029 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
1033 static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback
[] = {
1034 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
1038 static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback
[] = {
1039 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1044 static const struct snd_kcontrol_new stac92hd71bxx_loopback
[] = {
1045 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1048 static const struct snd_kcontrol_new stac925x_mixer
[] = {
1049 HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xe, 0, HDA_OUTPUT
),
1050 HDA_CODEC_MUTE("PCM Playback Switch", 0x0e, 0, HDA_OUTPUT
),
1054 static const struct snd_kcontrol_new stac9205_loopback
[] = {
1055 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1059 static const struct snd_kcontrol_new stac927x_loopback
[] = {
1060 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1064 static struct snd_kcontrol_new stac_dmux_mixer
= {
1065 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1066 .name
= "Digital Input Source",
1067 /* count set later */
1068 .info
= stac92xx_dmux_enum_info
,
1069 .get
= stac92xx_dmux_enum_get
,
1070 .put
= stac92xx_dmux_enum_put
,
1073 static struct snd_kcontrol_new stac_smux_mixer
= {
1074 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1075 .name
= "IEC958 Playback Source",
1076 /* count set later */
1077 .info
= stac92xx_smux_enum_info
,
1078 .get
= stac92xx_smux_enum_get
,
1079 .put
= stac92xx_smux_enum_put
,
1082 static const char * const slave_pfxs
[] = {
1083 "Front", "Surround", "Center", "LFE", "Side",
1084 "Headphone", "Speaker", "Bass Speaker", "IEC958", "PCM",
1088 static void stac92xx_update_led_status(struct hda_codec
*codec
, int enabled
);
1090 static void stac92xx_vmaster_hook(void *private_data
, int val
)
1092 stac92xx_update_led_status(private_data
, val
);
1095 static void stac92xx_free_kctls(struct hda_codec
*codec
);
1097 static int stac92xx_build_controls(struct hda_codec
*codec
)
1099 struct sigmatel_spec
*spec
= codec
->spec
;
1100 unsigned int vmaster_tlv
[4];
1105 err
= snd_hda_add_new_ctls(codec
, spec
->mixer
);
1110 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1111 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1115 if (!spec
->auto_mic
&& spec
->num_dmuxes
> 0 &&
1116 snd_hda_get_bool_hint(codec
, "separate_dmux") == 1) {
1117 stac_dmux_mixer
.count
= spec
->num_dmuxes
;
1118 err
= snd_hda_ctl_add(codec
, 0,
1119 snd_ctl_new1(&stac_dmux_mixer
, codec
));
1123 if (spec
->num_smuxes
> 0) {
1124 int wcaps
= get_wcaps(codec
, spec
->multiout
.dig_out_nid
);
1125 struct hda_input_mux
*smux
= &spec
->private_smux
;
1126 /* check for mute support on SPDIF out */
1127 if (wcaps
& AC_WCAP_OUT_AMP
) {
1128 snd_hda_add_imux_item(smux
, "Off", 0, NULL
);
1129 spec
->spdif_mute
= 1;
1131 stac_smux_mixer
.count
= spec
->num_smuxes
;
1132 err
= snd_hda_ctl_add(codec
, 0,
1133 snd_ctl_new1(&stac_smux_mixer
, codec
));
1138 if (spec
->multiout
.dig_out_nid
) {
1139 err
= snd_hda_create_dig_out_ctls(codec
,
1140 spec
->multiout
.dig_out_nid
,
1141 spec
->multiout
.dig_out_nid
,
1142 spec
->autocfg
.dig_out_type
[0]);
1145 err
= snd_hda_create_spdif_share_sw(codec
,
1149 spec
->multiout
.share_spdif
= 1;
1151 if (spec
->dig_in_nid
&& !(spec
->gpio_dir
& 0x01)) {
1152 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1157 /* if we have no master control, let's create it */
1158 snd_hda_set_vmaster_tlv(codec
, spec
->multiout
.dac_nids
[0],
1159 HDA_OUTPUT
, vmaster_tlv
);
1160 /* correct volume offset */
1161 vmaster_tlv
[2] += vmaster_tlv
[3] * spec
->volume_offset
;
1162 /* minimum value is actually mute */
1163 vmaster_tlv
[3] |= TLV_DB_SCALE_MUTE
;
1164 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1165 vmaster_tlv
, slave_pfxs
,
1170 err
= __snd_hda_add_vmaster(codec
, "Master Playback Switch",
1172 "Playback Switch", true,
1173 &spec
->vmaster_mute
.sw_kctl
);
1177 if (spec
->gpio_led
) {
1178 spec
->vmaster_mute
.hook
= stac92xx_vmaster_hook
;
1179 err
= snd_hda_add_vmaster_hook(codec
, &spec
->vmaster_mute
, true);
1184 if (spec
->aloopback_ctl
&&
1185 snd_hda_get_bool_hint(codec
, "loopback") == 1) {
1186 err
= snd_hda_add_new_ctls(codec
, spec
->aloopback_ctl
);
1191 stac92xx_free_kctls(codec
); /* no longer needed */
1193 err
= snd_hda_jack_add_kctls(codec
, &spec
->autocfg
);
1200 static const struct hda_pintbl ref9200_pin_configs
[] = {
1201 { 0x08, 0x01c47010 },
1202 { 0x09, 0x01447010 },
1203 { 0x0d, 0x0221401f },
1204 { 0x0e, 0x01114010 },
1205 { 0x0f, 0x02a19020 },
1206 { 0x10, 0x01a19021 },
1207 { 0x11, 0x90100140 },
1208 { 0x12, 0x01813122 },
1212 static const struct hda_pintbl gateway9200_m4_pin_configs
[] = {
1213 { 0x08, 0x400000fe },
1214 { 0x09, 0x404500f4 },
1215 { 0x0d, 0x400100f0 },
1216 { 0x0e, 0x90110010 },
1217 { 0x0f, 0x400100f1 },
1218 { 0x10, 0x02a1902e },
1219 { 0x11, 0x500000f2 },
1220 { 0x12, 0x500000f3 },
1224 static const struct hda_pintbl gateway9200_m4_2_pin_configs
[] = {
1225 { 0x08, 0x400000fe },
1226 { 0x09, 0x404500f4 },
1227 { 0x0d, 0x400100f0 },
1228 { 0x0e, 0x90110010 },
1229 { 0x0f, 0x400100f1 },
1230 { 0x10, 0x02a1902e },
1231 { 0x11, 0x500000f2 },
1232 { 0x12, 0x500000f3 },
1237 STAC 9200 pin configs for
1242 static const struct hda_pintbl dell9200_d21_pin_configs
[] = {
1243 { 0x08, 0x400001f0 },
1244 { 0x09, 0x400001f1 },
1245 { 0x0d, 0x02214030 },
1246 { 0x0e, 0x01014010 },
1247 { 0x0f, 0x02a19020 },
1248 { 0x10, 0x01a19021 },
1249 { 0x11, 0x90100140 },
1250 { 0x12, 0x01813122 },
1255 STAC 9200 pin configs for
1259 static const struct hda_pintbl dell9200_d22_pin_configs
[] = {
1260 { 0x08, 0x400001f0 },
1261 { 0x09, 0x400001f1 },
1262 { 0x0d, 0x0221401f },
1263 { 0x0e, 0x01014010 },
1264 { 0x0f, 0x01813020 },
1265 { 0x10, 0x02a19021 },
1266 { 0x11, 0x90100140 },
1267 { 0x12, 0x400001f2 },
1272 STAC 9200 pin configs for
1273 102801C4 (Dell Dimension E310)
1280 static const struct hda_pintbl dell9200_d23_pin_configs
[] = {
1281 { 0x08, 0x400001f0 },
1282 { 0x09, 0x400001f1 },
1283 { 0x0d, 0x0221401f },
1284 { 0x0e, 0x01014010 },
1285 { 0x0f, 0x01813020 },
1286 { 0x10, 0x01a19021 },
1287 { 0x11, 0x90100140 },
1288 { 0x12, 0x400001f2 },
1294 STAC 9200-32 pin configs for
1295 102801B5 (Dell Inspiron 630m)
1296 102801D8 (Dell Inspiron 640m)
1298 static const struct hda_pintbl dell9200_m21_pin_configs
[] = {
1299 { 0x08, 0x40c003fa },
1300 { 0x09, 0x03441340 },
1301 { 0x0d, 0x0321121f },
1302 { 0x0e, 0x90170310 },
1303 { 0x0f, 0x408003fb },
1304 { 0x10, 0x03a11020 },
1305 { 0x11, 0x401003fc },
1306 { 0x12, 0x403003fd },
1311 STAC 9200-32 pin configs for
1312 102801C2 (Dell Latitude D620)
1314 102801CC (Dell Latitude D820)
1318 static const struct hda_pintbl dell9200_m22_pin_configs
[] = {
1319 { 0x08, 0x40c003fa },
1320 { 0x09, 0x0144131f },
1321 { 0x0d, 0x0321121f },
1322 { 0x0e, 0x90170310 },
1323 { 0x0f, 0x90a70321 },
1324 { 0x10, 0x03a11020 },
1325 { 0x11, 0x401003fb },
1326 { 0x12, 0x40f000fc },
1331 STAC 9200-32 pin configs for
1332 102801CE (Dell XPS M1710)
1333 102801CF (Dell Precision M90)
1335 static const struct hda_pintbl dell9200_m23_pin_configs
[] = {
1336 { 0x08, 0x40c003fa },
1337 { 0x09, 0x01441340 },
1338 { 0x0d, 0x0421421f },
1339 { 0x0e, 0x90170310 },
1340 { 0x0f, 0x408003fb },
1341 { 0x10, 0x04a1102e },
1342 { 0x11, 0x90170311 },
1343 { 0x12, 0x403003fc },
1348 STAC 9200-32 pin configs for
1351 102801CB (Dell Latitude 120L)
1354 static const struct hda_pintbl dell9200_m24_pin_configs
[] = {
1355 { 0x08, 0x40c003fa },
1356 { 0x09, 0x404003fb },
1357 { 0x0d, 0x0321121f },
1358 { 0x0e, 0x90170310 },
1359 { 0x0f, 0x408003fc },
1360 { 0x10, 0x03a11020 },
1361 { 0x11, 0x401003fd },
1362 { 0x12, 0x403003fe },
1367 STAC 9200-32 pin configs for
1368 102801BD (Dell Inspiron E1505n)
1372 static const struct hda_pintbl dell9200_m25_pin_configs
[] = {
1373 { 0x08, 0x40c003fa },
1374 { 0x09, 0x01441340 },
1375 { 0x0d, 0x0421121f },
1376 { 0x0e, 0x90170310 },
1377 { 0x0f, 0x408003fb },
1378 { 0x10, 0x04a11020 },
1379 { 0x11, 0x401003fc },
1380 { 0x12, 0x403003fd },
1385 STAC 9200-32 pin configs for
1386 102801F5 (Dell Inspiron 1501)
1389 static const struct hda_pintbl dell9200_m26_pin_configs
[] = {
1390 { 0x08, 0x40c003fa },
1391 { 0x09, 0x404003fb },
1392 { 0x0d, 0x0421121f },
1393 { 0x0e, 0x90170310 },
1394 { 0x0f, 0x408003fc },
1395 { 0x10, 0x04a11020 },
1396 { 0x11, 0x401003fd },
1397 { 0x12, 0x403003fe },
1403 102801CD (Dell Inspiron E1705/9400)
1405 static const struct hda_pintbl dell9200_m27_pin_configs
[] = {
1406 { 0x08, 0x40c003fa },
1407 { 0x09, 0x01441340 },
1408 { 0x0d, 0x0421121f },
1409 { 0x0e, 0x90170310 },
1410 { 0x0f, 0x90170310 },
1411 { 0x10, 0x04a11020 },
1412 { 0x11, 0x90170310 },
1413 { 0x12, 0x40f003fc },
1417 static const struct hda_pintbl oqo9200_pin_configs
[] = {
1418 { 0x08, 0x40c000f0 },
1419 { 0x09, 0x404000f1 },
1420 { 0x0d, 0x0221121f },
1421 { 0x0e, 0x02211210 },
1422 { 0x0f, 0x90170111 },
1423 { 0x10, 0x90a70120 },
1424 { 0x11, 0x400000f2 },
1425 { 0x12, 0x400000f3 },
1430 static void stac9200_fixup_panasonic(struct hda_codec
*codec
,
1431 const struct hda_fixup
*fix
, int action
)
1433 struct sigmatel_spec
*spec
= codec
->spec
;
1436 case HDA_FIXUP_ACT_PRE_PROBE
:
1437 spec
->gpio_mask
= spec
->gpio_dir
= 0x09;
1438 spec
->gpio_data
= 0x00;
1440 case HDA_FIXUP_ACT_PROBE
:
1441 /* CF-74 has no headphone detection, and the driver should *NOT*
1442 * do detection and HP/speaker toggle because the hardware does it.
1444 spec
->hp_detect
= 0;
1450 static const struct hda_fixup stac9200_fixups
[] = {
1452 .type
= HDA_FIXUP_PINS
,
1453 .v
.pins
= ref9200_pin_configs
,
1456 .type
= HDA_FIXUP_PINS
,
1457 .v
.pins
= oqo9200_pin_configs
,
1459 .chain_id
= STAC_9200_EAPD_INIT
,
1461 [STAC_9200_DELL_D21
] = {
1462 .type
= HDA_FIXUP_PINS
,
1463 .v
.pins
= dell9200_d21_pin_configs
,
1465 [STAC_9200_DELL_D22
] = {
1466 .type
= HDA_FIXUP_PINS
,
1467 .v
.pins
= dell9200_d22_pin_configs
,
1469 [STAC_9200_DELL_D23
] = {
1470 .type
= HDA_FIXUP_PINS
,
1471 .v
.pins
= dell9200_d23_pin_configs
,
1473 [STAC_9200_DELL_M21
] = {
1474 .type
= HDA_FIXUP_PINS
,
1475 .v
.pins
= dell9200_m21_pin_configs
,
1477 [STAC_9200_DELL_M22
] = {
1478 .type
= HDA_FIXUP_PINS
,
1479 .v
.pins
= dell9200_m22_pin_configs
,
1481 [STAC_9200_DELL_M23
] = {
1482 .type
= HDA_FIXUP_PINS
,
1483 .v
.pins
= dell9200_m23_pin_configs
,
1485 [STAC_9200_DELL_M24
] = {
1486 .type
= HDA_FIXUP_PINS
,
1487 .v
.pins
= dell9200_m24_pin_configs
,
1489 [STAC_9200_DELL_M25
] = {
1490 .type
= HDA_FIXUP_PINS
,
1491 .v
.pins
= dell9200_m25_pin_configs
,
1493 [STAC_9200_DELL_M26
] = {
1494 .type
= HDA_FIXUP_PINS
,
1495 .v
.pins
= dell9200_m26_pin_configs
,
1497 [STAC_9200_DELL_M27
] = {
1498 .type
= HDA_FIXUP_PINS
,
1499 .v
.pins
= dell9200_m27_pin_configs
,
1502 .type
= HDA_FIXUP_PINS
,
1503 .v
.pins
= gateway9200_m4_pin_configs
,
1505 .chain_id
= STAC_9200_EAPD_INIT
,
1507 [STAC_9200_M4_2
] = {
1508 .type
= HDA_FIXUP_PINS
,
1509 .v
.pins
= gateway9200_m4_2_pin_configs
,
1511 .chain_id
= STAC_9200_EAPD_INIT
,
1513 [STAC_9200_PANASONIC
] = {
1514 .type
= HDA_FIXUP_FUNC
,
1515 .v
.func
= stac9200_fixup_panasonic
,
1517 [STAC_9200_EAPD_INIT
] = {
1518 .type
= HDA_FIXUP_VERBS
,
1519 .v
.verbs
= (const struct hda_verb
[]) {
1520 {0x08, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1526 static const struct hda_model_fixup stac9200_models
[] = {
1527 { .id
= STAC_REF
, .name
= "ref" },
1528 { .id
= STAC_9200_OQO
, .name
= "oqo" },
1529 { .id
= STAC_9200_DELL_D21
, .name
= "dell-d21" },
1530 { .id
= STAC_9200_DELL_D22
, .name
= "dell-d22" },
1531 { .id
= STAC_9200_DELL_D23
, .name
= "dell-d23" },
1532 { .id
= STAC_9200_DELL_M21
, .name
= "dell-m21" },
1533 { .id
= STAC_9200_DELL_M22
, .name
= "dell-m22" },
1534 { .id
= STAC_9200_DELL_M23
, .name
= "dell-m23" },
1535 { .id
= STAC_9200_DELL_M24
, .name
= "dell-m24" },
1536 { .id
= STAC_9200_DELL_M25
, .name
= "dell-m25" },
1537 { .id
= STAC_9200_DELL_M26
, .name
= "dell-m26" },
1538 { .id
= STAC_9200_DELL_M27
, .name
= "dell-m27" },
1539 { .id
= STAC_9200_M4
, .name
= "gateway-m4" },
1540 { .id
= STAC_9200_M4_2
, .name
= "gateway-m4-2" },
1541 { .id
= STAC_9200_PANASONIC
, .name
= "panasonic" },
1545 static const struct snd_pci_quirk stac9200_fixup_tbl
[] = {
1546 /* SigmaTel reference board */
1547 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
1548 "DFI LanParty", STAC_REF
),
1549 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
1550 "DFI LanParty", STAC_REF
),
1551 /* Dell laptops have BIOS problem */
1552 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a8,
1553 "unknown Dell", STAC_9200_DELL_D21
),
1554 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01b5,
1555 "Dell Inspiron 630m", STAC_9200_DELL_M21
),
1556 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bd,
1557 "Dell Inspiron E1505n", STAC_9200_DELL_M25
),
1558 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c0,
1559 "unknown Dell", STAC_9200_DELL_D22
),
1560 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c1,
1561 "unknown Dell", STAC_9200_DELL_D22
),
1562 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c2,
1563 "Dell Latitude D620", STAC_9200_DELL_M22
),
1564 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c5,
1565 "unknown Dell", STAC_9200_DELL_D23
),
1566 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c7,
1567 "unknown Dell", STAC_9200_DELL_D23
),
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c8,
1569 "unknown Dell", STAC_9200_DELL_M22
),
1570 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01c9,
1571 "unknown Dell", STAC_9200_DELL_M24
),
1572 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ca,
1573 "unknown Dell", STAC_9200_DELL_M24
),
1574 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cb,
1575 "Dell Latitude 120L", STAC_9200_DELL_M24
),
1576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cc,
1577 "Dell Latitude D820", STAC_9200_DELL_M22
),
1578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cd,
1579 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27
),
1580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ce,
1581 "Dell XPS M1710", STAC_9200_DELL_M23
),
1582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01cf,
1583 "Dell Precision M90", STAC_9200_DELL_M23
),
1584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d3,
1585 "unknown Dell", STAC_9200_DELL_M22
),
1586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d4,
1587 "unknown Dell", STAC_9200_DELL_M22
),
1588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d6,
1589 "unknown Dell", STAC_9200_DELL_M22
),
1590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d8,
1591 "Dell Inspiron 640m", STAC_9200_DELL_M21
),
1592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d9,
1593 "unknown Dell", STAC_9200_DELL_D23
),
1594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01da,
1595 "unknown Dell", STAC_9200_DELL_D23
),
1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01de,
1597 "unknown Dell", STAC_9200_DELL_D21
),
1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e3,
1599 "unknown Dell", STAC_9200_DELL_D23
),
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01e8,
1601 "unknown Dell", STAC_9200_DELL_D21
),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ee,
1603 "unknown Dell", STAC_9200_DELL_M25
),
1604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ef,
1605 "unknown Dell", STAC_9200_DELL_M25
),
1606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f5,
1607 "Dell Inspiron 1501", STAC_9200_DELL_M26
),
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f6,
1609 "unknown Dell", STAC_9200_DELL_M26
),
1611 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC
),
1612 /* Gateway machines needs EAPD to be set on resume */
1613 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4
),
1614 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2
),
1615 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2
),
1617 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO
),
1621 static const struct hda_pintbl ref925x_pin_configs
[] = {
1622 { 0x07, 0x40c003f0 },
1623 { 0x08, 0x424503f2 },
1624 { 0x0a, 0x01813022 },
1625 { 0x0b, 0x02a19021 },
1626 { 0x0c, 0x90a70320 },
1627 { 0x0d, 0x02214210 },
1628 { 0x10, 0x01019020 },
1629 { 0x11, 0x9033032e },
1633 static const struct hda_pintbl stac925xM1_pin_configs
[] = {
1634 { 0x07, 0x40c003f4 },
1635 { 0x08, 0x424503f2 },
1636 { 0x0a, 0x400000f3 },
1637 { 0x0b, 0x02a19020 },
1638 { 0x0c, 0x40a000f0 },
1639 { 0x0d, 0x90100210 },
1640 { 0x10, 0x400003f1 },
1641 { 0x11, 0x9033032e },
1645 static const struct hda_pintbl stac925xM1_2_pin_configs
[] = {
1646 { 0x07, 0x40c003f4 },
1647 { 0x08, 0x424503f2 },
1648 { 0x0a, 0x400000f3 },
1649 { 0x0b, 0x02a19020 },
1650 { 0x0c, 0x40a000f0 },
1651 { 0x0d, 0x90100210 },
1652 { 0x10, 0x400003f1 },
1653 { 0x11, 0x9033032e },
1657 static const struct hda_pintbl stac925xM2_pin_configs
[] = {
1658 { 0x07, 0x40c003f4 },
1659 { 0x08, 0x424503f2 },
1660 { 0x0a, 0x400000f3 },
1661 { 0x0b, 0x02a19020 },
1662 { 0x0c, 0x40a000f0 },
1663 { 0x0d, 0x90100210 },
1664 { 0x10, 0x400003f1 },
1665 { 0x11, 0x9033032e },
1669 static const struct hda_pintbl stac925xM2_2_pin_configs
[] = {
1670 { 0x07, 0x40c003f4 },
1671 { 0x08, 0x424503f2 },
1672 { 0x0a, 0x400000f3 },
1673 { 0x0b, 0x02a19020 },
1674 { 0x0c, 0x40a000f0 },
1675 { 0x0d, 0x90100210 },
1676 { 0x10, 0x400003f1 },
1677 { 0x11, 0x9033032e },
1681 static const struct hda_pintbl stac925xM3_pin_configs
[] = {
1682 { 0x07, 0x40c003f4 },
1683 { 0x08, 0x424503f2 },
1684 { 0x0a, 0x400000f3 },
1685 { 0x0b, 0x02a19020 },
1686 { 0x0c, 0x40a000f0 },
1687 { 0x0d, 0x90100210 },
1688 { 0x10, 0x400003f1 },
1689 { 0x11, 0x503303f3 },
1693 static const struct hda_pintbl stac925xM5_pin_configs
[] = {
1694 { 0x07, 0x40c003f4 },
1695 { 0x08, 0x424503f2 },
1696 { 0x0a, 0x400000f3 },
1697 { 0x0b, 0x02a19020 },
1698 { 0x0c, 0x40a000f0 },
1699 { 0x0d, 0x90100210 },
1700 { 0x10, 0x400003f1 },
1701 { 0x11, 0x9033032e },
1705 static const struct hda_pintbl stac925xM6_pin_configs
[] = {
1706 { 0x07, 0x40c003f4 },
1707 { 0x08, 0x424503f2 },
1708 { 0x0a, 0x400000f3 },
1709 { 0x0b, 0x02a19020 },
1710 { 0x0c, 0x40a000f0 },
1711 { 0x0d, 0x90100210 },
1712 { 0x10, 0x400003f1 },
1713 { 0x11, 0x90330320 },
1717 static const struct hda_fixup stac925x_fixups
[] = {
1719 .type
= HDA_FIXUP_PINS
,
1720 .v
.pins
= ref925x_pin_configs
,
1723 .type
= HDA_FIXUP_PINS
,
1724 .v
.pins
= stac925xM1_pin_configs
,
1727 .type
= HDA_FIXUP_PINS
,
1728 .v
.pins
= stac925xM1_2_pin_configs
,
1731 .type
= HDA_FIXUP_PINS
,
1732 .v
.pins
= stac925xM2_pin_configs
,
1735 .type
= HDA_FIXUP_PINS
,
1736 .v
.pins
= stac925xM2_2_pin_configs
,
1739 .type
= HDA_FIXUP_PINS
,
1740 .v
.pins
= stac925xM3_pin_configs
,
1743 .type
= HDA_FIXUP_PINS
,
1744 .v
.pins
= stac925xM5_pin_configs
,
1747 .type
= HDA_FIXUP_PINS
,
1748 .v
.pins
= stac925xM6_pin_configs
,
1752 static const struct hda_model_fixup stac925x_models
[] = {
1753 { .id
= STAC_REF
, .name
= "ref" },
1754 { .id
= STAC_M1
, .name
= "m1" },
1755 { .id
= STAC_M1_2
, .name
= "m1-2" },
1756 { .id
= STAC_M2
, .name
= "m2" },
1757 { .id
= STAC_M2_2
, .name
= "m2-2" },
1758 { .id
= STAC_M3
, .name
= "m3" },
1759 { .id
= STAC_M5
, .name
= "m5" },
1760 { .id
= STAC_M6
, .name
= "m6" },
1764 static const struct snd_pci_quirk stac925x_fixup_tbl
[] = {
1765 /* SigmaTel reference board */
1766 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668, "DFI LanParty", STAC_REF
),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101, "DFI LanParty", STAC_REF
),
1768 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF
),
1770 /* Default table for unknown ID */
1771 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2
),
1773 /* gateway machines are checked via codec ssid */
1774 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2
),
1775 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5
),
1776 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1
),
1777 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2
),
1778 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2
),
1779 /* Not sure about the brand name for those */
1780 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1
),
1781 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3
),
1782 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6
),
1783 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2
),
1787 static const struct hda_pintbl ref92hd73xx_pin_configs
[] = {
1788 { 0x0a, 0x02214030 },
1789 { 0x0b, 0x02a19040 },
1790 { 0x0c, 0x01a19020 },
1791 { 0x0d, 0x02214030 },
1792 { 0x0e, 0x0181302e },
1793 { 0x0f, 0x01014010 },
1794 { 0x10, 0x01014020 },
1795 { 0x11, 0x01014030 },
1796 { 0x12, 0x02319040 },
1797 { 0x13, 0x90a000f0 },
1798 { 0x14, 0x90a000f0 },
1799 { 0x22, 0x01452050 },
1800 { 0x23, 0x01452050 },
1804 static const struct hda_pintbl dell_m6_pin_configs
[] = {
1805 { 0x0a, 0x0321101f },
1806 { 0x0b, 0x4f00000f },
1807 { 0x0c, 0x4f0000f0 },
1808 { 0x0d, 0x90170110 },
1809 { 0x0e, 0x03a11020 },
1810 { 0x0f, 0x0321101f },
1811 { 0x10, 0x4f0000f0 },
1812 { 0x11, 0x4f0000f0 },
1813 { 0x12, 0x4f0000f0 },
1814 { 0x13, 0x90a60160 },
1815 { 0x14, 0x4f0000f0 },
1816 { 0x22, 0x4f0000f0 },
1817 { 0x23, 0x4f0000f0 },
1821 static const struct hda_pintbl alienware_m17x_pin_configs
[] = {
1822 { 0x0a, 0x0321101f },
1823 { 0x0b, 0x0321101f },
1824 { 0x0c, 0x03a11020 },
1825 { 0x0d, 0x03014020 },
1826 { 0x0e, 0x90170110 },
1827 { 0x0f, 0x4f0000f0 },
1828 { 0x10, 0x4f0000f0 },
1829 { 0x11, 0x4f0000f0 },
1830 { 0x12, 0x4f0000f0 },
1831 { 0x13, 0x90a60160 },
1832 { 0x14, 0x4f0000f0 },
1833 { 0x22, 0x4f0000f0 },
1834 { 0x23, 0x904601b0 },
1838 static const struct hda_pintbl intel_dg45id_pin_configs
[] = {
1839 { 0x0a, 0x02214230 },
1840 { 0x0b, 0x02A19240 },
1841 { 0x0c, 0x01013214 },
1842 { 0x0d, 0x01014210 },
1843 { 0x0e, 0x01A19250 },
1844 { 0x0f, 0x01011212 },
1845 { 0x10, 0x01016211 },
1849 static void stac92hd73xx_fixup_ref(struct hda_codec
*codec
,
1850 const struct hda_fixup
*fix
, int action
)
1852 struct sigmatel_spec
*spec
= codec
->spec
;
1854 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1857 snd_hda_apply_pincfgs(codec
, ref92hd73xx_pin_configs
);
1858 spec
->gpio_mask
= spec
->gpio_dir
= spec
->gpio_data
= 0;
1861 static void stac92hd73xx_fixup_dell(struct hda_codec
*codec
)
1863 struct sigmatel_spec
*spec
= codec
->spec
;
1865 snd_hda_apply_pincfgs(codec
, dell_m6_pin_configs
);
1866 spec
->num_smuxes
= 0;
1867 spec
->eapd_switch
= 0;
1870 static void stac92hd73xx_fixup_dell_eq(struct hda_codec
*codec
,
1871 const struct hda_fixup
*fix
, int action
)
1873 struct sigmatel_spec
*spec
= codec
->spec
;
1875 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1878 stac92hd73xx_fixup_dell(codec
);
1879 snd_hda_add_verbs(codec
, dell_eq_core_init
);
1880 spec
->volknob_init
= 1;
1884 static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec
*codec
,
1885 const struct hda_fixup
*fix
, int action
)
1887 struct sigmatel_spec
*spec
= codec
->spec
;
1889 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1892 stac92hd73xx_fixup_dell(codec
);
1893 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
1894 spec
->num_dmics
= 0;
1898 static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec
*codec
,
1899 const struct hda_fixup
*fix
, int action
)
1901 struct sigmatel_spec
*spec
= codec
->spec
;
1903 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1906 stac92hd73xx_fixup_dell(codec
);
1907 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
1908 spec
->num_dmics
= 1;
1912 static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec
*codec
,
1913 const struct hda_fixup
*fix
, int action
)
1915 struct sigmatel_spec
*spec
= codec
->spec
;
1917 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1920 stac92hd73xx_fixup_dell(codec
);
1921 snd_hda_codec_set_pincfg(codec
, 0x0b, 0x90A70170);
1922 snd_hda_codec_set_pincfg(codec
, 0x13, 0x90A60160);
1923 spec
->num_dmics
= 1;
1926 static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec
*codec
,
1927 const struct hda_fixup
*fix
, int action
)
1929 struct sigmatel_spec
*spec
= codec
->spec
;
1931 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1934 snd_hda_apply_pincfgs(codec
, alienware_m17x_pin_configs
);
1935 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
1936 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
1937 spec
->eapd_switch
= 0;
1940 static void stac92hd73xx_fixup_no_jd(struct hda_codec
*codec
,
1941 const struct hda_fixup
*fix
, int action
)
1943 struct sigmatel_spec
*spec
= codec
->spec
;
1945 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
1947 spec
->hp_detect
= 0;
1950 static const struct hda_fixup stac92hd73xx_fixups
[] = {
1951 [STAC_92HD73XX_REF
] = {
1952 .type
= HDA_FIXUP_FUNC
,
1953 .v
.func
= stac92hd73xx_fixup_ref
,
1955 [STAC_DELL_M6_AMIC
] = {
1956 .type
= HDA_FIXUP_FUNC
,
1957 .v
.func
= stac92hd73xx_fixup_dell_m6_amic
,
1959 [STAC_DELL_M6_DMIC
] = {
1960 .type
= HDA_FIXUP_FUNC
,
1961 .v
.func
= stac92hd73xx_fixup_dell_m6_dmic
,
1963 [STAC_DELL_M6_BOTH
] = {
1964 .type
= HDA_FIXUP_FUNC
,
1965 .v
.func
= stac92hd73xx_fixup_dell_m6_both
,
1968 .type
= HDA_FIXUP_FUNC
,
1969 .v
.func
= stac92hd73xx_fixup_dell_eq
,
1971 [STAC_ALIENWARE_M17X
] = {
1972 .type
= HDA_FIXUP_FUNC
,
1973 .v
.func
= stac92hd73xx_fixup_alienware_m17x
,
1975 [STAC_92HD73XX_INTEL
] = {
1976 .type
= HDA_FIXUP_PINS
,
1977 .v
.pins
= intel_dg45id_pin_configs
,
1979 [STAC_92HD73XX_NO_JD
] = {
1980 .type
= HDA_FIXUP_FUNC
,
1981 .v
.func
= stac92hd73xx_fixup_no_jd
,
1985 static const struct hda_model_fixup stac92hd73xx_models
[] = {
1986 { .id
= STAC_92HD73XX_NO_JD
, .name
= "no-jd" },
1987 { .id
= STAC_92HD73XX_REF
, .name
= "ref" },
1988 { .id
= STAC_92HD73XX_INTEL
, .name
= "intel" },
1989 { .id
= STAC_DELL_M6_AMIC
, .name
= "dell-m6-amic" },
1990 { .id
= STAC_DELL_M6_DMIC
, .name
= "dell-m6-dmic" },
1991 { .id
= STAC_DELL_M6_BOTH
, .name
= "dell-m6" },
1992 { .id
= STAC_DELL_EQ
, .name
= "dell-eq" },
1993 { .id
= STAC_ALIENWARE_M17X
, .name
= "alienware" },
1997 static const struct snd_pci_quirk stac92hd73xx_fixup_tbl
[] = {
1998 /* SigmaTel reference board */
1999 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2000 "DFI LanParty", STAC_92HD73XX_REF
),
2001 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2002 "DFI LanParty", STAC_92HD73XX_REF
),
2003 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5002,
2004 "Intel DG45ID", STAC_92HD73XX_INTEL
),
2005 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5003,
2006 "Intel DG45FC", STAC_92HD73XX_INTEL
),
2007 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0254,
2008 "Dell Studio 1535", STAC_DELL_M6_DMIC
),
2009 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0255,
2010 "unknown Dell", STAC_DELL_M6_DMIC
),
2011 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0256,
2012 "unknown Dell", STAC_DELL_M6_BOTH
),
2013 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0257,
2014 "unknown Dell", STAC_DELL_M6_BOTH
),
2015 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025e,
2016 "unknown Dell", STAC_DELL_M6_AMIC
),
2017 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x025f,
2018 "unknown Dell", STAC_DELL_M6_AMIC
),
2019 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0271,
2020 "unknown Dell", STAC_DELL_M6_DMIC
),
2021 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0272,
2022 "unknown Dell", STAC_DELL_M6_DMIC
),
2023 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x029f,
2024 "Dell Studio 1537", STAC_DELL_M6_DMIC
),
2025 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a0,
2026 "Dell Studio 17", STAC_DELL_M6_DMIC
),
2027 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02be,
2028 "Dell Studio 1555", STAC_DELL_M6_DMIC
),
2029 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02bd,
2030 "Dell Studio 1557", STAC_DELL_M6_DMIC
),
2031 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02fe,
2032 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC
),
2033 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0413,
2034 "Dell Studio 1558", STAC_DELL_M6_DMIC
),
2035 /* codec SSID matching */
2036 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02a1,
2037 "Alienware M17x", STAC_ALIENWARE_M17X
),
2038 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x043a,
2039 "Alienware M17x", STAC_ALIENWARE_M17X
),
2040 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0490,
2041 "Alienware M17x R3", STAC_DELL_EQ
),
2045 static const struct hda_pintbl ref92hd83xxx_pin_configs
[] = {
2046 { 0x0a, 0x02214030 },
2047 { 0x0b, 0x02211010 },
2048 { 0x0c, 0x02a19020 },
2049 { 0x0d, 0x02170130 },
2050 { 0x0e, 0x01014050 },
2051 { 0x0f, 0x01819040 },
2052 { 0x10, 0x01014020 },
2053 { 0x11, 0x90a3014e },
2054 { 0x1f, 0x01451160 },
2055 { 0x20, 0x98560170 },
2059 static const struct hda_pintbl dell_s14_pin_configs
[] = {
2060 { 0x0a, 0x0221403f },
2061 { 0x0b, 0x0221101f },
2062 { 0x0c, 0x02a19020 },
2063 { 0x0d, 0x90170110 },
2064 { 0x0e, 0x40f000f0 },
2065 { 0x0f, 0x40f000f0 },
2066 { 0x10, 0x40f000f0 },
2067 { 0x11, 0x90a60160 },
2068 { 0x1f, 0x40f000f0 },
2069 { 0x20, 0x40f000f0 },
2073 static const struct hda_pintbl dell_vostro_3500_pin_configs
[] = {
2074 { 0x0a, 0x02a11020 },
2075 { 0x0b, 0x0221101f },
2076 { 0x0c, 0x400000f0 },
2077 { 0x0d, 0x90170110 },
2078 { 0x0e, 0x400000f1 },
2079 { 0x0f, 0x400000f2 },
2080 { 0x10, 0x400000f3 },
2081 { 0x11, 0x90a60160 },
2082 { 0x1f, 0x400000f4 },
2083 { 0x20, 0x400000f5 },
2087 static const struct hda_pintbl hp_dv7_4000_pin_configs
[] = {
2088 { 0x0a, 0x03a12050 },
2089 { 0x0b, 0x0321201f },
2090 { 0x0c, 0x40f000f0 },
2091 { 0x0d, 0x90170110 },
2092 { 0x0e, 0x40f000f0 },
2093 { 0x0f, 0x40f000f0 },
2094 { 0x10, 0x90170110 },
2095 { 0x11, 0xd5a30140 },
2096 { 0x1f, 0x40f000f0 },
2097 { 0x20, 0x40f000f0 },
2101 static const struct hda_pintbl hp_zephyr_pin_configs
[] = {
2102 { 0x0a, 0x01813050 },
2103 { 0x0b, 0x0421201f },
2104 { 0x0c, 0x04a1205e },
2105 { 0x0d, 0x96130310 },
2106 { 0x0e, 0x96130310 },
2107 { 0x0f, 0x0101401f },
2108 { 0x10, 0x1111611f },
2109 { 0x11, 0xd5a30130 },
2113 static const struct hda_pintbl hp_cNB11_intquad_pin_configs
[] = {
2114 { 0x0a, 0x40f000f0 },
2115 { 0x0b, 0x0221101f },
2116 { 0x0c, 0x02a11020 },
2117 { 0x0d, 0x92170110 },
2118 { 0x0e, 0x40f000f0 },
2119 { 0x0f, 0x92170110 },
2120 { 0x10, 0x40f000f0 },
2121 { 0x11, 0xd5a30130 },
2122 { 0x1f, 0x40f000f0 },
2123 { 0x20, 0x40f000f0 },
2127 static void stac92hd83xxx_fixup_hp(struct hda_codec
*codec
,
2128 const struct hda_fixup
*fix
, int action
)
2130 struct sigmatel_spec
*spec
= codec
->spec
;
2132 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2135 if (hp_bnb2011_with_dock(codec
)) {
2136 snd_hda_codec_set_pincfg(codec
, 0xa, 0x2101201f);
2137 snd_hda_codec_set_pincfg(codec
, 0xf, 0x2181205e);
2140 if (find_mute_led_cfg(codec
, spec
->default_polarity
))
2141 snd_printd("mute LED gpio %d polarity %d\n",
2143 spec
->gpio_led_polarity
);
2146 static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec
*codec
,
2147 const struct hda_fixup
*fix
, int action
)
2149 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2152 snd_hda_apply_pincfgs(codec
, hp_zephyr_pin_configs
);
2153 snd_hda_add_verbs(codec
, stac92hd83xxx_hp_zephyr_init
);
2156 static void stac92hd83xxx_fixup_hp_led(struct hda_codec
*codec
,
2157 const struct hda_fixup
*fix
, int action
)
2159 struct sigmatel_spec
*spec
= codec
->spec
;
2161 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
2162 spec
->default_polarity
= 0;
2165 static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec
*codec
,
2166 const struct hda_fixup
*fix
, int action
)
2168 struct sigmatel_spec
*spec
= codec
->spec
;
2170 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
2171 spec
->default_polarity
= 1;
2174 static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec
*codec
,
2175 const struct hda_fixup
*fix
, int action
)
2177 struct sigmatel_spec
*spec
= codec
->spec
;
2179 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
2180 spec
->mic_mute_led_gpio
= 0x08; /* GPIO3 */
2183 static void stac92hd83xxx_fixup_headset_jack(struct hda_codec
*codec
,
2184 const struct hda_fixup
*fix
, int action
)
2186 struct sigmatel_spec
*spec
= codec
->spec
;
2188 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
2189 spec
->headset_jack
= 1;
2192 static const struct hda_fixup stac92hd83xxx_fixups
[] = {
2193 [STAC_92HD83XXX_REF
] = {
2194 .type
= HDA_FIXUP_PINS
,
2195 .v
.pins
= ref92hd83xxx_pin_configs
,
2197 [STAC_92HD83XXX_PWR_REF
] = {
2198 .type
= HDA_FIXUP_PINS
,
2199 .v
.pins
= ref92hd83xxx_pin_configs
,
2202 .type
= HDA_FIXUP_PINS
,
2203 .v
.pins
= dell_s14_pin_configs
,
2205 [STAC_DELL_VOSTRO_3500
] = {
2206 .type
= HDA_FIXUP_PINS
,
2207 .v
.pins
= dell_vostro_3500_pin_configs
,
2209 [STAC_92HD83XXX_HP_cNB11_INTQUAD
] = {
2210 .type
= HDA_FIXUP_PINS
,
2211 .v
.pins
= hp_cNB11_intquad_pin_configs
,
2213 .chain_id
= STAC_92HD83XXX_HP
,
2215 [STAC_92HD83XXX_HP
] = {
2216 .type
= HDA_FIXUP_FUNC
,
2217 .v
.func
= stac92hd83xxx_fixup_hp
,
2219 [STAC_HP_DV7_4000
] = {
2220 .type
= HDA_FIXUP_PINS
,
2221 .v
.pins
= hp_dv7_4000_pin_configs
,
2223 .chain_id
= STAC_92HD83XXX_HP
,
2225 [STAC_HP_ZEPHYR
] = {
2226 .type
= HDA_FIXUP_FUNC
,
2227 .v
.func
= stac92hd83xxx_fixup_hp_zephyr
,
2229 .chain_id
= STAC_92HD83XXX_HP
,
2231 [STAC_92HD83XXX_HP_LED
] = {
2232 .type
= HDA_FIXUP_FUNC
,
2233 .v
.func
= stac92hd83xxx_fixup_hp_led
,
2235 .chain_id
= STAC_92HD83XXX_HP
,
2237 [STAC_92HD83XXX_HP_INV_LED
] = {
2238 .type
= HDA_FIXUP_FUNC
,
2239 .v
.func
= stac92hd83xxx_fixup_hp_inv_led
,
2241 .chain_id
= STAC_92HD83XXX_HP
,
2243 [STAC_92HD83XXX_HP_MIC_LED
] = {
2244 .type
= HDA_FIXUP_FUNC
,
2245 .v
.func
= stac92hd83xxx_fixup_hp_mic_led
,
2247 .chain_id
= STAC_92HD83XXX_HP
,
2249 [STAC_92HD83XXX_HEADSET_JACK
] = {
2250 .type
= HDA_FIXUP_FUNC
,
2251 .v
.func
= stac92hd83xxx_fixup_headset_jack
,
2255 static const struct hda_model_fixup stac92hd83xxx_models
[] = {
2256 { .id
= STAC_92HD83XXX_REF
, .name
= "ref" },
2257 { .id
= STAC_92HD83XXX_PWR_REF
, .name
= "mic-ref" },
2258 { .id
= STAC_DELL_S14
, .name
= "dell-s14" },
2259 { .id
= STAC_DELL_VOSTRO_3500
, .name
= "dell-vostro-3500" },
2260 { .id
= STAC_92HD83XXX_HP_cNB11_INTQUAD
, .name
= "hp_cNB11_intquad" },
2261 { .id
= STAC_HP_DV7_4000
, .name
= "hp-dv7-4000" },
2262 { .id
= STAC_HP_ZEPHYR
, .name
= "hp-zephyr" },
2263 { .id
= STAC_92HD83XXX_HP_LED
, .name
= "hp-led" },
2264 { .id
= STAC_92HD83XXX_HP_INV_LED
, .name
= "hp-inv-led" },
2265 { .id
= STAC_92HD83XXX_HP_MIC_LED
, .name
= "hp-mic-led" },
2266 { .id
= STAC_92HD83XXX_HEADSET_JACK
, .name
= "headset-jack" },
2270 static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl
[] = {
2271 /* SigmaTel reference board */
2272 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2273 "DFI LanParty", STAC_92HD83XXX_REF
),
2274 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2275 "DFI LanParty", STAC_92HD83XXX_REF
),
2276 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ba,
2277 "unknown Dell", STAC_DELL_S14
),
2278 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0532,
2279 "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK
),
2280 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0533,
2281 "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK
),
2282 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0534,
2283 "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK
),
2284 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0535,
2285 "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK
),
2286 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x053c,
2287 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK
),
2288 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x053d,
2289 "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK
),
2290 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0549,
2291 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK
),
2292 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x057d,
2293 "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK
),
2294 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0584,
2295 "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK
),
2296 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x1028,
2297 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500
),
2298 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1656,
2299 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2300 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1657,
2301 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2302 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1658,
2303 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2304 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x1659,
2305 "HP Pavilion dv7", STAC_HP_DV7_4000
),
2306 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x165A,
2307 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2308 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x165B,
2309 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2310 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x18df,
2311 "HP Folio", STAC_92HD83XXX_HP_MIC_LED
),
2312 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3388,
2313 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2314 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3389,
2315 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2316 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355B,
2317 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2318 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355C,
2319 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2320 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355D,
2321 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2322 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355E,
2323 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2324 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x355F,
2325 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2326 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3560,
2327 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2328 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358B,
2329 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2330 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358C,
2331 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2332 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x358D,
2333 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2334 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3591,
2335 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2336 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3592,
2337 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2338 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3593,
2339 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD
),
2340 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3561,
2341 "HP", STAC_HP_ZEPHYR
),
2342 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3660,
2343 "HP Mini", STAC_92HD83XXX_HP_LED
),
2344 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x144E,
2345 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED
),
2346 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP
, "HP", STAC_92HD83XXX_HP
),
2350 static const struct hda_pintbl ref92hd71bxx_pin_configs
[] = {
2351 { 0x0a, 0x02214030 },
2352 { 0x0b, 0x02a19040 },
2353 { 0x0c, 0x01a19020 },
2354 { 0x0d, 0x01014010 },
2355 { 0x0e, 0x0181302e },
2356 { 0x0f, 0x01014010 },
2357 { 0x14, 0x01019020 },
2358 { 0x18, 0x90a000f0 },
2359 { 0x19, 0x90a000f0 },
2360 { 0x1e, 0x01452050 },
2361 { 0x1f, 0x01452050 },
2365 static const struct hda_pintbl dell_m4_1_pin_configs
[] = {
2366 { 0x0a, 0x0421101f },
2367 { 0x0b, 0x04a11221 },
2368 { 0x0c, 0x40f000f0 },
2369 { 0x0d, 0x90170110 },
2370 { 0x0e, 0x23a1902e },
2371 { 0x0f, 0x23014250 },
2372 { 0x14, 0x40f000f0 },
2373 { 0x18, 0x90a000f0 },
2374 { 0x19, 0x40f000f0 },
2375 { 0x1e, 0x4f0000f0 },
2376 { 0x1f, 0x4f0000f0 },
2380 static const struct hda_pintbl dell_m4_2_pin_configs
[] = {
2381 { 0x0a, 0x0421101f },
2382 { 0x0b, 0x04a11221 },
2383 { 0x0c, 0x90a70330 },
2384 { 0x0d, 0x90170110 },
2385 { 0x0e, 0x23a1902e },
2386 { 0x0f, 0x23014250 },
2387 { 0x14, 0x40f000f0 },
2388 { 0x18, 0x40f000f0 },
2389 { 0x19, 0x40f000f0 },
2390 { 0x1e, 0x044413b0 },
2391 { 0x1f, 0x044413b0 },
2395 static const struct hda_pintbl dell_m4_3_pin_configs
[] = {
2396 { 0x0a, 0x0421101f },
2397 { 0x0b, 0x04a11221 },
2398 { 0x0c, 0x90a70330 },
2399 { 0x0d, 0x90170110 },
2400 { 0x0e, 0x40f000f0 },
2401 { 0x0f, 0x40f000f0 },
2402 { 0x14, 0x40f000f0 },
2403 { 0x18, 0x90a000f0 },
2404 { 0x19, 0x40f000f0 },
2405 { 0x1e, 0x044413b0 },
2406 { 0x1f, 0x044413b0 },
2410 static void stac92hd71bxx_fixup_ref(struct hda_codec
*codec
,
2411 const struct hda_fixup
*fix
, int action
)
2413 struct sigmatel_spec
*spec
= codec
->spec
;
2415 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2418 snd_hda_apply_pincfgs(codec
, ref92hd71bxx_pin_configs
);
2419 spec
->gpio_mask
= spec
->gpio_dir
= spec
->gpio_data
= 0;
2422 static void stac92hd71bxx_fixup_no_dmic(struct hda_codec
*codec
,
2423 const struct hda_fixup
*fix
, int action
)
2425 struct sigmatel_spec
*spec
= codec
->spec
;
2427 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2429 spec
->num_dmics
= 0;
2430 spec
->num_smuxes
= 0;
2431 spec
->num_dmuxes
= 0;
2434 static void stac92hd71bxx_fixup_no_smux(struct hda_codec
*codec
,
2435 const struct hda_fixup
*fix
, int action
)
2437 struct sigmatel_spec
*spec
= codec
->spec
;
2439 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2441 spec
->num_dmics
= 1;
2442 spec
->num_smuxes
= 0;
2443 spec
->num_dmuxes
= 1;
2446 static void stac92hd71bxx_fixup_hp_m4(struct hda_codec
*codec
,
2447 const struct hda_fixup
*fix
, int action
)
2449 struct sigmatel_spec
*spec
= codec
->spec
;
2451 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2454 /* Enable VREF power saving on GPIO1 detect */
2455 stac_add_event(codec
, codec
->afg
, STAC_VREF_EVENT
, 0x02);
2456 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
2457 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x02);
2458 snd_hda_jack_detect_enable(codec
, codec
->afg
, 0);
2459 spec
->gpio_mask
|= 0x02;
2461 /* enable internal microphone */
2462 snd_hda_codec_set_pincfg(codec
, 0x0e, 0x01813040);
2463 stac92xx_auto_set_pinctl(codec
, 0x0e,
2464 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
);
2466 stac92hd71bxx_fixup_no_dmic(codec
, fix
, action
);
2469 static void stac92hd71bxx_fixup_hp_dv4_1222nr(struct hda_codec
*codec
,
2470 const struct hda_fixup
*fix
, int action
)
2472 struct sigmatel_spec
*spec
= codec
->spec
;
2474 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2476 spec
->num_dmics
= 1;
2477 /* I don't know if it needs 1 or 2 smuxes - will wait for
2478 * bug reports to fix if needed
2480 spec
->num_smuxes
= 1;
2481 spec
->num_dmuxes
= 1;
2484 static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec
*codec
,
2485 const struct hda_fixup
*fix
, int action
)
2487 struct sigmatel_spec
*spec
= codec
->spec
;
2489 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2491 spec
->gpio_led
= 0x01;
2494 static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec
*codec
,
2495 const struct hda_fixup
*fix
, int action
)
2497 struct sigmatel_spec
*spec
= codec
->spec
;
2501 case HDA_FIXUP_ACT_PRE_PROBE
:
2502 snd_hda_codec_set_pincfg(codec
, 0x0d, 0x90170010);
2503 stac92xx_auto_set_pinctl(codec
, 0x0d, AC_PINCTL_OUT_EN
);
2504 /* HP dv6 gives the headphone pin as a line-out. Thus we
2505 * need to set hp_detect flag here to force to enable HP
2508 spec
->hp_detect
= 1;
2511 case HDA_FIXUP_ACT_PROBE
:
2512 /* enable bass on HP dv7 */
2513 cap
= snd_hda_param_read(codec
, 0x1, AC_PAR_GPIO_CAP
);
2514 cap
&= AC_GPIO_IO_COUNT
;
2516 stac_add_hp_bass_switch(codec
);
2521 static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec
*codec
,
2522 const struct hda_fixup
*fix
, int action
)
2524 struct sigmatel_spec
*spec
= codec
->spec
;
2526 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2528 spec
->gpio_led
= 0x08;
2529 spec
->num_dmics
= 1;
2530 spec
->num_smuxes
= 1;
2531 spec
->num_dmuxes
= 1;
2535 static void stac92hd71bxx_fixup_hp(struct hda_codec
*codec
,
2536 const struct hda_fixup
*fix
, int action
)
2538 struct sigmatel_spec
*spec
= codec
->spec
;
2540 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2543 if (hp_blike_system(codec
->subsystem_id
)) {
2544 unsigned int pin_cfg
= snd_hda_codec_get_pincfg(codec
, 0x0f);
2545 if (get_defcfg_device(pin_cfg
) == AC_JACK_LINE_OUT
||
2546 get_defcfg_device(pin_cfg
) == AC_JACK_SPEAKER
||
2547 get_defcfg_device(pin_cfg
) == AC_JACK_HP_OUT
) {
2548 /* It was changed in the BIOS to just satisfy MS DTM.
2549 * Lets turn it back into slaved HP
2551 pin_cfg
= (pin_cfg
& (~AC_DEFCFG_DEVICE
))
2552 | (AC_JACK_HP_OUT
<<
2553 AC_DEFCFG_DEVICE_SHIFT
);
2554 pin_cfg
= (pin_cfg
& (~(AC_DEFCFG_DEF_ASSOC
2555 | AC_DEFCFG_SEQUENCE
)))
2557 snd_hda_codec_set_pincfg(codec
, 0x0f, pin_cfg
);
2561 if (find_mute_led_cfg(codec
, 1))
2562 snd_printd("mute LED gpio %d polarity %d\n",
2564 spec
->gpio_led_polarity
);
2568 static const struct hda_fixup stac92hd71bxx_fixups
[] = {
2569 [STAC_92HD71BXX_REF
] = {
2570 .type
= HDA_FIXUP_FUNC
,
2571 .v
.func
= stac92hd71bxx_fixup_ref
,
2573 [STAC_DELL_M4_1
] = {
2574 .type
= HDA_FIXUP_PINS
,
2575 .v
.pins
= dell_m4_1_pin_configs
,
2577 .chain_id
= STAC_92HD71BXX_NO_SMUX
,
2579 [STAC_DELL_M4_2
] = {
2580 .type
= HDA_FIXUP_PINS
,
2581 .v
.pins
= dell_m4_2_pin_configs
,
2583 .chain_id
= STAC_92HD71BXX_NO_DMIC
,
2585 [STAC_DELL_M4_3
] = {
2586 .type
= HDA_FIXUP_PINS
,
2587 .v
.pins
= dell_m4_3_pin_configs
,
2589 .chain_id
= STAC_92HD71BXX_NO_SMUX
,
2592 .type
= HDA_FIXUP_FUNC
,
2593 .v
.func
= stac92hd71bxx_fixup_hp_m4
,
2595 .chain_id
= STAC_92HD71BXX_HP
,
2598 .type
= HDA_FIXUP_FUNC
,
2599 .v
.func
= stac92hd71bxx_fixup_hp_dv4
,
2601 .chain_id
= STAC_HP_DV5
,
2604 .type
= HDA_FIXUP_FUNC
,
2605 .v
.func
= stac92hd71bxx_fixup_hp_dv5
,
2607 .chain_id
= STAC_92HD71BXX_HP
,
2610 .type
= HDA_FIXUP_FUNC
,
2611 .v
.func
= stac92hd71bxx_fixup_hp_hdx
,
2613 .chain_id
= STAC_92HD71BXX_HP
,
2615 [STAC_HP_DV4_1222NR
] = {
2616 .type
= HDA_FIXUP_FUNC
,
2617 .v
.func
= stac92hd71bxx_fixup_hp_dv4_1222nr
,
2619 .chain_id
= STAC_HP_DV4
,
2621 [STAC_92HD71BXX_NO_DMIC
] = {
2622 .type
= HDA_FIXUP_FUNC
,
2623 .v
.func
= stac92hd71bxx_fixup_no_dmic
,
2625 [STAC_92HD71BXX_NO_SMUX
] = {
2626 .type
= HDA_FIXUP_FUNC
,
2627 .v
.func
= stac92hd71bxx_fixup_no_smux
,
2629 [STAC_92HD71BXX_HP
] = {
2630 .type
= HDA_FIXUP_FUNC
,
2631 .v
.func
= stac92hd71bxx_fixup_hp
,
2635 static const struct hda_model_fixup stac92hd71bxx_models
[] = {
2636 { .id
= STAC_92HD71BXX_REF
, .name
= "ref" },
2637 { .id
= STAC_DELL_M4_1
, .name
= "dell-m4-1" },
2638 { .id
= STAC_DELL_M4_2
, .name
= "dell-m4-2" },
2639 { .id
= STAC_DELL_M4_3
, .name
= "dell-m4-3" },
2640 { .id
= STAC_HP_M4
, .name
= "hp-m4" },
2641 { .id
= STAC_HP_DV4
, .name
= "hp-dv4" },
2642 { .id
= STAC_HP_DV5
, .name
= "hp-dv5" },
2643 { .id
= STAC_HP_HDX
, .name
= "hp-hdx" },
2644 { .id
= STAC_HP_DV4_1222NR
, .name
= "hp-dv4-1222nr" },
2648 static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl
[] = {
2649 /* SigmaTel reference board */
2650 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
2651 "DFI LanParty", STAC_92HD71BXX_REF
),
2652 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
2653 "DFI LanParty", STAC_92HD71BXX_REF
),
2654 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x30fb,
2655 "HP dv4-1222nr", STAC_HP_DV4_1222NR
),
2656 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x1720,
2658 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3080,
2660 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x30f0,
2661 "HP dv4-7", STAC_HP_DV4
),
2662 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3600,
2663 "HP dv4-7", STAC_HP_DV5
),
2664 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3610,
2665 "HP HDX", STAC_HP_HDX
), /* HDX18 */
2666 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361a,
2667 "HP mini 1000", STAC_HP_M4
),
2668 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x361b,
2669 "HP HDX", STAC_HP_HDX
), /* HDX16 */
2670 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x3620,
2671 "HP dv6", STAC_HP_DV5
),
2672 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x3061,
2673 "HP dv6", STAC_HP_DV5
), /* HP dv6-1110ax */
2674 SND_PCI_QUIRK(PCI_VENDOR_ID_HP
, 0x363e,
2675 "HP DV6", STAC_HP_DV5
),
2676 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP
, 0xfff0, 0x7010,
2678 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP
, "HP", STAC_92HD71BXX_HP
),
2679 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0233,
2680 "unknown Dell", STAC_DELL_M4_1
),
2681 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0234,
2682 "unknown Dell", STAC_DELL_M4_1
),
2683 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0250,
2684 "unknown Dell", STAC_DELL_M4_1
),
2685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024f,
2686 "unknown Dell", STAC_DELL_M4_1
),
2687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x024d,
2688 "unknown Dell", STAC_DELL_M4_1
),
2689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0251,
2690 "unknown Dell", STAC_DELL_M4_1
),
2691 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0277,
2692 "unknown Dell", STAC_DELL_M4_1
),
2693 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0263,
2694 "unknown Dell", STAC_DELL_M4_2
),
2695 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0265,
2696 "unknown Dell", STAC_DELL_M4_2
),
2697 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0262,
2698 "unknown Dell", STAC_DELL_M4_2
),
2699 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0264,
2700 "unknown Dell", STAC_DELL_M4_2
),
2701 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02aa,
2702 "unknown Dell", STAC_DELL_M4_3
),
2706 static const struct hda_pintbl ref922x_pin_configs
[] = {
2707 { 0x0a, 0x01014010 },
2708 { 0x0b, 0x01016011 },
2709 { 0x0c, 0x01012012 },
2710 { 0x0d, 0x0221401f },
2711 { 0x0e, 0x01813122 },
2712 { 0x0f, 0x01011014 },
2713 { 0x10, 0x01441030 },
2714 { 0x11, 0x01c41030 },
2715 { 0x15, 0x40000100 },
2716 { 0x1b, 0x40000100 },
2721 STAC 922X pin configs for
2728 static const struct hda_pintbl dell_922x_d81_pin_configs
[] = {
2729 { 0x0a, 0x02214030 },
2730 { 0x0b, 0x01a19021 },
2731 { 0x0c, 0x01111012 },
2732 { 0x0d, 0x01114010 },
2733 { 0x0e, 0x02a19020 },
2734 { 0x0f, 0x01117011 },
2735 { 0x10, 0x400001f0 },
2736 { 0x11, 0x400001f1 },
2737 { 0x15, 0x01813122 },
2738 { 0x1b, 0x400001f2 },
2743 STAC 922X pin configs for
2747 static const struct hda_pintbl dell_922x_d82_pin_configs
[] = {
2748 { 0x0a, 0x02214030 },
2749 { 0x0b, 0x01a19021 },
2750 { 0x0c, 0x01111012 },
2751 { 0x0d, 0x01114010 },
2752 { 0x0e, 0x02a19020 },
2753 { 0x0f, 0x01117011 },
2754 { 0x10, 0x01451140 },
2755 { 0x11, 0x400001f0 },
2756 { 0x15, 0x01813122 },
2757 { 0x1b, 0x400001f1 },
2762 STAC 922X pin configs for
2765 static const struct hda_pintbl dell_922x_m81_pin_configs
[] = {
2766 { 0x0a, 0x0321101f },
2767 { 0x0b, 0x01112024 },
2768 { 0x0c, 0x01111222 },
2769 { 0x0d, 0x91174220 },
2770 { 0x0e, 0x03a11050 },
2771 { 0x0f, 0x01116221 },
2772 { 0x10, 0x90a70330 },
2773 { 0x11, 0x01452340 },
2774 { 0x15, 0x40C003f1 },
2775 { 0x1b, 0x405003f0 },
2780 STAC 9221 A1 pin configs for
2781 102801D7 (Dell XPS M1210)
2783 static const struct hda_pintbl dell_922x_m82_pin_configs
[] = {
2784 { 0x0a, 0x02211211 },
2785 { 0x0b, 0x408103ff },
2786 { 0x0c, 0x02a1123e },
2787 { 0x0d, 0x90100310 },
2788 { 0x0e, 0x408003f1 },
2789 { 0x0f, 0x0221121f },
2790 { 0x10, 0x03451340 },
2791 { 0x11, 0x40c003f2 },
2792 { 0x15, 0x508003f3 },
2793 { 0x1b, 0x405003f4 },
2797 static const struct hda_pintbl d945gtp3_pin_configs
[] = {
2798 { 0x0a, 0x0221401f },
2799 { 0x0b, 0x01a19022 },
2800 { 0x0c, 0x01813021 },
2801 { 0x0d, 0x01014010 },
2802 { 0x0e, 0x40000100 },
2803 { 0x0f, 0x40000100 },
2804 { 0x10, 0x40000100 },
2805 { 0x11, 0x40000100 },
2806 { 0x15, 0x02a19120 },
2807 { 0x1b, 0x40000100 },
2811 static const struct hda_pintbl d945gtp5_pin_configs
[] = {
2812 { 0x0a, 0x0221401f },
2813 { 0x0b, 0x01011012 },
2814 { 0x0c, 0x01813024 },
2815 { 0x0d, 0x01014010 },
2816 { 0x0e, 0x01a19021 },
2817 { 0x0f, 0x01016011 },
2818 { 0x10, 0x01452130 },
2819 { 0x11, 0x40000100 },
2820 { 0x15, 0x02a19320 },
2821 { 0x1b, 0x40000100 },
2825 static const struct hda_pintbl intel_mac_v1_pin_configs
[] = {
2826 { 0x0a, 0x0121e21f },
2827 { 0x0b, 0x400000ff },
2828 { 0x0c, 0x9017e110 },
2829 { 0x0d, 0x400000fd },
2830 { 0x0e, 0x400000fe },
2831 { 0x0f, 0x0181e020 },
2832 { 0x10, 0x1145e030 },
2833 { 0x11, 0x11c5e240 },
2834 { 0x15, 0x400000fc },
2835 { 0x1b, 0x400000fb },
2839 static const struct hda_pintbl intel_mac_v2_pin_configs
[] = {
2840 { 0x0a, 0x0121e21f },
2841 { 0x0b, 0x90a7012e },
2842 { 0x0c, 0x9017e110 },
2843 { 0x0d, 0x400000fd },
2844 { 0x0e, 0x400000fe },
2845 { 0x0f, 0x0181e020 },
2846 { 0x10, 0x1145e230 },
2847 { 0x11, 0x500000fa },
2848 { 0x15, 0x400000fc },
2849 { 0x1b, 0x400000fb },
2853 static const struct hda_pintbl intel_mac_v3_pin_configs
[] = {
2854 { 0x0a, 0x0121e21f },
2855 { 0x0b, 0x90a7012e },
2856 { 0x0c, 0x9017e110 },
2857 { 0x0d, 0x400000fd },
2858 { 0x0e, 0x400000fe },
2859 { 0x0f, 0x0181e020 },
2860 { 0x10, 0x1145e230 },
2861 { 0x11, 0x11c5e240 },
2862 { 0x15, 0x400000fc },
2863 { 0x1b, 0x400000fb },
2867 static const struct hda_pintbl intel_mac_v4_pin_configs
[] = {
2868 { 0x0a, 0x0321e21f },
2869 { 0x0b, 0x03a1e02e },
2870 { 0x0c, 0x9017e110 },
2871 { 0x0d, 0x9017e11f },
2872 { 0x0e, 0x400000fe },
2873 { 0x0f, 0x0381e020 },
2874 { 0x10, 0x1345e230 },
2875 { 0x11, 0x13c5e240 },
2876 { 0x15, 0x400000fc },
2877 { 0x1b, 0x400000fb },
2881 static const struct hda_pintbl intel_mac_v5_pin_configs
[] = {
2882 { 0x0a, 0x0321e21f },
2883 { 0x0b, 0x03a1e02e },
2884 { 0x0c, 0x9017e110 },
2885 { 0x0d, 0x9017e11f },
2886 { 0x0e, 0x400000fe },
2887 { 0x0f, 0x0381e020 },
2888 { 0x10, 0x1345e230 },
2889 { 0x11, 0x13c5e240 },
2890 { 0x15, 0x400000fc },
2891 { 0x1b, 0x400000fb },
2895 static const struct hda_pintbl ecs202_pin_configs
[] = {
2896 { 0x0a, 0x0221401f },
2897 { 0x0b, 0x02a19020 },
2898 { 0x0c, 0x01a19020 },
2899 { 0x0d, 0x01114010 },
2900 { 0x0e, 0x408000f0 },
2901 { 0x0f, 0x01813022 },
2902 { 0x10, 0x074510a0 },
2903 { 0x11, 0x40c400f1 },
2904 { 0x15, 0x9037012e },
2905 { 0x1b, 0x40e000f2 },
2909 /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
2910 static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl
[] = {
2911 SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1
),
2912 SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2
),
2913 SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2
),
2914 SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3
),
2915 SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3
),
2916 SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3
),
2917 SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3
),
2918 SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3
),
2919 SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3
),
2920 SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4
),
2921 SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5
),
2922 SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5
),
2926 static const struct hda_fixup stac922x_fixups
[];
2928 /* remap the fixup from codec SSID and apply it */
2929 static void stac922x_fixup_intel_mac_auto(struct hda_codec
*codec
,
2930 const struct hda_fixup
*fix
,
2933 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2935 snd_hda_pick_fixup(codec
, NULL
, stac922x_intel_mac_fixup_tbl
,
2937 if (codec
->fixup_id
!= STAC_INTEL_MAC_AUTO
)
2938 snd_hda_apply_fixup(codec
, action
);
2941 static void stac922x_fixup_intel_mac_gpio(struct hda_codec
*codec
,
2942 const struct hda_fixup
*fix
,
2945 struct sigmatel_spec
*spec
= codec
->spec
;
2947 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
2948 spec
->gpio_mask
= spec
->gpio_dir
= 0x03;
2949 spec
->gpio_data
= 0x03;
2953 static const struct hda_fixup stac922x_fixups
[] = {
2955 .type
= HDA_FIXUP_PINS
,
2956 .v
.pins
= ref922x_pin_configs
,
2959 .type
= HDA_FIXUP_PINS
,
2960 .v
.pins
= d945gtp3_pin_configs
,
2963 .type
= HDA_FIXUP_PINS
,
2964 .v
.pins
= d945gtp5_pin_configs
,
2966 [STAC_INTEL_MAC_AUTO
] = {
2967 .type
= HDA_FIXUP_FUNC
,
2968 .v
.func
= stac922x_fixup_intel_mac_auto
,
2970 [STAC_INTEL_MAC_V1
] = {
2971 .type
= HDA_FIXUP_PINS
,
2972 .v
.pins
= intel_mac_v1_pin_configs
,
2974 .chain_id
= STAC_922X_INTEL_MAC_GPIO
,
2976 [STAC_INTEL_MAC_V2
] = {
2977 .type
= HDA_FIXUP_PINS
,
2978 .v
.pins
= intel_mac_v2_pin_configs
,
2980 .chain_id
= STAC_922X_INTEL_MAC_GPIO
,
2982 [STAC_INTEL_MAC_V3
] = {
2983 .type
= HDA_FIXUP_PINS
,
2984 .v
.pins
= intel_mac_v3_pin_configs
,
2986 .chain_id
= STAC_922X_INTEL_MAC_GPIO
,
2988 [STAC_INTEL_MAC_V4
] = {
2989 .type
= HDA_FIXUP_PINS
,
2990 .v
.pins
= intel_mac_v4_pin_configs
,
2992 .chain_id
= STAC_922X_INTEL_MAC_GPIO
,
2994 [STAC_INTEL_MAC_V5
] = {
2995 .type
= HDA_FIXUP_PINS
,
2996 .v
.pins
= intel_mac_v5_pin_configs
,
2998 .chain_id
= STAC_922X_INTEL_MAC_GPIO
,
3000 [STAC_922X_INTEL_MAC_GPIO
] = {
3001 .type
= HDA_FIXUP_FUNC
,
3002 .v
.func
= stac922x_fixup_intel_mac_gpio
,
3005 .type
= HDA_FIXUP_PINS
,
3006 .v
.pins
= ecs202_pin_configs
,
3008 [STAC_922X_DELL_D81
] = {
3009 .type
= HDA_FIXUP_PINS
,
3010 .v
.pins
= dell_922x_d81_pin_configs
,
3012 [STAC_922X_DELL_D82
] = {
3013 .type
= HDA_FIXUP_PINS
,
3014 .v
.pins
= dell_922x_d82_pin_configs
,
3016 [STAC_922X_DELL_M81
] = {
3017 .type
= HDA_FIXUP_PINS
,
3018 .v
.pins
= dell_922x_m81_pin_configs
,
3020 [STAC_922X_DELL_M82
] = {
3021 .type
= HDA_FIXUP_PINS
,
3022 .v
.pins
= dell_922x_m82_pin_configs
,
3026 static const struct hda_model_fixup stac922x_models
[] = {
3027 { .id
= STAC_D945_REF
, .name
= "ref" },
3028 { .id
= STAC_D945GTP5
, .name
= "5stack" },
3029 { .id
= STAC_D945GTP3
, .name
= "3stack" },
3030 { .id
= STAC_INTEL_MAC_V1
, .name
= "intel-mac-v1" },
3031 { .id
= STAC_INTEL_MAC_V2
, .name
= "intel-mac-v2" },
3032 { .id
= STAC_INTEL_MAC_V3
, .name
= "intel-mac-v3" },
3033 { .id
= STAC_INTEL_MAC_V4
, .name
= "intel-mac-v4" },
3034 { .id
= STAC_INTEL_MAC_V5
, .name
= "intel-mac-v5" },
3035 { .id
= STAC_INTEL_MAC_AUTO
, .name
= "intel-mac-auto" },
3036 { .id
= STAC_ECS_202
, .name
= "ecs202" },
3037 { .id
= STAC_922X_DELL_D81
, .name
= "dell-d81" },
3038 { .id
= STAC_922X_DELL_D82
, .name
= "dell-d82" },
3039 { .id
= STAC_922X_DELL_M81
, .name
= "dell-m81" },
3040 { .id
= STAC_922X_DELL_M82
, .name
= "dell-m82" },
3041 /* for backward compatibility */
3042 { .id
= STAC_INTEL_MAC_V3
, .name
= "macmini" },
3043 { .id
= STAC_INTEL_MAC_V5
, .name
= "macbook" },
3044 { .id
= STAC_INTEL_MAC_V3
, .name
= "macbook-pro-v1" },
3045 { .id
= STAC_INTEL_MAC_V3
, .name
= "macbook-pro" },
3046 { .id
= STAC_INTEL_MAC_V2
, .name
= "imac-intel" },
3047 { .id
= STAC_INTEL_MAC_V3
, .name
= "imac-intel-20" },
3051 static const struct snd_pci_quirk stac922x_fixup_tbl
[] = {
3052 /* SigmaTel reference board */
3053 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
3054 "DFI LanParty", STAC_D945_REF
),
3055 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
3056 "DFI LanParty", STAC_D945_REF
),
3057 /* Intel 945G based systems */
3058 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0101,
3059 "Intel D945G", STAC_D945GTP3
),
3060 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0202,
3061 "Intel D945G", STAC_D945GTP3
),
3062 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0606,
3063 "Intel D945G", STAC_D945GTP3
),
3064 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0601,
3065 "Intel D945G", STAC_D945GTP3
),
3066 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0111,
3067 "Intel D945G", STAC_D945GTP3
),
3068 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1115,
3069 "Intel D945G", STAC_D945GTP3
),
3070 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1116,
3071 "Intel D945G", STAC_D945GTP3
),
3072 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1117,
3073 "Intel D945G", STAC_D945GTP3
),
3074 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1118,
3075 "Intel D945G", STAC_D945GTP3
),
3076 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x1119,
3077 "Intel D945G", STAC_D945GTP3
),
3078 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x8826,
3079 "Intel D945G", STAC_D945GTP3
),
3080 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5049,
3081 "Intel D945G", STAC_D945GTP3
),
3082 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5055,
3083 "Intel D945G", STAC_D945GTP3
),
3084 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x5048,
3085 "Intel D945G", STAC_D945GTP3
),
3086 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0110,
3087 "Intel D945G", STAC_D945GTP3
),
3088 /* Intel D945G 5-stack systems */
3089 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0404,
3090 "Intel D945G", STAC_D945GTP5
),
3091 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0303,
3092 "Intel D945G", STAC_D945GTP5
),
3093 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0013,
3094 "Intel D945G", STAC_D945GTP5
),
3095 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0417,
3096 "Intel D945G", STAC_D945GTP5
),
3097 /* Intel 945P based systems */
3098 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0b0b,
3099 "Intel D945P", STAC_D945GTP3
),
3100 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0112,
3101 "Intel D945P", STAC_D945GTP3
),
3102 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0d0d,
3103 "Intel D945P", STAC_D945GTP3
),
3104 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0909,
3105 "Intel D945P", STAC_D945GTP3
),
3106 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0505,
3107 "Intel D945P", STAC_D945GTP3
),
3108 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0707,
3109 "Intel D945P", STAC_D945GTP5
),
3111 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x0204,
3112 "Intel D945", STAC_D945_REF
),
3115 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
3116 SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO
),
3119 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a7,
3120 "unknown Dell", STAC_922X_DELL_D81
),
3121 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01a9,
3122 "unknown Dell", STAC_922X_DELL_D81
),
3123 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ab,
3124 "unknown Dell", STAC_922X_DELL_D81
),
3125 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ac,
3126 "unknown Dell", STAC_922X_DELL_D82
),
3127 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01bf,
3128 "unknown Dell", STAC_922X_DELL_M81
),
3129 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d0,
3130 "unknown Dell", STAC_922X_DELL_D82
),
3131 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d1,
3132 "unknown Dell", STAC_922X_DELL_D81
),
3133 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d2,
3134 "unknown Dell", STAC_922X_DELL_D81
),
3135 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01d7,
3136 "Dell XPS M1210", STAC_922X_DELL_M82
),
3137 /* ECS/PC Chips boards */
3138 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
3139 "ECS/PC chips", STAC_ECS_202
),
3143 static const struct hda_pintbl ref927x_pin_configs
[] = {
3144 { 0x0a, 0x02214020 },
3145 { 0x0b, 0x02a19080 },
3146 { 0x0c, 0x0181304e },
3147 { 0x0d, 0x01014010 },
3148 { 0x0e, 0x01a19040 },
3149 { 0x0f, 0x01011012 },
3150 { 0x10, 0x01016011 },
3151 { 0x11, 0x0101201f },
3152 { 0x12, 0x183301f0 },
3153 { 0x13, 0x18a001f0 },
3154 { 0x14, 0x18a001f0 },
3155 { 0x21, 0x01442070 },
3156 { 0x22, 0x01c42190 },
3157 { 0x23, 0x40000100 },
3161 static const struct hda_pintbl d965_3st_pin_configs
[] = {
3162 { 0x0a, 0x0221401f },
3163 { 0x0b, 0x02a19120 },
3164 { 0x0c, 0x40000100 },
3165 { 0x0d, 0x01014011 },
3166 { 0x0e, 0x01a19021 },
3167 { 0x0f, 0x01813024 },
3168 { 0x10, 0x40000100 },
3169 { 0x11, 0x40000100 },
3170 { 0x12, 0x40000100 },
3171 { 0x13, 0x40000100 },
3172 { 0x14, 0x40000100 },
3173 { 0x21, 0x40000100 },
3174 { 0x22, 0x40000100 },
3175 { 0x23, 0x40000100 },
3179 static const struct hda_pintbl d965_5st_pin_configs
[] = {
3180 { 0x0a, 0x02214020 },
3181 { 0x0b, 0x02a19080 },
3182 { 0x0c, 0x0181304e },
3183 { 0x0d, 0x01014010 },
3184 { 0x0e, 0x01a19040 },
3185 { 0x0f, 0x01011012 },
3186 { 0x10, 0x01016011 },
3187 { 0x11, 0x40000100 },
3188 { 0x12, 0x40000100 },
3189 { 0x13, 0x40000100 },
3190 { 0x14, 0x40000100 },
3191 { 0x21, 0x01442070 },
3192 { 0x22, 0x40000100 },
3193 { 0x23, 0x40000100 },
3197 static const struct hda_pintbl d965_5st_no_fp_pin_configs
[] = {
3198 { 0x0a, 0x40000100 },
3199 { 0x0b, 0x40000100 },
3200 { 0x0c, 0x0181304e },
3201 { 0x0d, 0x01014010 },
3202 { 0x0e, 0x01a19040 },
3203 { 0x0f, 0x01011012 },
3204 { 0x10, 0x01016011 },
3205 { 0x11, 0x40000100 },
3206 { 0x12, 0x40000100 },
3207 { 0x13, 0x40000100 },
3208 { 0x14, 0x40000100 },
3209 { 0x21, 0x01442070 },
3210 { 0x22, 0x40000100 },
3211 { 0x23, 0x40000100 },
3215 static const struct hda_pintbl dell_3st_pin_configs
[] = {
3216 { 0x0a, 0x02211230 },
3217 { 0x0b, 0x02a11220 },
3218 { 0x0c, 0x01a19040 },
3219 { 0x0d, 0x01114210 },
3220 { 0x0e, 0x01111212 },
3221 { 0x0f, 0x01116211 },
3222 { 0x10, 0x01813050 },
3223 { 0x11, 0x01112214 },
3224 { 0x12, 0x403003fa },
3225 { 0x13, 0x90a60040 },
3226 { 0x14, 0x90a60040 },
3227 { 0x21, 0x404003fb },
3228 { 0x22, 0x40c003fc },
3229 { 0x23, 0x40000100 },
3233 static void stac927x_fixup_ref_no_jd(struct hda_codec
*codec
,
3234 const struct hda_fixup
*fix
, int action
)
3236 struct sigmatel_spec
*spec
= codec
->spec
;
3238 /* no jack detecion for ref-no-jd model */
3239 if (action
== HDA_FIXUP_ACT_PROBE
)
3240 spec
->hp_detect
= 0;
3243 static void stac927x_fixup_ref(struct hda_codec
*codec
,
3244 const struct hda_fixup
*fix
, int action
)
3246 struct sigmatel_spec
*spec
= codec
->spec
;
3248 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3249 snd_hda_apply_pincfgs(codec
, ref927x_pin_configs
);
3250 spec
->eapd_mask
= spec
->gpio_mask
= 0;
3251 spec
->gpio_dir
= spec
->gpio_data
= 0;
3255 static void stac927x_fixup_dell_dmic(struct hda_codec
*codec
,
3256 const struct hda_fixup
*fix
, int action
)
3258 struct sigmatel_spec
*spec
= codec
->spec
;
3260 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
3263 if (codec
->subsystem_id
!= 0x1028022f) {
3264 /* GPIO2 High = Enable EAPD */
3265 spec
->eapd_mask
= spec
->gpio_mask
= 0x04;
3266 spec
->gpio_dir
= spec
->gpio_data
= 0x04;
3268 spec
->dmic_nids
= stac927x_dmic_nids
;
3269 spec
->num_dmics
= STAC927X_NUM_DMICS
;
3271 snd_hda_add_verbs(codec
, dell_3st_core_init
);
3272 spec
->volknob_init
= 1;
3273 spec
->dmux_nids
= stac927x_dmux_nids
;
3274 spec
->num_dmuxes
= ARRAY_SIZE(stac927x_dmux_nids
);
3277 static void stac927x_fixup_volknob(struct hda_codec
*codec
,
3278 const struct hda_fixup
*fix
, int action
)
3280 struct sigmatel_spec
*spec
= codec
->spec
;
3282 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3283 snd_hda_add_verbs(codec
, stac927x_volknob_core_init
);
3284 spec
->volknob_init
= 1;
3288 static const struct hda_fixup stac927x_fixups
[] = {
3289 [STAC_D965_REF_NO_JD
] = {
3290 .type
= HDA_FIXUP_FUNC
,
3291 .v
.func
= stac927x_fixup_ref_no_jd
,
3293 .chain_id
= STAC_D965_REF
,
3296 .type
= HDA_FIXUP_FUNC
,
3297 .v
.func
= stac927x_fixup_ref
,
3300 .type
= HDA_FIXUP_PINS
,
3301 .v
.pins
= d965_3st_pin_configs
,
3303 .chain_id
= STAC_D965_VERBS
,
3306 .type
= HDA_FIXUP_PINS
,
3307 .v
.pins
= d965_5st_pin_configs
,
3309 .chain_id
= STAC_D965_VERBS
,
3311 [STAC_D965_VERBS
] = {
3312 .type
= HDA_FIXUP_VERBS
,
3313 .v
.verbs
= d965_core_init
,
3315 [STAC_D965_5ST_NO_FP
] = {
3316 .type
= HDA_FIXUP_PINS
,
3317 .v
.pins
= d965_5st_no_fp_pin_configs
,
3320 .type
= HDA_FIXUP_PINS
,
3321 .v
.pins
= dell_3st_pin_configs
,
3323 .chain_id
= STAC_927X_DELL_DMIC
,
3325 [STAC_DELL_BIOS
] = {
3326 .type
= HDA_FIXUP_PINS
,
3327 .v
.pins
= (const struct hda_pintbl
[]) {
3328 /* configure the analog microphone on some laptops */
3329 { 0x0c, 0x90a79130 },
3330 /* correct the front output jack as a hp out */
3331 { 0x0f, 0x0227011f },
3332 /* correct the front input jack as a mic */
3333 { 0x0e, 0x02a79130 },
3337 .chain_id
= STAC_927X_DELL_DMIC
,
3339 [STAC_DELL_BIOS_SPDIF
] = {
3340 .type
= HDA_FIXUP_PINS
,
3341 .v
.pins
= (const struct hda_pintbl
[]) {
3342 /* correct the device field to SPDIF out */
3343 { 0x21, 0x01442070 },
3347 .chain_id
= STAC_DELL_BIOS
,
3349 [STAC_927X_DELL_DMIC
] = {
3350 .type
= HDA_FIXUP_FUNC
,
3351 .v
.func
= stac927x_fixup_dell_dmic
,
3353 [STAC_927X_VOLKNOB
] = {
3354 .type
= HDA_FIXUP_FUNC
,
3355 .v
.func
= stac927x_fixup_volknob
,
3359 static const struct hda_model_fixup stac927x_models
[] = {
3360 { .id
= STAC_D965_REF_NO_JD
, .name
= "ref-no-jd" },
3361 { .id
= STAC_D965_REF
, .name
= "ref" },
3362 { .id
= STAC_D965_3ST
, .name
= "3stack" },
3363 { .id
= STAC_D965_5ST
, .name
= "5stack" },
3364 { .id
= STAC_D965_5ST_NO_FP
, .name
= "5stack-no-fp" },
3365 { .id
= STAC_DELL_3ST
, .name
= "dell-3stack" },
3366 { .id
= STAC_DELL_BIOS
, .name
= "dell-bios" },
3367 { .id
= STAC_927X_VOLKNOB
, .name
= "volknob" },
3371 static const struct snd_pci_quirk stac927x_fixup_tbl
[] = {
3372 /* SigmaTel reference board */
3373 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
3374 "DFI LanParty", STAC_D965_REF
),
3375 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
3376 "DFI LanParty", STAC_D965_REF
),
3377 /* Intel 946 based systems */
3378 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x3d01, "Intel D946", STAC_D965_3ST
),
3379 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xa301, "Intel D946", STAC_D965_3ST
),
3380 /* 965 based 3 stack systems */
3381 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2100,
3382 "Intel D965", STAC_D965_3ST
),
3383 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2000,
3384 "Intel D965", STAC_D965_3ST
),
3385 /* Dell 3 stack systems */
3386 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST
),
3387 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ed, "Dell ", STAC_DELL_3ST
),
3388 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f4, "Dell ", STAC_DELL_3ST
),
3389 /* Dell 3 stack systems with verb table in BIOS */
3390 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS
),
3391 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS
),
3392 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS
),
3393 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022e, "Dell ", STAC_DELL_BIOS_SPDIF
),
3394 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS
),
3395 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0242, "Dell ", STAC_DELL_BIOS
),
3396 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0243, "Dell ", STAC_DELL_BIOS
),
3397 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x02ff, "Dell ", STAC_DELL_BIOS
),
3398 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF
),
3399 /* 965 based 5 stack systems */
3400 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2300,
3401 "Intel D965", STAC_D965_5ST
),
3402 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL
, 0xff00, 0x2500,
3403 "Intel D965", STAC_D965_5ST
),
3404 /* volume-knob fixes */
3405 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB
),
3409 static const struct hda_pintbl ref9205_pin_configs
[] = {
3410 { 0x0a, 0x40000100 },
3411 { 0x0b, 0x40000100 },
3412 { 0x0c, 0x01016011 },
3413 { 0x0d, 0x01014010 },
3414 { 0x0e, 0x01813122 },
3415 { 0x0f, 0x01a19021 },
3416 { 0x14, 0x01019020 },
3417 { 0x16, 0x40000100 },
3418 { 0x17, 0x90a000f0 },
3419 { 0x18, 0x90a000f0 },
3420 { 0x21, 0x01441030 },
3421 { 0x22, 0x01c41030 },
3426 STAC 9205 pin configs for
3433 10280228 (Dell Vostro 1500)
3434 10280229 (Dell Vostro 1700)
3436 static const struct hda_pintbl dell_9205_m42_pin_configs
[] = {
3437 { 0x0a, 0x0321101F },
3438 { 0x0b, 0x03A11020 },
3439 { 0x0c, 0x400003FA },
3440 { 0x0d, 0x90170310 },
3441 { 0x0e, 0x400003FB },
3442 { 0x0f, 0x400003FC },
3443 { 0x14, 0x400003FD },
3444 { 0x16, 0x40F000F9 },
3445 { 0x17, 0x90A60330 },
3446 { 0x18, 0x400003FF },
3447 { 0x21, 0x0144131F },
3448 { 0x22, 0x40C003FE },
3453 STAC 9205 pin configs for
3457 102801FF (Dell Precision M4300)
3462 static const struct hda_pintbl dell_9205_m43_pin_configs
[] = {
3463 { 0x0a, 0x0321101f },
3464 { 0x0b, 0x03a11020 },
3465 { 0x0c, 0x90a70330 },
3466 { 0x0d, 0x90170310 },
3467 { 0x0e, 0x400000fe },
3468 { 0x0f, 0x400000ff },
3469 { 0x14, 0x400000fd },
3470 { 0x16, 0x40f000f9 },
3471 { 0x17, 0x400000fa },
3472 { 0x18, 0x400000fc },
3473 { 0x21, 0x0144131f },
3474 { 0x22, 0x40c003f8 },
3475 /* Enable SPDIF in/out */
3476 { 0x1f, 0x01441030 },
3477 { 0x20, 0x1c410030 },
3481 static const struct hda_pintbl dell_9205_m44_pin_configs
[] = {
3482 { 0x0a, 0x0421101f },
3483 { 0x0b, 0x04a11020 },
3484 { 0x0c, 0x400003fa },
3485 { 0x0d, 0x90170310 },
3486 { 0x0e, 0x400003fb },
3487 { 0x0f, 0x400003fc },
3488 { 0x14, 0x400003fd },
3489 { 0x16, 0x400003f9 },
3490 { 0x17, 0x90a60330 },
3491 { 0x18, 0x400003ff },
3492 { 0x21, 0x01441340 },
3493 { 0x22, 0x40c003fe },
3497 static void stac9205_fixup_ref(struct hda_codec
*codec
,
3498 const struct hda_fixup
*fix
, int action
)
3500 struct sigmatel_spec
*spec
= codec
->spec
;
3502 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3503 snd_hda_apply_pincfgs(codec
, ref9205_pin_configs
);
3504 /* SPDIF-In enabled */
3505 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0;
3509 static void stac9205_fixup_dell_m43(struct hda_codec
*codec
,
3510 const struct hda_fixup
*fix
, int action
)
3512 struct sigmatel_spec
*spec
= codec
->spec
;
3515 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3516 snd_hda_apply_pincfgs(codec
, dell_9205_m43_pin_configs
);
3518 /* Enable unsol response for GPIO4/Dock HP connection */
3519 err
= stac_add_event(codec
, codec
->afg
, STAC_VREF_EVENT
, 0x01);
3522 snd_hda_codec_write_cache(codec
, codec
->afg
, 0,
3523 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK
, 0x10);
3524 snd_hda_jack_detect_enable(codec
, codec
->afg
, 0);
3526 spec
->gpio_dir
= 0x0b;
3527 spec
->eapd_mask
= 0x01;
3528 spec
->gpio_mask
= 0x1b;
3529 spec
->gpio_mute
= 0x10;
3530 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3533 spec
->gpio_data
= 0x01;
3537 static void stac9205_fixup_eapd(struct hda_codec
*codec
,
3538 const struct hda_fixup
*fix
, int action
)
3540 struct sigmatel_spec
*spec
= codec
->spec
;
3542 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
3543 spec
->eapd_switch
= 0;
3546 static const struct hda_fixup stac9205_fixups
[] = {
3548 .type
= HDA_FIXUP_FUNC
,
3549 .v
.func
= stac9205_fixup_ref
,
3551 [STAC_9205_DELL_M42
] = {
3552 .type
= HDA_FIXUP_PINS
,
3553 .v
.pins
= dell_9205_m42_pin_configs
,
3555 [STAC_9205_DELL_M43
] = {
3556 .type
= HDA_FIXUP_FUNC
,
3557 .v
.func
= stac9205_fixup_dell_m43
,
3559 [STAC_9205_DELL_M44
] = {
3560 .type
= HDA_FIXUP_PINS
,
3561 .v
.pins
= dell_9205_m44_pin_configs
,
3563 [STAC_9205_EAPD
] = {
3564 .type
= HDA_FIXUP_FUNC
,
3565 .v
.func
= stac9205_fixup_eapd
,
3570 static const struct hda_model_fixup stac9205_models
[] = {
3571 { .id
= STAC_9205_REF
, .name
= "ref" },
3572 { .id
= STAC_9205_DELL_M42
, .name
= "dell-m42" },
3573 { .id
= STAC_9205_DELL_M43
, .name
= "dell-m43" },
3574 { .id
= STAC_9205_DELL_M44
, .name
= "dell-m44" },
3575 { .id
= STAC_9205_EAPD
, .name
= "eapd" },
3579 static const struct snd_pci_quirk stac9205_fixup_tbl
[] = {
3580 /* SigmaTel reference board */
3581 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0x2668,
3582 "DFI LanParty", STAC_9205_REF
),
3583 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL
, 0xfb30,
3584 "SigmaTel", STAC_9205_REF
),
3585 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI
, 0x3101,
3586 "DFI LanParty", STAC_9205_REF
),
3588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f1,
3589 "unknown Dell", STAC_9205_DELL_M42
),
3590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f2,
3591 "unknown Dell", STAC_9205_DELL_M42
),
3592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f8,
3593 "Dell Precision", STAC_9205_DELL_M43
),
3594 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01f9,
3595 "Dell Precision", STAC_9205_DELL_M43
),
3596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fa,
3597 "Dell Precision", STAC_9205_DELL_M43
),
3598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fc,
3599 "unknown Dell", STAC_9205_DELL_M42
),
3600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fd,
3601 "unknown Dell", STAC_9205_DELL_M42
),
3602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01fe,
3603 "Dell Precision", STAC_9205_DELL_M43
),
3604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x01ff,
3605 "Dell Precision M4300", STAC_9205_DELL_M43
),
3606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0204,
3607 "unknown Dell", STAC_9205_DELL_M42
),
3608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0206,
3609 "Dell Precision", STAC_9205_DELL_M43
),
3610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021b,
3611 "Dell Precision", STAC_9205_DELL_M43
),
3612 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021c,
3613 "Dell Precision", STAC_9205_DELL_M43
),
3614 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x021f,
3615 "Dell Inspiron", STAC_9205_DELL_M44
),
3616 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0228,
3617 "Dell Vostro 1500", STAC_9205_DELL_M42
),
3618 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL
, 0x0229,
3619 "Dell Vostro 1700", STAC_9205_DELL_M42
),
3621 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD
),
3622 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD
),
3627 * Analog playback callbacks
3629 static int stac92xx_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3630 struct hda_codec
*codec
,
3631 struct snd_pcm_substream
*substream
)
3633 struct sigmatel_spec
*spec
= codec
->spec
;
3634 if (spec
->stream_delay
)
3635 msleep(spec
->stream_delay
);
3636 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3640 static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3641 struct hda_codec
*codec
,
3642 unsigned int stream_tag
,
3643 unsigned int format
,
3644 struct snd_pcm_substream
*substream
)
3646 struct sigmatel_spec
*spec
= codec
->spec
;
3647 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
, stream_tag
, format
, substream
);
3650 static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3651 struct hda_codec
*codec
,
3652 struct snd_pcm_substream
*substream
)
3654 struct sigmatel_spec
*spec
= codec
->spec
;
3655 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3659 * Digital playback callbacks
3661 static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3662 struct hda_codec
*codec
,
3663 struct snd_pcm_substream
*substream
)
3665 struct sigmatel_spec
*spec
= codec
->spec
;
3666 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3669 static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3670 struct hda_codec
*codec
,
3671 struct snd_pcm_substream
*substream
)
3673 struct sigmatel_spec
*spec
= codec
->spec
;
3674 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3677 static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3678 struct hda_codec
*codec
,
3679 unsigned int stream_tag
,
3680 unsigned int format
,
3681 struct snd_pcm_substream
*substream
)
3683 struct sigmatel_spec
*spec
= codec
->spec
;
3684 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3685 stream_tag
, format
, substream
);
3688 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3689 struct hda_codec
*codec
,
3690 struct snd_pcm_substream
*substream
)
3692 struct sigmatel_spec
*spec
= codec
->spec
;
3693 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3698 * Analog capture callbacks
3700 static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3701 struct hda_codec
*codec
,
3702 unsigned int stream_tag
,
3703 unsigned int format
,
3704 struct snd_pcm_substream
*substream
)
3706 struct sigmatel_spec
*spec
= codec
->spec
;
3707 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
3709 if (spec
->powerdown_adcs
) {
3711 snd_hda_codec_write(codec
, nid
, 0,
3712 AC_VERB_SET_POWER_STATE
, AC_PWRST_D0
);
3714 snd_hda_codec_setup_stream(codec
, nid
, stream_tag
, 0, format
);
3718 static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3719 struct hda_codec
*codec
,
3720 struct snd_pcm_substream
*substream
)
3722 struct sigmatel_spec
*spec
= codec
->spec
;
3723 hda_nid_t nid
= spec
->adc_nids
[substream
->number
];
3725 snd_hda_codec_cleanup_stream(codec
, nid
);
3726 if (spec
->powerdown_adcs
)
3727 snd_hda_codec_write(codec
, nid
, 0,
3728 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
3732 static const struct hda_pcm_stream stac92xx_pcm_digital_playback
= {
3736 /* NID is set in stac92xx_build_pcms */
3738 .open
= stac92xx_dig_playback_pcm_open
,
3739 .close
= stac92xx_dig_playback_pcm_close
,
3740 .prepare
= stac92xx_dig_playback_pcm_prepare
,
3741 .cleanup
= stac92xx_dig_playback_pcm_cleanup
3745 static const struct hda_pcm_stream stac92xx_pcm_digital_capture
= {
3749 /* NID is set in stac92xx_build_pcms */
3752 static const struct hda_pcm_stream stac92xx_pcm_analog_playback
= {
3756 .nid
= 0x02, /* NID to query formats and rates */
3758 .open
= stac92xx_playback_pcm_open
,
3759 .prepare
= stac92xx_playback_pcm_prepare
,
3760 .cleanup
= stac92xx_playback_pcm_cleanup
3764 static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback
= {
3768 .nid
= 0x06, /* NID to query formats and rates */
3770 .open
= stac92xx_playback_pcm_open
,
3771 .prepare
= stac92xx_playback_pcm_prepare
,
3772 .cleanup
= stac92xx_playback_pcm_cleanup
3776 static const struct hda_pcm_stream stac92xx_pcm_analog_capture
= {
3779 /* NID + .substreams is set in stac92xx_build_pcms */
3781 .prepare
= stac92xx_capture_pcm_prepare
,
3782 .cleanup
= stac92xx_capture_pcm_cleanup
3786 static int stac92xx_build_pcms(struct hda_codec
*codec
)
3788 struct sigmatel_spec
*spec
= codec
->spec
;
3789 struct hda_pcm
*info
= spec
->pcm_rec
;
3791 codec
->num_pcms
= 1;
3792 codec
->pcm_info
= info
;
3794 info
->name
= "STAC92xx Analog";
3795 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_playback
;
3796 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
3797 spec
->multiout
.dac_nids
[0];
3798 if (spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
&&
3799 spec
->autocfg
.line_outs
== 2)
3800 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].chmap
=
3803 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_analog_capture
;
3804 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
3805 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
= spec
->num_adcs
;
3807 if (spec
->alt_switch
) {
3810 info
->name
= "STAC92xx Analog Alt";
3811 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_analog_alt_playback
;
3814 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
3817 info
->name
= "STAC92xx Digital";
3818 info
->pcm_type
= spec
->autocfg
.dig_out_type
[0];
3819 if (spec
->multiout
.dig_out_nid
) {
3820 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = stac92xx_pcm_digital_playback
;
3821 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
3823 if (spec
->dig_in_nid
) {
3824 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = stac92xx_pcm_digital_capture
;
3825 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
3832 static void stac92xx_auto_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
, int pin_type
)
3835 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_type
);
3838 #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info
3840 static int stac92xx_hp_switch_get(struct snd_kcontrol
*kcontrol
,
3841 struct snd_ctl_elem_value
*ucontrol
)
3843 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3844 struct sigmatel_spec
*spec
= codec
->spec
;
3846 ucontrol
->value
.integer
.value
[0] = !!spec
->hp_switch
;
3850 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
);
3852 static int stac92xx_hp_switch_put(struct snd_kcontrol
*kcontrol
,
3853 struct snd_ctl_elem_value
*ucontrol
)
3855 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3856 struct sigmatel_spec
*spec
= codec
->spec
;
3857 int nid
= kcontrol
->private_value
;
3859 spec
->hp_switch
= ucontrol
->value
.integer
.value
[0] ? nid
: 0;
3861 /* check to be sure that the ports are up to date with
3864 stac_issue_unsol_event(codec
, nid
);
3869 static int stac92xx_dc_bias_info(struct snd_kcontrol
*kcontrol
,
3870 struct snd_ctl_elem_info
*uinfo
)
3873 static const char * const texts
[] = {
3874 "Mic In", "Line In", "Line Out"
3877 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3878 struct sigmatel_spec
*spec
= codec
->spec
;
3879 hda_nid_t nid
= kcontrol
->private_value
;
3881 if (nid
== spec
->mic_switch
|| nid
== spec
->line_switch
)
3886 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3887 uinfo
->value
.enumerated
.items
= i
;
3889 if (uinfo
->value
.enumerated
.item
>= i
)
3890 uinfo
->value
.enumerated
.item
= i
-1;
3891 strcpy(uinfo
->value
.enumerated
.name
,
3892 texts
[uinfo
->value
.enumerated
.item
]);
3897 static int stac92xx_dc_bias_get(struct snd_kcontrol
*kcontrol
,
3898 struct snd_ctl_elem_value
*ucontrol
)
3900 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3901 hda_nid_t nid
= kcontrol
->private_value
;
3902 unsigned int vref
= stac92xx_vref_get(codec
, nid
);
3904 if (vref
== snd_hda_get_default_vref(codec
, nid
))
3905 ucontrol
->value
.enumerated
.item
[0] = 0;
3906 else if (vref
== AC_PINCTL_VREF_GRD
)
3907 ucontrol
->value
.enumerated
.item
[0] = 1;
3908 else if (vref
== AC_PINCTL_VREF_HIZ
)
3909 ucontrol
->value
.enumerated
.item
[0] = 2;
3914 static int stac92xx_dc_bias_put(struct snd_kcontrol
*kcontrol
,
3915 struct snd_ctl_elem_value
*ucontrol
)
3917 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3918 unsigned int new_vref
= 0;
3920 hda_nid_t nid
= kcontrol
->private_value
;
3922 if (ucontrol
->value
.enumerated
.item
[0] == 0)
3923 new_vref
= snd_hda_get_default_vref(codec
, nid
);
3924 else if (ucontrol
->value
.enumerated
.item
[0] == 1)
3925 new_vref
= AC_PINCTL_VREF_GRD
;
3926 else if (ucontrol
->value
.enumerated
.item
[0] == 2)
3927 new_vref
= AC_PINCTL_VREF_HIZ
;
3931 if (new_vref
!= stac92xx_vref_get(codec
, nid
)) {
3932 error
= stac92xx_vref_set(codec
, nid
, new_vref
);
3939 static int stac92xx_io_switch_info(struct snd_kcontrol
*kcontrol
,
3940 struct snd_ctl_elem_info
*uinfo
)
3943 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3944 struct sigmatel_spec
*spec
= codec
->spec
;
3946 if (kcontrol
->private_value
== spec
->line_switch
)
3947 texts
[0] = "Line In";
3949 texts
[0] = "Mic In";
3950 texts
[1] = "Line Out";
3951 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3952 uinfo
->value
.enumerated
.items
= 2;
3955 if (uinfo
->value
.enumerated
.item
>= 2)
3956 uinfo
->value
.enumerated
.item
= 1;
3957 strcpy(uinfo
->value
.enumerated
.name
,
3958 texts
[uinfo
->value
.enumerated
.item
]);
3963 static int stac92xx_io_switch_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
3965 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3966 struct sigmatel_spec
*spec
= codec
->spec
;
3967 hda_nid_t nid
= kcontrol
->private_value
;
3968 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
3970 ucontrol
->value
.enumerated
.item
[0] = spec
->io_switch
[io_idx
];
3974 static int stac92xx_io_switch_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
3976 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3977 struct sigmatel_spec
*spec
= codec
->spec
;
3978 hda_nid_t nid
= kcontrol
->private_value
;
3979 int io_idx
= (nid
== spec
->mic_switch
) ? 1 : 0;
3980 unsigned short val
= !!ucontrol
->value
.enumerated
.item
[0];
3982 spec
->io_switch
[io_idx
] = val
;
3985 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
3987 unsigned int pinctl
= AC_PINCTL_IN_EN
;
3988 if (io_idx
) /* set VREF for mic */
3989 pinctl
|= snd_hda_get_default_vref(codec
, nid
);
3990 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
3993 /* check the auto-mute again: we need to mute/unmute the speaker
3994 * appropriately according to the pin direction
3996 if (spec
->hp_detect
)
3997 stac_issue_unsol_event(codec
, nid
);
4002 #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info
4004 static int stac92xx_clfe_switch_get(struct snd_kcontrol
*kcontrol
,
4005 struct snd_ctl_elem_value
*ucontrol
)
4007 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4008 struct sigmatel_spec
*spec
= codec
->spec
;
4010 ucontrol
->value
.integer
.value
[0] = spec
->clfe_swap
;
4014 static int stac92xx_clfe_switch_put(struct snd_kcontrol
*kcontrol
,
4015 struct snd_ctl_elem_value
*ucontrol
)
4017 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4018 struct sigmatel_spec
*spec
= codec
->spec
;
4019 hda_nid_t nid
= kcontrol
->private_value
& 0xff;
4020 unsigned int val
= !!ucontrol
->value
.integer
.value
[0];
4022 if (spec
->clfe_swap
== val
)
4025 spec
->clfe_swap
= val
;
4027 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
4028 spec
->clfe_swap
? 0x4 : 0x0);
4033 #define STAC_CODEC_HP_SWITCH(xname) \
4034 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4037 .info = stac92xx_hp_switch_info, \
4038 .get = stac92xx_hp_switch_get, \
4039 .put = stac92xx_hp_switch_put, \
4042 #define STAC_CODEC_IO_SWITCH(xname, xpval) \
4043 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4046 .info = stac92xx_io_switch_info, \
4047 .get = stac92xx_io_switch_get, \
4048 .put = stac92xx_io_switch_put, \
4049 .private_value = xpval, \
4052 #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \
4053 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4056 .info = stac92xx_clfe_switch_info, \
4057 .get = stac92xx_clfe_switch_get, \
4058 .put = stac92xx_clfe_switch_put, \
4059 .private_value = xpval, \
4063 STAC_CTL_WIDGET_VOL
,
4064 STAC_CTL_WIDGET_MUTE
,
4065 STAC_CTL_WIDGET_MUTE_BEEP
,
4066 STAC_CTL_WIDGET_MONO_MUX
,
4067 STAC_CTL_WIDGET_HP_SWITCH
,
4068 STAC_CTL_WIDGET_IO_SWITCH
,
4069 STAC_CTL_WIDGET_CLFE_SWITCH
,
4070 STAC_CTL_WIDGET_DC_BIAS
4073 static const struct snd_kcontrol_new stac92xx_control_templates
[] = {
4074 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4075 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4076 HDA_CODEC_MUTE_BEEP(NULL
, 0, 0, 0),
4078 STAC_CODEC_HP_SWITCH(NULL
),
4079 STAC_CODEC_IO_SWITCH(NULL
, 0),
4080 STAC_CODEC_CLFE_SWITCH(NULL
, 0),
4081 DC_BIAS(NULL
, 0, 0),
4084 /* add dynamic controls */
4085 static struct snd_kcontrol_new
*
4086 stac_control_new(struct sigmatel_spec
*spec
,
4087 const struct snd_kcontrol_new
*ktemp
,
4089 unsigned int subdev
)
4091 struct snd_kcontrol_new
*knew
;
4093 knew
= snd_array_new(&spec
->kctls
);
4097 knew
->name
= kstrdup(name
, GFP_KERNEL
);
4100 memset(knew
, 0, sizeof(*knew
));
4101 spec
->kctls
.alloced
--;
4104 knew
->subdevice
= subdev
;
4108 static struct snd_kcontrol_new
*
4109 add_control_temp(struct sigmatel_spec
*spec
,
4110 const struct snd_kcontrol_new
*ktemp
,
4111 int idx
, const char *name
,
4114 struct snd_kcontrol_new
*knew
= stac_control_new(spec
, ktemp
, name
,
4115 HDA_SUBDEV_AMP_FLAG
);
4119 knew
->private_value
= val
;
4123 static int stac92xx_add_control_temp(struct sigmatel_spec
*spec
,
4124 const struct snd_kcontrol_new
*ktemp
,
4125 int idx
, const char *name
,
4128 return add_control_temp(spec
, ktemp
, idx
, name
, val
) ? 0 : -ENOMEM
;
4131 static inline int stac92xx_add_control_idx(struct sigmatel_spec
*spec
,
4132 int type
, int idx
, const char *name
,
4135 return stac92xx_add_control_temp(spec
,
4136 &stac92xx_control_templates
[type
],
4141 /* add dynamic controls */
4142 static inline int stac92xx_add_control(struct sigmatel_spec
*spec
, int type
,
4143 const char *name
, unsigned long val
)
4145 return stac92xx_add_control_idx(spec
, type
, 0, name
, val
);
4148 static const struct snd_kcontrol_new stac_input_src_temp
= {
4149 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4150 .name
= "Input Source",
4151 .info
= stac92xx_mux_enum_info
,
4152 .get
= stac92xx_mux_enum_get
,
4153 .put
= stac92xx_mux_enum_put
,
4156 static inline int stac92xx_add_jack_mode_control(struct hda_codec
*codec
,
4157 hda_nid_t nid
, int idx
)
4159 int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4161 struct sigmatel_spec
*spec
= codec
->spec
;
4164 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
4165 if (spec
->headset_jack
&& snd_hda_get_input_pin_attr(def_conf
)
4166 != INPUT_PIN_ATTR_DOCK
)
4168 if (snd_hda_get_default_vref(codec
, nid
) == AC_PINCTL_VREF_GRD
4169 && nid
== spec
->line_switch
)
4170 control
= STAC_CTL_WIDGET_IO_SWITCH
;
4171 else if (snd_hda_query_pin_caps(codec
, nid
)
4172 & (AC_PINCAP_VREF_GRD
<< AC_PINCAP_VREF_SHIFT
))
4173 control
= STAC_CTL_WIDGET_DC_BIAS
;
4174 else if (nid
== spec
->mic_switch
)
4175 control
= STAC_CTL_WIDGET_IO_SWITCH
;
4179 snd_hda_get_pin_label(codec
, nid
, &spec
->autocfg
,
4180 name
, sizeof(name
), NULL
);
4181 return stac92xx_add_control(codec
->spec
, control
,
4182 strcat(name
, " Jack Mode"), nid
);
4188 static int stac92xx_add_input_source(struct sigmatel_spec
*spec
)
4190 struct snd_kcontrol_new
*knew
;
4191 struct hda_input_mux
*imux
= &spec
->private_imux
;
4194 return 0; /* no need for input source */
4195 if (!spec
->num_adcs
|| imux
->num_items
<= 1)
4196 return 0; /* no need for input source control */
4197 knew
= stac_control_new(spec
, &stac_input_src_temp
,
4198 stac_input_src_temp
.name
, 0);
4201 knew
->count
= spec
->num_adcs
;
4205 /* check whether the line-input can be used as line-out */
4206 static hda_nid_t
check_line_out_switch(struct hda_codec
*codec
)
4208 struct sigmatel_spec
*spec
= codec
->spec
;
4209 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4211 unsigned int pincap
;
4214 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
4216 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4217 if (cfg
->inputs
[i
].type
== AUTO_PIN_LINE_IN
) {
4218 nid
= cfg
->inputs
[i
].pin
;
4219 pincap
= snd_hda_query_pin_caps(codec
, nid
);
4220 if (pincap
& AC_PINCAP_OUT
)
4227 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
);
4229 /* check whether the mic-input can be used as line-out */
4230 static hda_nid_t
check_mic_out_switch(struct hda_codec
*codec
, hda_nid_t
*dac
)
4232 struct sigmatel_spec
*spec
= codec
->spec
;
4233 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4234 unsigned int def_conf
, pincap
;
4238 if (cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
4240 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4241 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
4242 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
4244 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4245 /* some laptops have an internal analog microphone
4246 * which can't be used as a output */
4247 if (snd_hda_get_input_pin_attr(def_conf
) != INPUT_PIN_ATTR_INT
) {
4248 pincap
= snd_hda_query_pin_caps(codec
, nid
);
4249 if (pincap
& AC_PINCAP_OUT
) {
4250 *dac
= get_unassigned_dac(codec
, nid
);
4259 static int is_in_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
4263 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++) {
4264 if (spec
->multiout
.dac_nids
[i
] == nid
)
4271 static int check_all_dac_nids(struct sigmatel_spec
*spec
, hda_nid_t nid
)
4274 if (is_in_dac_nids(spec
, nid
))
4276 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++)
4277 if (spec
->hp_dacs
[i
] == nid
)
4279 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++)
4280 if (spec
->speaker_dacs
[i
] == nid
)
4285 static hda_nid_t
get_unassigned_dac(struct hda_codec
*codec
, hda_nid_t nid
)
4287 struct sigmatel_spec
*spec
= codec
->spec
;
4288 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4290 hda_nid_t conn
[HDA_MAX_CONNECTIONS
], fallback_dac
;
4291 unsigned int wcaps
, wtype
;
4293 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
4294 HDA_MAX_CONNECTIONS
);
4295 /* 92HD88: trace back up the link of nids to find the DAC */
4296 while (conn_len
== 1 && (get_wcaps_type(get_wcaps(codec
, conn
[0]))
4297 != AC_WID_AUD_OUT
)) {
4299 conn_len
= snd_hda_get_connections(codec
, nid
, conn
,
4300 HDA_MAX_CONNECTIONS
);
4302 for (j
= 0; j
< conn_len
; j
++) {
4303 wcaps
= get_wcaps(codec
, conn
[j
]);
4304 wtype
= get_wcaps_type(wcaps
);
4305 /* we check only analog outputs */
4306 if (wtype
!= AC_WID_AUD_OUT
|| (wcaps
& AC_WCAP_DIGITAL
))
4308 /* if this route has a free DAC, assign it */
4309 if (!check_all_dac_nids(spec
, conn
[j
])) {
4311 /* select this DAC in the pin's input mux */
4312 snd_hda_codec_write_cache(codec
, nid
, 0,
4313 AC_VERB_SET_CONNECT_SEL
, j
);
4319 /* if all DACs are already assigned, connect to the primary DAC,
4320 unless we're assigning a secondary headphone */
4321 fallback_dac
= spec
->multiout
.dac_nids
[0];
4322 if (spec
->multiout
.hp_nid
) {
4323 for (j
= 0; j
< cfg
->hp_outs
; j
++)
4324 if (cfg
->hp_pins
[j
] == nid
) {
4325 fallback_dac
= spec
->multiout
.hp_nid
;
4331 for (j
= 0; j
< conn_len
; j
++) {
4332 if (conn
[j
] == fallback_dac
) {
4333 snd_hda_codec_write_cache(codec
, nid
, 0,
4334 AC_VERB_SET_CONNECT_SEL
, j
);
4342 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
4343 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
);
4346 * Fill in the dac_nids table from the parsed pin configuration
4347 * This function only works when every pin in line_out_pins[]
4348 * contains atleast one DAC in its connection list. Some 92xx
4349 * codecs are not connected directly to a DAC, such as the 9200
4350 * and 9202/925x. For those, dac_nids[] must be hard-coded.
4352 static int stac92xx_auto_fill_dac_nids(struct hda_codec
*codec
)
4354 struct sigmatel_spec
*spec
= codec
->spec
;
4355 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4359 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4360 nid
= cfg
->line_out_pins
[i
];
4361 dac
= get_unassigned_dac(codec
, nid
);
4363 if (spec
->multiout
.num_dacs
> 0) {
4364 /* we have already working output pins,
4365 * so let's drop the broken ones again
4367 cfg
->line_outs
= spec
->multiout
.num_dacs
;
4370 /* error out, no available DAC found */
4372 "%s: No available DAC for pin 0x%x\n",
4376 add_spec_dacs(spec
, dac
);
4379 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
4380 nid
= cfg
->hp_pins
[i
];
4381 dac
= get_unassigned_dac(codec
, nid
);
4383 if (!spec
->multiout
.hp_nid
)
4384 spec
->multiout
.hp_nid
= dac
;
4386 add_spec_extra_dacs(spec
, dac
);
4388 spec
->hp_dacs
[i
] = dac
;
4391 for (i
= 0; i
< cfg
->speaker_outs
; i
++) {
4392 nid
= cfg
->speaker_pins
[i
];
4393 dac
= get_unassigned_dac(codec
, nid
);
4395 add_spec_extra_dacs(spec
, dac
);
4396 spec
->speaker_dacs
[i
] = dac
;
4399 /* add line-in as output */
4400 nid
= check_line_out_switch(codec
);
4402 dac
= get_unassigned_dac(codec
, nid
);
4404 snd_printdd("STAC: Add line-in 0x%x as output %d\n",
4405 nid
, cfg
->line_outs
);
4406 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
4408 spec
->line_switch
= nid
;
4409 add_spec_dacs(spec
, dac
);
4412 /* add mic as output */
4413 nid
= check_mic_out_switch(codec
, &dac
);
4415 snd_printdd("STAC: Add mic-in 0x%x as output %d\n",
4416 nid
, cfg
->line_outs
);
4417 cfg
->line_out_pins
[cfg
->line_outs
] = nid
;
4419 spec
->mic_switch
= nid
;
4420 add_spec_dacs(spec
, dac
);
4423 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
4424 spec
->multiout
.num_dacs
,
4425 spec
->multiout
.dac_nids
[0],
4426 spec
->multiout
.dac_nids
[1],
4427 spec
->multiout
.dac_nids
[2],
4428 spec
->multiout
.dac_nids
[3],
4429 spec
->multiout
.dac_nids
[4]);
4434 /* create volume control/switch for the given prefx type */
4435 static int create_controls_idx(struct hda_codec
*codec
, const char *pfx
,
4436 int idx
, hda_nid_t nid
, int chs
)
4438 struct sigmatel_spec
*spec
= codec
->spec
;
4442 if (!spec
->check_volume_offset
) {
4443 unsigned int caps
, step
, nums
, db_scale
;
4444 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
4445 step
= (caps
& AC_AMPCAP_STEP_SIZE
) >>
4446 AC_AMPCAP_STEP_SIZE_SHIFT
;
4447 step
= (step
+ 1) * 25; /* in .01dB unit */
4448 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >>
4449 AC_AMPCAP_NUM_STEPS_SHIFT
;
4450 db_scale
= nums
* step
;
4451 /* if dB scale is over -64dB, and finer enough,
4452 * let's reduce it to half
4454 if (db_scale
> 6400 && nums
>= 0x1f)
4455 spec
->volume_offset
= nums
/ 2;
4456 spec
->check_volume_offset
= 1;
4459 sprintf(name
, "%s Playback Volume", pfx
);
4460 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
4461 HDA_COMPOSE_AMP_VAL_OFS(nid
, chs
, 0, HDA_OUTPUT
,
4462 spec
->volume_offset
));
4465 sprintf(name
, "%s Playback Switch", pfx
);
4466 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_MUTE
, idx
, name
,
4467 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
4473 #define create_controls(codec, pfx, nid, chs) \
4474 create_controls_idx(codec, pfx, 0, nid, chs)
4476 static int add_spec_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
4478 if (spec
->multiout
.num_dacs
> 4) {
4479 printk(KERN_WARNING
"stac92xx: No space for DAC 0x%x\n", nid
);
4482 snd_BUG_ON(spec
->multiout
.dac_nids
!= spec
->dac_nids
);
4483 spec
->dac_nids
[spec
->multiout
.num_dacs
] = nid
;
4484 spec
->multiout
.num_dacs
++;
4489 static int add_spec_extra_dacs(struct sigmatel_spec
*spec
, hda_nid_t nid
)
4492 for (i
= 0; i
< ARRAY_SIZE(spec
->multiout
.extra_out_nid
); i
++) {
4493 if (!spec
->multiout
.extra_out_nid
[i
]) {
4494 spec
->multiout
.extra_out_nid
[i
] = nid
;
4498 printk(KERN_WARNING
"stac92xx: No space for extra DAC 0x%x\n", nid
);
4502 /* Create output controls
4503 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT)
4505 static int create_multi_out_ctls(struct hda_codec
*codec
, int num_outs
,
4506 const hda_nid_t
*pins
,
4507 const hda_nid_t
*dac_nids
,
4510 struct sigmatel_spec
*spec
= codec
->spec
;
4511 static const char * const chname
[4] = {
4512 "Front", "Surround", NULL
/*CLFE*/, "Side"
4516 unsigned int wid_caps
;
4518 for (i
= 0; i
< num_outs
&& i
< ARRAY_SIZE(chname
); i
++) {
4519 if (type
== AUTO_PIN_HP_OUT
&& !spec
->hp_detect
) {
4520 if (is_jack_detectable(codec
, pins
[i
]))
4521 spec
->hp_detect
= 1;
4526 if (type
!= AUTO_PIN_HP_OUT
&& i
== 2) {
4528 err
= create_controls(codec
, "Center", nid
, 1);
4531 err
= create_controls(codec
, "LFE", nid
, 2);
4535 wid_caps
= get_wcaps(codec
, nid
);
4537 if (wid_caps
& AC_WCAP_LR_SWAP
) {
4538 err
= stac92xx_add_control(spec
,
4539 STAC_CTL_WIDGET_CLFE_SWITCH
,
4540 "Swap Center/LFE Playback Switch", nid
);
4550 case AUTO_PIN_HP_OUT
:
4554 case AUTO_PIN_SPEAKER_OUT
:
4555 if (num_outs
<= 2) {
4556 name
= i
? "Bass Speaker" : "Speaker";
4560 /* Fall through in case of multi speaker outs */
4566 err
= create_controls_idx(codec
, name
, idx
, nid
, 3);
4574 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
4575 unsigned int dir_mask
, unsigned int data
);
4577 /* hook for controlling mic-mute LED GPIO */
4578 static int stac92xx_capture_sw_put_led(struct snd_kcontrol
*kcontrol
,
4579 struct snd_ctl_elem_value
*ucontrol
)
4581 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4582 struct sigmatel_spec
*spec
= codec
->spec
;
4586 err
= snd_hda_mixer_amp_switch_put(kcontrol
, ucontrol
);
4589 mute
= !(ucontrol
->value
.integer
.value
[0] &&
4590 ucontrol
->value
.integer
.value
[1]);
4591 if (spec
->mic_mute_led_on
!= mute
) {
4592 spec
->mic_mute_led_on
= mute
;
4594 spec
->gpio_data
|= spec
->mic_mute_led_gpio
;
4596 spec
->gpio_data
&= ~spec
->mic_mute_led_gpio
;
4597 stac_gpio_set(codec
, spec
->gpio_mask
,
4598 spec
->gpio_dir
, spec
->gpio_data
);
4603 static int stac92xx_add_capvol_ctls(struct hda_codec
*codec
, unsigned long vol
,
4604 unsigned long sw
, int idx
)
4606 struct sigmatel_spec
*spec
= codec
->spec
;
4607 struct snd_kcontrol_new
*knew
;
4610 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
,
4611 "Capture Volume", vol
);
4615 knew
= add_control_temp(spec
,
4616 &stac92xx_control_templates
[STAC_CTL_WIDGET_MUTE
],
4617 idx
, "Capture Switch", sw
);
4620 /* add a LED hook for some HP laptops */
4621 if (spec
->mic_mute_led_gpio
)
4622 knew
->put
= stac92xx_capture_sw_put_led
;
4627 /* add playback controls from the parsed DAC table */
4628 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec
*codec
,
4629 const struct auto_pin_cfg
*cfg
)
4631 struct sigmatel_spec
*spec
= codec
->spec
;
4636 err
= create_multi_out_ctls(codec
, cfg
->line_outs
, cfg
->line_out_pins
,
4637 spec
->multiout
.dac_nids
,
4638 cfg
->line_out_type
);
4642 if (cfg
->hp_outs
> 1 && cfg
->line_out_type
== AUTO_PIN_LINE_OUT
) {
4643 err
= stac92xx_add_control(spec
,
4644 STAC_CTL_WIDGET_HP_SWITCH
,
4645 "Headphone as Line Out Switch",
4646 cfg
->hp_pins
[cfg
->hp_outs
- 1]);
4651 for (idx
= 0; idx
< cfg
->num_inputs
; idx
++) {
4652 if (cfg
->inputs
[idx
].type
> AUTO_PIN_LINE_IN
)
4654 nid
= cfg
->inputs
[idx
].pin
;
4655 err
= stac92xx_add_jack_mode_control(codec
, nid
, idx
);
4663 /* add playback controls for Speaker and HP outputs */
4664 static int stac92xx_auto_create_hp_ctls(struct hda_codec
*codec
,
4665 struct auto_pin_cfg
*cfg
)
4667 struct sigmatel_spec
*spec
= codec
->spec
;
4670 err
= create_multi_out_ctls(codec
, cfg
->hp_outs
, cfg
->hp_pins
,
4671 spec
->hp_dacs
, AUTO_PIN_HP_OUT
);
4675 err
= create_multi_out_ctls(codec
, cfg
->speaker_outs
, cfg
->speaker_pins
,
4676 spec
->speaker_dacs
, AUTO_PIN_SPEAKER_OUT
);
4683 /* labels for mono mux outputs */
4684 static const char * const stac92xx_mono_labels
[4] = {
4685 "DAC0", "DAC1", "Mixer", "DAC2"
4688 /* create mono mux for mono out on capable codecs */
4689 static int stac92xx_auto_create_mono_output_ctls(struct hda_codec
*codec
)
4691 struct sigmatel_spec
*spec
= codec
->spec
;
4692 struct hda_input_mux
*mono_mux
= &spec
->private_mono_mux
;
4694 hda_nid_t con_lst
[ARRAY_SIZE(stac92xx_mono_labels
)];
4696 num_cons
= snd_hda_get_connections(codec
,
4699 HDA_MAX_NUM_INPUTS
);
4700 if (num_cons
<= 0 || num_cons
> ARRAY_SIZE(stac92xx_mono_labels
))
4703 for (i
= 0; i
< num_cons
; i
++)
4704 snd_hda_add_imux_item(mono_mux
, stac92xx_mono_labels
[i
], i
,
4707 return stac92xx_add_control(spec
, STAC_CTL_WIDGET_MONO_MUX
,
4708 "Mono Mux", spec
->mono_nid
);
4711 /* create PC beep volume controls */
4712 static int stac92xx_auto_create_beep_ctls(struct hda_codec
*codec
,
4715 struct sigmatel_spec
*spec
= codec
->spec
;
4716 u32 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
4717 int err
, type
= STAC_CTL_WIDGET_MUTE_BEEP
;
4719 if (spec
->anabeep_nid
== nid
)
4720 type
= STAC_CTL_WIDGET_MUTE
;
4722 /* check for mute support for the the amp */
4723 if ((caps
& AC_AMPCAP_MUTE
) >> AC_AMPCAP_MUTE_SHIFT
) {
4724 err
= stac92xx_add_control(spec
, type
,
4725 "Beep Playback Switch",
4726 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
4731 /* check to see if there is volume support for the amp */
4732 if ((caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
4733 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_VOL
,
4734 "Beep Playback Volume",
4735 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
));
4742 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4743 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
4745 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol
*kcontrol
,
4746 struct snd_ctl_elem_value
*ucontrol
)
4748 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4749 ucontrol
->value
.integer
.value
[0] = codec
->beep
->enabled
;
4753 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol
*kcontrol
,
4754 struct snd_ctl_elem_value
*ucontrol
)
4756 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4757 return snd_hda_enable_beep_device(codec
, ucontrol
->value
.integer
.value
[0]);
4760 static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl
= {
4761 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4762 .info
= stac92xx_dig_beep_switch_info
,
4763 .get
= stac92xx_dig_beep_switch_get
,
4764 .put
= stac92xx_dig_beep_switch_put
,
4767 static int stac92xx_beep_switch_ctl(struct hda_codec
*codec
)
4769 return stac92xx_add_control_temp(codec
->spec
, &stac92xx_dig_beep_ctrl
,
4770 0, "Beep Playback Switch", 0);
4774 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec
*codec
)
4776 struct sigmatel_spec
*spec
= codec
->spec
;
4779 for (i
= 0; i
< spec
->num_muxes
; i
++) {
4784 nid
= spec
->mux_nids
[i
];
4785 wcaps
= get_wcaps(codec
, nid
);
4786 if (!(wcaps
& AC_WCAP_OUT_AMP
))
4789 /* check whether already the same control was created as
4790 * normal Capture Volume.
4792 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4793 for (j
= 0; j
< spec
->num_caps
; j
++) {
4794 if (spec
->capvols
[j
] == val
)
4797 if (j
< spec
->num_caps
)
4800 err
= stac92xx_add_control_idx(spec
, STAC_CTL_WIDGET_VOL
, i
,
4801 "Mux Capture Volume", val
);
4808 static const char * const stac92xx_spdif_labels
[3] = {
4809 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
4812 static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec
*codec
)
4814 struct sigmatel_spec
*spec
= codec
->spec
;
4815 struct hda_input_mux
*spdif_mux
= &spec
->private_smux
;
4816 const char * const *labels
= spec
->spdif_labels
;
4818 hda_nid_t con_lst
[HDA_MAX_NUM_INPUTS
];
4820 num_cons
= snd_hda_get_connections(codec
,
4823 HDA_MAX_NUM_INPUTS
);
4828 labels
= stac92xx_spdif_labels
;
4830 for (i
= 0; i
< num_cons
; i
++)
4831 snd_hda_add_imux_item(spdif_mux
, labels
[i
], i
, NULL
);
4836 /* labels for dmic mux inputs */
4837 static const char * const stac92xx_dmic_labels
[5] = {
4838 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
4839 "Digital Mic 3", "Digital Mic 4"
4842 static hda_nid_t
get_connected_node(struct hda_codec
*codec
, hda_nid_t mux
,
4845 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
4847 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
4848 if (idx
>= 0 && idx
< nums
)
4853 /* look for NID recursively */
4854 #define get_connection_index(codec, mux, nid) \
4855 snd_hda_get_conn_index(codec, mux, nid, 1)
4857 /* create a volume assigned to the given pin (only if supported) */
4858 /* return 1 if the volume control is created */
4859 static int create_elem_capture_vol(struct hda_codec
*codec
, hda_nid_t nid
,
4860 const char *label
, int idx
, int direction
)
4862 unsigned int caps
, nums
;
4866 if (direction
== HDA_OUTPUT
)
4867 caps
= AC_WCAP_OUT_AMP
;
4869 caps
= AC_WCAP_IN_AMP
;
4870 if (!(get_wcaps(codec
, nid
) & caps
))
4872 caps
= query_amp_caps(codec
, nid
, direction
);
4873 nums
= (caps
& AC_AMPCAP_NUM_STEPS
) >> AC_AMPCAP_NUM_STEPS_SHIFT
;
4876 snprintf(name
, sizeof(name
), "%s Capture Volume", label
);
4877 err
= stac92xx_add_control_idx(codec
->spec
, STAC_CTL_WIDGET_VOL
, idx
, name
,
4878 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, direction
));
4884 /* create playback/capture controls for input pins on dmic capable codecs */
4885 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec
*codec
,
4886 const struct auto_pin_cfg
*cfg
)
4888 struct sigmatel_spec
*spec
= codec
->spec
;
4889 struct hda_input_mux
*imux
= &spec
->private_imux
;
4890 struct hda_input_mux
*dimux
= &spec
->private_dimux
;
4892 unsigned int def_conf
;
4894 snd_hda_add_imux_item(dimux
, stac92xx_dmic_labels
[0], 0, NULL
);
4896 for (i
= 0; i
< spec
->num_dmics
; i
++) {
4898 int index
, type_idx
;
4901 nid
= spec
->dmic_nids
[i
];
4902 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
4904 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
4905 if (get_defcfg_connect(def_conf
) == AC_JACK_PORT_NONE
)
4908 index
= get_connection_index(codec
, spec
->dmux_nids
[0], nid
);
4912 snd_hda_get_pin_label(codec
, nid
, &spec
->autocfg
,
4913 label
, sizeof(label
), NULL
);
4914 snd_hda_add_imux_item(dimux
, label
, index
, &type_idx
);
4915 if (snd_hda_get_bool_hint(codec
, "separate_dmux") != 1)
4916 snd_hda_add_imux_item(imux
, label
, index
, &type_idx
);
4918 err
= create_elem_capture_vol(codec
, nid
, label
, type_idx
,
4923 err
= create_elem_capture_vol(codec
, nid
, label
,
4924 type_idx
, HDA_OUTPUT
);
4928 nid
= get_connected_node(codec
,
4929 spec
->dmux_nids
[0], index
);
4931 err
= create_elem_capture_vol(codec
,
4933 type_idx
, HDA_INPUT
);
4943 static int check_mic_pin(struct hda_codec
*codec
, hda_nid_t nid
,
4944 hda_nid_t
*fixed
, hda_nid_t
*ext
, hda_nid_t
*dock
)
4951 cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
4952 type
= get_defcfg_device(cfg
);
4953 switch (snd_hda_get_input_pin_attr(cfg
)) {
4954 case INPUT_PIN_ATTR_INT
:
4956 return 1; /* already occupied */
4957 if (type
!= AC_JACK_MIC_IN
)
4958 return 1; /* invalid type */
4961 case INPUT_PIN_ATTR_UNUSED
:
4963 case INPUT_PIN_ATTR_DOCK
:
4965 return 1; /* already occupied */
4966 if (type
!= AC_JACK_MIC_IN
&& type
!= AC_JACK_LINE_IN
)
4967 return 1; /* invalid type */
4972 return 1; /* already occupied */
4973 if (type
!= AC_JACK_MIC_IN
)
4974 return 1; /* invalid type */
4981 static int set_mic_route(struct hda_codec
*codec
,
4982 struct sigmatel_mic_route
*mic
,
4985 struct sigmatel_spec
*spec
= codec
->spec
;
4986 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
4992 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
4993 if (pin
== cfg
->inputs
[i
].pin
)
4996 if (i
< cfg
->num_inputs
&& cfg
->inputs
[i
].type
== AUTO_PIN_MIC
) {
4998 i
= get_connection_index(codec
, spec
->mux_nids
[0], pin
);
5003 if (spec
->dmux_nids
)
5004 mic
->dmux_idx
= get_connection_index(codec
,
5007 } else if (spec
->dmux_nids
) {
5009 i
= get_connection_index(codec
, spec
->dmux_nids
[0], pin
);
5015 mic
->mux_idx
= get_connection_index(codec
,
5017 spec
->dmux_nids
[0]);
5022 /* return non-zero if the device is for automatic mic switch */
5023 static int stac_check_auto_mic(struct hda_codec
*codec
)
5025 struct sigmatel_spec
*spec
= codec
->spec
;
5026 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5027 hda_nid_t fixed
, ext
, dock
;
5030 fixed
= ext
= dock
= 0;
5031 for (i
= 0; i
< cfg
->num_inputs
; i
++)
5032 if (check_mic_pin(codec
, cfg
->inputs
[i
].pin
,
5033 &fixed
, &ext
, &dock
))
5035 for (i
= 0; i
< spec
->num_dmics
; i
++)
5036 if (check_mic_pin(codec
, spec
->dmic_nids
[i
],
5037 &fixed
, &ext
, &dock
))
5039 if (!fixed
|| (!ext
&& !dock
))
5040 return 0; /* no input to switch */
5041 if (!is_jack_detectable(codec
, ext
))
5042 return 0; /* no unsol support */
5043 if (set_mic_route(codec
, &spec
->ext_mic
, ext
) ||
5044 set_mic_route(codec
, &spec
->int_mic
, fixed
) ||
5045 set_mic_route(codec
, &spec
->dock_mic
, dock
))
5046 return 0; /* something is wrong */
5050 /* create playback/capture controls for input pins */
5051 static int stac92xx_auto_create_analog_input_ctls(struct hda_codec
*codec
, const struct auto_pin_cfg
*cfg
)
5053 struct sigmatel_spec
*spec
= codec
->spec
;
5054 struct hda_input_mux
*imux
= &spec
->private_imux
;
5058 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5059 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5060 int index
, err
, type_idx
;
5063 for (j
= 0; j
< spec
->num_muxes
; j
++) {
5064 index
= get_connection_index(codec
, spec
->mux_nids
[j
],
5072 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5073 snd_hda_add_imux_item(imux
, label
, index
, &type_idx
);
5075 err
= create_elem_capture_vol(codec
, nid
,
5081 spec
->num_analog_muxes
= imux
->num_items
;
5083 if (imux
->num_items
) {
5085 * Set the current input for the muxes.
5086 * The STAC9221 has two input muxes with identical source
5087 * NID lists. Hopefully this won't get confused.
5089 for (i
= 0; i
< spec
->num_muxes
; i
++) {
5090 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[i
], 0,
5091 AC_VERB_SET_CONNECT_SEL
,
5092 imux
->items
[0].index
);
5099 static void stac92xx_auto_init_multi_out(struct hda_codec
*codec
)
5101 struct sigmatel_spec
*spec
= codec
->spec
;
5104 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
5105 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5106 stac92xx_auto_set_pinctl(codec
, nid
, AC_PINCTL_OUT_EN
);
5110 static void stac92xx_auto_init_hp_out(struct hda_codec
*codec
)
5112 struct sigmatel_spec
*spec
= codec
->spec
;
5115 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
5117 pin
= spec
->autocfg
.hp_pins
[i
];
5118 if (pin
) /* connect to front */
5119 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
5121 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
5123 pin
= spec
->autocfg
.speaker_pins
[i
];
5124 if (pin
) /* connect to front */
5125 stac92xx_auto_set_pinctl(codec
, pin
, AC_PINCTL_OUT_EN
);
5129 static int is_dual_headphones(struct hda_codec
*codec
)
5131 struct sigmatel_spec
*spec
= codec
->spec
;
5134 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
||
5135 spec
->autocfg
.hp_outs
<= 1)
5138 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
5139 hda_nid_t nid
= spec
->autocfg
.hp_pins
[i
];
5140 unsigned int cfg
= snd_hda_codec_get_pincfg(codec
, nid
);
5141 if (get_defcfg_location(cfg
) & AC_JACK_LOC_SEPARATE
)
5145 return (valid_hps
> 1);
5149 static int stac92xx_parse_auto_config(struct hda_codec
*codec
)
5151 struct sigmatel_spec
*spec
= codec
->spec
;
5152 hda_nid_t dig_out
= 0, dig_in
= 0;
5156 if ((err
= snd_hda_parse_pin_def_config(codec
,
5158 spec
->dmic_nids
)) < 0)
5160 if (! spec
->autocfg
.line_outs
)
5161 return 0; /* can't find valid pin config */
5163 /* If we have no real line-out pin and multiple hp-outs, HPs should
5164 * be set up as multi-channel outputs.
5166 if (is_dual_headphones(codec
)) {
5167 /* Copy hp_outs to line_outs, backup line_outs in
5168 * speaker_outs so that the following routines can handle
5169 * HP pins as primary outputs.
5171 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");
5172 memcpy(spec
->autocfg
.speaker_pins
, spec
->autocfg
.line_out_pins
,
5173 sizeof(spec
->autocfg
.line_out_pins
));
5174 spec
->autocfg
.speaker_outs
= spec
->autocfg
.line_outs
;
5175 memcpy(spec
->autocfg
.line_out_pins
, spec
->autocfg
.hp_pins
,
5176 sizeof(spec
->autocfg
.hp_pins
));
5177 spec
->autocfg
.line_outs
= spec
->autocfg
.hp_outs
;
5178 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
5179 spec
->autocfg
.hp_outs
= 0;
5182 if (spec
->autocfg
.mono_out_pin
) {
5183 int dir
= get_wcaps(codec
, spec
->autocfg
.mono_out_pin
) &
5184 (AC_WCAP_OUT_AMP
| AC_WCAP_IN_AMP
);
5185 u32 caps
= query_amp_caps(codec
,
5186 spec
->autocfg
.mono_out_pin
, dir
);
5187 hda_nid_t conn_list
[1];
5189 /* get the mixer node and then the mono mux if it exists */
5190 if (snd_hda_get_connections(codec
,
5191 spec
->autocfg
.mono_out_pin
, conn_list
, 1) &&
5192 snd_hda_get_connections(codec
, conn_list
[0],
5193 conn_list
, 1) > 0) {
5195 int wcaps
= get_wcaps(codec
, conn_list
[0]);
5196 int wid_type
= get_wcaps_type(wcaps
);
5197 /* LR swap check, some stac925x have a mux that
5198 * changes the DACs output path instead of the
5201 if (wid_type
== AC_WID_AUD_SEL
&&
5202 !(wcaps
& AC_WCAP_LR_SWAP
))
5203 spec
->mono_nid
= conn_list
[0];
5206 hda_nid_t nid
= spec
->autocfg
.mono_out_pin
;
5208 /* most mono outs have a least a mute/unmute switch */
5209 dir
= (dir
& AC_WCAP_OUT_AMP
) ? HDA_OUTPUT
: HDA_INPUT
;
5210 err
= stac92xx_add_control(spec
, STAC_CTL_WIDGET_MUTE
,
5211 "Mono Playback Switch",
5212 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
5215 /* check for volume support for the amp */
5216 if ((caps
& AC_AMPCAP_NUM_STEPS
)
5217 >> AC_AMPCAP_NUM_STEPS_SHIFT
) {
5218 err
= stac92xx_add_control(spec
,
5219 STAC_CTL_WIDGET_VOL
,
5220 "Mono Playback Volume",
5221 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, dir
));
5227 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.mono_out_pin
,
5231 if (!spec
->multiout
.num_dacs
) {
5232 err
= stac92xx_auto_fill_dac_nids(codec
);
5235 err
= stac92xx_auto_create_multi_out_ctls(codec
,
5241 /* setup analog beep controls */
5242 if (spec
->anabeep_nid
> 0) {
5243 err
= stac92xx_auto_create_beep_ctls(codec
,
5249 /* setup digital beep controls and input device */
5250 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5251 if (spec
->digbeep_nid
> 0) {
5252 hda_nid_t nid
= spec
->digbeep_nid
;
5255 err
= stac92xx_auto_create_beep_ctls(codec
, nid
);
5258 err
= snd_hda_attach_beep_device(codec
, nid
);
5262 /* IDT/STAC codecs have linear beep tone parameter */
5263 codec
->beep
->linear_tone
= spec
->linear_tone_beep
;
5264 /* if no beep switch is available, make its own one */
5265 caps
= query_amp_caps(codec
, nid
, HDA_OUTPUT
);
5266 if (!(caps
& AC_AMPCAP_MUTE
)) {
5267 err
= stac92xx_beep_switch_ctl(codec
);
5275 err
= stac92xx_auto_create_hp_ctls(codec
, &spec
->autocfg
);
5279 /* All output parsing done, now restore the swapped hp pins */
5281 memcpy(spec
->autocfg
.hp_pins
, spec
->autocfg
.line_out_pins
,
5282 sizeof(spec
->autocfg
.hp_pins
));
5283 spec
->autocfg
.hp_outs
= spec
->autocfg
.line_outs
;
5284 spec
->autocfg
.line_out_type
= AUTO_PIN_HP_OUT
;
5285 spec
->autocfg
.line_outs
= 0;
5288 if (stac_check_auto_mic(codec
)) {
5290 /* only one capture for auto-mic */
5293 spec
->num_muxes
= 1;
5296 for (i
= 0; i
< spec
->num_caps
; i
++) {
5297 err
= stac92xx_add_capvol_ctls(codec
, spec
->capvols
[i
],
5298 spec
->capsws
[i
], i
);
5303 err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
5307 if (spec
->mono_nid
> 0) {
5308 err
= stac92xx_auto_create_mono_output_ctls(codec
);
5312 if (spec
->num_dmics
> 0 && !spec
->dinput_mux
)
5313 if ((err
= stac92xx_auto_create_dmic_input_ctls(codec
,
5314 &spec
->autocfg
)) < 0)
5316 if (spec
->num_muxes
> 0) {
5317 err
= stac92xx_auto_create_mux_input_ctls(codec
);
5321 if (spec
->num_smuxes
> 0) {
5322 err
= stac92xx_auto_create_spdif_mux_ctls(codec
);
5327 err
= stac92xx_add_input_source(spec
);
5331 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5332 if (spec
->multiout
.max_channels
> 2)
5333 spec
->surr_switch
= 1;
5335 /* find digital out and in converters */
5336 for (i
= codec
->start_nid
; i
< codec
->start_nid
+ codec
->num_nodes
; i
++) {
5337 unsigned int wid_caps
= get_wcaps(codec
, i
);
5338 if (wid_caps
& AC_WCAP_DIGITAL
) {
5339 switch (get_wcaps_type(wid_caps
)) {
5340 case AC_WID_AUD_OUT
:
5351 if (spec
->autocfg
.dig_outs
)
5352 spec
->multiout
.dig_out_nid
= dig_out
;
5353 if (dig_in
&& spec
->autocfg
.dig_in_pin
)
5354 spec
->dig_in_nid
= dig_in
;
5356 if (spec
->kctls
.list
)
5357 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
5359 spec
->input_mux
= &spec
->private_imux
;
5360 if (!spec
->dinput_mux
)
5361 spec
->dinput_mux
= &spec
->private_dimux
;
5362 spec
->sinput_mux
= &spec
->private_smux
;
5363 spec
->mono_mux
= &spec
->private_mono_mux
;
5367 /* add playback controls for HP output */
5368 static int stac9200_auto_create_hp_ctls(struct hda_codec
*codec
,
5369 struct auto_pin_cfg
*cfg
)
5371 struct sigmatel_spec
*spec
= codec
->spec
;
5372 hda_nid_t pin
= cfg
->hp_pins
[0];
5377 if (is_jack_detectable(codec
, pin
))
5378 spec
->hp_detect
= 1;
5383 /* add playback controls for LFE output */
5384 static int stac9200_auto_create_lfe_ctls(struct hda_codec
*codec
,
5385 struct auto_pin_cfg
*cfg
)
5387 struct sigmatel_spec
*spec
= codec
->spec
;
5389 hda_nid_t lfe_pin
= 0x0;
5393 * search speaker outs and line outs for a mono speaker pin
5394 * with an amp. If one is found, add LFE controls
5397 for (i
= 0; i
< spec
->autocfg
.speaker_outs
&& lfe_pin
== 0x0; i
++) {
5398 hda_nid_t pin
= spec
->autocfg
.speaker_pins
[i
];
5399 unsigned int wcaps
= get_wcaps(codec
, pin
);
5400 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
5401 if (wcaps
== AC_WCAP_OUT_AMP
)
5402 /* found a mono speaker with an amp, must be lfe */
5406 /* if speaker_outs is 0, then speakers may be in line_outs */
5407 if (lfe_pin
== 0 && spec
->autocfg
.speaker_outs
== 0) {
5408 for (i
= 0; i
< spec
->autocfg
.line_outs
&& lfe_pin
== 0x0; i
++) {
5409 hda_nid_t pin
= spec
->autocfg
.line_out_pins
[i
];
5410 unsigned int defcfg
;
5411 defcfg
= snd_hda_codec_get_pincfg(codec
, pin
);
5412 if (get_defcfg_device(defcfg
) == AC_JACK_SPEAKER
) {
5413 unsigned int wcaps
= get_wcaps(codec
, pin
);
5414 wcaps
&= (AC_WCAP_STEREO
| AC_WCAP_OUT_AMP
);
5415 if (wcaps
== AC_WCAP_OUT_AMP
)
5416 /* found a mono speaker with an amp,
5424 err
= create_controls(codec
, "LFE", lfe_pin
, 1);
5432 static int stac9200_parse_auto_config(struct hda_codec
*codec
)
5434 struct sigmatel_spec
*spec
= codec
->spec
;
5437 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
, NULL
)) < 0)
5440 if ((err
= stac92xx_auto_create_analog_input_ctls(codec
, &spec
->autocfg
)) < 0)
5443 if ((err
= stac9200_auto_create_hp_ctls(codec
, &spec
->autocfg
)) < 0)
5446 if ((err
= stac9200_auto_create_lfe_ctls(codec
, &spec
->autocfg
)) < 0)
5449 if (spec
->num_muxes
> 0) {
5450 err
= stac92xx_auto_create_mux_input_ctls(codec
);
5455 err
= stac92xx_add_input_source(spec
);
5459 if (spec
->autocfg
.dig_outs
)
5460 spec
->multiout
.dig_out_nid
= 0x05;
5461 if (spec
->autocfg
.dig_in_pin
)
5462 spec
->dig_in_nid
= 0x04;
5464 if (spec
->kctls
.list
)
5465 spec
->mixers
[spec
->num_mixers
++] = spec
->kctls
.list
;
5467 spec
->input_mux
= &spec
->private_imux
;
5468 spec
->dinput_mux
= &spec
->private_dimux
;
5474 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
5475 * funky external mute control using GPIO pins.
5478 static void stac_gpio_set(struct hda_codec
*codec
, unsigned int mask
,
5479 unsigned int dir_mask
, unsigned int data
)
5481 unsigned int gpiostate
, gpiomask
, gpiodir
;
5483 snd_printdd("%s msk %x dir %x gpio %x\n", __func__
, mask
, dir_mask
, data
);
5485 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5486 AC_VERB_GET_GPIO_DATA
, 0);
5487 gpiostate
= (gpiostate
& ~dir_mask
) | (data
& dir_mask
);
5489 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5490 AC_VERB_GET_GPIO_MASK
, 0);
5493 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5494 AC_VERB_GET_GPIO_DIRECTION
, 0);
5495 gpiodir
|= dir_mask
;
5497 /* Configure GPIOx as CMOS */
5498 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e7, 0);
5500 snd_hda_codec_write(codec
, codec
->afg
, 0,
5501 AC_VERB_SET_GPIO_MASK
, gpiomask
);
5502 snd_hda_codec_read(codec
, codec
->afg
, 0,
5503 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
); /* sync */
5507 snd_hda_codec_read(codec
, codec
->afg
, 0,
5508 AC_VERB_SET_GPIO_DATA
, gpiostate
); /* sync */
5511 static int stac_add_event(struct hda_codec
*codec
, hda_nid_t nid
,
5512 unsigned char type
, int data
)
5514 struct hda_jack_tbl
*event
;
5516 event
= snd_hda_jack_tbl_new(codec
, nid
);
5519 event
->action
= type
;
5520 event
->private_data
= data
;
5525 static void handle_unsol_event(struct hda_codec
*codec
,
5526 struct hda_jack_tbl
*event
);
5528 /* check if given nid is a valid pin and no other events are assigned
5529 * to it. If OK, assign the event, set the unsol flag, and returns 1.
5530 * Otherwise, returns zero.
5532 static int enable_pin_detect(struct hda_codec
*codec
, hda_nid_t nid
,
5535 struct hda_jack_tbl
*event
;
5537 if (!is_jack_detectable(codec
, nid
))
5539 event
= snd_hda_jack_tbl_new(codec
, nid
);
5542 if (event
->action
&& event
->action
!= type
)
5544 event
->action
= type
;
5545 event
->callback
= handle_unsol_event
;
5546 snd_hda_jack_detect_enable(codec
, nid
, 0);
5550 static int is_nid_out_jack_pin(struct auto_pin_cfg
*cfg
, hda_nid_t nid
)
5553 for (i
= 0; i
< cfg
->hp_outs
; i
++)
5554 if (cfg
->hp_pins
[i
] == nid
)
5555 return 1; /* nid is a HP-Out */
5556 for (i
= 0; i
< cfg
->line_outs
; i
++)
5557 if (cfg
->line_out_pins
[i
] == nid
)
5558 return 1; /* nid is a line-Out */
5559 return 0; /* nid is not a HP-Out */
5562 static void stac92xx_power_down(struct hda_codec
*codec
)
5564 struct sigmatel_spec
*spec
= codec
->spec
;
5566 /* power down inactive DACs */
5567 const hda_nid_t
*dac
;
5568 for (dac
= spec
->dac_list
; *dac
; dac
++)
5569 if (!check_all_dac_nids(spec
, *dac
))
5570 snd_hda_codec_write(codec
, *dac
, 0,
5571 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
5574 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
5577 static inline bool get_int_hint(struct hda_codec
*codec
, const char *key
,
5580 return !snd_hda_get_int_hint(codec
, key
, valp
);
5583 /* override some hints from the hwdep entry */
5584 static void stac_store_hints(struct hda_codec
*codec
)
5586 struct sigmatel_spec
*spec
= codec
->spec
;
5589 val
= snd_hda_get_bool_hint(codec
, "hp_detect");
5591 spec
->hp_detect
= val
;
5592 if (get_int_hint(codec
, "gpio_mask", &spec
->gpio_mask
)) {
5593 spec
->eapd_mask
= spec
->gpio_dir
= spec
->gpio_data
=
5596 if (get_int_hint(codec
, "gpio_dir", &spec
->gpio_dir
))
5597 spec
->gpio_mask
&= spec
->gpio_mask
;
5598 if (get_int_hint(codec
, "gpio_data", &spec
->gpio_data
))
5599 spec
->gpio_dir
&= spec
->gpio_mask
;
5600 if (get_int_hint(codec
, "eapd_mask", &spec
->eapd_mask
))
5601 spec
->eapd_mask
&= spec
->gpio_mask
;
5602 if (get_int_hint(codec
, "gpio_mute", &spec
->gpio_mute
))
5603 spec
->gpio_mute
&= spec
->gpio_mask
;
5604 val
= snd_hda_get_bool_hint(codec
, "eapd_switch");
5606 spec
->eapd_switch
= val
;
5609 static void stac_issue_unsol_events(struct hda_codec
*codec
, int num_pins
,
5610 const hda_nid_t
*pins
)
5613 stac_issue_unsol_event(codec
, *pins
++);
5616 /* fake event to set up pins */
5617 static void stac_fake_hp_events(struct hda_codec
*codec
)
5619 struct sigmatel_spec
*spec
= codec
->spec
;
5621 if (spec
->autocfg
.hp_outs
)
5622 stac_issue_unsol_events(codec
, spec
->autocfg
.hp_outs
,
5623 spec
->autocfg
.hp_pins
);
5624 if (spec
->autocfg
.line_outs
&&
5625 spec
->autocfg
.line_out_pins
[0] != spec
->autocfg
.hp_pins
[0])
5626 stac_issue_unsol_events(codec
, spec
->autocfg
.line_outs
,
5627 spec
->autocfg
.line_out_pins
);
5630 static int stac92xx_init(struct hda_codec
*codec
)
5632 struct sigmatel_spec
*spec
= codec
->spec
;
5633 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5638 snd_hda_sequence_write(codec
, spec
->init
);
5640 snd_hda_apply_verbs(codec
);
5642 /* power down adcs initially */
5643 if (spec
->powerdown_adcs
)
5644 for (i
= 0; i
< spec
->num_adcs
; i
++)
5645 snd_hda_codec_write(codec
,
5646 spec
->adc_nids
[i
], 0,
5647 AC_VERB_SET_POWER_STATE
, AC_PWRST_D3
);
5649 /* override some hints */
5650 stac_store_hints(codec
);
5653 gpio
= spec
->gpio_data
;
5654 /* turn on EAPD statically when spec->eapd_switch isn't set.
5655 * otherwise, unsol event will turn it on/off dynamically
5657 if (!spec
->eapd_switch
)
5658 gpio
|= spec
->eapd_mask
;
5659 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, gpio
);
5662 if (spec
->hp_detect
) {
5663 /* Enable unsolicited responses on the HP widget */
5664 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
5665 hda_nid_t nid
= cfg
->hp_pins
[i
];
5666 enable_pin_detect(codec
, nid
, STAC_HP_EVENT
);
5668 if (cfg
->line_out_type
== AUTO_PIN_LINE_OUT
&&
5669 cfg
->speaker_outs
> 0) {
5670 /* enable pin-detect for line-outs as well */
5671 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5672 hda_nid_t nid
= cfg
->line_out_pins
[i
];
5673 enable_pin_detect(codec
, nid
, STAC_LO_EVENT
);
5677 /* force to enable the first line-out; the others are set up
5680 stac92xx_auto_set_pinctl(codec
, spec
->autocfg
.line_out_pins
[0],
5682 /* fake event to set up pins */
5683 stac_fake_hp_events(codec
);
5685 stac92xx_auto_init_multi_out(codec
);
5686 stac92xx_auto_init_hp_out(codec
);
5687 for (i
= 0; i
< cfg
->hp_outs
; i
++)
5688 stac_toggle_power_map(codec
, cfg
->hp_pins
[i
], 1);
5690 if (spec
->auto_mic
) {
5691 /* initialize connection to analog input */
5692 if (spec
->dmux_nids
)
5693 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
5694 AC_VERB_SET_CONNECT_SEL
, 0);
5695 if (enable_pin_detect(codec
, spec
->ext_mic
.pin
, STAC_MIC_EVENT
))
5696 stac_issue_unsol_event(codec
, spec
->ext_mic
.pin
);
5697 if (enable_pin_detect(codec
, spec
->dock_mic
.pin
,
5699 stac_issue_unsol_event(codec
, spec
->dock_mic
.pin
);
5701 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5702 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5703 int type
= cfg
->inputs
[i
].type
;
5704 unsigned int pinctl
, conf
;
5705 if (type
== AUTO_PIN_MIC
) {
5706 /* for mic pins, force to initialize */
5707 pinctl
= snd_hda_get_default_vref(codec
, nid
);
5708 pinctl
|= AC_PINCTL_IN_EN
;
5709 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
5711 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
5712 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
5713 /* if PINCTL already set then skip */
5714 /* Also, if both INPUT and OUTPUT are set,
5715 * it must be a BIOS bug; need to override, too
5717 if (!(pinctl
& AC_PINCTL_IN_EN
) ||
5718 (pinctl
& AC_PINCTL_OUT_EN
)) {
5719 pinctl
&= ~AC_PINCTL_OUT_EN
;
5720 pinctl
|= AC_PINCTL_IN_EN
;
5721 stac92xx_auto_set_pinctl(codec
, nid
, pinctl
);
5724 conf
= snd_hda_codec_get_pincfg(codec
, nid
);
5725 if (get_defcfg_connect(conf
) != AC_JACK_PORT_FIXED
) {
5726 if (enable_pin_detect(codec
, nid
, STAC_INSERT_EVENT
))
5727 stac_issue_unsol_event(codec
, nid
);
5730 for (i
= 0; i
< spec
->num_dmics
; i
++)
5731 stac92xx_auto_set_pinctl(codec
, spec
->dmic_nids
[i
],
5733 if (cfg
->dig_out_pins
[0])
5734 stac92xx_auto_set_pinctl(codec
, cfg
->dig_out_pins
[0],
5736 if (cfg
->dig_in_pin
)
5737 stac92xx_auto_set_pinctl(codec
, cfg
->dig_in_pin
,
5739 for (i
= 0; i
< spec
->num_pwrs
; i
++) {
5740 hda_nid_t nid
= spec
->pwr_nids
[i
];
5741 unsigned int pinctl
, def_conf
;
5743 def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
5744 def_conf
= get_defcfg_connect(def_conf
);
5745 if (def_conf
== AC_JACK_PORT_NONE
) {
5746 /* power off unused ports */
5747 stac_toggle_power_map(codec
, nid
, 0);
5750 if (def_conf
== AC_JACK_PORT_FIXED
) {
5751 /* no need for jack detection for fixed pins */
5752 stac_toggle_power_map(codec
, nid
, 1);
5755 /* power on when no jack detection is available */
5756 /* or when the VREF is used for controlling LED */
5757 if (!spec
->hp_detect
||
5758 spec
->vref_mute_led_nid
== nid
||
5759 !is_jack_detectable(codec
, nid
)) {
5760 stac_toggle_power_map(codec
, nid
, 1);
5764 if (is_nid_out_jack_pin(cfg
, nid
))
5765 continue; /* already has an unsol event */
5767 pinctl
= snd_hda_codec_read(codec
, nid
, 0,
5768 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
5769 /* outputs are only ports capable of power management
5770 * any attempts on powering down a input port cause the
5771 * referenced VREF to act quirky.
5773 if (pinctl
& AC_PINCTL_IN_EN
) {
5774 stac_toggle_power_map(codec
, nid
, 1);
5777 if (enable_pin_detect(codec
, nid
, STAC_PWR_EVENT
)) {
5778 stac_issue_unsol_event(codec
, nid
);
5781 /* none of the above, turn the port OFF */
5782 stac_toggle_power_map(codec
, nid
, 0);
5786 if (spec
->gpio_led
) {
5787 if (spec
->vmaster_mute
.hook
)
5788 snd_hda_sync_vmaster_hook(&spec
->vmaster_mute
);
5789 else /* the very first init call doesn't have vmaster yet */
5790 stac92xx_update_led_status(codec
, false);
5793 /* sync the power-map */
5795 snd_hda_codec_write(codec
, codec
->afg
, 0,
5796 AC_VERB_IDT_SET_POWER_MAP
,
5797 spec
->power_map_bits
);
5799 stac92xx_power_down(codec
);
5803 static void stac92xx_free_kctls(struct hda_codec
*codec
)
5805 struct sigmatel_spec
*spec
= codec
->spec
;
5807 if (spec
->kctls
.list
) {
5808 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
5810 for (i
= 0; i
< spec
->kctls
.used
; i
++)
5811 kfree(kctl
[i
].name
);
5813 snd_array_free(&spec
->kctls
);
5816 static void stac92xx_shutup_pins(struct hda_codec
*codec
)
5818 unsigned int i
, def_conf
;
5820 if (codec
->bus
->shutdown
)
5822 for (i
= 0; i
< codec
->init_pins
.used
; i
++) {
5823 struct hda_pincfg
*pin
= snd_array_elem(&codec
->init_pins
, i
);
5824 def_conf
= snd_hda_codec_get_pincfg(codec
, pin
->nid
);
5825 if (get_defcfg_connect(def_conf
) != AC_JACK_PORT_NONE
)
5826 snd_hda_set_pin_ctl(codec
, pin
->nid
, 0);
5830 static void stac92xx_shutup(struct hda_codec
*codec
)
5832 struct sigmatel_spec
*spec
= codec
->spec
;
5834 stac92xx_shutup_pins(codec
);
5836 if (spec
->eapd_mask
)
5837 stac_gpio_set(codec
, spec
->gpio_mask
,
5838 spec
->gpio_dir
, spec
->gpio_data
&
5842 static void stac92xx_free(struct hda_codec
*codec
)
5844 struct sigmatel_spec
*spec
= codec
->spec
;
5850 snd_hda_detach_beep_device(codec
);
5853 static void stac92xx_set_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
5856 unsigned int old_ctl
, pin_ctl
;
5858 pin_ctl
= snd_hda_codec_read(codec
, nid
,
5859 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
5861 if (pin_ctl
& AC_PINCTL_IN_EN
) {
5863 * we need to check the current set-up direction of
5864 * shared input pins since they can be switched via
5865 * "xxx as Output" mixer switch
5867 struct sigmatel_spec
*spec
= codec
->spec
;
5868 if (nid
== spec
->line_switch
|| nid
== spec
->mic_switch
)
5873 /* if setting pin direction bits, clear the current
5874 direction bits first */
5875 if (flag
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
))
5876 pin_ctl
&= ~(AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
);
5879 if (old_ctl
!= pin_ctl
)
5880 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_ctl
);
5883 static void stac92xx_reset_pinctl(struct hda_codec
*codec
, hda_nid_t nid
,
5886 unsigned int pin_ctl
= snd_hda_codec_read(codec
, nid
,
5887 0, AC_VERB_GET_PIN_WIDGET_CONTROL
, 0x00);
5889 snd_hda_set_pin_ctl_cache(codec
, nid
, pin_ctl
& ~flag
);
5892 static inline int get_pin_presence(struct hda_codec
*codec
, hda_nid_t nid
)
5896 return snd_hda_jack_detect(codec
, nid
);
5899 static void stac92xx_line_out_detect(struct hda_codec
*codec
,
5902 struct sigmatel_spec
*spec
= codec
->spec
;
5903 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5906 if (cfg
->speaker_outs
== 0)
5909 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5912 presence
= get_pin_presence(codec
, cfg
->line_out_pins
[i
]);
5914 unsigned int pinctl
;
5915 pinctl
= snd_hda_codec_read(codec
,
5916 cfg
->line_out_pins
[i
], 0,
5917 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
5918 if (pinctl
& AC_PINCTL_IN_EN
)
5919 presence
= 0; /* mic- or line-input */
5924 /* disable speakers */
5925 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
5926 stac92xx_reset_pinctl(codec
, cfg
->speaker_pins
[i
],
5928 if (spec
->eapd_mask
&& spec
->eapd_switch
)
5929 stac_gpio_set(codec
, spec
->gpio_mask
,
5930 spec
->gpio_dir
, spec
->gpio_data
&
5933 /* enable speakers */
5934 for (i
= 0; i
< cfg
->speaker_outs
; i
++)
5935 stac92xx_set_pinctl(codec
, cfg
->speaker_pins
[i
],
5937 if (spec
->eapd_mask
&& spec
->eapd_switch
)
5938 stac_gpio_set(codec
, spec
->gpio_mask
,
5939 spec
->gpio_dir
, spec
->gpio_data
|
5944 /* return non-zero if the hp-pin of the given array index isn't
5945 * a jack-detection target
5947 static int no_hp_sensing(struct sigmatel_spec
*spec
, int i
)
5949 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5951 /* ignore sensing of shared line and mic jacks */
5952 if (cfg
->hp_pins
[i
] == spec
->line_switch
)
5954 if (cfg
->hp_pins
[i
] == spec
->mic_switch
)
5956 /* ignore if the pin is set as line-out */
5957 if (cfg
->hp_pins
[i
] == spec
->hp_switch
)
5962 static void stac92xx_hp_detect(struct hda_codec
*codec
)
5964 struct sigmatel_spec
*spec
= codec
->spec
;
5965 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5969 if (spec
->gpio_mute
)
5970 presence
= !(snd_hda_codec_read(codec
, codec
->afg
, 0,
5971 AC_VERB_GET_GPIO_DATA
, 0) & spec
->gpio_mute
);
5973 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
5976 if (no_hp_sensing(spec
, i
))
5978 presence
= get_pin_presence(codec
, cfg
->hp_pins
[i
]);
5980 unsigned int pinctl
;
5981 pinctl
= snd_hda_codec_read(codec
, cfg
->hp_pins
[i
], 0,
5982 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
5983 if (pinctl
& AC_PINCTL_IN_EN
)
5984 presence
= 0; /* mic- or line-input */
5989 /* disable lineouts */
5990 if (spec
->hp_switch
)
5991 stac92xx_reset_pinctl(codec
, spec
->hp_switch
,
5993 for (i
= 0; i
< cfg
->line_outs
; i
++)
5994 stac92xx_reset_pinctl(codec
, cfg
->line_out_pins
[i
],
5997 /* enable lineouts */
5998 if (spec
->hp_switch
)
5999 stac92xx_set_pinctl(codec
, spec
->hp_switch
,
6001 for (i
= 0; i
< cfg
->line_outs
; i
++)
6002 stac92xx_set_pinctl(codec
, cfg
->line_out_pins
[i
],
6005 stac92xx_line_out_detect(codec
, presence
);
6006 /* toggle hp outs */
6007 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
6008 unsigned int val
= AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
;
6009 if (no_hp_sensing(spec
, i
))
6012 stac92xx_set_pinctl(codec
, cfg
->hp_pins
[i
], val
);
6014 /* Resetting the pinctl like below may lead to (a sort of) regressions
6015 * on some devices since they use the HP pin actually for line/speaker
6016 * outs although the default pin config shows a different pin (that is
6017 * wrong and useless).
6019 * So, it's basically a problem of default pin configs, likely a BIOS issue.
6020 * But, disabling the code below just works around it, and I'm too tired of
6021 * bug reports with such devices...
6024 stac92xx_reset_pinctl(codec
, cfg
->hp_pins
[i
], val
);
6029 static void stac_toggle_power_map(struct hda_codec
*codec
, hda_nid_t nid
,
6032 struct sigmatel_spec
*spec
= codec
->spec
;
6033 unsigned int idx
, val
;
6035 for (idx
= 0; idx
< spec
->num_pwrs
; idx
++) {
6036 if (spec
->pwr_nids
[idx
] == nid
)
6039 if (idx
>= spec
->num_pwrs
)
6044 val
= spec
->power_map_bits
;
6050 /* power down unused output ports */
6051 if (val
!= spec
->power_map_bits
) {
6052 spec
->power_map_bits
= val
;
6053 snd_hda_codec_write(codec
, codec
->afg
, 0,
6054 AC_VERB_IDT_SET_POWER_MAP
, val
);
6058 static void stac92xx_pin_sense(struct hda_codec
*codec
, hda_nid_t nid
)
6060 stac_toggle_power_map(codec
, nid
, get_pin_presence(codec
, nid
));
6063 /* get the pin connection (fixed, none, etc) */
6064 static unsigned int stac_get_defcfg_connect(struct hda_codec
*codec
, int idx
)
6066 struct sigmatel_spec
*spec
= codec
->spec
;
6069 cfg
= snd_hda_codec_get_pincfg(codec
, spec
->pin_nids
[idx
]);
6070 return get_defcfg_connect(cfg
);
6073 static int stac92xx_connected_ports(struct hda_codec
*codec
,
6074 const hda_nid_t
*nids
, int num_nids
)
6076 struct sigmatel_spec
*spec
= codec
->spec
;
6078 unsigned int def_conf
;
6080 for (num
= 0; num
< num_nids
; num
++) {
6081 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
6082 if (spec
->pin_nids
[idx
] == nids
[num
])
6084 if (idx
>= spec
->num_pins
)
6086 def_conf
= stac_get_defcfg_connect(codec
, idx
);
6087 if (def_conf
== AC_JACK_PORT_NONE
)
6093 static void stac92xx_mic_detect(struct hda_codec
*codec
)
6095 struct sigmatel_spec
*spec
= codec
->spec
;
6096 struct sigmatel_mic_route
*mic
;
6098 if (get_pin_presence(codec
, spec
->ext_mic
.pin
))
6099 mic
= &spec
->ext_mic
;
6100 else if (get_pin_presence(codec
, spec
->dock_mic
.pin
))
6101 mic
= &spec
->dock_mic
;
6103 mic
= &spec
->int_mic
;
6104 if (mic
->dmux_idx
>= 0)
6105 snd_hda_codec_write_cache(codec
, spec
->dmux_nids
[0], 0,
6106 AC_VERB_SET_CONNECT_SEL
,
6108 if (mic
->mux_idx
>= 0)
6109 snd_hda_codec_write_cache(codec
, spec
->mux_nids
[0], 0,
6110 AC_VERB_SET_CONNECT_SEL
,
6114 static void handle_unsol_event(struct hda_codec
*codec
,
6115 struct hda_jack_tbl
*event
)
6117 struct sigmatel_spec
*spec
= codec
->spec
;
6120 switch (event
->action
) {
6123 stac92xx_hp_detect(codec
);
6125 case STAC_MIC_EVENT
:
6126 stac92xx_mic_detect(codec
);
6130 switch (event
->action
) {
6133 case STAC_MIC_EVENT
:
6134 case STAC_INSERT_EVENT
:
6135 case STAC_PWR_EVENT
:
6136 if (spec
->num_pwrs
> 0)
6137 stac92xx_pin_sense(codec
, event
->nid
);
6139 switch (codec
->subsystem_id
) {
6141 if (event
->nid
== 0xb) {
6142 int pin
= AC_PINCTL_IN_EN
;
6144 if (get_pin_presence(codec
, 0xa)
6145 && get_pin_presence(codec
, 0xb))
6146 pin
|= AC_PINCTL_VREF_80
;
6147 if (!get_pin_presence(codec
, 0xb))
6148 pin
|= AC_PINCTL_VREF_80
;
6150 /* toggle VREF state based on mic + hp pin
6153 stac92xx_auto_set_pinctl(codec
, 0x0a, pin
);
6157 case STAC_VREF_EVENT
:
6158 data
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6159 AC_VERB_GET_GPIO_DATA
, 0);
6160 /* toggle VREF state based on GPIOx status */
6161 snd_hda_codec_write(codec
, codec
->afg
, 0, 0x7e0,
6162 !!(data
& (1 << event
->private_data
)));
6167 static void stac_issue_unsol_event(struct hda_codec
*codec
, hda_nid_t nid
)
6169 struct hda_jack_tbl
*event
= snd_hda_jack_tbl_get(codec
, nid
);
6172 handle_unsol_event(codec
, event
);
6175 static void set_hp_led_gpio(struct hda_codec
*codec
)
6177 struct sigmatel_spec
*spec
= codec
->spec
;
6183 gpio
= snd_hda_param_read(codec
, codec
->afg
, AC_PAR_GPIO_CAP
);
6184 gpio
&= AC_GPIO_IO_COUNT
;
6186 spec
->gpio_led
= 0x08; /* GPIO 3 */
6188 spec
->gpio_led
= 0x01; /* GPIO 0 */
6192 * This method searches for the mute LED GPIO configuration
6193 * provided as OEM string in SMBIOS. The format of that string
6194 * is HP_Mute_LED_P_G or HP_Mute_LED_P
6195 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
6196 * that corresponds to the NOT muted state of the master volume
6197 * and G is the index of the GPIO to use as the mute LED control (0..9)
6198 * If _G portion is missing it is assigned based on the codec ID
6200 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
6201 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
6204 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
6205 * SMBIOS - at least the ones I have seen do not have them - which include
6206 * my own system (HP Pavilion dv6-1110ax) and my cousin's
6207 * HP Pavilion dv9500t CTO.
6208 * Need more information on whether it is true across the entire series.
6211 static int find_mute_led_cfg(struct hda_codec
*codec
, int default_polarity
)
6213 struct sigmatel_spec
*spec
= codec
->spec
;
6214 const struct dmi_device
*dev
= NULL
;
6216 if (get_int_hint(codec
, "gpio_led", &spec
->gpio_led
)) {
6217 get_int_hint(codec
, "gpio_led_polarity",
6218 &spec
->gpio_led_polarity
);
6222 if ((codec
->subsystem_id
>> 16) == PCI_VENDOR_ID_HP
) {
6223 while ((dev
= dmi_find_device(DMI_DEV_TYPE_OEM_STRING
,
6225 if (sscanf(dev
->name
, "HP_Mute_LED_%d_%x",
6226 &spec
->gpio_led_polarity
,
6227 &spec
->gpio_led
) == 2) {
6228 unsigned int max_gpio
;
6229 max_gpio
= snd_hda_param_read(codec
, codec
->afg
,
6231 max_gpio
&= AC_GPIO_IO_COUNT
;
6232 if (spec
->gpio_led
< max_gpio
)
6233 spec
->gpio_led
= 1 << spec
->gpio_led
;
6235 spec
->vref_mute_led_nid
= spec
->gpio_led
;
6238 if (sscanf(dev
->name
, "HP_Mute_LED_%d",
6239 &spec
->gpio_led_polarity
) == 1) {
6240 set_hp_led_gpio(codec
);
6243 /* BIOS bug: unfilled OEM string */
6244 if (strstr(dev
->name
, "HP_Mute_LED_P_G")) {
6245 set_hp_led_gpio(codec
);
6246 switch (codec
->subsystem_id
) {
6248 spec
->gpio_led_polarity
= 0;
6251 spec
->gpio_led_polarity
= 1;
6259 * Fallback case - if we don't find the DMI strings,
6260 * we statically set the GPIO - if not a B-series system
6261 * and default polarity is provided
6263 if (!hp_blike_system(codec
->subsystem_id
) &&
6264 (default_polarity
== 0 || default_polarity
== 1)) {
6265 set_hp_led_gpio(codec
);
6266 spec
->gpio_led_polarity
= default_polarity
;
6273 static int hp_blike_system(u32 subsystem_id
)
6275 switch (subsystem_id
) {
6302 #ifdef CONFIG_PROC_FS
6303 static void stac92hd_proc_hook(struct snd_info_buffer
*buffer
,
6304 struct hda_codec
*codec
, hda_nid_t nid
)
6306 if (nid
== codec
->afg
)
6307 snd_iprintf(buffer
, "Power-Map: 0x%02x\n",
6308 snd_hda_codec_read(codec
, nid
, 0,
6309 AC_VERB_IDT_GET_POWER_MAP
, 0));
6312 static void analog_loop_proc_hook(struct snd_info_buffer
*buffer
,
6313 struct hda_codec
*codec
,
6316 snd_iprintf(buffer
, "Analog Loopback: 0x%02x\n",
6317 snd_hda_codec_read(codec
, codec
->afg
, 0, verb
, 0));
6320 /* stac92hd71bxx, stac92hd73xx */
6321 static void stac92hd7x_proc_hook(struct snd_info_buffer
*buffer
,
6322 struct hda_codec
*codec
, hda_nid_t nid
)
6324 stac92hd_proc_hook(buffer
, codec
, nid
);
6325 if (nid
== codec
->afg
)
6326 analog_loop_proc_hook(buffer
, codec
, 0xfa0);
6329 static void stac9205_proc_hook(struct snd_info_buffer
*buffer
,
6330 struct hda_codec
*codec
, hda_nid_t nid
)
6332 if (nid
== codec
->afg
)
6333 analog_loop_proc_hook(buffer
, codec
, 0xfe0);
6336 static void stac927x_proc_hook(struct snd_info_buffer
*buffer
,
6337 struct hda_codec
*codec
, hda_nid_t nid
)
6339 if (nid
== codec
->afg
)
6340 analog_loop_proc_hook(buffer
, codec
, 0xfeb);
6343 #define stac92hd_proc_hook NULL
6344 #define stac92hd7x_proc_hook NULL
6345 #define stac9205_proc_hook NULL
6346 #define stac927x_proc_hook NULL
6350 static int stac92xx_resume(struct hda_codec
*codec
)
6352 stac92xx_init(codec
);
6353 snd_hda_codec_resume_amp(codec
);
6354 snd_hda_codec_resume_cache(codec
);
6355 /* fake event to set up pins again to override cached values */
6356 stac_fake_hp_events(codec
);
6360 static int stac92xx_suspend(struct hda_codec
*codec
)
6362 stac92xx_shutup(codec
);
6366 static void stac92xx_set_power_state(struct hda_codec
*codec
, hda_nid_t fg
,
6367 unsigned int power_state
)
6369 unsigned int afg_power_state
= power_state
;
6370 struct sigmatel_spec
*spec
= codec
->spec
;
6372 if (power_state
== AC_PWRST_D3
) {
6373 if (spec
->vref_mute_led_nid
) {
6374 /* with vref-out pin used for mute led control
6375 * codec AFG is prevented from D3 state
6377 afg_power_state
= AC_PWRST_D1
;
6379 /* this delay seems necessary to avoid click noise at power-down */
6382 snd_hda_codec_read(codec
, fg
, 0, AC_VERB_SET_POWER_STATE
,
6384 snd_hda_codec_set_power_to_all(codec
, fg
, power_state
, true);
6387 #define stac92xx_suspend NULL
6388 #define stac92xx_resume NULL
6389 #define stac92xx_set_power_state NULL
6390 #endif /* CONFIG_PM */
6392 /* update mute-LED accoring to the master switch */
6393 static void stac92xx_update_led_status(struct hda_codec
*codec
, int enabled
)
6395 struct sigmatel_spec
*spec
= codec
->spec
;
6396 int muted
= !enabled
;
6398 if (!spec
->gpio_led
)
6401 /* LED state is inverted on these systems */
6402 if (spec
->gpio_led_polarity
)
6405 if (!spec
->vref_mute_led_nid
) {
6407 spec
->gpio_data
|= spec
->gpio_led
;
6409 spec
->gpio_data
&= ~spec
->gpio_led
;
6410 stac_gpio_set(codec
, spec
->gpio_mask
,
6411 spec
->gpio_dir
, spec
->gpio_data
);
6413 spec
->vref_led
= muted
? AC_PINCTL_VREF_50
: AC_PINCTL_VREF_GRD
;
6414 stac_vrefout_set(codec
, spec
->vref_mute_led_nid
,
6419 static const struct hda_codec_ops stac92xx_patch_ops
= {
6420 .build_controls
= stac92xx_build_controls
,
6421 .build_pcms
= stac92xx_build_pcms
,
6422 .init
= stac92xx_init
,
6423 .free
= stac92xx_free
,
6424 .unsol_event
= snd_hda_jack_unsol_event
,
6426 .suspend
= stac92xx_suspend
,
6427 .resume
= stac92xx_resume
,
6429 .reboot_notify
= stac92xx_shutup
,
6432 static int alloc_stac_spec(struct hda_codec
*codec
, int num_pins
,
6433 const hda_nid_t
*pin_nids
)
6435 struct sigmatel_spec
*spec
;
6437 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6441 codec
->no_trigger_sense
= 1; /* seems common with STAC/IDT codecs */
6442 spec
->num_pins
= num_pins
;
6443 spec
->pin_nids
= pin_nids
;
6444 snd_array_init(&spec
->kctls
, sizeof(struct snd_kcontrol_new
), 32);
6448 static int patch_stac9200(struct hda_codec
*codec
)
6450 struct sigmatel_spec
*spec
;
6453 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9200_pin_nids
),
6459 spec
->linear_tone_beep
= 1;
6461 snd_hda_pick_fixup(codec
, stac9200_models
, stac9200_fixup_tbl
,
6464 spec
->multiout
.max_channels
= 2;
6465 spec
->multiout
.num_dacs
= 1;
6466 spec
->multiout
.dac_nids
= stac9200_dac_nids
;
6467 spec
->adc_nids
= stac9200_adc_nids
;
6468 spec
->mux_nids
= stac9200_mux_nids
;
6469 spec
->num_muxes
= 1;
6470 spec
->num_dmics
= 0;
6473 snd_hda_add_verbs(codec
, stac9200_eapd_init
);
6475 spec
->mixer
= stac9200_mixer
;
6477 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
6479 err
= stac9200_parse_auto_config(codec
);
6481 stac92xx_free(codec
);
6485 codec
->patch_ops
= stac92xx_patch_ops
;
6487 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
6492 static int patch_stac925x(struct hda_codec
*codec
)
6494 struct sigmatel_spec
*spec
;
6497 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac925x_pin_nids
),
6503 spec
->linear_tone_beep
= 1;
6505 snd_hda_pick_fixup(codec
, stac925x_models
, stac925x_fixup_tbl
,
6508 spec
->multiout
.max_channels
= 2;
6509 spec
->multiout
.num_dacs
= 1;
6510 spec
->multiout
.dac_nids
= stac925x_dac_nids
;
6511 spec
->adc_nids
= stac925x_adc_nids
;
6512 spec
->mux_nids
= stac925x_mux_nids
;
6513 spec
->num_muxes
= 1;
6516 switch (codec
->vendor_id
) {
6517 case 0x83847632: /* STAC9202 */
6518 case 0x83847633: /* STAC9202D */
6519 case 0x83847636: /* STAC9251 */
6520 case 0x83847637: /* STAC9251D */
6521 spec
->num_dmics
= STAC925X_NUM_DMICS
;
6522 spec
->dmic_nids
= stac925x_dmic_nids
;
6523 spec
->num_dmuxes
= ARRAY_SIZE(stac925x_dmux_nids
);
6524 spec
->dmux_nids
= stac925x_dmux_nids
;
6527 spec
->num_dmics
= 0;
6531 snd_hda_add_verbs(codec
, stac925x_core_init
);
6532 spec
->mixer
= stac925x_mixer
;
6534 spec
->capvols
= stac925x_capvols
;
6535 spec
->capsws
= stac925x_capsws
;
6537 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
6539 err
= stac92xx_parse_auto_config(codec
);
6543 stac92xx_free(codec
);
6547 codec
->patch_ops
= stac92xx_patch_ops
;
6549 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
6554 static int patch_stac92hd73xx(struct hda_codec
*codec
)
6556 struct sigmatel_spec
*spec
;
6557 hda_nid_t conn
[STAC92HD73_DAC_COUNT
+ 2];
6561 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac92hd73xx_pin_nids
),
6562 stac92hd73xx_pin_nids
);
6567 spec
->linear_tone_beep
= 0;
6568 codec
->slave_dig_outs
= stac92hd73xx_slave_dig_outs
;
6570 snd_hda_pick_fixup(codec
, stac92hd73xx_models
, stac92hd73xx_fixup_tbl
,
6571 stac92hd73xx_fixups
);
6573 num_dacs
= snd_hda_get_connections(codec
, 0x0a,
6574 conn
, STAC92HD73_DAC_COUNT
+ 2) - 1;
6576 if (num_dacs
< 3 || num_dacs
> 5) {
6577 printk(KERN_WARNING
"hda_codec: Could not determine "
6578 "number of channels defaulting to DAC count\n");
6579 num_dacs
= STAC92HD73_DAC_COUNT
;
6583 case 0x3: /* 6 Channel */
6584 spec
->aloopback_ctl
= stac92hd73xx_6ch_loopback
;
6586 case 0x4: /* 8 Channel */
6587 spec
->aloopback_ctl
= stac92hd73xx_8ch_loopback
;
6589 case 0x5: /* 10 Channel */
6590 spec
->aloopback_ctl
= stac92hd73xx_10ch_loopback
;
6593 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6595 spec
->aloopback_mask
= 0x01;
6596 spec
->aloopback_shift
= 8;
6598 spec
->digbeep_nid
= 0x1c;
6599 spec
->mux_nids
= stac92hd73xx_mux_nids
;
6600 spec
->adc_nids
= stac92hd73xx_adc_nids
;
6601 spec
->dmic_nids
= stac92hd73xx_dmic_nids
;
6602 spec
->dmux_nids
= stac92hd73xx_dmux_nids
;
6603 spec
->smux_nids
= stac92hd73xx_smux_nids
;
6605 spec
->num_muxes
= ARRAY_SIZE(stac92hd73xx_mux_nids
);
6606 spec
->num_adcs
= ARRAY_SIZE(stac92hd73xx_adc_nids
);
6607 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd73xx_dmux_nids
);
6609 spec
->num_caps
= STAC92HD73XX_NUM_CAPS
;
6610 spec
->capvols
= stac92hd73xx_capvols
;
6611 spec
->capsws
= stac92hd73xx_capsws
;
6613 /* GPIO0 High = Enable EAPD */
6614 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
6615 spec
->gpio_data
= 0x01;
6617 spec
->num_dmics
= STAC92HD73XX_NUM_DMICS
;
6618 spec
->num_smuxes
= ARRAY_SIZE(stac92hd73xx_smux_nids
);
6619 spec
->eapd_switch
= 1;
6621 spec
->num_pwrs
= ARRAY_SIZE(stac92hd73xx_pwr_nids
);
6622 spec
->pwr_nids
= stac92hd73xx_pwr_nids
;
6624 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
6626 if (!spec
->volknob_init
)
6627 snd_hda_add_verbs(codec
, stac92hd73xx_core_init
);
6629 err
= stac92xx_parse_auto_config(codec
);
6634 stac92xx_free(codec
);
6638 codec
->patch_ops
= stac92xx_patch_ops
;
6640 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
6642 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
6647 static int hp_bnb2011_with_dock(struct hda_codec
*codec
)
6649 if (codec
->vendor_id
!= 0x111d7605 &&
6650 codec
->vendor_id
!= 0x111d76d1)
6653 switch (codec
->subsystem_id
) {
6687 static void stac92hd8x_add_pin(struct hda_codec
*codec
, hda_nid_t nid
)
6689 struct sigmatel_spec
*spec
= codec
->spec
;
6690 unsigned int def_conf
= snd_hda_codec_get_pincfg(codec
, nid
);
6693 spec
->auto_pin_nids
[spec
->auto_pin_cnt
] = nid
;
6694 spec
->auto_pin_cnt
++;
6696 if (get_defcfg_device(def_conf
) == AC_JACK_MIC_IN
&&
6697 get_defcfg_connect(def_conf
) != AC_JACK_PORT_NONE
) {
6698 for (i
= 0; i
< ARRAY_SIZE(stac92hd83xxx_dmic_nids
); i
++) {
6699 if (nid
== stac92hd83xxx_dmic_nids
[i
]) {
6700 spec
->auto_dmic_nids
[spec
->auto_dmic_cnt
] = nid
;
6701 spec
->auto_dmic_cnt
++;
6707 static void stac92hd8x_add_adc(struct hda_codec
*codec
, hda_nid_t nid
)
6709 struct sigmatel_spec
*spec
= codec
->spec
;
6711 spec
->auto_adc_nids
[spec
->auto_adc_cnt
] = nid
;
6712 spec
->auto_adc_cnt
++;
6715 static void stac92hd8x_add_mux(struct hda_codec
*codec
, hda_nid_t nid
)
6718 struct sigmatel_spec
*spec
= codec
->spec
;
6720 for (i
= 0; i
< spec
->auto_adc_cnt
; i
++) {
6721 if (get_connection_index(codec
,
6722 spec
->auto_adc_nids
[i
], nid
) >= 0) {
6723 /* mux and volume for adc_nids[i] */
6724 if (!spec
->auto_mux_nids
[i
]) {
6725 spec
->auto_mux_nids
[i
] = nid
;
6726 /* 92hd codecs capture volume is in mux */
6727 spec
->auto_capvols
[i
] = HDA_COMPOSE_AMP_VAL(nid
,
6730 for (j
= 0; j
< spec
->auto_dmic_cnt
; j
++) {
6731 if (get_connection_index(codec
, nid
,
6732 spec
->auto_dmic_nids
[j
]) >= 0) {
6733 /* dmux for adc_nids[i] */
6734 if (!spec
->auto_dmux_nids
[i
])
6735 spec
->auto_dmux_nids
[i
] = nid
;
6744 static void stac92hd8x_fill_auto_spec(struct hda_codec
*codec
)
6746 hda_nid_t nid
, end_nid
;
6747 unsigned int wid_caps
, wid_type
;
6748 struct sigmatel_spec
*spec
= codec
->spec
;
6750 end_nid
= codec
->start_nid
+ codec
->num_nodes
;
6752 for (nid
= codec
->start_nid
; nid
< end_nid
; nid
++) {
6753 wid_caps
= get_wcaps(codec
, nid
);
6754 wid_type
= get_wcaps_type(wid_caps
);
6756 if (wid_type
== AC_WID_PIN
)
6757 stac92hd8x_add_pin(codec
, nid
);
6759 if (wid_type
== AC_WID_AUD_IN
&& !(wid_caps
& AC_WCAP_DIGITAL
))
6760 stac92hd8x_add_adc(codec
, nid
);
6763 for (nid
= codec
->start_nid
; nid
< end_nid
; nid
++) {
6764 wid_caps
= get_wcaps(codec
, nid
);
6765 wid_type
= get_wcaps_type(wid_caps
);
6767 if (wid_type
== AC_WID_AUD_SEL
)
6768 stac92hd8x_add_mux(codec
, nid
);
6771 spec
->pin_nids
= spec
->auto_pin_nids
;
6772 spec
->num_pins
= spec
->auto_pin_cnt
;
6773 spec
->adc_nids
= spec
->auto_adc_nids
;
6774 spec
->num_adcs
= spec
->auto_adc_cnt
;
6775 spec
->capvols
= spec
->auto_capvols
;
6776 spec
->capsws
= spec
->auto_capvols
;
6777 spec
->num_caps
= spec
->auto_adc_cnt
;
6778 spec
->mux_nids
= spec
->auto_mux_nids
;
6779 spec
->num_muxes
= spec
->auto_adc_cnt
;
6780 spec
->dmux_nids
= spec
->auto_dmux_nids
;
6781 spec
->num_dmuxes
= spec
->auto_adc_cnt
;
6782 spec
->dmic_nids
= spec
->auto_dmic_nids
;
6783 spec
->num_dmics
= spec
->auto_dmic_cnt
;
6786 static void stac_setup_gpio(struct hda_codec
*codec
)
6788 struct sigmatel_spec
*spec
= codec
->spec
;
6790 if (spec
->gpio_led
) {
6791 if (!spec
->vref_mute_led_nid
) {
6792 spec
->gpio_mask
|= spec
->gpio_led
;
6793 spec
->gpio_dir
|= spec
->gpio_led
;
6794 spec
->gpio_data
|= spec
->gpio_led
;
6796 codec
->patch_ops
.set_power_state
=
6797 stac92xx_set_power_state
;
6801 if (spec
->mic_mute_led_gpio
) {
6802 spec
->gpio_mask
|= spec
->mic_mute_led_gpio
;
6803 spec
->gpio_dir
|= spec
->mic_mute_led_gpio
;
6804 spec
->mic_mute_led_on
= true;
6805 spec
->gpio_data
|= spec
->mic_mute_led_gpio
;
6809 static int patch_stac92hd83xxx(struct hda_codec
*codec
)
6811 struct sigmatel_spec
*spec
;
6814 err
= alloc_stac_spec(codec
, 0, NULL
); /* pins filled later */
6818 codec
->epss
= 0; /* longer delay needed for D3 */
6819 stac92hd8x_fill_auto_spec(codec
);
6822 spec
->linear_tone_beep
= 0;
6823 codec
->slave_dig_outs
= stac92hd83xxx_slave_dig_outs
;
6824 spec
->digbeep_nid
= 0x21;
6825 spec
->pwr_nids
= stac92hd83xxx_pwr_nids
;
6826 spec
->num_pwrs
= ARRAY_SIZE(stac92hd83xxx_pwr_nids
);
6827 spec
->multiout
.dac_nids
= spec
->dac_nids
;
6829 snd_hda_pick_fixup(codec
, stac92hd83xxx_models
, stac92hd83xxx_fixup_tbl
,
6830 stac92hd83xxx_fixups
);
6832 snd_hda_add_verbs(codec
, stac92hd83xxx_core_init
);
6833 spec
->default_polarity
= -1; /* no default cfg */
6835 codec
->patch_ops
= stac92xx_patch_ops
;
6837 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
6839 stac_setup_gpio(codec
);
6841 err
= stac92xx_parse_auto_config(codec
);
6845 stac92xx_free(codec
);
6849 codec
->proc_widget_hook
= stac92hd_proc_hook
;
6851 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
6856 static int stac92hd71bxx_connected_smuxes(struct hda_codec
*codec
,
6859 struct sigmatel_spec
*spec
= codec
->spec
;
6862 for (idx
= 0; idx
< spec
->num_pins
; idx
++)
6863 if (spec
->pin_nids
[idx
] == dig0pin
)
6865 if ((idx
+ 2) >= spec
->num_pins
)
6869 if (stac_get_defcfg_connect(codec
, idx
+ 1) != AC_JACK_PORT_NONE
)
6872 /* dig0pin + dig2pin case */
6873 if (stac_get_defcfg_connect(codec
, idx
+ 2) != AC_JACK_PORT_NONE
)
6875 if (stac_get_defcfg_connect(codec
, idx
) != AC_JACK_PORT_NONE
)
6881 /* HP dv7 bass switch - GPIO5 */
6882 #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
6883 static int stac_hp_bass_gpio_get(struct snd_kcontrol
*kcontrol
,
6884 struct snd_ctl_elem_value
*ucontrol
)
6886 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6887 struct sigmatel_spec
*spec
= codec
->spec
;
6888 ucontrol
->value
.integer
.value
[0] = !!(spec
->gpio_data
& 0x20);
6892 static int stac_hp_bass_gpio_put(struct snd_kcontrol
*kcontrol
,
6893 struct snd_ctl_elem_value
*ucontrol
)
6895 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6896 struct sigmatel_spec
*spec
= codec
->spec
;
6897 unsigned int gpio_data
;
6899 gpio_data
= (spec
->gpio_data
& ~0x20) |
6900 (ucontrol
->value
.integer
.value
[0] ? 0x20 : 0);
6901 if (gpio_data
== spec
->gpio_data
)
6903 spec
->gpio_data
= gpio_data
;
6904 stac_gpio_set(codec
, spec
->gpio_mask
, spec
->gpio_dir
, spec
->gpio_data
);
6908 static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl
= {
6909 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6910 .info
= stac_hp_bass_gpio_info
,
6911 .get
= stac_hp_bass_gpio_get
,
6912 .put
= stac_hp_bass_gpio_put
,
6915 static int stac_add_hp_bass_switch(struct hda_codec
*codec
)
6917 struct sigmatel_spec
*spec
= codec
->spec
;
6919 if (!stac_control_new(spec
, &stac_hp_bass_sw_ctrl
,
6920 "Bass Speaker Playback Switch", 0))
6923 spec
->gpio_mask
|= 0x20;
6924 spec
->gpio_dir
|= 0x20;
6925 spec
->gpio_data
|= 0x20;
6929 static int patch_stac92hd71bxx(struct hda_codec
*codec
)
6931 struct sigmatel_spec
*spec
;
6932 const struct hda_verb
*unmute_init
= stac92hd71bxx_unmute_core_init
;
6935 err
= alloc_stac_spec(codec
, STAC92HD71BXX_NUM_PINS
,
6936 stac92hd71bxx_pin_nids_4port
);
6941 spec
->linear_tone_beep
= 0;
6942 codec
->patch_ops
= stac92xx_patch_ops
;
6943 switch (codec
->vendor_id
) {
6949 /* On 92HD75Bx 0x27 isn't a pin nid */
6953 spec
->pin_nids
= stac92hd71bxx_pin_nids_6port
;
6955 spec
->num_pwrs
= ARRAY_SIZE(stac92hd71bxx_pwr_nids
);
6957 snd_hda_pick_fixup(codec
, stac92hd71bxx_models
, stac92hd71bxx_fixup_tbl
,
6958 stac92hd71bxx_fixups
);
6961 spec
->gpio_mask
= 0x01;
6962 spec
->gpio_dir
= 0x01;
6963 spec
->gpio_data
= 0x01;
6965 spec
->dmic_nids
= stac92hd71bxx_dmic_nids
;
6966 spec
->dmux_nids
= stac92hd71bxx_dmux_nids
;
6968 spec
->num_caps
= STAC92HD71BXX_NUM_CAPS
;
6969 spec
->capvols
= stac92hd71bxx_capvols
;
6970 spec
->capsws
= stac92hd71bxx_capsws
;
6972 switch (codec
->vendor_id
) {
6973 case 0x111d76b6: /* 4 Port without Analog Mixer */
6977 case 0x111d76b4: /* 6 Port without Analog Mixer */
6979 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
6980 spec
->num_dmics
= stac92xx_connected_ports(codec
,
6981 stac92hd71bxx_dmic_nids
,
6982 STAC92HD71BXX_NUM_DMICS
);
6984 case 0x111d7608: /* 5 Port with Analog Mixer */
6985 if ((codec
->revision_id
& 0xf) == 0 ||
6986 (codec
->revision_id
& 0xf) == 1)
6987 spec
->stream_delay
= 40; /* 40 milliseconds */
6991 snd_hda_codec_set_pincfg(codec
, 0x0f, 0x40f000f0);
6992 snd_hda_codec_set_pincfg(codec
, 0x19, 0x40f000f3);
6993 spec
->dmic_nids
= stac92hd71bxx_dmic_5port_nids
;
6994 spec
->num_dmics
= stac92xx_connected_ports(codec
,
6995 stac92hd71bxx_dmic_5port_nids
,
6996 STAC92HD71BXX_NUM_DMICS
- 1);
6998 case 0x111d7603: /* 6 Port with Analog Mixer */
6999 if ((codec
->revision_id
& 0xf) == 1)
7000 spec
->stream_delay
= 40; /* 40 milliseconds */
7004 codec
->slave_dig_outs
= stac92hd71bxx_slave_dig_outs
;
7005 spec
->num_dmics
= stac92xx_connected_ports(codec
,
7006 stac92hd71bxx_dmic_nids
,
7007 STAC92HD71BXX_NUM_DMICS
);
7011 if (get_wcaps_type(get_wcaps(codec
, 0x28)) == AC_WID_VOL_KNB
)
7012 snd_hda_add_verbs(codec
, stac92hd71bxx_core_init
);
7014 if (get_wcaps(codec
, 0xa) & AC_WCAP_IN_AMP
)
7015 snd_hda_sequence_write_cache(codec
, unmute_init
);
7017 spec
->aloopback_ctl
= stac92hd71bxx_loopback
;
7018 spec
->aloopback_mask
= 0x50;
7019 spec
->aloopback_shift
= 0;
7021 spec
->powerdown_adcs
= 1;
7022 spec
->digbeep_nid
= 0x26;
7023 spec
->mux_nids
= stac92hd71bxx_mux_nids
;
7024 spec
->adc_nids
= stac92hd71bxx_adc_nids
;
7025 spec
->smux_nids
= stac92hd71bxx_smux_nids
;
7026 spec
->pwr_nids
= stac92hd71bxx_pwr_nids
;
7028 spec
->num_muxes
= ARRAY_SIZE(stac92hd71bxx_mux_nids
);
7029 spec
->num_adcs
= ARRAY_SIZE(stac92hd71bxx_adc_nids
);
7030 spec
->num_dmuxes
= ARRAY_SIZE(stac92hd71bxx_dmux_nids
);
7031 spec
->num_smuxes
= stac92hd71bxx_connected_smuxes(codec
, 0x1e);
7033 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
7035 stac_setup_gpio(codec
);
7037 spec
->multiout
.dac_nids
= spec
->dac_nids
;
7039 err
= stac92xx_parse_auto_config(codec
);
7043 stac92xx_free(codec
);
7047 codec
->proc_widget_hook
= stac92hd7x_proc_hook
;
7049 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
7054 static int patch_stac922x(struct hda_codec
*codec
)
7056 struct sigmatel_spec
*spec
;
7059 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac922x_pin_nids
),
7065 spec
->linear_tone_beep
= 1;
7067 snd_hda_pick_fixup(codec
, stac922x_models
, stac922x_fixup_tbl
,
7070 spec
->adc_nids
= stac922x_adc_nids
;
7071 spec
->mux_nids
= stac922x_mux_nids
;
7072 spec
->num_muxes
= ARRAY_SIZE(stac922x_mux_nids
);
7073 spec
->num_adcs
= ARRAY_SIZE(stac922x_adc_nids
);
7074 spec
->num_dmics
= 0;
7077 spec
->num_caps
= STAC922X_NUM_CAPS
;
7078 spec
->capvols
= stac922x_capvols
;
7079 spec
->capsws
= stac922x_capsws
;
7081 spec
->multiout
.dac_nids
= spec
->dac_nids
;
7083 snd_hda_add_verbs(codec
, stac922x_core_init
);
7085 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
7087 err
= stac92xx_parse_auto_config(codec
);
7091 stac92xx_free(codec
);
7095 codec
->patch_ops
= stac92xx_patch_ops
;
7097 /* Fix Mux capture level; max to 2 */
7098 snd_hda_override_amp_caps(codec
, 0x12, HDA_OUTPUT
,
7099 (0 << AC_AMPCAP_OFFSET_SHIFT
) |
7100 (2 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
7101 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
7102 (0 << AC_AMPCAP_MUTE_SHIFT
));
7104 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
7109 static int patch_stac927x(struct hda_codec
*codec
)
7111 struct sigmatel_spec
*spec
;
7114 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac927x_pin_nids
),
7120 spec
->linear_tone_beep
= 1;
7121 codec
->slave_dig_outs
= stac927x_slave_dig_outs
;
7123 snd_hda_pick_fixup(codec
, stac927x_models
, stac927x_fixup_tbl
,
7126 spec
->digbeep_nid
= 0x23;
7127 spec
->adc_nids
= stac927x_adc_nids
;
7128 spec
->num_adcs
= ARRAY_SIZE(stac927x_adc_nids
);
7129 spec
->mux_nids
= stac927x_mux_nids
;
7130 spec
->num_muxes
= ARRAY_SIZE(stac927x_mux_nids
);
7131 spec
->smux_nids
= stac927x_smux_nids
;
7132 spec
->num_smuxes
= ARRAY_SIZE(stac927x_smux_nids
);
7133 spec
->spdif_labels
= stac927x_spdif_labels
;
7134 spec
->dac_list
= stac927x_dac_nids
;
7135 spec
->multiout
.dac_nids
= spec
->dac_nids
;
7137 /* GPIO0 High = Enable EAPD */
7138 spec
->eapd_mask
= spec
->gpio_mask
= 0x01;
7139 spec
->gpio_dir
= spec
->gpio_data
= 0x01;
7141 spec
->num_dmics
= 0;
7143 spec
->num_caps
= STAC927X_NUM_CAPS
;
7144 spec
->capvols
= stac927x_capvols
;
7145 spec
->capsws
= stac927x_capsws
;
7148 spec
->aloopback_ctl
= stac927x_loopback
;
7149 spec
->aloopback_mask
= 0x40;
7150 spec
->aloopback_shift
= 0;
7151 spec
->eapd_switch
= 1;
7153 if (!spec
->volknob_init
)
7154 snd_hda_add_verbs(codec
, stac927x_core_init
);
7156 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
7158 err
= stac92xx_parse_auto_config(codec
);
7162 stac92xx_free(codec
);
7166 codec
->patch_ops
= stac92xx_patch_ops
;
7168 codec
->proc_widget_hook
= stac927x_proc_hook
;
7172 * The STAC927x seem to require fairly long delays for certain
7173 * command sequences. With too short delays (even if the answer
7174 * is set to RIRB properly), it results in the silence output
7175 * on some hardwares like Dell.
7177 * The below flag enables the longer delay (see get_response
7180 codec
->bus
->needs_damn_long_delay
= 1;
7182 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
7187 static int patch_stac9205(struct hda_codec
*codec
)
7189 struct sigmatel_spec
*spec
;
7192 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9205_pin_nids
),
7198 spec
->linear_tone_beep
= 1;
7200 snd_hda_pick_fixup(codec
, stac9205_models
, stac9205_fixup_tbl
,
7203 spec
->digbeep_nid
= 0x23;
7204 spec
->adc_nids
= stac9205_adc_nids
;
7205 spec
->num_adcs
= ARRAY_SIZE(stac9205_adc_nids
);
7206 spec
->mux_nids
= stac9205_mux_nids
;
7207 spec
->num_muxes
= ARRAY_SIZE(stac9205_mux_nids
);
7208 spec
->smux_nids
= stac9205_smux_nids
;
7209 spec
->num_smuxes
= ARRAY_SIZE(stac9205_smux_nids
);
7210 spec
->dmic_nids
= stac9205_dmic_nids
;
7211 spec
->num_dmics
= STAC9205_NUM_DMICS
;
7212 spec
->dmux_nids
= stac9205_dmux_nids
;
7213 spec
->num_dmuxes
= ARRAY_SIZE(stac9205_dmux_nids
);
7216 snd_hda_add_verbs(codec
, stac9205_core_init
);
7217 spec
->aloopback_ctl
= stac9205_loopback
;
7219 spec
->num_caps
= STAC9205_NUM_CAPS
;
7220 spec
->capvols
= stac9205_capvols
;
7221 spec
->capsws
= stac9205_capsws
;
7223 spec
->aloopback_mask
= 0x40;
7224 spec
->aloopback_shift
= 0;
7225 spec
->multiout
.dac_nids
= spec
->dac_nids
;
7227 /* GPIO0 High = EAPD */
7228 spec
->eapd_mask
= spec
->gpio_mask
= spec
->gpio_dir
= 0x1;
7229 spec
->gpio_data
= 0x01;
7231 /* Turn on/off EAPD per HP plugging */
7232 spec
->eapd_switch
= 1;
7234 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
7236 err
= stac92xx_parse_auto_config(codec
);
7240 stac92xx_free(codec
);
7244 codec
->patch_ops
= stac92xx_patch_ops
;
7246 codec
->proc_widget_hook
= stac9205_proc_hook
;
7248 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
7257 static const struct hda_verb stac9872_core_init
[] = {
7258 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x1}, /* mic-sel: 0a,0d,14,02 */
7259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Mic-in -> 0x9 */
7263 static const hda_nid_t stac9872_pin_nids
[] = {
7264 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
7268 static const hda_nid_t stac9872_adc_nids
[] = {
7272 static const hda_nid_t stac9872_mux_nids
[] = {
7276 static const unsigned long stac9872_capvols
[] = {
7277 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
7279 #define stac9872_capsws stac9872_capvols
7281 static const struct hda_pintbl stac9872_vaio_pin_configs
[] = {
7282 { 0x0a, 0x03211020 },
7283 { 0x0b, 0x411111f0 },
7284 { 0x0c, 0x411111f0 },
7285 { 0x0d, 0x03a15030 },
7286 { 0x0e, 0x411111f0 },
7287 { 0x0f, 0x90170110 },
7288 { 0x11, 0x411111f0 },
7289 { 0x13, 0x411111f0 },
7290 { 0x14, 0x90a7013e },
7294 static const struct hda_model_fixup stac9872_models
[] = {
7295 { .id
= STAC_9872_VAIO
, .name
= "vaio" },
7299 static const struct hda_fixup stac9872_fixups
[] = {
7300 [STAC_9872_VAIO
] = {
7301 .type
= HDA_FIXUP_PINS
,
7302 .v
.pins
= stac9872_vaio_pin_configs
,
7306 static const struct snd_pci_quirk stac9872_fixup_tbl
[] = {
7307 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
7308 "Sony VAIO F/S", STAC_9872_VAIO
),
7312 static int patch_stac9872(struct hda_codec
*codec
)
7314 struct sigmatel_spec
*spec
;
7317 err
= alloc_stac_spec(codec
, ARRAY_SIZE(stac9872_pin_nids
),
7323 spec
->linear_tone_beep
= 1;
7325 snd_hda_pick_fixup(codec
, stac9872_models
, stac9872_fixup_tbl
,
7328 spec
->multiout
.dac_nids
= spec
->dac_nids
;
7329 spec
->num_adcs
= ARRAY_SIZE(stac9872_adc_nids
);
7330 spec
->adc_nids
= stac9872_adc_nids
;
7331 spec
->num_muxes
= ARRAY_SIZE(stac9872_mux_nids
);
7332 spec
->mux_nids
= stac9872_mux_nids
;
7334 spec
->capvols
= stac9872_capvols
;
7335 spec
->capsws
= stac9872_capsws
;
7336 snd_hda_add_verbs(codec
, stac9872_core_init
);
7338 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
7340 err
= stac92xx_parse_auto_config(codec
);
7342 stac92xx_free(codec
);
7345 spec
->input_mux
= &spec
->private_imux
;
7346 codec
->patch_ops
= stac92xx_patch_ops
;
7348 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
7357 static const struct hda_codec_preset snd_hda_preset_sigmatel
[] = {
7358 { .id
= 0x83847690, .name
= "STAC9200", .patch
= patch_stac9200
},
7359 { .id
= 0x83847882, .name
= "STAC9220 A1", .patch
= patch_stac922x
},
7360 { .id
= 0x83847680, .name
= "STAC9221 A1", .patch
= patch_stac922x
},
7361 { .id
= 0x83847880, .name
= "STAC9220 A2", .patch
= patch_stac922x
},
7362 { .id
= 0x83847681, .name
= "STAC9220D/9223D A2", .patch
= patch_stac922x
},
7363 { .id
= 0x83847682, .name
= "STAC9221 A2", .patch
= patch_stac922x
},
7364 { .id
= 0x83847683, .name
= "STAC9221D A2", .patch
= patch_stac922x
},
7365 { .id
= 0x83847618, .name
= "STAC9227", .patch
= patch_stac927x
},
7366 { .id
= 0x83847619, .name
= "STAC9227", .patch
= patch_stac927x
},
7367 { .id
= 0x83847616, .name
= "STAC9228", .patch
= patch_stac927x
},
7368 { .id
= 0x83847617, .name
= "STAC9228", .patch
= patch_stac927x
},
7369 { .id
= 0x83847614, .name
= "STAC9229", .patch
= patch_stac927x
},
7370 { .id
= 0x83847615, .name
= "STAC9229", .patch
= patch_stac927x
},
7371 { .id
= 0x83847620, .name
= "STAC9274", .patch
= patch_stac927x
},
7372 { .id
= 0x83847621, .name
= "STAC9274D", .patch
= patch_stac927x
},
7373 { .id
= 0x83847622, .name
= "STAC9273X", .patch
= patch_stac927x
},
7374 { .id
= 0x83847623, .name
= "STAC9273D", .patch
= patch_stac927x
},
7375 { .id
= 0x83847624, .name
= "STAC9272X", .patch
= patch_stac927x
},
7376 { .id
= 0x83847625, .name
= "STAC9272D", .patch
= patch_stac927x
},
7377 { .id
= 0x83847626, .name
= "STAC9271X", .patch
= patch_stac927x
},
7378 { .id
= 0x83847627, .name
= "STAC9271D", .patch
= patch_stac927x
},
7379 { .id
= 0x83847628, .name
= "STAC9274X5NH", .patch
= patch_stac927x
},
7380 { .id
= 0x83847629, .name
= "STAC9274D5NH", .patch
= patch_stac927x
},
7381 { .id
= 0x83847632, .name
= "STAC9202", .patch
= patch_stac925x
},
7382 { .id
= 0x83847633, .name
= "STAC9202D", .patch
= patch_stac925x
},
7383 { .id
= 0x83847634, .name
= "STAC9250", .patch
= patch_stac925x
},
7384 { .id
= 0x83847635, .name
= "STAC9250D", .patch
= patch_stac925x
},
7385 { .id
= 0x83847636, .name
= "STAC9251", .patch
= patch_stac925x
},
7386 { .id
= 0x83847637, .name
= "STAC9250D", .patch
= patch_stac925x
},
7387 { .id
= 0x83847645, .name
= "92HD206X", .patch
= patch_stac927x
},
7388 { .id
= 0x83847646, .name
= "92HD206D", .patch
= patch_stac927x
},
7389 /* The following does not take into account .id=0x83847661 when subsys =
7390 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
7391 * currently not fully supported.
7393 { .id
= 0x83847661, .name
= "CXD9872RD/K", .patch
= patch_stac9872
},
7394 { .id
= 0x83847662, .name
= "STAC9872AK", .patch
= patch_stac9872
},
7395 { .id
= 0x83847664, .name
= "CXD9872AKD", .patch
= patch_stac9872
},
7396 { .id
= 0x83847698, .name
= "STAC9205", .patch
= patch_stac9205
},
7397 { .id
= 0x838476a0, .name
= "STAC9205", .patch
= patch_stac9205
},
7398 { .id
= 0x838476a1, .name
= "STAC9205D", .patch
= patch_stac9205
},
7399 { .id
= 0x838476a2, .name
= "STAC9204", .patch
= patch_stac9205
},
7400 { .id
= 0x838476a3, .name
= "STAC9204D", .patch
= patch_stac9205
},
7401 { .id
= 0x838476a4, .name
= "STAC9255", .patch
= patch_stac9205
},
7402 { .id
= 0x838476a5, .name
= "STAC9255D", .patch
= patch_stac9205
},
7403 { .id
= 0x838476a6, .name
= "STAC9254", .patch
= patch_stac9205
},
7404 { .id
= 0x838476a7, .name
= "STAC9254D", .patch
= patch_stac9205
},
7405 { .id
= 0x111d7603, .name
= "92HD75B3X5", .patch
= patch_stac92hd71bxx
},
7406 { .id
= 0x111d7604, .name
= "92HD83C1X5", .patch
= patch_stac92hd83xxx
},
7407 { .id
= 0x111d76d4, .name
= "92HD83C1C5", .patch
= patch_stac92hd83xxx
},
7408 { .id
= 0x111d7605, .name
= "92HD81B1X5", .patch
= patch_stac92hd83xxx
},
7409 { .id
= 0x111d76d5, .name
= "92HD81B1C5", .patch
= patch_stac92hd83xxx
},
7410 { .id
= 0x111d76d1, .name
= "92HD87B1/3", .patch
= patch_stac92hd83xxx
},
7411 { .id
= 0x111d76d9, .name
= "92HD87B2/4", .patch
= patch_stac92hd83xxx
},
7412 { .id
= 0x111d7666, .name
= "92HD88B3", .patch
= patch_stac92hd83xxx
},
7413 { .id
= 0x111d7667, .name
= "92HD88B1", .patch
= patch_stac92hd83xxx
},
7414 { .id
= 0x111d7668, .name
= "92HD88B2", .patch
= patch_stac92hd83xxx
},
7415 { .id
= 0x111d7669, .name
= "92HD88B4", .patch
= patch_stac92hd83xxx
},
7416 { .id
= 0x111d7608, .name
= "92HD75B2X5", .patch
= patch_stac92hd71bxx
},
7417 { .id
= 0x111d7674, .name
= "92HD73D1X5", .patch
= patch_stac92hd73xx
},
7418 { .id
= 0x111d7675, .name
= "92HD73C1X5", .patch
= patch_stac92hd73xx
},
7419 { .id
= 0x111d7676, .name
= "92HD73E1X5", .patch
= patch_stac92hd73xx
},
7420 { .id
= 0x111d76b0, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
7421 { .id
= 0x111d76b1, .name
= "92HD71B8X", .patch
= patch_stac92hd71bxx
},
7422 { .id
= 0x111d76b2, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
7423 { .id
= 0x111d76b3, .name
= "92HD71B7X", .patch
= patch_stac92hd71bxx
},
7424 { .id
= 0x111d76b4, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
7425 { .id
= 0x111d76b5, .name
= "92HD71B6X", .patch
= patch_stac92hd71bxx
},
7426 { .id
= 0x111d76b6, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
7427 { .id
= 0x111d76b7, .name
= "92HD71B5X", .patch
= patch_stac92hd71bxx
},
7428 { .id
= 0x111d76c0, .name
= "92HD89C3", .patch
= patch_stac92hd73xx
},
7429 { .id
= 0x111d76c1, .name
= "92HD89C2", .patch
= patch_stac92hd73xx
},
7430 { .id
= 0x111d76c2, .name
= "92HD89C1", .patch
= patch_stac92hd73xx
},
7431 { .id
= 0x111d76c3, .name
= "92HD89B3", .patch
= patch_stac92hd73xx
},
7432 { .id
= 0x111d76c4, .name
= "92HD89B2", .patch
= patch_stac92hd73xx
},
7433 { .id
= 0x111d76c5, .name
= "92HD89B1", .patch
= patch_stac92hd73xx
},
7434 { .id
= 0x111d76c6, .name
= "92HD89E3", .patch
= patch_stac92hd73xx
},
7435 { .id
= 0x111d76c7, .name
= "92HD89E2", .patch
= patch_stac92hd73xx
},
7436 { .id
= 0x111d76c8, .name
= "92HD89E1", .patch
= patch_stac92hd73xx
},
7437 { .id
= 0x111d76c9, .name
= "92HD89D3", .patch
= patch_stac92hd73xx
},
7438 { .id
= 0x111d76ca, .name
= "92HD89D2", .patch
= patch_stac92hd73xx
},
7439 { .id
= 0x111d76cb, .name
= "92HD89D1", .patch
= patch_stac92hd73xx
},
7440 { .id
= 0x111d76cc, .name
= "92HD89F3", .patch
= patch_stac92hd73xx
},
7441 { .id
= 0x111d76cd, .name
= "92HD89F2", .patch
= patch_stac92hd73xx
},
7442 { .id
= 0x111d76ce, .name
= "92HD89F1", .patch
= patch_stac92hd73xx
},
7443 { .id
= 0x111d76df, .name
= "92HD93BXX", .patch
= patch_stac92hd83xxx
},
7444 { .id
= 0x111d76e0, .name
= "92HD91BXX", .patch
= patch_stac92hd83xxx
},
7445 { .id
= 0x111d76e3, .name
= "92HD98BXX", .patch
= patch_stac92hd83xxx
},
7446 { .id
= 0x111d76e5, .name
= "92HD99BXX", .patch
= patch_stac92hd83xxx
},
7447 { .id
= 0x111d76e7, .name
= "92HD90BXX", .patch
= patch_stac92hd83xxx
},
7448 { .id
= 0x111d76e8, .name
= "92HD66B1X5", .patch
= patch_stac92hd83xxx
},
7449 { .id
= 0x111d76e9, .name
= "92HD66B2X5", .patch
= patch_stac92hd83xxx
},
7450 { .id
= 0x111d76ea, .name
= "92HD66B3X5", .patch
= patch_stac92hd83xxx
},
7451 { .id
= 0x111d76eb, .name
= "92HD66C1X5", .patch
= patch_stac92hd83xxx
},
7452 { .id
= 0x111d76ec, .name
= "92HD66C2X5", .patch
= patch_stac92hd83xxx
},
7453 { .id
= 0x111d76ed, .name
= "92HD66C3X5", .patch
= patch_stac92hd83xxx
},
7454 { .id
= 0x111d76ee, .name
= "92HD66B1X3", .patch
= patch_stac92hd83xxx
},
7455 { .id
= 0x111d76ef, .name
= "92HD66B2X3", .patch
= patch_stac92hd83xxx
},
7456 { .id
= 0x111d76f0, .name
= "92HD66B3X3", .patch
= patch_stac92hd83xxx
},
7457 { .id
= 0x111d76f1, .name
= "92HD66C1X3", .patch
= patch_stac92hd83xxx
},
7458 { .id
= 0x111d76f2, .name
= "92HD66C2X3", .patch
= patch_stac92hd83xxx
},
7459 { .id
= 0x111d76f3, .name
= "92HD66C3/65", .patch
= patch_stac92hd83xxx
},
7463 MODULE_ALIAS("snd-hda-codec-id:8384*");
7464 MODULE_ALIAS("snd-hda-codec-id:111d*");
7466 MODULE_LICENSE("GPL");
7467 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
7469 static struct hda_codec_preset_list sigmatel_list
= {
7470 .preset
= snd_hda_preset_sigmatel
,
7471 .owner
= THIS_MODULE
,
7474 static int __init
patch_sigmatel_init(void)
7476 return snd_hda_add_codec_preset(&sigmatel_list
);
7479 static void __exit
patch_sigmatel_exit(void)
7481 snd_hda_delete_codec_preset(&sigmatel_list
);
7484 module_init(patch_sigmatel_init
)
7485 module_exit(patch_sigmatel_exit
)