aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c1194
1 files changed, 797 insertions, 397 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6c26afcb8262..82097790f6f3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -30,6 +30,7 @@
30#include <sound/core.h> 30#include <sound/core.h>
31#include "hda_codec.h" 31#include "hda_codec.h"
32#include "hda_local.h" 32#include "hda_local.h"
33#include "hda_beep.h"
33 34
34#define ALC880_FRONT_EVENT 0x01 35#define ALC880_FRONT_EVENT 0x01
35#define ALC880_DCVOL_EVENT 0x02 36#define ALC880_DCVOL_EVENT 0x02
@@ -77,6 +78,7 @@ enum {
77 ALC260_ACER, 78 ALC260_ACER,
78 ALC260_WILL, 79 ALC260_WILL,
79 ALC260_REPLACER_672V, 80 ALC260_REPLACER_672V,
81 ALC260_FAVORIT100,
80#ifdef CONFIG_SND_DEBUG 82#ifdef CONFIG_SND_DEBUG
81 ALC260_TEST, 83 ALC260_TEST,
82#endif 84#endif
@@ -103,6 +105,7 @@ enum {
103 ALC262_NEC, 105 ALC262_NEC,
104 ALC262_TOSHIBA_S06, 106 ALC262_TOSHIBA_S06,
105 ALC262_TOSHIBA_RX1, 107 ALC262_TOSHIBA_RX1,
108 ALC262_TYAN,
106 ALC262_AUTO, 109 ALC262_AUTO,
107 ALC262_MODEL_LAST /* last tag */ 110 ALC262_MODEL_LAST /* last tag */
108}; 111};
@@ -238,6 +241,13 @@ enum {
238 ALC883_MODEL_LAST, 241 ALC883_MODEL_LAST,
239}; 242};
240 243
244/* styles of capture selection */
245enum {
246 CAPT_MUX = 0, /* only mux based */
247 CAPT_MIX, /* only mixer based */
248 CAPT_1MUX_MIX, /* first mux and other mixers */
249};
250
241/* for GPIO Poll */ 251/* for GPIO Poll */
242#define GPIO_MASK 0x03 252#define GPIO_MASK 0x03
243 253
@@ -246,6 +256,7 @@ struct alc_spec {
246 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 256 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
247 unsigned int num_mixers; 257 unsigned int num_mixers;
248 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 258 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
259 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
249 260
250 const struct hda_verb *init_verbs[5]; /* initialization verbs 261 const struct hda_verb *init_verbs[5]; /* initialization verbs
251 * don't forget NULL 262 * don't forget NULL
@@ -269,13 +280,15 @@ struct alc_spec {
269 * dig_out_nid and hp_nid are optional 280 * dig_out_nid and hp_nid are optional
270 */ 281 */
271 hda_nid_t alt_dac_nid; 282 hda_nid_t alt_dac_nid;
283 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
284 int dig_out_type;
272 285
273 /* capture */ 286 /* capture */
274 unsigned int num_adc_nids; 287 unsigned int num_adc_nids;
275 hda_nid_t *adc_nids; 288 hda_nid_t *adc_nids;
276 hda_nid_t *capsrc_nids; 289 hda_nid_t *capsrc_nids;
277 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 290 hda_nid_t dig_in_nid; /* digital-in NID; optional */
278 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ 291 int capture_style; /* capture style (CAPT_*) */
279 292
280 /* capture source */ 293 /* capture source */
281 unsigned int num_mux_defs; 294 unsigned int num_mux_defs;
@@ -293,7 +306,7 @@ struct alc_spec {
293 /* dynamic controls, init_verbs and input_mux */ 306 /* dynamic controls, init_verbs and input_mux */
294 struct auto_pin_cfg autocfg; 307 struct auto_pin_cfg autocfg;
295 struct snd_array kctls; 308 struct snd_array kctls;
296 struct hda_input_mux private_imux; 309 struct hda_input_mux private_imux[3];
297 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; 310 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
298 311
299 /* hooks */ 312 /* hooks */
@@ -305,6 +318,9 @@ struct alc_spec {
305 unsigned int jack_present: 1; 318 unsigned int jack_present: 1;
306 unsigned int master_sw: 1; 319 unsigned int master_sw: 1;
307 320
321 /* other flags */
322 unsigned int no_analog :1; /* digital I/O only */
323
308 /* for virtual master */ 324 /* for virtual master */
309 hda_nid_t vmaster_nid; 325 hda_nid_t vmaster_nid;
310#ifdef CONFIG_SND_HDA_POWER_SAVE 326#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -314,13 +330,6 @@ struct alc_spec {
314 /* for PLL fix */ 330 /* for PLL fix */
315 hda_nid_t pll_nid; 331 hda_nid_t pll_nid;
316 unsigned int pll_coef_idx, pll_coef_bit; 332 unsigned int pll_coef_idx, pll_coef_bit;
317
318#ifdef SND_HDA_NEEDS_RESUME
319#define ALC_MAX_PINS 16
320 unsigned int num_pins;
321 hda_nid_t pin_nids[ALC_MAX_PINS];
322 unsigned int pin_cfgs[ALC_MAX_PINS];
323#endif
324}; 333};
325 334
326/* 335/*
@@ -336,6 +345,7 @@ struct alc_config_preset {
336 hda_nid_t *dac_nids; 345 hda_nid_t *dac_nids;
337 hda_nid_t dig_out_nid; /* optional */ 346 hda_nid_t dig_out_nid; /* optional */
338 hda_nid_t hp_nid; /* optional */ 347 hda_nid_t hp_nid; /* optional */
348 hda_nid_t *slave_dig_outs;
339 unsigned int num_adc_nids; 349 unsigned int num_adc_nids;
340 hda_nid_t *adc_nids; 350 hda_nid_t *adc_nids;
341 hda_nid_t *capsrc_nids; 351 hda_nid_t *capsrc_nids;
@@ -392,7 +402,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
392 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 402 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
393 imux = &spec->input_mux[mux_idx]; 403 imux = &spec->input_mux[mux_idx];
394 404
395 if (spec->is_mix_capture) { 405 if (spec->capture_style &&
406 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
396 /* Matrix-mixer style (e.g. ALC882) */ 407 /* Matrix-mixer style (e.g. ALC882) */
397 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 408 unsigned int *cur_val = &spec->cur_mux[adc_idx];
398 unsigned int i, idx; 409 unsigned int i, idx;
@@ -750,6 +761,24 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
750#endif /* CONFIG_SND_DEBUG */ 761#endif /* CONFIG_SND_DEBUG */
751 762
752/* 763/*
764 * set up the input pin config (depending on the given auto-pin type)
765 */
766static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
767 int auto_pin_type)
768{
769 unsigned int val = PIN_IN;
770
771 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
772 unsigned int pincap;
773 pincap = snd_hda_query_pin_caps(codec, nid);
774 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
775 if (pincap & AC_PINCAP_VREF_80)
776 val = PIN_VREF80;
777 }
778 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
779}
780
781/*
753 */ 782 */
754static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) 783static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
755{ 784{
@@ -810,6 +839,7 @@ static void setup_preset(struct alc_spec *spec,
810 spec->multiout.num_dacs = preset->num_dacs; 839 spec->multiout.num_dacs = preset->num_dacs;
811 spec->multiout.dac_nids = preset->dac_nids; 840 spec->multiout.dac_nids = preset->dac_nids;
812 spec->multiout.dig_out_nid = preset->dig_out_nid; 841 spec->multiout.dig_out_nid = preset->dig_out_nid;
842 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
813 spec->multiout.hp_nid = preset->hp_nid; 843 spec->multiout.hp_nid = preset->hp_nid;
814 844
815 spec->num_mux_defs = preset->num_mux_defs; 845 spec->num_mux_defs = preset->num_mux_defs;
@@ -921,7 +951,7 @@ static void alc_mic_automute(struct hda_codec *codec)
921 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 951 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
922} 952}
923#else 953#else
924#define alc_mic_automute(codec) /* NOP */ 954#define alc_mic_automute(codec) do {} while(0) /* NOP */
925#endif /* disabled */ 955#endif /* disabled */
926 956
927/* unsolicited event for HP jack sensing */ 957/* unsolicited event for HP jack sensing */
@@ -952,7 +982,7 @@ static void alc888_coef_init(struct hda_codec *codec)
952 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); 982 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
953 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); 983 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
954 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); 984 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
955 if ((tmp & 0xf0) == 2) 985 if ((tmp & 0xf0) == 0x20)
956 /* alc888S-VC */ 986 /* alc888S-VC */
957 snd_hda_codec_read(codec, 0x20, 0, 987 snd_hda_codec_read(codec, 0x20, 0,
958 AC_VERB_SET_PROC_COEF, 0x830); 988 AC_VERB_SET_PROC_COEF, 0x830);
@@ -991,8 +1021,7 @@ static void alc_subsystem_id(struct hda_codec *codec,
991 nid = 0x1d; 1021 nid = 0x1d;
992 if (codec->vendor_id == 0x10ec0260) 1022 if (codec->vendor_id == 0x10ec0260)
993 nid = 0x17; 1023 nid = 0x17;
994 ass = snd_hda_codec_read(codec, nid, 0, 1024 ass = snd_hda_codec_get_pincfg(codec, nid);
995 AC_VERB_GET_CONFIG_DEFAULT, 0);
996 if (!(ass & 1) && !(ass & 0x100000)) 1025 if (!(ass & 1) && !(ass & 0x100000))
997 return; 1026 return;
998 if ((ass >> 30) != 1) /* no physical connection */ 1027 if ((ass >> 30) != 1) /* no physical connection */
@@ -1166,16 +1195,8 @@ static void alc_fix_pincfg(struct hda_codec *codec,
1166 return; 1195 return;
1167 1196
1168 cfg = pinfix[quirk->value]; 1197 cfg = pinfix[quirk->value];
1169 for (; cfg->nid; cfg++) { 1198 for (; cfg->nid; cfg++)
1170 int i; 1199 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1171 u32 val = cfg->val;
1172 for (i = 0; i < 4; i++) {
1173 snd_hda_codec_write(codec, cfg->nid, 0,
1174 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1175 val & 0xff);
1176 val >>= 8;
1177 }
1178 }
1179} 1200}
1180 1201
1181/* 1202/*
@@ -1375,8 +1396,6 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 1397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1378 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1379 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1380 { } /* end */ 1399 { } /* end */
1381}; 1400};
1382 1401
@@ -1483,8 +1502,6 @@ static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1484 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), 1503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1485 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), 1504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1486 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1487 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), 1505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1489 { 1506 {
1490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1578,8 +1595,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1578 snd_hda_mixer_amp_switch_put); 1595 snd_hda_mixer_amp_switch_put);
1579} 1596}
1580 1597
1581#define DEFINE_CAPMIX(num) \ 1598#define _DEFINE_CAPMIX(num) \
1582static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1583 { \ 1599 { \
1584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 1600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1585 .name = "Capture Switch", \ 1601 .name = "Capture Switch", \
@@ -1600,7 +1616,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1600 .get = alc_cap_vol_get, \ 1616 .get = alc_cap_vol_get, \
1601 .put = alc_cap_vol_put, \ 1617 .put = alc_cap_vol_put, \
1602 .tlv = { .c = alc_cap_vol_tlv }, \ 1618 .tlv = { .c = alc_cap_vol_tlv }, \
1603 }, \ 1619 }
1620
1621#define _DEFINE_CAPSRC(num) \
1604 { \ 1622 { \
1605 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 1623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1606 /* .name = "Capture Source", */ \ 1624 /* .name = "Capture Source", */ \
@@ -1609,15 +1627,28 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1609 .info = alc_mux_enum_info, \ 1627 .info = alc_mux_enum_info, \
1610 .get = alc_mux_enum_get, \ 1628 .get = alc_mux_enum_get, \
1611 .put = alc_mux_enum_put, \ 1629 .put = alc_mux_enum_put, \
1612 }, \ 1630 }
1613 { } /* end */ \ 1631
1632#define DEFINE_CAPMIX(num) \
1633static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1634 _DEFINE_CAPMIX(num), \
1635 _DEFINE_CAPSRC(num), \
1636 { } /* end */ \
1637}
1638
1639#define DEFINE_CAPMIX_NOSRC(num) \
1640static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1641 _DEFINE_CAPMIX(num), \
1642 { } /* end */ \
1614} 1643}
1615 1644
1616/* up to three ADCs */ 1645/* up to three ADCs */
1617DEFINE_CAPMIX(1); 1646DEFINE_CAPMIX(1);
1618DEFINE_CAPMIX(2); 1647DEFINE_CAPMIX(2);
1619DEFINE_CAPMIX(3); 1648DEFINE_CAPMIX(3);
1620 1649DEFINE_CAPMIX_NOSRC(1);
1650DEFINE_CAPMIX_NOSRC(2);
1651DEFINE_CAPMIX_NOSRC(3);
1621 1652
1622/* 1653/*
1623 * ALC880 5-stack model 1654 * ALC880 5-stack model
@@ -1706,8 +1737,6 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1738 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1739 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1709 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1710 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1711 { 1740 {
1712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1713 .name = "Channel Mode", 1742 .name = "Channel Mode",
@@ -1884,13 +1913,6 @@ static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1884 { } /* end */ 1913 { } /* end */
1885}; 1914};
1886 1915
1887/* additional mixers to alc880_asus_mixer */
1888static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1889 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1890 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1891 { } /* end */
1892};
1893
1894/* TCL S700 */ 1916/* TCL S700 */
1895static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { 1917static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1918 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
@@ -1923,8 +1945,6 @@ static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1946 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1947 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1926 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1927 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1928 { 1948 {
1929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1930 .name = "Channel Mode", 1950 .name = "Channel Mode",
@@ -1999,6 +2019,13 @@ static const char *alc_slave_sws[] = {
1999 2019
2000static void alc_free_kctls(struct hda_codec *codec); 2020static void alc_free_kctls(struct hda_codec *codec);
2001 2021
2022/* additional beep mixers; the actual parameters are overwritten at build */
2023static struct snd_kcontrol_new alc_beep_mixer[] = {
2024 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2025 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2026 { } /* end */
2027};
2028
2002static int alc_build_controls(struct hda_codec *codec) 2029static int alc_build_controls(struct hda_codec *codec)
2003{ 2030{
2004 struct alc_spec *spec = codec->spec; 2031 struct alc_spec *spec = codec->spec;
@@ -2020,11 +2047,13 @@ static int alc_build_controls(struct hda_codec *codec)
2020 spec->multiout.dig_out_nid); 2047 spec->multiout.dig_out_nid);
2021 if (err < 0) 2048 if (err < 0)
2022 return err; 2049 return err;
2023 err = snd_hda_create_spdif_share_sw(codec, 2050 if (!spec->no_analog) {
2024 &spec->multiout); 2051 err = snd_hda_create_spdif_share_sw(codec,
2025 if (err < 0) 2052 &spec->multiout);
2026 return err; 2053 if (err < 0)
2027 spec->multiout.share_spdif = 1; 2054 return err;
2055 spec->multiout.share_spdif = 1;
2056 }
2028 } 2057 }
2029 if (spec->dig_in_nid) { 2058 if (spec->dig_in_nid) {
2030 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); 2059 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
@@ -2032,8 +2061,24 @@ static int alc_build_controls(struct hda_codec *codec)
2032 return err; 2061 return err;
2033 } 2062 }
2034 2063
2064 /* create beep controls if needed */
2065 if (spec->beep_amp) {
2066 struct snd_kcontrol_new *knew;
2067 for (knew = alc_beep_mixer; knew->name; knew++) {
2068 struct snd_kcontrol *kctl;
2069 kctl = snd_ctl_new1(knew, codec);
2070 if (!kctl)
2071 return -ENOMEM;
2072 kctl->private_value = spec->beep_amp;
2073 err = snd_hda_ctl_add(codec, kctl);
2074 if (err < 0)
2075 return err;
2076 }
2077 }
2078
2035 /* if we have no master control, let's create it */ 2079 /* if we have no master control, let's create it */
2036 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 2080 if (!spec->no_analog &&
2081 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2037 unsigned int vmaster_tlv[4]; 2082 unsigned int vmaster_tlv[4];
2038 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, 2083 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2039 HDA_OUTPUT, vmaster_tlv); 2084 HDA_OUTPUT, vmaster_tlv);
@@ -2042,7 +2087,8 @@ static int alc_build_controls(struct hda_codec *codec)
2042 if (err < 0) 2087 if (err < 0)
2043 return err; 2088 return err;
2044 } 2089 }
2045 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { 2090 if (!spec->no_analog &&
2091 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2046 err = snd_hda_add_vmaster(codec, "Master Playback Switch", 2092 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2047 NULL, alc_slave_sws); 2093 NULL, alc_slave_sws);
2048 if (err < 0) 2094 if (err < 0)
@@ -2951,6 +2997,14 @@ static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2951 stream_tag, format, substream); 2997 stream_tag, format, substream);
2952} 2998}
2953 2999
3000static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3001 struct hda_codec *codec,
3002 struct snd_pcm_substream *substream)
3003{
3004 struct alc_spec *spec = codec->spec;
3005 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3006}
3007
2954static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, 3008static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2955 struct hda_codec *codec, 3009 struct hda_codec *codec,
2956 struct snd_pcm_substream *substream) 3010 struct snd_pcm_substream *substream)
@@ -3034,7 +3088,8 @@ static struct hda_pcm_stream alc880_pcm_digital_playback = {
3034 .ops = { 3088 .ops = {
3035 .open = alc880_dig_playback_pcm_open, 3089 .open = alc880_dig_playback_pcm_open,
3036 .close = alc880_dig_playback_pcm_close, 3090 .close = alc880_dig_playback_pcm_close,
3037 .prepare = alc880_dig_playback_pcm_prepare 3091 .prepare = alc880_dig_playback_pcm_prepare,
3092 .cleanup = alc880_dig_playback_pcm_cleanup
3038 }, 3093 },
3039}; 3094};
3040 3095
@@ -3061,6 +3116,9 @@ static int alc_build_pcms(struct hda_codec *codec)
3061 codec->num_pcms = 1; 3116 codec->num_pcms = 1;
3062 codec->pcm_info = info; 3117 codec->pcm_info = info;
3063 3118
3119 if (spec->no_analog)
3120 goto skip_analog;
3121
3064 info->name = spec->stream_name_analog; 3122 info->name = spec->stream_name_analog;
3065 if (spec->stream_analog_playback) { 3123 if (spec->stream_analog_playback) {
3066 if (snd_BUG_ON(!spec->multiout.dac_nids)) 3124 if (snd_BUG_ON(!spec->multiout.dac_nids))
@@ -3084,12 +3142,17 @@ static int alc_build_pcms(struct hda_codec *codec)
3084 } 3142 }
3085 } 3143 }
3086 3144
3145 skip_analog:
3087 /* SPDIF for stream index #1 */ 3146 /* SPDIF for stream index #1 */
3088 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 3147 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3089 codec->num_pcms = 2; 3148 codec->num_pcms = 2;
3149 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3090 info = spec->pcm_rec + 1; 3150 info = spec->pcm_rec + 1;
3091 info->name = spec->stream_name_digital; 3151 info->name = spec->stream_name_digital;
3092 info->pcm_type = HDA_PCM_TYPE_SPDIF; 3152 if (spec->dig_out_type)
3153 info->pcm_type = spec->dig_out_type;
3154 else
3155 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3093 if (spec->multiout.dig_out_nid && 3156 if (spec->multiout.dig_out_nid &&
3094 spec->stream_digital_playback) { 3157 spec->stream_digital_playback) {
3095 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); 3158 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
@@ -3104,6 +3167,9 @@ static int alc_build_pcms(struct hda_codec *codec)
3104 codec->spdif_status_reset = 1; 3167 codec->spdif_status_reset = 1;
3105 } 3168 }
3106 3169
3170 if (spec->no_analog)
3171 return 0;
3172
3107 /* If the use of more than one ADC is requested for the current 3173 /* If the use of more than one ADC is requested for the current
3108 * model, configure a second analog capture-only PCM. 3174 * model, configure a second analog capture-only PCM.
3109 */ 3175 */
@@ -3162,65 +3228,17 @@ static void alc_free(struct hda_codec *codec)
3162 3228
3163 alc_free_kctls(codec); 3229 alc_free_kctls(codec);
3164 kfree(spec); 3230 kfree(spec);
3165 codec->spec = NULL; /* to be sure */ 3231 snd_hda_detach_beep_device(codec);
3166} 3232}
3167 3233
3168#ifdef SND_HDA_NEEDS_RESUME 3234#ifdef SND_HDA_NEEDS_RESUME
3169static void store_pin_configs(struct hda_codec *codec)
3170{
3171 struct alc_spec *spec = codec->spec;
3172 hda_nid_t nid, end_nid;
3173
3174 end_nid = codec->start_nid + codec->num_nodes;
3175 for (nid = codec->start_nid; nid < end_nid; nid++) {
3176 unsigned int wid_caps = get_wcaps(codec, nid);
3177 unsigned int wid_type =
3178 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3179 if (wid_type != AC_WID_PIN)
3180 continue;
3181 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3182 break;
3183 spec->pin_nids[spec->num_pins] = nid;
3184 spec->pin_cfgs[spec->num_pins] =
3185 snd_hda_codec_read(codec, nid, 0,
3186 AC_VERB_GET_CONFIG_DEFAULT, 0);
3187 spec->num_pins++;
3188 }
3189}
3190
3191static void resume_pin_configs(struct hda_codec *codec)
3192{
3193 struct alc_spec *spec = codec->spec;
3194 int i;
3195
3196 for (i = 0; i < spec->num_pins; i++) {
3197 hda_nid_t pin_nid = spec->pin_nids[i];
3198 unsigned int pin_config = spec->pin_cfgs[i];
3199 snd_hda_codec_write(codec, pin_nid, 0,
3200 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3201 pin_config & 0x000000ff);
3202 snd_hda_codec_write(codec, pin_nid, 0,
3203 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3204 (pin_config & 0x0000ff00) >> 8);
3205 snd_hda_codec_write(codec, pin_nid, 0,
3206 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3207 (pin_config & 0x00ff0000) >> 16);
3208 snd_hda_codec_write(codec, pin_nid, 0,
3209 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3210 pin_config >> 24);
3211 }
3212}
3213
3214static int alc_resume(struct hda_codec *codec) 3235static int alc_resume(struct hda_codec *codec)
3215{ 3236{
3216 resume_pin_configs(codec);
3217 codec->patch_ops.init(codec); 3237 codec->patch_ops.init(codec);
3218 snd_hda_codec_resume_amp(codec); 3238 snd_hda_codec_resume_amp(codec);
3219 snd_hda_codec_resume_cache(codec); 3239 snd_hda_codec_resume_cache(codec);
3220 return 0; 3240 return 0;
3221} 3241}
3222#else
3223#define store_pin_configs(codec)
3224#endif 3242#endif
3225 3243
3226/* 3244/*
@@ -3559,7 +3577,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
3559 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), 3577 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3560 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), 3578 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3561 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), 3579 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3562 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ 3580 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3563 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), 3581 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3564 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), 3582 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3565 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), 3583 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
@@ -3602,7 +3620,8 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
3602 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), 3620 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3603 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), 3621 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3604 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), 3622 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3605 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ 3623 /* default Intel */
3624 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3606 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), 3625 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), 3626 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3608 {} 3627 {}
@@ -3782,7 +3801,7 @@ static struct alc_config_preset alc880_presets[] = {
3782 .input_mux = &alc880_capture_source, 3801 .input_mux = &alc880_capture_source,
3783 }, 3802 },
3784 [ALC880_UNIWILL_DIG] = { 3803 [ALC880_UNIWILL_DIG] = {
3785 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, 3804 .mixers = { alc880_asus_mixer },
3786 .init_verbs = { alc880_volume_init_verbs, 3805 .init_verbs = { alc880_volume_init_verbs,
3787 alc880_pin_asus_init_verbs }, 3806 alc880_pin_asus_init_verbs },
3788 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 3807 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
@@ -3820,8 +3839,7 @@ static struct alc_config_preset alc880_presets[] = {
3820 .init_hook = alc880_uniwill_p53_hp_automute, 3839 .init_hook = alc880_uniwill_p53_hp_automute,
3821 }, 3840 },
3822 [ALC880_FUJITSU] = { 3841 [ALC880_FUJITSU] = {
3823 .mixers = { alc880_fujitsu_mixer, 3842 .mixers = { alc880_fujitsu_mixer },
3824 alc880_pcbeep_mixer, },
3825 .init_verbs = { alc880_volume_init_verbs, 3843 .init_verbs = { alc880_volume_init_verbs,
3826 alc880_uniwill_p53_init_verbs, 3844 alc880_uniwill_p53_init_verbs,
3827 alc880_beep_init_verbs }, 3845 alc880_beep_init_verbs },
@@ -4114,7 +4132,7 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4114static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, 4132static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4115 const struct auto_pin_cfg *cfg) 4133 const struct auto_pin_cfg *cfg)
4116{ 4134{
4117 struct hda_input_mux *imux = &spec->private_imux; 4135 struct hda_input_mux *imux = &spec->private_imux[0];
4118 int i, err, idx; 4136 int i, err, idx;
4119 4137
4120 for (i = 0; i < AUTO_PIN_LAST; i++) { 4138 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -4202,11 +4220,9 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec)
4202 for (i = 0; i < AUTO_PIN_LAST; i++) { 4220 for (i = 0; i < AUTO_PIN_LAST; i++) {
4203 hda_nid_t nid = spec->autocfg.input_pins[i]; 4221 hda_nid_t nid = spec->autocfg.input_pins[i];
4204 if (alc880_is_input_pin(nid)) { 4222 if (alc880_is_input_pin(nid)) {
4205 snd_hda_codec_write(codec, nid, 0, 4223 alc_set_input_pin(codec, nid, i);
4206 AC_VERB_SET_PIN_WIDGET_CONTROL, 4224 if (nid != ALC880_PIN_CD_NID &&
4207 i <= AUTO_PIN_FRONT_MIC ? 4225 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4208 PIN_VREF80 : PIN_IN);
4209 if (nid != ALC880_PIN_CD_NID)
4210 snd_hda_codec_write(codec, nid, 0, 4226 snd_hda_codec_write(codec, nid, 0,
4211 AC_VERB_SET_AMP_GAIN_MUTE, 4227 AC_VERB_SET_AMP_GAIN_MUTE,
4212 AMP_OUT_MUTE); 4228 AMP_OUT_MUTE);
@@ -4221,7 +4237,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec)
4221static int alc880_parse_auto_config(struct hda_codec *codec) 4237static int alc880_parse_auto_config(struct hda_codec *codec)
4222{ 4238{
4223 struct alc_spec *spec = codec->spec; 4239 struct alc_spec *spec = codec->spec;
4224 int err; 4240 int i, err;
4225 static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 4241 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4226 4242
4227 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 4243 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -4252,8 +4268,23 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4252 4268
4253 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 4269 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4254 4270
4255 if (spec->autocfg.dig_out_pin) 4271 /* check multiple SPDIF-out (for recent codecs) */
4256 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 4272 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4273 hda_nid_t dig_nid;
4274 err = snd_hda_get_connections(codec,
4275 spec->autocfg.dig_out_pins[i],
4276 &dig_nid, 1);
4277 if (err < 0)
4278 continue;
4279 if (!i)
4280 spec->multiout.dig_out_nid = dig_nid;
4281 else {
4282 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4283 spec->slave_dig_outs[i - 1] = dig_nid;
4284 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4285 break;
4286 }
4287 }
4257 if (spec->autocfg.dig_in_pin) 4288 if (spec->autocfg.dig_in_pin)
4258 spec->dig_in_nid = ALC880_DIGIN_NID; 4289 spec->dig_in_nid = ALC880_DIGIN_NID;
4259 4290
@@ -4263,9 +4294,8 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4263 add_verb(spec, alc880_volume_init_verbs); 4294 add_verb(spec, alc880_volume_init_verbs);
4264 4295
4265 spec->num_mux_defs = 1; 4296 spec->num_mux_defs = 1;
4266 spec->input_mux = &spec->private_imux; 4297 spec->input_mux = &spec->private_imux[0];
4267 4298
4268 store_pin_configs(codec);
4269 return 1; 4299 return 1;
4270} 4300}
4271 4301
@@ -4280,21 +4310,33 @@ static void alc880_auto_init(struct hda_codec *codec)
4280 alc_inithook(codec); 4310 alc_inithook(codec);
4281} 4311}
4282 4312
4283/*
4284 * OK, here we have finally the patch for ALC880
4285 */
4286
4287static void set_capture_mixer(struct alc_spec *spec) 4313static void set_capture_mixer(struct alc_spec *spec)
4288{ 4314{
4289 static struct snd_kcontrol_new *caps[3] = { 4315 static struct snd_kcontrol_new *caps[2][3] = {
4290 alc_capture_mixer1, 4316 { alc_capture_mixer_nosrc1,
4291 alc_capture_mixer2, 4317 alc_capture_mixer_nosrc2,
4292 alc_capture_mixer3, 4318 alc_capture_mixer_nosrc3 },
4319 { alc_capture_mixer1,
4320 alc_capture_mixer2,
4321 alc_capture_mixer3 },
4293 }; 4322 };
4294 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) 4323 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4295 spec->cap_mixer = caps[spec->num_adc_nids - 1]; 4324 int mux;
4325 if (spec->input_mux && spec->input_mux->num_items > 1)
4326 mux = 1;
4327 else
4328 mux = 0;
4329 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4330 }
4296} 4331}
4297 4332
4333#define set_beep_amp(spec, nid, idx, dir) \
4334 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4335
4336/*
4337 * OK, here we have finally the patch for ALC880
4338 */
4339
4298static int patch_alc880(struct hda_codec *codec) 4340static int patch_alc880(struct hda_codec *codec)
4299{ 4341{
4300 struct alc_spec *spec; 4342 struct alc_spec *spec;
@@ -4330,6 +4372,12 @@ static int patch_alc880(struct hda_codec *codec)
4330 } 4372 }
4331 } 4373 }
4332 4374
4375 err = snd_hda_attach_beep_device(codec, 0x1);
4376 if (err < 0) {
4377 alc_free(codec);
4378 return err;
4379 }
4380
4333 if (board_config != ALC880_AUTO) 4381 if (board_config != ALC880_AUTO)
4334 setup_preset(spec, &alc880_presets[board_config]); 4382 setup_preset(spec, &alc880_presets[board_config]);
4335 4383
@@ -4356,6 +4404,7 @@ static int patch_alc880(struct hda_codec *codec)
4356 } 4404 }
4357 } 4405 }
4358 set_capture_mixer(spec); 4406 set_capture_mixer(spec);
4407 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4359 4408
4360 spec->vmaster_nid = 0x0c; 4409 spec->vmaster_nid = 0x0c;
4361 4410
@@ -4463,6 +4512,26 @@ static struct hda_input_mux alc260_acer_capture_sources[2] = {
4463 }, 4512 },
4464 }, 4513 },
4465}; 4514};
4515
4516/* Maxdata Favorit 100XS */
4517static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4518 {
4519 .num_items = 2,
4520 .items = {
4521 { "Line/Mic", 0x0 },
4522 { "CD", 0x4 },
4523 },
4524 },
4525 {
4526 .num_items = 3,
4527 .items = {
4528 { "Line/Mic", 0x0 },
4529 { "CD", 0x4 },
4530 { "Mixer", 0x5 },
4531 },
4532 },
4533};
4534
4466/* 4535/*
4467 * This is just place-holder, so there's something for alc_build_pcms to look 4536 * This is just place-holder, so there's something for alc_build_pcms to look
4468 * at when it calculates the maximum number of channels. ALC260 has no mixer 4537 * at when it calculates the maximum number of channels. ALC260 has no mixer
@@ -4505,12 +4574,6 @@ static struct snd_kcontrol_new alc260_input_mixer[] = {
4505 { } /* end */ 4574 { } /* end */
4506}; 4575};
4507 4576
4508static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4509 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4510 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4511 { } /* end */
4512};
4513
4514/* update HP, line and mono out pins according to the master switch */ 4577/* update HP, line and mono out pins according to the master switch */
4515static void alc260_hp_master_update(struct hda_codec *codec, 4578static void alc260_hp_master_update(struct hda_codec *codec,
4516 hda_nid_t hp, hda_nid_t line, 4579 hda_nid_t hp, hda_nid_t line,
@@ -4702,8 +4765,6 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4702 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), 4765 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4703 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), 4766 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4704 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), 4767 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4705 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4706 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4707 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 4768 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4708 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), 4769 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4709 { } /* end */ 4770 { } /* end */
@@ -4748,8 +4809,18 @@ static struct snd_kcontrol_new alc260_acer_mixer[] = {
4748 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 4809 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4749 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), 4810 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4750 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 4811 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4751 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 4812 { } /* end */
4752 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 4813};
4814
4815/* Maxdata Favorit 100XS: one output and one input (0x12) jack
4816 */
4817static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4818 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4819 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4820 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4821 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4822 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4823 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4753 { } /* end */ 4824 { } /* end */
4754}; 4825};
4755 4826
@@ -4767,8 +4838,6 @@ static struct snd_kcontrol_new alc260_will_mixer[] = {
4767 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 4838 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4768 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 4839 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4769 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 4840 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4770 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4771 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4772 { } /* end */ 4841 { } /* end */
4773}; 4842};
4774 4843
@@ -5126,6 +5195,89 @@ static struct hda_verb alc260_acer_init_verbs[] = {
5126 { } 5195 { }
5127}; 5196};
5128 5197
5198/* Initialisation sequence for Maxdata Favorit 100XS
5199 * (adapted from Acer init verbs).
5200 */
5201static struct hda_verb alc260_favorit100_init_verbs[] = {
5202 /* GPIO 0 enables the output jack.
5203 * Turn this on and rely on the standard mute
5204 * methods whenever the user wants to turn these outputs off.
5205 */
5206 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5207 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5208 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5209 /* Line/Mic input jack is connected to Mic1 pin */
5210 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5211 /* Ensure all other unused pins are disabled and muted. */
5212 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5213 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5214 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5215 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5216 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5217 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5222 /* Disable digital (SPDIF) pins */
5223 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5224 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5225
5226 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5227 * bus when acting as outputs.
5228 */
5229 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5230 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5231
5232 /* Start with output sum widgets muted and their output gains at min */
5233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5239 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5242
5243 /* Unmute Line-out pin widget amp left and right
5244 * (no equiv mixer ctrl)
5245 */
5246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5247 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5248 * inputs. If the pin mode is changed by the user the pin mode control
5249 * will take care of enabling the pin's input/output buffers as needed.
5250 * Therefore there's no need to enable the input buffer at this
5251 * stage.
5252 */
5253 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5254
5255 /* Mute capture amp left and right */
5256 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5257 /* Set ADC connection select to match default mixer setting - mic
5258 * (on mic1 pin)
5259 */
5260 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5261
5262 /* Do similar with the second ADC: mute capture input amp and
5263 * set ADC connection to mic to match ALSA's default state.
5264 */
5265 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5266 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5267
5268 /* Mute all inputs to mixer widget (even unconnected ones) */
5269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5277
5278 { }
5279};
5280
5129static struct hda_verb alc260_will_verbs[] = { 5281static struct hda_verb alc260_will_verbs[] = {
5130 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 5282 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5131 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, 5283 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -5272,8 +5424,6 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
5272 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), 5424 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5273 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 5425 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5274 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 5426 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5275 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5276 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5277 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), 5427 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5278 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), 5428 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5279 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), 5429 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
@@ -5471,7 +5621,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5471static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, 5621static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5472 const struct auto_pin_cfg *cfg) 5622 const struct auto_pin_cfg *cfg)
5473{ 5623{
5474 struct hda_input_mux *imux = &spec->private_imux; 5624 struct hda_input_mux *imux = &spec->private_imux[0];
5475 int i, err, idx; 5625 int i, err, idx;
5476 5626
5477 for (i = 0; i < AUTO_PIN_LAST; i++) { 5627 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -5546,11 +5696,9 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec)
5546 for (i = 0; i < AUTO_PIN_LAST; i++) { 5696 for (i = 0; i < AUTO_PIN_LAST; i++) {
5547 hda_nid_t nid = spec->autocfg.input_pins[i]; 5697 hda_nid_t nid = spec->autocfg.input_pins[i];
5548 if (nid >= 0x12) { 5698 if (nid >= 0x12) {
5549 snd_hda_codec_write(codec, nid, 0, 5699 alc_set_input_pin(codec, nid, i);
5550 AC_VERB_SET_PIN_WIDGET_CONTROL, 5700 if (nid != ALC260_PIN_CD_NID &&
5551 i <= AUTO_PIN_FRONT_MIC ? 5701 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5552 PIN_VREF80 : PIN_IN);
5553 if (nid != ALC260_PIN_CD_NID)
5554 snd_hda_codec_write(codec, nid, 0, 5702 snd_hda_codec_write(codec, nid, 0,
5555 AC_VERB_SET_AMP_GAIN_MUTE, 5703 AC_VERB_SET_AMP_GAIN_MUTE,
5556 AMP_OUT_MUTE); 5704 AMP_OUT_MUTE);
@@ -5623,7 +5771,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
5623 5771
5624 spec->multiout.max_channels = 2; 5772 spec->multiout.max_channels = 2;
5625 5773
5626 if (spec->autocfg.dig_out_pin) 5774 if (spec->autocfg.dig_outs)
5627 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; 5775 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5628 if (spec->kctls.list) 5776 if (spec->kctls.list)
5629 add_mixer(spec, spec->kctls.list); 5777 add_mixer(spec, spec->kctls.list);
@@ -5631,9 +5779,8 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
5631 add_verb(spec, alc260_volume_init_verbs); 5779 add_verb(spec, alc260_volume_init_verbs);
5632 5780
5633 spec->num_mux_defs = 1; 5781 spec->num_mux_defs = 1;
5634 spec->input_mux = &spec->private_imux; 5782 spec->input_mux = &spec->private_imux[0];
5635 5783
5636 store_pin_configs(codec);
5637 return 1; 5784 return 1;
5638} 5785}
5639 5786
@@ -5670,6 +5817,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
5670 [ALC260_ACER] = "acer", 5817 [ALC260_ACER] = "acer",
5671 [ALC260_WILL] = "will", 5818 [ALC260_WILL] = "will",
5672 [ALC260_REPLACER_672V] = "replacer", 5819 [ALC260_REPLACER_672V] = "replacer",
5820 [ALC260_FAVORIT100] = "favorit100",
5673#ifdef CONFIG_SND_DEBUG 5821#ifdef CONFIG_SND_DEBUG
5674 [ALC260_TEST] = "test", 5822 [ALC260_TEST] = "test",
5675#endif 5823#endif
@@ -5679,6 +5827,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
5679static struct snd_pci_quirk alc260_cfg_tbl[] = { 5827static struct snd_pci_quirk alc260_cfg_tbl[] = {
5680 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 5828 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5681 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 5829 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5830 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5682 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), 5831 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5683 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), 5832 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5684 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 5833 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
@@ -5701,8 +5850,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = {
5701static struct alc_config_preset alc260_presets[] = { 5850static struct alc_config_preset alc260_presets[] = {
5702 [ALC260_BASIC] = { 5851 [ALC260_BASIC] = {
5703 .mixers = { alc260_base_output_mixer, 5852 .mixers = { alc260_base_output_mixer,
5704 alc260_input_mixer, 5853 alc260_input_mixer },
5705 alc260_pc_beep_mixer },
5706 .init_verbs = { alc260_init_verbs }, 5854 .init_verbs = { alc260_init_verbs },
5707 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 5855 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5708 .dac_nids = alc260_dac_nids, 5856 .dac_nids = alc260_dac_nids,
@@ -5781,6 +5929,18 @@ static struct alc_config_preset alc260_presets[] = {
5781 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), 5929 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5782 .input_mux = alc260_acer_capture_sources, 5930 .input_mux = alc260_acer_capture_sources,
5783 }, 5931 },
5932 [ALC260_FAVORIT100] = {
5933 .mixers = { alc260_favorit100_mixer },
5934 .init_verbs = { alc260_favorit100_init_verbs },
5935 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5936 .dac_nids = alc260_dac_nids,
5937 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5938 .adc_nids = alc260_dual_adc_nids,
5939 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5940 .channel_mode = alc260_modes,
5941 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5942 .input_mux = alc260_favorit100_capture_sources,
5943 },
5784 [ALC260_WILL] = { 5944 [ALC260_WILL] = {
5785 .mixers = { alc260_will_mixer }, 5945 .mixers = { alc260_will_mixer },
5786 .init_verbs = { alc260_init_verbs, alc260_will_verbs }, 5946 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
@@ -5857,6 +6017,12 @@ static int patch_alc260(struct hda_codec *codec)
5857 } 6017 }
5858 } 6018 }
5859 6019
6020 err = snd_hda_attach_beep_device(codec, 0x1);
6021 if (err < 0) {
6022 alc_free(codec);
6023 return err;
6024 }
6025
5860 if (board_config != ALC260_AUTO) 6026 if (board_config != ALC260_AUTO)
5861 setup_preset(spec, &alc260_presets[board_config]); 6027 setup_preset(spec, &alc260_presets[board_config]);
5862 6028
@@ -5882,6 +6048,7 @@ static int patch_alc260(struct hda_codec *codec)
5882 } 6048 }
5883 } 6049 }
5884 set_capture_mixer(spec); 6050 set_capture_mixer(spec);
6051 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
5885 6052
5886 spec->vmaster_nid = 0x08; 6053 spec->vmaster_nid = 0x08;
5887 6054
@@ -6053,8 +6220,6 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {
6053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 6220 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6054 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 6221 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 6222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6056 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6057 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6058 { } /* end */ 6223 { } /* end */
6059}; 6224};
6060 6225
@@ -6081,8 +6246,6 @@ static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6247 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6248 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6084 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6085 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6086 { } /* end */ 6249 { } /* end */
6087}; 6250};
6088 6251
@@ -6134,8 +6297,6 @@ static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6298 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6299 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6137 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6138 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6139 { } /* end */ 6300 { } /* end */
6140}; 6301};
6141 6302
@@ -6244,8 +6405,10 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), 6405 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), 6406 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6246 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), 6407 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6408 /* FIXME: this looks suspicious...
6247 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), 6409 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6248 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), 6410 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6411 */
6249 { } /* end */ 6412 { } /* end */
6250}; 6413};
6251 6414
@@ -6877,19 +7040,9 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
6877 7040
6878 for (i = 0; i < AUTO_PIN_LAST; i++) { 7041 for (i = 0; i < AUTO_PIN_LAST; i++) {
6879 hda_nid_t nid = spec->autocfg.input_pins[i]; 7042 hda_nid_t nid = spec->autocfg.input_pins[i];
6880 unsigned int vref;
6881 if (!nid) 7043 if (!nid)
6882 continue; 7044 continue;
6883 vref = PIN_IN; 7045 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
6884 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6885 unsigned int pincap;
6886 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6887 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6888 AC_PINCAP_VREF_80)
6889 vref = PIN_VREF80;
6890 }
6891 snd_hda_codec_write(codec, nid, 0,
6892 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6893 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) 7046 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6894 snd_hda_codec_write(codec, nid, 0, 7047 snd_hda_codec_write(codec, nid, 0,
6895 AC_VERB_SET_AMP_GAIN_MUTE, 7048 AC_VERB_SET_AMP_GAIN_MUTE,
@@ -6900,18 +7053,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
6900static void alc882_auto_init_input_src(struct hda_codec *codec) 7053static void alc882_auto_init_input_src(struct hda_codec *codec)
6901{ 7054{
6902 struct alc_spec *spec = codec->spec; 7055 struct alc_spec *spec = codec->spec;
6903 const struct hda_input_mux *imux = spec->input_mux;
6904 int c; 7056 int c;
6905 7057
6906 for (c = 0; c < spec->num_adc_nids; c++) { 7058 for (c = 0; c < spec->num_adc_nids; c++) {
6907 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; 7059 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6908 hda_nid_t nid = spec->capsrc_nids[c]; 7060 hda_nid_t nid = spec->capsrc_nids[c];
7061 unsigned int mux_idx;
7062 const struct hda_input_mux *imux;
6909 int conns, mute, idx, item; 7063 int conns, mute, idx, item;
6910 7064
6911 conns = snd_hda_get_connections(codec, nid, conn_list, 7065 conns = snd_hda_get_connections(codec, nid, conn_list,
6912 ARRAY_SIZE(conn_list)); 7066 ARRAY_SIZE(conn_list));
6913 if (conns < 0) 7067 if (conns < 0)
6914 continue; 7068 continue;
7069 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7070 imux = &spec->input_mux[mux_idx];
6915 for (idx = 0; idx < conns; idx++) { 7071 for (idx = 0; idx < conns; idx++) {
6916 /* if the current connection is the selected one, 7072 /* if the current connection is the selected one,
6917 * unmute it as default - otherwise mute it 7073 * unmute it as default - otherwise mute it
@@ -6924,8 +7080,20 @@ static void alc882_auto_init_input_src(struct hda_codec *codec)
6924 break; 7080 break;
6925 } 7081 }
6926 } 7082 }
6927 snd_hda_codec_write(codec, nid, 0, 7083 /* check if we have a selector or mixer
6928 AC_VERB_SET_AMP_GAIN_MUTE, mute); 7084 * we could check for the widget type instead, but
7085 * just check for Amp-In presence (in case of mixer
7086 * without amp-in there is something wrong, this
7087 * function shouldn't be used or capsrc nid is wrong)
7088 */
7089 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7090 snd_hda_codec_write(codec, nid, 0,
7091 AC_VERB_SET_AMP_GAIN_MUTE,
7092 mute);
7093 else if (mute != AMP_IN_MUTE(idx))
7094 snd_hda_codec_write(codec, nid, 0,
7095 AC_VERB_SET_CONNECT_SEL,
7096 idx);
6929 } 7097 }
6930 } 7098 }
6931} 7099}
@@ -7054,6 +7222,12 @@ static int patch_alc882(struct hda_codec *codec)
7054 } 7222 }
7055 } 7223 }
7056 7224
7225 err = snd_hda_attach_beep_device(codec, 0x1);
7226 if (err < 0) {
7227 alc_free(codec);
7228 return err;
7229 }
7230
7057 if (board_config != ALC882_AUTO) 7231 if (board_config != ALC882_AUTO)
7058 setup_preset(spec, &alc882_presets[board_config]); 7232 setup_preset(spec, &alc882_presets[board_config]);
7059 7233
@@ -7074,7 +7248,7 @@ static int patch_alc882(struct hda_codec *codec)
7074 spec->stream_digital_playback = &alc882_pcm_digital_playback; 7248 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7075 spec->stream_digital_capture = &alc882_pcm_digital_capture; 7249 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7076 7250
7077 spec->is_mix_capture = 1; /* matrix-style capture */ 7251 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7078 if (!spec->adc_nids && spec->input_mux) { 7252 if (!spec->adc_nids && spec->input_mux) {
7079 /* check whether NID 0x07 is valid */ 7253 /* check whether NID 0x07 is valid */
7080 unsigned int wcap = get_wcaps(codec, 0x07); 7254 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -7091,6 +7265,7 @@ static int patch_alc882(struct hda_codec *codec)
7091 } 7265 }
7092 } 7266 }
7093 set_capture_mixer(spec); 7267 set_capture_mixer(spec);
7268 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7094 7269
7095 spec->vmaster_nid = 0x0c; 7270 spec->vmaster_nid = 0x0c;
7096 7271
@@ -7142,10 +7317,14 @@ static hda_nid_t alc883_adc_nids_rev[2] = {
7142 0x09, 0x08 7317 0x09, 0x08
7143}; 7318};
7144 7319
7320#define alc889_adc_nids alc880_adc_nids
7321
7145static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; 7322static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7146 7323
7147static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; 7324static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7148 7325
7326#define alc889_capsrc_nids alc882_capsrc_nids
7327
7149/* input MUX */ 7328/* input MUX */
7150/* FIXME: should be a matrix-type input source selection */ 7329/* FIXME: should be a matrix-type input source selection */
7151 7330
@@ -7363,8 +7542,6 @@ static struct snd_kcontrol_new alc883_base_mixer[] = {
7363 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7542 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7364 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7543 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7365 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7544 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7366 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7367 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7368 { } /* end */ 7545 { } /* end */
7369}; 7546};
7370 7547
@@ -7427,8 +7604,6 @@ static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7604 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7605 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7431 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7432 { } /* end */ 7607 { } /* end */
7433}; 7608};
7434 7609
@@ -7452,8 +7627,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7452 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7627 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7628 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7454 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7455 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7456 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7457 { } /* end */ 7630 { } /* end */
7458}; 7631};
7459 7632
@@ -7478,8 +7651,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 7651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7479 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), 7652 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 7653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7481 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7482 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7483 { } /* end */ 7654 { } /* end */
7484}; 7655};
7485 7656
@@ -7503,8 +7674,6 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 7674 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7504 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7675 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7506 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7507 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7508 { } /* end */ 7677 { } /* end */
7509}; 7678};
7510 7679
@@ -7912,36 +8081,83 @@ static struct hda_verb alc888_lenovo_sky_verbs[] = {
7912 { } /* end */ 8081 { } /* end */
7913}; 8082};
7914 8083
8084static struct hda_verb alc888_6st_dell_verbs[] = {
8085 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8086 { }
8087};
8088
8089static void alc888_3st_hp_front_automute(struct hda_codec *codec)
8090{
8091 unsigned int present, bits;
8092
8093 present = snd_hda_codec_read(codec, 0x1b, 0,
8094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8095 bits = present ? HDA_AMP_MUTE : 0;
8096 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8097 HDA_AMP_MUTE, bits);
8098 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8099 HDA_AMP_MUTE, bits);
8100 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8101 HDA_AMP_MUTE, bits);
8102}
8103
8104static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
8105 unsigned int res)
8106{
8107 switch (res >> 26) {
8108 case ALC880_HP_EVENT:
8109 alc888_3st_hp_front_automute(codec);
8110 break;
8111 }
8112}
8113
7915static struct hda_verb alc888_3st_hp_verbs[] = { 8114static struct hda_verb alc888_3st_hp_verbs[] = {
7916 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 8115 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7917 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 8116 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7918 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ 8117 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7919 { }
7920};
7921
7922static struct hda_verb alc888_6st_dell_verbs[] = {
7923 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 8118 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7924 { } 8119 { } /* end */
7925}; 8120};
7926 8121
8122/*
8123 * 2ch mode
8124 */
7927static struct hda_verb alc888_3st_hp_2ch_init[] = { 8125static struct hda_verb alc888_3st_hp_2ch_init[] = {
7928 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8126 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7929 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 8127 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7930 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 8128 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7931 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 8129 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7932 { } 8130 { } /* end */
8131};
8132
8133/*
8134 * 4ch mode
8135 */
8136static struct hda_verb alc888_3st_hp_4ch_init[] = {
8137 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8138 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8139 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8140 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8141 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8142 { } /* end */
7933}; 8143};
7934 8144
8145/*
8146 * 6ch mode
8147 */
7935static struct hda_verb alc888_3st_hp_6ch_init[] = { 8148static struct hda_verb alc888_3st_hp_6ch_init[] = {
7936 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8149 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7937 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8150 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8151 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8152 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7939 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8153 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7940 { } 8154 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8155 { } /* end */
7941}; 8156};
7942 8157
7943static struct hda_channel_mode alc888_3st_hp_modes[2] = { 8158static struct hda_channel_mode alc888_3st_hp_modes[3] = {
7944 { 2, alc888_3st_hp_2ch_init }, 8159 { 2, alc888_3st_hp_2ch_init },
8160 { 4, alc888_3st_hp_4ch_init },
7945 { 6, alc888_3st_hp_6ch_init }, 8161 { 6, alc888_3st_hp_6ch_init },
7946}; 8162};
7947 8163
@@ -8202,7 +8418,7 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8202{ 8418{
8203 switch (res >> 26) { 8419 switch (res >> 26) {
8204 case ALC880_HP_EVENT: 8420 case ALC880_HP_EVENT:
8205 printk("hp_event\n"); 8421 /* printk(KERN_DEBUG "hp_event\n"); */
8206 alc888_6st_dell_front_automute(codec); 8422 alc888_6st_dell_front_automute(codec);
8207 break; 8423 break;
8208 } 8424 }
@@ -8461,6 +8677,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8461 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), 8677 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8462 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), 8678 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8463 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), 8679 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8680 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8464 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), 8681 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8465 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), 8682 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8466 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8683 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
@@ -8468,17 +8685,21 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8468 ALC888_ACER_ASPIRE_4930G), 8685 ALC888_ACER_ASPIRE_4930G),
8469 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", 8686 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8470 ALC888_ACER_ASPIRE_4930G), 8687 ALC888_ACER_ASPIRE_4930G),
8688 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8689 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8471 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", 8690 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8472 ALC888_ACER_ASPIRE_4930G), 8691 ALC888_ACER_ASPIRE_4930G),
8473 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", 8692 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8474 ALC888_ACER_ASPIRE_4930G), 8693 ALC888_ACER_ASPIRE_4930G),
8475 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8694 /* default Acer */
8695 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8476 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8696 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8477 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 8697 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8478 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 8698 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8479 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8699 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8480 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8700 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8481 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), 8701 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8702 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8482 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8703 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8483 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8704 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8484 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), 8705 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
@@ -8518,7 +8739,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8518 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), 8739 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8519 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), 8740 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8520 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), 8741 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8521 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), 8742 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8522 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 8743 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8523 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 8744 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8524 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", 8745 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
@@ -8543,6 +8764,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8543 {} 8764 {}
8544}; 8765};
8545 8766
8767static hda_nid_t alc1200_slave_dig_outs[] = {
8768 ALC883_DIGOUT_NID, 0,
8769};
8770
8546static struct alc_config_preset alc883_presets[] = { 8771static struct alc_config_preset alc883_presets[] = {
8547 [ALC883_3ST_2ch_DIG] = { 8772 [ALC883_3ST_2ch_DIG] = {
8548 .mixers = { alc883_3ST_2ch_mixer }, 8773 .mixers = { alc883_3ST_2ch_mixer },
@@ -8778,6 +9003,8 @@ static struct alc_config_preset alc883_presets[] = {
8778 .channel_mode = alc888_3st_hp_modes, 9003 .channel_mode = alc888_3st_hp_modes,
8779 .need_dac_fix = 1, 9004 .need_dac_fix = 1,
8780 .input_mux = &alc883_capture_source, 9005 .input_mux = &alc883_capture_source,
9006 .unsol_event = alc888_3st_hp_unsol_event,
9007 .init_hook = alc888_3st_hp_front_automute,
8781 }, 9008 },
8782 [ALC888_6ST_DELL] = { 9009 [ALC888_6ST_DELL] = {
8783 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 9010 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
@@ -8883,6 +9110,7 @@ static struct alc_config_preset alc883_presets[] = {
8883 .dac_nids = alc883_dac_nids, 9110 .dac_nids = alc883_dac_nids,
8884 .dig_out_nid = ALC1200_DIGOUT_NID, 9111 .dig_out_nid = ALC1200_DIGOUT_NID,
8885 .dig_in_nid = ALC883_DIGIN_NID, 9112 .dig_in_nid = ALC883_DIGIN_NID,
9113 .slave_dig_outs = alc1200_slave_dig_outs,
8886 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9114 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8887 .channel_mode = alc883_sixstack_modes, 9115 .channel_mode = alc883_sixstack_modes,
8888 .input_mux = &alc883_capture_source, 9116 .input_mux = &alc883_capture_source,
@@ -8950,11 +9178,9 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec)
8950 for (i = 0; i < AUTO_PIN_LAST; i++) { 9178 for (i = 0; i < AUTO_PIN_LAST; i++) {
8951 hda_nid_t nid = spec->autocfg.input_pins[i]; 9179 hda_nid_t nid = spec->autocfg.input_pins[i];
8952 if (alc883_is_input_pin(nid)) { 9180 if (alc883_is_input_pin(nid)) {
8953 snd_hda_codec_write(codec, nid, 0, 9181 alc_set_input_pin(codec, nid, i);
8954 AC_VERB_SET_PIN_WIDGET_CONTROL, 9182 if (nid != ALC883_PIN_CD_NID &&
8955 (i <= AUTO_PIN_FRONT_MIC ? 9183 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
8956 PIN_VREF80 : PIN_IN));
8957 if (nid != ALC883_PIN_CD_NID)
8958 snd_hda_codec_write(codec, nid, 0, 9184 snd_hda_codec_write(codec, nid, 0,
8959 AC_VERB_SET_AMP_GAIN_MUTE, 9185 AC_VERB_SET_AMP_GAIN_MUTE,
8960 AMP_OUT_MUTE); 9186 AMP_OUT_MUTE);
@@ -8969,6 +9195,8 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
8969{ 9195{
8970 struct alc_spec *spec = codec->spec; 9196 struct alc_spec *spec = codec->spec;
8971 int err = alc880_parse_auto_config(codec); 9197 int err = alc880_parse_auto_config(codec);
9198 struct auto_pin_cfg *cfg = &spec->autocfg;
9199 int i;
8972 9200
8973 if (err < 0) 9201 if (err < 0)
8974 return err; 9202 return err;
@@ -8982,6 +9210,26 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
8982 /* hack - override the init verbs */ 9210 /* hack - override the init verbs */
8983 spec->init_verbs[0] = alc883_auto_init_verbs; 9211 spec->init_verbs[0] = alc883_auto_init_verbs;
8984 9212
9213 /* setup input_mux for ALC889 */
9214 if (codec->vendor_id == 0x10ec0889) {
9215 /* digital-mic input pin is excluded in alc880_auto_create..()
9216 * because it's under 0x18
9217 */
9218 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9219 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9220 struct hda_input_mux *imux = &spec->private_imux[0];
9221 for (i = 1; i < 3; i++)
9222 memcpy(&spec->private_imux[i],
9223 &spec->private_imux[0],
9224 sizeof(spec->private_imux[0]));
9225 imux->items[imux->num_items].label = "Int DMic";
9226 imux->items[imux->num_items].index = 0x0b;
9227 imux->num_items++;
9228 spec->num_mux_defs = 3;
9229 spec->input_mux = spec->private_imux;
9230 }
9231 }
9232
8985 return 1; /* config found */ 9233 return 1; /* config found */
8986} 9234}
8987 9235
@@ -9033,6 +9281,12 @@ static int patch_alc883(struct hda_codec *codec)
9033 } 9281 }
9034 } 9282 }
9035 9283
9284 err = snd_hda_attach_beep_device(codec, 0x1);
9285 if (err < 0) {
9286 alc_free(codec);
9287 return err;
9288 }
9289
9036 if (board_config != ALC883_AUTO) 9290 if (board_config != ALC883_AUTO)
9037 setup_preset(spec, &alc883_presets[board_config]); 9291 setup_preset(spec, &alc883_presets[board_config]);
9038 9292
@@ -9045,14 +9299,36 @@ static int patch_alc883(struct hda_codec *codec)
9045 spec->stream_name_analog = "ALC888 Analog"; 9299 spec->stream_name_analog = "ALC888 Analog";
9046 spec->stream_name_digital = "ALC888 Digital"; 9300 spec->stream_name_digital = "ALC888 Digital";
9047 } 9301 }
9302 if (!spec->num_adc_nids) {
9303 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9304 spec->adc_nids = alc883_adc_nids;
9305 }
9306 if (!spec->capsrc_nids)
9307 spec->capsrc_nids = alc883_capsrc_nids;
9308 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9048 break; 9309 break;
9049 case 0x10ec0889: 9310 case 0x10ec0889:
9050 spec->stream_name_analog = "ALC889 Analog"; 9311 spec->stream_name_analog = "ALC889 Analog";
9051 spec->stream_name_digital = "ALC889 Digital"; 9312 spec->stream_name_digital = "ALC889 Digital";
9313 if (!spec->num_adc_nids) {
9314 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9315 spec->adc_nids = alc889_adc_nids;
9316 }
9317 if (!spec->capsrc_nids)
9318 spec->capsrc_nids = alc889_capsrc_nids;
9319 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9320 capture */
9052 break; 9321 break;
9053 default: 9322 default:
9054 spec->stream_name_analog = "ALC883 Analog"; 9323 spec->stream_name_analog = "ALC883 Analog";
9055 spec->stream_name_digital = "ALC883 Digital"; 9324 spec->stream_name_digital = "ALC883 Digital";
9325 if (!spec->num_adc_nids) {
9326 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9327 spec->adc_nids = alc883_adc_nids;
9328 }
9329 if (!spec->capsrc_nids)
9330 spec->capsrc_nids = alc883_capsrc_nids;
9331 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9056 break; 9332 break;
9057 } 9333 }
9058 9334
@@ -9063,15 +9339,9 @@ static int patch_alc883(struct hda_codec *codec)
9063 spec->stream_digital_playback = &alc883_pcm_digital_playback; 9339 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9064 spec->stream_digital_capture = &alc883_pcm_digital_capture; 9340 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9065 9341
9066 if (!spec->num_adc_nids) {
9067 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9068 spec->adc_nids = alc883_adc_nids;
9069 }
9070 if (!spec->capsrc_nids)
9071 spec->capsrc_nids = alc883_capsrc_nids;
9072 spec->is_mix_capture = 1; /* matrix-style capture */
9073 if (!spec->cap_mixer) 9342 if (!spec->cap_mixer)
9074 set_capture_mixer(spec); 9343 set_capture_mixer(spec);
9344 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9075 9345
9076 spec->vmaster_nid = 0x0c; 9346 spec->vmaster_nid = 0x0c;
9077 9347
@@ -9124,8 +9394,6 @@ static struct snd_kcontrol_new alc262_base_mixer[] = {
9124 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 9394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 9395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9126 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 9396 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9127 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9128 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), 9397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9131 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 9399 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
@@ -9146,8 +9414,6 @@ static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 9414 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 9415 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9148 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 9416 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9149 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9150 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9151 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ 9417 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9153 { } /* end */ 9419 { } /* end */
@@ -9256,8 +9522,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9256 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 9522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 9523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 9524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9259 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9260 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9261 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), 9525 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9262 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), 9526 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9263 { } /* end */ 9527 { } /* end */
@@ -9286,8 +9550,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), 9550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9287 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 9551 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9288 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 9552 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9289 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9290 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9291 { } /* end */ 9553 { } /* end */
9292}; 9554};
9293 9555
@@ -9435,6 +9697,67 @@ static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9435 { } /* end */ 9697 { } /* end */
9436}; 9698};
9437 9699
9700static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9701 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9702 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9703 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9704 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9709 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9710 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9712 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9713 { } /* end */
9714};
9715
9716static struct hda_verb alc262_tyan_verbs[] = {
9717 /* Headphone automute */
9718 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9719 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9720 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9721
9722 /* P11 AUX_IN, white 4-pin connector */
9723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9724 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9725 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9726 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9727
9728 {}
9729};
9730
9731/* unsolicited event for HP jack sensing */
9732static void alc262_tyan_automute(struct hda_codec *codec)
9733{
9734 unsigned int mute;
9735 unsigned int present;
9736
9737 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9738 present = snd_hda_codec_read(codec, 0x1b, 0,
9739 AC_VERB_GET_PIN_SENSE, 0);
9740 present = (present & 0x80000000) != 0;
9741 if (present) {
9742 /* mute line output on ATX panel */
9743 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9744 HDA_AMP_MUTE, HDA_AMP_MUTE);
9745 } else {
9746 /* unmute line output if necessary */
9747 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9748 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9749 HDA_AMP_MUTE, mute);
9750 }
9751}
9752
9753static void alc262_tyan_unsol_event(struct hda_codec *codec,
9754 unsigned int res)
9755{
9756 if ((res >> 26) != ALC880_HP_EVENT)
9757 return;
9758 alc262_tyan_automute(codec);
9759}
9760
9438#define alc262_capture_mixer alc882_capture_mixer 9761#define alc262_capture_mixer alc882_capture_mixer
9439#define alc262_capture_alt_mixer alc882_capture_alt_mixer 9762#define alc262_capture_alt_mixer alc882_capture_alt_mixer
9440 9763
@@ -9901,8 +10224,6 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9901 }, 10224 },
9902 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 10225 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9903 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 10226 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9904 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9905 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9906 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 10227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 10228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 10229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
@@ -10474,8 +10795,14 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10474 alc262_ignore); 10795 alc262_ignore);
10475 if (err < 0) 10796 if (err < 0)
10476 return err; 10797 return err;
10477 if (!spec->autocfg.line_outs) 10798 if (!spec->autocfg.line_outs) {
10799 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10800 spec->multiout.max_channels = 2;
10801 spec->no_analog = 1;
10802 goto dig_only;
10803 }
10478 return 0; /* can't find valid BIOS pin config */ 10804 return 0; /* can't find valid BIOS pin config */
10805 }
10479 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); 10806 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10480 if (err < 0) 10807 if (err < 0)
10481 return err; 10808 return err;
@@ -10485,8 +10812,11 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10485 10812
10486 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 10813 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10487 10814
10488 if (spec->autocfg.dig_out_pin) 10815 dig_only:
10816 if (spec->autocfg.dig_outs) {
10489 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; 10817 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10818 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10819 }
10490 if (spec->autocfg.dig_in_pin) 10820 if (spec->autocfg.dig_in_pin)
10491 spec->dig_in_nid = ALC262_DIGIN_NID; 10821 spec->dig_in_nid = ALC262_DIGIN_NID;
10492 10822
@@ -10495,13 +10825,12 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10495 10825
10496 add_verb(spec, alc262_volume_init_verbs); 10826 add_verb(spec, alc262_volume_init_verbs);
10497 spec->num_mux_defs = 1; 10827 spec->num_mux_defs = 1;
10498 spec->input_mux = &spec->private_imux; 10828 spec->input_mux = &spec->private_imux[0];
10499 10829
10500 err = alc_auto_add_mic_boost(codec); 10830 err = alc_auto_add_mic_boost(codec);
10501 if (err < 0) 10831 if (err < 0)
10502 return err; 10832 return err;
10503 10833
10504 store_pin_configs(codec);
10505 return 1; 10834 return 1;
10506} 10835}
10507 10836
@@ -10543,21 +10872,19 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
10543 [ALC262_ULTRA] = "ultra", 10872 [ALC262_ULTRA] = "ultra",
10544 [ALC262_LENOVO_3000] = "lenovo-3000", 10873 [ALC262_LENOVO_3000] = "lenovo-3000",
10545 [ALC262_NEC] = "nec", 10874 [ALC262_NEC] = "nec",
10875 [ALC262_TYAN] = "tyan",
10546 [ALC262_AUTO] = "auto", 10876 [ALC262_AUTO] = "auto",
10547}; 10877};
10548 10878
10549static struct snd_pci_quirk alc262_cfg_tbl[] = { 10879static struct snd_pci_quirk alc262_cfg_tbl[] = {
10550 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 10880 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10551 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), 10881 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10552 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), 10882 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10553 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), 10883 ALC262_HP_BPC),
10554 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), 10884 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10555 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), 10885 ALC262_HP_BPC),
10556 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), 10886 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10557 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), 10887 ALC262_HP_BPC),
10558 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10559 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10560 SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC),
10561 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 10888 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10562 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), 10889 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10563 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), 10890 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
@@ -10575,17 +10902,17 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10575 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10902 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10576 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), 10903 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10577 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10904 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10578 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10905 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10579 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 10906 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10580 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", 10907 ALC262_SONY_ASSAMD),
10581 ALC262_SONY_ASSAMD),
10582 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 10908 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10583 ALC262_TOSHIBA_RX1), 10909 ALC262_TOSHIBA_RX1),
10584 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), 10910 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10585 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 10911 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10586 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10912 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10587 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10913 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10588 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10914 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10915 ALC262_ULTRA),
10589 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), 10916 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10590 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10917 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10591 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 10918 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
@@ -10802,6 +11129,19 @@ static struct alc_config_preset alc262_presets[] = {
10802 .unsol_event = alc262_hippo_unsol_event, 11129 .unsol_event = alc262_hippo_unsol_event,
10803 .init_hook = alc262_hippo_automute, 11130 .init_hook = alc262_hippo_automute,
10804 }, 11131 },
11132 [ALC262_TYAN] = {
11133 .mixers = { alc262_tyan_mixer },
11134 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11135 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11136 .dac_nids = alc262_dac_nids,
11137 .hp_nid = 0x02,
11138 .dig_out_nid = ALC262_DIGOUT_NID,
11139 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11140 .channel_mode = alc262_modes,
11141 .input_mux = &alc262_capture_source,
11142 .unsol_event = alc262_tyan_unsol_event,
11143 .init_hook = alc262_tyan_automute,
11144 },
10805}; 11145};
10806 11146
10807static int patch_alc262(struct hda_codec *codec) 11147static int patch_alc262(struct hda_codec *codec)
@@ -10854,6 +11194,14 @@ static int patch_alc262(struct hda_codec *codec)
10854 } 11194 }
10855 } 11195 }
10856 11196
11197 if (!spec->no_analog) {
11198 err = snd_hda_attach_beep_device(codec, 0x1);
11199 if (err < 0) {
11200 alc_free(codec);
11201 return err;
11202 }
11203 }
11204
10857 if (board_config != ALC262_AUTO) 11205 if (board_config != ALC262_AUTO)
10858 setup_preset(spec, &alc262_presets[board_config]); 11206 setup_preset(spec, &alc262_presets[board_config]);
10859 11207
@@ -10865,7 +11213,7 @@ static int patch_alc262(struct hda_codec *codec)
10865 spec->stream_digital_playback = &alc262_pcm_digital_playback; 11213 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10866 spec->stream_digital_capture = &alc262_pcm_digital_capture; 11214 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10867 11215
10868 spec->is_mix_capture = 1; 11216 spec->capture_style = CAPT_MIX;
10869 if (!spec->adc_nids && spec->input_mux) { 11217 if (!spec->adc_nids && spec->input_mux) {
10870 /* check whether NID 0x07 is valid */ 11218 /* check whether NID 0x07 is valid */
10871 unsigned int wcap = get_wcaps(codec, 0x07); 11219 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -10882,8 +11230,10 @@ static int patch_alc262(struct hda_codec *codec)
10882 spec->capsrc_nids = alc262_capsrc_nids; 11230 spec->capsrc_nids = alc262_capsrc_nids;
10883 } 11231 }
10884 } 11232 }
10885 if (!spec->cap_mixer) 11233 if (!spec->cap_mixer && !spec->no_analog)
10886 set_capture_mixer(spec); 11234 set_capture_mixer(spec);
11235 if (!spec->no_analog)
11236 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10887 11237
10888 spec->vmaster_nid = 0x0c; 11238 spec->vmaster_nid = 0x0c;
10889 11239
@@ -11263,19 +11613,13 @@ static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11263static struct hda_verb alc268_base_init_verbs[] = { 11613static struct hda_verb alc268_base_init_verbs[] = {
11264 /* Unmute DAC0-1 and set vol = 0 */ 11614 /* Unmute DAC0-1 and set vol = 0 */
11265 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 11615 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11266 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11267 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11268 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 11616 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11269 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11270 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11271 11617
11272 /* 11618 /*
11273 * Set up output mixers (0x0c - 0x0e) 11619 * Set up output mixers (0x0c - 0x0e)
11274 */ 11620 */
11275 /* set vol=0 to output mixers */ 11621 /* set vol=0 to output mixers */
11276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11279 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, 11623 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11280 11624
11281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11625 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -11294,9 +11638,7 @@ static struct hda_verb alc268_base_init_verbs[] = {
11294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11295 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11639 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11296 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11640 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11299 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11300 11642
11301 /* set PCBEEP vol = 0, mute connections */ 11643 /* set PCBEEP vol = 0, mute connections */
11302 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11644 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -11318,10 +11660,8 @@ static struct hda_verb alc268_base_init_verbs[] = {
11318 */ 11660 */
11319static struct hda_verb alc268_volume_init_verbs[] = { 11661static struct hda_verb alc268_volume_init_verbs[] = {
11320 /* set output DAC */ 11662 /* set output DAC */
11321 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11663 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11322 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11664 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11323 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11324 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11325 11665
11326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 11666 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11327 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 11667 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
@@ -11329,16 +11669,12 @@ static struct hda_verb alc268_volume_init_verbs[] = {
11329 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 11669 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11330 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 11670 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11331 11671
11332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11672 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11336 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11674 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11337 11675
11338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11339 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11340 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11341 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11342 11678
11343 /* set PCBEEP vol = 0, mute connections */ 11679 /* set PCBEEP vol = 0, mute connections */
11344 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 11680 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -11537,7 +11873,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11537static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, 11873static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11538 const struct auto_pin_cfg *cfg) 11874 const struct auto_pin_cfg *cfg)
11539{ 11875{
11540 struct hda_input_mux *imux = &spec->private_imux; 11876 struct hda_input_mux *imux = &spec->private_imux[0];
11541 int i, idx1; 11877 int i, idx1;
11542 11878
11543 for (i = 0; i < AUTO_PIN_LAST; i++) { 11879 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -11631,9 +11967,14 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
11631 alc268_ignore); 11967 alc268_ignore);
11632 if (err < 0) 11968 if (err < 0)
11633 return err; 11969 return err;
11634 if (!spec->autocfg.line_outs) 11970 if (!spec->autocfg.line_outs) {
11971 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11972 spec->multiout.max_channels = 2;
11973 spec->no_analog = 1;
11974 goto dig_only;
11975 }
11635 return 0; /* can't find valid BIOS pin config */ 11976 return 0; /* can't find valid BIOS pin config */
11636 11977 }
11637 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); 11978 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11638 if (err < 0) 11979 if (err < 0)
11639 return err; 11980 return err;
@@ -11643,25 +11984,26 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
11643 11984
11644 spec->multiout.max_channels = 2; 11985 spec->multiout.max_channels = 2;
11645 11986
11987 dig_only:
11646 /* digital only support output */ 11988 /* digital only support output */
11647 if (spec->autocfg.dig_out_pin) 11989 if (spec->autocfg.dig_outs) {
11648 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; 11990 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11649 11991 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11992 }
11650 if (spec->kctls.list) 11993 if (spec->kctls.list)
11651 add_mixer(spec, spec->kctls.list); 11994 add_mixer(spec, spec->kctls.list);
11652 11995
11653 if (spec->autocfg.speaker_pins[0] != 0x1d) 11996 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
11654 add_mixer(spec, alc268_beep_mixer); 11997 add_mixer(spec, alc268_beep_mixer);
11655 11998
11656 add_verb(spec, alc268_volume_init_verbs); 11999 add_verb(spec, alc268_volume_init_verbs);
11657 spec->num_mux_defs = 1; 12000 spec->num_mux_defs = 1;
11658 spec->input_mux = &spec->private_imux; 12001 spec->input_mux = &spec->private_imux[0];
11659 12002
11660 err = alc_auto_add_mic_boost(codec); 12003 err = alc_auto_add_mic_boost(codec);
11661 if (err < 0) 12004 if (err < 0)
11662 return err; 12005 return err;
11663 12006
11664 store_pin_configs(codec);
11665 return 1; 12007 return 1;
11666} 12008}
11667 12009
@@ -11723,7 +12065,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
11723 12065
11724static struct alc_config_preset alc268_presets[] = { 12066static struct alc_config_preset alc268_presets[] = {
11725 [ALC267_QUANTA_IL1] = { 12067 [ALC267_QUANTA_IL1] = {
11726 .mixers = { alc267_quanta_il1_mixer }, 12068 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11727 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 12069 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11728 alc267_quanta_il1_verbs }, 12070 alc267_quanta_il1_verbs },
11729 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 12071 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -11805,7 +12147,8 @@ static struct alc_config_preset alc268_presets[] = {
11805 }, 12147 },
11806 [ALC268_ACER_ASPIRE_ONE] = { 12148 [ALC268_ACER_ASPIRE_ONE] = {
11807 .mixers = { alc268_acer_aspire_one_mixer, 12149 .mixers = { alc268_acer_aspire_one_mixer,
11808 alc268_capture_alt_mixer }, 12150 alc268_beep_mixer,
12151 alc268_capture_alt_mixer },
11809 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 12152 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11810 alc268_acer_aspire_one_verbs }, 12153 alc268_acer_aspire_one_verbs },
11811 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 12154 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -11874,7 +12217,7 @@ static int patch_alc268(struct hda_codec *codec)
11874{ 12217{
11875 struct alc_spec *spec; 12218 struct alc_spec *spec;
11876 int board_config; 12219 int board_config;
11877 int err; 12220 int i, has_beep, err;
11878 12221
11879 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 12222 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11880 if (spec == NULL) 12223 if (spec == NULL)
@@ -11923,15 +12266,30 @@ static int patch_alc268(struct hda_codec *codec)
11923 12266
11924 spec->stream_digital_playback = &alc268_pcm_digital_playback; 12267 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11925 12268
11926 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) 12269 has_beep = 0;
11927 /* override the amp caps for beep generator */ 12270 for (i = 0; i < spec->num_mixers; i++) {
11928 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, 12271 if (spec->mixers[i] == alc268_beep_mixer) {
12272 has_beep = 1;
12273 break;
12274 }
12275 }
12276
12277 if (has_beep) {
12278 err = snd_hda_attach_beep_device(codec, 0x1);
12279 if (err < 0) {
12280 alc_free(codec);
12281 return err;
12282 }
12283 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12284 /* override the amp caps for beep generator */
12285 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11929 (0x0c << AC_AMPCAP_OFFSET_SHIFT) | 12286 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11930 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | 12287 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11931 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | 12288 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11932 (0 << AC_AMPCAP_MUTE_SHIFT)); 12289 (0 << AC_AMPCAP_MUTE_SHIFT));
12290 }
11933 12291
11934 if (!spec->adc_nids && spec->input_mux) { 12292 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
11935 /* check whether NID 0x07 is valid */ 12293 /* check whether NID 0x07 is valid */
11936 unsigned int wcap = get_wcaps(codec, 0x07); 12294 unsigned int wcap = get_wcaps(codec, 0x07);
11937 int i; 12295 int i;
@@ -12012,8 +12370,6 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
12012 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 12370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 12371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 12372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12015 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12016 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 12373 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12018 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 12374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12019 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 12375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
@@ -12040,8 +12396,6 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12040 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 12396 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12041 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 12397 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12042 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), 12398 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12043 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12044 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12045 { } 12399 { }
12046}; 12400};
12047 12401
@@ -12065,8 +12419,6 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12065 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), 12419 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12066 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), 12420 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12067 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), 12421 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12068 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12069 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12070 { } 12422 { }
12071}; 12423};
12072 12424
@@ -12103,13 +12455,6 @@ static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12103 { } /* end */ 12455 { } /* end */
12104}; 12456};
12105 12457
12106/* beep control */
12107static struct snd_kcontrol_new alc269_beep_mixer[] = {
12108 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12109 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12110 { } /* end */
12111};
12112
12113static struct hda_verb alc269_quanta_fl1_verbs[] = { 12458static struct hda_verb alc269_quanta_fl1_verbs[] = {
12114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 12459 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12115 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 12460 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -12509,7 +12854,7 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12509 */ 12854 */
12510 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || 12855 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12511 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { 12856 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12512 struct hda_input_mux *imux = &spec->private_imux; 12857 struct hda_input_mux *imux = &spec->private_imux[0];
12513 imux->items[imux->num_items].label = "Int Mic"; 12858 imux->items[imux->num_items].label = "Int Mic";
12514 imux->items[imux->num_items].index = 0x05; 12859 imux->items[imux->num_items].index = 0x05;
12515 imux->num_items++; 12860 imux->num_items++;
@@ -12527,13 +12872,34 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12527#define alc269_pcm_digital_playback alc880_pcm_digital_playback 12872#define alc269_pcm_digital_playback alc880_pcm_digital_playback
12528#define alc269_pcm_digital_capture alc880_pcm_digital_capture 12873#define alc269_pcm_digital_capture alc880_pcm_digital_capture
12529 12874
12875static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12876 .substreams = 1,
12877 .channels_min = 2,
12878 .channels_max = 8,
12879 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12880 /* NID is set in alc_build_pcms */
12881 .ops = {
12882 .open = alc880_playback_pcm_open,
12883 .prepare = alc880_playback_pcm_prepare,
12884 .cleanup = alc880_playback_pcm_cleanup
12885 },
12886};
12887
12888static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12889 .substreams = 1,
12890 .channels_min = 2,
12891 .channels_max = 2,
12892 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12893 /* NID is set in alc_build_pcms */
12894};
12895
12530/* 12896/*
12531 * BIOS auto configuration 12897 * BIOS auto configuration
12532 */ 12898 */
12533static int alc269_parse_auto_config(struct hda_codec *codec) 12899static int alc269_parse_auto_config(struct hda_codec *codec)
12534{ 12900{
12535 struct alc_spec *spec = codec->spec; 12901 struct alc_spec *spec = codec->spec;
12536 int i, err; 12902 int err;
12537 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 12903 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12538 12904
12539 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 12905 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -12550,22 +12916,15 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
12550 12916
12551 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 12917 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12552 12918
12553 if (spec->autocfg.dig_out_pin) 12919 if (spec->autocfg.dig_outs)
12554 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; 12920 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12555 12921
12556 if (spec->kctls.list) 12922 if (spec->kctls.list)
12557 add_mixer(spec, spec->kctls.list); 12923 add_mixer(spec, spec->kctls.list);
12558 12924
12559 /* create a beep mixer control if the pin 0x1d isn't assigned */
12560 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12561 if (spec->autocfg.input_pins[i] == 0x1d)
12562 break;
12563 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12564 add_mixer(spec, alc269_beep_mixer);
12565
12566 add_verb(spec, alc269_init_verbs); 12925 add_verb(spec, alc269_init_verbs);
12567 spec->num_mux_defs = 1; 12926 spec->num_mux_defs = 1;
12568 spec->input_mux = &spec->private_imux; 12927 spec->input_mux = &spec->private_imux[0];
12569 /* set default input source */ 12928 /* set default input source */
12570 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], 12929 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12571 0, AC_VERB_SET_CONNECT_SEL, 12930 0, AC_VERB_SET_CONNECT_SEL,
@@ -12575,10 +12934,9 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
12575 if (err < 0) 12934 if (err < 0)
12576 return err; 12935 return err;
12577 12936
12578 if (!spec->cap_mixer) 12937 if (!spec->cap_mixer && !spec->no_analog)
12579 set_capture_mixer(spec); 12938 set_capture_mixer(spec);
12580 12939
12581 store_pin_configs(codec);
12582 return 1; 12940 return 1;
12583} 12941}
12584 12942
@@ -12675,7 +13033,7 @@ static struct alc_config_preset alc269_presets[] = {
12675 .init_hook = alc269_eeepc_dmic_inithook, 13033 .init_hook = alc269_eeepc_dmic_inithook,
12676 }, 13034 },
12677 [ALC269_FUJITSU] = { 13035 [ALC269_FUJITSU] = {
12678 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, 13036 .mixers = { alc269_fujitsu_mixer },
12679 .cap_mixer = alc269_epc_capture_mixer, 13037 .cap_mixer = alc269_epc_capture_mixer,
12680 .init_verbs = { alc269_init_verbs, 13038 .init_verbs = { alc269_init_verbs,
12681 alc269_eeepc_dmic_init_verbs }, 13039 alc269_eeepc_dmic_init_verbs },
@@ -12740,13 +13098,26 @@ static int patch_alc269(struct hda_codec *codec)
12740 } 13098 }
12741 } 13099 }
12742 13100
13101 err = snd_hda_attach_beep_device(codec, 0x1);
13102 if (err < 0) {
13103 alc_free(codec);
13104 return err;
13105 }
13106
12743 if (board_config != ALC269_AUTO) 13107 if (board_config != ALC269_AUTO)
12744 setup_preset(spec, &alc269_presets[board_config]); 13108 setup_preset(spec, &alc269_presets[board_config]);
12745 13109
12746 spec->stream_name_analog = "ALC269 Analog"; 13110 spec->stream_name_analog = "ALC269 Analog";
12747 spec->stream_analog_playback = &alc269_pcm_analog_playback; 13111 if (codec->subsystem_id == 0x17aa3bf8) {
12748 spec->stream_analog_capture = &alc269_pcm_analog_capture; 13112 /* Due to a hardware problem on Lenovo Ideadpad, we need to
12749 13113 * fix the sample rate of analog I/O to 44.1kHz
13114 */
13115 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13116 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13117 } else {
13118 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13119 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13120 }
12750 spec->stream_name_digital = "ALC269 Digital"; 13121 spec->stream_name_digital = "ALC269 Digital";
12751 spec->stream_digital_playback = &alc269_pcm_digital_playback; 13122 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12752 spec->stream_digital_capture = &alc269_pcm_digital_capture; 13123 spec->stream_digital_capture = &alc269_pcm_digital_capture;
@@ -12756,6 +13127,7 @@ static int patch_alc269(struct hda_codec *codec)
12756 spec->capsrc_nids = alc269_capsrc_nids; 13127 spec->capsrc_nids = alc269_capsrc_nids;
12757 if (!spec->cap_mixer) 13128 if (!spec->cap_mixer)
12758 set_capture_mixer(spec); 13129 set_capture_mixer(spec);
13130 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12759 13131
12760 codec->patch_ops = alc_patch_ops; 13132 codec->patch_ops = alc_patch_ops;
12761 if (board_config == ALC269_AUTO) 13133 if (board_config == ALC269_AUTO)
@@ -13006,8 +13378,6 @@ static struct snd_kcontrol_new alc861_asus_mixer[] = {
13006static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { 13378static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13007 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 13379 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13008 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 13380 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13009 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
13010 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13011 { } 13381 { }
13012}; 13382};
13013 13383
@@ -13481,7 +13851,7 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13481static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, 13851static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13482 const struct auto_pin_cfg *cfg) 13852 const struct auto_pin_cfg *cfg)
13483{ 13853{
13484 struct hda_input_mux *imux = &spec->private_imux; 13854 struct hda_input_mux *imux = &spec->private_imux[0];
13485 int i, err, idx, idx1; 13855 int i, err, idx, idx1;
13486 13856
13487 for (i = 0; i < AUTO_PIN_LAST; i++) { 13857 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -13568,12 +13938,8 @@ static void alc861_auto_init_analog_input(struct hda_codec *codec)
13568 13938
13569 for (i = 0; i < AUTO_PIN_LAST; i++) { 13939 for (i = 0; i < AUTO_PIN_LAST; i++) {
13570 hda_nid_t nid = spec->autocfg.input_pins[i]; 13940 hda_nid_t nid = spec->autocfg.input_pins[i];
13571 if (nid >= 0x0c && nid <= 0x11) { 13941 if (nid >= 0x0c && nid <= 0x11)
13572 snd_hda_codec_write(codec, nid, 0, 13942 alc_set_input_pin(codec, nid, i);
13573 AC_VERB_SET_PIN_WIDGET_CONTROL,
13574 i <= AUTO_PIN_FRONT_MIC ?
13575 PIN_VREF80 : PIN_IN);
13576 }
13577 } 13943 }
13578} 13944}
13579 13945
@@ -13609,7 +13975,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
13609 13975
13610 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 13976 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13611 13977
13612 if (spec->autocfg.dig_out_pin) 13978 if (spec->autocfg.dig_outs)
13613 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; 13979 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13614 13980
13615 if (spec->kctls.list) 13981 if (spec->kctls.list)
@@ -13618,13 +13984,12 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
13618 add_verb(spec, alc861_auto_init_verbs); 13984 add_verb(spec, alc861_auto_init_verbs);
13619 13985
13620 spec->num_mux_defs = 1; 13986 spec->num_mux_defs = 1;
13621 spec->input_mux = &spec->private_imux; 13987 spec->input_mux = &spec->private_imux[0];
13622 13988
13623 spec->adc_nids = alc861_adc_nids; 13989 spec->adc_nids = alc861_adc_nids;
13624 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 13990 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13625 set_capture_mixer(spec); 13991 set_capture_mixer(spec);
13626 13992
13627 store_pin_configs(codec);
13628 return 1; 13993 return 1;
13629} 13994}
13630 13995
@@ -13833,6 +14198,12 @@ static int patch_alc861(struct hda_codec *codec)
13833 } 14198 }
13834 } 14199 }
13835 14200
14201 err = snd_hda_attach_beep_device(codec, 0x23);
14202 if (err < 0) {
14203 alc_free(codec);
14204 return err;
14205 }
14206
13836 if (board_config != ALC861_AUTO) 14207 if (board_config != ALC861_AUTO)
13837 setup_preset(spec, &alc861_presets[board_config]); 14208 setup_preset(spec, &alc861_presets[board_config]);
13838 14209
@@ -13844,6 +14215,8 @@ static int patch_alc861(struct hda_codec *codec)
13844 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14215 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13845 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14216 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13846 14217
14218 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14219
13847 spec->vmaster_nid = 0x03; 14220 spec->vmaster_nid = 0x03;
13848 14221
13849 codec->patch_ops = alc_patch_ops; 14222 codec->patch_ops = alc_patch_ops;
@@ -14000,9 +14373,6 @@ static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14000 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 14373 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14001 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 14374 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14002 14375
14003 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14004 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14005
14006 { } /* end */ 14376 { } /* end */
14007}; 14377};
14008 14378
@@ -14026,9 +14396,6 @@ static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14026 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 14396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14027 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 14397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14028 14398
14029 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14030 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14031
14032 { } /* end */ 14399 { } /* end */
14033}; 14400};
14034 14401
@@ -14067,8 +14434,6 @@ static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14067 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), 14434 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14068 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 14435 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14069 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 14436 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14070 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14071 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14072 { } /* end */ 14437 { } /* end */
14073}; 14438};
14074 14439
@@ -14379,9 +14744,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14379 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), 14744 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14380 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), 14745 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14381 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), 14746 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14382 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), 14747 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14383 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14384 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14385 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), 14748 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14386 {} 14749 {}
14387}; 14750};
@@ -14543,11 +14906,9 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14543 for (i = 0; i < AUTO_PIN_LAST; i++) { 14906 for (i = 0; i < AUTO_PIN_LAST; i++) {
14544 hda_nid_t nid = spec->autocfg.input_pins[i]; 14907 hda_nid_t nid = spec->autocfg.input_pins[i];
14545 if (alc861vd_is_input_pin(nid)) { 14908 if (alc861vd_is_input_pin(nid)) {
14546 snd_hda_codec_write(codec, nid, 0, 14909 alc_set_input_pin(codec, nid, i);
14547 AC_VERB_SET_PIN_WIDGET_CONTROL, 14910 if (nid != ALC861VD_PIN_CD_NID &&
14548 i <= AUTO_PIN_FRONT_MIC ? 14911 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14549 PIN_VREF80 : PIN_IN);
14550 if (nid != ALC861VD_PIN_CD_NID)
14551 snd_hda_codec_write(codec, nid, 0, 14912 snd_hda_codec_write(codec, nid, 0,
14552 AC_VERB_SET_AMP_GAIN_MUTE, 14913 AC_VERB_SET_AMP_GAIN_MUTE,
14553 AMP_OUT_MUTE); 14914 AMP_OUT_MUTE);
@@ -14713,7 +15074,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
14713 15074
14714 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 15075 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14715 15076
14716 if (spec->autocfg.dig_out_pin) 15077 if (spec->autocfg.dig_outs)
14717 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; 15078 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14718 15079
14719 if (spec->kctls.list) 15080 if (spec->kctls.list)
@@ -14722,13 +15083,12 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
14722 add_verb(spec, alc861vd_volume_init_verbs); 15083 add_verb(spec, alc861vd_volume_init_verbs);
14723 15084
14724 spec->num_mux_defs = 1; 15085 spec->num_mux_defs = 1;
14725 spec->input_mux = &spec->private_imux; 15086 spec->input_mux = &spec->private_imux[0];
14726 15087
14727 err = alc_auto_add_mic_boost(codec); 15088 err = alc_auto_add_mic_boost(codec);
14728 if (err < 0) 15089 if (err < 0)
14729 return err; 15090 return err;
14730 15091
14731 store_pin_configs(codec);
14732 return 1; 15092 return 1;
14733} 15093}
14734 15094
@@ -14779,6 +15139,12 @@ static int patch_alc861vd(struct hda_codec *codec)
14779 } 15139 }
14780 } 15140 }
14781 15141
15142 err = snd_hda_attach_beep_device(codec, 0x23);
15143 if (err < 0) {
15144 alc_free(codec);
15145 return err;
15146 }
15147
14782 if (board_config != ALC861VD_AUTO) 15148 if (board_config != ALC861VD_AUTO)
14783 setup_preset(spec, &alc861vd_presets[board_config]); 15149 setup_preset(spec, &alc861vd_presets[board_config]);
14784 15150
@@ -14801,9 +15167,10 @@ static int patch_alc861vd(struct hda_codec *codec)
14801 spec->adc_nids = alc861vd_adc_nids; 15167 spec->adc_nids = alc861vd_adc_nids;
14802 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 15168 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14803 spec->capsrc_nids = alc861vd_capsrc_nids; 15169 spec->capsrc_nids = alc861vd_capsrc_nids;
14804 spec->is_mix_capture = 1; 15170 spec->capture_style = CAPT_MIX;
14805 15171
14806 set_capture_mixer(spec); 15172 set_capture_mixer(spec);
15173 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14807 15174
14808 spec->vmaster_nid = 0x02; 15175 spec->vmaster_nid = 0x02;
14809 15176
@@ -14992,8 +15359,6 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 15359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 15360 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 15361 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14995 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14996 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14997 { } /* end */ 15362 { } /* end */
14998}; 15363};
14999 15364
@@ -15015,8 +15380,6 @@ static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 15380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 15381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 15382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15018 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15019 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15020 { } /* end */ 15383 { } /* end */
15021}; 15384};
15022 15385
@@ -15992,56 +16355,55 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
15992}; 16355};
15993 16356
15994static struct snd_pci_quirk alc662_cfg_tbl[] = { 16357static struct snd_pci_quirk alc662_cfg_tbl[] = {
15995 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), 16358 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15996 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15997 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15998 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15999 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16000 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16001 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
16002 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), 16359 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16003 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), 16360 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16004 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), 16361 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16005 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16006 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 16362 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16363 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16007 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 16364 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16008 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16009 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16010 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16011 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 16365 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16012 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), 16366 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16013 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), 16367 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16368 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16369 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16370 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16014 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), 16371 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16015 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 16372 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16016 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), 16373 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16374 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16017 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), 16375 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16018 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 16376 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16019 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 16377 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16020 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 16378 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16021 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16022 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), 16379 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16023 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16024 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16025 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), 16380 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16026 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), 16381 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16382 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16383 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16384 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16385 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16386 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16387 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16388 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16389 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16390 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16391 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16027 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), 16392 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16028 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), 16393 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16029 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), 16394 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16030 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 16395 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16031 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 16396 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16032 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 16397 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16033 ALC662_3ST_6ch_DIG), 16398 ALC662_3ST_6ch_DIG),
16034 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16035 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16036 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16037 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 16399 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16038 ALC662_3ST_6ch_DIG), 16400 ALC662_3ST_6ch_DIG),
16039 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), 16401 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16402 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16040 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", 16403 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16041 ALC662_3ST_6ch_DIG), 16404 ALC662_3ST_6ch_DIG),
16042 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 16405 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16043 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 16406 ALC663_ASUS_H13),
16044 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16045 {} 16407 {}
16046}; 16408};
16047 16409
@@ -16361,7 +16723,7 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16361 16723
16362 if (alc880_is_fixed_pin(pin)) { 16724 if (alc880_is_fixed_pin(pin)) {
16363 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); 16725 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16364 /* printk("DAC nid=%x\n",nid); */ 16726 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16365 /* specify the DAC as the extra output */ 16727 /* specify the DAC as the extra output */
16366 if (!spec->multiout.hp_nid) 16728 if (!spec->multiout.hp_nid)
16367 spec->multiout.hp_nid = nid; 16729 spec->multiout.hp_nid = nid;
@@ -16391,26 +16753,58 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16391 return 0; 16753 return 0;
16392} 16754}
16393 16755
16756/* return the index of the src widget from the connection list of the nid.
16757 * return -1 if not found
16758 */
16759static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16760 hda_nid_t src)
16761{
16762 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16763 int i, conns;
16764
16765 conns = snd_hda_get_connections(codec, nid, conn_list,
16766 ARRAY_SIZE(conn_list));
16767 if (conns < 0)
16768 return -1;
16769 for (i = 0; i < conns; i++)
16770 if (conn_list[i] == src)
16771 return i;
16772 return -1;
16773}
16774
16775static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16776{
16777 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16778 return (pincap & AC_PINCAP_IN) != 0;
16779}
16780
16394/* create playback/capture controls for input pins */ 16781/* create playback/capture controls for input pins */
16395static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, 16782static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16396 const struct auto_pin_cfg *cfg) 16783 const struct auto_pin_cfg *cfg)
16397{ 16784{
16398 struct hda_input_mux *imux = &spec->private_imux; 16785 struct alc_spec *spec = codec->spec;
16786 struct hda_input_mux *imux = &spec->private_imux[0];
16399 int i, err, idx; 16787 int i, err, idx;
16400 16788
16401 for (i = 0; i < AUTO_PIN_LAST; i++) { 16789 for (i = 0; i < AUTO_PIN_LAST; i++) {
16402 if (alc880_is_input_pin(cfg->input_pins[i])) { 16790 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16403 idx = alc880_input_pin_idx(cfg->input_pins[i]); 16791 idx = alc662_input_pin_idx(codec, 0x0b,
16404 err = new_analog_input(spec, cfg->input_pins[i], 16792 cfg->input_pins[i]);
16405 auto_pin_cfg_labels[i], 16793 if (idx >= 0) {
16406 idx, 0x0b); 16794 err = new_analog_input(spec, cfg->input_pins[i],
16407 if (err < 0) 16795 auto_pin_cfg_labels[i],
16408 return err; 16796 idx, 0x0b);
16409 imux->items[imux->num_items].label = 16797 if (err < 0)
16410 auto_pin_cfg_labels[i]; 16798 return err;
16411 imux->items[imux->num_items].index = 16799 }
16412 alc880_input_pin_idx(cfg->input_pins[i]); 16800 idx = alc662_input_pin_idx(codec, 0x22,
16413 imux->num_items++; 16801 cfg->input_pins[i]);
16802 if (idx >= 0) {
16803 imux->items[imux->num_items].label =
16804 auto_pin_cfg_labels[i];
16805 imux->items[imux->num_items].index = idx;
16806 imux->num_items++;
16807 }
16414 } 16808 }
16415 } 16809 }
16416 return 0; 16810 return 0;
@@ -16460,7 +16854,6 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
16460 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 16854 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16461} 16855}
16462 16856
16463#define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16464#define ALC662_PIN_CD_NID ALC880_PIN_CD_NID 16857#define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16465 16858
16466static void alc662_auto_init_analog_input(struct hda_codec *codec) 16859static void alc662_auto_init_analog_input(struct hda_codec *codec)
@@ -16470,12 +16863,10 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec)
16470 16863
16471 for (i = 0; i < AUTO_PIN_LAST; i++) { 16864 for (i = 0; i < AUTO_PIN_LAST; i++) {
16472 hda_nid_t nid = spec->autocfg.input_pins[i]; 16865 hda_nid_t nid = spec->autocfg.input_pins[i];
16473 if (alc662_is_input_pin(nid)) { 16866 if (alc662_is_input_pin(codec, nid)) {
16474 snd_hda_codec_write(codec, nid, 0, 16867 alc_set_input_pin(codec, nid, i);
16475 AC_VERB_SET_PIN_WIDGET_CONTROL, 16868 if (nid != ALC662_PIN_CD_NID &&
16476 (i <= AUTO_PIN_FRONT_MIC ? 16869 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16477 PIN_VREF80 : PIN_IN));
16478 if (nid != ALC662_PIN_CD_NID)
16479 snd_hda_codec_write(codec, nid, 0, 16870 snd_hda_codec_write(codec, nid, 0,
16480 AC_VERB_SET_AMP_GAIN_MUTE, 16871 AC_VERB_SET_AMP_GAIN_MUTE,
16481 AMP_OUT_MUTE); 16872 AMP_OUT_MUTE);
@@ -16513,20 +16904,20 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
16513 "Headphone"); 16904 "Headphone");
16514 if (err < 0) 16905 if (err < 0)
16515 return err; 16906 return err;
16516 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); 16907 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16517 if (err < 0) 16908 if (err < 0)
16518 return err; 16909 return err;
16519 16910
16520 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 16911 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16521 16912
16522 if (spec->autocfg.dig_out_pin) 16913 if (spec->autocfg.dig_outs)
16523 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 16914 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16524 16915
16525 if (spec->kctls.list) 16916 if (spec->kctls.list)
16526 add_mixer(spec, spec->kctls.list); 16917 add_mixer(spec, spec->kctls.list);
16527 16918
16528 spec->num_mux_defs = 1; 16919 spec->num_mux_defs = 1;
16529 spec->input_mux = &spec->private_imux; 16920 spec->input_mux = &spec->private_imux[0];
16530 16921
16531 add_verb(spec, alc662_auto_init_verbs); 16922 add_verb(spec, alc662_auto_init_verbs);
16532 if (codec->vendor_id == 0x10ec0663) 16923 if (codec->vendor_id == 0x10ec0663)
@@ -16536,7 +16927,6 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
16536 if (err < 0) 16927 if (err < 0)
16537 return err; 16928 return err;
16538 16929
16539 store_pin_configs(codec);
16540 return 1; 16930 return 1;
16541} 16931}
16542 16932
@@ -16588,6 +16978,12 @@ static int patch_alc662(struct hda_codec *codec)
16588 } 16978 }
16589 } 16979 }
16590 16980
16981 err = snd_hda_attach_beep_device(codec, 0x1);
16982 if (err < 0) {
16983 alc_free(codec);
16984 return err;
16985 }
16986
16591 if (board_config != ALC662_AUTO) 16987 if (board_config != ALC662_AUTO)
16592 setup_preset(spec, &alc662_presets[board_config]); 16988 setup_preset(spec, &alc662_presets[board_config]);
16593 16989
@@ -16611,10 +17007,14 @@ static int patch_alc662(struct hda_codec *codec)
16611 spec->adc_nids = alc662_adc_nids; 17007 spec->adc_nids = alc662_adc_nids;
16612 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 17008 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16613 spec->capsrc_nids = alc662_capsrc_nids; 17009 spec->capsrc_nids = alc662_capsrc_nids;
16614 spec->is_mix_capture = 1; 17010 spec->capture_style = CAPT_MIX;
16615 17011
16616 if (!spec->cap_mixer) 17012 if (!spec->cap_mixer)
16617 set_capture_mixer(spec); 17013 set_capture_mixer(spec);
17014 if (codec->vendor_id == 0x10ec0662)
17015 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17016 else
17017 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
16618 17018
16619 spec->vmaster_nid = 0x02; 17019 spec->vmaster_nid = 0x02;
16620 17020