diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-09-10 09:32:52 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-09-10 09:32:52 -0400 |
commit | 2d4ff66ad7b8811d0c75ccccad346496f67cb43a (patch) | |
tree | 250ad8d9b07d0144b85960c18a19447a140119e8 /sound | |
parent | 6a0f4021469727675b83d85ac91d106bfae0e2c3 (diff) | |
parent | 33d78674586aeb6a623b1e612e6f92dd83015ed3 (diff) |
Merge branch 'topic/hda' into for-linus
* topic/hda: (92 commits)
ALSA: hda - Use auto model for HP laptops with ALC268 codec
ALSA: hda/realtek: Added support for CLEVO M540R subsystem, 6 channel + digital
ALSA: hda - Add support of Alienware M17x laptop
ALSA: hda - Remove dead codes from patch_sigmatel.c
ALSA: hda - Fix input source selection of IDT92HD73xx
ALSA: hda - Fix obsolete CONFIG_SND_DEBUG_DETECT
ALSA: hda - Unmute docking line-out as default with AD1984A codec
ALSA: hda - Add another entry for Nvidia HDMI device
ALSA: hda - Add missing GPIO initialization for AD1984A laptop model
ALSA: hda - Add support of docking auto-mute/mic for AD1984A laptop model
ALSA: hda - Fix ALC268/ALC269 headphone pin routing
ALSA: hda - Create "Digital Mic Capture Volume" correctly for IDT codecs
ALSA: hda - Add more quirk for HP laptops with AD1984A
ALSA: hda - Add / fix model entries for HD-audio driver
ALSA: hda - Add full audio support on Acer Aspire 7730G notebook
ALSA: hda - Improve auto-cfg mixer name for ALC662
ALSA: hda - Improve auto-cfg mixer name for ALC861-VD
ALSA: hda - Improve auto-cfg mixer name for ALC262
ALSA: hda - Improve auto-cfg mixer name for ALC260
ALSA: hda - Improve auto-cfg mixer name for ALC880
...
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/Kconfig | 27 | ||||
-rw-r--r-- | sound/pci/hda/Makefile | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_beep.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 68 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 10 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 18 | ||||
-rw-r--r-- | sound/pci/hda/hda_hwdep.c | 236 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 74 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 14 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 7 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 131 | ||||
-rw-r--r-- | sound/pci/hda/patch_atihdmi.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0110.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 1194 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 479 | ||||
-rw-r--r-- | sound/pci/hda/patch_intelhdmi.c | 104 | ||||
-rw-r--r-- | sound/pci/hda/patch_nvhdmi.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 4144 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 1206 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 3 |
21 files changed, 4830 insertions, 2904 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 04438f1d682d..55545e0818b5 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -46,6 +46,20 @@ config SND_HDA_INPUT_JACK | |||
46 | Say Y here to enable the jack plugging notification via | 46 | Say Y here to enable the jack plugging notification via |
47 | input layer. | 47 | input layer. |
48 | 48 | ||
49 | config SND_HDA_PATCH_LOADER | ||
50 | bool "Support initialization patch loading for HD-audio" | ||
51 | depends on EXPERIMENTAL | ||
52 | select FW_LOADER | ||
53 | select SND_HDA_HWDEP | ||
54 | select SND_HDA_RECONFIG | ||
55 | help | ||
56 | Say Y here to allow the HD-audio driver to load a pseudo | ||
57 | firmware file ("patch") for overriding the BIOS setup at | ||
58 | start up. The "patch" file can be specified via patch module | ||
59 | option, such as patch=hda-init. | ||
60 | |||
61 | This option turns on hwdep and reconfig features automatically. | ||
62 | |||
49 | config SND_HDA_CODEC_REALTEK | 63 | config SND_HDA_CODEC_REALTEK |
50 | bool "Build Realtek HD-audio codec support" | 64 | bool "Build Realtek HD-audio codec support" |
51 | default y | 65 | default y |
@@ -134,6 +148,19 @@ config SND_HDA_ELD | |||
134 | def_bool y | 148 | def_bool y |
135 | depends on SND_HDA_CODEC_INTELHDMI | 149 | depends on SND_HDA_CODEC_INTELHDMI |
136 | 150 | ||
151 | config SND_HDA_CODEC_CIRRUS | ||
152 | bool "Build Cirrus Logic codec support" | ||
153 | depends on SND_HDA_INTEL | ||
154 | default y | ||
155 | help | ||
156 | Say Y here to include Cirrus Logic codec support in | ||
157 | snd-hda-intel driver, such as CS4206. | ||
158 | |||
159 | When the HD-audio driver is built as a module, the codec | ||
160 | support code is also built as another module, | ||
161 | snd-hda-codec-cirrus. | ||
162 | This module is automatically loaded at probing. | ||
163 | |||
137 | config SND_HDA_CODEC_CONEXANT | 164 | config SND_HDA_CODEC_CONEXANT |
138 | bool "Build Conexant HD-audio codec support" | 165 | bool "Build Conexant HD-audio codec support" |
139 | default y | 166 | default y |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index e3081d4586cc..315a1c4f8998 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -13,6 +13,7 @@ snd-hda-codec-analog-objs := patch_analog.o | |||
13 | snd-hda-codec-idt-objs := patch_sigmatel.o | 13 | snd-hda-codec-idt-objs := patch_sigmatel.o |
14 | snd-hda-codec-si3054-objs := patch_si3054.o | 14 | snd-hda-codec-si3054-objs := patch_si3054.o |
15 | snd-hda-codec-atihdmi-objs := patch_atihdmi.o | 15 | snd-hda-codec-atihdmi-objs := patch_atihdmi.o |
16 | snd-hda-codec-cirrus-objs := patch_cirrus.o | ||
16 | snd-hda-codec-ca0110-objs := patch_ca0110.o | 17 | snd-hda-codec-ca0110-objs := patch_ca0110.o |
17 | snd-hda-codec-conexant-objs := patch_conexant.o | 18 | snd-hda-codec-conexant-objs := patch_conexant.o |
18 | snd-hda-codec-via-objs := patch_via.o | 19 | snd-hda-codec-via-objs := patch_via.o |
@@ -41,6 +42,9 @@ endif | |||
41 | ifdef CONFIG_SND_HDA_CODEC_ATIHDMI | 42 | ifdef CONFIG_SND_HDA_CODEC_ATIHDMI |
42 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-atihdmi.o | 43 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-atihdmi.o |
43 | endif | 44 | endif |
45 | ifdef CONFIG_SND_HDA_CODEC_CIRRUS | ||
46 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-cirrus.o | ||
47 | endif | ||
44 | ifdef CONFIG_SND_HDA_CODEC_CA0110 | 48 | ifdef CONFIG_SND_HDA_CODEC_CA0110 |
45 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-ca0110.o | 49 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-ca0110.o |
46 | endif | 50 | endif |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index b0275a050870..3f51a981e604 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <sound/core.h> | 25 | #include <sound/core.h> |
26 | #include "hda_beep.h" | 26 | #include "hda_beep.h" |
27 | #include "hda_local.h" | ||
27 | 28 | ||
28 | enum { | 29 | enum { |
29 | DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ | 30 | DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ |
@@ -118,6 +119,9 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
118 | struct hda_beep *beep; | 119 | struct hda_beep *beep; |
119 | int err; | 120 | int err; |
120 | 121 | ||
122 | if (!snd_hda_get_bool_hint(codec, "beep")) | ||
123 | return 0; /* disabled explicitly */ | ||
124 | |||
121 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); | 125 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); |
122 | if (beep == NULL) | 126 | if (beep == NULL) |
123 | return -ENOMEM; | 127 | return -ENOMEM; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c7df01b72cac..af989f660cca 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -44,6 +44,7 @@ struct hda_vendor_id { | |||
44 | /* codec vendor labels */ | 44 | /* codec vendor labels */ |
45 | static struct hda_vendor_id hda_vendor_ids[] = { | 45 | static struct hda_vendor_id hda_vendor_ids[] = { |
46 | { 0x1002, "ATI" }, | 46 | { 0x1002, "ATI" }, |
47 | { 0x1013, "Cirrus Logic" }, | ||
47 | { 0x1057, "Motorola" }, | 48 | { 0x1057, "Motorola" }, |
48 | { 0x1095, "Silicon Image" }, | 49 | { 0x1095, "Silicon Image" }, |
49 | { 0x10de, "Nvidia" }, | 50 | { 0x10de, "Nvidia" }, |
@@ -150,7 +151,14 @@ make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, | |||
150 | { | 151 | { |
151 | u32 val; | 152 | u32 val; |
152 | 153 | ||
153 | val = (u32)(codec->addr & 0x0f) << 28; | 154 | if ((codec->addr & ~0xf) || (direct & ~1) || (nid & ~0x7f) || |
155 | (verb & ~0xfff) || (parm & ~0xffff)) { | ||
156 | printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n", | ||
157 | codec->addr, direct, nid, verb, parm); | ||
158 | return ~0; | ||
159 | } | ||
160 | |||
161 | val = (u32)codec->addr << 28; | ||
154 | val |= (u32)direct << 27; | 162 | val |= (u32)direct << 27; |
155 | val |= (u32)nid << 20; | 163 | val |= (u32)nid << 20; |
156 | val |= verb << 8; | 164 | val |= verb << 8; |
@@ -167,6 +175,9 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, | |||
167 | struct hda_bus *bus = codec->bus; | 175 | struct hda_bus *bus = codec->bus; |
168 | int err; | 176 | int err; |
169 | 177 | ||
178 | if (cmd == ~0) | ||
179 | return -1; | ||
180 | |||
170 | if (res) | 181 | if (res) |
171 | *res = -1; | 182 | *res = -1; |
172 | again: | 183 | again: |
@@ -291,11 +302,20 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
291 | unsigned int parm; | 302 | unsigned int parm; |
292 | int i, conn_len, conns; | 303 | int i, conn_len, conns; |
293 | unsigned int shift, num_elems, mask; | 304 | unsigned int shift, num_elems, mask; |
305 | unsigned int wcaps; | ||
294 | hda_nid_t prev_nid; | 306 | hda_nid_t prev_nid; |
295 | 307 | ||
296 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) | 308 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) |
297 | return -EINVAL; | 309 | return -EINVAL; |
298 | 310 | ||
311 | wcaps = get_wcaps(codec, nid); | ||
312 | if (!(wcaps & AC_WCAP_CONN_LIST) && | ||
313 | get_wcaps_type(wcaps) != AC_WID_VOL_KNB) { | ||
314 | snd_printk(KERN_WARNING "hda_codec: " | ||
315 | "connection list not available for 0x%x\n", nid); | ||
316 | return -EINVAL; | ||
317 | } | ||
318 | |||
299 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); | 319 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); |
300 | if (parm & AC_CLIST_LONG) { | 320 | if (parm & AC_CLIST_LONG) { |
301 | /* long form */ | 321 | /* long form */ |
@@ -316,6 +336,8 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
316 | /* single connection */ | 336 | /* single connection */ |
317 | parm = snd_hda_codec_read(codec, nid, 0, | 337 | parm = snd_hda_codec_read(codec, nid, 0, |
318 | AC_VERB_GET_CONNECT_LIST, 0); | 338 | AC_VERB_GET_CONNECT_LIST, 0); |
339 | if (parm == -1 && codec->bus->rirb_error) | ||
340 | return -EIO; | ||
319 | conn_list[0] = parm & mask; | 341 | conn_list[0] = parm & mask; |
320 | return 1; | 342 | return 1; |
321 | } | 343 | } |
@@ -327,9 +349,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
327 | int range_val; | 349 | int range_val; |
328 | hda_nid_t val, n; | 350 | hda_nid_t val, n; |
329 | 351 | ||
330 | if (i % num_elems == 0) | 352 | if (i % num_elems == 0) { |
331 | parm = snd_hda_codec_read(codec, nid, 0, | 353 | parm = snd_hda_codec_read(codec, nid, 0, |
332 | AC_VERB_GET_CONNECT_LIST, i); | 354 | AC_VERB_GET_CONNECT_LIST, i); |
355 | if (parm == -1 && codec->bus->rirb_error) | ||
356 | return -EIO; | ||
357 | } | ||
333 | range_val = !!(parm & (1 << (shift-1))); /* ranges */ | 358 | range_val = !!(parm & (1 << (shift-1))); /* ranges */ |
334 | val = parm & mask; | 359 | val = parm & mask; |
335 | if (val == 0) { | 360 | if (val == 0) { |
@@ -727,8 +752,7 @@ static int read_pin_defaults(struct hda_codec *codec) | |||
727 | for (i = 0; i < codec->num_nodes; i++, nid++) { | 752 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
728 | struct hda_pincfg *pin; | 753 | struct hda_pincfg *pin; |
729 | unsigned int wcaps = get_wcaps(codec, nid); | 754 | unsigned int wcaps = get_wcaps(codec, nid); |
730 | unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> | 755 | unsigned int wid_type = get_wcaps_type(wcaps); |
731 | AC_WCAP_TYPE_SHIFT; | ||
732 | if (wid_type != AC_WID_PIN) | 756 | if (wid_type != AC_WID_PIN) |
733 | continue; | 757 | continue; |
734 | pin = snd_array_new(&codec->init_pins); | 758 | pin = snd_array_new(&codec->init_pins); |
@@ -891,7 +915,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
891 | * Returns 0 if successful, or a negative error code. | 915 | * Returns 0 if successful, or a negative error code. |
892 | */ | 916 | */ |
893 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 917 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, |
894 | int do_init, struct hda_codec **codecp) | 918 | struct hda_codec **codecp) |
895 | { | 919 | { |
896 | struct hda_codec *codec; | 920 | struct hda_codec *codec; |
897 | char component[31]; | 921 | char component[31]; |
@@ -984,11 +1008,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
984 | codec->afg ? codec->afg : codec->mfg, | 1008 | codec->afg ? codec->afg : codec->mfg, |
985 | AC_PWRST_D0); | 1009 | AC_PWRST_D0); |
986 | 1010 | ||
987 | if (do_init) { | ||
988 | err = snd_hda_codec_configure(codec); | ||
989 | if (err < 0) | ||
990 | goto error; | ||
991 | } | ||
992 | snd_hda_codec_proc_new(codec); | 1011 | snd_hda_codec_proc_new(codec); |
993 | 1012 | ||
994 | snd_hda_create_hwdep(codec); | 1013 | snd_hda_create_hwdep(codec); |
@@ -1042,6 +1061,7 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1042 | err = init_unsol_queue(codec->bus); | 1061 | err = init_unsol_queue(codec->bus); |
1043 | return err; | 1062 | return err; |
1044 | } | 1063 | } |
1064 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); | ||
1045 | 1065 | ||
1046 | /** | 1066 | /** |
1047 | * snd_hda_codec_setup_stream - set up the codec for streaming | 1067 | * snd_hda_codec_setup_stream - set up the codec for streaming |
@@ -2356,16 +2376,20 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
2356 | hda_nid_t nid; | 2376 | hda_nid_t nid; |
2357 | int i; | 2377 | int i; |
2358 | 2378 | ||
2359 | snd_hda_codec_write(codec, fg, 0, AC_VERB_SET_POWER_STATE, | 2379 | /* this delay seems necessary to avoid click noise at power-down */ |
2380 | if (power_state == AC_PWRST_D3) | ||
2381 | msleep(100); | ||
2382 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, | ||
2360 | power_state); | 2383 | power_state); |
2361 | msleep(10); /* partial workaround for "azx_get_response timeout" */ | 2384 | /* partial workaround for "azx_get_response timeout" */ |
2385 | if (power_state == AC_PWRST_D0) | ||
2386 | msleep(10); | ||
2362 | 2387 | ||
2363 | nid = codec->start_nid; | 2388 | nid = codec->start_nid; |
2364 | for (i = 0; i < codec->num_nodes; i++, nid++) { | 2389 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
2365 | unsigned int wcaps = get_wcaps(codec, nid); | 2390 | unsigned int wcaps = get_wcaps(codec, nid); |
2366 | if (wcaps & AC_WCAP_POWER) { | 2391 | if (wcaps & AC_WCAP_POWER) { |
2367 | unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> | 2392 | unsigned int wid_type = get_wcaps_type(wcaps); |
2368 | AC_WCAP_TYPE_SHIFT; | ||
2369 | if (power_state == AC_PWRST_D3 && | 2393 | if (power_state == AC_PWRST_D3 && |
2370 | wid_type == AC_WID_PIN) { | 2394 | wid_type == AC_WID_PIN) { |
2371 | unsigned int pincap; | 2395 | unsigned int pincap; |
@@ -2573,7 +2597,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
2573 | case 20: | 2597 | case 20: |
2574 | case 24: | 2598 | case 24: |
2575 | case 32: | 2599 | case 32: |
2576 | if (maxbps >= 32) | 2600 | if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE) |
2577 | val |= 0x40; | 2601 | val |= 0x40; |
2578 | else if (maxbps >= 24) | 2602 | else if (maxbps >= 24) |
2579 | val |= 0x30; | 2603 | val |= 0x30; |
@@ -2700,11 +2724,12 @@ static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | |||
2700 | bps = 20; | 2724 | bps = 20; |
2701 | } | 2725 | } |
2702 | } | 2726 | } |
2703 | else if (streams == AC_SUPFMT_FLOAT32) { | 2727 | if (streams & AC_SUPFMT_FLOAT32) { |
2704 | /* should be exclusive */ | ||
2705 | formats |= SNDRV_PCM_FMTBIT_FLOAT_LE; | 2728 | formats |= SNDRV_PCM_FMTBIT_FLOAT_LE; |
2706 | bps = 32; | 2729 | if (!bps) |
2707 | } else if (streams == AC_SUPFMT_AC3) { | 2730 | bps = 32; |
2731 | } | ||
2732 | if (streams == AC_SUPFMT_AC3) { | ||
2708 | /* should be exclusive */ | 2733 | /* should be exclusive */ |
2709 | /* temporary hack: we have still no proper support | 2734 | /* temporary hack: we have still no proper support |
2710 | * for the direct AC3 stream... | 2735 | * for the direct AC3 stream... |
@@ -3102,7 +3127,7 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
3102 | tbl = q; | 3127 | tbl = q; |
3103 | 3128 | ||
3104 | if (tbl->value >= 0 && tbl->value < num_configs) { | 3129 | if (tbl->value >= 0 && tbl->value < num_configs) { |
3105 | #ifdef CONFIG_SND_DEBUG_DETECT | 3130 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
3106 | char tmp[10]; | 3131 | char tmp[10]; |
3107 | const char *model = NULL; | 3132 | const char *model = NULL; |
3108 | if (models) | 3133 | if (models) |
@@ -3655,8 +3680,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
3655 | end_nid = codec->start_nid + codec->num_nodes; | 3680 | end_nid = codec->start_nid + codec->num_nodes; |
3656 | for (nid = codec->start_nid; nid < end_nid; nid++) { | 3681 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
3657 | unsigned int wid_caps = get_wcaps(codec, nid); | 3682 | unsigned int wid_caps = get_wcaps(codec, nid); |
3658 | unsigned int wid_type = | 3683 | unsigned int wid_type = get_wcaps_type(wid_caps); |
3659 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
3660 | unsigned int def_conf; | 3684 | unsigned int def_conf; |
3661 | short assoc, loc; | 3685 | short assoc, loc; |
3662 | 3686 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 1b75f28ed092..99552fb5f756 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -830,7 +830,8 @@ enum { | |||
830 | int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, | 830 | int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, |
831 | struct hda_bus **busp); | 831 | struct hda_bus **busp); |
832 | int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 832 | int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, |
833 | int do_init, struct hda_codec **codecp); | 833 | struct hda_codec **codecp); |
834 | int snd_hda_codec_configure(struct hda_codec *codec); | ||
834 | 835 | ||
835 | /* | 836 | /* |
836 | * low level functions | 837 | * low level functions |
@@ -938,6 +939,13 @@ static inline void snd_hda_power_down(struct hda_codec *codec) {} | |||
938 | #define snd_hda_codec_needs_resume(codec) 1 | 939 | #define snd_hda_codec_needs_resume(codec) 1 |
939 | #endif | 940 | #endif |
940 | 941 | ||
942 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
943 | /* | ||
944 | * patch firmware | ||
945 | */ | ||
946 | int snd_hda_load_patch(struct hda_bus *bus, const char *patch); | ||
947 | #endif | ||
948 | |||
941 | /* | 949 | /* |
942 | * Codec modularization | 950 | * Codec modularization |
943 | */ | 951 | */ |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 1d5797a96682..b36f6c5a92df 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -121,11 +121,17 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid | |||
121 | if (node == NULL) | 121 | if (node == NULL) |
122 | return -ENOMEM; | 122 | return -ENOMEM; |
123 | node->nid = nid; | 123 | node->nid = nid; |
124 | nconns = snd_hda_get_connections(codec, nid, conn_list, | 124 | node->wid_caps = get_wcaps(codec, nid); |
125 | HDA_MAX_CONNECTIONS); | 125 | node->type = get_wcaps_type(node->wid_caps); |
126 | if (nconns < 0) { | 126 | if (node->wid_caps & AC_WCAP_CONN_LIST) { |
127 | kfree(node); | 127 | nconns = snd_hda_get_connections(codec, nid, conn_list, |
128 | return nconns; | 128 | HDA_MAX_CONNECTIONS); |
129 | if (nconns < 0) { | ||
130 | kfree(node); | ||
131 | return nconns; | ||
132 | } | ||
133 | } else { | ||
134 | nconns = 0; | ||
129 | } | 135 | } |
130 | if (nconns <= ARRAY_SIZE(node->slist)) | 136 | if (nconns <= ARRAY_SIZE(node->slist)) |
131 | node->conn_list = node->slist; | 137 | node->conn_list = node->slist; |
@@ -140,8 +146,6 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid | |||
140 | } | 146 | } |
141 | memcpy(node->conn_list, conn_list, nconns * sizeof(hda_nid_t)); | 147 | memcpy(node->conn_list, conn_list, nconns * sizeof(hda_nid_t)); |
142 | node->nconns = nconns; | 148 | node->nconns = nconns; |
143 | node->wid_caps = get_wcaps(codec, nid); | ||
144 | node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
145 | 149 | ||
146 | if (node->type == AC_WID_PIN) { | 150 | if (node->type == AC_WID_PIN) { |
147 | node->pin_caps = snd_hda_query_pin_caps(codec, node->nid); | 151 | node->pin_caps = snd_hda_query_pin_caps(codec, node->nid); |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 6812fbe80fa4..cc24e6721d74 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/compat.h> | 24 | #include <linux/compat.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/firmware.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 30 | #include "hda_local.h" |
@@ -312,12 +313,8 @@ static ssize_t init_verbs_show(struct device *dev, | |||
312 | return len; | 313 | return len; |
313 | } | 314 | } |
314 | 315 | ||
315 | static ssize_t init_verbs_store(struct device *dev, | 316 | static int parse_init_verbs(struct hda_codec *codec, const char *buf) |
316 | struct device_attribute *attr, | ||
317 | const char *buf, size_t count) | ||
318 | { | 317 | { |
319 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
320 | struct hda_codec *codec = hwdep->private_data; | ||
321 | struct hda_verb *v; | 318 | struct hda_verb *v; |
322 | int nid, verb, param; | 319 | int nid, verb, param; |
323 | 320 | ||
@@ -331,6 +328,18 @@ static ssize_t init_verbs_store(struct device *dev, | |||
331 | v->nid = nid; | 328 | v->nid = nid; |
332 | v->verb = verb; | 329 | v->verb = verb; |
333 | v->param = param; | 330 | v->param = param; |
331 | return 0; | ||
332 | } | ||
333 | |||
334 | static ssize_t init_verbs_store(struct device *dev, | ||
335 | struct device_attribute *attr, | ||
336 | const char *buf, size_t count) | ||
337 | { | ||
338 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
339 | struct hda_codec *codec = hwdep->private_data; | ||
340 | int err = parse_init_verbs(codec, buf); | ||
341 | if (err < 0) | ||
342 | return err; | ||
334 | return count; | 343 | return count; |
335 | } | 344 | } |
336 | 345 | ||
@@ -376,19 +385,15 @@ static void remove_trail_spaces(char *str) | |||
376 | 385 | ||
377 | #define MAX_HINTS 1024 | 386 | #define MAX_HINTS 1024 |
378 | 387 | ||
379 | static ssize_t hints_store(struct device *dev, | 388 | static int parse_hints(struct hda_codec *codec, const char *buf) |
380 | struct device_attribute *attr, | ||
381 | const char *buf, size_t count) | ||
382 | { | 389 | { |
383 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
384 | struct hda_codec *codec = hwdep->private_data; | ||
385 | char *key, *val; | 390 | char *key, *val; |
386 | struct hda_hint *hint; | 391 | struct hda_hint *hint; |
387 | 392 | ||
388 | while (isspace(*buf)) | 393 | while (isspace(*buf)) |
389 | buf++; | 394 | buf++; |
390 | if (!*buf || *buf == '#' || *buf == '\n') | 395 | if (!*buf || *buf == '#' || *buf == '\n') |
391 | return count; | 396 | return 0; |
392 | if (*buf == '=') | 397 | if (*buf == '=') |
393 | return -EINVAL; | 398 | return -EINVAL; |
394 | key = kstrndup_noeol(buf, 1024); | 399 | key = kstrndup_noeol(buf, 1024); |
@@ -411,7 +416,7 @@ static ssize_t hints_store(struct device *dev, | |||
411 | kfree(hint->key); | 416 | kfree(hint->key); |
412 | hint->key = key; | 417 | hint->key = key; |
413 | hint->val = val; | 418 | hint->val = val; |
414 | return count; | 419 | return 0; |
415 | } | 420 | } |
416 | /* allocate a new hint entry */ | 421 | /* allocate a new hint entry */ |
417 | if (codec->hints.used >= MAX_HINTS) | 422 | if (codec->hints.used >= MAX_HINTS) |
@@ -424,6 +429,18 @@ static ssize_t hints_store(struct device *dev, | |||
424 | } | 429 | } |
425 | hint->key = key; | 430 | hint->key = key; |
426 | hint->val = val; | 431 | hint->val = val; |
432 | return 0; | ||
433 | } | ||
434 | |||
435 | static ssize_t hints_store(struct device *dev, | ||
436 | struct device_attribute *attr, | ||
437 | const char *buf, size_t count) | ||
438 | { | ||
439 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
440 | struct hda_codec *codec = hwdep->private_data; | ||
441 | int err = parse_hints(codec, buf); | ||
442 | if (err < 0) | ||
443 | return err; | ||
427 | return count; | 444 | return count; |
428 | } | 445 | } |
429 | 446 | ||
@@ -469,20 +486,24 @@ static ssize_t driver_pin_configs_show(struct device *dev, | |||
469 | 486 | ||
470 | #define MAX_PIN_CONFIGS 32 | 487 | #define MAX_PIN_CONFIGS 32 |
471 | 488 | ||
472 | static ssize_t user_pin_configs_store(struct device *dev, | 489 | static int parse_user_pin_configs(struct hda_codec *codec, const char *buf) |
473 | struct device_attribute *attr, | ||
474 | const char *buf, size_t count) | ||
475 | { | 490 | { |
476 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
477 | struct hda_codec *codec = hwdep->private_data; | ||
478 | int nid, cfg; | 491 | int nid, cfg; |
479 | int err; | ||
480 | 492 | ||
481 | if (sscanf(buf, "%i %i", &nid, &cfg) != 2) | 493 | if (sscanf(buf, "%i %i", &nid, &cfg) != 2) |
482 | return -EINVAL; | 494 | return -EINVAL; |
483 | if (!nid) | 495 | if (!nid) |
484 | return -EINVAL; | 496 | return -EINVAL; |
485 | err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); | 497 | return snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); |
498 | } | ||
499 | |||
500 | static ssize_t user_pin_configs_store(struct device *dev, | ||
501 | struct device_attribute *attr, | ||
502 | const char *buf, size_t count) | ||
503 | { | ||
504 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
505 | struct hda_codec *codec = hwdep->private_data; | ||
506 | int err = parse_user_pin_configs(codec, buf); | ||
486 | if (err < 0) | 507 | if (err < 0) |
487 | return err; | 508 | return err; |
488 | return count; | 509 | return count; |
@@ -553,3 +574,180 @@ int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) | |||
553 | EXPORT_SYMBOL_HDA(snd_hda_get_bool_hint); | 574 | EXPORT_SYMBOL_HDA(snd_hda_get_bool_hint); |
554 | 575 | ||
555 | #endif /* CONFIG_SND_HDA_RECONFIG */ | 576 | #endif /* CONFIG_SND_HDA_RECONFIG */ |
577 | |||
578 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
579 | |||
580 | /* parser mode */ | ||
581 | enum { | ||
582 | LINE_MODE_NONE, | ||
583 | LINE_MODE_CODEC, | ||
584 | LINE_MODE_MODEL, | ||
585 | LINE_MODE_PINCFG, | ||
586 | LINE_MODE_VERB, | ||
587 | LINE_MODE_HINT, | ||
588 | NUM_LINE_MODES, | ||
589 | }; | ||
590 | |||
591 | static inline int strmatch(const char *a, const char *b) | ||
592 | { | ||
593 | return strnicmp(a, b, strlen(b)) == 0; | ||
594 | } | ||
595 | |||
596 | /* parse the contents after the line "[codec]" | ||
597 | * accept only the line with three numbers, and assign the current codec | ||
598 | */ | ||
599 | static void parse_codec_mode(char *buf, struct hda_bus *bus, | ||
600 | struct hda_codec **codecp) | ||
601 | { | ||
602 | unsigned int vendorid, subid, caddr; | ||
603 | struct hda_codec *codec; | ||
604 | |||
605 | *codecp = NULL; | ||
606 | if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) { | ||
607 | list_for_each_entry(codec, &bus->codec_list, list) { | ||
608 | if (codec->addr == caddr) { | ||
609 | *codecp = codec; | ||
610 | break; | ||
611 | } | ||
612 | } | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /* parse the contents after the other command tags, [pincfg], [verb], | ||
617 | * [hint] and [model] | ||
618 | * just pass to the sysfs helper (only when any codec was specified) | ||
619 | */ | ||
620 | static void parse_pincfg_mode(char *buf, struct hda_bus *bus, | ||
621 | struct hda_codec **codecp) | ||
622 | { | ||
623 | if (!*codecp) | ||
624 | return; | ||
625 | parse_user_pin_configs(*codecp, buf); | ||
626 | } | ||
627 | |||
628 | static void parse_verb_mode(char *buf, struct hda_bus *bus, | ||
629 | struct hda_codec **codecp) | ||
630 | { | ||
631 | if (!*codecp) | ||
632 | return; | ||
633 | parse_init_verbs(*codecp, buf); | ||
634 | } | ||
635 | |||
636 | static void parse_hint_mode(char *buf, struct hda_bus *bus, | ||
637 | struct hda_codec **codecp) | ||
638 | { | ||
639 | if (!*codecp) | ||
640 | return; | ||
641 | parse_hints(*codecp, buf); | ||
642 | } | ||
643 | |||
644 | static void parse_model_mode(char *buf, struct hda_bus *bus, | ||
645 | struct hda_codec **codecp) | ||
646 | { | ||
647 | if (!*codecp) | ||
648 | return; | ||
649 | kfree((*codecp)->modelname); | ||
650 | (*codecp)->modelname = kstrdup(buf, GFP_KERNEL); | ||
651 | } | ||
652 | |||
653 | struct hda_patch_item { | ||
654 | const char *tag; | ||
655 | void (*parser)(char *buf, struct hda_bus *bus, struct hda_codec **retc); | ||
656 | }; | ||
657 | |||
658 | static struct hda_patch_item patch_items[NUM_LINE_MODES] = { | ||
659 | [LINE_MODE_CODEC] = { "[codec]", parse_codec_mode }, | ||
660 | [LINE_MODE_MODEL] = { "[model]", parse_model_mode }, | ||
661 | [LINE_MODE_VERB] = { "[verb]", parse_verb_mode }, | ||
662 | [LINE_MODE_PINCFG] = { "[pincfg]", parse_pincfg_mode }, | ||
663 | [LINE_MODE_HINT] = { "[hint]", parse_hint_mode }, | ||
664 | }; | ||
665 | |||
666 | /* check the line starting with '[' -- change the parser mode accodingly */ | ||
667 | static int parse_line_mode(char *buf, struct hda_bus *bus) | ||
668 | { | ||
669 | int i; | ||
670 | for (i = 0; i < ARRAY_SIZE(patch_items); i++) { | ||
671 | if (!patch_items[i].tag) | ||
672 | continue; | ||
673 | if (strmatch(buf, patch_items[i].tag)) | ||
674 | return i; | ||
675 | } | ||
676 | return LINE_MODE_NONE; | ||
677 | } | ||
678 | |||
679 | /* copy one line from the buffer in fw, and update the fields in fw | ||
680 | * return zero if it reaches to the end of the buffer, or non-zero | ||
681 | * if successfully copied a line | ||
682 | * | ||
683 | * the spaces at the beginning and the end of the line are stripped | ||
684 | */ | ||
685 | static int get_line_from_fw(char *buf, int size, struct firmware *fw) | ||
686 | { | ||
687 | int len; | ||
688 | const char *p = fw->data; | ||
689 | while (isspace(*p) && fw->size) { | ||
690 | p++; | ||
691 | fw->size--; | ||
692 | } | ||
693 | if (!fw->size) | ||
694 | return 0; | ||
695 | if (size < fw->size) | ||
696 | size = fw->size; | ||
697 | |||
698 | for (len = 0; len < fw->size; len++) { | ||
699 | if (!*p) | ||
700 | break; | ||
701 | if (*p == '\n') { | ||
702 | p++; | ||
703 | len++; | ||
704 | break; | ||
705 | } | ||
706 | if (len < size) | ||
707 | *buf++ = *p++; | ||
708 | } | ||
709 | *buf = 0; | ||
710 | fw->size -= len; | ||
711 | fw->data = p; | ||
712 | remove_trail_spaces(buf); | ||
713 | return 1; | ||
714 | } | ||
715 | |||
716 | /* | ||
717 | * load a "patch" firmware file and parse it | ||
718 | */ | ||
719 | int snd_hda_load_patch(struct hda_bus *bus, const char *patch) | ||
720 | { | ||
721 | int err; | ||
722 | const struct firmware *fw; | ||
723 | struct firmware tmp; | ||
724 | char buf[128]; | ||
725 | struct hda_codec *codec; | ||
726 | int line_mode; | ||
727 | struct device *dev = bus->card->dev; | ||
728 | |||
729 | if (snd_BUG_ON(!dev)) | ||
730 | return -ENODEV; | ||
731 | err = request_firmware(&fw, patch, dev); | ||
732 | if (err < 0) { | ||
733 | printk(KERN_ERR "hda-codec: Cannot load the patch '%s'\n", | ||
734 | patch); | ||
735 | return err; | ||
736 | } | ||
737 | |||
738 | tmp = *fw; | ||
739 | line_mode = LINE_MODE_NONE; | ||
740 | codec = NULL; | ||
741 | while (get_line_from_fw(buf, sizeof(buf) - 1, &tmp)) { | ||
742 | if (!*buf || *buf == '#' || *buf == '\n') | ||
743 | continue; | ||
744 | if (*buf == '[') | ||
745 | line_mode = parse_line_mode(buf, bus); | ||
746 | else if (patch_items[line_mode].parser) | ||
747 | patch_items[line_mode].parser(buf, bus, &codec); | ||
748 | } | ||
749 | release_firmware(fw); | ||
750 | return 0; | ||
751 | } | ||
752 | EXPORT_SYMBOL_HDA(snd_hda_load_patch); | ||
753 | #endif /* CONFIG_SND_HDA_PATCH_LOADER */ | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 175f07a381ba..20a66f85f0a4 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -61,6 +61,9 @@ static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; | |||
61 | static int probe_only[SNDRV_CARDS]; | 61 | static int probe_only[SNDRV_CARDS]; |
62 | static int single_cmd; | 62 | static int single_cmd; |
63 | static int enable_msi; | 63 | static int enable_msi; |
64 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
65 | static char *patch[SNDRV_CARDS]; | ||
66 | #endif | ||
64 | 67 | ||
65 | module_param_array(index, int, NULL, 0444); | 68 | module_param_array(index, int, NULL, 0444); |
66 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); | 69 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); |
@@ -84,6 +87,10 @@ MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " | |||
84 | "(for debugging only)."); | 87 | "(for debugging only)."); |
85 | module_param(enable_msi, int, 0444); | 88 | module_param(enable_msi, int, 0444); |
86 | MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)"); | 89 | MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)"); |
90 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
91 | module_param_array(patch, charp, NULL, 0444); | ||
92 | MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); | ||
93 | #endif | ||
87 | 94 | ||
88 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 95 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
89 | static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; | 96 | static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; |
@@ -1331,8 +1338,7 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | |||
1331 | [AZX_DRIVER_TERA] = 1, | 1338 | [AZX_DRIVER_TERA] = 1, |
1332 | }; | 1339 | }; |
1333 | 1340 | ||
1334 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1341 | static int __devinit azx_codec_create(struct azx *chip, const char *model) |
1335 | int no_init) | ||
1336 | { | 1342 | { |
1337 | struct hda_bus_template bus_temp; | 1343 | struct hda_bus_template bus_temp; |
1338 | int c, codecs, err; | 1344 | int c, codecs, err; |
@@ -1391,7 +1397,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1391 | for (c = 0; c < max_slots; c++) { | 1397 | for (c = 0; c < max_slots; c++) { |
1392 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { | 1398 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1393 | struct hda_codec *codec; | 1399 | struct hda_codec *codec; |
1394 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); | 1400 | err = snd_hda_codec_new(chip->bus, c, &codec); |
1395 | if (err < 0) | 1401 | if (err < 0) |
1396 | continue; | 1402 | continue; |
1397 | codecs++; | 1403 | codecs++; |
@@ -1401,7 +1407,16 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1401 | snd_printk(KERN_ERR SFX "no codecs initialized\n"); | 1407 | snd_printk(KERN_ERR SFX "no codecs initialized\n"); |
1402 | return -ENXIO; | 1408 | return -ENXIO; |
1403 | } | 1409 | } |
1410 | return 0; | ||
1411 | } | ||
1404 | 1412 | ||
1413 | /* configure each codec instance */ | ||
1414 | static int __devinit azx_codec_configure(struct azx *chip) | ||
1415 | { | ||
1416 | struct hda_codec *codec; | ||
1417 | list_for_each_entry(codec, &chip->bus->codec_list, list) { | ||
1418 | snd_hda_codec_configure(codec); | ||
1419 | } | ||
1405 | return 0; | 1420 | return 0; |
1406 | } | 1421 | } |
1407 | 1422 | ||
@@ -2284,6 +2299,30 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2284 | } | 2299 | } |
2285 | } | 2300 | } |
2286 | 2301 | ||
2302 | /* | ||
2303 | * white-list for enable_msi | ||
2304 | */ | ||
2305 | static struct snd_pci_quirk msi_white_list[] __devinitdata = { | ||
2306 | SND_PCI_QUIRK(0x103c, 0x3607, "HP Compa CQ40", 1), | ||
2307 | {} | ||
2308 | }; | ||
2309 | |||
2310 | static void __devinit check_msi(struct azx *chip) | ||
2311 | { | ||
2312 | const struct snd_pci_quirk *q; | ||
2313 | |||
2314 | chip->msi = enable_msi; | ||
2315 | if (chip->msi) | ||
2316 | return; | ||
2317 | q = snd_pci_quirk_lookup(chip->pci, msi_white_list); | ||
2318 | if (q) { | ||
2319 | printk(KERN_INFO | ||
2320 | "hda_intel: msi for device %04x:%04x set to %d\n", | ||
2321 | q->subvendor, q->subdevice, q->value); | ||
2322 | chip->msi = q->value; | ||
2323 | } | ||
2324 | } | ||
2325 | |||
2287 | 2326 | ||
2288 | /* | 2327 | /* |
2289 | * constructor | 2328 | * constructor |
@@ -2318,7 +2357,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2318 | chip->pci = pci; | 2357 | chip->pci = pci; |
2319 | chip->irq = -1; | 2358 | chip->irq = -1; |
2320 | chip->driver_type = driver_type; | 2359 | chip->driver_type = driver_type; |
2321 | chip->msi = enable_msi; | 2360 | check_msi(chip); |
2322 | chip->dev_index = dev; | 2361 | chip->dev_index = dev; |
2323 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); | 2362 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); |
2324 | 2363 | ||
@@ -2526,15 +2565,32 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2526 | return err; | 2565 | return err; |
2527 | } | 2566 | } |
2528 | 2567 | ||
2568 | /* set this here since it's referred in snd_hda_load_patch() */ | ||
2569 | snd_card_set_dev(card, &pci->dev); | ||
2570 | |||
2529 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); | 2571 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); |
2530 | if (err < 0) | 2572 | if (err < 0) |
2531 | goto out_free; | 2573 | goto out_free; |
2532 | card->private_data = chip; | 2574 | card->private_data = chip; |
2533 | 2575 | ||
2534 | /* create codec instances */ | 2576 | /* create codec instances */ |
2535 | err = azx_codec_create(chip, model[dev], probe_only[dev]); | 2577 | err = azx_codec_create(chip, model[dev]); |
2536 | if (err < 0) | 2578 | if (err < 0) |
2537 | goto out_free; | 2579 | goto out_free; |
2580 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
2581 | if (patch[dev]) { | ||
2582 | snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", | ||
2583 | patch[dev]); | ||
2584 | err = snd_hda_load_patch(chip->bus, patch[dev]); | ||
2585 | if (err < 0) | ||
2586 | goto out_free; | ||
2587 | } | ||
2588 | #endif | ||
2589 | if (!probe_only[dev]) { | ||
2590 | err = azx_codec_configure(chip); | ||
2591 | if (err < 0) | ||
2592 | goto out_free; | ||
2593 | } | ||
2538 | 2594 | ||
2539 | /* create PCM streams */ | 2595 | /* create PCM streams */ |
2540 | err = snd_hda_build_pcms(chip->bus); | 2596 | err = snd_hda_build_pcms(chip->bus); |
@@ -2546,8 +2602,6 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2546 | if (err < 0) | 2602 | if (err < 0) |
2547 | goto out_free; | 2603 | goto out_free; |
2548 | 2604 | ||
2549 | snd_card_set_dev(card, &pci->dev); | ||
2550 | |||
2551 | err = snd_card_register(card); | 2605 | err = snd_card_register(card); |
2552 | if (err < 0) | 2606 | if (err < 0) |
2553 | goto out_free; | 2607 | goto out_free; |
@@ -2649,11 +2703,15 @@ static struct pci_device_id azx_ids[] = { | |||
2649 | /* this entry seems still valid -- i.e. without emu20kx chip */ | 2703 | /* this entry seems still valid -- i.e. without emu20kx chip */ |
2650 | { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_GENERIC }, | 2704 | { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_GENERIC }, |
2651 | #endif | 2705 | #endif |
2652 | /* AMD Generic, PCI class code and Vendor ID for HD Audio */ | 2706 | /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ |
2653 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), | 2707 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), |
2654 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | 2708 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2655 | .class_mask = 0xffffff, | 2709 | .class_mask = 0xffffff, |
2656 | .driver_data = AZX_DRIVER_GENERIC }, | 2710 | .driver_data = AZX_DRIVER_GENERIC }, |
2711 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_ANY_ID), | ||
2712 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | ||
2713 | .class_mask = 0xffffff, | ||
2714 | .driver_data = AZX_DRIVER_GENERIC }, | ||
2657 | { 0, } | 2715 | { 0, } |
2658 | }; | 2716 | }; |
2659 | MODULE_DEVICE_TABLE(pci, azx_ids); | 2717 | MODULE_DEVICE_TABLE(pci, azx_ids); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 83349013b4df..5f1dcc59002b 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -99,7 +99,6 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
99 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | 99 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, |
100 | unsigned int *tlv, const char **slaves); | 100 | unsigned int *tlv, const char **slaves); |
101 | int snd_hda_codec_reset(struct hda_codec *codec); | 101 | int snd_hda_codec_reset(struct hda_codec *codec); |
102 | int snd_hda_codec_configure(struct hda_codec *codec); | ||
103 | 102 | ||
104 | /* amp value bits */ | 103 | /* amp value bits */ |
105 | #define HDA_AMP_MUTE 0x80 | 104 | #define HDA_AMP_MUTE 0x80 |
@@ -408,6 +407,19 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) | |||
408 | return codec->wcaps[nid - codec->start_nid]; | 407 | return codec->wcaps[nid - codec->start_nid]; |
409 | } | 408 | } |
410 | 409 | ||
410 | /* get the widget type from widget capability bits */ | ||
411 | #define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) | ||
412 | |||
413 | static inline unsigned int get_wcaps_channels(u32 wcaps) | ||
414 | { | ||
415 | unsigned int chans; | ||
416 | |||
417 | chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13; | ||
418 | chans = ((chans << 1) | 1) + 1; | ||
419 | |||
420 | return chans; | ||
421 | } | ||
422 | |||
411 | u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); | 423 | u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); |
412 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | 424 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, |
413 | unsigned int caps); | 425 | unsigned int caps); |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 418c5d1badaa..95f24e4729f8 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -508,17 +508,14 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
508 | unsigned int wid_caps = | 508 | unsigned int wid_caps = |
509 | snd_hda_param_read(codec, nid, | 509 | snd_hda_param_read(codec, nid, |
510 | AC_PAR_AUDIO_WIDGET_CAP); | 510 | AC_PAR_AUDIO_WIDGET_CAP); |
511 | unsigned int wid_type = | 511 | unsigned int wid_type = get_wcaps_type(wid_caps); |
512 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
513 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; | 512 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
514 | int conn_len = 0; | 513 | int conn_len = 0; |
515 | 514 | ||
516 | snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, | 515 | snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, |
517 | get_wid_type_name(wid_type), wid_caps); | 516 | get_wid_type_name(wid_type), wid_caps); |
518 | if (wid_caps & AC_WCAP_STEREO) { | 517 | if (wid_caps & AC_WCAP_STEREO) { |
519 | unsigned int chans; | 518 | unsigned int chans = get_wcaps_channels(wid_caps); |
520 | chans = (wid_caps & AC_WCAP_CHAN_CNT_EXT) >> 13; | ||
521 | chans = ((chans << 1) | 1) + 1; | ||
522 | if (chans == 2) | 519 | if (chans == 2) |
523 | snd_iprintf(buffer, " Stereo"); | 520 | snd_iprintf(buffer, " Stereo"); |
524 | else | 521 | else |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 403588c6e3f6..215e72a87113 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -2982,7 +2982,8 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2982 | board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, | 2982 | board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, |
2983 | ad1988_models, ad1988_cfg_tbl); | 2983 | ad1988_models, ad1988_cfg_tbl); |
2984 | if (board_config < 0) { | 2984 | if (board_config < 0) { |
2985 | printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); | 2985 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
2986 | codec->chip_name); | ||
2986 | board_config = AD1988_AUTO; | 2987 | board_config = AD1988_AUTO; |
2987 | } | 2988 | } |
2988 | 2989 | ||
@@ -3702,19 +3703,29 @@ static struct hda_amp_list ad1884a_loopbacks[] = { | |||
3702 | * Port F: Internal speakers | 3703 | * Port F: Internal speakers |
3703 | */ | 3704 | */ |
3704 | 3705 | ||
3705 | static struct hda_input_mux ad1884a_laptop_capture_source = { | 3706 | static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, |
3706 | .num_items = 4, | 3707 | struct snd_ctl_elem_value *ucontrol) |
3707 | .items = { | 3708 | { |
3708 | { "Mic", 0x0 }, /* port-B */ | 3709 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
3709 | { "Internal Mic", 0x1 }, /* port-C */ | 3710 | int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); |
3710 | { "Dock Mic", 0x4 }, /* port-E */ | 3711 | int mute = (!ucontrol->value.integer.value[0] && |
3711 | { "Mix", 0x3 }, | 3712 | !ucontrol->value.integer.value[1]); |
3712 | }, | 3713 | /* toggle GPIO1 according to the mute state */ |
3713 | }; | 3714 | snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
3715 | mute ? 0x02 : 0x0); | ||
3716 | return ret; | ||
3717 | } | ||
3714 | 3718 | ||
3715 | static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | 3719 | static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { |
3716 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 3720 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
3717 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 3721 | { |
3722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3723 | .name = "Master Playback Switch", | ||
3724 | .info = snd_hda_mixer_amp_switch_info, | ||
3725 | .get = snd_hda_mixer_amp_switch_get, | ||
3726 | .put = ad1884a_mobile_master_sw_put, | ||
3727 | .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
3728 | }, | ||
3718 | HDA_CODEC_MUTE("Dock Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 3729 | HDA_CODEC_MUTE("Dock Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
3719 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | 3730 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), |
3720 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3731 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
@@ -3729,36 +3740,9 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | |||
3729 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3740 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
3730 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3741 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
3731 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | 3742 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), |
3732 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3733 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3734 | { | ||
3735 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3736 | /* The multiple "Capture Source" controls confuse alsamixer | ||
3737 | * So call somewhat different.. | ||
3738 | */ | ||
3739 | /* .name = "Capture Source", */ | ||
3740 | .name = "Input Source", | ||
3741 | .count = 2, | ||
3742 | .info = ad198x_mux_enum_info, | ||
3743 | .get = ad198x_mux_enum_get, | ||
3744 | .put = ad198x_mux_enum_put, | ||
3745 | }, | ||
3746 | { } /* end */ | 3743 | { } /* end */ |
3747 | }; | 3744 | }; |
3748 | 3745 | ||
3749 | static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, | ||
3750 | struct snd_ctl_elem_value *ucontrol) | ||
3751 | { | ||
3752 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3753 | int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
3754 | int mute = (!ucontrol->value.integer.value[0] && | ||
3755 | !ucontrol->value.integer.value[1]); | ||
3756 | /* toggle GPIO1 according to the mute state */ | ||
3757 | snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | ||
3758 | mute ? 0x02 : 0x0); | ||
3759 | return ret; | ||
3760 | } | ||
3761 | |||
3762 | static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | 3746 | static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { |
3763 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 3747 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
3764 | /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ | 3748 | /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ |
@@ -3828,6 +3812,63 @@ static int ad1884a_hp_init(struct hda_codec *codec) | |||
3828 | return 0; | 3812 | return 0; |
3829 | } | 3813 | } |
3830 | 3814 | ||
3815 | /* mute internal speaker if HP or docking HP is plugged */ | ||
3816 | static void ad1884a_laptop_automute(struct hda_codec *codec) | ||
3817 | { | ||
3818 | unsigned int present; | ||
3819 | |||
3820 | present = snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0); | ||
3821 | present &= AC_PINSENSE_PRESENCE; | ||
3822 | if (!present) { | ||
3823 | present = snd_hda_codec_read(codec, 0x12, 0, | ||
3824 | AC_VERB_GET_PIN_SENSE, 0); | ||
3825 | present &= AC_PINSENSE_PRESENCE; | ||
3826 | } | ||
3827 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
3828 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
3829 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
3830 | present ? 0x00 : 0x02); | ||
3831 | } | ||
3832 | |||
3833 | /* switch to external mic if plugged */ | ||
3834 | static void ad1884a_laptop_automic(struct hda_codec *codec) | ||
3835 | { | ||
3836 | unsigned int idx; | ||
3837 | |||
3838 | if (snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) & | ||
3839 | AC_PINSENSE_PRESENCE) | ||
3840 | idx = 0; | ||
3841 | else if (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) & | ||
3842 | AC_PINSENSE_PRESENCE) | ||
3843 | idx = 4; | ||
3844 | else | ||
3845 | idx = 1; | ||
3846 | snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL, idx); | ||
3847 | } | ||
3848 | |||
3849 | /* unsolicited event for HP jack sensing */ | ||
3850 | static void ad1884a_laptop_unsol_event(struct hda_codec *codec, | ||
3851 | unsigned int res) | ||
3852 | { | ||
3853 | switch (res >> 26) { | ||
3854 | case AD1884A_HP_EVENT: | ||
3855 | ad1884a_laptop_automute(codec); | ||
3856 | break; | ||
3857 | case AD1884A_MIC_EVENT: | ||
3858 | ad1884a_laptop_automic(codec); | ||
3859 | break; | ||
3860 | } | ||
3861 | } | ||
3862 | |||
3863 | /* initialize jack-sensing, too */ | ||
3864 | static int ad1884a_laptop_init(struct hda_codec *codec) | ||
3865 | { | ||
3866 | ad198x_init(codec); | ||
3867 | ad1884a_laptop_automute(codec); | ||
3868 | ad1884a_laptop_automic(codec); | ||
3869 | return 0; | ||
3870 | } | ||
3871 | |||
3831 | /* additional verbs for laptop model */ | 3872 | /* additional verbs for laptop model */ |
3832 | static struct hda_verb ad1884a_laptop_verbs[] = { | 3873 | static struct hda_verb ad1884a_laptop_verbs[] = { |
3833 | /* Port-A (HP) pin - always unmuted */ | 3874 | /* Port-A (HP) pin - always unmuted */ |
@@ -3844,11 +3885,19 @@ static struct hda_verb ad1884a_laptop_verbs[] = { | |||
3844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ | 3886 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ |
3846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ | 3887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ |
3888 | /* Port-D (docking line-out) pin - default unmuted */ | ||
3889 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
3847 | /* analog mix */ | 3890 | /* analog mix */ |
3848 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 3891 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
3849 | /* unsolicited event for pin-sense */ | 3892 | /* unsolicited event for pin-sense */ |
3850 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | 3893 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, |
3894 | {0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | ||
3851 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, | 3895 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, |
3896 | {0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, | ||
3897 | /* allow to touch GPIO1 (for mute control) */ | ||
3898 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | ||
3899 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | ||
3900 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */ | ||
3852 | { } /* end */ | 3901 | { } /* end */ |
3853 | }; | 3902 | }; |
3854 | 3903 | ||
@@ -4008,6 +4057,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
4008 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30d0, "HP laptop", AD1884A_LAPTOP), | 4057 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30d0, "HP laptop", AD1884A_LAPTOP), |
4009 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), | 4058 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), |
4010 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), | 4059 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), |
4060 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x7010, "HP laptop", AD1884A_MOBILE), | ||
4011 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 4061 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
4012 | {} | 4062 | {} |
4013 | }; | 4063 | }; |
@@ -4057,9 +4107,8 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4057 | spec->mixers[0] = ad1884a_laptop_mixers; | 4107 | spec->mixers[0] = ad1884a_laptop_mixers; |
4058 | spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; | 4108 | spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; |
4059 | spec->multiout.dig_out_nid = 0; | 4109 | spec->multiout.dig_out_nid = 0; |
4060 | spec->input_mux = &ad1884a_laptop_capture_source; | 4110 | codec->patch_ops.unsol_event = ad1884a_laptop_unsol_event; |
4061 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; | 4111 | codec->patch_ops.init = ad1884a_laptop_init; |
4062 | codec->patch_ops.init = ad1884a_hp_init; | ||
4063 | /* set the upper-limit for mixer amp to 0dB for avoiding the | 4112 | /* set the upper-limit for mixer amp to 0dB for avoiding the |
4064 | * possible damage by overloading | 4113 | * possible damage by overloading |
4065 | */ | 4114 | */ |
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c index 233e4778bba9..fb684f00156b 100644 --- a/sound/pci/hda/patch_atihdmi.c +++ b/sound/pci/hda/patch_atihdmi.c | |||
@@ -141,8 +141,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec) | |||
141 | /* FIXME: we must check ELD and change the PCM parameters dynamically | 141 | /* FIXME: we must check ELD and change the PCM parameters dynamically |
142 | */ | 142 | */ |
143 | chans = get_wcaps(codec, CVT_NID); | 143 | chans = get_wcaps(codec, CVT_NID); |
144 | chans = (chans & AC_WCAP_CHAN_CNT_EXT) >> 13; | 144 | chans = get_wcaps_channels(chans); |
145 | chans = ((chans << 1) | 1) + 1; | ||
146 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | 145 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; |
147 | 146 | ||
148 | return 0; | 147 | return 0; |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 019ca7cb56d7..d08353d3bb7f 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -459,8 +459,7 @@ static void parse_input(struct hda_codec *codec) | |||
459 | nid = codec->start_nid; | 459 | nid = codec->start_nid; |
460 | for (i = 0; i < codec->num_nodes; i++, nid++) { | 460 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
461 | unsigned int wcaps = get_wcaps(codec, nid); | 461 | unsigned int wcaps = get_wcaps(codec, nid); |
462 | unsigned int type = (wcaps & AC_WCAP_TYPE) >> | 462 | unsigned int type = get_wcaps_type(wcaps); |
463 | AC_WCAP_TYPE_SHIFT; | ||
464 | if (type != AC_WID_AUD_IN) | 463 | if (type != AC_WID_AUD_IN) |
465 | continue; | 464 | continue; |
466 | if (snd_hda_get_connections(codec, nid, &pin, 1) != 1) | 465 | if (snd_hda_get_connections(codec, nid, &pin, 1) != 1) |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c new file mode 100644 index 000000000000..8ba306856d38 --- /dev/null +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -0,0 +1,1194 @@ | |||
1 | /* | ||
2 | * HD audio interface patch for Cirrus Logic CS420x chip | ||
3 | * | ||
4 | * Copyright (c) 2009 Takashi Iwai <tiwai@suse.de> | ||
5 | * | ||
6 | * This driver is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This driver is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/pci.h> | ||
25 | #include <sound/core.h> | ||
26 | #include "hda_codec.h" | ||
27 | #include "hda_local.h" | ||
28 | |||
29 | /* | ||
30 | */ | ||
31 | |||
32 | struct cs_spec { | ||
33 | int board_config; | ||
34 | struct auto_pin_cfg autocfg; | ||
35 | struct hda_multi_out multiout; | ||
36 | struct snd_kcontrol *vmaster_sw; | ||
37 | struct snd_kcontrol *vmaster_vol; | ||
38 | |||
39 | hda_nid_t dac_nid[AUTO_CFG_MAX_OUTS]; | ||
40 | hda_nid_t slave_dig_outs[2]; | ||
41 | |||
42 | unsigned int input_idx[AUTO_PIN_LAST]; | ||
43 | unsigned int capsrc_idx[AUTO_PIN_LAST]; | ||
44 | hda_nid_t adc_nid[AUTO_PIN_LAST]; | ||
45 | unsigned int adc_idx[AUTO_PIN_LAST]; | ||
46 | unsigned int num_inputs; | ||
47 | unsigned int cur_input; | ||
48 | unsigned int automic_idx; | ||
49 | hda_nid_t cur_adc; | ||
50 | unsigned int cur_adc_stream_tag; | ||
51 | unsigned int cur_adc_format; | ||
52 | hda_nid_t dig_in; | ||
53 | |||
54 | struct hda_bind_ctls *capture_bind[2]; | ||
55 | |||
56 | unsigned int gpio_mask; | ||
57 | unsigned int gpio_dir; | ||
58 | unsigned int gpio_data; | ||
59 | |||
60 | struct hda_pcm pcm_rec[2]; /* PCM information */ | ||
61 | |||
62 | unsigned int hp_detect:1; | ||
63 | unsigned int mic_detect:1; | ||
64 | }; | ||
65 | |||
66 | /* available models */ | ||
67 | enum { | ||
68 | CS420X_MBP55, | ||
69 | CS420X_AUTO, | ||
70 | CS420X_MODELS | ||
71 | }; | ||
72 | |||
73 | /* Vendor-specific processing widget */ | ||
74 | #define CS420X_VENDOR_NID 0x11 | ||
75 | #define CS_DIG_OUT1_PIN_NID 0x10 | ||
76 | #define CS_DIG_OUT2_PIN_NID 0x15 | ||
77 | #define CS_DMIC1_PIN_NID 0x12 | ||
78 | #define CS_DMIC2_PIN_NID 0x0e | ||
79 | |||
80 | /* coef indices */ | ||
81 | #define IDX_SPDIF_STAT 0x0000 | ||
82 | #define IDX_SPDIF_CTL 0x0001 | ||
83 | #define IDX_ADC_CFG 0x0002 | ||
84 | /* SZC bitmask, 4 modes below: | ||
85 | * 0 = immediate, | ||
86 | * 1 = digital immediate, analog zero-cross | ||
87 | * 2 = digtail & analog soft-ramp | ||
88 | * 3 = digital soft-ramp, analog zero-cross | ||
89 | */ | ||
90 | #define CS_COEF_ADC_SZC_MASK (3 << 0) | ||
91 | #define CS_COEF_ADC_MIC_SZC_MODE (3 << 0) /* SZC setup for mic */ | ||
92 | #define CS_COEF_ADC_LI_SZC_MODE (3 << 0) /* SZC setup for line-in */ | ||
93 | /* PGA mode: 0 = differential, 1 = signle-ended */ | ||
94 | #define CS_COEF_ADC_MIC_PGA_MODE (1 << 5) /* PGA setup for mic */ | ||
95 | #define CS_COEF_ADC_LI_PGA_MODE (1 << 6) /* PGA setup for line-in */ | ||
96 | #define IDX_DAC_CFG 0x0003 | ||
97 | /* SZC bitmask, 4 modes below: | ||
98 | * 0 = Immediate | ||
99 | * 1 = zero-cross | ||
100 | * 2 = soft-ramp | ||
101 | * 3 = soft-ramp on zero-cross | ||
102 | */ | ||
103 | #define CS_COEF_DAC_HP_SZC_MODE (3 << 0) /* nid 0x02 */ | ||
104 | #define CS_COEF_DAC_LO_SZC_MODE (3 << 2) /* nid 0x03 */ | ||
105 | #define CS_COEF_DAC_SPK_SZC_MODE (3 << 4) /* nid 0x04 */ | ||
106 | |||
107 | #define IDX_BEEP_CFG 0x0004 | ||
108 | /* 0x0008 - test reg key */ | ||
109 | /* 0x0009 - 0x0014 -> 12 test regs */ | ||
110 | /* 0x0015 - visibility reg */ | ||
111 | |||
112 | |||
113 | static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) | ||
114 | { | ||
115 | snd_hda_codec_write(codec, CS420X_VENDOR_NID, 0, | ||
116 | AC_VERB_SET_COEF_INDEX, idx); | ||
117 | return snd_hda_codec_read(codec, CS420X_VENDOR_NID, 0, | ||
118 | AC_VERB_GET_PROC_COEF, 0); | ||
119 | } | ||
120 | |||
121 | static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, | ||
122 | unsigned int coef) | ||
123 | { | ||
124 | snd_hda_codec_write(codec, CS420X_VENDOR_NID, 0, | ||
125 | AC_VERB_SET_COEF_INDEX, idx); | ||
126 | snd_hda_codec_write(codec, CS420X_VENDOR_NID, 0, | ||
127 | AC_VERB_SET_PROC_COEF, coef); | ||
128 | } | ||
129 | |||
130 | |||
131 | #define HP_EVENT 1 | ||
132 | #define MIC_EVENT 2 | ||
133 | |||
134 | /* | ||
135 | * PCM callbacks | ||
136 | */ | ||
137 | static int cs_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
138 | struct hda_codec *codec, | ||
139 | struct snd_pcm_substream *substream) | ||
140 | { | ||
141 | struct cs_spec *spec = codec->spec; | ||
142 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | ||
143 | hinfo); | ||
144 | } | ||
145 | |||
146 | static int cs_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
147 | struct hda_codec *codec, | ||
148 | unsigned int stream_tag, | ||
149 | unsigned int format, | ||
150 | struct snd_pcm_substream *substream) | ||
151 | { | ||
152 | struct cs_spec *spec = codec->spec; | ||
153 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | ||
154 | stream_tag, format, substream); | ||
155 | } | ||
156 | |||
157 | static int cs_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
158 | struct hda_codec *codec, | ||
159 | struct snd_pcm_substream *substream) | ||
160 | { | ||
161 | struct cs_spec *spec = codec->spec; | ||
162 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * Digital out | ||
167 | */ | ||
168 | static int cs_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
169 | struct hda_codec *codec, | ||
170 | struct snd_pcm_substream *substream) | ||
171 | { | ||
172 | struct cs_spec *spec = codec->spec; | ||
173 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | ||
174 | } | ||
175 | |||
176 | static int cs_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
177 | struct hda_codec *codec, | ||
178 | struct snd_pcm_substream *substream) | ||
179 | { | ||
180 | struct cs_spec *spec = codec->spec; | ||
181 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | ||
182 | } | ||
183 | |||
184 | static int cs_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
185 | struct hda_codec *codec, | ||
186 | unsigned int stream_tag, | ||
187 | unsigned int format, | ||
188 | struct snd_pcm_substream *substream) | ||
189 | { | ||
190 | struct cs_spec *spec = codec->spec; | ||
191 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | ||
192 | format, substream); | ||
193 | } | ||
194 | |||
195 | static int cs_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
196 | struct hda_codec *codec, | ||
197 | struct snd_pcm_substream *substream) | ||
198 | { | ||
199 | struct cs_spec *spec = codec->spec; | ||
200 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | ||
201 | } | ||
202 | |||
203 | /* | ||
204 | * Analog capture | ||
205 | */ | ||
206 | static int cs_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
207 | struct hda_codec *codec, | ||
208 | unsigned int stream_tag, | ||
209 | unsigned int format, | ||
210 | struct snd_pcm_substream *substream) | ||
211 | { | ||
212 | struct cs_spec *spec = codec->spec; | ||
213 | spec->cur_adc = spec->adc_nid[spec->cur_input]; | ||
214 | spec->cur_adc_stream_tag = stream_tag; | ||
215 | spec->cur_adc_format = format; | ||
216 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static int cs_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
221 | struct hda_codec *codec, | ||
222 | struct snd_pcm_substream *substream) | ||
223 | { | ||
224 | struct cs_spec *spec = codec->spec; | ||
225 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | ||
226 | spec->cur_adc = 0; | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | /* | ||
231 | */ | ||
232 | static struct hda_pcm_stream cs_pcm_analog_playback = { | ||
233 | .substreams = 1, | ||
234 | .channels_min = 2, | ||
235 | .channels_max = 2, | ||
236 | .ops = { | ||
237 | .open = cs_playback_pcm_open, | ||
238 | .prepare = cs_playback_pcm_prepare, | ||
239 | .cleanup = cs_playback_pcm_cleanup | ||
240 | }, | ||
241 | }; | ||
242 | |||
243 | static struct hda_pcm_stream cs_pcm_analog_capture = { | ||
244 | .substreams = 1, | ||
245 | .channels_min = 2, | ||
246 | .channels_max = 2, | ||
247 | .ops = { | ||
248 | .prepare = cs_capture_pcm_prepare, | ||
249 | .cleanup = cs_capture_pcm_cleanup | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct hda_pcm_stream cs_pcm_digital_playback = { | ||
254 | .substreams = 1, | ||
255 | .channels_min = 2, | ||
256 | .channels_max = 2, | ||
257 | .ops = { | ||
258 | .open = cs_dig_playback_pcm_open, | ||
259 | .close = cs_dig_playback_pcm_close, | ||
260 | .prepare = cs_dig_playback_pcm_prepare, | ||
261 | .cleanup = cs_dig_playback_pcm_cleanup | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static struct hda_pcm_stream cs_pcm_digital_capture = { | ||
266 | .substreams = 1, | ||
267 | .channels_min = 2, | ||
268 | .channels_max = 2, | ||
269 | }; | ||
270 | |||
271 | static int cs_build_pcms(struct hda_codec *codec) | ||
272 | { | ||
273 | struct cs_spec *spec = codec->spec; | ||
274 | struct hda_pcm *info = spec->pcm_rec; | ||
275 | |||
276 | codec->pcm_info = info; | ||
277 | codec->num_pcms = 0; | ||
278 | |||
279 | info->name = "Cirrus Analog"; | ||
280 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = cs_pcm_analog_playback; | ||
281 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dac_nid[0]; | ||
282 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = | ||
283 | spec->multiout.max_channels; | ||
284 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = cs_pcm_analog_capture; | ||
285 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | ||
286 | spec->adc_nid[spec->cur_input]; | ||
287 | codec->num_pcms++; | ||
288 | |||
289 | if (!spec->multiout.dig_out_nid && !spec->dig_in) | ||
290 | return 0; | ||
291 | |||
292 | info++; | ||
293 | info->name = "Cirrus Digital"; | ||
294 | info->pcm_type = spec->autocfg.dig_out_type[0]; | ||
295 | if (!info->pcm_type) | ||
296 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
297 | if (spec->multiout.dig_out_nid) { | ||
298 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | ||
299 | cs_pcm_digital_playback; | ||
300 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | ||
301 | spec->multiout.dig_out_nid; | ||
302 | } | ||
303 | if (spec->dig_in) { | ||
304 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
305 | cs_pcm_digital_capture; | ||
306 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; | ||
307 | } | ||
308 | codec->num_pcms++; | ||
309 | |||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | /* | ||
314 | * parse codec topology | ||
315 | */ | ||
316 | |||
317 | static hda_nid_t get_dac(struct hda_codec *codec, hda_nid_t pin) | ||
318 | { | ||
319 | hda_nid_t dac; | ||
320 | if (!pin) | ||
321 | return 0; | ||
322 | if (snd_hda_get_connections(codec, pin, &dac, 1) != 1) | ||
323 | return 0; | ||
324 | return dac; | ||
325 | } | ||
326 | |||
327 | static int is_ext_mic(struct hda_codec *codec, unsigned int idx) | ||
328 | { | ||
329 | struct cs_spec *spec = codec->spec; | ||
330 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
331 | hda_nid_t pin = cfg->input_pins[idx]; | ||
332 | unsigned int val = snd_hda_query_pin_caps(codec, pin); | ||
333 | if (!(val & AC_PINCAP_PRES_DETECT)) | ||
334 | return 0; | ||
335 | val = snd_hda_codec_get_pincfg(codec, pin); | ||
336 | return (get_defcfg_connect(val) == AC_JACK_PORT_COMPLEX); | ||
337 | } | ||
338 | |||
339 | static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin, | ||
340 | unsigned int *idxp) | ||
341 | { | ||
342 | int i; | ||
343 | hda_nid_t nid; | ||
344 | |||
345 | nid = codec->start_nid; | ||
346 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
347 | hda_nid_t pins[2]; | ||
348 | unsigned int type; | ||
349 | int j, nums; | ||
350 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) | ||
351 | >> AC_WCAP_TYPE_SHIFT; | ||
352 | if (type != AC_WID_AUD_IN) | ||
353 | continue; | ||
354 | nums = snd_hda_get_connections(codec, nid, pins, | ||
355 | ARRAY_SIZE(pins)); | ||
356 | if (nums <= 0) | ||
357 | continue; | ||
358 | for (j = 0; j < nums; j++) { | ||
359 | if (pins[j] == pin) { | ||
360 | *idxp = j; | ||
361 | return nid; | ||
362 | } | ||
363 | } | ||
364 | } | ||
365 | return 0; | ||
366 | } | ||
367 | |||
368 | static int is_active_pin(struct hda_codec *codec, hda_nid_t nid) | ||
369 | { | ||
370 | unsigned int val; | ||
371 | val = snd_hda_codec_get_pincfg(codec, nid); | ||
372 | return (get_defcfg_connect(val) != AC_JACK_PORT_NONE); | ||
373 | } | ||
374 | |||
375 | static int parse_output(struct hda_codec *codec) | ||
376 | { | ||
377 | struct cs_spec *spec = codec->spec; | ||
378 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
379 | int i, extra_nids; | ||
380 | hda_nid_t dac; | ||
381 | |||
382 | for (i = 0; i < cfg->line_outs; i++) { | ||
383 | dac = get_dac(codec, cfg->line_out_pins[i]); | ||
384 | if (!dac) | ||
385 | break; | ||
386 | spec->dac_nid[i] = dac; | ||
387 | } | ||
388 | spec->multiout.num_dacs = i; | ||
389 | spec->multiout.dac_nids = spec->dac_nid; | ||
390 | spec->multiout.max_channels = i * 2; | ||
391 | |||
392 | /* add HP and speakers */ | ||
393 | extra_nids = 0; | ||
394 | for (i = 0; i < cfg->hp_outs; i++) { | ||
395 | dac = get_dac(codec, cfg->hp_pins[i]); | ||
396 | if (!dac) | ||
397 | break; | ||
398 | if (!i) | ||
399 | spec->multiout.hp_nid = dac; | ||
400 | else | ||
401 | spec->multiout.extra_out_nid[extra_nids++] = dac; | ||
402 | } | ||
403 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
404 | dac = get_dac(codec, cfg->speaker_pins[i]); | ||
405 | if (!dac) | ||
406 | break; | ||
407 | spec->multiout.extra_out_nid[extra_nids++] = dac; | ||
408 | } | ||
409 | |||
410 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
411 | cfg->speaker_outs = cfg->line_outs; | ||
412 | memcpy(cfg->speaker_pins, cfg->line_out_pins, | ||
413 | sizeof(cfg->speaker_pins)); | ||
414 | cfg->line_outs = 0; | ||
415 | } | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | static int parse_input(struct hda_codec *codec) | ||
421 | { | ||
422 | struct cs_spec *spec = codec->spec; | ||
423 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
424 | int i; | ||
425 | |||
426 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
427 | hda_nid_t pin = cfg->input_pins[i]; | ||
428 | if (!pin) | ||
429 | continue; | ||
430 | spec->input_idx[spec->num_inputs] = i; | ||
431 | spec->capsrc_idx[i] = spec->num_inputs++; | ||
432 | spec->cur_input = i; | ||
433 | spec->adc_nid[i] = get_adc(codec, pin, &spec->adc_idx[i]); | ||
434 | } | ||
435 | if (!spec->num_inputs) | ||
436 | return 0; | ||
437 | |||
438 | /* check whether the automatic mic switch is available */ | ||
439 | if (spec->num_inputs == 2 && | ||
440 | spec->adc_nid[AUTO_PIN_MIC] && spec->adc_nid[AUTO_PIN_FRONT_MIC]) { | ||
441 | if (is_ext_mic(codec, cfg->input_pins[AUTO_PIN_FRONT_MIC])) { | ||
442 | if (!is_ext_mic(codec, cfg->input_pins[AUTO_PIN_MIC])) { | ||
443 | spec->mic_detect = 1; | ||
444 | spec->automic_idx = AUTO_PIN_FRONT_MIC; | ||
445 | } | ||
446 | } else { | ||
447 | if (is_ext_mic(codec, cfg->input_pins[AUTO_PIN_MIC])) { | ||
448 | spec->mic_detect = 1; | ||
449 | spec->automic_idx = AUTO_PIN_MIC; | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | |||
457 | static int parse_digital_output(struct hda_codec *codec) | ||
458 | { | ||
459 | struct cs_spec *spec = codec->spec; | ||
460 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
461 | hda_nid_t nid; | ||
462 | |||
463 | if (!cfg->dig_outs) | ||
464 | return 0; | ||
465 | if (snd_hda_get_connections(codec, cfg->dig_out_pins[0], &nid, 1) < 1) | ||
466 | return 0; | ||
467 | spec->multiout.dig_out_nid = nid; | ||
468 | spec->multiout.share_spdif = 1; | ||
469 | if (cfg->dig_outs > 1 && | ||
470 | snd_hda_get_connections(codec, cfg->dig_out_pins[1], &nid, 1) > 0) { | ||
471 | spec->slave_dig_outs[0] = nid; | ||
472 | codec->slave_dig_outs = spec->slave_dig_outs; | ||
473 | } | ||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | static int parse_digital_input(struct hda_codec *codec) | ||
478 | { | ||
479 | struct cs_spec *spec = codec->spec; | ||
480 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
481 | int idx; | ||
482 | |||
483 | if (cfg->dig_in_pin) | ||
484 | spec->dig_in = get_adc(codec, cfg->dig_in_pin, &idx); | ||
485 | return 0; | ||
486 | } | ||
487 | |||
488 | /* | ||
489 | * create mixer controls | ||
490 | */ | ||
491 | |||
492 | static const char *dir_sfx[2] = { "Playback", "Capture" }; | ||
493 | |||
494 | static int add_mute(struct hda_codec *codec, const char *name, int index, | ||
495 | unsigned int pval, int dir, struct snd_kcontrol **kctlp) | ||
496 | { | ||
497 | char tmp[44]; | ||
498 | struct snd_kcontrol_new knew = | ||
499 | HDA_CODEC_MUTE_IDX(tmp, index, 0, 0, HDA_OUTPUT); | ||
500 | knew.private_value = pval; | ||
501 | snprintf(tmp, sizeof(tmp), "%s %s Switch", name, dir_sfx[dir]); | ||
502 | *kctlp = snd_ctl_new1(&knew, codec); | ||
503 | return snd_hda_ctl_add(codec, *kctlp); | ||
504 | } | ||
505 | |||
506 | static int add_volume(struct hda_codec *codec, const char *name, | ||
507 | int index, unsigned int pval, int dir, | ||
508 | struct snd_kcontrol **kctlp) | ||
509 | { | ||
510 | char tmp[32]; | ||
511 | struct snd_kcontrol_new knew = | ||
512 | HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT); | ||
513 | knew.private_value = pval; | ||
514 | snprintf(tmp, sizeof(tmp), "%s %s Volume", name, dir_sfx[dir]); | ||
515 | *kctlp = snd_ctl_new1(&knew, codec); | ||
516 | return snd_hda_ctl_add(codec, *kctlp); | ||
517 | } | ||
518 | |||
519 | static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) | ||
520 | { | ||
521 | unsigned int caps; | ||
522 | |||
523 | /* set the upper-limit for mixer amp to 0dB */ | ||
524 | caps = query_amp_caps(codec, dac, HDA_OUTPUT); | ||
525 | caps &= ~(0x7f << AC_AMPCAP_NUM_STEPS_SHIFT); | ||
526 | caps |= ((caps >> AC_AMPCAP_OFFSET_SHIFT) & 0x7f) | ||
527 | << AC_AMPCAP_NUM_STEPS_SHIFT; | ||
528 | snd_hda_override_amp_caps(codec, dac, HDA_OUTPUT, caps); | ||
529 | } | ||
530 | |||
531 | static int add_vmaster(struct hda_codec *codec, hda_nid_t dac) | ||
532 | { | ||
533 | struct cs_spec *spec = codec->spec; | ||
534 | unsigned int tlv[4]; | ||
535 | int err; | ||
536 | |||
537 | spec->vmaster_sw = | ||
538 | snd_ctl_make_virtual_master("Master Playback Switch", NULL); | ||
539 | err = snd_hda_ctl_add(codec, spec->vmaster_sw); | ||
540 | if (err < 0) | ||
541 | return err; | ||
542 | |||
543 | snd_hda_set_vmaster_tlv(codec, dac, HDA_OUTPUT, tlv); | ||
544 | spec->vmaster_vol = | ||
545 | snd_ctl_make_virtual_master("Master Playback Volume", tlv); | ||
546 | err = snd_hda_ctl_add(codec, spec->vmaster_vol); | ||
547 | if (err < 0) | ||
548 | return err; | ||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx, | ||
553 | int num_ctls, int type) | ||
554 | { | ||
555 | struct cs_spec *spec = codec->spec; | ||
556 | const char *name; | ||
557 | int err, index; | ||
558 | struct snd_kcontrol *kctl; | ||
559 | static char *speakers[] = { | ||
560 | "Front Speaker", "Surround Speaker", "Bass Speaker" | ||
561 | }; | ||
562 | static char *line_outs[] = { | ||
563 | "Front Line-Out", "Surround Line-Out", "Bass Line-Out" | ||
564 | }; | ||
565 | |||
566 | fix_volume_caps(codec, dac); | ||
567 | if (!spec->vmaster_sw) { | ||
568 | err = add_vmaster(codec, dac); | ||
569 | if (err < 0) | ||
570 | return err; | ||
571 | } | ||
572 | |||
573 | index = 0; | ||
574 | switch (type) { | ||
575 | case AUTO_PIN_HP_OUT: | ||
576 | name = "Headphone"; | ||
577 | index = idx; | ||
578 | break; | ||
579 | case AUTO_PIN_SPEAKER_OUT: | ||
580 | if (num_ctls > 1) | ||
581 | name = speakers[idx]; | ||
582 | else | ||
583 | name = "Speaker"; | ||
584 | break; | ||
585 | default: | ||
586 | if (num_ctls > 1) | ||
587 | name = line_outs[idx]; | ||
588 | else | ||
589 | name = "Line-Out"; | ||
590 | break; | ||
591 | } | ||
592 | |||
593 | err = add_mute(codec, name, index, | ||
594 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); | ||
595 | if (err < 0) | ||
596 | return err; | ||
597 | err = snd_ctl_add_slave(spec->vmaster_sw, kctl); | ||
598 | if (err < 0) | ||
599 | return err; | ||
600 | |||
601 | err = add_volume(codec, name, index, | ||
602 | HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); | ||
603 | if (err < 0) | ||
604 | return err; | ||
605 | err = snd_ctl_add_slave(spec->vmaster_vol, kctl); | ||
606 | if (err < 0) | ||
607 | return err; | ||
608 | |||
609 | return 0; | ||
610 | } | ||
611 | |||
612 | static int build_output(struct hda_codec *codec) | ||
613 | { | ||
614 | struct cs_spec *spec = codec->spec; | ||
615 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
616 | int i, err; | ||
617 | |||
618 | for (i = 0; i < cfg->line_outs; i++) { | ||
619 | err = add_output(codec, get_dac(codec, cfg->line_out_pins[i]), | ||
620 | i, cfg->line_outs, cfg->line_out_type); | ||
621 | if (err < 0) | ||
622 | return err; | ||
623 | } | ||
624 | for (i = 0; i < cfg->hp_outs; i++) { | ||
625 | err = add_output(codec, get_dac(codec, cfg->hp_pins[i]), | ||
626 | i, cfg->hp_outs, AUTO_PIN_HP_OUT); | ||
627 | if (err < 0) | ||
628 | return err; | ||
629 | } | ||
630 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
631 | err = add_output(codec, get_dac(codec, cfg->speaker_pins[i]), | ||
632 | i, cfg->speaker_outs, AUTO_PIN_SPEAKER_OUT); | ||
633 | if (err < 0) | ||
634 | return err; | ||
635 | } | ||
636 | return 0; | ||
637 | } | ||
638 | |||
639 | /* | ||
640 | */ | ||
641 | |||
642 | static struct snd_kcontrol_new cs_capture_ctls[] = { | ||
643 | HDA_BIND_SW("Capture Switch", 0), | ||
644 | HDA_BIND_VOL("Capture Volume", 0), | ||
645 | }; | ||
646 | |||
647 | static int change_cur_input(struct hda_codec *codec, unsigned int idx, | ||
648 | int force) | ||
649 | { | ||
650 | struct cs_spec *spec = codec->spec; | ||
651 | |||
652 | if (spec->cur_input == idx && !force) | ||
653 | return 0; | ||
654 | if (spec->cur_adc && spec->cur_adc != spec->adc_nid[idx]) { | ||
655 | /* stream is running, let's swap the current ADC */ | ||
656 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | ||
657 | spec->cur_adc = spec->adc_nid[idx]; | ||
658 | snd_hda_codec_setup_stream(codec, spec->cur_adc, | ||
659 | spec->cur_adc_stream_tag, 0, | ||
660 | spec->cur_adc_format); | ||
661 | } | ||
662 | snd_hda_codec_write(codec, spec->cur_adc, 0, | ||
663 | AC_VERB_SET_CONNECT_SEL, | ||
664 | spec->adc_idx[idx]); | ||
665 | spec->cur_input = idx; | ||
666 | return 1; | ||
667 | } | ||
668 | |||
669 | static int cs_capture_source_info(struct snd_kcontrol *kcontrol, | ||
670 | struct snd_ctl_elem_info *uinfo) | ||
671 | { | ||
672 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
673 | struct cs_spec *spec = codec->spec; | ||
674 | unsigned int idx; | ||
675 | |||
676 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
677 | uinfo->count = 1; | ||
678 | uinfo->value.enumerated.items = spec->num_inputs; | ||
679 | if (uinfo->value.enumerated.item >= spec->num_inputs) | ||
680 | uinfo->value.enumerated.item = spec->num_inputs - 1; | ||
681 | idx = spec->input_idx[uinfo->value.enumerated.item]; | ||
682 | strcpy(uinfo->value.enumerated.name, auto_pin_cfg_labels[idx]); | ||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | static int cs_capture_source_get(struct snd_kcontrol *kcontrol, | ||
687 | struct snd_ctl_elem_value *ucontrol) | ||
688 | { | ||
689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
690 | struct cs_spec *spec = codec->spec; | ||
691 | ucontrol->value.enumerated.item[0] = spec->capsrc_idx[spec->cur_input]; | ||
692 | return 0; | ||
693 | } | ||
694 | |||
695 | static int cs_capture_source_put(struct snd_kcontrol *kcontrol, | ||
696 | struct snd_ctl_elem_value *ucontrol) | ||
697 | { | ||
698 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
699 | struct cs_spec *spec = codec->spec; | ||
700 | unsigned int idx = ucontrol->value.enumerated.item[0]; | ||
701 | |||
702 | if (idx >= spec->num_inputs) | ||
703 | return -EINVAL; | ||
704 | idx = spec->input_idx[idx]; | ||
705 | return change_cur_input(codec, idx, 0); | ||
706 | } | ||
707 | |||
708 | static struct snd_kcontrol_new cs_capture_source = { | ||
709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
710 | .name = "Capture Source", | ||
711 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | ||
712 | .info = cs_capture_source_info, | ||
713 | .get = cs_capture_source_get, | ||
714 | .put = cs_capture_source_put, | ||
715 | }; | ||
716 | |||
717 | static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec, | ||
718 | struct hda_ctl_ops *ops) | ||
719 | { | ||
720 | struct cs_spec *spec = codec->spec; | ||
721 | struct hda_bind_ctls *bind; | ||
722 | int i, n; | ||
723 | |||
724 | bind = kzalloc(sizeof(*bind) + sizeof(long) * (spec->num_inputs + 1), | ||
725 | GFP_KERNEL); | ||
726 | if (!bind) | ||
727 | return NULL; | ||
728 | bind->ops = ops; | ||
729 | n = 0; | ||
730 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
731 | if (!spec->adc_nid[i]) | ||
732 | continue; | ||
733 | bind->values[n++] = | ||
734 | HDA_COMPOSE_AMP_VAL(spec->adc_nid[i], 3, | ||
735 | spec->adc_idx[i], HDA_INPUT); | ||
736 | } | ||
737 | return bind; | ||
738 | } | ||
739 | |||
740 | static int build_input(struct hda_codec *codec) | ||
741 | { | ||
742 | struct cs_spec *spec = codec->spec; | ||
743 | int i, err; | ||
744 | |||
745 | if (!spec->num_inputs) | ||
746 | return 0; | ||
747 | |||
748 | /* make bind-capture */ | ||
749 | spec->capture_bind[0] = make_bind_capture(codec, &snd_hda_bind_sw); | ||
750 | spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); | ||
751 | for (i = 0; i < 2; i++) { | ||
752 | struct snd_kcontrol *kctl; | ||
753 | if (!spec->capture_bind[i]) | ||
754 | return -ENOMEM; | ||
755 | kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); | ||
756 | if (!kctl) | ||
757 | return -ENOMEM; | ||
758 | kctl->private_value = (long)spec->capture_bind[i]; | ||
759 | err = snd_hda_ctl_add(codec, kctl); | ||
760 | if (err < 0) | ||
761 | return err; | ||
762 | } | ||
763 | |||
764 | if (spec->num_inputs > 1 && !spec->mic_detect) { | ||
765 | err = snd_hda_ctl_add(codec, | ||
766 | snd_ctl_new1(&cs_capture_source, codec)); | ||
767 | if (err < 0) | ||
768 | return err; | ||
769 | } | ||
770 | |||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | /* | ||
775 | */ | ||
776 | |||
777 | static int build_digital_output(struct hda_codec *codec) | ||
778 | { | ||
779 | struct cs_spec *spec = codec->spec; | ||
780 | int err; | ||
781 | |||
782 | if (!spec->multiout.dig_out_nid) | ||
783 | return 0; | ||
784 | |||
785 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | ||
786 | if (err < 0) | ||
787 | return err; | ||
788 | err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); | ||
789 | if (err < 0) | ||
790 | return err; | ||
791 | return 0; | ||
792 | } | ||
793 | |||
794 | static int build_digital_input(struct hda_codec *codec) | ||
795 | { | ||
796 | struct cs_spec *spec = codec->spec; | ||
797 | if (spec->dig_in) | ||
798 | return snd_hda_create_spdif_in_ctls(codec, spec->dig_in); | ||
799 | return 0; | ||
800 | } | ||
801 | |||
802 | /* | ||
803 | * auto-mute and auto-mic switching | ||
804 | */ | ||
805 | |||
806 | static void cs_automute(struct hda_codec *codec) | ||
807 | { | ||
808 | struct cs_spec *spec = codec->spec; | ||
809 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
810 | unsigned int caps, present, hp_present; | ||
811 | hda_nid_t nid; | ||
812 | int i; | ||
813 | |||
814 | hp_present = 0; | ||
815 | for (i = 0; i < cfg->hp_outs; i++) { | ||
816 | nid = cfg->hp_pins[i]; | ||
817 | caps = snd_hda_query_pin_caps(codec, nid); | ||
818 | if (!(caps & AC_PINCAP_PRES_DETECT)) | ||
819 | continue; | ||
820 | if (caps & AC_PINCAP_TRIG_REQ) | ||
821 | snd_hda_codec_read(codec, nid, 0, | ||
822 | AC_VERB_SET_PIN_SENSE, 0); | ||
823 | present = snd_hda_codec_read(codec, nid, 0, | ||
824 | AC_VERB_GET_PIN_SENSE, 0); | ||
825 | hp_present |= (present & AC_PINSENSE_PRESENCE) != 0; | ||
826 | if (hp_present) | ||
827 | break; | ||
828 | } | ||
829 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
830 | nid = cfg->speaker_pins[i]; | ||
831 | snd_hda_codec_write(codec, nid, 0, | ||
832 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
833 | hp_present ? 0 : PIN_OUT); | ||
834 | } | ||
835 | if (spec->board_config == CS420X_MBP55) { | ||
836 | unsigned int gpio = hp_present ? 0x02 : 0x08; | ||
837 | snd_hda_codec_write(codec, 0x01, 0, | ||
838 | AC_VERB_SET_GPIO_DATA, gpio); | ||
839 | } | ||
840 | } | ||
841 | |||
842 | static void cs_automic(struct hda_codec *codec) | ||
843 | { | ||
844 | struct cs_spec *spec = codec->spec; | ||
845 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
846 | hda_nid_t nid; | ||
847 | unsigned int caps, present; | ||
848 | |||
849 | nid = cfg->input_pins[spec->automic_idx]; | ||
850 | caps = snd_hda_query_pin_caps(codec, nid); | ||
851 | if (caps & AC_PINCAP_TRIG_REQ) | ||
852 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
853 | present = snd_hda_codec_read(codec, nid, 0, | ||
854 | AC_VERB_GET_PIN_SENSE, 0); | ||
855 | if (present & AC_PINSENSE_PRESENCE) | ||
856 | change_cur_input(codec, spec->automic_idx, 0); | ||
857 | else { | ||
858 | unsigned int imic = (spec->automic_idx == AUTO_PIN_MIC) ? | ||
859 | AUTO_PIN_FRONT_MIC : AUTO_PIN_MIC; | ||
860 | change_cur_input(codec, imic, 0); | ||
861 | } | ||
862 | } | ||
863 | |||
864 | /* | ||
865 | */ | ||
866 | |||
867 | static void init_output(struct hda_codec *codec) | ||
868 | { | ||
869 | struct cs_spec *spec = codec->spec; | ||
870 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
871 | int i; | ||
872 | |||
873 | /* mute first */ | ||
874 | for (i = 0; i < spec->multiout.num_dacs; i++) | ||
875 | snd_hda_codec_write(codec, spec->multiout.dac_nids[i], 0, | ||
876 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | ||
877 | if (spec->multiout.hp_nid) | ||
878 | snd_hda_codec_write(codec, spec->multiout.hp_nid, 0, | ||
879 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | ||
880 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { | ||
881 | if (!spec->multiout.extra_out_nid[i]) | ||
882 | break; | ||
883 | snd_hda_codec_write(codec, spec->multiout.extra_out_nid[i], 0, | ||
884 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | ||
885 | } | ||
886 | |||
887 | /* set appropriate pin controls */ | ||
888 | for (i = 0; i < cfg->line_outs; i++) | ||
889 | snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, | ||
890 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
891 | for (i = 0; i < cfg->hp_outs; i++) { | ||
892 | hda_nid_t nid = cfg->hp_pins[i]; | ||
893 | snd_hda_codec_write(codec, nid, 0, | ||
894 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); | ||
895 | if (!cfg->speaker_outs) | ||
896 | continue; | ||
897 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { | ||
898 | snd_hda_codec_write(codec, nid, 0, | ||
899 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
900 | AC_USRSP_EN | HP_EVENT); | ||
901 | spec->hp_detect = 1; | ||
902 | } | ||
903 | } | ||
904 | for (i = 0; i < cfg->speaker_outs; i++) | ||
905 | snd_hda_codec_write(codec, cfg->speaker_pins[i], 0, | ||
906 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
907 | if (spec->hp_detect) | ||
908 | cs_automute(codec); | ||
909 | } | ||
910 | |||
911 | static void init_input(struct hda_codec *codec) | ||
912 | { | ||
913 | struct cs_spec *spec = codec->spec; | ||
914 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
915 | unsigned int coef; | ||
916 | int i; | ||
917 | |||
918 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
919 | unsigned int ctl; | ||
920 | hda_nid_t pin = cfg->input_pins[i]; | ||
921 | if (!pin || !spec->adc_nid[i]) | ||
922 | continue; | ||
923 | /* set appropriate pin control and mute first */ | ||
924 | ctl = PIN_IN; | ||
925 | if (i <= AUTO_PIN_FRONT_MIC) { | ||
926 | unsigned int caps = snd_hda_query_pin_caps(codec, pin); | ||
927 | caps >>= AC_PINCAP_VREF_SHIFT; | ||
928 | if (caps & AC_PINCAP_VREF_80) | ||
929 | ctl = PIN_VREF80; | ||
930 | } | ||
931 | snd_hda_codec_write(codec, pin, 0, | ||
932 | AC_VERB_SET_PIN_WIDGET_CONTROL, ctl); | ||
933 | snd_hda_codec_write(codec, spec->adc_nid[i], 0, | ||
934 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
935 | AMP_IN_MUTE(spec->adc_idx[i])); | ||
936 | if (spec->mic_detect && spec->automic_idx == i) | ||
937 | snd_hda_codec_write(codec, pin, 0, | ||
938 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
939 | AC_USRSP_EN | MIC_EVENT); | ||
940 | } | ||
941 | change_cur_input(codec, spec->cur_input, 1); | ||
942 | if (spec->mic_detect) | ||
943 | cs_automic(codec); | ||
944 | |||
945 | coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */ | ||
946 | if (is_active_pin(codec, CS_DMIC2_PIN_NID)) | ||
947 | coef |= 0x0500; /* DMIC2 enable 2 channels, disable GPIO1 */ | ||
948 | if (is_active_pin(codec, CS_DMIC1_PIN_NID)) | ||
949 | coef |= 0x1800; /* DMIC1 enable 2 channels, disable GPIO0 | ||
950 | * No effect if SPDIF_OUT2 is slected in | ||
951 | * IDX_SPDIF_CTL. | ||
952 | */ | ||
953 | cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); | ||
954 | } | ||
955 | |||
956 | static struct hda_verb cs_coef_init_verbs[] = { | ||
957 | {0x11, AC_VERB_SET_PROC_STATE, 1}, | ||
958 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, | ||
959 | {0x11, AC_VERB_SET_PROC_COEF, | ||
960 | (0x002a /* DAC1/2/3 SZCMode Soft Ramp */ | ||
961 | | 0x0040 /* Mute DACs on FIFO error */ | ||
962 | | 0x1000 /* Enable DACs High Pass Filter */ | ||
963 | | 0x0400 /* Disable Coefficient Auto increment */ | ||
964 | )}, | ||
965 | /* Beep */ | ||
966 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, | ||
967 | {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */ | ||
968 | |||
969 | {} /* terminator */ | ||
970 | }; | ||
971 | |||
972 | /* SPDIF setup */ | ||
973 | static void init_digital(struct hda_codec *codec) | ||
974 | { | ||
975 | unsigned int coef; | ||
976 | |||
977 | coef = 0x0002; /* SRC_MUTE soft-mute on SPDIF (if no lock) */ | ||
978 | coef |= 0x0008; /* Replace with mute on error */ | ||
979 | if (is_active_pin(codec, CS_DIG_OUT2_PIN_NID)) | ||
980 | coef |= 0x4000; /* RX to TX1 or TX2 Loopthru / SPDIF2 | ||
981 | * SPDIF_OUT2 is shared with GPIO1 and | ||
982 | * DMIC_SDA2. | ||
983 | */ | ||
984 | cs_vendor_coef_set(codec, IDX_SPDIF_CTL, coef); | ||
985 | } | ||
986 | |||
987 | static int cs_init(struct hda_codec *codec) | ||
988 | { | ||
989 | struct cs_spec *spec = codec->spec; | ||
990 | |||
991 | snd_hda_sequence_write(codec, cs_coef_init_verbs); | ||
992 | |||
993 | if (spec->gpio_mask) { | ||
994 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, | ||
995 | spec->gpio_mask); | ||
996 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, | ||
997 | spec->gpio_dir); | ||
998 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | ||
999 | spec->gpio_data); | ||
1000 | } | ||
1001 | |||
1002 | init_output(codec); | ||
1003 | init_input(codec); | ||
1004 | init_digital(codec); | ||
1005 | return 0; | ||
1006 | } | ||
1007 | |||
1008 | static int cs_build_controls(struct hda_codec *codec) | ||
1009 | { | ||
1010 | int err; | ||
1011 | |||
1012 | err = build_output(codec); | ||
1013 | if (err < 0) | ||
1014 | return err; | ||
1015 | err = build_input(codec); | ||
1016 | if (err < 0) | ||
1017 | return err; | ||
1018 | err = build_digital_output(codec); | ||
1019 | if (err < 0) | ||
1020 | return err; | ||
1021 | err = build_digital_input(codec); | ||
1022 | if (err < 0) | ||
1023 | return err; | ||
1024 | return cs_init(codec); | ||
1025 | } | ||
1026 | |||
1027 | static void cs_free(struct hda_codec *codec) | ||
1028 | { | ||
1029 | struct cs_spec *spec = codec->spec; | ||
1030 | kfree(spec->capture_bind[0]); | ||
1031 | kfree(spec->capture_bind[1]); | ||
1032 | kfree(codec->spec); | ||
1033 | } | ||
1034 | |||
1035 | static void cs_unsol_event(struct hda_codec *codec, unsigned int res) | ||
1036 | { | ||
1037 | switch ((res >> 26) & 0x7f) { | ||
1038 | case HP_EVENT: | ||
1039 | cs_automute(codec); | ||
1040 | break; | ||
1041 | case MIC_EVENT: | ||
1042 | cs_automic(codec); | ||
1043 | break; | ||
1044 | } | ||
1045 | } | ||
1046 | |||
1047 | static struct hda_codec_ops cs_patch_ops = { | ||
1048 | .build_controls = cs_build_controls, | ||
1049 | .build_pcms = cs_build_pcms, | ||
1050 | .init = cs_init, | ||
1051 | .free = cs_free, | ||
1052 | .unsol_event = cs_unsol_event, | ||
1053 | }; | ||
1054 | |||
1055 | static int cs_parse_auto_config(struct hda_codec *codec) | ||
1056 | { | ||
1057 | struct cs_spec *spec = codec->spec; | ||
1058 | int err; | ||
1059 | |||
1060 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); | ||
1061 | if (err < 0) | ||
1062 | return err; | ||
1063 | |||
1064 | err = parse_output(codec); | ||
1065 | if (err < 0) | ||
1066 | return err; | ||
1067 | err = parse_input(codec); | ||
1068 | if (err < 0) | ||
1069 | return err; | ||
1070 | err = parse_digital_output(codec); | ||
1071 | if (err < 0) | ||
1072 | return err; | ||
1073 | err = parse_digital_input(codec); | ||
1074 | if (err < 0) | ||
1075 | return err; | ||
1076 | return 0; | ||
1077 | } | ||
1078 | |||
1079 | static const char *cs420x_models[CS420X_MODELS] = { | ||
1080 | [CS420X_MBP55] = "mbp55", | ||
1081 | [CS420X_AUTO] = "auto", | ||
1082 | }; | ||
1083 | |||
1084 | |||
1085 | static struct snd_pci_quirk cs420x_cfg_tbl[] = { | ||
1086 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | ||
1087 | {} /* terminator */ | ||
1088 | }; | ||
1089 | |||
1090 | struct cs_pincfg { | ||
1091 | hda_nid_t nid; | ||
1092 | u32 val; | ||
1093 | }; | ||
1094 | |||
1095 | static struct cs_pincfg mbp55_pincfgs[] = { | ||
1096 | { 0x09, 0x012b4030 }, | ||
1097 | { 0x0a, 0x90100121 }, | ||
1098 | { 0x0b, 0x90100120 }, | ||
1099 | { 0x0c, 0x400000f0 }, | ||
1100 | { 0x0d, 0x90a00110 }, | ||
1101 | { 0x0e, 0x400000f0 }, | ||
1102 | { 0x0f, 0x400000f0 }, | ||
1103 | { 0x10, 0x014be040 }, | ||
1104 | { 0x12, 0x400000f0 }, | ||
1105 | { 0x15, 0x400000f0 }, | ||
1106 | {} /* terminator */ | ||
1107 | }; | ||
1108 | |||
1109 | static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { | ||
1110 | [CS420X_MBP55] = mbp55_pincfgs, | ||
1111 | }; | ||
1112 | |||
1113 | static void fix_pincfg(struct hda_codec *codec, int model) | ||
1114 | { | ||
1115 | const struct cs_pincfg *cfg = cs_pincfgs[model]; | ||
1116 | if (!cfg) | ||
1117 | return; | ||
1118 | for (; cfg->nid; cfg++) | ||
1119 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
1120 | } | ||
1121 | |||
1122 | |||
1123 | static int patch_cs420x(struct hda_codec *codec) | ||
1124 | { | ||
1125 | struct cs_spec *spec; | ||
1126 | int err; | ||
1127 | |||
1128 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
1129 | if (!spec) | ||
1130 | return -ENOMEM; | ||
1131 | codec->spec = spec; | ||
1132 | |||
1133 | spec->board_config = | ||
1134 | snd_hda_check_board_config(codec, CS420X_MODELS, | ||
1135 | cs420x_models, cs420x_cfg_tbl); | ||
1136 | if (spec->board_config >= 0) | ||
1137 | fix_pincfg(codec, spec->board_config); | ||
1138 | |||
1139 | switch (spec->board_config) { | ||
1140 | case CS420X_MBP55: | ||
1141 | /* GPIO1 = headphones */ | ||
1142 | /* GPIO3 = speakers */ | ||
1143 | spec->gpio_mask = 0x0a; | ||
1144 | spec->gpio_dir = 0x0a; | ||
1145 | break; | ||
1146 | } | ||
1147 | |||
1148 | err = cs_parse_auto_config(codec); | ||
1149 | if (err < 0) | ||
1150 | goto error; | ||
1151 | |||
1152 | codec->patch_ops = cs_patch_ops; | ||
1153 | |||
1154 | return 0; | ||
1155 | |||
1156 | error: | ||
1157 | kfree(codec->spec); | ||
1158 | codec->spec = NULL; | ||
1159 | return err; | ||
1160 | } | ||
1161 | |||
1162 | |||
1163 | /* | ||
1164 | * patch entries | ||
1165 | */ | ||
1166 | static struct hda_codec_preset snd_hda_preset_cirrus[] = { | ||
1167 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, | ||
1168 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, | ||
1169 | {} /* terminator */ | ||
1170 | }; | ||
1171 | |||
1172 | MODULE_ALIAS("snd-hda-codec-id:10134206"); | ||
1173 | MODULE_ALIAS("snd-hda-codec-id:10134207"); | ||
1174 | |||
1175 | MODULE_LICENSE("GPL"); | ||
1176 | MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); | ||
1177 | |||
1178 | static struct hda_codec_preset_list cirrus_list = { | ||
1179 | .preset = snd_hda_preset_cirrus, | ||
1180 | .owner = THIS_MODULE, | ||
1181 | }; | ||
1182 | |||
1183 | static int __init patch_cirrus_init(void) | ||
1184 | { | ||
1185 | return snd_hda_add_codec_preset(&cirrus_list); | ||
1186 | } | ||
1187 | |||
1188 | static void __exit patch_cirrus_exit(void) | ||
1189 | { | ||
1190 | snd_hda_delete_codec_preset(&cirrus_list); | ||
1191 | } | ||
1192 | |||
1193 | module_init(patch_cirrus_init) | ||
1194 | module_exit(patch_cirrus_exit) | ||
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index c921264bbd71..780e1a72114a 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -635,7 +635,8 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
635 | cmi9880_models, | 635 | cmi9880_models, |
636 | cmi9880_cfg_tbl); | 636 | cmi9880_cfg_tbl); |
637 | if (spec->board_config < 0) { | 637 | if (spec->board_config < 0) { |
638 | snd_printdd(KERN_INFO "hda_codec: Unknown model for CMI9880\n"); | 638 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
639 | codec->chip_name); | ||
639 | spec->board_config = CMI_AUTO; /* try everything */ | 640 | spec->board_config = CMI_AUTO; /* try everything */ |
640 | } | 641 | } |
641 | 642 | ||
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index ac868c59f9e3..9d899eda44d7 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -108,6 +108,8 @@ struct conexant_spec { | |||
108 | struct hda_input_mux private_imux; | 108 | struct hda_input_mux private_imux; |
109 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 109 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
110 | 110 | ||
111 | unsigned int dell_automute; | ||
112 | unsigned int port_d_mode; | ||
111 | }; | 113 | }; |
112 | 114 | ||
113 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, | 115 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, |
@@ -1908,6 +1910,480 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
1908 | return 0; | 1910 | return 0; |
1909 | } | 1911 | } |
1910 | 1912 | ||
1913 | /* Conexant 5066 specific */ | ||
1914 | |||
1915 | static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; | ||
1916 | static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; | ||
1917 | static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; | ||
1918 | #define CXT5066_SPDIF_OUT 0x21 | ||
1919 | |||
1920 | static struct hda_channel_mode cxt5066_modes[1] = { | ||
1921 | { 2, NULL }, | ||
1922 | }; | ||
1923 | |||
1924 | static void cxt5066_update_speaker(struct hda_codec *codec) | ||
1925 | { | ||
1926 | struct conexant_spec *spec = codec->spec; | ||
1927 | unsigned int pinctl; | ||
1928 | |||
1929 | snd_printdd("CXT5066: update speaker, hp_present=%d\n", | ||
1930 | spec->hp_present); | ||
1931 | |||
1932 | /* Port A (HP) */ | ||
1933 | pinctl = ((spec->hp_present & 1) && spec->cur_eapd) ? PIN_HP : 0; | ||
1934 | snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1935 | pinctl); | ||
1936 | |||
1937 | /* Port D (HP/LO) */ | ||
1938 | pinctl = ((spec->hp_present & 2) && spec->cur_eapd) | ||
1939 | ? spec->port_d_mode : 0; | ||
1940 | snd_hda_codec_write(codec, 0x1c, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1941 | pinctl); | ||
1942 | |||
1943 | /* CLASS_D AMP */ | ||
1944 | pinctl = (!spec->hp_present && spec->cur_eapd) ? PIN_OUT : 0; | ||
1945 | snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1946 | pinctl); | ||
1947 | |||
1948 | if (spec->dell_automute) { | ||
1949 | /* DELL AIO Port Rule: PortA > PortD > IntSpk */ | ||
1950 | pinctl = (!(spec->hp_present & 1) && spec->cur_eapd) | ||
1951 | ? PIN_OUT : 0; | ||
1952 | snd_hda_codec_write(codec, 0x1c, 0, | ||
1953 | AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl); | ||
1954 | } | ||
1955 | } | ||
1956 | |||
1957 | /* turn on/off EAPD (+ mute HP) as a master switch */ | ||
1958 | static int cxt5066_hp_master_sw_put(struct snd_kcontrol *kcontrol, | ||
1959 | struct snd_ctl_elem_value *ucontrol) | ||
1960 | { | ||
1961 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1962 | |||
1963 | if (!cxt_eapd_put(kcontrol, ucontrol)) | ||
1964 | return 0; | ||
1965 | |||
1966 | cxt5066_update_speaker(codec); | ||
1967 | return 1; | ||
1968 | } | ||
1969 | |||
1970 | /* toggle input of built-in and mic jack appropriately */ | ||
1971 | static void cxt5066_automic(struct hda_codec *codec) | ||
1972 | { | ||
1973 | static struct hda_verb ext_mic_present[] = { | ||
1974 | /* enable external mic, port B */ | ||
1975 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1976 | |||
1977 | /* switch to external mic input */ | ||
1978 | {0x17, AC_VERB_SET_CONNECT_SEL, 0}, | ||
1979 | |||
1980 | /* disable internal mic, port C */ | ||
1981 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
1982 | {} | ||
1983 | }; | ||
1984 | static struct hda_verb ext_mic_absent[] = { | ||
1985 | /* enable internal mic, port C */ | ||
1986 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1987 | |||
1988 | /* switch to internal mic input */ | ||
1989 | {0x17, AC_VERB_SET_CONNECT_SEL, 1}, | ||
1990 | |||
1991 | /* disable external mic, port B */ | ||
1992 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
1993 | {} | ||
1994 | }; | ||
1995 | unsigned int present; | ||
1996 | |||
1997 | present = snd_hda_codec_read(codec, 0x1a, 0, | ||
1998 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
1999 | if (present) { | ||
2000 | snd_printdd("CXT5066: external microphone detected\n"); | ||
2001 | snd_hda_sequence_write(codec, ext_mic_present); | ||
2002 | } else { | ||
2003 | snd_printdd("CXT5066: external microphone absent\n"); | ||
2004 | snd_hda_sequence_write(codec, ext_mic_absent); | ||
2005 | } | ||
2006 | } | ||
2007 | |||
2008 | /* mute internal speaker if HP is plugged */ | ||
2009 | static void cxt5066_hp_automute(struct hda_codec *codec) | ||
2010 | { | ||
2011 | struct conexant_spec *spec = codec->spec; | ||
2012 | unsigned int portA, portD; | ||
2013 | |||
2014 | /* Port A */ | ||
2015 | portA = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
2016 | & AC_PINSENSE_PRESENCE; | ||
2017 | |||
2018 | /* Port D */ | ||
2019 | portD = (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
2020 | & AC_PINSENSE_PRESENCE) << 1; | ||
2021 | |||
2022 | spec->hp_present = !!(portA | portD); | ||
2023 | snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n", | ||
2024 | portA, portD, spec->hp_present); | ||
2025 | cxt5066_update_speaker(codec); | ||
2026 | } | ||
2027 | |||
2028 | /* unsolicited event for jack sensing */ | ||
2029 | static void cxt5066_unsol_event(struct hda_codec *codec, unsigned int res) | ||
2030 | { | ||
2031 | snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); | ||
2032 | switch (res >> 26) { | ||
2033 | case CONEXANT_HP_EVENT: | ||
2034 | cxt5066_hp_automute(codec); | ||
2035 | break; | ||
2036 | case CONEXANT_MIC_EVENT: | ||
2037 | cxt5066_automic(codec); | ||
2038 | break; | ||
2039 | } | ||
2040 | } | ||
2041 | |||
2042 | static const struct hda_input_mux cxt5066_analog_mic_boost = { | ||
2043 | .num_items = 5, | ||
2044 | .items = { | ||
2045 | { "0dB", 0 }, | ||
2046 | { "10dB", 1 }, | ||
2047 | { "20dB", 2 }, | ||
2048 | { "30dB", 3 }, | ||
2049 | { "40dB", 4 }, | ||
2050 | }, | ||
2051 | }; | ||
2052 | |||
2053 | static int cxt5066_mic_boost_mux_enum_info(struct snd_kcontrol *kcontrol, | ||
2054 | struct snd_ctl_elem_info *uinfo) | ||
2055 | { | ||
2056 | return snd_hda_input_mux_info(&cxt5066_analog_mic_boost, uinfo); | ||
2057 | } | ||
2058 | |||
2059 | static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol, | ||
2060 | struct snd_ctl_elem_value *ucontrol) | ||
2061 | { | ||
2062 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
2063 | int val; | ||
2064 | |||
2065 | val = snd_hda_codec_read(codec, 0x17, 0, | ||
2066 | AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); | ||
2067 | |||
2068 | ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; | ||
2069 | return 0; | ||
2070 | } | ||
2071 | |||
2072 | static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
2073 | struct snd_ctl_elem_value *ucontrol) | ||
2074 | { | ||
2075 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
2076 | const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; | ||
2077 | unsigned int idx; | ||
2078 | |||
2079 | if (!imux->num_items) | ||
2080 | return 0; | ||
2081 | idx = ucontrol->value.enumerated.item[0]; | ||
2082 | if (idx >= imux->num_items) | ||
2083 | idx = imux->num_items - 1; | ||
2084 | |||
2085 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
2086 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
2087 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | | ||
2088 | imux->items[idx].index); | ||
2089 | |||
2090 | return 1; | ||
2091 | } | ||
2092 | |||
2093 | static struct hda_input_mux cxt5066_capture_source = { | ||
2094 | .num_items = 4, | ||
2095 | .items = { | ||
2096 | { "Mic B", 0 }, | ||
2097 | { "Mic C", 1 }, | ||
2098 | { "Mic E", 2 }, | ||
2099 | { "Mic F", 3 }, | ||
2100 | }, | ||
2101 | }; | ||
2102 | |||
2103 | static struct hda_bind_ctls cxt5066_bind_capture_vol_others = { | ||
2104 | .ops = &snd_hda_bind_vol, | ||
2105 | .values = { | ||
2106 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT), | ||
2107 | HDA_COMPOSE_AMP_VAL(0x14, 3, 2, HDA_INPUT), | ||
2108 | 0 | ||
2109 | }, | ||
2110 | }; | ||
2111 | |||
2112 | static struct hda_bind_ctls cxt5066_bind_capture_sw_others = { | ||
2113 | .ops = &snd_hda_bind_sw, | ||
2114 | .values = { | ||
2115 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT), | ||
2116 | HDA_COMPOSE_AMP_VAL(0x14, 3, 2, HDA_INPUT), | ||
2117 | 0 | ||
2118 | }, | ||
2119 | }; | ||
2120 | |||
2121 | static struct snd_kcontrol_new cxt5066_mixer_master[] = { | ||
2122 | HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), | ||
2123 | {} | ||
2124 | }; | ||
2125 | |||
2126 | static struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = { | ||
2127 | { | ||
2128 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2129 | .name = "Master Playback Volume", | ||
2130 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
2131 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | | ||
2132 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, | ||
2133 | .info = snd_hda_mixer_amp_volume_info, | ||
2134 | .get = snd_hda_mixer_amp_volume_get, | ||
2135 | .put = snd_hda_mixer_amp_volume_put, | ||
2136 | .tlv = { .c = snd_hda_mixer_amp_tlv }, | ||
2137 | /* offset by 28 volume steps to limit minimum gain to -46dB */ | ||
2138 | .private_value = | ||
2139 | HDA_COMPOSE_AMP_VAL_OFS(0x10, 3, 0, HDA_OUTPUT, 28), | ||
2140 | }, | ||
2141 | {} | ||
2142 | }; | ||
2143 | |||
2144 | static struct snd_kcontrol_new cxt5066_mixers[] = { | ||
2145 | { | ||
2146 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2147 | .name = "Master Playback Switch", | ||
2148 | .info = cxt_eapd_info, | ||
2149 | .get = cxt_eapd_get, | ||
2150 | .put = cxt5066_hp_master_sw_put, | ||
2151 | .private_value = 0x1d, | ||
2152 | }, | ||
2153 | |||
2154 | { | ||
2155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2156 | .name = "Analog Mic Boost Capture Enum", | ||
2157 | .info = cxt5066_mic_boost_mux_enum_info, | ||
2158 | .get = cxt5066_mic_boost_mux_enum_get, | ||
2159 | .put = cxt5066_mic_boost_mux_enum_put, | ||
2160 | }, | ||
2161 | |||
2162 | HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), | ||
2163 | HDA_BIND_SW("Capture Switch", &cxt5066_bind_capture_sw_others), | ||
2164 | {} | ||
2165 | }; | ||
2166 | |||
2167 | static struct hda_verb cxt5066_init_verbs[] = { | ||
2168 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ | ||
2169 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ | ||
2170 | {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */ | ||
2171 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port E */ | ||
2172 | |||
2173 | /* Speakers */ | ||
2174 | {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2175 | {0x1f, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ | ||
2176 | |||
2177 | /* HP, Amp */ | ||
2178 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2179 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ | ||
2180 | |||
2181 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2182 | {0x1c, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ | ||
2183 | |||
2184 | /* DAC1 */ | ||
2185 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2186 | |||
2187 | /* Node 14 connections: 0x17 0x18 0x23 0x24 0x27 */ | ||
2188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x50}, | ||
2189 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2190 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2) | 0x50}, | ||
2191 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
2192 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
2193 | |||
2194 | /* no digital microphone support yet */ | ||
2195 | {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2196 | |||
2197 | /* Audio input selector */ | ||
2198 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x3}, | ||
2199 | |||
2200 | /* SPDIF route: PCM */ | ||
2201 | {0x20, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
2202 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
2203 | |||
2204 | {0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2205 | {0x22, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2206 | |||
2207 | /* EAPD */ | ||
2208 | {0x1d, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | ||
2209 | |||
2210 | /* not handling these yet */ | ||
2211 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2212 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2213 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2214 | {0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2215 | {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2216 | {0x1e, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2217 | {0x20, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2218 | {0x22, AC_VERB_SET_UNSOLICITED_ENABLE, 0}, | ||
2219 | { } /* end */ | ||
2220 | }; | ||
2221 | |||
2222 | static struct hda_verb cxt5066_init_verbs_olpc[] = { | ||
2223 | /* Port A: headphones */ | ||
2224 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2225 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ | ||
2226 | |||
2227 | /* Port B: external microphone */ | ||
2228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
2229 | |||
2230 | /* Port C: internal microphone */ | ||
2231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
2232 | |||
2233 | /* Port D: unused */ | ||
2234 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2235 | |||
2236 | /* Port E: unused, but has primary EAPD */ | ||
2237 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2238 | {0x1d, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | ||
2239 | |||
2240 | /* Port F: unused */ | ||
2241 | {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2242 | |||
2243 | /* Port G: internal speakers */ | ||
2244 | {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2245 | {0x1f, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ | ||
2246 | |||
2247 | /* DAC1 */ | ||
2248 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2249 | |||
2250 | /* DAC2: unused */ | ||
2251 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2252 | |||
2253 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x50}, | ||
2254 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
2256 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
2257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2258 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
2260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
2261 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2262 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2263 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
2264 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
2265 | |||
2266 | /* Disable digital microphone port */ | ||
2267 | {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2268 | |||
2269 | /* Audio input selectors */ | ||
2270 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x3}, | ||
2271 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
2272 | |||
2273 | /* Disable SPDIF */ | ||
2274 | {0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2275 | {0x22, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2276 | |||
2277 | /* enable unsolicited events for Port A and B */ | ||
2278 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, | ||
2279 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, | ||
2280 | { } /* end */ | ||
2281 | }; | ||
2282 | |||
2283 | static struct hda_verb cxt5066_init_verbs_portd_lo[] = { | ||
2284 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2285 | { } /* end */ | ||
2286 | }; | ||
2287 | |||
2288 | /* initialize jack-sensing, too */ | ||
2289 | static int cxt5066_init(struct hda_codec *codec) | ||
2290 | { | ||
2291 | snd_printdd("CXT5066: init\n"); | ||
2292 | conexant_init(codec); | ||
2293 | if (codec->patch_ops.unsol_event) { | ||
2294 | cxt5066_hp_automute(codec); | ||
2295 | cxt5066_automic(codec); | ||
2296 | } | ||
2297 | return 0; | ||
2298 | } | ||
2299 | |||
2300 | enum { | ||
2301 | CXT5066_LAPTOP, /* Laptops w/ EAPD support */ | ||
2302 | CXT5066_DELL_LAPTOP, /* Dell Laptop */ | ||
2303 | CXT5066_OLPC_XO_1_5, /* OLPC XO 1.5 */ | ||
2304 | CXT5066_MODELS | ||
2305 | }; | ||
2306 | |||
2307 | static const char *cxt5066_models[CXT5066_MODELS] = { | ||
2308 | [CXT5066_LAPTOP] = "laptop", | ||
2309 | [CXT5066_DELL_LAPTOP] = "dell-laptop", | ||
2310 | [CXT5066_OLPC_XO_1_5] = "olpc-xo-1_5", | ||
2311 | }; | ||
2312 | |||
2313 | static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | ||
2314 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", | ||
2315 | CXT5066_LAPTOP), | ||
2316 | SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", | ||
2317 | CXT5066_DELL_LAPTOP), | ||
2318 | {} | ||
2319 | }; | ||
2320 | |||
2321 | static int patch_cxt5066(struct hda_codec *codec) | ||
2322 | { | ||
2323 | struct conexant_spec *spec; | ||
2324 | int board_config; | ||
2325 | |||
2326 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
2327 | if (!spec) | ||
2328 | return -ENOMEM; | ||
2329 | codec->spec = spec; | ||
2330 | |||
2331 | codec->patch_ops = conexant_patch_ops; | ||
2332 | codec->patch_ops.init = cxt5066_init; | ||
2333 | |||
2334 | spec->dell_automute = 0; | ||
2335 | spec->multiout.max_channels = 2; | ||
2336 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids); | ||
2337 | spec->multiout.dac_nids = cxt5066_dac_nids; | ||
2338 | spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT; | ||
2339 | spec->num_adc_nids = 1; | ||
2340 | spec->adc_nids = cxt5066_adc_nids; | ||
2341 | spec->capsrc_nids = cxt5066_capsrc_nids; | ||
2342 | spec->input_mux = &cxt5066_capture_source; | ||
2343 | |||
2344 | spec->port_d_mode = PIN_HP; | ||
2345 | |||
2346 | spec->num_init_verbs = 1; | ||
2347 | spec->init_verbs[0] = cxt5066_init_verbs; | ||
2348 | spec->num_channel_mode = ARRAY_SIZE(cxt5066_modes); | ||
2349 | spec->channel_mode = cxt5066_modes; | ||
2350 | spec->cur_adc = 0; | ||
2351 | spec->cur_adc_idx = 0; | ||
2352 | |||
2353 | board_config = snd_hda_check_board_config(codec, CXT5066_MODELS, | ||
2354 | cxt5066_models, cxt5066_cfg_tbl); | ||
2355 | switch (board_config) { | ||
2356 | default: | ||
2357 | case CXT5066_LAPTOP: | ||
2358 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; | ||
2359 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | ||
2360 | break; | ||
2361 | case CXT5066_DELL_LAPTOP: | ||
2362 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; | ||
2363 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | ||
2364 | |||
2365 | spec->port_d_mode = PIN_OUT; | ||
2366 | spec->init_verbs[spec->num_init_verbs] = cxt5066_init_verbs_portd_lo; | ||
2367 | spec->num_init_verbs++; | ||
2368 | spec->dell_automute = 1; | ||
2369 | break; | ||
2370 | case CXT5066_OLPC_XO_1_5: | ||
2371 | codec->patch_ops.unsol_event = cxt5066_unsol_event; | ||
2372 | spec->init_verbs[0] = cxt5066_init_verbs_olpc; | ||
2373 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; | ||
2374 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | ||
2375 | spec->port_d_mode = 0; | ||
2376 | |||
2377 | /* no S/PDIF out */ | ||
2378 | spec->multiout.dig_out_nid = 0; | ||
2379 | |||
2380 | /* input source automatically selected */ | ||
2381 | spec->input_mux = NULL; | ||
2382 | break; | ||
2383 | } | ||
2384 | |||
2385 | return 0; | ||
2386 | } | ||
1911 | 2387 | ||
1912 | /* | 2388 | /* |
1913 | */ | 2389 | */ |
@@ -1919,12 +2395,15 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
1919 | .patch = patch_cxt5047 }, | 2395 | .patch = patch_cxt5047 }, |
1920 | { .id = 0x14f15051, .name = "CX20561 (Hermosa)", | 2396 | { .id = 0x14f15051, .name = "CX20561 (Hermosa)", |
1921 | .patch = patch_cxt5051 }, | 2397 | .patch = patch_cxt5051 }, |
2398 | { .id = 0x14f15066, .name = "CX20582 (Pebble)", | ||
2399 | .patch = patch_cxt5066 }, | ||
1922 | {} /* terminator */ | 2400 | {} /* terminator */ |
1923 | }; | 2401 | }; |
1924 | 2402 | ||
1925 | MODULE_ALIAS("snd-hda-codec-id:14f15045"); | 2403 | MODULE_ALIAS("snd-hda-codec-id:14f15045"); |
1926 | MODULE_ALIAS("snd-hda-codec-id:14f15047"); | 2404 | MODULE_ALIAS("snd-hda-codec-id:14f15047"); |
1927 | MODULE_ALIAS("snd-hda-codec-id:14f15051"); | 2405 | MODULE_ALIAS("snd-hda-codec-id:14f15051"); |
2406 | MODULE_ALIAS("snd-hda-codec-id:14f15066"); | ||
1928 | 2407 | ||
1929 | MODULE_LICENSE("GPL"); | 2408 | MODULE_LICENSE("GPL"); |
1930 | MODULE_DESCRIPTION("Conexant HD-audio codec"); | 2409 | MODULE_DESCRIPTION("Conexant HD-audio codec"); |
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index fcc77fec4487..01a18ed475ac 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #include "hda_codec.h" | 33 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 34 | #include "hda_local.h" |
35 | 35 | ||
36 | #define CVT_NID 0x02 /* audio converter */ | 36 | static hda_nid_t cvt_nid; /* audio converter */ |
37 | #define PIN_NID 0x03 /* HDMI output pin */ | 37 | static hda_nid_t pin_nid; /* HDMI output pin */ |
38 | 38 | ||
39 | #define INTEL_HDMI_EVENT_TAG 0x08 | 39 | #define INTEL_HDMI_EVENT_TAG 0x08 |
40 | 40 | ||
@@ -44,30 +44,6 @@ struct intel_hdmi_spec { | |||
44 | struct hdmi_eld sink_eld; | 44 | struct hdmi_eld sink_eld; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static struct hda_verb pinout_enable_verb[] = { | ||
48 | {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
49 | {} /* terminator */ | ||
50 | }; | ||
51 | |||
52 | static struct hda_verb unsolicited_response_verb[] = { | ||
53 | {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | | ||
54 | INTEL_HDMI_EVENT_TAG}, | ||
55 | {} | ||
56 | }; | ||
57 | |||
58 | static struct hda_verb def_chan_map[] = { | ||
59 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x00}, | ||
60 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x11}, | ||
61 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x22}, | ||
62 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x33}, | ||
63 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x44}, | ||
64 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x55}, | ||
65 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x66}, | ||
66 | {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT, 0x77}, | ||
67 | {} | ||
68 | }; | ||
69 | |||
70 | |||
71 | struct hdmi_audio_infoframe { | 47 | struct hdmi_audio_infoframe { |
72 | u8 type; /* 0x84 */ | 48 | u8 type; /* 0x84 */ |
73 | u8 ver; /* 0x01 */ | 49 | u8 ver; /* 0x01 */ |
@@ -244,11 +220,12 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid, | |||
244 | static void hdmi_enable_output(struct hda_codec *codec) | 220 | static void hdmi_enable_output(struct hda_codec *codec) |
245 | { | 221 | { |
246 | /* Unmute */ | 222 | /* Unmute */ |
247 | if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) | 223 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) |
248 | snd_hda_codec_write(codec, PIN_NID, 0, | 224 | snd_hda_codec_write(codec, pin_nid, 0, |
249 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | 225 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
250 | /* Enable pin out */ | 226 | /* Enable pin out */ |
251 | snd_hda_sequence_write(codec, pinout_enable_verb); | 227 | snd_hda_codec_write(codec, pin_nid, 0, |
228 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
252 | } | 229 | } |
253 | 230 | ||
254 | /* | 231 | /* |
@@ -256,8 +233,8 @@ static void hdmi_enable_output(struct hda_codec *codec) | |||
256 | */ | 233 | */ |
257 | static void hdmi_start_infoframe_trans(struct hda_codec *codec) | 234 | static void hdmi_start_infoframe_trans(struct hda_codec *codec) |
258 | { | 235 | { |
259 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | 236 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); |
260 | snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, | 237 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, |
261 | AC_DIPXMIT_BEST); | 238 | AC_DIPXMIT_BEST); |
262 | } | 239 | } |
263 | 240 | ||
@@ -266,20 +243,20 @@ static void hdmi_start_infoframe_trans(struct hda_codec *codec) | |||
266 | */ | 243 | */ |
267 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec) | 244 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec) |
268 | { | 245 | { |
269 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | 246 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); |
270 | snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, | 247 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, |
271 | AC_DIPXMIT_DISABLE); | 248 | AC_DIPXMIT_DISABLE); |
272 | } | 249 | } |
273 | 250 | ||
274 | static int hdmi_get_channel_count(struct hda_codec *codec) | 251 | static int hdmi_get_channel_count(struct hda_codec *codec) |
275 | { | 252 | { |
276 | return 1 + snd_hda_codec_read(codec, CVT_NID, 0, | 253 | return 1 + snd_hda_codec_read(codec, cvt_nid, 0, |
277 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | 254 | AC_VERB_GET_CVT_CHAN_COUNT, 0); |
278 | } | 255 | } |
279 | 256 | ||
280 | static void hdmi_set_channel_count(struct hda_codec *codec, int chs) | 257 | static void hdmi_set_channel_count(struct hda_codec *codec, int chs) |
281 | { | 258 | { |
282 | snd_hda_codec_write(codec, CVT_NID, 0, | 259 | snd_hda_codec_write(codec, cvt_nid, 0, |
283 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | 260 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); |
284 | 261 | ||
285 | if (chs != hdmi_get_channel_count(codec)) | 262 | if (chs != hdmi_get_channel_count(codec)) |
@@ -294,7 +271,7 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec) | |||
294 | int slot; | 271 | int slot; |
295 | 272 | ||
296 | for (i = 0; i < 8; i++) { | 273 | for (i = 0; i < 8; i++) { |
297 | slot = snd_hda_codec_read(codec, CVT_NID, 0, | 274 | slot = snd_hda_codec_read(codec, cvt_nid, 0, |
298 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | 275 | AC_VERB_GET_HDMI_CHAN_SLOT, i); |
299 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | 276 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", |
300 | slot >> 4, slot & 0x7); | 277 | slot >> 4, slot & 0x7); |
@@ -307,7 +284,7 @@ static void hdmi_parse_eld(struct hda_codec *codec) | |||
307 | struct intel_hdmi_spec *spec = codec->spec; | 284 | struct intel_hdmi_spec *spec = codec->spec; |
308 | struct hdmi_eld *eld = &spec->sink_eld; | 285 | struct hdmi_eld *eld = &spec->sink_eld; |
309 | 286 | ||
310 | if (!snd_hdmi_get_eld(eld, codec, PIN_NID)) | 287 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) |
311 | snd_hdmi_show_eld(eld); | 288 | snd_hdmi_show_eld(eld); |
312 | } | 289 | } |
313 | 290 | ||
@@ -322,11 +299,11 @@ static void hdmi_debug_dip_size(struct hda_codec *codec) | |||
322 | int i; | 299 | int i; |
323 | int size; | 300 | int size; |
324 | 301 | ||
325 | size = snd_hdmi_get_eld_size(codec, PIN_NID); | 302 | size = snd_hdmi_get_eld_size(codec, pin_nid); |
326 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | 303 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); |
327 | 304 | ||
328 | for (i = 0; i < 8; i++) { | 305 | for (i = 0; i < 8; i++) { |
329 | size = snd_hda_codec_read(codec, PIN_NID, 0, | 306 | size = snd_hda_codec_read(codec, pin_nid, 0, |
330 | AC_VERB_GET_HDMI_DIP_SIZE, i); | 307 | AC_VERB_GET_HDMI_DIP_SIZE, i); |
331 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | 308 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); |
332 | } | 309 | } |
@@ -340,15 +317,15 @@ static void hdmi_clear_dip_buffers(struct hda_codec *codec) | |||
340 | int size; | 317 | int size; |
341 | int pi, bi; | 318 | int pi, bi; |
342 | for (i = 0; i < 8; i++) { | 319 | for (i = 0; i < 8; i++) { |
343 | size = snd_hda_codec_read(codec, PIN_NID, 0, | 320 | size = snd_hda_codec_read(codec, pin_nid, 0, |
344 | AC_VERB_GET_HDMI_DIP_SIZE, i); | 321 | AC_VERB_GET_HDMI_DIP_SIZE, i); |
345 | if (size == 0) | 322 | if (size == 0) |
346 | continue; | 323 | continue; |
347 | 324 | ||
348 | hdmi_set_dip_index(codec, PIN_NID, i, 0x0); | 325 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); |
349 | for (j = 1; j < 1000; j++) { | 326 | for (j = 1; j < 1000; j++) { |
350 | hdmi_write_dip_byte(codec, PIN_NID, 0x0); | 327 | hdmi_write_dip_byte(codec, pin_nid, 0x0); |
351 | hdmi_get_dip_index(codec, PIN_NID, &pi, &bi); | 328 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); |
352 | if (pi != i) | 329 | if (pi != i) |
353 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | 330 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", |
354 | bi, pi, i); | 331 | bi, pi, i); |
@@ -376,9 +353,9 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | |||
376 | sum += params[i]; | 353 | sum += params[i]; |
377 | ai->checksum = - sum; | 354 | ai->checksum = - sum; |
378 | 355 | ||
379 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | 356 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); |
380 | for (i = 0; i < sizeof(ai); i++) | 357 | for (i = 0; i < sizeof(ai); i++) |
381 | hdmi_write_dip_byte(codec, PIN_NID, params[i]); | 358 | hdmi_write_dip_byte(codec, pin_nid, params[i]); |
382 | } | 359 | } |
383 | 360 | ||
384 | /* | 361 | /* |
@@ -465,6 +442,8 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec, | |||
465 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | 442 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, |
466 | struct hdmi_audio_infoframe *ai) | 443 | struct hdmi_audio_infoframe *ai) |
467 | { | 444 | { |
445 | int i; | ||
446 | |||
468 | if (!ai->CA) | 447 | if (!ai->CA) |
469 | return; | 448 | return; |
470 | 449 | ||
@@ -473,7 +452,11 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec, | |||
473 | * ALSA sequence is front/surr/clfe/side? | 452 | * ALSA sequence is front/surr/clfe/side? |
474 | */ | 453 | */ |
475 | 454 | ||
476 | snd_hda_sequence_write(codec, def_chan_map); | 455 | for (i = 0; i < 8; i++) |
456 | snd_hda_codec_write(codec, cvt_nid, 0, | ||
457 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
458 | (i << 4) | i); | ||
459 | |||
477 | hdmi_debug_channel_mapping(codec); | 460 | hdmi_debug_channel_mapping(codec); |
478 | } | 461 | } |
479 | 462 | ||
@@ -597,7 +580,6 @@ static struct hda_pcm_stream intel_hdmi_pcm_playback = { | |||
597 | .substreams = 1, | 580 | .substreams = 1, |
598 | .channels_min = 2, | 581 | .channels_min = 2, |
599 | .channels_max = 8, | 582 | .channels_max = 8, |
600 | .nid = CVT_NID, /* NID to query formats and rates and setup streams */ | ||
601 | .ops = { | 583 | .ops = { |
602 | .open = intel_hdmi_playback_pcm_open, | 584 | .open = intel_hdmi_playback_pcm_open, |
603 | .close = intel_hdmi_playback_pcm_close, | 585 | .close = intel_hdmi_playback_pcm_close, |
@@ -613,6 +595,9 @@ static int intel_hdmi_build_pcms(struct hda_codec *codec) | |||
613 | codec->num_pcms = 1; | 595 | codec->num_pcms = 1; |
614 | codec->pcm_info = info; | 596 | codec->pcm_info = info; |
615 | 597 | ||
598 | /* NID to query formats and rates and setup streams */ | ||
599 | intel_hdmi_pcm_playback.nid = cvt_nid; | ||
600 | |||
616 | info->name = "INTEL HDMI"; | 601 | info->name = "INTEL HDMI"; |
617 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 602 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
618 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = intel_hdmi_pcm_playback; | 603 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = intel_hdmi_pcm_playback; |
@@ -636,8 +621,9 @@ static int intel_hdmi_init(struct hda_codec *codec) | |||
636 | { | 621 | { |
637 | hdmi_enable_output(codec); | 622 | hdmi_enable_output(codec); |
638 | 623 | ||
639 | snd_hda_sequence_write(codec, unsolicited_response_verb); | 624 | snd_hda_codec_write(codec, pin_nid, 0, |
640 | 625 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
626 | AC_USRSP_EN | INTEL_HDMI_EVENT_TAG); | ||
641 | return 0; | 627 | return 0; |
642 | } | 628 | } |
643 | 629 | ||
@@ -657,7 +643,7 @@ static struct hda_codec_ops intel_hdmi_patch_ops = { | |||
657 | .unsol_event = intel_hdmi_unsol_event, | 643 | .unsol_event = intel_hdmi_unsol_event, |
658 | }; | 644 | }; |
659 | 645 | ||
660 | static int patch_intel_hdmi(struct hda_codec *codec) | 646 | static int do_patch_intel_hdmi(struct hda_codec *codec) |
661 | { | 647 | { |
662 | struct intel_hdmi_spec *spec; | 648 | struct intel_hdmi_spec *spec; |
663 | 649 | ||
@@ -667,7 +653,7 @@ static int patch_intel_hdmi(struct hda_codec *codec) | |||
667 | 653 | ||
668 | spec->multiout.num_dacs = 0; /* no analog */ | 654 | spec->multiout.num_dacs = 0; /* no analog */ |
669 | spec->multiout.max_channels = 8; | 655 | spec->multiout.max_channels = 8; |
670 | spec->multiout.dig_out_nid = CVT_NID; | 656 | spec->multiout.dig_out_nid = cvt_nid; |
671 | 657 | ||
672 | codec->spec = spec; | 658 | codec->spec = spec; |
673 | codec->patch_ops = intel_hdmi_patch_ops; | 659 | codec->patch_ops = intel_hdmi_patch_ops; |
@@ -679,12 +665,27 @@ static int patch_intel_hdmi(struct hda_codec *codec) | |||
679 | return 0; | 665 | return 0; |
680 | } | 666 | } |
681 | 667 | ||
668 | static int patch_intel_hdmi(struct hda_codec *codec) | ||
669 | { | ||
670 | cvt_nid = 0x02; | ||
671 | pin_nid = 0x03; | ||
672 | return do_patch_intel_hdmi(codec); | ||
673 | } | ||
674 | |||
675 | static int patch_intel_hdmi_ibexpeak(struct hda_codec *codec) | ||
676 | { | ||
677 | cvt_nid = 0x02; | ||
678 | pin_nid = 0x04; | ||
679 | return do_patch_intel_hdmi(codec); | ||
680 | } | ||
681 | |||
682 | static struct hda_codec_preset snd_hda_preset_intelhdmi[] = { | 682 | static struct hda_codec_preset snd_hda_preset_intelhdmi[] = { |
683 | { .id = 0x808629fb, .name = "G45 DEVCL", .patch = patch_intel_hdmi }, | 683 | { .id = 0x808629fb, .name = "G45 DEVCL", .patch = patch_intel_hdmi }, |
684 | { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, | 684 | { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, |
685 | { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, | 685 | { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, |
686 | { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, | 686 | { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, |
687 | { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi }, | 687 | { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi }, |
688 | { .id = 0x80860054, .name = "Q57 DEVIBX", .patch = patch_intel_hdmi_ibexpeak }, | ||
688 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, | 689 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, |
689 | {} /* terminator */ | 690 | {} /* terminator */ |
690 | }; | 691 | }; |
@@ -694,6 +695,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862801"); | |||
694 | MODULE_ALIAS("snd-hda-codec-id:80862802"); | 695 | MODULE_ALIAS("snd-hda-codec-id:80862802"); |
695 | MODULE_ALIAS("snd-hda-codec-id:80862803"); | 696 | MODULE_ALIAS("snd-hda-codec-id:80862803"); |
696 | MODULE_ALIAS("snd-hda-codec-id:80862804"); | 697 | MODULE_ALIAS("snd-hda-codec-id:80862804"); |
698 | MODULE_ALIAS("snd-hda-codec-id:80860054"); | ||
697 | MODULE_ALIAS("snd-hda-codec-id:10951392"); | 699 | MODULE_ALIAS("snd-hda-codec-id:10951392"); |
698 | 700 | ||
699 | MODULE_LICENSE("GPL"); | 701 | MODULE_LICENSE("GPL"); |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index f5792e2eea82..c8435c9a97f9 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -377,6 +377,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
377 | */ | 377 | */ |
378 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | 378 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { |
379 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 379 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, |
380 | { .id = 0x10de0003, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
380 | { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 381 | { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, |
381 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi_8ch }, | 382 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi_8ch }, |
382 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 383 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
@@ -385,6 +386,7 @@ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | |||
385 | }; | 386 | }; |
386 | 387 | ||
387 | MODULE_ALIAS("snd-hda-codec-id:10de0002"); | 388 | MODULE_ALIAS("snd-hda-codec-id:10de0002"); |
389 | MODULE_ALIAS("snd-hda-codec-id:10de0003"); | ||
388 | MODULE_ALIAS("snd-hda-codec-id:10de0006"); | 390 | MODULE_ALIAS("snd-hda-codec-id:10de0006"); |
389 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); | 391 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); |
390 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 392 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 30eeb304351c..7ed47f66ddd1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -208,12 +208,6 @@ enum { | |||
208 | ALC885_MBP3, | 208 | ALC885_MBP3, |
209 | ALC885_MB5, | 209 | ALC885_MB5, |
210 | ALC885_IMAC24, | 210 | ALC885_IMAC24, |
211 | ALC882_AUTO, | ||
212 | ALC882_MODEL_LAST, | ||
213 | }; | ||
214 | |||
215 | /* ALC883 models */ | ||
216 | enum { | ||
217 | ALC883_3ST_2ch_DIG, | 211 | ALC883_3ST_2ch_DIG, |
218 | ALC883_3ST_6ch_DIG, | 212 | ALC883_3ST_6ch_DIG, |
219 | ALC883_3ST_6ch, | 213 | ALC883_3ST_6ch, |
@@ -226,6 +220,7 @@ enum { | |||
226 | ALC888_ACER_ASPIRE_4930G, | 220 | ALC888_ACER_ASPIRE_4930G, |
227 | ALC888_ACER_ASPIRE_6530G, | 221 | ALC888_ACER_ASPIRE_6530G, |
228 | ALC888_ACER_ASPIRE_8930G, | 222 | ALC888_ACER_ASPIRE_8930G, |
223 | ALC888_ACER_ASPIRE_7730G, | ||
229 | ALC883_MEDION, | 224 | ALC883_MEDION, |
230 | ALC883_MEDION_MD2, | 225 | ALC883_MEDION_MD2, |
231 | ALC883_LAPTOP_EAPD, | 226 | ALC883_LAPTOP_EAPD, |
@@ -237,17 +232,20 @@ enum { | |||
237 | ALC888_3ST_HP, | 232 | ALC888_3ST_HP, |
238 | ALC888_6ST_DELL, | 233 | ALC888_6ST_DELL, |
239 | ALC883_MITAC, | 234 | ALC883_MITAC, |
235 | ALC883_CLEVO_M540R, | ||
240 | ALC883_CLEVO_M720, | 236 | ALC883_CLEVO_M720, |
241 | ALC883_FUJITSU_PI2515, | 237 | ALC883_FUJITSU_PI2515, |
242 | ALC888_FUJITSU_XA3530, | 238 | ALC888_FUJITSU_XA3530, |
243 | ALC883_3ST_6ch_INTEL, | 239 | ALC883_3ST_6ch_INTEL, |
240 | ALC889A_INTEL, | ||
241 | ALC889_INTEL, | ||
244 | ALC888_ASUS_M90V, | 242 | ALC888_ASUS_M90V, |
245 | ALC888_ASUS_EEE1601, | 243 | ALC888_ASUS_EEE1601, |
246 | ALC889A_MB31, | 244 | ALC889A_MB31, |
247 | ALC1200_ASUS_P5Q, | 245 | ALC1200_ASUS_P5Q, |
248 | ALC883_SONY_VAIO_TT, | 246 | ALC883_SONY_VAIO_TT, |
249 | ALC883_AUTO, | 247 | ALC882_AUTO, |
250 | ALC883_MODEL_LAST, | 248 | ALC882_MODEL_LAST, |
251 | }; | 249 | }; |
252 | 250 | ||
253 | /* for GPIO Poll */ | 251 | /* for GPIO Poll */ |
@@ -262,6 +260,14 @@ enum { | |||
262 | ALC_INIT_GPIO3, | 260 | ALC_INIT_GPIO3, |
263 | }; | 261 | }; |
264 | 262 | ||
263 | struct alc_mic_route { | ||
264 | hda_nid_t pin; | ||
265 | unsigned char mux_idx; | ||
266 | unsigned char amix_idx; | ||
267 | }; | ||
268 | |||
269 | #define MUX_IDX_UNDEF ((unsigned char)-1) | ||
270 | |||
265 | struct alc_spec { | 271 | struct alc_spec { |
266 | /* codec parameterization */ | 272 | /* codec parameterization */ |
267 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | 273 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
@@ -304,6 +310,8 @@ struct alc_spec { | |||
304 | unsigned int num_mux_defs; | 310 | unsigned int num_mux_defs; |
305 | const struct hda_input_mux *input_mux; | 311 | const struct hda_input_mux *input_mux; |
306 | unsigned int cur_mux[3]; | 312 | unsigned int cur_mux[3]; |
313 | struct alc_mic_route ext_mic; | ||
314 | struct alc_mic_route int_mic; | ||
307 | 315 | ||
308 | /* channel model */ | 316 | /* channel model */ |
309 | const struct hda_channel_mode *channel_mode; | 317 | const struct hda_channel_mode *channel_mode; |
@@ -320,6 +328,8 @@ struct alc_spec { | |||
320 | struct snd_array kctls; | 328 | struct snd_array kctls; |
321 | struct hda_input_mux private_imux[3]; | 329 | struct hda_input_mux private_imux[3]; |
322 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 330 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
331 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | ||
332 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | ||
323 | 333 | ||
324 | /* hooks */ | 334 | /* hooks */ |
325 | void (*init_hook)(struct hda_codec *codec); | 335 | void (*init_hook)(struct hda_codec *codec); |
@@ -329,6 +339,7 @@ struct alc_spec { | |||
329 | unsigned int sense_updated: 1; | 339 | unsigned int sense_updated: 1; |
330 | unsigned int jack_present: 1; | 340 | unsigned int jack_present: 1; |
331 | unsigned int master_sw: 1; | 341 | unsigned int master_sw: 1; |
342 | unsigned int auto_mic:1; | ||
332 | 343 | ||
333 | /* other flags */ | 344 | /* other flags */ |
334 | unsigned int no_analog :1; /* digital I/O only */ | 345 | unsigned int no_analog :1; /* digital I/O only */ |
@@ -370,6 +381,7 @@ struct alc_config_preset { | |||
370 | unsigned int num_mux_defs; | 381 | unsigned int num_mux_defs; |
371 | const struct hda_input_mux *input_mux; | 382 | const struct hda_input_mux *input_mux; |
372 | void (*unsol_event)(struct hda_codec *, unsigned int); | 383 | void (*unsol_event)(struct hda_codec *, unsigned int); |
384 | void (*setup)(struct hda_codec *); | ||
373 | void (*init_hook)(struct hda_codec *); | 385 | void (*init_hook)(struct hda_codec *); |
374 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 386 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
375 | struct hda_amp_list *loopbacks; | 387 | struct hda_amp_list *loopbacks; |
@@ -417,7 +429,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
417 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 429 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
418 | imux = &spec->input_mux[mux_idx]; | 430 | imux = &spec->input_mux[mux_idx]; |
419 | 431 | ||
420 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 432 | type = get_wcaps_type(get_wcaps(codec, nid)); |
421 | if (type == AC_WID_AUD_MIX) { | 433 | if (type == AC_WID_AUD_MIX) { |
422 | /* Matrix-mixer style (e.g. ALC882) */ | 434 | /* Matrix-mixer style (e.g. ALC882) */ |
423 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | 435 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
@@ -842,9 +854,10 @@ static void print_realtek_coef(struct snd_info_buffer *buffer, | |||
842 | /* | 854 | /* |
843 | * set up from the preset table | 855 | * set up from the preset table |
844 | */ | 856 | */ |
845 | static void setup_preset(struct alc_spec *spec, | 857 | static void setup_preset(struct hda_codec *codec, |
846 | const struct alc_config_preset *preset) | 858 | const struct alc_config_preset *preset) |
847 | { | 859 | { |
860 | struct alc_spec *spec = codec->spec; | ||
848 | int i; | 861 | int i; |
849 | 862 | ||
850 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | 863 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
@@ -886,6 +899,9 @@ static void setup_preset(struct alc_spec *spec, | |||
886 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
887 | spec->loopback.amplist = preset->loopbacks; | 900 | spec->loopback.amplist = preset->loopbacks; |
888 | #endif | 901 | #endif |
902 | |||
903 | if (preset->setup) | ||
904 | preset->setup(codec); | ||
889 | } | 905 | } |
890 | 906 | ||
891 | /* Enable GPIO mask and set output */ | 907 | /* Enable GPIO mask and set output */ |
@@ -965,30 +981,64 @@ static void alc_automute_pin(struct hda_codec *codec) | |||
965 | } | 981 | } |
966 | } | 982 | } |
967 | 983 | ||
968 | #if 0 /* it's broken in some cases -- temporarily disabled */ | 984 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
985 | hda_nid_t nid) | ||
986 | { | ||
987 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
988 | int i, nums; | ||
989 | |||
990 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
991 | for (i = 0; i < nums; i++) | ||
992 | if (conn[i] == nid) | ||
993 | return i; | ||
994 | return -1; | ||
995 | } | ||
996 | |||
969 | static void alc_mic_automute(struct hda_codec *codec) | 997 | static void alc_mic_automute(struct hda_codec *codec) |
970 | { | 998 | { |
971 | struct alc_spec *spec = codec->spec; | 999 | struct alc_spec *spec = codec->spec; |
972 | unsigned int present; | 1000 | struct alc_mic_route *dead, *alive; |
973 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | 1001 | unsigned int present, type; |
974 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | 1002 | hda_nid_t cap_nid; |
975 | unsigned int mix_nid = spec->capsrc_nids[0]; | 1003 | |
976 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | 1004 | if (!spec->auto_mic) |
977 | 1005 | return; | |
978 | capsrc_idx_mic = mic_nid - 0x18; | 1006 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
979 | capsrc_idx_fmic = fmic_nid - 0x18; | 1007 | return; |
980 | present = snd_hda_codec_read(codec, mic_nid, 0, | 1008 | if (snd_BUG_ON(!spec->adc_nids)) |
981 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 1009 | return; |
982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 1010 | |
983 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | 1011 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
984 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 1012 | |
985 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | 1013 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
986 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | 1014 | AC_VERB_GET_PIN_SENSE, 0); |
987 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 1015 | present &= AC_PINSENSE_PRESENCE; |
1016 | if (present) { | ||
1017 | alive = &spec->ext_mic; | ||
1018 | dead = &spec->int_mic; | ||
1019 | } else { | ||
1020 | alive = &spec->int_mic; | ||
1021 | dead = &spec->ext_mic; | ||
1022 | } | ||
1023 | |||
1024 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | ||
1025 | if (type == AC_WID_AUD_MIX) { | ||
1026 | /* Matrix-mixer style (e.g. ALC882) */ | ||
1027 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
1028 | alive->mux_idx, | ||
1029 | HDA_AMP_MUTE, 0); | ||
1030 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
1031 | dead->mux_idx, | ||
1032 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
1033 | } else { | ||
1034 | /* MUX style (e.g. ALC880) */ | ||
1035 | snd_hda_codec_write_cache(codec, cap_nid, 0, | ||
1036 | AC_VERB_SET_CONNECT_SEL, | ||
1037 | alive->mux_idx); | ||
1038 | } | ||
1039 | |||
1040 | /* FIXME: analog mixer */ | ||
988 | } | 1041 | } |
989 | #else | ||
990 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ | ||
991 | #endif /* disabled */ | ||
992 | 1042 | ||
993 | /* unsolicited event for HP jack sensing */ | 1043 | /* unsolicited event for HP jack sensing */ |
994 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 1044 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -1031,6 +1081,16 @@ static void alc888_coef_init(struct hda_codec *codec) | |||
1031 | AC_VERB_SET_PROC_COEF, 0x3030); | 1081 | AC_VERB_SET_PROC_COEF, 0x3030); |
1032 | } | 1082 | } |
1033 | 1083 | ||
1084 | static void alc889_coef_init(struct hda_codec *codec) | ||
1085 | { | ||
1086 | unsigned int tmp; | ||
1087 | |||
1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
1089 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | ||
1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
1091 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | ||
1092 | } | ||
1093 | |||
1034 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 1094 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
1035 | { | 1095 | { |
1036 | unsigned int tmp; | 1096 | unsigned int tmp; |
@@ -1088,15 +1148,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
1088 | case 0x10ec0885: | 1148 | case 0x10ec0885: |
1089 | case 0x10ec0887: | 1149 | case 0x10ec0887: |
1090 | case 0x10ec0889: | 1150 | case 0x10ec0889: |
1091 | snd_hda_codec_write(codec, 0x20, 0, | 1151 | alc889_coef_init(codec); |
1092 | AC_VERB_SET_COEF_INDEX, 7); | ||
1093 | tmp = snd_hda_codec_read(codec, 0x20, 0, | ||
1094 | AC_VERB_GET_PROC_COEF, 0); | ||
1095 | snd_hda_codec_write(codec, 0x20, 0, | ||
1096 | AC_VERB_SET_COEF_INDEX, 7); | ||
1097 | snd_hda_codec_write(codec, 0x20, 0, | ||
1098 | AC_VERB_SET_PROC_COEF, | ||
1099 | tmp | 0x2010); | ||
1100 | break; | 1152 | break; |
1101 | case 0x10ec0888: | 1153 | case 0x10ec0888: |
1102 | alc888_coef_init(codec); | 1154 | alc888_coef_init(codec); |
@@ -1142,6 +1194,55 @@ static void alc_init_auto_hp(struct hda_codec *codec) | |||
1142 | spec->unsol_event = alc_sku_unsol_event; | 1194 | spec->unsol_event = alc_sku_unsol_event; |
1143 | } | 1195 | } |
1144 | 1196 | ||
1197 | static void alc_init_auto_mic(struct hda_codec *codec) | ||
1198 | { | ||
1199 | struct alc_spec *spec = codec->spec; | ||
1200 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1201 | hda_nid_t fixed, ext; | ||
1202 | int i; | ||
1203 | |||
1204 | /* there must be only two mic inputs exclusively */ | ||
1205 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) | ||
1206 | if (cfg->input_pins[i]) | ||
1207 | return; | ||
1208 | |||
1209 | fixed = ext = 0; | ||
1210 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { | ||
1211 | hda_nid_t nid = cfg->input_pins[i]; | ||
1212 | unsigned int defcfg; | ||
1213 | if (!nid) | ||
1214 | return; | ||
1215 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | ||
1216 | switch (get_defcfg_connect(defcfg)) { | ||
1217 | case AC_JACK_PORT_FIXED: | ||
1218 | if (fixed) | ||
1219 | return; /* already occupied */ | ||
1220 | fixed = nid; | ||
1221 | break; | ||
1222 | case AC_JACK_PORT_COMPLEX: | ||
1223 | if (ext) | ||
1224 | return; /* already occupied */ | ||
1225 | ext = nid; | ||
1226 | break; | ||
1227 | default: | ||
1228 | return; /* invalid entry */ | ||
1229 | } | ||
1230 | } | ||
1231 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | ||
1232 | return; /* no unsol support */ | ||
1233 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | ||
1234 | ext, fixed); | ||
1235 | spec->ext_mic.pin = ext; | ||
1236 | spec->int_mic.pin = fixed; | ||
1237 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
1238 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
1239 | spec->auto_mic = 1; | ||
1240 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | ||
1241 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1242 | AC_USRSP_EN | ALC880_MIC_EVENT); | ||
1243 | spec->unsol_event = alc_sku_unsol_event; | ||
1244 | } | ||
1245 | |||
1145 | /* check subsystem ID and set up device-specific initialization; | 1246 | /* check subsystem ID and set up device-specific initialization; |
1146 | * return 1 if initialized, 0 if invalid SSID | 1247 | * return 1 if initialized, 0 if invalid SSID |
1147 | */ | 1248 | */ |
@@ -1243,6 +1344,7 @@ do_sku: | |||
1243 | } | 1344 | } |
1244 | 1345 | ||
1245 | alc_init_auto_hp(codec); | 1346 | alc_init_auto_hp(codec); |
1347 | alc_init_auto_mic(codec); | ||
1246 | return 1; | 1348 | return 1; |
1247 | } | 1349 | } |
1248 | 1350 | ||
@@ -1255,6 +1357,7 @@ static void alc_ssid_check(struct hda_codec *codec, | |||
1255 | "Enable default setup for auto mode as fallback\n"); | 1357 | "Enable default setup for auto mode as fallback\n"); |
1256 | spec->init_amp = ALC_INIT_DEFAULT; | 1358 | spec->init_amp = ALC_INIT_DEFAULT; |
1257 | alc_init_auto_hp(codec); | 1359 | alc_init_auto_hp(codec); |
1360 | alc_init_auto_mic(codec); | ||
1258 | } | 1361 | } |
1259 | } | 1362 | } |
1260 | 1363 | ||
@@ -1436,7 +1539,25 @@ static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |||
1436 | alc_automute_amp(codec); | 1539 | alc_automute_amp(codec); |
1437 | } | 1540 | } |
1438 | 1541 | ||
1439 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | 1542 | static void alc889_automute_setup(struct hda_codec *codec) |
1543 | { | ||
1544 | struct alc_spec *spec = codec->spec; | ||
1545 | |||
1546 | spec->autocfg.hp_pins[0] = 0x15; | ||
1547 | spec->autocfg.speaker_pins[0] = 0x14; | ||
1548 | spec->autocfg.speaker_pins[1] = 0x16; | ||
1549 | spec->autocfg.speaker_pins[2] = 0x17; | ||
1550 | spec->autocfg.speaker_pins[3] = 0x19; | ||
1551 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
1552 | } | ||
1553 | |||
1554 | static void alc889_intel_init_hook(struct hda_codec *codec) | ||
1555 | { | ||
1556 | alc889_coef_init(codec); | ||
1557 | alc_automute_amp(codec); | ||
1558 | } | ||
1559 | |||
1560 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | ||
1440 | { | 1561 | { |
1441 | struct alc_spec *spec = codec->spec; | 1562 | struct alc_spec *spec = codec->spec; |
1442 | 1563 | ||
@@ -1444,7 +1565,6 @@ static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | |||
1444 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | 1565 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
1445 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | 1566 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
1446 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | 1567 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
1447 | alc_automute_amp(codec); | ||
1448 | } | 1568 | } |
1449 | 1569 | ||
1450 | /* | 1570 | /* |
@@ -1643,16 +1763,15 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1643 | { } /* end */ | 1763 | { } /* end */ |
1644 | }; | 1764 | }; |
1645 | 1765 | ||
1646 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) | 1766 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1647 | { | 1767 | { |
1648 | struct alc_spec *spec = codec->spec; | 1768 | struct alc_spec *spec = codec->spec; |
1649 | 1769 | ||
1650 | spec->autocfg.hp_pins[0] = 0x15; | 1770 | spec->autocfg.hp_pins[0] = 0x15; |
1651 | spec->autocfg.speaker_pins[0] = 0x14; | 1771 | spec->autocfg.speaker_pins[0] = 0x14; |
1652 | alc_automute_amp(codec); | ||
1653 | } | 1772 | } |
1654 | 1773 | ||
1655 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | 1774 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
1656 | { | 1775 | { |
1657 | struct alc_spec *spec = codec->spec; | 1776 | struct alc_spec *spec = codec->spec; |
1658 | 1777 | ||
@@ -1660,10 +1779,9 @@ static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | |||
1660 | spec->autocfg.speaker_pins[0] = 0x14; | 1779 | spec->autocfg.speaker_pins[0] = 0x14; |
1661 | spec->autocfg.speaker_pins[1] = 0x16; | 1780 | spec->autocfg.speaker_pins[1] = 0x16; |
1662 | spec->autocfg.speaker_pins[2] = 0x17; | 1781 | spec->autocfg.speaker_pins[2] = 0x17; |
1663 | alc_automute_amp(codec); | ||
1664 | } | 1782 | } |
1665 | 1783 | ||
1666 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | 1784 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
1667 | { | 1785 | { |
1668 | struct alc_spec *spec = codec->spec; | 1786 | struct alc_spec *spec = codec->spec; |
1669 | 1787 | ||
@@ -1671,7 +1789,6 @@ static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | |||
1671 | spec->autocfg.speaker_pins[0] = 0x14; | 1789 | spec->autocfg.speaker_pins[0] = 0x14; |
1672 | spec->autocfg.speaker_pins[1] = 0x16; | 1790 | spec->autocfg.speaker_pins[1] = 0x16; |
1673 | spec->autocfg.speaker_pins[2] = 0x1b; | 1791 | spec->autocfg.speaker_pins[2] = 0x1b; |
1674 | alc_automute_amp(codec); | ||
1675 | } | 1792 | } |
1676 | 1793 | ||
1677 | /* | 1794 | /* |
@@ -2651,13 +2768,17 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |||
2651 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | 2768 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
2652 | } | 2769 | } |
2653 | 2770 | ||
2654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | 2771 | static void alc880_uniwill_setup(struct hda_codec *codec) |
2655 | { | 2772 | { |
2656 | struct alc_spec *spec = codec->spec; | 2773 | struct alc_spec *spec = codec->spec; |
2657 | 2774 | ||
2658 | spec->autocfg.hp_pins[0] = 0x14; | 2775 | spec->autocfg.hp_pins[0] = 0x14; |
2659 | spec->autocfg.speaker_pins[0] = 0x15; | 2776 | spec->autocfg.speaker_pins[0] = 0x15; |
2660 | spec->autocfg.speaker_pins[0] = 0x16; | 2777 | spec->autocfg.speaker_pins[0] = 0x16; |
2778 | } | ||
2779 | |||
2780 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | ||
2781 | { | ||
2661 | alc_automute_amp(codec); | 2782 | alc_automute_amp(codec); |
2662 | alc880_uniwill_mic_automute(codec); | 2783 | alc880_uniwill_mic_automute(codec); |
2663 | } | 2784 | } |
@@ -2678,13 +2799,12 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |||
2678 | } | 2799 | } |
2679 | } | 2800 | } |
2680 | 2801 | ||
2681 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) | 2802 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
2682 | { | 2803 | { |
2683 | struct alc_spec *spec = codec->spec; | 2804 | struct alc_spec *spec = codec->spec; |
2684 | 2805 | ||
2685 | spec->autocfg.hp_pins[0] = 0x14; | 2806 | spec->autocfg.hp_pins[0] = 0x14; |
2686 | spec->autocfg.speaker_pins[0] = 0x15; | 2807 | spec->autocfg.speaker_pins[0] = 0x15; |
2687 | alc_automute_amp(codec); | ||
2688 | } | 2808 | } |
2689 | 2809 | ||
2690 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 2810 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
@@ -2947,13 +3067,12 @@ static struct hda_verb alc880_lg_init_verbs[] = { | |||
2947 | }; | 3067 | }; |
2948 | 3068 | ||
2949 | /* toggle speaker-output according to the hp-jack state */ | 3069 | /* toggle speaker-output according to the hp-jack state */ |
2950 | static void alc880_lg_init_hook(struct hda_codec *codec) | 3070 | static void alc880_lg_setup(struct hda_codec *codec) |
2951 | { | 3071 | { |
2952 | struct alc_spec *spec = codec->spec; | 3072 | struct alc_spec *spec = codec->spec; |
2953 | 3073 | ||
2954 | spec->autocfg.hp_pins[0] = 0x1b; | 3074 | spec->autocfg.hp_pins[0] = 0x1b; |
2955 | spec->autocfg.speaker_pins[0] = 0x17; | 3075 | spec->autocfg.speaker_pins[0] = 0x17; |
2956 | alc_automute_amp(codec); | ||
2957 | } | 3076 | } |
2958 | 3077 | ||
2959 | /* | 3078 | /* |
@@ -3032,13 +3151,12 @@ static struct hda_verb alc880_lg_lw_init_verbs[] = { | |||
3032 | }; | 3151 | }; |
3033 | 3152 | ||
3034 | /* toggle speaker-output according to the hp-jack state */ | 3153 | /* toggle speaker-output according to the hp-jack state */ |
3035 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) | 3154 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
3036 | { | 3155 | { |
3037 | struct alc_spec *spec = codec->spec; | 3156 | struct alc_spec *spec = codec->spec; |
3038 | 3157 | ||
3039 | spec->autocfg.hp_pins[0] = 0x1b; | 3158 | spec->autocfg.hp_pins[0] = 0x1b; |
3040 | spec->autocfg.speaker_pins[0] = 0x14; | 3159 | spec->autocfg.speaker_pins[0] = 0x14; |
3041 | alc_automute_amp(codec); | ||
3042 | } | 3160 | } |
3043 | 3161 | ||
3044 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | 3162 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
@@ -3104,13 +3222,12 @@ static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |||
3104 | alc880_medion_rim_automute(codec); | 3222 | alc880_medion_rim_automute(codec); |
3105 | } | 3223 | } |
3106 | 3224 | ||
3107 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) | 3225 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
3108 | { | 3226 | { |
3109 | struct alc_spec *spec = codec->spec; | 3227 | struct alc_spec *spec = codec->spec; |
3110 | 3228 | ||
3111 | spec->autocfg.hp_pins[0] = 0x14; | 3229 | spec->autocfg.hp_pins[0] = 0x14; |
3112 | spec->autocfg.speaker_pins[0] = 0x1b; | 3230 | spec->autocfg.speaker_pins[0] = 0x1b; |
3113 | alc880_medion_rim_automute(codec); | ||
3114 | } | 3231 | } |
3115 | 3232 | ||
3116 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3233 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -3977,7 +4094,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
3977 | .channel_mode = alc880_2_jack_modes, | 4094 | .channel_mode = alc880_2_jack_modes, |
3978 | .input_mux = &alc880_f1734_capture_source, | 4095 | .input_mux = &alc880_f1734_capture_source, |
3979 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4096 | .unsol_event = alc880_uniwill_p53_unsol_event, |
3980 | .init_hook = alc880_uniwill_p53_init_hook, | 4097 | .setup = alc880_uniwill_p53_setup, |
4098 | .init_hook = alc_automute_amp, | ||
3981 | }, | 4099 | }, |
3982 | [ALC880_ASUS] = { | 4100 | [ALC880_ASUS] = { |
3983 | .mixers = { alc880_asus_mixer }, | 4101 | .mixers = { alc880_asus_mixer }, |
@@ -4054,6 +4172,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
4054 | .need_dac_fix = 1, | 4172 | .need_dac_fix = 1, |
4055 | .input_mux = &alc880_capture_source, | 4173 | .input_mux = &alc880_capture_source, |
4056 | .unsol_event = alc880_uniwill_unsol_event, | 4174 | .unsol_event = alc880_uniwill_unsol_event, |
4175 | .setup = alc880_uniwill_setup, | ||
4057 | .init_hook = alc880_uniwill_init_hook, | 4176 | .init_hook = alc880_uniwill_init_hook, |
4058 | }, | 4177 | }, |
4059 | [ALC880_UNIWILL_P53] = { | 4178 | [ALC880_UNIWILL_P53] = { |
@@ -4066,7 +4185,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4066 | .channel_mode = alc880_threestack_modes, | 4185 | .channel_mode = alc880_threestack_modes, |
4067 | .input_mux = &alc880_capture_source, | 4186 | .input_mux = &alc880_capture_source, |
4068 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4187 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4069 | .init_hook = alc880_uniwill_p53_init_hook, | 4188 | .setup = alc880_uniwill_p53_setup, |
4189 | .init_hook = alc_automute_amp, | ||
4070 | }, | 4190 | }, |
4071 | [ALC880_FUJITSU] = { | 4191 | [ALC880_FUJITSU] = { |
4072 | .mixers = { alc880_fujitsu_mixer }, | 4192 | .mixers = { alc880_fujitsu_mixer }, |
@@ -4080,7 +4200,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4080 | .channel_mode = alc880_2_jack_modes, | 4200 | .channel_mode = alc880_2_jack_modes, |
4081 | .input_mux = &alc880_capture_source, | 4201 | .input_mux = &alc880_capture_source, |
4082 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4202 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4083 | .init_hook = alc880_uniwill_p53_init_hook, | 4203 | .setup = alc880_uniwill_p53_setup, |
4204 | .init_hook = alc_automute_amp, | ||
4084 | }, | 4205 | }, |
4085 | [ALC880_CLEVO] = { | 4206 | [ALC880_CLEVO] = { |
4086 | .mixers = { alc880_three_stack_mixer }, | 4207 | .mixers = { alc880_three_stack_mixer }, |
@@ -4106,7 +4227,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4106 | .need_dac_fix = 1, | 4227 | .need_dac_fix = 1, |
4107 | .input_mux = &alc880_lg_capture_source, | 4228 | .input_mux = &alc880_lg_capture_source, |
4108 | .unsol_event = alc_automute_amp_unsol_event, | 4229 | .unsol_event = alc_automute_amp_unsol_event, |
4109 | .init_hook = alc880_lg_init_hook, | 4230 | .setup = alc880_lg_setup, |
4231 | .init_hook = alc_automute_amp, | ||
4110 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4232 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4111 | .loopbacks = alc880_lg_loopbacks, | 4233 | .loopbacks = alc880_lg_loopbacks, |
4112 | #endif | 4234 | #endif |
@@ -4122,7 +4244,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4122 | .channel_mode = alc880_lg_lw_modes, | 4244 | .channel_mode = alc880_lg_lw_modes, |
4123 | .input_mux = &alc880_lg_lw_capture_source, | 4245 | .input_mux = &alc880_lg_lw_capture_source, |
4124 | .unsol_event = alc_automute_amp_unsol_event, | 4246 | .unsol_event = alc_automute_amp_unsol_event, |
4125 | .init_hook = alc880_lg_lw_init_hook, | 4247 | .setup = alc880_lg_lw_setup, |
4248 | .init_hook = alc_automute_amp, | ||
4126 | }, | 4249 | }, |
4127 | [ALC880_MEDION_RIM] = { | 4250 | [ALC880_MEDION_RIM] = { |
4128 | .mixers = { alc880_medion_rim_mixer }, | 4251 | .mixers = { alc880_medion_rim_mixer }, |
@@ -4136,7 +4259,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4136 | .channel_mode = alc880_2_jack_modes, | 4259 | .channel_mode = alc880_2_jack_modes, |
4137 | .input_mux = &alc880_medion_rim_capture_source, | 4260 | .input_mux = &alc880_medion_rim_capture_source, |
4138 | .unsol_event = alc880_medion_rim_unsol_event, | 4261 | .unsol_event = alc880_medion_rim_unsol_event, |
4139 | .init_hook = alc880_medion_rim_init_hook, | 4262 | .setup = alc880_medion_rim_setup, |
4263 | .init_hook = alc880_medion_rim_automute, | ||
4140 | }, | 4264 | }, |
4141 | #ifdef CONFIG_SND_DEBUG | 4265 | #ifdef CONFIG_SND_DEBUG |
4142 | [ALC880_TEST] = { | 4266 | [ALC880_TEST] = { |
@@ -4189,8 +4313,6 @@ static int add_control(struct alc_spec *spec, int type, const char *name, | |||
4189 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | 4313 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
4190 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | 4314 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
4191 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | 4315 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
4192 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | ||
4193 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | ||
4194 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | 4316 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
4195 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | 4317 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
4196 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | 4318 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
@@ -4278,13 +4400,19 @@ static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
4278 | if (err < 0) | 4400 | if (err < 0) |
4279 | return err; | 4401 | return err; |
4280 | } else { | 4402 | } else { |
4281 | sprintf(name, "%s Playback Volume", chname[i]); | 4403 | const char *pfx; |
4404 | if (cfg->line_outs == 1 && | ||
4405 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
4406 | pfx = "Speaker"; | ||
4407 | else | ||
4408 | pfx = chname[i]; | ||
4409 | sprintf(name, "%s Playback Volume", pfx); | ||
4282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 4410 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
4283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 4411 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
4284 | HDA_OUTPUT)); | 4412 | HDA_OUTPUT)); |
4285 | if (err < 0) | 4413 | if (err < 0) |
4286 | return err; | 4414 | return err; |
4287 | sprintf(name, "%s Playback Switch", chname[i]); | 4415 | sprintf(name, "%s Playback Switch", pfx); |
4288 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 4416 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
4289 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | 4417 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
4290 | HDA_INPUT)); | 4418 | HDA_INPUT)); |
@@ -4358,31 +4486,61 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |||
4358 | return 0; | 4486 | return 0; |
4359 | } | 4487 | } |
4360 | 4488 | ||
4489 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
4490 | { | ||
4491 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
4492 | return (pincap & AC_PINCAP_IN) != 0; | ||
4493 | } | ||
4494 | |||
4361 | /* create playback/capture controls for input pins */ | 4495 | /* create playback/capture controls for input pins */ |
4362 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, | 4496 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
4363 | const struct auto_pin_cfg *cfg) | 4497 | const struct auto_pin_cfg *cfg, |
4498 | hda_nid_t mixer, | ||
4499 | hda_nid_t cap1, hda_nid_t cap2) | ||
4364 | { | 4500 | { |
4501 | struct alc_spec *spec = codec->spec; | ||
4365 | struct hda_input_mux *imux = &spec->private_imux[0]; | 4502 | struct hda_input_mux *imux = &spec->private_imux[0]; |
4366 | int i, err, idx; | 4503 | int i, err, idx; |
4367 | 4504 | ||
4368 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4505 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4369 | if (alc880_is_input_pin(cfg->input_pins[i])) { | 4506 | hda_nid_t pin; |
4370 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | 4507 | |
4371 | err = new_analog_input(spec, cfg->input_pins[i], | 4508 | pin = cfg->input_pins[i]; |
4372 | auto_pin_cfg_labels[i], | 4509 | if (!alc_is_input_pin(codec, pin)) |
4373 | idx, 0x0b); | 4510 | continue; |
4374 | if (err < 0) | 4511 | |
4375 | return err; | 4512 | if (mixer) { |
4513 | idx = get_connection_index(codec, mixer, pin); | ||
4514 | if (idx >= 0) { | ||
4515 | err = new_analog_input(spec, pin, | ||
4516 | auto_pin_cfg_labels[i], | ||
4517 | idx, mixer); | ||
4518 | if (err < 0) | ||
4519 | return err; | ||
4520 | } | ||
4521 | } | ||
4522 | |||
4523 | if (!cap1) | ||
4524 | continue; | ||
4525 | idx = get_connection_index(codec, cap1, pin); | ||
4526 | if (idx < 0 && cap2) | ||
4527 | idx = get_connection_index(codec, cap2, pin); | ||
4528 | if (idx >= 0) { | ||
4376 | imux->items[imux->num_items].label = | 4529 | imux->items[imux->num_items].label = |
4377 | auto_pin_cfg_labels[i]; | 4530 | auto_pin_cfg_labels[i]; |
4378 | imux->items[imux->num_items].index = | 4531 | imux->items[imux->num_items].index = idx; |
4379 | alc880_input_pin_idx(cfg->input_pins[i]); | ||
4380 | imux->num_items++; | 4532 | imux->num_items++; |
4381 | } | 4533 | } |
4382 | } | 4534 | } |
4383 | return 0; | 4535 | return 0; |
4384 | } | 4536 | } |
4385 | 4537 | ||
4538 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | ||
4539 | const struct auto_pin_cfg *cfg) | ||
4540 | { | ||
4541 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | ||
4542 | } | ||
4543 | |||
4386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | 4544 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
4387 | unsigned int pin_type) | 4545 | unsigned int pin_type) |
4388 | { | 4546 | { |
@@ -4448,7 +4606,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4448 | 4606 | ||
4449 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4607 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4450 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 4608 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
4451 | if (alc880_is_input_pin(nid)) { | 4609 | if (alc_is_input_pin(codec, nid)) { |
4452 | alc_set_input_pin(codec, nid, i); | 4610 | alc_set_input_pin(codec, nid, i); |
4453 | if (nid != ALC880_PIN_CD_NID && | 4611 | if (nid != ALC880_PIN_CD_NID && |
4454 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 4612 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -4491,7 +4649,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4491 | "Headphone"); | 4649 | "Headphone"); |
4492 | if (err < 0) | 4650 | if (err < 0) |
4493 | return err; | 4651 | return err; |
4494 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | 4652 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
4495 | if (err < 0) | 4653 | if (err < 0) |
4496 | return err; | 4654 | return err; |
4497 | 4655 | ||
@@ -4505,12 +4663,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4505 | &dig_nid, 1); | 4663 | &dig_nid, 1); |
4506 | if (err < 0) | 4664 | if (err < 0) |
4507 | continue; | 4665 | continue; |
4508 | if (dig_nid > 0x7f) { | ||
4509 | printk(KERN_ERR "alc880_auto: invalid dig_nid " | ||
4510 | "connection 0x%x for NID 0x%x\n", dig_nid, | ||
4511 | spec->autocfg.dig_out_pins[i]); | ||
4512 | continue; | ||
4513 | } | ||
4514 | if (!i) | 4666 | if (!i) |
4515 | spec->multiout.dig_out_nid = dig_nid; | 4667 | spec->multiout.dig_out_nid = dig_nid; |
4516 | else { | 4668 | else { |
@@ -4547,8 +4699,42 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
4547 | alc_inithook(codec); | 4699 | alc_inithook(codec); |
4548 | } | 4700 | } |
4549 | 4701 | ||
4550 | static void set_capture_mixer(struct alc_spec *spec) | 4702 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
4703 | * one of two digital mic pins, e.g. on ALC272 | ||
4704 | */ | ||
4705 | static void fixup_automic_adc(struct hda_codec *codec) | ||
4551 | { | 4706 | { |
4707 | struct alc_spec *spec = codec->spec; | ||
4708 | int i; | ||
4709 | |||
4710 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
4711 | hda_nid_t cap = spec->capsrc_nids ? | ||
4712 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
4713 | int iidx, eidx; | ||
4714 | |||
4715 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | ||
4716 | if (iidx < 0) | ||
4717 | continue; | ||
4718 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | ||
4719 | if (eidx < 0) | ||
4720 | continue; | ||
4721 | spec->int_mic.mux_idx = iidx; | ||
4722 | spec->ext_mic.mux_idx = eidx; | ||
4723 | if (spec->capsrc_nids) | ||
4724 | spec->capsrc_nids += i; | ||
4725 | spec->adc_nids += i; | ||
4726 | spec->num_adc_nids = 1; | ||
4727 | return; | ||
4728 | } | ||
4729 | snd_printd(KERN_INFO "hda_codec: %s: " | ||
4730 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | ||
4731 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | ||
4732 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | ||
4733 | } | ||
4734 | |||
4735 | static void set_capture_mixer(struct hda_codec *codec) | ||
4736 | { | ||
4737 | struct alc_spec *spec = codec->spec; | ||
4552 | static struct snd_kcontrol_new *caps[2][3] = { | 4738 | static struct snd_kcontrol_new *caps[2][3] = { |
4553 | { alc_capture_mixer_nosrc1, | 4739 | { alc_capture_mixer_nosrc1, |
4554 | alc_capture_mixer_nosrc2, | 4740 | alc_capture_mixer_nosrc2, |
@@ -4559,7 +4745,10 @@ static void set_capture_mixer(struct alc_spec *spec) | |||
4559 | }; | 4745 | }; |
4560 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | 4746 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4561 | int mux; | 4747 | int mux; |
4562 | if (spec->input_mux && spec->input_mux->num_items > 1) | 4748 | if (spec->auto_mic) { |
4749 | mux = 0; | ||
4750 | fixup_automic_adc(codec); | ||
4751 | } else if (spec->input_mux && spec->input_mux->num_items > 1) | ||
4563 | mux = 1; | 4752 | mux = 1; |
4564 | else | 4753 | else |
4565 | mux = 0; | 4754 | mux = 0; |
@@ -4590,8 +4779,8 @@ static int patch_alc880(struct hda_codec *codec) | |||
4590 | alc880_models, | 4779 | alc880_models, |
4591 | alc880_cfg_tbl); | 4780 | alc880_cfg_tbl); |
4592 | if (board_config < 0) { | 4781 | if (board_config < 0) { |
4593 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 4782 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4594 | "trying auto-probe from BIOS...\n", codec->chip_name); | 4783 | codec->chip_name); |
4595 | board_config = ALC880_AUTO; | 4784 | board_config = ALC880_AUTO; |
4596 | } | 4785 | } |
4597 | 4786 | ||
@@ -4616,7 +4805,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4616 | } | 4805 | } |
4617 | 4806 | ||
4618 | if (board_config != ALC880_AUTO) | 4807 | if (board_config != ALC880_AUTO) |
4619 | setup_preset(spec, &alc880_presets[board_config]); | 4808 | setup_preset(codec, &alc880_presets[board_config]); |
4620 | 4809 | ||
4621 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | 4810 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
4622 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | 4811 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
@@ -4629,7 +4818,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4629 | /* check whether NID 0x07 is valid */ | 4818 | /* check whether NID 0x07 is valid */ |
4630 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | 4819 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
4631 | /* get type */ | 4820 | /* get type */ |
4632 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 4821 | wcap = get_wcaps_type(wcap); |
4633 | if (wcap != AC_WID_AUD_IN) { | 4822 | if (wcap != AC_WID_AUD_IN) { |
4634 | spec->adc_nids = alc880_adc_nids_alt; | 4823 | spec->adc_nids = alc880_adc_nids_alt; |
4635 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | 4824 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
@@ -4638,7 +4827,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4638 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | 4827 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
4639 | } | 4828 | } |
4640 | } | 4829 | } |
4641 | set_capture_mixer(spec); | 4830 | set_capture_mixer(codec); |
4642 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 4831 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
4643 | 4832 | ||
4644 | spec->vmaster_nid = 0x0c; | 4833 | spec->vmaster_nid = 0x0c; |
@@ -5830,7 +6019,14 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5830 | 6019 | ||
5831 | nid = cfg->line_out_pins[0]; | 6020 | nid = cfg->line_out_pins[0]; |
5832 | if (nid) { | 6021 | if (nid) { |
5833 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); | 6022 | const char *pfx; |
6023 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | ||
6024 | pfx = "Master"; | ||
6025 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
6026 | pfx = "Speaker"; | ||
6027 | else | ||
6028 | pfx = "Front"; | ||
6029 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | ||
5834 | if (err < 0) | 6030 | if (err < 0) |
5835 | return err; | 6031 | return err; |
5836 | } | 6032 | } |
@@ -5853,39 +6049,10 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5853 | } | 6049 | } |
5854 | 6050 | ||
5855 | /* create playback/capture controls for input pins */ | 6051 | /* create playback/capture controls for input pins */ |
5856 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | 6052 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
5857 | const struct auto_pin_cfg *cfg) | 6053 | const struct auto_pin_cfg *cfg) |
5858 | { | 6054 | { |
5859 | struct hda_input_mux *imux = &spec->private_imux[0]; | 6055 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
5860 | int i, err, idx; | ||
5861 | |||
5862 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
5863 | if (cfg->input_pins[i] >= 0x12) { | ||
5864 | idx = cfg->input_pins[i] - 0x12; | ||
5865 | err = new_analog_input(spec, cfg->input_pins[i], | ||
5866 | auto_pin_cfg_labels[i], idx, | ||
5867 | 0x07); | ||
5868 | if (err < 0) | ||
5869 | return err; | ||
5870 | imux->items[imux->num_items].label = | ||
5871 | auto_pin_cfg_labels[i]; | ||
5872 | imux->items[imux->num_items].index = idx; | ||
5873 | imux->num_items++; | ||
5874 | } | ||
5875 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ | ||
5876 | idx = cfg->input_pins[i] - 0x09; | ||
5877 | err = new_analog_input(spec, cfg->input_pins[i], | ||
5878 | auto_pin_cfg_labels[i], idx, | ||
5879 | 0x07); | ||
5880 | if (err < 0) | ||
5881 | return err; | ||
5882 | imux->items[imux->num_items].label = | ||
5883 | auto_pin_cfg_labels[i]; | ||
5884 | imux->items[imux->num_items].index = idx; | ||
5885 | imux->num_items++; | ||
5886 | } | ||
5887 | } | ||
5888 | return 0; | ||
5889 | } | 6056 | } |
5890 | 6057 | ||
5891 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | 6058 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
@@ -5999,7 +6166,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5999 | return err; | 6166 | return err; |
6000 | if (!spec->kctls.list) | 6167 | if (!spec->kctls.list) |
6001 | return 0; /* can't find valid BIOS pin config */ | 6168 | return 0; /* can't find valid BIOS pin config */ |
6002 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); | 6169 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
6003 | if (err < 0) | 6170 | if (err < 0) |
6004 | return err; | 6171 | return err; |
6005 | 6172 | ||
@@ -6234,8 +6401,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6234 | alc260_models, | 6401 | alc260_models, |
6235 | alc260_cfg_tbl); | 6402 | alc260_cfg_tbl); |
6236 | if (board_config < 0) { | 6403 | if (board_config < 0) { |
6237 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " | 6404 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
6238 | "trying auto-probe from BIOS...\n", | ||
6239 | codec->chip_name); | 6405 | codec->chip_name); |
6240 | board_config = ALC260_AUTO; | 6406 | board_config = ALC260_AUTO; |
6241 | } | 6407 | } |
@@ -6261,7 +6427,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6261 | } | 6427 | } |
6262 | 6428 | ||
6263 | if (board_config != ALC260_AUTO) | 6429 | if (board_config != ALC260_AUTO) |
6264 | setup_preset(spec, &alc260_presets[board_config]); | 6430 | setup_preset(codec, &alc260_presets[board_config]); |
6265 | 6431 | ||
6266 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | 6432 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
6267 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | 6433 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
@@ -6272,7 +6438,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6272 | if (!spec->adc_nids && spec->input_mux) { | 6438 | if (!spec->adc_nids && spec->input_mux) { |
6273 | /* check whether NID 0x04 is valid */ | 6439 | /* check whether NID 0x04 is valid */ |
6274 | unsigned int wcap = get_wcaps(codec, 0x04); | 6440 | unsigned int wcap = get_wcaps(codec, 0x04); |
6275 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 6441 | wcap = get_wcaps_type(wcap); |
6276 | /* get type */ | 6442 | /* get type */ |
6277 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 6443 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
6278 | spec->adc_nids = alc260_adc_nids_alt; | 6444 | spec->adc_nids = alc260_adc_nids_alt; |
@@ -6282,7 +6448,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6282 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | 6448 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
6283 | } | 6449 | } |
6284 | } | 6450 | } |
6285 | set_capture_mixer(spec); | 6451 | set_capture_mixer(codec); |
6286 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | 6452 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
6287 | 6453 | ||
6288 | spec->vmaster_nid = 0x08; | 6454 | spec->vmaster_nid = 0x08; |
@@ -6301,7 +6467,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6301 | 6467 | ||
6302 | 6468 | ||
6303 | /* | 6469 | /* |
6304 | * ALC882 support | 6470 | * ALC882/883/885/888/889 support |
6305 | * | 6471 | * |
6306 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | 6472 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
6307 | * configuration. Each pin widget can choose any input DACs and a mixer. | 6473 | * configuration. Each pin widget can choose any input DACs and a mixer. |
@@ -6313,22 +6479,35 @@ static int patch_alc260(struct hda_codec *codec) | |||
6313 | */ | 6479 | */ |
6314 | #define ALC882_DIGOUT_NID 0x06 | 6480 | #define ALC882_DIGOUT_NID 0x06 |
6315 | #define ALC882_DIGIN_NID 0x0a | 6481 | #define ALC882_DIGIN_NID 0x0a |
6482 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | ||
6483 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | ||
6484 | #define ALC1200_DIGOUT_NID 0x10 | ||
6485 | |||
6316 | 6486 | ||
6317 | static struct hda_channel_mode alc882_ch_modes[1] = { | 6487 | static struct hda_channel_mode alc882_ch_modes[1] = { |
6318 | { 8, NULL } | 6488 | { 8, NULL } |
6319 | }; | 6489 | }; |
6320 | 6490 | ||
6491 | /* DACs */ | ||
6321 | static hda_nid_t alc882_dac_nids[4] = { | 6492 | static hda_nid_t alc882_dac_nids[4] = { |
6322 | /* front, rear, clfe, rear_surr */ | 6493 | /* front, rear, clfe, rear_surr */ |
6323 | 0x02, 0x03, 0x04, 0x05 | 6494 | 0x02, 0x03, 0x04, 0x05 |
6324 | }; | 6495 | }; |
6496 | #define alc883_dac_nids alc882_dac_nids | ||
6325 | 6497 | ||
6326 | /* identical with ALC880 */ | 6498 | /* ADCs */ |
6327 | #define alc882_adc_nids alc880_adc_nids | 6499 | #define alc882_adc_nids alc880_adc_nids |
6328 | #define alc882_adc_nids_alt alc880_adc_nids_alt | 6500 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
6501 | #define alc883_adc_nids alc882_adc_nids_alt | ||
6502 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | ||
6503 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | ||
6504 | #define alc889_adc_nids alc880_adc_nids | ||
6329 | 6505 | ||
6330 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | 6506 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
6331 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | 6507 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
6508 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | ||
6509 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
6510 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
6332 | 6511 | ||
6333 | /* input MUX */ | 6512 | /* input MUX */ |
6334 | /* FIXME: should be a matrix-type input source selection */ | 6513 | /* FIXME: should be a matrix-type input source selection */ |
@@ -6343,6 +6522,17 @@ static struct hda_input_mux alc882_capture_source = { | |||
6343 | }, | 6522 | }, |
6344 | }; | 6523 | }; |
6345 | 6524 | ||
6525 | #define alc883_capture_source alc882_capture_source | ||
6526 | |||
6527 | static struct hda_input_mux alc889_capture_source = { | ||
6528 | .num_items = 3, | ||
6529 | .items = { | ||
6530 | { "Front Mic", 0x0 }, | ||
6531 | { "Mic", 0x3 }, | ||
6532 | { "Line", 0x2 }, | ||
6533 | }, | ||
6534 | }; | ||
6535 | |||
6346 | static struct hda_input_mux mb5_capture_source = { | 6536 | static struct hda_input_mux mb5_capture_source = { |
6347 | .num_items = 3, | 6537 | .num_items = 3, |
6348 | .items = { | 6538 | .items = { |
@@ -6352,6 +6542,77 @@ static struct hda_input_mux mb5_capture_source = { | |||
6352 | }, | 6542 | }, |
6353 | }; | 6543 | }; |
6354 | 6544 | ||
6545 | static struct hda_input_mux alc883_3stack_6ch_intel = { | ||
6546 | .num_items = 4, | ||
6547 | .items = { | ||
6548 | { "Mic", 0x1 }, | ||
6549 | { "Front Mic", 0x0 }, | ||
6550 | { "Line", 0x2 }, | ||
6551 | { "CD", 0x4 }, | ||
6552 | }, | ||
6553 | }; | ||
6554 | |||
6555 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
6556 | .num_items = 2, | ||
6557 | .items = { | ||
6558 | { "Mic", 0x1 }, | ||
6559 | { "Line", 0x2 }, | ||
6560 | }, | ||
6561 | }; | ||
6562 | |||
6563 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
6564 | .num_items = 4, | ||
6565 | .items = { | ||
6566 | { "Mic", 0x0 }, | ||
6567 | { "iMic", 0x1 }, | ||
6568 | { "Line", 0x2 }, | ||
6569 | { "CD", 0x4 }, | ||
6570 | }, | ||
6571 | }; | ||
6572 | |||
6573 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
6574 | .num_items = 2, | ||
6575 | .items = { | ||
6576 | { "Mic", 0x0 }, | ||
6577 | { "Int Mic", 0x1 }, | ||
6578 | }, | ||
6579 | }; | ||
6580 | |||
6581 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
6582 | .num_items = 3, | ||
6583 | .items = { | ||
6584 | { "Mic", 0x0 }, | ||
6585 | { "Front Mic", 0x1 }, | ||
6586 | { "Line", 0x4 }, | ||
6587 | }, | ||
6588 | }; | ||
6589 | |||
6590 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
6591 | .num_items = 2, | ||
6592 | .items = { | ||
6593 | { "Mic", 0x0 }, | ||
6594 | { "Line", 0x2 }, | ||
6595 | }, | ||
6596 | }; | ||
6597 | |||
6598 | static struct hda_input_mux alc889A_mb31_capture_source = { | ||
6599 | .num_items = 2, | ||
6600 | .items = { | ||
6601 | { "Mic", 0x0 }, | ||
6602 | /* Front Mic (0x01) unused */ | ||
6603 | { "Line", 0x2 }, | ||
6604 | /* Line 2 (0x03) unused */ | ||
6605 | /* CD (0x04) unsused? */ | ||
6606 | }, | ||
6607 | }; | ||
6608 | |||
6609 | /* | ||
6610 | * 2ch mode | ||
6611 | */ | ||
6612 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
6613 | { 2, NULL } | ||
6614 | }; | ||
6615 | |||
6355 | /* | 6616 | /* |
6356 | * 2ch mode | 6617 | * 2ch mode |
6357 | */ | 6618 | */ |
@@ -6364,6 +6625,18 @@ static struct hda_verb alc882_3ST_ch2_init[] = { | |||
6364 | }; | 6625 | }; |
6365 | 6626 | ||
6366 | /* | 6627 | /* |
6628 | * 4ch mode | ||
6629 | */ | ||
6630 | static struct hda_verb alc882_3ST_ch4_init[] = { | ||
6631 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6632 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6635 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6636 | { } /* end */ | ||
6637 | }; | ||
6638 | |||
6639 | /* | ||
6367 | * 6ch mode | 6640 | * 6ch mode |
6368 | */ | 6641 | */ |
6369 | static struct hda_verb alc882_3ST_ch6_init[] = { | 6642 | static struct hda_verb alc882_3ST_ch6_init[] = { |
@@ -6376,11 +6649,60 @@ static struct hda_verb alc882_3ST_ch6_init[] = { | |||
6376 | { } /* end */ | 6649 | { } /* end */ |
6377 | }; | 6650 | }; |
6378 | 6651 | ||
6379 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { | 6652 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
6380 | { 2, alc882_3ST_ch2_init }, | 6653 | { 2, alc882_3ST_ch2_init }, |
6654 | { 4, alc882_3ST_ch4_init }, | ||
6381 | { 6, alc882_3ST_ch6_init }, | 6655 | { 6, alc882_3ST_ch6_init }, |
6382 | }; | 6656 | }; |
6383 | 6657 | ||
6658 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | ||
6659 | |||
6660 | /* | ||
6661 | * 2ch mode | ||
6662 | */ | ||
6663 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | ||
6664 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
6665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6667 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6668 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6669 | { } /* end */ | ||
6670 | }; | ||
6671 | |||
6672 | /* | ||
6673 | * 4ch mode | ||
6674 | */ | ||
6675 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | ||
6676 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6677 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6678 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6679 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6680 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6681 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6682 | { } /* end */ | ||
6683 | }; | ||
6684 | |||
6685 | /* | ||
6686 | * 6ch mode | ||
6687 | */ | ||
6688 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | ||
6689 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6692 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6695 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6696 | { } /* end */ | ||
6697 | }; | ||
6698 | |||
6699 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | ||
6700 | { 2, alc883_3ST_ch2_clevo_init }, | ||
6701 | { 4, alc883_3ST_ch4_clevo_init }, | ||
6702 | { 6, alc883_3ST_ch6_clevo_init }, | ||
6703 | }; | ||
6704 | |||
6705 | |||
6384 | /* | 6706 | /* |
6385 | * 6ch mode | 6707 | * 6ch mode |
6386 | */ | 6708 | */ |
@@ -6468,6 +6790,189 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |||
6468 | { 6, alc885_mb5_ch6_init }, | 6790 | { 6, alc885_mb5_ch6_init }, |
6469 | }; | 6791 | }; |
6470 | 6792 | ||
6793 | |||
6794 | /* | ||
6795 | * 2ch mode | ||
6796 | */ | ||
6797 | static struct hda_verb alc883_4ST_ch2_init[] = { | ||
6798 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6799 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6800 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6801 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6804 | { } /* end */ | ||
6805 | }; | ||
6806 | |||
6807 | /* | ||
6808 | * 4ch mode | ||
6809 | */ | ||
6810 | static struct hda_verb alc883_4ST_ch4_init[] = { | ||
6811 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6812 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6815 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6816 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6817 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6818 | { } /* end */ | ||
6819 | }; | ||
6820 | |||
6821 | /* | ||
6822 | * 6ch mode | ||
6823 | */ | ||
6824 | static struct hda_verb alc883_4ST_ch6_init[] = { | ||
6825 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6826 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6827 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6828 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6829 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6830 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6831 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6832 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6833 | { } /* end */ | ||
6834 | }; | ||
6835 | |||
6836 | /* | ||
6837 | * 8ch mode | ||
6838 | */ | ||
6839 | static struct hda_verb alc883_4ST_ch8_init[] = { | ||
6840 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6841 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6842 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6843 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6844 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6845 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6846 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6847 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6848 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6849 | { } /* end */ | ||
6850 | }; | ||
6851 | |||
6852 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
6853 | { 2, alc883_4ST_ch2_init }, | ||
6854 | { 4, alc883_4ST_ch4_init }, | ||
6855 | { 6, alc883_4ST_ch6_init }, | ||
6856 | { 8, alc883_4ST_ch8_init }, | ||
6857 | }; | ||
6858 | |||
6859 | |||
6860 | /* | ||
6861 | * 2ch mode | ||
6862 | */ | ||
6863 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
6864 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6865 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6866 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6867 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6868 | { } /* end */ | ||
6869 | }; | ||
6870 | |||
6871 | /* | ||
6872 | * 4ch mode | ||
6873 | */ | ||
6874 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
6875 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6876 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6877 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6878 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6879 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6880 | { } /* end */ | ||
6881 | }; | ||
6882 | |||
6883 | /* | ||
6884 | * 6ch mode | ||
6885 | */ | ||
6886 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
6887 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6888 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6889 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6890 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6891 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6892 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6893 | { } /* end */ | ||
6894 | }; | ||
6895 | |||
6896 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
6897 | { 2, alc883_3ST_ch2_intel_init }, | ||
6898 | { 4, alc883_3ST_ch4_intel_init }, | ||
6899 | { 6, alc883_3ST_ch6_intel_init }, | ||
6900 | }; | ||
6901 | |||
6902 | /* | ||
6903 | * 2ch mode | ||
6904 | */ | ||
6905 | static struct hda_verb alc889_ch2_intel_init[] = { | ||
6906 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6907 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6908 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6909 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6910 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6911 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6912 | { } /* end */ | ||
6913 | }; | ||
6914 | |||
6915 | /* | ||
6916 | * 6ch mode | ||
6917 | */ | ||
6918 | static struct hda_verb alc889_ch6_intel_init[] = { | ||
6919 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6920 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6921 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6922 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6923 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6924 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6925 | { } /* end */ | ||
6926 | }; | ||
6927 | |||
6928 | /* | ||
6929 | * 8ch mode | ||
6930 | */ | ||
6931 | static struct hda_verb alc889_ch8_intel_init[] = { | ||
6932 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6933 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6934 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6935 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6936 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6939 | { } /* end */ | ||
6940 | }; | ||
6941 | |||
6942 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | ||
6943 | { 2, alc889_ch2_intel_init }, | ||
6944 | { 6, alc889_ch6_intel_init }, | ||
6945 | { 8, alc889_ch8_intel_init }, | ||
6946 | }; | ||
6947 | |||
6948 | /* | ||
6949 | * 6ch mode | ||
6950 | */ | ||
6951 | static struct hda_verb alc883_sixstack_ch6_init[] = { | ||
6952 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
6953 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6954 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6955 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6956 | { } /* end */ | ||
6957 | }; | ||
6958 | |||
6959 | /* | ||
6960 | * 8ch mode | ||
6961 | */ | ||
6962 | static struct hda_verb alc883_sixstack_ch8_init[] = { | ||
6963 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6964 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6965 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6966 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6967 | { } /* end */ | ||
6968 | }; | ||
6969 | |||
6970 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
6971 | { 6, alc883_sixstack_ch6_init }, | ||
6972 | { 8, alc883_sixstack_ch8_init }, | ||
6973 | }; | ||
6974 | |||
6975 | |||
6471 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | 6976 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
6472 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | 6977 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
6473 | */ | 6978 | */ |
@@ -6604,7 +7109,7 @@ static struct snd_kcontrol_new alc882_chmode_mixer[] = { | |||
6604 | { } /* end */ | 7109 | { } /* end */ |
6605 | }; | 7110 | }; |
6606 | 7111 | ||
6607 | static struct hda_verb alc882_init_verbs[] = { | 7112 | static struct hda_verb alc882_base_init_verbs[] = { |
6608 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | 7113 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
6609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 7114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
6610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -6622,6 +7127,13 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6622 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7127 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 7128 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
6624 | 7129 | ||
7130 | /* mute analog input loopbacks */ | ||
7131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7136 | |||
6625 | /* Front Pin: output 0 (0x0c) */ | 7137 | /* Front Pin: output 0 (0x0c) */ |
6626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
6627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 7139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -6656,11 +7168,6 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6656 | 7168 | ||
6657 | /* FIXME: use matrix-type input source selection */ | 7169 | /* FIXME: use matrix-type input source selection */ |
6658 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7170 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
6659 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
6660 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
6661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
6662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
6663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
6664 | /* Input mixer2 */ | 7171 | /* Input mixer2 */ |
6665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | 7173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
@@ -6671,9 +7178,6 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | 7178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
6672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | 7179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
6673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 7180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
6674 | /* ADC1: mute amp left and right */ | ||
6675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
6676 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
6677 | /* ADC2: mute amp left and right */ | 7181 | /* ADC2: mute amp left and right */ |
6678 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7182 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6679 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7183 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -6684,6 +7188,18 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6684 | { } | 7188 | { } |
6685 | }; | 7189 | }; |
6686 | 7190 | ||
7191 | static struct hda_verb alc882_adc1_init_verbs[] = { | ||
7192 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7197 | /* ADC1: mute amp left and right */ | ||
7198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7199 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7200 | { } | ||
7201 | }; | ||
7202 | |||
6687 | static struct hda_verb alc882_eapd_verbs[] = { | 7203 | static struct hda_verb alc882_eapd_verbs[] = { |
6688 | /* change to EAPD mode */ | 7204 | /* change to EAPD mode */ |
6689 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | 7205 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
@@ -6691,6 +7207,110 @@ static struct hda_verb alc882_eapd_verbs[] = { | |||
6691 | { } | 7207 | { } |
6692 | }; | 7208 | }; |
6693 | 7209 | ||
7210 | static struct hda_verb alc889_eapd_verbs[] = { | ||
7211 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
7212 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
7213 | { } | ||
7214 | }; | ||
7215 | |||
7216 | static struct hda_verb alc_hp15_unsol_verbs[] = { | ||
7217 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
7218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7219 | {} | ||
7220 | }; | ||
7221 | |||
7222 | static struct hda_verb alc885_init_verbs[] = { | ||
7223 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7227 | /* Rear mixer */ | ||
7228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7231 | /* CLFE mixer */ | ||
7232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7235 | /* Side mixer */ | ||
7236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7237 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7238 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7239 | |||
7240 | /* mute analog input loopbacks */ | ||
7241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7244 | |||
7245 | /* Front HP Pin: output 0 (0x0c) */ | ||
7246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7249 | /* Front Pin: output 0 (0x0c) */ | ||
7250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7251 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7252 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7253 | /* Rear Pin: output 1 (0x0d) */ | ||
7254 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7255 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7256 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7257 | /* CLFE Pin: output 2 (0x0e) */ | ||
7258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7260 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
7261 | /* Side Pin: output 3 (0x0f) */ | ||
7262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7264 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
7265 | /* Mic (rear) pin: input vref at 80% */ | ||
7266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7268 | /* Front Mic pin: input vref at 80% */ | ||
7269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7270 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7271 | /* Line In pin: input */ | ||
7272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7274 | |||
7275 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | ||
7276 | /* Input mixer1 */ | ||
7277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
7278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7280 | /* Input mixer2 */ | ||
7281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7284 | /* Input mixer3 */ | ||
7285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
7286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7288 | /* ADC2: mute amp left and right */ | ||
7289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7290 | /* ADC3: mute amp left and right */ | ||
7291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7292 | |||
7293 | { } | ||
7294 | }; | ||
7295 | |||
7296 | static struct hda_verb alc885_init_input_verbs[] = { | ||
7297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
7299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
7300 | { } | ||
7301 | }; | ||
7302 | |||
7303 | |||
7304 | /* Unmute Selector 24h and set the default input to front mic */ | ||
7305 | static struct hda_verb alc889_init_input_verbs[] = { | ||
7306 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7307 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7308 | { } | ||
7309 | }; | ||
7310 | |||
7311 | |||
7312 | #define alc883_init_verbs alc882_base_init_verbs | ||
7313 | |||
6694 | /* Mac Pro test */ | 7314 | /* Mac Pro test */ |
6695 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | 7315 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
6696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -6898,23 +7518,21 @@ static struct hda_verb alc885_imac24_init_verbs[] = { | |||
6898 | }; | 7518 | }; |
6899 | 7519 | ||
6900 | /* Toggle speaker-output according to the hp-jack state */ | 7520 | /* Toggle speaker-output according to the hp-jack state */ |
6901 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) | 7521 | static void alc885_imac24_setup(struct hda_codec *codec) |
6902 | { | 7522 | { |
6903 | struct alc_spec *spec = codec->spec; | 7523 | struct alc_spec *spec = codec->spec; |
6904 | 7524 | ||
6905 | spec->autocfg.hp_pins[0] = 0x14; | 7525 | spec->autocfg.hp_pins[0] = 0x14; |
6906 | spec->autocfg.speaker_pins[0] = 0x18; | 7526 | spec->autocfg.speaker_pins[0] = 0x18; |
6907 | spec->autocfg.speaker_pins[1] = 0x1a; | 7527 | spec->autocfg.speaker_pins[1] = 0x1a; |
6908 | alc_automute_amp(codec); | ||
6909 | } | 7528 | } |
6910 | 7529 | ||
6911 | static void alc885_mbp3_init_hook(struct hda_codec *codec) | 7530 | static void alc885_mbp3_setup(struct hda_codec *codec) |
6912 | { | 7531 | { |
6913 | struct alc_spec *spec = codec->spec; | 7532 | struct alc_spec *spec = codec->spec; |
6914 | 7533 | ||
6915 | spec->autocfg.hp_pins[0] = 0x15; | 7534 | spec->autocfg.hp_pins[0] = 0x15; |
6916 | spec->autocfg.speaker_pins[0] = 0x14; | 7535 | spec->autocfg.speaker_pins[0] = 0x14; |
6917 | alc_automute_amp(codec); | ||
6918 | } | 7536 | } |
6919 | 7537 | ||
6920 | 7538 | ||
@@ -6942,13 +7560,12 @@ static void alc882_targa_automute(struct hda_codec *codec) | |||
6942 | spec->jack_present ? 1 : 3); | 7560 | spec->jack_present ? 1 : 3); |
6943 | } | 7561 | } |
6944 | 7562 | ||
6945 | static void alc882_targa_init_hook(struct hda_codec *codec) | 7563 | static void alc882_targa_setup(struct hda_codec *codec) |
6946 | { | 7564 | { |
6947 | struct alc_spec *spec = codec->spec; | 7565 | struct alc_spec *spec = codec->spec; |
6948 | 7566 | ||
6949 | spec->autocfg.hp_pins[0] = 0x14; | 7567 | spec->autocfg.hp_pins[0] = 0x14; |
6950 | spec->autocfg.speaker_pins[0] = 0x1b; | 7568 | spec->autocfg.speaker_pins[0] = 0x1b; |
6951 | alc882_targa_automute(codec); | ||
6952 | } | 7569 | } |
6953 | 7570 | ||
6954 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | 7571 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -7036,18 +7653,16 @@ static void alc885_macpro_init_hook(struct hda_codec *codec) | |||
7036 | static void alc885_imac24_init_hook(struct hda_codec *codec) | 7653 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
7037 | { | 7654 | { |
7038 | alc885_macpro_init_hook(codec); | 7655 | alc885_macpro_init_hook(codec); |
7039 | alc885_imac24_automute_init_hook(codec); | 7656 | alc_automute_amp(codec); |
7040 | } | 7657 | } |
7041 | 7658 | ||
7042 | /* | 7659 | /* |
7043 | * generic initialization of ADC, input mixers and output mixers | 7660 | * generic initialization of ADC, input mixers and output mixers |
7044 | */ | 7661 | */ |
7045 | static struct hda_verb alc882_auto_init_verbs[] = { | 7662 | static struct hda_verb alc883_auto_init_verbs[] = { |
7046 | /* | 7663 | /* |
7047 | * Unmute ADC0-2 and set the default input to mic-in | 7664 | * Unmute ADC0-2 and set the default input to mic-in |
7048 | */ | 7665 | */ |
7049 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7051 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7666 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7052 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7053 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7668 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -7088,11 +7703,6 @@ static struct hda_verb alc882_auto_init_verbs[] = { | |||
7088 | 7703 | ||
7089 | /* FIXME: use matrix-type input source selection */ | 7704 | /* FIXME: use matrix-type input source selection */ |
7090 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7705 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
7091 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
7093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
7094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
7095 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
7096 | /* Input mixer2 */ | 7706 | /* Input mixer2 */ |
7097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | 7707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
7098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | 7708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
@@ -7107,821 +7717,6 @@ static struct hda_verb alc882_auto_init_verbs[] = { | |||
7107 | { } | 7717 | { } |
7108 | }; | 7718 | }; |
7109 | 7719 | ||
7110 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
7111 | #define alc882_loopbacks alc880_loopbacks | ||
7112 | #endif | ||
7113 | |||
7114 | /* pcm configuration: identical with ALC880 */ | ||
7115 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | ||
7116 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | ||
7117 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | ||
7118 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | ||
7119 | |||
7120 | /* | ||
7121 | * configuration and preset | ||
7122 | */ | ||
7123 | static const char *alc882_models[ALC882_MODEL_LAST] = { | ||
7124 | [ALC882_3ST_DIG] = "3stack-dig", | ||
7125 | [ALC882_6ST_DIG] = "6stack-dig", | ||
7126 | [ALC882_ARIMA] = "arima", | ||
7127 | [ALC882_W2JC] = "w2jc", | ||
7128 | [ALC882_TARGA] = "targa", | ||
7129 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
7130 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
7131 | [ALC885_MACPRO] = "macpro", | ||
7132 | [ALC885_MB5] = "mb5", | ||
7133 | [ALC885_MBP3] = "mbp3", | ||
7134 | [ALC885_IMAC24] = "imac24", | ||
7135 | [ALC882_AUTO] = "auto", | ||
7136 | }; | ||
7137 | |||
7138 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | ||
7139 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | ||
7140 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
7141 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
7142 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
7143 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
7144 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
7145 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
7146 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | ||
7147 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | ||
7148 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
7149 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
7150 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | ||
7151 | {} | ||
7152 | }; | ||
7153 | |||
7154 | static struct alc_config_preset alc882_presets[] = { | ||
7155 | [ALC882_3ST_DIG] = { | ||
7156 | .mixers = { alc882_base_mixer }, | ||
7157 | .init_verbs = { alc882_init_verbs }, | ||
7158 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7159 | .dac_nids = alc882_dac_nids, | ||
7160 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7161 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7162 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7163 | .channel_mode = alc882_ch_modes, | ||
7164 | .need_dac_fix = 1, | ||
7165 | .input_mux = &alc882_capture_source, | ||
7166 | }, | ||
7167 | [ALC882_6ST_DIG] = { | ||
7168 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
7169 | .init_verbs = { alc882_init_verbs }, | ||
7170 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7171 | .dac_nids = alc882_dac_nids, | ||
7172 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7173 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7174 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
7175 | .channel_mode = alc882_sixstack_modes, | ||
7176 | .input_mux = &alc882_capture_source, | ||
7177 | }, | ||
7178 | [ALC882_ARIMA] = { | ||
7179 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
7180 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | ||
7181 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7182 | .dac_nids = alc882_dac_nids, | ||
7183 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
7184 | .channel_mode = alc882_sixstack_modes, | ||
7185 | .input_mux = &alc882_capture_source, | ||
7186 | }, | ||
7187 | [ALC882_W2JC] = { | ||
7188 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
7189 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | ||
7190 | alc880_gpio1_init_verbs }, | ||
7191 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7192 | .dac_nids = alc882_dac_nids, | ||
7193 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
7194 | .channel_mode = alc880_threestack_modes, | ||
7195 | .need_dac_fix = 1, | ||
7196 | .input_mux = &alc882_capture_source, | ||
7197 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7198 | }, | ||
7199 | [ALC885_MBP3] = { | ||
7200 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | ||
7201 | .init_verbs = { alc885_mbp3_init_verbs, | ||
7202 | alc880_gpio1_init_verbs }, | ||
7203 | .num_dacs = 2, | ||
7204 | .dac_nids = alc882_dac_nids, | ||
7205 | .hp_nid = 0x04, | ||
7206 | .channel_mode = alc885_mbp_4ch_modes, | ||
7207 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
7208 | .input_mux = &alc882_capture_source, | ||
7209 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7210 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7211 | .unsol_event = alc_automute_amp_unsol_event, | ||
7212 | .init_hook = alc885_mbp3_init_hook, | ||
7213 | }, | ||
7214 | [ALC885_MB5] = { | ||
7215 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | ||
7216 | .init_verbs = { alc885_mb5_init_verbs, | ||
7217 | alc880_gpio1_init_verbs }, | ||
7218 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7219 | .dac_nids = alc882_dac_nids, | ||
7220 | .channel_mode = alc885_mb5_6ch_modes, | ||
7221 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | ||
7222 | .input_mux = &mb5_capture_source, | ||
7223 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7224 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7225 | }, | ||
7226 | [ALC885_MACPRO] = { | ||
7227 | .mixers = { alc882_macpro_mixer }, | ||
7228 | .init_verbs = { alc882_macpro_init_verbs }, | ||
7229 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7230 | .dac_nids = alc882_dac_nids, | ||
7231 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7232 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7233 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7234 | .channel_mode = alc882_ch_modes, | ||
7235 | .input_mux = &alc882_capture_source, | ||
7236 | .init_hook = alc885_macpro_init_hook, | ||
7237 | }, | ||
7238 | [ALC885_IMAC24] = { | ||
7239 | .mixers = { alc885_imac24_mixer }, | ||
7240 | .init_verbs = { alc885_imac24_init_verbs }, | ||
7241 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7242 | .dac_nids = alc882_dac_nids, | ||
7243 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7244 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7245 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7246 | .channel_mode = alc882_ch_modes, | ||
7247 | .input_mux = &alc882_capture_source, | ||
7248 | .unsol_event = alc_automute_amp_unsol_event, | ||
7249 | .init_hook = alc885_imac24_init_hook, | ||
7250 | }, | ||
7251 | [ALC882_TARGA] = { | ||
7252 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
7253 | .init_verbs = { alc882_init_verbs, alc880_gpio3_init_verbs, | ||
7254 | alc882_targa_verbs}, | ||
7255 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7256 | .dac_nids = alc882_dac_nids, | ||
7257 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7258 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
7259 | .adc_nids = alc882_adc_nids, | ||
7260 | .capsrc_nids = alc882_capsrc_nids, | ||
7261 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
7262 | .channel_mode = alc882_3ST_6ch_modes, | ||
7263 | .need_dac_fix = 1, | ||
7264 | .input_mux = &alc882_capture_source, | ||
7265 | .unsol_event = alc882_targa_unsol_event, | ||
7266 | .init_hook = alc882_targa_init_hook, | ||
7267 | }, | ||
7268 | [ALC882_ASUS_A7J] = { | ||
7269 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
7270 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, | ||
7271 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7272 | .dac_nids = alc882_dac_nids, | ||
7273 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7274 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
7275 | .adc_nids = alc882_adc_nids, | ||
7276 | .capsrc_nids = alc882_capsrc_nids, | ||
7277 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
7278 | .channel_mode = alc882_3ST_6ch_modes, | ||
7279 | .need_dac_fix = 1, | ||
7280 | .input_mux = &alc882_capture_source, | ||
7281 | }, | ||
7282 | [ALC882_ASUS_A7M] = { | ||
7283 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
7284 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | ||
7285 | alc880_gpio1_init_verbs, | ||
7286 | alc882_asus_a7m_verbs }, | ||
7287 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7288 | .dac_nids = alc882_dac_nids, | ||
7289 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7290 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
7291 | .channel_mode = alc880_threestack_modes, | ||
7292 | .need_dac_fix = 1, | ||
7293 | .input_mux = &alc882_capture_source, | ||
7294 | }, | ||
7295 | }; | ||
7296 | |||
7297 | |||
7298 | /* | ||
7299 | * Pin config fixes | ||
7300 | */ | ||
7301 | enum { | ||
7302 | PINFIX_ABIT_AW9D_MAX | ||
7303 | }; | ||
7304 | |||
7305 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | ||
7306 | { 0x15, 0x01080104 }, /* side */ | ||
7307 | { 0x16, 0x01011012 }, /* rear */ | ||
7308 | { 0x17, 0x01016011 }, /* clfe */ | ||
7309 | { } | ||
7310 | }; | ||
7311 | |||
7312 | static const struct alc_pincfg *alc882_pin_fixes[] = { | ||
7313 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | ||
7314 | }; | ||
7315 | |||
7316 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | ||
7317 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | ||
7318 | {} | ||
7319 | }; | ||
7320 | |||
7321 | /* | ||
7322 | * BIOS auto configuration | ||
7323 | */ | ||
7324 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | ||
7325 | hda_nid_t nid, int pin_type, | ||
7326 | int dac_idx) | ||
7327 | { | ||
7328 | /* set as output */ | ||
7329 | struct alc_spec *spec = codec->spec; | ||
7330 | int idx; | ||
7331 | |||
7332 | alc_set_pin_output(codec, nid, pin_type); | ||
7333 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | ||
7334 | idx = 4; | ||
7335 | else | ||
7336 | idx = spec->multiout.dac_nids[dac_idx] - 2; | ||
7337 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | ||
7338 | |||
7339 | } | ||
7340 | |||
7341 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | ||
7342 | { | ||
7343 | struct alc_spec *spec = codec->spec; | ||
7344 | int i; | ||
7345 | |||
7346 | for (i = 0; i <= HDA_SIDE; i++) { | ||
7347 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
7348 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
7349 | if (nid) | ||
7350 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | ||
7351 | i); | ||
7352 | } | ||
7353 | } | ||
7354 | |||
7355 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | ||
7356 | { | ||
7357 | struct alc_spec *spec = codec->spec; | ||
7358 | hda_nid_t pin; | ||
7359 | |||
7360 | pin = spec->autocfg.hp_pins[0]; | ||
7361 | if (pin) /* connect to front */ | ||
7362 | /* use dac 0 */ | ||
7363 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | ||
7364 | pin = spec->autocfg.speaker_pins[0]; | ||
7365 | if (pin) | ||
7366 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
7367 | } | ||
7368 | |||
7369 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | ||
7370 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | ||
7371 | |||
7372 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | ||
7373 | { | ||
7374 | struct alc_spec *spec = codec->spec; | ||
7375 | int i; | ||
7376 | |||
7377 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
7378 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
7379 | if (!nid) | ||
7380 | continue; | ||
7381 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); | ||
7382 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | ||
7383 | snd_hda_codec_write(codec, nid, 0, | ||
7384 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
7385 | AMP_OUT_MUTE); | ||
7386 | } | ||
7387 | } | ||
7388 | |||
7389 | static void alc882_auto_init_input_src(struct hda_codec *codec) | ||
7390 | { | ||
7391 | struct alc_spec *spec = codec->spec; | ||
7392 | int c; | ||
7393 | |||
7394 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
7395 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | ||
7396 | hda_nid_t nid = spec->capsrc_nids[c]; | ||
7397 | unsigned int mux_idx; | ||
7398 | const struct hda_input_mux *imux; | ||
7399 | int conns, mute, idx, item; | ||
7400 | |||
7401 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
7402 | ARRAY_SIZE(conn_list)); | ||
7403 | if (conns < 0) | ||
7404 | continue; | ||
7405 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
7406 | imux = &spec->input_mux[mux_idx]; | ||
7407 | for (idx = 0; idx < conns; idx++) { | ||
7408 | /* if the current connection is the selected one, | ||
7409 | * unmute it as default - otherwise mute it | ||
7410 | */ | ||
7411 | mute = AMP_IN_MUTE(idx); | ||
7412 | for (item = 0; item < imux->num_items; item++) { | ||
7413 | if (imux->items[item].index == idx) { | ||
7414 | if (spec->cur_mux[c] == item) | ||
7415 | mute = AMP_IN_UNMUTE(idx); | ||
7416 | break; | ||
7417 | } | ||
7418 | } | ||
7419 | /* check if we have a selector or mixer | ||
7420 | * we could check for the widget type instead, but | ||
7421 | * just check for Amp-In presence (in case of mixer | ||
7422 | * without amp-in there is something wrong, this | ||
7423 | * function shouldn't be used or capsrc nid is wrong) | ||
7424 | */ | ||
7425 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
7426 | snd_hda_codec_write(codec, nid, 0, | ||
7427 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
7428 | mute); | ||
7429 | else if (mute != AMP_IN_MUTE(idx)) | ||
7430 | snd_hda_codec_write(codec, nid, 0, | ||
7431 | AC_VERB_SET_CONNECT_SEL, | ||
7432 | idx); | ||
7433 | } | ||
7434 | } | ||
7435 | } | ||
7436 | |||
7437 | /* add mic boosts if needed */ | ||
7438 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
7439 | { | ||
7440 | struct alc_spec *spec = codec->spec; | ||
7441 | int err; | ||
7442 | hda_nid_t nid; | ||
7443 | |||
7444 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
7445 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
7446 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
7447 | "Mic Boost", | ||
7448 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
7449 | if (err < 0) | ||
7450 | return err; | ||
7451 | } | ||
7452 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
7453 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
7454 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
7455 | "Front Mic Boost", | ||
7456 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
7457 | if (err < 0) | ||
7458 | return err; | ||
7459 | } | ||
7460 | return 0; | ||
7461 | } | ||
7462 | |||
7463 | /* almost identical with ALC880 parser... */ | ||
7464 | static int alc882_parse_auto_config(struct hda_codec *codec) | ||
7465 | { | ||
7466 | struct alc_spec *spec = codec->spec; | ||
7467 | int err = alc880_parse_auto_config(codec); | ||
7468 | |||
7469 | if (err < 0) | ||
7470 | return err; | ||
7471 | else if (!err) | ||
7472 | return 0; /* no config found */ | ||
7473 | |||
7474 | err = alc_auto_add_mic_boost(codec); | ||
7475 | if (err < 0) | ||
7476 | return err; | ||
7477 | |||
7478 | /* hack - override the init verbs */ | ||
7479 | spec->init_verbs[0] = alc882_auto_init_verbs; | ||
7480 | |||
7481 | return 1; /* config found */ | ||
7482 | } | ||
7483 | |||
7484 | /* additional initialization for auto-configuration model */ | ||
7485 | static void alc882_auto_init(struct hda_codec *codec) | ||
7486 | { | ||
7487 | struct alc_spec *spec = codec->spec; | ||
7488 | alc882_auto_init_multi_out(codec); | ||
7489 | alc882_auto_init_hp_out(codec); | ||
7490 | alc882_auto_init_analog_input(codec); | ||
7491 | alc882_auto_init_input_src(codec); | ||
7492 | if (spec->unsol_event) | ||
7493 | alc_inithook(codec); | ||
7494 | } | ||
7495 | |||
7496 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ | ||
7497 | |||
7498 | static int patch_alc882(struct hda_codec *codec) | ||
7499 | { | ||
7500 | struct alc_spec *spec; | ||
7501 | int err, board_config; | ||
7502 | |||
7503 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
7504 | if (spec == NULL) | ||
7505 | return -ENOMEM; | ||
7506 | |||
7507 | codec->spec = spec; | ||
7508 | |||
7509 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | ||
7510 | alc882_models, | ||
7511 | alc882_cfg_tbl); | ||
7512 | |||
7513 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | ||
7514 | /* Pick up systems that don't supply PCI SSID */ | ||
7515 | switch (codec->subsystem_id) { | ||
7516 | case 0x106b0c00: /* Mac Pro */ | ||
7517 | board_config = ALC885_MACPRO; | ||
7518 | break; | ||
7519 | case 0x106b1000: /* iMac 24 */ | ||
7520 | case 0x106b2800: /* AppleTV */ | ||
7521 | case 0x106b3e00: /* iMac 24 Aluminium */ | ||
7522 | board_config = ALC885_IMAC24; | ||
7523 | break; | ||
7524 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ | ||
7525 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | ||
7526 | case 0x106b00a4: /* MacbookPro4,1 */ | ||
7527 | case 0x106b2c00: /* Macbook Pro rev3 */ | ||
7528 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ | ||
7529 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ | ||
7530 | board_config = ALC885_MBP3; | ||
7531 | break; | ||
7532 | case 0x106b3f00: /* Macbook 5,1 */ | ||
7533 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense | ||
7534 | * seems not working, so apparently | ||
7535 | * no perfect solution yet | ||
7536 | */ | ||
7537 | board_config = ALC885_MB5; | ||
7538 | break; | ||
7539 | default: | ||
7540 | /* ALC889A is handled better as ALC888-compatible */ | ||
7541 | if (codec->revision_id == 0x100101 || | ||
7542 | codec->revision_id == 0x100103) { | ||
7543 | alc_free(codec); | ||
7544 | return patch_alc883(codec); | ||
7545 | } | ||
7546 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | ||
7547 | "trying auto-probe from BIOS...\n", | ||
7548 | codec->chip_name); | ||
7549 | board_config = ALC882_AUTO; | ||
7550 | } | ||
7551 | } | ||
7552 | |||
7553 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); | ||
7554 | |||
7555 | if (board_config == ALC882_AUTO) { | ||
7556 | /* automatic parse from the BIOS config */ | ||
7557 | err = alc882_parse_auto_config(codec); | ||
7558 | if (err < 0) { | ||
7559 | alc_free(codec); | ||
7560 | return err; | ||
7561 | } else if (!err) { | ||
7562 | printk(KERN_INFO | ||
7563 | "hda_codec: Cannot set up configuration " | ||
7564 | "from BIOS. Using base mode...\n"); | ||
7565 | board_config = ALC882_3ST_DIG; | ||
7566 | } | ||
7567 | } | ||
7568 | |||
7569 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
7570 | if (err < 0) { | ||
7571 | alc_free(codec); | ||
7572 | return err; | ||
7573 | } | ||
7574 | |||
7575 | if (board_config != ALC882_AUTO) | ||
7576 | setup_preset(spec, &alc882_presets[board_config]); | ||
7577 | |||
7578 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | ||
7579 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | ||
7580 | /* FIXME: setup DAC5 */ | ||
7581 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | ||
7582 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | ||
7583 | |||
7584 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | ||
7585 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | ||
7586 | |||
7587 | if (!spec->adc_nids && spec->input_mux) { | ||
7588 | /* check whether NID 0x07 is valid */ | ||
7589 | unsigned int wcap = get_wcaps(codec, 0x07); | ||
7590 | /* get type */ | ||
7591 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
7592 | if (wcap != AC_WID_AUD_IN) { | ||
7593 | spec->adc_nids = alc882_adc_nids_alt; | ||
7594 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | ||
7595 | spec->capsrc_nids = alc882_capsrc_nids_alt; | ||
7596 | } else { | ||
7597 | spec->adc_nids = alc882_adc_nids; | ||
7598 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | ||
7599 | spec->capsrc_nids = alc882_capsrc_nids; | ||
7600 | } | ||
7601 | } | ||
7602 | set_capture_mixer(spec); | ||
7603 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
7604 | |||
7605 | spec->vmaster_nid = 0x0c; | ||
7606 | |||
7607 | codec->patch_ops = alc_patch_ops; | ||
7608 | if (board_config == ALC882_AUTO) | ||
7609 | spec->init_hook = alc882_auto_init; | ||
7610 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
7611 | if (!spec->loopback.amplist) | ||
7612 | spec->loopback.amplist = alc882_loopbacks; | ||
7613 | #endif | ||
7614 | codec->proc_widget_hook = print_realtek_coef; | ||
7615 | |||
7616 | return 0; | ||
7617 | } | ||
7618 | |||
7619 | /* | ||
7620 | * ALC883 support | ||
7621 | * | ||
7622 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | ||
7623 | * configuration. Each pin widget can choose any input DACs and a mixer. | ||
7624 | * Each ADC is connected from a mixer of all inputs. This makes possible | ||
7625 | * 6-channel independent captures. | ||
7626 | * | ||
7627 | * In addition, an independent DAC for the multi-playback (not used in this | ||
7628 | * driver yet). | ||
7629 | */ | ||
7630 | #define ALC883_DIGOUT_NID 0x06 | ||
7631 | #define ALC883_DIGIN_NID 0x0a | ||
7632 | |||
7633 | #define ALC1200_DIGOUT_NID 0x10 | ||
7634 | |||
7635 | static hda_nid_t alc883_dac_nids[4] = { | ||
7636 | /* front, rear, clfe, rear_surr */ | ||
7637 | 0x02, 0x03, 0x04, 0x05 | ||
7638 | }; | ||
7639 | |||
7640 | static hda_nid_t alc883_adc_nids[2] = { | ||
7641 | /* ADC1-2 */ | ||
7642 | 0x08, 0x09, | ||
7643 | }; | ||
7644 | |||
7645 | static hda_nid_t alc883_adc_nids_alt[1] = { | ||
7646 | /* ADC1 */ | ||
7647 | 0x08, | ||
7648 | }; | ||
7649 | |||
7650 | static hda_nid_t alc883_adc_nids_rev[2] = { | ||
7651 | /* ADC2-1 */ | ||
7652 | 0x09, 0x08 | ||
7653 | }; | ||
7654 | |||
7655 | #define alc889_adc_nids alc880_adc_nids | ||
7656 | |||
7657 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; | ||
7658 | |||
7659 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
7660 | |||
7661 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
7662 | |||
7663 | /* input MUX */ | ||
7664 | /* FIXME: should be a matrix-type input source selection */ | ||
7665 | |||
7666 | static struct hda_input_mux alc883_capture_source = { | ||
7667 | .num_items = 4, | ||
7668 | .items = { | ||
7669 | { "Mic", 0x0 }, | ||
7670 | { "Front Mic", 0x1 }, | ||
7671 | { "Line", 0x2 }, | ||
7672 | { "CD", 0x4 }, | ||
7673 | }, | ||
7674 | }; | ||
7675 | |||
7676 | static struct hda_input_mux alc883_3stack_6ch_intel = { | ||
7677 | .num_items = 4, | ||
7678 | .items = { | ||
7679 | { "Mic", 0x1 }, | ||
7680 | { "Front Mic", 0x0 }, | ||
7681 | { "Line", 0x2 }, | ||
7682 | { "CD", 0x4 }, | ||
7683 | }, | ||
7684 | }; | ||
7685 | |||
7686 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
7687 | .num_items = 2, | ||
7688 | .items = { | ||
7689 | { "Mic", 0x1 }, | ||
7690 | { "Line", 0x2 }, | ||
7691 | }, | ||
7692 | }; | ||
7693 | |||
7694 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
7695 | .num_items = 4, | ||
7696 | .items = { | ||
7697 | { "Mic", 0x0 }, | ||
7698 | { "iMic", 0x1 }, | ||
7699 | { "Line", 0x2 }, | ||
7700 | { "CD", 0x4 }, | ||
7701 | }, | ||
7702 | }; | ||
7703 | |||
7704 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
7705 | .num_items = 2, | ||
7706 | .items = { | ||
7707 | { "Mic", 0x0 }, | ||
7708 | { "Int Mic", 0x1 }, | ||
7709 | }, | ||
7710 | }; | ||
7711 | |||
7712 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
7713 | .num_items = 3, | ||
7714 | .items = { | ||
7715 | { "Mic", 0x0 }, | ||
7716 | { "Front Mic", 0x1 }, | ||
7717 | { "Line", 0x4 }, | ||
7718 | }, | ||
7719 | }; | ||
7720 | |||
7721 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
7722 | .num_items = 2, | ||
7723 | .items = { | ||
7724 | { "Mic", 0x0 }, | ||
7725 | { "Line", 0x2 }, | ||
7726 | }, | ||
7727 | }; | ||
7728 | |||
7729 | static struct hda_input_mux alc889A_mb31_capture_source = { | ||
7730 | .num_items = 2, | ||
7731 | .items = { | ||
7732 | { "Mic", 0x0 }, | ||
7733 | /* Front Mic (0x01) unused */ | ||
7734 | { "Line", 0x2 }, | ||
7735 | /* Line 2 (0x03) unused */ | ||
7736 | /* CD (0x04) unsused? */ | ||
7737 | }, | ||
7738 | }; | ||
7739 | |||
7740 | /* | ||
7741 | * 2ch mode | ||
7742 | */ | ||
7743 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
7744 | { 2, NULL } | ||
7745 | }; | ||
7746 | |||
7747 | /* | ||
7748 | * 2ch mode | ||
7749 | */ | ||
7750 | static struct hda_verb alc883_3ST_ch2_init[] = { | ||
7751 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7752 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7755 | { } /* end */ | ||
7756 | }; | ||
7757 | |||
7758 | /* | ||
7759 | * 4ch mode | ||
7760 | */ | ||
7761 | static struct hda_verb alc883_3ST_ch4_init[] = { | ||
7762 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7763 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7766 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7767 | { } /* end */ | ||
7768 | }; | ||
7769 | |||
7770 | /* | ||
7771 | * 6ch mode | ||
7772 | */ | ||
7773 | static struct hda_verb alc883_3ST_ch6_init[] = { | ||
7774 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7775 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7776 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7777 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7778 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7779 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7780 | { } /* end */ | ||
7781 | }; | ||
7782 | |||
7783 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { | ||
7784 | { 2, alc883_3ST_ch2_init }, | ||
7785 | { 4, alc883_3ST_ch4_init }, | ||
7786 | { 6, alc883_3ST_ch6_init }, | ||
7787 | }; | ||
7788 | |||
7789 | |||
7790 | /* | ||
7791 | * 2ch mode | ||
7792 | */ | ||
7793 | static struct hda_verb alc883_4ST_ch2_init[] = { | ||
7794 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7795 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7796 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7797 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7798 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7799 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7800 | { } /* end */ | ||
7801 | }; | ||
7802 | |||
7803 | /* | ||
7804 | * 4ch mode | ||
7805 | */ | ||
7806 | static struct hda_verb alc883_4ST_ch4_init[] = { | ||
7807 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7808 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7809 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7810 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7811 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7812 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7813 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7814 | { } /* end */ | ||
7815 | }; | ||
7816 | |||
7817 | /* | ||
7818 | * 6ch mode | ||
7819 | */ | ||
7820 | static struct hda_verb alc883_4ST_ch6_init[] = { | ||
7821 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7822 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7823 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7824 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7825 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7826 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7827 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7828 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7829 | { } /* end */ | ||
7830 | }; | ||
7831 | |||
7832 | /* | ||
7833 | * 8ch mode | ||
7834 | */ | ||
7835 | static struct hda_verb alc883_4ST_ch8_init[] = { | ||
7836 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7837 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7838 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
7839 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7840 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7841 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7842 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7843 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7844 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7845 | { } /* end */ | ||
7846 | }; | ||
7847 | |||
7848 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
7849 | { 2, alc883_4ST_ch2_init }, | ||
7850 | { 4, alc883_4ST_ch4_init }, | ||
7851 | { 6, alc883_4ST_ch6_init }, | ||
7852 | { 8, alc883_4ST_ch8_init }, | ||
7853 | }; | ||
7854 | |||
7855 | |||
7856 | /* | ||
7857 | * 2ch mode | ||
7858 | */ | ||
7859 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
7860 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7861 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7862 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7863 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7864 | { } /* end */ | ||
7865 | }; | ||
7866 | |||
7867 | /* | ||
7868 | * 4ch mode | ||
7869 | */ | ||
7870 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
7871 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7872 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7873 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7874 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7875 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7876 | { } /* end */ | ||
7877 | }; | ||
7878 | |||
7879 | /* | ||
7880 | * 6ch mode | ||
7881 | */ | ||
7882 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
7883 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7884 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7885 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7889 | { } /* end */ | ||
7890 | }; | ||
7891 | |||
7892 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
7893 | { 2, alc883_3ST_ch2_intel_init }, | ||
7894 | { 4, alc883_3ST_ch4_intel_init }, | ||
7895 | { 6, alc883_3ST_ch6_intel_init }, | ||
7896 | }; | ||
7897 | |||
7898 | /* | ||
7899 | * 6ch mode | ||
7900 | */ | ||
7901 | static struct hda_verb alc883_sixstack_ch6_init[] = { | ||
7902 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
7903 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7904 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7905 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7906 | { } /* end */ | ||
7907 | }; | ||
7908 | |||
7909 | /* | ||
7910 | * 8ch mode | ||
7911 | */ | ||
7912 | static struct hda_verb alc883_sixstack_ch8_init[] = { | ||
7913 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7914 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7915 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7916 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7917 | { } /* end */ | ||
7918 | }; | ||
7919 | |||
7920 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
7921 | { 6, alc883_sixstack_ch6_init }, | ||
7922 | { 8, alc883_sixstack_ch8_init }, | ||
7923 | }; | ||
7924 | |||
7925 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | 7720 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
7926 | static struct hda_verb alc889A_mb31_ch2_init[] = { | 7721 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
7927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | 7722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
@@ -7972,34 +7767,7 @@ static struct hda_verb alc883_medion_eapd_verbs[] = { | |||
7972 | { } | 7767 | { } |
7973 | }; | 7768 | }; |
7974 | 7769 | ||
7975 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | 7770 | #define alc883_base_mixer alc882_base_mixer |
7976 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
7977 | */ | ||
7978 | |||
7979 | static struct snd_kcontrol_new alc883_base_mixer[] = { | ||
7980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7982 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
7983 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
7984 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
7985 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
7986 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
7987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
7988 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7989 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
7991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
7992 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
7993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7994 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7998 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
7999 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
8000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
8001 | { } /* end */ | ||
8002 | }; | ||
8003 | 7771 | ||
8004 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | 7772 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -8110,6 +7878,30 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |||
8110 | { } /* end */ | 7878 | { } /* end */ |
8111 | }; | 7879 | }; |
8112 | 7880 | ||
7881 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | ||
7882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
7885 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
7886 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
7887 | HDA_OUTPUT), | ||
7888 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
7889 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
7890 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
7891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
7894 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7895 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7896 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
7897 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | ||
7898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
7899 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7900 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | ||
7901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7902 | { } /* end */ | ||
7903 | }; | ||
7904 | |||
8113 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | 7905 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
8114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 7907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -8350,93 +8142,14 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
8350 | { } /* end */ | 8142 | { } /* end */ |
8351 | }; | 8143 | }; |
8352 | 8144 | ||
8353 | static struct hda_verb alc883_init_verbs[] = { | ||
8354 | /* ADC1: mute amp left and right */ | ||
8355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8356 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8357 | /* ADC2: mute amp left and right */ | ||
8358 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8359 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8360 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8364 | /* Rear mixer */ | ||
8365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8366 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8367 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8368 | /* CLFE mixer */ | ||
8369 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8372 | /* Side mixer */ | ||
8373 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8374 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8376 | |||
8377 | /* mute analog input loopbacks */ | ||
8378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
8382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8383 | |||
8384 | /* Front Pin: output 0 (0x0c) */ | ||
8385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8386 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8387 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8388 | /* Rear Pin: output 1 (0x0d) */ | ||
8389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
8392 | /* CLFE Pin: output 2 (0x0e) */ | ||
8393 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8394 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8395 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
8396 | /* Side Pin: output 3 (0x0f) */ | ||
8397 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8398 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8399 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
8400 | /* Mic (rear) pin: input vref at 80% */ | ||
8401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
8402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8403 | /* Front Mic pin: input vref at 80% */ | ||
8404 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
8405 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8406 | /* Line In pin: input */ | ||
8407 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
8408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8409 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
8410 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8411 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8412 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8413 | /* CD pin widget for input */ | ||
8414 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
8415 | |||
8416 | /* FIXME: use matrix-type input source selection */ | ||
8417 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
8418 | /* Input mixer2 */ | ||
8419 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8420 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8422 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8423 | /* Input mixer3 */ | ||
8424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8428 | { } | ||
8429 | }; | ||
8430 | |||
8431 | /* toggle speaker-output according to the hp-jack state */ | 8145 | /* toggle speaker-output according to the hp-jack state */ |
8432 | static void alc883_mitac_init_hook(struct hda_codec *codec) | 8146 | static void alc883_mitac_setup(struct hda_codec *codec) |
8433 | { | 8147 | { |
8434 | struct alc_spec *spec = codec->spec; | 8148 | struct alc_spec *spec = codec->spec; |
8435 | 8149 | ||
8436 | spec->autocfg.hp_pins[0] = 0x15; | 8150 | spec->autocfg.hp_pins[0] = 0x15; |
8437 | spec->autocfg.speaker_pins[0] = 0x14; | 8151 | spec->autocfg.speaker_pins[0] = 0x14; |
8438 | spec->autocfg.speaker_pins[1] = 0x17; | 8152 | spec->autocfg.speaker_pins[1] = 0x17; |
8439 | alc_automute_amp(codec); | ||
8440 | } | 8153 | } |
8441 | 8154 | ||
8442 | /* auto-toggle front mic */ | 8155 | /* auto-toggle front mic */ |
@@ -8468,6 +8181,22 @@ static struct hda_verb alc883_mitac_verbs[] = { | |||
8468 | { } /* end */ | 8181 | { } /* end */ |
8469 | }; | 8182 | }; |
8470 | 8183 | ||
8184 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | ||
8185 | /* HP */ | ||
8186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8188 | /* Int speaker */ | ||
8189 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | ||
8190 | |||
8191 | /* enable unsolicited event */ | ||
8192 | /* | ||
8193 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8194 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
8195 | */ | ||
8196 | |||
8197 | { } /* end */ | ||
8198 | }; | ||
8199 | |||
8471 | static struct hda_verb alc883_clevo_m720_verbs[] = { | 8200 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
8472 | /* HP */ | 8201 | /* HP */ |
8473 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 8202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -8591,7 +8320,7 @@ static struct hda_verb alc883_vaiott_verbs[] = { | |||
8591 | { } /* end */ | 8320 | { } /* end */ |
8592 | }; | 8321 | }; |
8593 | 8322 | ||
8594 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) | 8323 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8595 | { | 8324 | { |
8596 | struct alc_spec *spec = codec->spec; | 8325 | struct alc_spec *spec = codec->spec; |
8597 | 8326 | ||
@@ -8599,7 +8328,6 @@ static void alc888_3st_hp_init_hook(struct hda_codec *codec) | |||
8599 | spec->autocfg.speaker_pins[0] = 0x14; | 8328 | spec->autocfg.speaker_pins[0] = 0x14; |
8600 | spec->autocfg.speaker_pins[1] = 0x16; | 8329 | spec->autocfg.speaker_pins[1] = 0x16; |
8601 | spec->autocfg.speaker_pins[2] = 0x18; | 8330 | spec->autocfg.speaker_pins[2] = 0x18; |
8602 | alc_automute_amp(codec); | ||
8603 | } | 8331 | } |
8604 | 8332 | ||
8605 | static struct hda_verb alc888_3st_hp_verbs[] = { | 8333 | static struct hda_verb alc888_3st_hp_verbs[] = { |
@@ -8696,13 +8424,12 @@ static struct hda_verb alc883_medion_md2_verbs[] = { | |||
8696 | }; | 8424 | }; |
8697 | 8425 | ||
8698 | /* toggle speaker-output according to the hp-jack state */ | 8426 | /* toggle speaker-output according to the hp-jack state */ |
8699 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) | 8427 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
8700 | { | 8428 | { |
8701 | struct alc_spec *spec = codec->spec; | 8429 | struct alc_spec *spec = codec->spec; |
8702 | 8430 | ||
8703 | spec->autocfg.hp_pins[0] = 0x14; | 8431 | spec->autocfg.hp_pins[0] = 0x14; |
8704 | spec->autocfg.speaker_pins[0] = 0x15; | 8432 | spec->autocfg.speaker_pins[0] = 0x15; |
8705 | alc_automute_amp(codec); | ||
8706 | } | 8433 | } |
8707 | 8434 | ||
8708 | /* toggle speaker-output according to the hp-jack state */ | 8435 | /* toggle speaker-output according to the hp-jack state */ |
@@ -8719,12 +8446,16 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | |||
8719 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 8446 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
8720 | } | 8447 | } |
8721 | 8448 | ||
8722 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | 8449 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
8723 | { | 8450 | { |
8724 | struct alc_spec *spec = codec->spec; | 8451 | struct alc_spec *spec = codec->spec; |
8725 | 8452 | ||
8726 | spec->autocfg.hp_pins[0] = 0x15; | 8453 | spec->autocfg.hp_pins[0] = 0x15; |
8727 | spec->autocfg.speaker_pins[0] = 0x14; | 8454 | spec->autocfg.speaker_pins[0] = 0x14; |
8455 | } | ||
8456 | |||
8457 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | ||
8458 | { | ||
8728 | alc_automute_amp(codec); | 8459 | alc_automute_amp(codec); |
8729 | alc883_clevo_m720_mic_automute(codec); | 8460 | alc883_clevo_m720_mic_automute(codec); |
8730 | } | 8461 | } |
@@ -8743,22 +8474,20 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |||
8743 | } | 8474 | } |
8744 | 8475 | ||
8745 | /* toggle speaker-output according to the hp-jack state */ | 8476 | /* toggle speaker-output according to the hp-jack state */ |
8746 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) | 8477 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
8747 | { | 8478 | { |
8748 | struct alc_spec *spec = codec->spec; | 8479 | struct alc_spec *spec = codec->spec; |
8749 | 8480 | ||
8750 | spec->autocfg.hp_pins[0] = 0x14; | 8481 | spec->autocfg.hp_pins[0] = 0x14; |
8751 | spec->autocfg.speaker_pins[0] = 0x15; | 8482 | spec->autocfg.speaker_pins[0] = 0x15; |
8752 | alc_automute_amp(codec); | ||
8753 | } | 8483 | } |
8754 | 8484 | ||
8755 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) | 8485 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
8756 | { | 8486 | { |
8757 | struct alc_spec *spec = codec->spec; | 8487 | struct alc_spec *spec = codec->spec; |
8758 | 8488 | ||
8759 | spec->autocfg.hp_pins[0] = 0x1b; | 8489 | spec->autocfg.hp_pins[0] = 0x1b; |
8760 | spec->autocfg.speaker_pins[0] = 0x14; | 8490 | spec->autocfg.speaker_pins[0] = 0x14; |
8761 | alc_automute_amp(codec); | ||
8762 | } | 8491 | } |
8763 | 8492 | ||
8764 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | 8493 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
@@ -8797,14 +8526,13 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
8797 | } | 8526 | } |
8798 | 8527 | ||
8799 | /* toggle speaker-output according to the hp-jack state */ | 8528 | /* toggle speaker-output according to the hp-jack state */ |
8800 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) | 8529 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
8801 | { | 8530 | { |
8802 | struct alc_spec *spec = codec->spec; | 8531 | struct alc_spec *spec = codec->spec; |
8803 | 8532 | ||
8804 | spec->autocfg.hp_pins[0] = 0x14; | 8533 | spec->autocfg.hp_pins[0] = 0x14; |
8805 | spec->autocfg.speaker_pins[0] = 0x15; | 8534 | spec->autocfg.speaker_pins[0] = 0x15; |
8806 | spec->autocfg.speaker_pins[1] = 0x16; | 8535 | spec->autocfg.speaker_pins[1] = 0x16; |
8807 | alc_automute_amp(codec); | ||
8808 | } | 8536 | } |
8809 | 8537 | ||
8810 | static struct hda_verb alc883_acer_eapd_verbs[] = { | 8538 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
@@ -8825,7 +8553,14 @@ static struct hda_verb alc883_acer_eapd_verbs[] = { | |||
8825 | { } | 8553 | { } |
8826 | }; | 8554 | }; |
8827 | 8555 | ||
8828 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) | 8556 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
8557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8558 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
8559 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8560 | { } /* end */ | ||
8561 | }; | ||
8562 | |||
8563 | static void alc888_6st_dell_setup(struct hda_codec *codec) | ||
8829 | { | 8564 | { |
8830 | struct alc_spec *spec = codec->spec; | 8565 | struct alc_spec *spec = codec->spec; |
8831 | 8566 | ||
@@ -8834,10 +8569,9 @@ static void alc888_6st_dell_init_hook(struct hda_codec *codec) | |||
8834 | spec->autocfg.speaker_pins[1] = 0x15; | 8569 | spec->autocfg.speaker_pins[1] = 0x15; |
8835 | spec->autocfg.speaker_pins[2] = 0x16; | 8570 | spec->autocfg.speaker_pins[2] = 0x16; |
8836 | spec->autocfg.speaker_pins[3] = 0x17; | 8571 | spec->autocfg.speaker_pins[3] = 0x17; |
8837 | alc_automute_amp(codec); | ||
8838 | } | 8572 | } |
8839 | 8573 | ||
8840 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | 8574 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
8841 | { | 8575 | { |
8842 | struct alc_spec *spec = codec->spec; | 8576 | struct alc_spec *spec = codec->spec; |
8843 | 8577 | ||
@@ -8847,82 +8581,17 @@ static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | |||
8847 | spec->autocfg.speaker_pins[2] = 0x16; | 8581 | spec->autocfg.speaker_pins[2] = 0x16; |
8848 | spec->autocfg.speaker_pins[3] = 0x17; | 8582 | spec->autocfg.speaker_pins[3] = 0x17; |
8849 | spec->autocfg.speaker_pins[4] = 0x1a; | 8583 | spec->autocfg.speaker_pins[4] = 0x1a; |
8850 | alc_automute_amp(codec); | ||
8851 | } | 8584 | } |
8852 | 8585 | ||
8853 | static void alc883_vaiott_init_hook(struct hda_codec *codec) | 8586 | static void alc883_vaiott_setup(struct hda_codec *codec) |
8854 | { | 8587 | { |
8855 | struct alc_spec *spec = codec->spec; | 8588 | struct alc_spec *spec = codec->spec; |
8856 | 8589 | ||
8857 | spec->autocfg.hp_pins[0] = 0x15; | 8590 | spec->autocfg.hp_pins[0] = 0x15; |
8858 | spec->autocfg.speaker_pins[0] = 0x14; | 8591 | spec->autocfg.speaker_pins[0] = 0x14; |
8859 | spec->autocfg.speaker_pins[1] = 0x17; | 8592 | spec->autocfg.speaker_pins[1] = 0x17; |
8860 | alc_automute_amp(codec); | ||
8861 | } | 8593 | } |
8862 | 8594 | ||
8863 | /* | ||
8864 | * generic initialization of ADC, input mixers and output mixers | ||
8865 | */ | ||
8866 | static struct hda_verb alc883_auto_init_verbs[] = { | ||
8867 | /* | ||
8868 | * Unmute ADC0-2 and set the default input to mic-in | ||
8869 | */ | ||
8870 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8872 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8873 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8874 | |||
8875 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
8876 | * mixer widget | ||
8877 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
8878 | * front panel mic (mic 2) | ||
8879 | */ | ||
8880 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
8881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
8885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8886 | |||
8887 | /* | ||
8888 | * Set up output mixers (0x0c - 0x0f) | ||
8889 | */ | ||
8890 | /* set vol=0 to output mixers */ | ||
8891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8892 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8895 | /* set up input amps for analog loopback */ | ||
8896 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
8897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8901 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8903 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8905 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8906 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8907 | |||
8908 | /* FIXME: use matrix-type input source selection */ | ||
8909 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
8910 | /* Input mixer1 */ | ||
8911 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8912 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8913 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
8914 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ | ||
8915 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
8916 | /* Input mixer2 */ | ||
8917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8918 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8919 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
8920 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ | ||
8921 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
8922 | |||
8923 | { } | ||
8924 | }; | ||
8925 | |||
8926 | static struct hda_verb alc888_asus_m90v_verbs[] = { | 8595 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
8927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 8596 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 8597 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -8933,19 +8602,7 @@ static struct hda_verb alc888_asus_m90v_verbs[] = { | |||
8933 | { } /* end */ | 8602 | { } /* end */ |
8934 | }; | 8603 | }; |
8935 | 8604 | ||
8936 | static void alc883_nb_mic_automute(struct hda_codec *codec) | 8605 | static void alc883_mode2_setup(struct hda_codec *codec) |
8937 | { | ||
8938 | unsigned int present; | ||
8939 | |||
8940 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
8941 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8942 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8943 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
8944 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8945 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
8946 | } | ||
8947 | |||
8948 | static void alc883_M90V_init_hook(struct hda_codec *codec) | ||
8949 | { | 8606 | { |
8950 | struct alc_spec *spec = codec->spec; | 8607 | struct alc_spec *spec = codec->spec; |
8951 | 8608 | ||
@@ -8953,26 +8610,11 @@ static void alc883_M90V_init_hook(struct hda_codec *codec) | |||
8953 | spec->autocfg.speaker_pins[0] = 0x14; | 8610 | spec->autocfg.speaker_pins[0] = 0x14; |
8954 | spec->autocfg.speaker_pins[1] = 0x15; | 8611 | spec->autocfg.speaker_pins[1] = 0x15; |
8955 | spec->autocfg.speaker_pins[2] = 0x16; | 8612 | spec->autocfg.speaker_pins[2] = 0x16; |
8956 | alc_automute_pin(codec); | 8613 | spec->ext_mic.pin = 0x18; |
8957 | } | 8614 | spec->int_mic.pin = 0x19; |
8958 | 8615 | spec->ext_mic.mux_idx = 0; | |
8959 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | 8616 | spec->int_mic.mux_idx = 1; |
8960 | unsigned int res) | 8617 | spec->auto_mic = 1; |
8961 | { | ||
8962 | switch (res >> 26) { | ||
8963 | case ALC880_MIC_EVENT: | ||
8964 | alc883_nb_mic_automute(codec); | ||
8965 | break; | ||
8966 | default: | ||
8967 | alc_sku_unsol_event(codec, res); | ||
8968 | break; | ||
8969 | } | ||
8970 | } | ||
8971 | |||
8972 | static void alc883_mode2_inithook(struct hda_codec *codec) | ||
8973 | { | ||
8974 | alc883_M90V_init_hook(codec); | ||
8975 | alc883_nb_mic_automute(codec); | ||
8976 | } | 8618 | } |
8977 | 8619 | ||
8978 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | 8620 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
@@ -9033,25 +8675,44 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |||
9033 | alc889A_mb31_automute(codec); | 8675 | alc889A_mb31_automute(codec); |
9034 | } | 8676 | } |
9035 | 8677 | ||
8678 | |||
9036 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 8679 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9037 | #define alc883_loopbacks alc880_loopbacks | 8680 | #define alc882_loopbacks alc880_loopbacks |
9038 | #endif | 8681 | #endif |
9039 | 8682 | ||
9040 | /* pcm configuration: identical with ALC880 */ | 8683 | /* pcm configuration: identical with ALC880 */ |
9041 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | 8684 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
9042 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | 8685 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
9043 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | 8686 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
9044 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback | 8687 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
9045 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | 8688 | |
8689 | static hda_nid_t alc883_slave_dig_outs[] = { | ||
8690 | ALC1200_DIGOUT_NID, 0, | ||
8691 | }; | ||
8692 | |||
8693 | static hda_nid_t alc1200_slave_dig_outs[] = { | ||
8694 | ALC883_DIGOUT_NID, 0, | ||
8695 | }; | ||
9046 | 8696 | ||
9047 | /* | 8697 | /* |
9048 | * configuration and preset | 8698 | * configuration and preset |
9049 | */ | 8699 | */ |
9050 | static const char *alc883_models[ALC883_MODEL_LAST] = { | 8700 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
9051 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | 8701 | [ALC882_3ST_DIG] = "3stack-dig", |
8702 | [ALC882_6ST_DIG] = "6stack-dig", | ||
8703 | [ALC882_ARIMA] = "arima", | ||
8704 | [ALC882_W2JC] = "w2jc", | ||
8705 | [ALC882_TARGA] = "targa", | ||
8706 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
8707 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
8708 | [ALC885_MACPRO] = "macpro", | ||
8709 | [ALC885_MB5] = "mb5", | ||
8710 | [ALC885_MBP3] = "mbp3", | ||
8711 | [ALC885_IMAC24] = "imac24", | ||
8712 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | ||
9052 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | 8713 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
9053 | [ALC883_3ST_6ch] = "3stack-6ch", | 8714 | [ALC883_3ST_6ch] = "3stack-6ch", |
9054 | [ALC883_6ST_DIG] = "6stack-dig", | 8715 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
9055 | [ALC883_TARGA_DIG] = "targa-dig", | 8716 | [ALC883_TARGA_DIG] = "targa-dig", |
9056 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | 8717 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
9057 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | 8718 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
@@ -9060,6 +8721,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
9060 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | 8721 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
9061 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | 8722 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
9062 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | 8723 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
8724 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | ||
9063 | [ALC883_MEDION] = "medion", | 8725 | [ALC883_MEDION] = "medion", |
9064 | [ALC883_MEDION_MD2] = "medion-md2", | 8726 | [ALC883_MEDION_MD2] = "medion-md2", |
9065 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | 8727 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
@@ -9071,18 +8733,22 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
9071 | [ALC888_3ST_HP] = "3stack-hp", | 8733 | [ALC888_3ST_HP] = "3stack-hp", |
9072 | [ALC888_6ST_DELL] = "6stack-dell", | 8734 | [ALC888_6ST_DELL] = "6stack-dell", |
9073 | [ALC883_MITAC] = "mitac", | 8735 | [ALC883_MITAC] = "mitac", |
8736 | [ALC883_CLEVO_M540R] = "clevo-m540r", | ||
9074 | [ALC883_CLEVO_M720] = "clevo-m720", | 8737 | [ALC883_CLEVO_M720] = "clevo-m720", |
9075 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | 8738 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
9076 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | 8739 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
9077 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | 8740 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
8741 | [ALC889A_INTEL] = "intel-alc889a", | ||
8742 | [ALC889_INTEL] = "intel-x58", | ||
9078 | [ALC1200_ASUS_P5Q] = "asus-p5q", | 8743 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
9079 | [ALC889A_MB31] = "mb31", | 8744 | [ALC889A_MB31] = "mb31", |
9080 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | 8745 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
9081 | [ALC883_AUTO] = "auto", | 8746 | [ALC882_AUTO] = "auto", |
9082 | }; | 8747 | }; |
9083 | 8748 | ||
9084 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | 8749 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9085 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | 8750 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
8751 | |||
9086 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8752 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
9087 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | 8753 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
9088 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | 8754 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
@@ -9097,40 +8763,56 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9097 | ALC888_ACER_ASPIRE_8930G), | 8763 | ALC888_ACER_ASPIRE_8930G), |
9098 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | 8764 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
9099 | ALC888_ACER_ASPIRE_8930G), | 8765 | ALC888_ACER_ASPIRE_8930G), |
9100 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), | 8766 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
9101 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), | 8767 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
9102 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | 8768 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
9103 | ALC888_ACER_ASPIRE_6530G), | 8769 | ALC888_ACER_ASPIRE_6530G), |
9104 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | 8770 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
9105 | ALC888_ACER_ASPIRE_6530G), | 8771 | ALC888_ACER_ASPIRE_6530G), |
8772 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | ||
8773 | ALC888_ACER_ASPIRE_7730G), | ||
9106 | /* default Acer -- disabled as it causes more problems. | 8774 | /* default Acer -- disabled as it causes more problems. |
9107 | * model=auto should work fine now | 8775 | * model=auto should work fine now |
9108 | */ | 8776 | */ |
9109 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | 8777 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
8778 | |||
9110 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8779 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
8780 | |||
9111 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8781 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
9112 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8782 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
9113 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8783 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
9114 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8784 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
9115 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | 8785 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
9116 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | 8786 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
8787 | |||
8788 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
8789 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
8790 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
9117 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | 8791 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
8792 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
8793 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
8794 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
9118 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8795 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
9119 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | 8796 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
9120 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | 8797 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
9121 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | 8798 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
8799 | |||
8800 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
9122 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8801 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
9123 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 8802 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
9124 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | 8803 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
9125 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | 8804 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
9126 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 8805 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
9127 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | 8806 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
9128 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | 8807 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
9129 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), | 8808 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
8809 | |||
9130 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 8810 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
9131 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 8811 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
9132 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 8812 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
8813 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
9133 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | 8814 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
8815 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
9134 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 8816 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
9135 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | 8817 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
9136 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | 8818 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
@@ -9139,6 +8821,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9139 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | 8821 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
9140 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | 8822 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
9141 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | 8823 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
8824 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | ||
9142 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | 8825 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9143 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | 8826 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
9144 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | 8827 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
@@ -9152,11 +8835,15 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9152 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | 8835 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
9153 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | 8836 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
9154 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 8837 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
8838 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | ||
8839 | |||
9155 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 8840 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
9156 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | 8841 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9157 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | 8842 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
8843 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | ||
9158 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | 8844 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
9159 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 8845 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
8846 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | ||
9160 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 8847 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
9161 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | 8848 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
9162 | ALC883_FUJITSU_PI2515), | 8849 | ALC883_FUJITSU_PI2515), |
@@ -9171,24 +8858,186 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9171 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | 8858 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
9172 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8859 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
9173 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8860 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
8861 | |||
9174 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | 8862 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
9175 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | 8863 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
9176 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | 8864 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
9177 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), | 8865 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
8866 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | ||
8867 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | ||
9178 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | 8868 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
9179 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
9180 | {} | ||
9181 | }; | ||
9182 | 8869 | ||
9183 | static hda_nid_t alc883_slave_dig_outs[] = { | 8870 | {} |
9184 | ALC1200_DIGOUT_NID, 0, | ||
9185 | }; | 8871 | }; |
9186 | 8872 | ||
9187 | static hda_nid_t alc1200_slave_dig_outs[] = { | 8873 | /* codec SSID table for Intel Mac */ |
9188 | ALC883_DIGOUT_NID, 0, | 8874 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
8875 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | ||
8876 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | ||
8877 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | ||
8878 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | ||
8879 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | ||
8880 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | ||
8881 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | ||
8882 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | ||
8883 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | ||
8884 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | ||
8885 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | ||
8886 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently | ||
8887 | * no perfect solution yet | ||
8888 | */ | ||
8889 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | ||
8890 | {} /* terminator */ | ||
9189 | }; | 8891 | }; |
9190 | 8892 | ||
9191 | static struct alc_config_preset alc883_presets[] = { | 8893 | static struct alc_config_preset alc882_presets[] = { |
8894 | [ALC882_3ST_DIG] = { | ||
8895 | .mixers = { alc882_base_mixer }, | ||
8896 | .init_verbs = { alc882_base_init_verbs, | ||
8897 | alc882_adc1_init_verbs }, | ||
8898 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8899 | .dac_nids = alc882_dac_nids, | ||
8900 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8901 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8902 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8903 | .channel_mode = alc882_ch_modes, | ||
8904 | .need_dac_fix = 1, | ||
8905 | .input_mux = &alc882_capture_source, | ||
8906 | }, | ||
8907 | [ALC882_6ST_DIG] = { | ||
8908 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
8909 | .init_verbs = { alc882_base_init_verbs, | ||
8910 | alc882_adc1_init_verbs }, | ||
8911 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8912 | .dac_nids = alc882_dac_nids, | ||
8913 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8914 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8915 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
8916 | .channel_mode = alc882_sixstack_modes, | ||
8917 | .input_mux = &alc882_capture_source, | ||
8918 | }, | ||
8919 | [ALC882_ARIMA] = { | ||
8920 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
8921 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8922 | alc882_eapd_verbs }, | ||
8923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8924 | .dac_nids = alc882_dac_nids, | ||
8925 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
8926 | .channel_mode = alc882_sixstack_modes, | ||
8927 | .input_mux = &alc882_capture_source, | ||
8928 | }, | ||
8929 | [ALC882_W2JC] = { | ||
8930 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
8931 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8932 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | ||
8933 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8934 | .dac_nids = alc882_dac_nids, | ||
8935 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
8936 | .channel_mode = alc880_threestack_modes, | ||
8937 | .need_dac_fix = 1, | ||
8938 | .input_mux = &alc882_capture_source, | ||
8939 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8940 | }, | ||
8941 | [ALC885_MBP3] = { | ||
8942 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | ||
8943 | .init_verbs = { alc885_mbp3_init_verbs, | ||
8944 | alc880_gpio1_init_verbs }, | ||
8945 | .num_dacs = 2, | ||
8946 | .dac_nids = alc882_dac_nids, | ||
8947 | .hp_nid = 0x04, | ||
8948 | .channel_mode = alc885_mbp_4ch_modes, | ||
8949 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
8950 | .input_mux = &alc882_capture_source, | ||
8951 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8952 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8953 | .unsol_event = alc_automute_amp_unsol_event, | ||
8954 | .setup = alc885_mbp3_setup, | ||
8955 | .init_hook = alc_automute_amp, | ||
8956 | }, | ||
8957 | [ALC885_MB5] = { | ||
8958 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | ||
8959 | .init_verbs = { alc885_mb5_init_verbs, | ||
8960 | alc880_gpio1_init_verbs }, | ||
8961 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8962 | .dac_nids = alc882_dac_nids, | ||
8963 | .channel_mode = alc885_mb5_6ch_modes, | ||
8964 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | ||
8965 | .input_mux = &mb5_capture_source, | ||
8966 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8967 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8968 | }, | ||
8969 | [ALC885_MACPRO] = { | ||
8970 | .mixers = { alc882_macpro_mixer }, | ||
8971 | .init_verbs = { alc882_macpro_init_verbs }, | ||
8972 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8973 | .dac_nids = alc882_dac_nids, | ||
8974 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8975 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8976 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8977 | .channel_mode = alc882_ch_modes, | ||
8978 | .input_mux = &alc882_capture_source, | ||
8979 | .init_hook = alc885_macpro_init_hook, | ||
8980 | }, | ||
8981 | [ALC885_IMAC24] = { | ||
8982 | .mixers = { alc885_imac24_mixer }, | ||
8983 | .init_verbs = { alc885_imac24_init_verbs }, | ||
8984 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8985 | .dac_nids = alc882_dac_nids, | ||
8986 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8987 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8988 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8989 | .channel_mode = alc882_ch_modes, | ||
8990 | .input_mux = &alc882_capture_source, | ||
8991 | .unsol_event = alc_automute_amp_unsol_event, | ||
8992 | .setup = alc885_imac24_setup, | ||
8993 | .init_hook = alc885_imac24_init_hook, | ||
8994 | }, | ||
8995 | [ALC882_TARGA] = { | ||
8996 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
8997 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8998 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | ||
8999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9000 | .dac_nids = alc882_dac_nids, | ||
9001 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9002 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
9003 | .adc_nids = alc882_adc_nids, | ||
9004 | .capsrc_nids = alc882_capsrc_nids, | ||
9005 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
9006 | .channel_mode = alc882_3ST_6ch_modes, | ||
9007 | .need_dac_fix = 1, | ||
9008 | .input_mux = &alc882_capture_source, | ||
9009 | .unsol_event = alc882_targa_unsol_event, | ||
9010 | .setup = alc882_targa_setup, | ||
9011 | .init_hook = alc882_targa_automute, | ||
9012 | }, | ||
9013 | [ALC882_ASUS_A7J] = { | ||
9014 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
9015 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
9016 | alc882_asus_a7j_verbs}, | ||
9017 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9018 | .dac_nids = alc882_dac_nids, | ||
9019 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9020 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
9021 | .adc_nids = alc882_adc_nids, | ||
9022 | .capsrc_nids = alc882_capsrc_nids, | ||
9023 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
9024 | .channel_mode = alc882_3ST_6ch_modes, | ||
9025 | .need_dac_fix = 1, | ||
9026 | .input_mux = &alc882_capture_source, | ||
9027 | }, | ||
9028 | [ALC882_ASUS_A7M] = { | ||
9029 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
9030 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
9031 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | ||
9032 | alc882_asus_a7m_verbs }, | ||
9033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9034 | .dac_nids = alc882_dac_nids, | ||
9035 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9036 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
9037 | .channel_mode = alc880_threestack_modes, | ||
9038 | .need_dac_fix = 1, | ||
9039 | .input_mux = &alc882_capture_source, | ||
9040 | }, | ||
9192 | [ALC883_3ST_2ch_DIG] = { | 9041 | [ALC883_3ST_2ch_DIG] = { |
9193 | .mixers = { alc883_3ST_2ch_mixer }, | 9042 | .mixers = { alc883_3ST_2ch_mixer }, |
9194 | .init_verbs = { alc883_init_verbs }, | 9043 | .init_verbs = { alc883_init_verbs }, |
@@ -9235,6 +9084,46 @@ static struct alc_config_preset alc883_presets[] = { | |||
9235 | .need_dac_fix = 1, | 9084 | .need_dac_fix = 1, |
9236 | .input_mux = &alc883_3stack_6ch_intel, | 9085 | .input_mux = &alc883_3stack_6ch_intel, |
9237 | }, | 9086 | }, |
9087 | [ALC889A_INTEL] = { | ||
9088 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
9089 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | ||
9090 | alc_hp15_unsol_verbs }, | ||
9091 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9092 | .dac_nids = alc883_dac_nids, | ||
9093 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
9094 | .adc_nids = alc889_adc_nids, | ||
9095 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9096 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9097 | .slave_dig_outs = alc883_slave_dig_outs, | ||
9098 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
9099 | .channel_mode = alc889_8ch_intel_modes, | ||
9100 | .capsrc_nids = alc889_capsrc_nids, | ||
9101 | .input_mux = &alc889_capture_source, | ||
9102 | .setup = alc889_automute_setup, | ||
9103 | .init_hook = alc_automute_amp, | ||
9104 | .unsol_event = alc_automute_amp_unsol_event, | ||
9105 | .need_dac_fix = 1, | ||
9106 | }, | ||
9107 | [ALC889_INTEL] = { | ||
9108 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
9109 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | ||
9110 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | ||
9111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9112 | .dac_nids = alc883_dac_nids, | ||
9113 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
9114 | .adc_nids = alc889_adc_nids, | ||
9115 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9116 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9117 | .slave_dig_outs = alc883_slave_dig_outs, | ||
9118 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
9119 | .channel_mode = alc889_8ch_intel_modes, | ||
9120 | .capsrc_nids = alc889_capsrc_nids, | ||
9121 | .input_mux = &alc889_capture_source, | ||
9122 | .setup = alc889_automute_setup, | ||
9123 | .init_hook = alc889_intel_init_hook, | ||
9124 | .unsol_event = alc_automute_amp_unsol_event, | ||
9125 | .need_dac_fix = 1, | ||
9126 | }, | ||
9238 | [ALC883_6ST_DIG] = { | 9127 | [ALC883_6ST_DIG] = { |
9239 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9128 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
9240 | .init_verbs = { alc883_init_verbs }, | 9129 | .init_verbs = { alc883_init_verbs }, |
@@ -9258,7 +9147,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9258 | .need_dac_fix = 1, | 9147 | .need_dac_fix = 1, |
9259 | .input_mux = &alc883_capture_source, | 9148 | .input_mux = &alc883_capture_source, |
9260 | .unsol_event = alc883_targa_unsol_event, | 9149 | .unsol_event = alc883_targa_unsol_event, |
9261 | .init_hook = alc883_targa_init_hook, | 9150 | .setup = alc882_targa_setup, |
9151 | .init_hook = alc882_targa_automute, | ||
9262 | }, | 9152 | }, |
9263 | [ALC883_TARGA_2ch_DIG] = { | 9153 | [ALC883_TARGA_2ch_DIG] = { |
9264 | .mixers = { alc883_targa_2ch_mixer}, | 9154 | .mixers = { alc883_targa_2ch_mixer}, |
@@ -9273,7 +9163,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9273 | .channel_mode = alc883_3ST_2ch_modes, | 9163 | .channel_mode = alc883_3ST_2ch_modes, |
9274 | .input_mux = &alc883_capture_source, | 9164 | .input_mux = &alc883_capture_source, |
9275 | .unsol_event = alc883_targa_unsol_event, | 9165 | .unsol_event = alc883_targa_unsol_event, |
9276 | .init_hook = alc883_targa_init_hook, | 9166 | .setup = alc882_targa_setup, |
9167 | .init_hook = alc882_targa_automute, | ||
9277 | }, | 9168 | }, |
9278 | [ALC883_TARGA_8ch_DIG] = { | 9169 | [ALC883_TARGA_8ch_DIG] = { |
9279 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9170 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9291,7 +9182,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9291 | .need_dac_fix = 1, | 9182 | .need_dac_fix = 1, |
9292 | .input_mux = &alc883_capture_source, | 9183 | .input_mux = &alc883_capture_source, |
9293 | .unsol_event = alc883_targa_unsol_event, | 9184 | .unsol_event = alc883_targa_unsol_event, |
9294 | .init_hook = alc883_targa_init_hook, | 9185 | .setup = alc882_targa_setup, |
9186 | .init_hook = alc882_targa_automute, | ||
9295 | }, | 9187 | }, |
9296 | [ALC883_ACER] = { | 9188 | [ALC883_ACER] = { |
9297 | .mixers = { alc883_base_mixer }, | 9189 | .mixers = { alc883_base_mixer }, |
@@ -9317,7 +9209,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9317 | .channel_mode = alc883_3ST_2ch_modes, | 9209 | .channel_mode = alc883_3ST_2ch_modes, |
9318 | .input_mux = &alc883_capture_source, | 9210 | .input_mux = &alc883_capture_source, |
9319 | .unsol_event = alc_automute_amp_unsol_event, | 9211 | .unsol_event = alc_automute_amp_unsol_event, |
9320 | .init_hook = alc883_acer_aspire_init_hook, | 9212 | .setup = alc883_acer_aspire_setup, |
9213 | .init_hook = alc_automute_amp, | ||
9321 | }, | 9214 | }, |
9322 | [ALC888_ACER_ASPIRE_4930G] = { | 9215 | [ALC888_ACER_ASPIRE_4930G] = { |
9323 | .mixers = { alc888_base_mixer, | 9216 | .mixers = { alc888_base_mixer, |
@@ -9337,7 +9230,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9337 | ARRAY_SIZE(alc888_2_capture_sources), | 9230 | ARRAY_SIZE(alc888_2_capture_sources), |
9338 | .input_mux = alc888_2_capture_sources, | 9231 | .input_mux = alc888_2_capture_sources, |
9339 | .unsol_event = alc_automute_amp_unsol_event, | 9232 | .unsol_event = alc_automute_amp_unsol_event, |
9340 | .init_hook = alc888_acer_aspire_4930g_init_hook, | 9233 | .setup = alc888_acer_aspire_4930g_setup, |
9234 | .init_hook = alc_automute_amp, | ||
9341 | }, | 9235 | }, |
9342 | [ALC888_ACER_ASPIRE_6530G] = { | 9236 | [ALC888_ACER_ASPIRE_6530G] = { |
9343 | .mixers = { alc888_acer_aspire_6530_mixer }, | 9237 | .mixers = { alc888_acer_aspire_6530_mixer }, |
@@ -9355,7 +9249,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9355 | ARRAY_SIZE(alc888_2_capture_sources), | 9249 | ARRAY_SIZE(alc888_2_capture_sources), |
9356 | .input_mux = alc888_acer_aspire_6530_sources, | 9250 | .input_mux = alc888_acer_aspire_6530_sources, |
9357 | .unsol_event = alc_automute_amp_unsol_event, | 9251 | .unsol_event = alc_automute_amp_unsol_event, |
9358 | .init_hook = alc888_acer_aspire_6530g_init_hook, | 9252 | .setup = alc888_acer_aspire_6530g_setup, |
9253 | .init_hook = alc_automute_amp, | ||
9359 | }, | 9254 | }, |
9360 | [ALC888_ACER_ASPIRE_8930G] = { | 9255 | [ALC888_ACER_ASPIRE_8930G] = { |
9361 | .mixers = { alc888_base_mixer, | 9256 | .mixers = { alc888_base_mixer, |
@@ -9376,7 +9271,28 @@ static struct alc_config_preset alc883_presets[] = { | |||
9376 | ARRAY_SIZE(alc889_capture_sources), | 9271 | ARRAY_SIZE(alc889_capture_sources), |
9377 | .input_mux = alc889_capture_sources, | 9272 | .input_mux = alc889_capture_sources, |
9378 | .unsol_event = alc_automute_amp_unsol_event, | 9273 | .unsol_event = alc_automute_amp_unsol_event, |
9379 | .init_hook = alc889_acer_aspire_8930g_init_hook, | 9274 | .setup = alc889_acer_aspire_8930g_setup, |
9275 | .init_hook = alc_automute_amp, | ||
9276 | }, | ||
9277 | [ALC888_ACER_ASPIRE_7730G] = { | ||
9278 | .mixers = { alc883_3ST_6ch_mixer, | ||
9279 | alc883_chmode_mixer }, | ||
9280 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
9281 | alc888_acer_aspire_7730G_verbs }, | ||
9282 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9283 | .dac_nids = alc883_dac_nids, | ||
9284 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
9285 | .adc_nids = alc883_adc_nids_rev, | ||
9286 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
9287 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
9289 | .channel_mode = alc883_3ST_6ch_modes, | ||
9290 | .need_dac_fix = 1, | ||
9291 | .const_channel_count = 6, | ||
9292 | .input_mux = &alc883_capture_source, | ||
9293 | .unsol_event = alc_automute_amp_unsol_event, | ||
9294 | .setup = alc888_acer_aspire_6530g_setup, | ||
9295 | .init_hook = alc_automute_amp, | ||
9380 | }, | 9296 | }, |
9381 | [ALC883_MEDION] = { | 9297 | [ALC883_MEDION] = { |
9382 | .mixers = { alc883_fivestack_mixer, | 9298 | .mixers = { alc883_fivestack_mixer, |
@@ -9401,7 +9317,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9401 | .channel_mode = alc883_3ST_2ch_modes, | 9317 | .channel_mode = alc883_3ST_2ch_modes, |
9402 | .input_mux = &alc883_capture_source, | 9318 | .input_mux = &alc883_capture_source, |
9403 | .unsol_event = alc_automute_amp_unsol_event, | 9319 | .unsol_event = alc_automute_amp_unsol_event, |
9404 | .init_hook = alc883_medion_md2_init_hook, | 9320 | .setup = alc883_medion_md2_setup, |
9321 | .init_hook = alc_automute_amp, | ||
9405 | }, | 9322 | }, |
9406 | [ALC883_LAPTOP_EAPD] = { | 9323 | [ALC883_LAPTOP_EAPD] = { |
9407 | .mixers = { alc883_base_mixer }, | 9324 | .mixers = { alc883_base_mixer }, |
@@ -9412,6 +9329,21 @@ static struct alc_config_preset alc883_presets[] = { | |||
9412 | .channel_mode = alc883_3ST_2ch_modes, | 9329 | .channel_mode = alc883_3ST_2ch_modes, |
9413 | .input_mux = &alc883_capture_source, | 9330 | .input_mux = &alc883_capture_source, |
9414 | }, | 9331 | }, |
9332 | [ALC883_CLEVO_M540R] = { | ||
9333 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
9334 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | ||
9335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9336 | .dac_nids = alc883_dac_nids, | ||
9337 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9338 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9339 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | ||
9340 | .channel_mode = alc883_3ST_6ch_clevo_modes, | ||
9341 | .need_dac_fix = 1, | ||
9342 | .input_mux = &alc883_capture_source, | ||
9343 | /* This machine has the hardware HP auto-muting, thus | ||
9344 | * we need no software mute via unsol event | ||
9345 | */ | ||
9346 | }, | ||
9415 | [ALC883_CLEVO_M720] = { | 9347 | [ALC883_CLEVO_M720] = { |
9416 | .mixers = { alc883_clevo_m720_mixer }, | 9348 | .mixers = { alc883_clevo_m720_mixer }, |
9417 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | 9349 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
@@ -9422,6 +9354,7 @@ static struct alc_config_preset alc883_presets[] = { | |||
9422 | .channel_mode = alc883_3ST_2ch_modes, | 9354 | .channel_mode = alc883_3ST_2ch_modes, |
9423 | .input_mux = &alc883_capture_source, | 9355 | .input_mux = &alc883_capture_source, |
9424 | .unsol_event = alc883_clevo_m720_unsol_event, | 9356 | .unsol_event = alc883_clevo_m720_unsol_event, |
9357 | .setup = alc883_clevo_m720_setup, | ||
9425 | .init_hook = alc883_clevo_m720_init_hook, | 9358 | .init_hook = alc883_clevo_m720_init_hook, |
9426 | }, | 9359 | }, |
9427 | [ALC883_LENOVO_101E_2ch] = { | 9360 | [ALC883_LENOVO_101E_2ch] = { |
@@ -9447,7 +9380,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9447 | .need_dac_fix = 1, | 9380 | .need_dac_fix = 1, |
9448 | .input_mux = &alc883_lenovo_nb0763_capture_source, | 9381 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
9449 | .unsol_event = alc_automute_amp_unsol_event, | 9382 | .unsol_event = alc_automute_amp_unsol_event, |
9450 | .init_hook = alc883_medion_md2_init_hook, | 9383 | .setup = alc883_medion_md2_setup, |
9384 | .init_hook = alc_automute_amp, | ||
9451 | }, | 9385 | }, |
9452 | [ALC888_LENOVO_MS7195_DIG] = { | 9386 | [ALC888_LENOVO_MS7195_DIG] = { |
9453 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9387 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9472,7 +9406,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9472 | .channel_mode = alc883_3ST_2ch_modes, | 9406 | .channel_mode = alc883_3ST_2ch_modes, |
9473 | .input_mux = &alc883_capture_source, | 9407 | .input_mux = &alc883_capture_source, |
9474 | .unsol_event = alc_automute_amp_unsol_event, | 9408 | .unsol_event = alc_automute_amp_unsol_event, |
9475 | .init_hook = alc883_haier_w66_init_hook, | 9409 | .setup = alc883_haier_w66_setup, |
9410 | .init_hook = alc_automute_amp, | ||
9476 | }, | 9411 | }, |
9477 | [ALC888_3ST_HP] = { | 9412 | [ALC888_3ST_HP] = { |
9478 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9413 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9484,7 +9419,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9484 | .need_dac_fix = 1, | 9419 | .need_dac_fix = 1, |
9485 | .input_mux = &alc883_capture_source, | 9420 | .input_mux = &alc883_capture_source, |
9486 | .unsol_event = alc_automute_amp_unsol_event, | 9421 | .unsol_event = alc_automute_amp_unsol_event, |
9487 | .init_hook = alc888_3st_hp_init_hook, | 9422 | .setup = alc888_3st_hp_setup, |
9423 | .init_hook = alc_automute_amp, | ||
9488 | }, | 9424 | }, |
9489 | [ALC888_6ST_DELL] = { | 9425 | [ALC888_6ST_DELL] = { |
9490 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9426 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9497,7 +9433,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9497 | .channel_mode = alc883_sixstack_modes, | 9433 | .channel_mode = alc883_sixstack_modes, |
9498 | .input_mux = &alc883_capture_source, | 9434 | .input_mux = &alc883_capture_source, |
9499 | .unsol_event = alc_automute_amp_unsol_event, | 9435 | .unsol_event = alc_automute_amp_unsol_event, |
9500 | .init_hook = alc888_6st_dell_init_hook, | 9436 | .setup = alc888_6st_dell_setup, |
9437 | .init_hook = alc_automute_amp, | ||
9501 | }, | 9438 | }, |
9502 | [ALC883_MITAC] = { | 9439 | [ALC883_MITAC] = { |
9503 | .mixers = { alc883_mitac_mixer }, | 9440 | .mixers = { alc883_mitac_mixer }, |
@@ -9508,7 +9445,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9508 | .channel_mode = alc883_3ST_2ch_modes, | 9445 | .channel_mode = alc883_3ST_2ch_modes, |
9509 | .input_mux = &alc883_capture_source, | 9446 | .input_mux = &alc883_capture_source, |
9510 | .unsol_event = alc_automute_amp_unsol_event, | 9447 | .unsol_event = alc_automute_amp_unsol_event, |
9511 | .init_hook = alc883_mitac_init_hook, | 9448 | .setup = alc883_mitac_setup, |
9449 | .init_hook = alc_automute_amp, | ||
9512 | }, | 9450 | }, |
9513 | [ALC883_FUJITSU_PI2515] = { | 9451 | [ALC883_FUJITSU_PI2515] = { |
9514 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | 9452 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
@@ -9521,7 +9459,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9521 | .channel_mode = alc883_3ST_2ch_modes, | 9459 | .channel_mode = alc883_3ST_2ch_modes, |
9522 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9460 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9523 | .unsol_event = alc_automute_amp_unsol_event, | 9461 | .unsol_event = alc_automute_amp_unsol_event, |
9524 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, | 9462 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
9463 | .init_hook = alc_automute_amp, | ||
9525 | }, | 9464 | }, |
9526 | [ALC888_FUJITSU_XA3530] = { | 9465 | [ALC888_FUJITSU_XA3530] = { |
9527 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | 9466 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
@@ -9539,7 +9478,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9539 | ARRAY_SIZE(alc888_2_capture_sources), | 9478 | ARRAY_SIZE(alc888_2_capture_sources), |
9540 | .input_mux = alc888_2_capture_sources, | 9479 | .input_mux = alc888_2_capture_sources, |
9541 | .unsol_event = alc_automute_amp_unsol_event, | 9480 | .unsol_event = alc_automute_amp_unsol_event, |
9542 | .init_hook = alc888_fujitsu_xa3530_init_hook, | 9481 | .setup = alc888_fujitsu_xa3530_setup, |
9482 | .init_hook = alc_automute_amp, | ||
9543 | }, | 9483 | }, |
9544 | [ALC888_LENOVO_SKY] = { | 9484 | [ALC888_LENOVO_SKY] = { |
9545 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | 9485 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
@@ -9552,7 +9492,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9552 | .need_dac_fix = 1, | 9492 | .need_dac_fix = 1, |
9553 | .input_mux = &alc883_lenovo_sky_capture_source, | 9493 | .input_mux = &alc883_lenovo_sky_capture_source, |
9554 | .unsol_event = alc_automute_amp_unsol_event, | 9494 | .unsol_event = alc_automute_amp_unsol_event, |
9555 | .init_hook = alc888_lenovo_sky_init_hook, | 9495 | .setup = alc888_lenovo_sky_setup, |
9496 | .init_hook = alc_automute_amp, | ||
9556 | }, | 9497 | }, |
9557 | [ALC888_ASUS_M90V] = { | 9498 | [ALC888_ASUS_M90V] = { |
9558 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9499 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9565,8 +9506,9 @@ static struct alc_config_preset alc883_presets[] = { | |||
9565 | .channel_mode = alc883_3ST_6ch_modes, | 9506 | .channel_mode = alc883_3ST_6ch_modes, |
9566 | .need_dac_fix = 1, | 9507 | .need_dac_fix = 1, |
9567 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9508 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9568 | .unsol_event = alc883_mode2_unsol_event, | 9509 | .unsol_event = alc_sku_unsol_event, |
9569 | .init_hook = alc883_mode2_inithook, | 9510 | .setup = alc883_mode2_setup, |
9511 | .init_hook = alc_inithook, | ||
9570 | }, | 9512 | }, |
9571 | [ALC888_ASUS_EEE1601] = { | 9513 | [ALC888_ASUS_EEE1601] = { |
9572 | .mixers = { alc883_asus_eee1601_mixer }, | 9514 | .mixers = { alc883_asus_eee1601_mixer }, |
@@ -9619,15 +9561,45 @@ static struct alc_config_preset alc883_presets[] = { | |||
9619 | .channel_mode = alc883_3ST_2ch_modes, | 9561 | .channel_mode = alc883_3ST_2ch_modes, |
9620 | .input_mux = &alc883_capture_source, | 9562 | .input_mux = &alc883_capture_source, |
9621 | .unsol_event = alc_automute_amp_unsol_event, | 9563 | .unsol_event = alc_automute_amp_unsol_event, |
9622 | .init_hook = alc883_vaiott_init_hook, | 9564 | .setup = alc883_vaiott_setup, |
9565 | .init_hook = alc_automute_amp, | ||
9623 | }, | 9566 | }, |
9624 | }; | 9567 | }; |
9625 | 9568 | ||
9626 | 9569 | ||
9627 | /* | 9570 | /* |
9571 | * Pin config fixes | ||
9572 | */ | ||
9573 | enum { | ||
9574 | PINFIX_ABIT_AW9D_MAX | ||
9575 | }; | ||
9576 | |||
9577 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | ||
9578 | { 0x15, 0x01080104 }, /* side */ | ||
9579 | { 0x16, 0x01011012 }, /* rear */ | ||
9580 | { 0x17, 0x01016011 }, /* clfe */ | ||
9581 | { } | ||
9582 | }; | ||
9583 | |||
9584 | static const struct alc_pincfg *alc882_pin_fixes[] = { | ||
9585 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | ||
9586 | }; | ||
9587 | |||
9588 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | ||
9589 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | ||
9590 | {} | ||
9591 | }; | ||
9592 | |||
9593 | /* | ||
9628 | * BIOS auto configuration | 9594 | * BIOS auto configuration |
9629 | */ | 9595 | */ |
9630 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | 9596 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
9597 | const struct auto_pin_cfg *cfg) | ||
9598 | { | ||
9599 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | ||
9600 | } | ||
9601 | |||
9602 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | ||
9631 | hda_nid_t nid, int pin_type, | 9603 | hda_nid_t nid, int pin_type, |
9632 | int dac_idx) | 9604 | int dac_idx) |
9633 | { | 9605 | { |
@@ -9644,7 +9616,7 @@ static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |||
9644 | 9616 | ||
9645 | } | 9617 | } |
9646 | 9618 | ||
9647 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | 9619 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
9648 | { | 9620 | { |
9649 | struct alc_spec *spec = codec->spec; | 9621 | struct alc_spec *spec = codec->spec; |
9650 | int i; | 9622 | int i; |
@@ -9653,12 +9625,12 @@ static void alc883_auto_init_multi_out(struct hda_codec *codec) | |||
9653 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | 9625 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
9654 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | 9626 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9655 | if (nid) | 9627 | if (nid) |
9656 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, | 9628 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
9657 | i); | 9629 | i); |
9658 | } | 9630 | } |
9659 | } | 9631 | } |
9660 | 9632 | ||
9661 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | 9633 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
9662 | { | 9634 | { |
9663 | struct alc_spec *spec = codec->spec; | 9635 | struct alc_spec *spec = codec->spec; |
9664 | hda_nid_t pin; | 9636 | hda_nid_t pin; |
@@ -9666,91 +9638,191 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec) | |||
9666 | pin = spec->autocfg.hp_pins[0]; | 9638 | pin = spec->autocfg.hp_pins[0]; |
9667 | if (pin) /* connect to front */ | 9639 | if (pin) /* connect to front */ |
9668 | /* use dac 0 */ | 9640 | /* use dac 0 */ |
9669 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 9641 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
9670 | pin = spec->autocfg.speaker_pins[0]; | 9642 | pin = spec->autocfg.speaker_pins[0]; |
9671 | if (pin) | 9643 | if (pin) |
9672 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 9644 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
9673 | } | 9645 | } |
9674 | 9646 | ||
9675 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | 9647 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
9676 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | ||
9677 | |||
9678 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | ||
9679 | { | 9648 | { |
9680 | struct alc_spec *spec = codec->spec; | 9649 | struct alc_spec *spec = codec->spec; |
9681 | int i; | 9650 | int i; |
9682 | 9651 | ||
9683 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 9652 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
9684 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 9653 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
9685 | if (alc883_is_input_pin(nid)) { | 9654 | if (!nid) |
9686 | alc_set_input_pin(codec, nid, i); | 9655 | continue; |
9687 | if (nid != ALC883_PIN_CD_NID && | 9656 | alc_set_input_pin(codec, nid, i); |
9688 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 9657 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
9658 | snd_hda_codec_write(codec, nid, 0, | ||
9659 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
9660 | AMP_OUT_MUTE); | ||
9661 | } | ||
9662 | } | ||
9663 | |||
9664 | static void alc882_auto_init_input_src(struct hda_codec *codec) | ||
9665 | { | ||
9666 | struct alc_spec *spec = codec->spec; | ||
9667 | int c; | ||
9668 | |||
9669 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
9670 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | ||
9671 | hda_nid_t nid = spec->capsrc_nids[c]; | ||
9672 | unsigned int mux_idx; | ||
9673 | const struct hda_input_mux *imux; | ||
9674 | int conns, mute, idx, item; | ||
9675 | |||
9676 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
9677 | ARRAY_SIZE(conn_list)); | ||
9678 | if (conns < 0) | ||
9679 | continue; | ||
9680 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
9681 | imux = &spec->input_mux[mux_idx]; | ||
9682 | for (idx = 0; idx < conns; idx++) { | ||
9683 | /* if the current connection is the selected one, | ||
9684 | * unmute it as default - otherwise mute it | ||
9685 | */ | ||
9686 | mute = AMP_IN_MUTE(idx); | ||
9687 | for (item = 0; item < imux->num_items; item++) { | ||
9688 | if (imux->items[item].index == idx) { | ||
9689 | if (spec->cur_mux[c] == item) | ||
9690 | mute = AMP_IN_UNMUTE(idx); | ||
9691 | break; | ||
9692 | } | ||
9693 | } | ||
9694 | /* check if we have a selector or mixer | ||
9695 | * we could check for the widget type instead, but | ||
9696 | * just check for Amp-In presence (in case of mixer | ||
9697 | * without amp-in there is something wrong, this | ||
9698 | * function shouldn't be used or capsrc nid is wrong) | ||
9699 | */ | ||
9700 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
9689 | snd_hda_codec_write(codec, nid, 0, | 9701 | snd_hda_codec_write(codec, nid, 0, |
9690 | AC_VERB_SET_AMP_GAIN_MUTE, | 9702 | AC_VERB_SET_AMP_GAIN_MUTE, |
9691 | AMP_OUT_MUTE); | 9703 | mute); |
9704 | else if (mute != AMP_IN_MUTE(idx)) | ||
9705 | snd_hda_codec_write(codec, nid, 0, | ||
9706 | AC_VERB_SET_CONNECT_SEL, | ||
9707 | idx); | ||
9692 | } | 9708 | } |
9693 | } | 9709 | } |
9694 | } | 9710 | } |
9695 | 9711 | ||
9696 | #define alc883_auto_init_input_src alc882_auto_init_input_src | 9712 | /* add mic boosts if needed */ |
9713 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
9714 | { | ||
9715 | struct alc_spec *spec = codec->spec; | ||
9716 | int err; | ||
9717 | hda_nid_t nid; | ||
9718 | |||
9719 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
9720 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
9721 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
9722 | "Mic Boost", | ||
9723 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
9724 | if (err < 0) | ||
9725 | return err; | ||
9726 | } | ||
9727 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
9728 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
9729 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
9730 | "Front Mic Boost", | ||
9731 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
9732 | if (err < 0) | ||
9733 | return err; | ||
9734 | } | ||
9735 | return 0; | ||
9736 | } | ||
9697 | 9737 | ||
9698 | /* almost identical with ALC880 parser... */ | 9738 | /* almost identical with ALC880 parser... */ |
9699 | static int alc883_parse_auto_config(struct hda_codec *codec) | 9739 | static int alc882_parse_auto_config(struct hda_codec *codec) |
9700 | { | 9740 | { |
9701 | struct alc_spec *spec = codec->spec; | 9741 | struct alc_spec *spec = codec->spec; |
9702 | int err = alc880_parse_auto_config(codec); | 9742 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
9703 | struct auto_pin_cfg *cfg = &spec->autocfg; | 9743 | int i, err; |
9704 | int i; | ||
9705 | 9744 | ||
9745 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
9746 | alc882_ignore); | ||
9706 | if (err < 0) | 9747 | if (err < 0) |
9707 | return err; | 9748 | return err; |
9708 | else if (!err) | 9749 | if (!spec->autocfg.line_outs) |
9709 | return 0; /* no config found */ | 9750 | return 0; /* can't find valid BIOS pin config */ |
9710 | 9751 | ||
9711 | err = alc_auto_add_mic_boost(codec); | 9752 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
9753 | if (err < 0) | ||
9754 | return err; | ||
9755 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
9756 | if (err < 0) | ||
9757 | return err; | ||
9758 | err = alc880_auto_create_extra_out(spec, | ||
9759 | spec->autocfg.speaker_pins[0], | ||
9760 | "Speaker"); | ||
9761 | if (err < 0) | ||
9762 | return err; | ||
9763 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | ||
9764 | "Headphone"); | ||
9765 | if (err < 0) | ||
9766 | return err; | ||
9767 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | ||
9712 | if (err < 0) | 9768 | if (err < 0) |
9713 | return err; | 9769 | return err; |
9714 | 9770 | ||
9715 | /* hack - override the init verbs */ | 9771 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
9716 | spec->init_verbs[0] = alc883_auto_init_verbs; | ||
9717 | 9772 | ||
9718 | /* setup input_mux for ALC889 */ | 9773 | /* check multiple SPDIF-out (for recent codecs) */ |
9719 | if (codec->vendor_id == 0x10ec0889) { | 9774 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
9720 | /* digital-mic input pin is excluded in alc880_auto_create..() | 9775 | hda_nid_t dig_nid; |
9721 | * because it's under 0x18 | 9776 | err = snd_hda_get_connections(codec, |
9722 | */ | 9777 | spec->autocfg.dig_out_pins[i], |
9723 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | 9778 | &dig_nid, 1); |
9724 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | 9779 | if (err < 0) |
9725 | struct hda_input_mux *imux = &spec->private_imux[0]; | 9780 | continue; |
9726 | for (i = 1; i < 3; i++) | 9781 | if (!i) |
9727 | memcpy(&spec->private_imux[i], | 9782 | spec->multiout.dig_out_nid = dig_nid; |
9728 | &spec->private_imux[0], | 9783 | else { |
9729 | sizeof(spec->private_imux[0])); | 9784 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
9730 | imux->items[imux->num_items].label = "Int DMic"; | 9785 | spec->slave_dig_outs[i - 1] = dig_nid; |
9731 | imux->items[imux->num_items].index = 0x0b; | 9786 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
9732 | imux->num_items++; | 9787 | break; |
9733 | spec->num_mux_defs = 3; | ||
9734 | spec->input_mux = spec->private_imux; | ||
9735 | } | 9788 | } |
9736 | } | 9789 | } |
9790 | if (spec->autocfg.dig_in_pin) | ||
9791 | spec->dig_in_nid = ALC880_DIGIN_NID; | ||
9792 | |||
9793 | if (spec->kctls.list) | ||
9794 | add_mixer(spec, spec->kctls.list); | ||
9795 | |||
9796 | add_verb(spec, alc883_auto_init_verbs); | ||
9797 | /* if ADC 0x07 is available, initialize it, too */ | ||
9798 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | ||
9799 | add_verb(spec, alc882_adc1_init_verbs); | ||
9800 | |||
9801 | spec->num_mux_defs = 1; | ||
9802 | spec->input_mux = &spec->private_imux[0]; | ||
9803 | |||
9804 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | ||
9805 | |||
9806 | err = alc_auto_add_mic_boost(codec); | ||
9807 | if (err < 0) | ||
9808 | return err; | ||
9737 | 9809 | ||
9738 | return 1; /* config found */ | 9810 | return 1; /* config found */ |
9739 | } | 9811 | } |
9740 | 9812 | ||
9741 | /* additional initialization for auto-configuration model */ | 9813 | /* additional initialization for auto-configuration model */ |
9742 | static void alc883_auto_init(struct hda_codec *codec) | 9814 | static void alc882_auto_init(struct hda_codec *codec) |
9743 | { | 9815 | { |
9744 | struct alc_spec *spec = codec->spec; | 9816 | struct alc_spec *spec = codec->spec; |
9745 | alc883_auto_init_multi_out(codec); | 9817 | alc882_auto_init_multi_out(codec); |
9746 | alc883_auto_init_hp_out(codec); | 9818 | alc882_auto_init_hp_out(codec); |
9747 | alc883_auto_init_analog_input(codec); | 9819 | alc882_auto_init_analog_input(codec); |
9748 | alc883_auto_init_input_src(codec); | 9820 | alc882_auto_init_input_src(codec); |
9749 | if (spec->unsol_event) | 9821 | if (spec->unsol_event) |
9750 | alc_inithook(codec); | 9822 | alc_inithook(codec); |
9751 | } | 9823 | } |
9752 | 9824 | ||
9753 | static int patch_alc883(struct hda_codec *codec) | 9825 | static int patch_alc882(struct hda_codec *codec) |
9754 | { | 9826 | { |
9755 | struct alc_spec *spec; | 9827 | struct alc_spec *spec; |
9756 | int err, board_config; | 9828 | int err, board_config; |
@@ -9761,28 +9833,35 @@ static int patch_alc883(struct hda_codec *codec) | |||
9761 | 9833 | ||
9762 | codec->spec = spec; | 9834 | codec->spec = spec; |
9763 | 9835 | ||
9764 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | 9836 | switch (codec->vendor_id) { |
9837 | case 0x10ec0882: | ||
9838 | case 0x10ec0885: | ||
9839 | break; | ||
9840 | default: | ||
9841 | /* ALC883 and variants */ | ||
9842 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | ||
9843 | break; | ||
9844 | } | ||
9765 | 9845 | ||
9766 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, | 9846 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
9767 | alc883_models, | 9847 | alc882_models, |
9768 | alc883_cfg_tbl); | 9848 | alc882_cfg_tbl); |
9769 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { | 9849 | |
9770 | /* Pick up systems that don't supply PCI SSID */ | 9850 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
9771 | switch (codec->subsystem_id) { | 9851 | board_config = snd_hda_check_board_codec_sid_config(codec, |
9772 | case 0x106b3600: /* Macbook 3.1 */ | 9852 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
9773 | board_config = ALC889A_MB31; | 9853 | |
9774 | break; | 9854 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
9775 | default: | 9855 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
9776 | printk(KERN_INFO | 9856 | codec->chip_name); |
9777 | "hda_codec: Unknown model for %s, trying " | 9857 | board_config = ALC882_AUTO; |
9778 | "auto-probe from BIOS...\n", codec->chip_name); | ||
9779 | board_config = ALC883_AUTO; | ||
9780 | } | ||
9781 | } | 9858 | } |
9782 | 9859 | ||
9783 | if (board_config == ALC883_AUTO) { | 9860 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
9861 | |||
9862 | if (board_config == ALC882_AUTO) { | ||
9784 | /* automatic parse from the BIOS config */ | 9863 | /* automatic parse from the BIOS config */ |
9785 | err = alc883_parse_auto_config(codec); | 9864 | err = alc882_parse_auto_config(codec); |
9786 | if (err < 0) { | 9865 | if (err < 0) { |
9787 | alc_free(codec); | 9866 | alc_free(codec); |
9788 | return err; | 9867 | return err; |
@@ -9790,7 +9869,7 @@ static int patch_alc883(struct hda_codec *codec) | |||
9790 | printk(KERN_INFO | 9869 | printk(KERN_INFO |
9791 | "hda_codec: Cannot set up configuration " | 9870 | "hda_codec: Cannot set up configuration " |
9792 | "from BIOS. Using base mode...\n"); | 9871 | "from BIOS. Using base mode...\n"); |
9793 | board_config = ALC883_3ST_2ch_DIG; | 9872 | board_config = ALC882_3ST_DIG; |
9794 | } | 9873 | } |
9795 | } | 9874 | } |
9796 | 9875 | ||
@@ -9800,63 +9879,61 @@ static int patch_alc883(struct hda_codec *codec) | |||
9800 | return err; | 9879 | return err; |
9801 | } | 9880 | } |
9802 | 9881 | ||
9803 | if (board_config != ALC883_AUTO) | 9882 | if (board_config != ALC882_AUTO) |
9804 | setup_preset(spec, &alc883_presets[board_config]); | 9883 | setup_preset(codec, &alc882_presets[board_config]); |
9805 | 9884 | ||
9806 | switch (codec->vendor_id) { | 9885 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
9807 | case 0x10ec0888: | 9886 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
9808 | if (!spec->num_adc_nids) { | 9887 | /* FIXME: setup DAC5 */ |
9809 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 9888 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
9810 | spec->adc_nids = alc883_adc_nids; | 9889 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
9811 | } | 9890 | |
9812 | if (!spec->capsrc_nids) | 9891 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
9813 | spec->capsrc_nids = alc883_capsrc_nids; | 9892 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
9893 | |||
9894 | if (codec->vendor_id == 0x10ec0888) | ||
9814 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ | 9895 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
9815 | break; | 9896 | |
9816 | case 0x10ec0889: | 9897 | if (!spec->adc_nids && spec->input_mux) { |
9817 | if (!spec->num_adc_nids) { | 9898 | int i; |
9818 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); | 9899 | spec->num_adc_nids = 0; |
9819 | spec->adc_nids = alc889_adc_nids; | 9900 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
9820 | } | 9901 | hda_nid_t cap; |
9821 | if (!spec->capsrc_nids) | 9902 | hda_nid_t nid = alc882_adc_nids[i]; |
9822 | spec->capsrc_nids = alc889_capsrc_nids; | 9903 | unsigned int wcap = get_wcaps(codec, nid); |
9823 | break; | 9904 | /* get type */ |
9824 | default: | 9905 | wcap = get_wcaps_type(wcap); |
9825 | if (!spec->num_adc_nids) { | 9906 | if (wcap != AC_WID_AUD_IN) |
9826 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 9907 | continue; |
9827 | spec->adc_nids = alc883_adc_nids; | 9908 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
9909 | err = snd_hda_get_connections(codec, nid, &cap, 1); | ||
9910 | if (err < 0) | ||
9911 | continue; | ||
9912 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | ||
9913 | spec->num_adc_nids++; | ||
9828 | } | 9914 | } |
9829 | if (!spec->capsrc_nids) | 9915 | spec->adc_nids = spec->private_adc_nids; |
9830 | spec->capsrc_nids = alc883_capsrc_nids; | 9916 | spec->capsrc_nids = spec->private_capsrc_nids; |
9831 | break; | ||
9832 | } | 9917 | } |
9833 | 9918 | ||
9834 | spec->stream_analog_playback = &alc883_pcm_analog_playback; | 9919 | set_capture_mixer(codec); |
9835 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | ||
9836 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; | ||
9837 | |||
9838 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | ||
9839 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | ||
9840 | |||
9841 | if (!spec->cap_mixer) | ||
9842 | set_capture_mixer(spec); | ||
9843 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 9920 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
9844 | 9921 | ||
9845 | spec->vmaster_nid = 0x0c; | 9922 | spec->vmaster_nid = 0x0c; |
9846 | 9923 | ||
9847 | codec->patch_ops = alc_patch_ops; | 9924 | codec->patch_ops = alc_patch_ops; |
9848 | if (board_config == ALC883_AUTO) | 9925 | if (board_config == ALC882_AUTO) |
9849 | spec->init_hook = alc883_auto_init; | 9926 | spec->init_hook = alc882_auto_init; |
9850 | |||
9851 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 9927 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9852 | if (!spec->loopback.amplist) | 9928 | if (!spec->loopback.amplist) |
9853 | spec->loopback.amplist = alc883_loopbacks; | 9929 | spec->loopback.amplist = alc882_loopbacks; |
9854 | #endif | 9930 | #endif |
9855 | codec->proc_widget_hook = print_realtek_coef; | 9931 | codec->proc_widget_hook = print_realtek_coef; |
9856 | 9932 | ||
9857 | return 0; | 9933 | return 0; |
9858 | } | 9934 | } |
9859 | 9935 | ||
9936 | |||
9860 | /* | 9937 | /* |
9861 | * ALC262 support | 9938 | * ALC262 support |
9862 | */ | 9939 | */ |
@@ -10032,13 +10109,12 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |||
10032 | }; | 10109 | }; |
10033 | 10110 | ||
10034 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 10111 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
10035 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | 10112 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
10036 | { | 10113 | { |
10037 | struct alc_spec *spec = codec->spec; | 10114 | struct alc_spec *spec = codec->spec; |
10038 | 10115 | ||
10039 | spec->autocfg.hp_pins[0] = 0x15; | 10116 | spec->autocfg.hp_pins[0] = 0x15; |
10040 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | 10117 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
10041 | alc_automute_amp(codec); | ||
10042 | } | 10118 | } |
10043 | 10119 | ||
10044 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | 10120 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
@@ -10195,22 +10271,20 @@ static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |||
10195 | alc262_hippo_automute(codec); | 10271 | alc262_hippo_automute(codec); |
10196 | } | 10272 | } |
10197 | 10273 | ||
10198 | static void alc262_hippo_init_hook(struct hda_codec *codec) | 10274 | static void alc262_hippo_setup(struct hda_codec *codec) |
10199 | { | 10275 | { |
10200 | struct alc_spec *spec = codec->spec; | 10276 | struct alc_spec *spec = codec->spec; |
10201 | 10277 | ||
10202 | spec->autocfg.hp_pins[0] = 0x15; | 10278 | spec->autocfg.hp_pins[0] = 0x15; |
10203 | spec->autocfg.speaker_pins[0] = 0x14; | 10279 | spec->autocfg.speaker_pins[0] = 0x14; |
10204 | alc262_hippo_automute(codec); | ||
10205 | } | 10280 | } |
10206 | 10281 | ||
10207 | static void alc262_hippo1_init_hook(struct hda_codec *codec) | 10282 | static void alc262_hippo1_setup(struct hda_codec *codec) |
10208 | { | 10283 | { |
10209 | struct alc_spec *spec = codec->spec; | 10284 | struct alc_spec *spec = codec->spec; |
10210 | 10285 | ||
10211 | spec->autocfg.hp_pins[0] = 0x1b; | 10286 | spec->autocfg.hp_pins[0] = 0x1b; |
10212 | spec->autocfg.speaker_pins[0] = 0x14; | 10287 | spec->autocfg.speaker_pins[0] = 0x14; |
10213 | alc262_hippo_automute(codec); | ||
10214 | } | 10288 | } |
10215 | 10289 | ||
10216 | 10290 | ||
@@ -10267,13 +10341,12 @@ static struct hda_verb alc262_tyan_verbs[] = { | |||
10267 | }; | 10341 | }; |
10268 | 10342 | ||
10269 | /* unsolicited event for HP jack sensing */ | 10343 | /* unsolicited event for HP jack sensing */ |
10270 | static void alc262_tyan_init_hook(struct hda_codec *codec) | 10344 | static void alc262_tyan_setup(struct hda_codec *codec) |
10271 | { | 10345 | { |
10272 | struct alc_spec *spec = codec->spec; | 10346 | struct alc_spec *spec = codec->spec; |
10273 | 10347 | ||
10274 | spec->autocfg.hp_pins[0] = 0x1b; | 10348 | spec->autocfg.hp_pins[0] = 0x1b; |
10275 | spec->autocfg.speaker_pins[0] = 0x15; | 10349 | spec->autocfg.speaker_pins[0] = 0x15; |
10276 | alc_automute_amp(codec); | ||
10277 | } | 10350 | } |
10278 | 10351 | ||
10279 | 10352 | ||
@@ -10365,12 +10438,6 @@ static struct hda_verb alc262_eapd_verbs[] = { | |||
10365 | { } | 10438 | { } |
10366 | }; | 10439 | }; |
10367 | 10440 | ||
10368 | static struct hda_verb alc262_hippo_unsol_verbs[] = { | ||
10369 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
10370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
10371 | {} | ||
10372 | }; | ||
10373 | |||
10374 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | 10441 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
10375 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | 10442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
10376 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | 10443 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -10391,14 +10458,6 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { | |||
10391 | {} | 10458 | {} |
10392 | }; | 10459 | }; |
10393 | 10460 | ||
10394 | static struct hda_input_mux alc262_dmic_capture_source = { | ||
10395 | .num_items = 2, | ||
10396 | .items = { | ||
10397 | { "Int DMic", 0x9 }, | ||
10398 | { "Mic", 0x0 }, | ||
10399 | }, | ||
10400 | }; | ||
10401 | |||
10402 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | 10461 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
10403 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 10462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
10404 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 10463 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
@@ -10420,35 +10479,17 @@ static struct hda_verb alc262_toshiba_s06_verbs[] = { | |||
10420 | {} | 10479 | {} |
10421 | }; | 10480 | }; |
10422 | 10481 | ||
10423 | static void alc262_dmic_automute(struct hda_codec *codec) | 10482 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
10424 | { | ||
10425 | unsigned int present; | ||
10426 | |||
10427 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
10428 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10429 | snd_hda_codec_write(codec, 0x22, 0, | ||
10430 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | ||
10431 | } | ||
10432 | |||
10433 | |||
10434 | /* unsolicited event for HP jack sensing */ | ||
10435 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | ||
10436 | unsigned int res) | ||
10437 | { | ||
10438 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
10439 | alc262_dmic_automute(codec); | ||
10440 | else | ||
10441 | alc_sku_unsol_event(codec, res); | ||
10442 | } | ||
10443 | |||
10444 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | ||
10445 | { | 10483 | { |
10446 | struct alc_spec *spec = codec->spec; | 10484 | struct alc_spec *spec = codec->spec; |
10447 | 10485 | ||
10448 | spec->autocfg.hp_pins[0] = 0x15; | 10486 | spec->autocfg.hp_pins[0] = 0x15; |
10449 | spec->autocfg.speaker_pins[0] = 0x14; | 10487 | spec->autocfg.speaker_pins[0] = 0x14; |
10450 | alc_automute_pin(codec); | 10488 | spec->ext_mic.pin = 0x18; |
10451 | alc262_dmic_automute(codec); | 10489 | spec->ext_mic.mux_idx = 0; |
10490 | spec->int_mic.pin = 0x12; | ||
10491 | spec->int_mic.mux_idx = 9; | ||
10492 | spec->auto_mic = 1; | ||
10452 | } | 10493 | } |
10453 | 10494 | ||
10454 | /* | 10495 | /* |
@@ -10866,104 +10907,111 @@ static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |||
10866 | { } /* end */ | 10907 | { } /* end */ |
10867 | }; | 10908 | }; |
10868 | 10909 | ||
10910 | /* We use two mixers depending on the output pin; 0x16 is a mono output | ||
10911 | * and thus it's bound with a different mixer. | ||
10912 | * This function returns which mixer amp should be used. | ||
10913 | */ | ||
10914 | static int alc262_check_volbit(hda_nid_t nid) | ||
10915 | { | ||
10916 | if (!nid) | ||
10917 | return 0; | ||
10918 | else if (nid == 0x16) | ||
10919 | return 2; | ||
10920 | else | ||
10921 | return 1; | ||
10922 | } | ||
10923 | |||
10924 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
10925 | const char *pfx, int *vbits) | ||
10926 | { | ||
10927 | char name[32]; | ||
10928 | unsigned long val; | ||
10929 | int vbit; | ||
10930 | |||
10931 | vbit = alc262_check_volbit(nid); | ||
10932 | if (!vbit) | ||
10933 | return 0; | ||
10934 | if (*vbits & vbit) /* a volume control for this mixer already there */ | ||
10935 | return 0; | ||
10936 | *vbits |= vbit; | ||
10937 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | ||
10938 | if (vbit == 2) | ||
10939 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | ||
10940 | else | ||
10941 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | ||
10942 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, val); | ||
10943 | } | ||
10944 | |||
10945 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
10946 | const char *pfx) | ||
10947 | { | ||
10948 | char name[32]; | ||
10949 | unsigned long val; | ||
10950 | |||
10951 | if (!nid) | ||
10952 | return 0; | ||
10953 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | ||
10954 | if (nid == 0x16) | ||
10955 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | ||
10956 | else | ||
10957 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
10958 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val); | ||
10959 | } | ||
10960 | |||
10869 | /* add playback controls from the parsed DAC table */ | 10961 | /* add playback controls from the parsed DAC table */ |
10870 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | 10962 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
10871 | const struct auto_pin_cfg *cfg) | 10963 | const struct auto_pin_cfg *cfg) |
10872 | { | 10964 | { |
10873 | hda_nid_t nid; | 10965 | const char *pfx; |
10966 | int vbits; | ||
10874 | int err; | 10967 | int err; |
10875 | 10968 | ||
10876 | spec->multiout.num_dacs = 1; /* only use one dac */ | 10969 | spec->multiout.num_dacs = 1; /* only use one dac */ |
10877 | spec->multiout.dac_nids = spec->private_dac_nids; | 10970 | spec->multiout.dac_nids = spec->private_dac_nids; |
10878 | spec->multiout.dac_nids[0] = 2; | 10971 | spec->multiout.dac_nids[0] = 2; |
10879 | 10972 | ||
10880 | nid = cfg->line_out_pins[0]; | 10973 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
10881 | if (nid) { | 10974 | pfx = "Master"; |
10882 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | 10975 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
10883 | "Front Playback Volume", | 10976 | pfx = "Speaker"; |
10884 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); | 10977 | else |
10885 | if (err < 0) | 10978 | pfx = "Front"; |
10886 | return err; | 10979 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
10887 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 10980 | if (err < 0) |
10888 | "Front Playback Switch", | 10981 | return err; |
10889 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 10982 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
10890 | if (err < 0) | 10983 | if (err < 0) |
10891 | return err; | 10984 | return err; |
10892 | } | 10985 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
10893 | 10986 | if (err < 0) | |
10894 | nid = cfg->speaker_pins[0]; | 10987 | return err; |
10895 | if (nid) { | ||
10896 | if (nid == 0x16) { | ||
10897 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
10898 | "Speaker Playback Volume", | ||
10899 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | ||
10900 | HDA_OUTPUT)); | ||
10901 | if (err < 0) | ||
10902 | return err; | ||
10903 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10904 | "Speaker Playback Switch", | ||
10905 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
10906 | HDA_OUTPUT)); | ||
10907 | if (err < 0) | ||
10908 | return err; | ||
10909 | } else { | ||
10910 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10911 | "Speaker Playback Switch", | ||
10912 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
10913 | HDA_OUTPUT)); | ||
10914 | if (err < 0) | ||
10915 | return err; | ||
10916 | } | ||
10917 | } | ||
10918 | nid = cfg->hp_pins[0]; | ||
10919 | if (nid) { | ||
10920 | /* spec->multiout.hp_nid = 2; */ | ||
10921 | if (nid == 0x16) { | ||
10922 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
10923 | "Headphone Playback Volume", | ||
10924 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | ||
10925 | HDA_OUTPUT)); | ||
10926 | if (err < 0) | ||
10927 | return err; | ||
10928 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10929 | "Headphone Playback Switch", | ||
10930 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
10931 | HDA_OUTPUT)); | ||
10932 | if (err < 0) | ||
10933 | return err; | ||
10934 | } else { | ||
10935 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10936 | "Headphone Playback Switch", | ||
10937 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
10938 | HDA_OUTPUT)); | ||
10939 | if (err < 0) | ||
10940 | return err; | ||
10941 | } | ||
10942 | } | ||
10943 | return 0; | ||
10944 | } | ||
10945 | |||
10946 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, | ||
10947 | const struct auto_pin_cfg *cfg) | ||
10948 | { | ||
10949 | int err; | ||
10950 | 10988 | ||
10951 | err = alc880_auto_create_analog_input_ctls(spec, cfg); | 10989 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
10990 | alc262_check_volbit(cfg->speaker_pins[0]) | | ||
10991 | alc262_check_volbit(cfg->hp_pins[0]); | ||
10992 | if (vbits == 1 || vbits == 2) | ||
10993 | pfx = "Master"; /* only one mixer is used */ | ||
10994 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
10995 | pfx = "Speaker"; | ||
10996 | else | ||
10997 | pfx = "Front"; | ||
10998 | vbits = 0; | ||
10999 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | ||
11000 | if (err < 0) | ||
11001 | return err; | ||
11002 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | ||
11003 | &vbits); | ||
11004 | if (err < 0) | ||
11005 | return err; | ||
11006 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | ||
11007 | &vbits); | ||
10952 | if (err < 0) | 11008 | if (err < 0) |
10953 | return err; | 11009 | return err; |
10954 | /* digital-mic input pin is excluded in alc880_auto_create..() | ||
10955 | * because it's under 0x18 | ||
10956 | */ | ||
10957 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | ||
10958 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | ||
10959 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
10960 | imux->items[imux->num_items].label = "Int Mic"; | ||
10961 | imux->items[imux->num_items].index = 0x09; | ||
10962 | imux->num_items++; | ||
10963 | } | ||
10964 | return 0; | 11010 | return 0; |
10965 | } | 11011 | } |
10966 | 11012 | ||
11013 | #define alc262_auto_create_input_ctls \ | ||
11014 | alc880_auto_create_input_ctls | ||
10967 | 11015 | ||
10968 | /* | 11016 | /* |
10969 | * generic initialization of ADC, input mixers and output mixers | 11017 | * generic initialization of ADC, input mixers and output mixers |
@@ -11281,7 +11329,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
11281 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | 11329 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
11282 | if (err < 0) | 11330 | if (err < 0) |
11283 | return err; | 11331 | return err; |
11284 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); | 11332 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
11285 | if (err < 0) | 11333 | if (err < 0) |
11286 | return err; | 11334 | return err; |
11287 | 11335 | ||
@@ -11412,7 +11460,7 @@ static struct alc_config_preset alc262_presets[] = { | |||
11412 | }, | 11460 | }, |
11413 | [ALC262_HIPPO] = { | 11461 | [ALC262_HIPPO] = { |
11414 | .mixers = { alc262_hippo_mixer }, | 11462 | .mixers = { alc262_hippo_mixer }, |
11415 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | 11463 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
11416 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11417 | .dac_nids = alc262_dac_nids, | 11465 | .dac_nids = alc262_dac_nids, |
11418 | .hp_nid = 0x03, | 11466 | .hp_nid = 0x03, |
@@ -11421,7 +11469,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11421 | .channel_mode = alc262_modes, | 11469 | .channel_mode = alc262_modes, |
11422 | .input_mux = &alc262_capture_source, | 11470 | .input_mux = &alc262_capture_source, |
11423 | .unsol_event = alc262_hippo_unsol_event, | 11471 | .unsol_event = alc262_hippo_unsol_event, |
11424 | .init_hook = alc262_hippo_init_hook, | 11472 | .setup = alc262_hippo_setup, |
11473 | .init_hook = alc262_hippo_automute, | ||
11425 | }, | 11474 | }, |
11426 | [ALC262_HIPPO_1] = { | 11475 | [ALC262_HIPPO_1] = { |
11427 | .mixers = { alc262_hippo1_mixer }, | 11476 | .mixers = { alc262_hippo1_mixer }, |
@@ -11434,7 +11483,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11434 | .channel_mode = alc262_modes, | 11483 | .channel_mode = alc262_modes, |
11435 | .input_mux = &alc262_capture_source, | 11484 | .input_mux = &alc262_capture_source, |
11436 | .unsol_event = alc262_hippo_unsol_event, | 11485 | .unsol_event = alc262_hippo_unsol_event, |
11437 | .init_hook = alc262_hippo1_init_hook, | 11486 | .setup = alc262_hippo1_setup, |
11487 | .init_hook = alc262_hippo_automute, | ||
11438 | }, | 11488 | }, |
11439 | [ALC262_FUJITSU] = { | 11489 | [ALC262_FUJITSU] = { |
11440 | .mixers = { alc262_fujitsu_mixer }, | 11490 | .mixers = { alc262_fujitsu_mixer }, |
@@ -11497,7 +11547,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11497 | .channel_mode = alc262_modes, | 11547 | .channel_mode = alc262_modes, |
11498 | .input_mux = &alc262_capture_source, | 11548 | .input_mux = &alc262_capture_source, |
11499 | .unsol_event = alc_automute_amp_unsol_event, | 11549 | .unsol_event = alc_automute_amp_unsol_event, |
11500 | .init_hook = alc262_hp_t5735_init_hook, | 11550 | .setup = alc262_hp_t5735_setup, |
11551 | .init_hook = alc_automute_amp, | ||
11501 | }, | 11552 | }, |
11502 | [ALC262_HP_RP5700] = { | 11553 | [ALC262_HP_RP5700] = { |
11503 | .mixers = { alc262_hp_rp5700_mixer }, | 11554 | .mixers = { alc262_hp_rp5700_mixer }, |
@@ -11528,11 +11579,13 @@ static struct alc_config_preset alc262_presets[] = { | |||
11528 | .channel_mode = alc262_modes, | 11579 | .channel_mode = alc262_modes, |
11529 | .input_mux = &alc262_capture_source, | 11580 | .input_mux = &alc262_capture_source, |
11530 | .unsol_event = alc262_hippo_unsol_event, | 11581 | .unsol_event = alc262_hippo_unsol_event, |
11531 | .init_hook = alc262_hippo_init_hook, | 11582 | .setup = alc262_hippo_setup, |
11583 | .init_hook = alc262_hippo_automute, | ||
11532 | }, | 11584 | }, |
11533 | [ALC262_BENQ_T31] = { | 11585 | [ALC262_BENQ_T31] = { |
11534 | .mixers = { alc262_benq_t31_mixer }, | 11586 | .mixers = { alc262_benq_t31_mixer }, |
11535 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, | 11587 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
11588 | alc_hp15_unsol_verbs }, | ||
11536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11589 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11537 | .dac_nids = alc262_dac_nids, | 11590 | .dac_nids = alc262_dac_nids, |
11538 | .hp_nid = 0x03, | 11591 | .hp_nid = 0x03, |
@@ -11540,7 +11593,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11540 | .channel_mode = alc262_modes, | 11593 | .channel_mode = alc262_modes, |
11541 | .input_mux = &alc262_capture_source, | 11594 | .input_mux = &alc262_capture_source, |
11542 | .unsol_event = alc262_hippo_unsol_event, | 11595 | .unsol_event = alc262_hippo_unsol_event, |
11543 | .init_hook = alc262_hippo_init_hook, | 11596 | .setup = alc262_hippo_setup, |
11597 | .init_hook = alc262_hippo_automute, | ||
11544 | }, | 11598 | }, |
11545 | [ALC262_ULTRA] = { | 11599 | [ALC262_ULTRA] = { |
11546 | .mixers = { alc262_ultra_mixer }, | 11600 | .mixers = { alc262_ultra_mixer }, |
@@ -11592,9 +11646,9 @@ static struct alc_config_preset alc262_presets[] = { | |||
11592 | .dig_out_nid = ALC262_DIGOUT_NID, | 11646 | .dig_out_nid = ALC262_DIGOUT_NID, |
11593 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 11647 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
11594 | .channel_mode = alc262_modes, | 11648 | .channel_mode = alc262_modes, |
11595 | .input_mux = &alc262_dmic_capture_source, | 11649 | .unsol_event = alc_sku_unsol_event, |
11596 | .unsol_event = alc262_toshiba_s06_unsol_event, | 11650 | .setup = alc262_toshiba_s06_setup, |
11597 | .init_hook = alc262_toshiba_s06_init_hook, | 11651 | .init_hook = alc_inithook, |
11598 | }, | 11652 | }, |
11599 | [ALC262_TOSHIBA_RX1] = { | 11653 | [ALC262_TOSHIBA_RX1] = { |
11600 | .mixers = { alc262_toshiba_rx1_mixer }, | 11654 | .mixers = { alc262_toshiba_rx1_mixer }, |
@@ -11606,7 +11660,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11606 | .channel_mode = alc262_modes, | 11660 | .channel_mode = alc262_modes, |
11607 | .input_mux = &alc262_capture_source, | 11661 | .input_mux = &alc262_capture_source, |
11608 | .unsol_event = alc262_hippo_unsol_event, | 11662 | .unsol_event = alc262_hippo_unsol_event, |
11609 | .init_hook = alc262_hippo_init_hook, | 11663 | .setup = alc262_hippo_setup, |
11664 | .init_hook = alc262_hippo_automute, | ||
11610 | }, | 11665 | }, |
11611 | [ALC262_TYAN] = { | 11666 | [ALC262_TYAN] = { |
11612 | .mixers = { alc262_tyan_mixer }, | 11667 | .mixers = { alc262_tyan_mixer }, |
@@ -11619,7 +11674,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11619 | .channel_mode = alc262_modes, | 11674 | .channel_mode = alc262_modes, |
11620 | .input_mux = &alc262_capture_source, | 11675 | .input_mux = &alc262_capture_source, |
11621 | .unsol_event = alc_automute_amp_unsol_event, | 11676 | .unsol_event = alc_automute_amp_unsol_event, |
11622 | .init_hook = alc262_tyan_init_hook, | 11677 | .setup = alc262_tyan_setup, |
11678 | .init_hook = alc_automute_amp, | ||
11623 | }, | 11679 | }, |
11624 | }; | 11680 | }; |
11625 | 11681 | ||
@@ -11654,8 +11710,8 @@ static int patch_alc262(struct hda_codec *codec) | |||
11654 | alc262_cfg_tbl); | 11710 | alc262_cfg_tbl); |
11655 | 11711 | ||
11656 | if (board_config < 0) { | 11712 | if (board_config < 0) { |
11657 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 11713 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
11658 | "trying auto-probe from BIOS...\n", codec->chip_name); | 11714 | codec->chip_name); |
11659 | board_config = ALC262_AUTO; | 11715 | board_config = ALC262_AUTO; |
11660 | } | 11716 | } |
11661 | 11717 | ||
@@ -11682,7 +11738,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11682 | } | 11738 | } |
11683 | 11739 | ||
11684 | if (board_config != ALC262_AUTO) | 11740 | if (board_config != ALC262_AUTO) |
11685 | setup_preset(spec, &alc262_presets[board_config]); | 11741 | setup_preset(codec, &alc262_presets[board_config]); |
11686 | 11742 | ||
11687 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | 11743 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
11688 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | 11744 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
@@ -11708,7 +11764,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11708 | unsigned int wcap = get_wcaps(codec, 0x07); | 11764 | unsigned int wcap = get_wcaps(codec, 0x07); |
11709 | 11765 | ||
11710 | /* get type */ | 11766 | /* get type */ |
11711 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 11767 | wcap = get_wcaps_type(wcap); |
11712 | if (wcap != AC_WID_AUD_IN) { | 11768 | if (wcap != AC_WID_AUD_IN) { |
11713 | spec->adc_nids = alc262_adc_nids_alt; | 11769 | spec->adc_nids = alc262_adc_nids_alt; |
11714 | spec->num_adc_nids = | 11770 | spec->num_adc_nids = |
@@ -11723,7 +11779,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11723 | } | 11779 | } |
11724 | } | 11780 | } |
11725 | if (!spec->cap_mixer && !spec->no_analog) | 11781 | if (!spec->cap_mixer && !spec->no_analog) |
11726 | set_capture_mixer(spec); | 11782 | set_capture_mixer(codec); |
11727 | if (!spec->no_analog) | 11783 | if (!spec->no_analog) |
11728 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 11784 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
11729 | 11785 | ||
@@ -11815,14 +11871,6 @@ static struct hda_verb alc268_toshiba_verbs[] = { | |||
11815 | { } /* end */ | 11871 | { } /* end */ |
11816 | }; | 11872 | }; |
11817 | 11873 | ||
11818 | static struct hda_input_mux alc268_acer_lc_capture_source = { | ||
11819 | .num_items = 2, | ||
11820 | .items = { | ||
11821 | { "i-Mic", 0x6 }, | ||
11822 | { "E-Mic", 0x0 }, | ||
11823 | }, | ||
11824 | }; | ||
11825 | |||
11826 | /* Acer specific */ | 11874 | /* Acer specific */ |
11827 | /* bind volumes of both NID 0x02 and 0x03 */ | 11875 | /* bind volumes of both NID 0x02 and 0x03 */ |
11828 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | 11876 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
@@ -11941,7 +11989,8 @@ static struct hda_verb alc268_acer_verbs[] = { | |||
11941 | 11989 | ||
11942 | /* unsolicited event for HP jack sensing */ | 11990 | /* unsolicited event for HP jack sensing */ |
11943 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | 11991 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
11944 | #define alc268_toshiba_init_hook alc262_hippo_init_hook | 11992 | #define alc268_toshiba_setup alc262_hippo_setup |
11993 | #define alc268_toshiba_automute alc262_hippo_automute | ||
11945 | 11994 | ||
11946 | static void alc268_acer_unsol_event(struct hda_codec *codec, | 11995 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
11947 | unsigned int res) | 11996 | unsigned int res) |
@@ -11971,30 +12020,33 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |||
11971 | AMP_IN_MUTE(0), bits); | 12020 | AMP_IN_MUTE(0), bits); |
11972 | } | 12021 | } |
11973 | 12022 | ||
11974 | |||
11975 | static void alc268_acer_mic_automute(struct hda_codec *codec) | ||
11976 | { | ||
11977 | unsigned int present; | ||
11978 | |||
11979 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
11980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
11981 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | ||
11982 | present ? 0x0 : 0x6); | ||
11983 | } | ||
11984 | |||
11985 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | 12023 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
11986 | unsigned int res) | 12024 | unsigned int res) |
11987 | { | 12025 | { |
11988 | if ((res >> 26) == ALC880_HP_EVENT) | 12026 | switch (res >> 26) { |
12027 | case ALC880_HP_EVENT: | ||
11989 | alc268_aspire_one_speaker_automute(codec); | 12028 | alc268_aspire_one_speaker_automute(codec); |
11990 | if ((res >> 26) == ALC880_MIC_EVENT) | 12029 | break; |
11991 | alc268_acer_mic_automute(codec); | 12030 | case ALC880_MIC_EVENT: |
12031 | alc_mic_automute(codec); | ||
12032 | break; | ||
12033 | } | ||
12034 | } | ||
12035 | |||
12036 | static void alc268_acer_lc_setup(struct hda_codec *codec) | ||
12037 | { | ||
12038 | struct alc_spec *spec = codec->spec; | ||
12039 | spec->ext_mic.pin = 0x18; | ||
12040 | spec->ext_mic.mux_idx = 0; | ||
12041 | spec->int_mic.pin = 0x12; | ||
12042 | spec->int_mic.mux_idx = 6; | ||
12043 | spec->auto_mic = 1; | ||
11992 | } | 12044 | } |
11993 | 12045 | ||
11994 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | 12046 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
11995 | { | 12047 | { |
11996 | alc268_aspire_one_speaker_automute(codec); | 12048 | alc268_aspire_one_speaker_automute(codec); |
11997 | alc268_acer_mic_automute(codec); | 12049 | alc_mic_automute(codec); |
11998 | } | 12050 | } |
11999 | 12051 | ||
12000 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | 12052 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
@@ -12012,17 +12064,22 @@ static struct hda_verb alc268_dell_verbs[] = { | |||
12012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 12064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
12013 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 12065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
12014 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 12066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
12015 | { } | 12068 | { } |
12016 | }; | 12069 | }; |
12017 | 12070 | ||
12018 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 12071 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
12019 | static void alc268_dell_init_hook(struct hda_codec *codec) | 12072 | static void alc268_dell_setup(struct hda_codec *codec) |
12020 | { | 12073 | { |
12021 | struct alc_spec *spec = codec->spec; | 12074 | struct alc_spec *spec = codec->spec; |
12022 | 12075 | ||
12023 | spec->autocfg.hp_pins[0] = 0x15; | 12076 | spec->autocfg.hp_pins[0] = 0x15; |
12024 | spec->autocfg.speaker_pins[0] = 0x14; | 12077 | spec->autocfg.speaker_pins[0] = 0x14; |
12025 | alc_automute_pin(codec); | 12078 | spec->ext_mic.pin = 0x18; |
12079 | spec->ext_mic.mux_idx = 0; | ||
12080 | spec->int_mic.pin = 0x19; | ||
12081 | spec->int_mic.mux_idx = 1; | ||
12082 | spec->auto_mic = 1; | ||
12026 | } | 12083 | } |
12027 | 12084 | ||
12028 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | 12085 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
@@ -12043,38 +12100,16 @@ static struct hda_verb alc267_quanta_il1_verbs[] = { | |||
12043 | { } | 12100 | { } |
12044 | }; | 12101 | }; |
12045 | 12102 | ||
12046 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | 12103 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
12047 | { | ||
12048 | unsigned int present; | ||
12049 | |||
12050 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
12051 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
12052 | snd_hda_codec_write(codec, 0x23, 0, | ||
12053 | AC_VERB_SET_CONNECT_SEL, | ||
12054 | present ? 0x00 : 0x01); | ||
12055 | } | ||
12056 | |||
12057 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) | ||
12058 | { | 12104 | { |
12059 | struct alc_spec *spec = codec->spec; | 12105 | struct alc_spec *spec = codec->spec; |
12060 | |||
12061 | spec->autocfg.hp_pins[0] = 0x15; | 12106 | spec->autocfg.hp_pins[0] = 0x15; |
12062 | spec->autocfg.speaker_pins[0] = 0x14; | 12107 | spec->autocfg.speaker_pins[0] = 0x14; |
12063 | alc_automute_pin(codec); | 12108 | spec->ext_mic.pin = 0x18; |
12064 | alc267_quanta_il1_mic_automute(codec); | 12109 | spec->ext_mic.mux_idx = 0; |
12065 | } | 12110 | spec->int_mic.pin = 0x19; |
12066 | 12111 | spec->int_mic.mux_idx = 1; | |
12067 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | 12112 | spec->auto_mic = 1; |
12068 | unsigned int res) | ||
12069 | { | ||
12070 | switch (res >> 26) { | ||
12071 | case ALC880_MIC_EVENT: | ||
12072 | alc267_quanta_il1_mic_automute(codec); | ||
12073 | break; | ||
12074 | default: | ||
12075 | alc_sku_unsol_event(codec, res); | ||
12076 | break; | ||
12077 | } | ||
12078 | } | 12113 | } |
12079 | 12114 | ||
12080 | /* | 12115 | /* |
@@ -12154,21 +12189,16 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
12154 | { } | 12189 | { } |
12155 | }; | 12190 | }; |
12156 | 12191 | ||
12192 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | ||
12193 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
12194 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
12195 | { } /* end */ | ||
12196 | }; | ||
12197 | |||
12157 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | 12198 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
12158 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | 12199 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
12159 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12200 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12160 | { | 12201 | _DEFINE_CAPSRC(1), |
12161 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12162 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12163 | * So call somewhat different.. | ||
12164 | */ | ||
12165 | /* .name = "Capture Source", */ | ||
12166 | .name = "Input Source", | ||
12167 | .count = 1, | ||
12168 | .info = alc_mux_enum_info, | ||
12169 | .get = alc_mux_enum_get, | ||
12170 | .put = alc_mux_enum_put, | ||
12171 | }, | ||
12172 | { } /* end */ | 12202 | { } /* end */ |
12173 | }; | 12203 | }; |
12174 | 12204 | ||
@@ -12177,18 +12207,7 @@ static struct snd_kcontrol_new alc268_capture_mixer[] = { | |||
12177 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12207 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12178 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | 12208 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
12179 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | 12209 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
12180 | { | 12210 | _DEFINE_CAPSRC(2), |
12181 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12182 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12183 | * So call somewhat different.. | ||
12184 | */ | ||
12185 | /* .name = "Capture Source", */ | ||
12186 | .name = "Input Source", | ||
12187 | .count = 2, | ||
12188 | .info = alc_mux_enum_info, | ||
12189 | .get = alc_mux_enum_get, | ||
12190 | .put = alc_mux_enum_put, | ||
12191 | }, | ||
12192 | { } /* end */ | 12211 | { } /* end */ |
12193 | }; | 12212 | }; |
12194 | 12213 | ||
@@ -12275,26 +12294,38 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
12275 | const char *ctlname, int idx) | 12294 | const char *ctlname, int idx) |
12276 | { | 12295 | { |
12277 | char name[32]; | 12296 | char name[32]; |
12297 | hda_nid_t dac; | ||
12278 | int err; | 12298 | int err; |
12279 | 12299 | ||
12280 | sprintf(name, "%s Playback Volume", ctlname); | 12300 | sprintf(name, "%s Playback Volume", ctlname); |
12281 | if (nid == 0x14) { | 12301 | switch (nid) { |
12282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 12302 | case 0x14: |
12283 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | 12303 | case 0x16: |
12284 | HDA_OUTPUT)); | 12304 | dac = 0x02; |
12285 | if (err < 0) | 12305 | break; |
12286 | return err; | 12306 | case 0x15: |
12287 | } else if (nid == 0x15) { | 12307 | dac = 0x03; |
12308 | break; | ||
12309 | default: | ||
12310 | return 0; | ||
12311 | } | ||
12312 | if (spec->multiout.dac_nids[0] != dac && | ||
12313 | spec->multiout.dac_nids[1] != dac) { | ||
12288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 12314 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
12289 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | 12315 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
12290 | HDA_OUTPUT)); | 12316 | HDA_OUTPUT)); |
12291 | if (err < 0) | 12317 | if (err < 0) |
12292 | return err; | 12318 | return err; |
12293 | } else | 12319 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
12294 | return -1; | 12320 | } |
12321 | |||
12295 | sprintf(name, "%s Playback Switch", ctlname); | 12322 | sprintf(name, "%s Playback Switch", ctlname); |
12296 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 12323 | if (nid != 0x16) |
12324 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
12297 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | 12325 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
12326 | else /* mono */ | ||
12327 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
12328 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | ||
12298 | if (err < 0) | 12329 | if (err < 0) |
12299 | return err; | 12330 | return err; |
12300 | return 0; | 12331 | return 0; |
@@ -12307,14 +12338,19 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12307 | hda_nid_t nid; | 12338 | hda_nid_t nid; |
12308 | int err; | 12339 | int err; |
12309 | 12340 | ||
12310 | spec->multiout.num_dacs = 2; /* only use one dac */ | ||
12311 | spec->multiout.dac_nids = spec->private_dac_nids; | 12341 | spec->multiout.dac_nids = spec->private_dac_nids; |
12312 | spec->multiout.dac_nids[0] = 2; | ||
12313 | spec->multiout.dac_nids[1] = 3; | ||
12314 | 12342 | ||
12315 | nid = cfg->line_out_pins[0]; | 12343 | nid = cfg->line_out_pins[0]; |
12316 | if (nid) | 12344 | if (nid) { |
12317 | alc268_new_analog_output(spec, nid, "Front", 0); | 12345 | const char *name; |
12346 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
12347 | name = "Speaker"; | ||
12348 | else | ||
12349 | name = "Front"; | ||
12350 | err = alc268_new_analog_output(spec, nid, name, 0); | ||
12351 | if (err < 0) | ||
12352 | return err; | ||
12353 | } | ||
12318 | 12354 | ||
12319 | nid = cfg->speaker_pins[0]; | 12355 | nid = cfg->speaker_pins[0]; |
12320 | if (nid == 0x1d) { | 12356 | if (nid == 0x1d) { |
@@ -12323,16 +12359,23 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12323 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | 12359 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
12324 | if (err < 0) | 12360 | if (err < 0) |
12325 | return err; | 12361 | return err; |
12362 | } else { | ||
12363 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | ||
12364 | if (err < 0) | ||
12365 | return err; | ||
12326 | } | 12366 | } |
12327 | nid = cfg->hp_pins[0]; | 12367 | nid = cfg->hp_pins[0]; |
12328 | if (nid) | 12368 | if (nid) { |
12329 | alc268_new_analog_output(spec, nid, "Headphone", 0); | 12369 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
12370 | if (err < 0) | ||
12371 | return err; | ||
12372 | } | ||
12330 | 12373 | ||
12331 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | 12374 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
12332 | if (nid == 0x16) { | 12375 | if (nid == 0x16) { |
12333 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 12376 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
12334 | "Mono Playback Switch", | 12377 | "Mono Playback Switch", |
12335 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | 12378 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
12336 | if (err < 0) | 12379 | if (err < 0) |
12337 | return err; | 12380 | return err; |
12338 | } | 12381 | } |
@@ -12340,38 +12383,46 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12340 | } | 12383 | } |
12341 | 12384 | ||
12342 | /* create playback/capture controls for input pins */ | 12385 | /* create playback/capture controls for input pins */ |
12343 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | 12386 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
12344 | const struct auto_pin_cfg *cfg) | 12387 | const struct auto_pin_cfg *cfg) |
12345 | { | 12388 | { |
12346 | struct hda_input_mux *imux = &spec->private_imux[0]; | 12389 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
12347 | int i, idx1; | 12390 | } |
12348 | 12391 | ||
12349 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 12392 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
12350 | switch(cfg->input_pins[i]) { | 12393 | hda_nid_t nid, int pin_type) |
12351 | case 0x18: | 12394 | { |
12352 | idx1 = 0; /* Mic 1 */ | 12395 | int idx; |
12353 | break; | 12396 | |
12354 | case 0x19: | 12397 | alc_set_pin_output(codec, nid, pin_type); |
12355 | idx1 = 1; /* Mic 2 */ | 12398 | if (nid == 0x14 || nid == 0x16) |
12356 | break; | 12399 | idx = 0; |
12357 | case 0x1a: | 12400 | else |
12358 | idx1 = 2; /* Line In */ | 12401 | idx = 1; |
12359 | break; | 12402 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
12360 | case 0x1c: | 12403 | } |
12361 | idx1 = 3; /* CD */ | 12404 | |
12362 | break; | 12405 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
12363 | case 0x12: | 12406 | { |
12364 | case 0x13: | 12407 | struct alc_spec *spec = codec->spec; |
12365 | idx1 = 6; /* digital mics */ | 12408 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
12366 | break; | 12409 | if (nid) { |
12367 | default: | 12410 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
12368 | continue; | 12411 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
12369 | } | ||
12370 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | ||
12371 | imux->items[imux->num_items].index = idx1; | ||
12372 | imux->num_items++; | ||
12373 | } | 12412 | } |
12374 | return 0; | 12413 | } |
12414 | |||
12415 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | ||
12416 | { | ||
12417 | struct alc_spec *spec = codec->spec; | ||
12418 | hda_nid_t pin; | ||
12419 | |||
12420 | pin = spec->autocfg.hp_pins[0]; | ||
12421 | if (pin) | ||
12422 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | ||
12423 | pin = spec->autocfg.speaker_pins[0]; | ||
12424 | if (pin) | ||
12425 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | ||
12375 | } | 12426 | } |
12376 | 12427 | ||
12377 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | 12428 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
@@ -12382,9 +12433,10 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
12382 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | 12433 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
12383 | unsigned int dac_vol1, dac_vol2; | 12434 | unsigned int dac_vol1, dac_vol2; |
12384 | 12435 | ||
12385 | if (speaker_nid) { | 12436 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
12386 | snd_hda_codec_write(codec, speaker_nid, 0, | 12437 | snd_hda_codec_write(codec, speaker_nid, 0, |
12387 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | 12438 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
12439 | /* mute mixer inputs from 0x1d */ | ||
12388 | snd_hda_codec_write(codec, 0x0f, 0, | 12440 | snd_hda_codec_write(codec, 0x0f, 0, |
12389 | AC_VERB_SET_AMP_GAIN_MUTE, | 12441 | AC_VERB_SET_AMP_GAIN_MUTE, |
12390 | AMP_IN_UNMUTE(1)); | 12442 | AMP_IN_UNMUTE(1)); |
@@ -12392,6 +12444,7 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
12392 | AC_VERB_SET_AMP_GAIN_MUTE, | 12444 | AC_VERB_SET_AMP_GAIN_MUTE, |
12393 | AMP_IN_UNMUTE(1)); | 12445 | AMP_IN_UNMUTE(1)); |
12394 | } else { | 12446 | } else { |
12447 | /* unmute mixer inputs from 0x1d */ | ||
12395 | snd_hda_codec_write(codec, 0x0f, 0, | 12448 | snd_hda_codec_write(codec, 0x0f, 0, |
12396 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | 12449 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
12397 | snd_hda_codec_write(codec, 0x10, 0, | 12450 | snd_hda_codec_write(codec, 0x10, 0, |
@@ -12448,7 +12501,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12448 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | 12501 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
12449 | if (err < 0) | 12502 | if (err < 0) |
12450 | return err; | 12503 | return err; |
12451 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); | 12504 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
12452 | if (err < 0) | 12505 | if (err < 0) |
12453 | return err; | 12506 | return err; |
12454 | 12507 | ||
@@ -12467,7 +12520,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12467 | add_mixer(spec, alc268_beep_mixer); | 12520 | add_mixer(spec, alc268_beep_mixer); |
12468 | 12521 | ||
12469 | add_verb(spec, alc268_volume_init_verbs); | 12522 | add_verb(spec, alc268_volume_init_verbs); |
12470 | spec->num_mux_defs = 1; | 12523 | spec->num_mux_defs = 2; |
12471 | spec->input_mux = &spec->private_imux[0]; | 12524 | spec->input_mux = &spec->private_imux[0]; |
12472 | 12525 | ||
12473 | err = alc_auto_add_mic_boost(codec); | 12526 | err = alc_auto_add_mic_boost(codec); |
@@ -12479,8 +12532,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12479 | return 1; | 12532 | return 1; |
12480 | } | 12533 | } |
12481 | 12534 | ||
12482 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out | ||
12483 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out | ||
12484 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | 12535 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
12485 | 12536 | ||
12486 | /* init callback for auto-configuration model -- overriding the default init */ | 12537 | /* init callback for auto-configuration model -- overriding the default init */ |
@@ -12523,8 +12574,11 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
12523 | ALC268_ACER_ASPIRE_ONE), | 12574 | ALC268_ACER_ASPIRE_ONE), |
12524 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | 12575 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
12525 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), | 12576 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
12577 | /* almost compatible with toshiba but with optional digital outs; | ||
12578 | * auto-probing seems working fine | ||
12579 | */ | ||
12526 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | 12580 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
12527 | ALC268_TOSHIBA), | 12581 | ALC268_AUTO), |
12528 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 12582 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
12529 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | 12583 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
12530 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | 12584 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
@@ -12545,7 +12599,8 @@ static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |||
12545 | 12599 | ||
12546 | static struct alc_config_preset alc268_presets[] = { | 12600 | static struct alc_config_preset alc268_presets[] = { |
12547 | [ALC267_QUANTA_IL1] = { | 12601 | [ALC267_QUANTA_IL1] = { |
12548 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, | 12602 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
12603 | alc268_capture_nosrc_mixer }, | ||
12549 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12604 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12550 | alc267_quanta_il1_verbs }, | 12605 | alc267_quanta_il1_verbs }, |
12551 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12606 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12555,9 +12610,9 @@ static struct alc_config_preset alc268_presets[] = { | |||
12555 | .hp_nid = 0x03, | 12610 | .hp_nid = 0x03, |
12556 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12611 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12557 | .channel_mode = alc268_modes, | 12612 | .channel_mode = alc268_modes, |
12558 | .input_mux = &alc268_capture_source, | 12613 | .unsol_event = alc_sku_unsol_event, |
12559 | .unsol_event = alc267_quanta_il1_unsol_event, | 12614 | .setup = alc267_quanta_il1_setup, |
12560 | .init_hook = alc267_quanta_il1_init_hook, | 12615 | .init_hook = alc_inithook, |
12561 | }, | 12616 | }, |
12562 | [ALC268_3ST] = { | 12617 | [ALC268_3ST] = { |
12563 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12618 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12589,10 +12644,11 @@ static struct alc_config_preset alc268_presets[] = { | |||
12589 | .channel_mode = alc268_modes, | 12644 | .channel_mode = alc268_modes, |
12590 | .input_mux = &alc268_capture_source, | 12645 | .input_mux = &alc268_capture_source, |
12591 | .unsol_event = alc268_toshiba_unsol_event, | 12646 | .unsol_event = alc268_toshiba_unsol_event, |
12592 | .init_hook = alc268_toshiba_init_hook, | 12647 | .setup = alc268_toshiba_setup, |
12648 | .init_hook = alc268_toshiba_automute, | ||
12593 | }, | 12649 | }, |
12594 | [ALC268_ACER] = { | 12650 | [ALC268_ACER] = { |
12595 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | 12651 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
12596 | alc268_beep_mixer }, | 12652 | alc268_beep_mixer }, |
12597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12653 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12598 | alc268_acer_verbs }, | 12654 | alc268_acer_verbs }, |
@@ -12628,7 +12684,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
12628 | [ALC268_ACER_ASPIRE_ONE] = { | 12684 | [ALC268_ACER_ASPIRE_ONE] = { |
12629 | .mixers = { alc268_acer_aspire_one_mixer, | 12685 | .mixers = { alc268_acer_aspire_one_mixer, |
12630 | alc268_beep_mixer, | 12686 | alc268_beep_mixer, |
12631 | alc268_capture_alt_mixer }, | 12687 | alc268_capture_nosrc_mixer }, |
12632 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12688 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12633 | alc268_acer_aspire_one_verbs }, | 12689 | alc268_acer_aspire_one_verbs }, |
12634 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12690 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12639,22 +12695,26 @@ static struct alc_config_preset alc268_presets[] = { | |||
12639 | .hp_nid = 0x03, | 12695 | .hp_nid = 0x03, |
12640 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12696 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12641 | .channel_mode = alc268_modes, | 12697 | .channel_mode = alc268_modes, |
12642 | .input_mux = &alc268_acer_lc_capture_source, | ||
12643 | .unsol_event = alc268_acer_lc_unsol_event, | 12698 | .unsol_event = alc268_acer_lc_unsol_event, |
12699 | .setup = alc268_acer_lc_setup, | ||
12644 | .init_hook = alc268_acer_lc_init_hook, | 12700 | .init_hook = alc268_acer_lc_init_hook, |
12645 | }, | 12701 | }, |
12646 | [ALC268_DELL] = { | 12702 | [ALC268_DELL] = { |
12647 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, | 12703 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
12704 | alc268_capture_nosrc_mixer }, | ||
12648 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12705 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12649 | alc268_dell_verbs }, | 12706 | alc268_dell_verbs }, |
12650 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12707 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
12651 | .dac_nids = alc268_dac_nids, | 12708 | .dac_nids = alc268_dac_nids, |
12709 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
12710 | .adc_nids = alc268_adc_nids_alt, | ||
12711 | .capsrc_nids = alc268_capsrc_nids, | ||
12652 | .hp_nid = 0x02, | 12712 | .hp_nid = 0x02, |
12653 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12713 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12654 | .channel_mode = alc268_modes, | 12714 | .channel_mode = alc268_modes, |
12655 | .unsol_event = alc_sku_unsol_event, | 12715 | .unsol_event = alc_sku_unsol_event, |
12656 | .init_hook = alc268_dell_init_hook, | 12716 | .setup = alc268_dell_setup, |
12657 | .input_mux = &alc268_capture_source, | 12717 | .init_hook = alc_inithook, |
12658 | }, | 12718 | }, |
12659 | [ALC268_ZEPTO] = { | 12719 | [ALC268_ZEPTO] = { |
12660 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12720 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12671,8 +12731,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12671 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12731 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12672 | .channel_mode = alc268_modes, | 12732 | .channel_mode = alc268_modes, |
12673 | .input_mux = &alc268_capture_source, | 12733 | .input_mux = &alc268_capture_source, |
12674 | .unsol_event = alc268_toshiba_unsol_event, | 12734 | .setup = alc268_toshiba_setup, |
12675 | .init_hook = alc268_toshiba_init_hook | 12735 | .init_hook = alc268_toshiba_automute, |
12676 | }, | 12736 | }, |
12677 | #ifdef CONFIG_SND_DEBUG | 12737 | #ifdef CONFIG_SND_DEBUG |
12678 | [ALC268_TEST] = { | 12738 | [ALC268_TEST] = { |
@@ -12714,8 +12774,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
12714 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | 12774 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
12715 | 12775 | ||
12716 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | 12776 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
12717 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 12777 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
12718 | "trying auto-probe from BIOS...\n", codec->chip_name); | 12778 | codec->chip_name); |
12719 | board_config = ALC268_AUTO; | 12779 | board_config = ALC268_AUTO; |
12720 | } | 12780 | } |
12721 | 12781 | ||
@@ -12734,7 +12794,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
12734 | } | 12794 | } |
12735 | 12795 | ||
12736 | if (board_config != ALC268_AUTO) | 12796 | if (board_config != ALC268_AUTO) |
12737 | setup_preset(spec, &alc268_presets[board_config]); | 12797 | setup_preset(codec, &alc268_presets[board_config]); |
12738 | 12798 | ||
12739 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | 12799 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
12740 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | 12800 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
@@ -12771,11 +12831,15 @@ static int patch_alc268(struct hda_codec *codec) | |||
12771 | int i; | 12831 | int i; |
12772 | 12832 | ||
12773 | /* get type */ | 12833 | /* get type */ |
12774 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 12834 | wcap = get_wcaps_type(wcap); |
12775 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 12835 | if (spec->auto_mic || |
12836 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | ||
12776 | spec->adc_nids = alc268_adc_nids_alt; | 12837 | spec->adc_nids = alc268_adc_nids_alt; |
12777 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 12838 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
12778 | add_mixer(spec, alc268_capture_alt_mixer); | 12839 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
12840 | add_mixer(spec, alc268_capture_nosrc_mixer); | ||
12841 | else | ||
12842 | add_mixer(spec, alc268_capture_alt_mixer); | ||
12779 | } else { | 12843 | } else { |
12780 | spec->adc_nids = alc268_adc_nids; | 12844 | spec->adc_nids = alc268_adc_nids; |
12781 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 12845 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
@@ -12786,6 +12850,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
12786 | for (i = 0; i < spec->num_adc_nids; i++) | 12850 | for (i = 0; i < spec->num_adc_nids; i++) |
12787 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | 12851 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
12788 | 0, AC_VERB_SET_CONNECT_SEL, | 12852 | 0, AC_VERB_SET_CONNECT_SEL, |
12853 | i < spec->num_mux_defs ? | ||
12854 | spec->input_mux[i].items[0].index : | ||
12789 | spec->input_mux->items[0].index); | 12855 | spec->input_mux->items[0].index); |
12790 | } | 12856 | } |
12791 | 12857 | ||
@@ -12820,22 +12886,6 @@ static hda_nid_t alc269_capsrc_nids[1] = { | |||
12820 | * not a mux! | 12886 | * not a mux! |
12821 | */ | 12887 | */ |
12822 | 12888 | ||
12823 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { | ||
12824 | .num_items = 2, | ||
12825 | .items = { | ||
12826 | { "i-Mic", 0x5 }, | ||
12827 | { "e-Mic", 0x0 }, | ||
12828 | }, | ||
12829 | }; | ||
12830 | |||
12831 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { | ||
12832 | .num_items = 2, | ||
12833 | .items = { | ||
12834 | { "i-Mic", 0x1 }, | ||
12835 | { "e-Mic", 0x0 }, | ||
12836 | }, | ||
12837 | }; | ||
12838 | |||
12839 | #define alc269_modes alc260_modes | 12889 | #define alc269_modes alc260_modes |
12840 | #define alc269_capture_source alc880_lg_lw_capture_source | 12890 | #define alc269_capture_source alc880_lg_lw_capture_source |
12841 | 12891 | ||
@@ -12997,16 +13047,6 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |||
12997 | AC_VERB_SET_PROC_COEF, 0x480); | 13047 | AC_VERB_SET_PROC_COEF, 0x480); |
12998 | } | 13048 | } |
12999 | 13049 | ||
13000 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) | ||
13001 | { | ||
13002 | unsigned int present; | ||
13003 | |||
13004 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13006 | snd_hda_codec_write(codec, 0x23, 0, | ||
13007 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); | ||
13008 | } | ||
13009 | |||
13010 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | 13050 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
13011 | { | 13051 | { |
13012 | unsigned int present_laptop; | 13052 | unsigned int present_laptop; |
@@ -13033,10 +13073,14 @@ static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |||
13033 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | 13073 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
13034 | unsigned int res) | 13074 | unsigned int res) |
13035 | { | 13075 | { |
13036 | if ((res >> 26) == ALC880_HP_EVENT) | 13076 | switch (res >> 26) { |
13077 | case ALC880_HP_EVENT: | ||
13037 | alc269_quanta_fl1_speaker_automute(codec); | 13078 | alc269_quanta_fl1_speaker_automute(codec); |
13038 | if ((res >> 26) == ALC880_MIC_EVENT) | 13079 | break; |
13039 | alc269_quanta_fl1_mic_automute(codec); | 13080 | case ALC880_MIC_EVENT: |
13081 | alc_mic_automute(codec); | ||
13082 | break; | ||
13083 | } | ||
13040 | } | 13084 | } |
13041 | 13085 | ||
13042 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | 13086 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
@@ -13048,10 +13092,20 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
13048 | alc269_lifebook_mic_autoswitch(codec); | 13092 | alc269_lifebook_mic_autoswitch(codec); |
13049 | } | 13093 | } |
13050 | 13094 | ||
13095 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | ||
13096 | { | ||
13097 | struct alc_spec *spec = codec->spec; | ||
13098 | spec->ext_mic.pin = 0x18; | ||
13099 | spec->ext_mic.mux_idx = 0; | ||
13100 | spec->int_mic.pin = 0x19; | ||
13101 | spec->int_mic.mux_idx = 1; | ||
13102 | spec->auto_mic = 1; | ||
13103 | } | ||
13104 | |||
13051 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | 13105 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
13052 | { | 13106 | { |
13053 | alc269_quanta_fl1_speaker_automute(codec); | 13107 | alc269_quanta_fl1_speaker_automute(codec); |
13054 | alc269_quanta_fl1_mic_automute(codec); | 13108 | alc_mic_automute(codec); |
13055 | } | 13109 | } |
13056 | 13110 | ||
13057 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | 13111 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
@@ -13096,60 +13150,44 @@ static void alc269_speaker_automute(struct hda_codec *codec) | |||
13096 | AMP_IN_MUTE(0), bits); | 13150 | AMP_IN_MUTE(0), bits); |
13097 | } | 13151 | } |
13098 | 13152 | ||
13099 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | ||
13100 | { | ||
13101 | unsigned int present; | ||
13102 | |||
13103 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13104 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13105 | snd_hda_codec_write(codec, 0x23, 0, | ||
13106 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); | ||
13107 | } | ||
13108 | |||
13109 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | ||
13110 | { | ||
13111 | unsigned int present; | ||
13112 | |||
13113 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13114 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13115 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13116 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
13117 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13118 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
13119 | } | ||
13120 | |||
13121 | /* unsolicited event for HP jack sensing */ | 13153 | /* unsolicited event for HP jack sensing */ |
13122 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | 13154 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
13123 | unsigned int res) | 13155 | unsigned int res) |
13124 | { | 13156 | { |
13125 | if ((res >> 26) == ALC880_HP_EVENT) | 13157 | switch (res >> 26) { |
13158 | case ALC880_HP_EVENT: | ||
13126 | alc269_speaker_automute(codec); | 13159 | alc269_speaker_automute(codec); |
13127 | 13160 | break; | |
13128 | if ((res >> 26) == ALC880_MIC_EVENT) | 13161 | case ALC880_MIC_EVENT: |
13129 | alc269_eeepc_dmic_automute(codec); | 13162 | alc_mic_automute(codec); |
13163 | break; | ||
13164 | } | ||
13130 | } | 13165 | } |
13131 | 13166 | ||
13132 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | 13167 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
13133 | { | 13168 | { |
13134 | alc269_speaker_automute(codec); | 13169 | struct alc_spec *spec = codec->spec; |
13135 | alc269_eeepc_dmic_automute(codec); | 13170 | spec->ext_mic.pin = 0x18; |
13171 | spec->ext_mic.mux_idx = 0; | ||
13172 | spec->int_mic.pin = 0x12; | ||
13173 | spec->int_mic.mux_idx = 5; | ||
13174 | spec->auto_mic = 1; | ||
13136 | } | 13175 | } |
13137 | 13176 | ||
13138 | /* unsolicited event for HP jack sensing */ | 13177 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
13139 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | ||
13140 | unsigned int res) | ||
13141 | { | 13178 | { |
13142 | if ((res >> 26) == ALC880_HP_EVENT) | 13179 | struct alc_spec *spec = codec->spec; |
13143 | alc269_speaker_automute(codec); | 13180 | spec->ext_mic.pin = 0x18; |
13144 | 13181 | spec->ext_mic.mux_idx = 0; | |
13145 | if ((res >> 26) == ALC880_MIC_EVENT) | 13182 | spec->int_mic.pin = 0x19; |
13146 | alc269_eeepc_amic_automute(codec); | 13183 | spec->int_mic.mux_idx = 1; |
13184 | spec->auto_mic = 1; | ||
13147 | } | 13185 | } |
13148 | 13186 | ||
13149 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | 13187 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
13150 | { | 13188 | { |
13151 | alc269_speaker_automute(codec); | 13189 | alc269_speaker_automute(codec); |
13152 | alc269_eeepc_amic_automute(codec); | 13190 | alc_mic_automute(codec); |
13153 | } | 13191 | } |
13154 | 13192 | ||
13155 | /* | 13193 | /* |
@@ -13222,89 +13260,10 @@ static struct hda_verb alc269_init_verbs[] = { | |||
13222 | { } | 13260 | { } |
13223 | }; | 13261 | }; |
13224 | 13262 | ||
13225 | /* add playback controls from the parsed DAC table */ | 13263 | #define alc269_auto_create_multi_out_ctls \ |
13226 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | 13264 | alc268_auto_create_multi_out_ctls |
13227 | const struct auto_pin_cfg *cfg) | 13265 | #define alc269_auto_create_input_ctls \ |
13228 | { | 13266 | alc268_auto_create_input_ctls |
13229 | hda_nid_t nid; | ||
13230 | int err; | ||
13231 | |||
13232 | spec->multiout.num_dacs = 1; /* only use one dac */ | ||
13233 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
13234 | spec->multiout.dac_nids[0] = 2; | ||
13235 | |||
13236 | nid = cfg->line_out_pins[0]; | ||
13237 | if (nid) { | ||
13238 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13239 | "Front Playback Volume", | ||
13240 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); | ||
13241 | if (err < 0) | ||
13242 | return err; | ||
13243 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13244 | "Front Playback Switch", | ||
13245 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
13246 | if (err < 0) | ||
13247 | return err; | ||
13248 | } | ||
13249 | |||
13250 | nid = cfg->speaker_pins[0]; | ||
13251 | if (nid) { | ||
13252 | if (!cfg->line_out_pins[0]) { | ||
13253 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13254 | "Speaker Playback Volume", | ||
13255 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | ||
13256 | HDA_OUTPUT)); | ||
13257 | if (err < 0) | ||
13258 | return err; | ||
13259 | } | ||
13260 | if (nid == 0x16) { | ||
13261 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13262 | "Speaker Playback Switch", | ||
13263 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
13264 | HDA_OUTPUT)); | ||
13265 | if (err < 0) | ||
13266 | return err; | ||
13267 | } else { | ||
13268 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13269 | "Speaker Playback Switch", | ||
13270 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
13271 | HDA_OUTPUT)); | ||
13272 | if (err < 0) | ||
13273 | return err; | ||
13274 | } | ||
13275 | } | ||
13276 | nid = cfg->hp_pins[0]; | ||
13277 | if (nid) { | ||
13278 | /* spec->multiout.hp_nid = 2; */ | ||
13279 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { | ||
13280 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13281 | "Headphone Playback Volume", | ||
13282 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | ||
13283 | HDA_OUTPUT)); | ||
13284 | if (err < 0) | ||
13285 | return err; | ||
13286 | } | ||
13287 | if (nid == 0x16) { | ||
13288 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13289 | "Headphone Playback Switch", | ||
13290 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
13291 | HDA_OUTPUT)); | ||
13292 | if (err < 0) | ||
13293 | return err; | ||
13294 | } else { | ||
13295 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13296 | "Headphone Playback Switch", | ||
13297 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
13298 | HDA_OUTPUT)); | ||
13299 | if (err < 0) | ||
13300 | return err; | ||
13301 | } | ||
13302 | } | ||
13303 | return 0; | ||
13304 | } | ||
13305 | |||
13306 | #define alc269_auto_create_analog_input_ctls \ | ||
13307 | alc262_auto_create_analog_input_ctls | ||
13308 | 13267 | ||
13309 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 13268 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13310 | #define alc269_loopbacks alc880_loopbacks | 13269 | #define alc269_loopbacks alc880_loopbacks |
@@ -13354,7 +13313,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13354 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | 13313 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
13355 | if (err < 0) | 13314 | if (err < 0) |
13356 | return err; | 13315 | return err; |
13357 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); | 13316 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
13358 | if (err < 0) | 13317 | if (err < 0) |
13359 | return err; | 13318 | return err; |
13360 | 13319 | ||
@@ -13379,15 +13338,15 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13379 | return err; | 13338 | return err; |
13380 | 13339 | ||
13381 | if (!spec->cap_mixer && !spec->no_analog) | 13340 | if (!spec->cap_mixer && !spec->no_analog) |
13382 | set_capture_mixer(spec); | 13341 | set_capture_mixer(codec); |
13383 | 13342 | ||
13384 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | 13343 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
13385 | 13344 | ||
13386 | return 1; | 13345 | return 1; |
13387 | } | 13346 | } |
13388 | 13347 | ||
13389 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out | 13348 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
13390 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out | 13349 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
13391 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | 13350 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
13392 | 13351 | ||
13393 | 13352 | ||
@@ -13455,6 +13414,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13455 | .channel_mode = alc269_modes, | 13414 | .channel_mode = alc269_modes, |
13456 | .input_mux = &alc269_capture_source, | 13415 | .input_mux = &alc269_capture_source, |
13457 | .unsol_event = alc269_quanta_fl1_unsol_event, | 13416 | .unsol_event = alc269_quanta_fl1_unsol_event, |
13417 | .setup = alc269_quanta_fl1_setup, | ||
13458 | .init_hook = alc269_quanta_fl1_init_hook, | 13418 | .init_hook = alc269_quanta_fl1_init_hook, |
13459 | }, | 13419 | }, |
13460 | [ALC269_ASUS_EEEPC_P703] = { | 13420 | [ALC269_ASUS_EEEPC_P703] = { |
@@ -13467,9 +13427,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13467 | .hp_nid = 0x03, | 13427 | .hp_nid = 0x03, |
13468 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13428 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13469 | .channel_mode = alc269_modes, | 13429 | .channel_mode = alc269_modes, |
13470 | .input_mux = &alc269_eeepc_amic_capture_source, | 13430 | .unsol_event = alc269_eeepc_unsol_event, |
13471 | .unsol_event = alc269_eeepc_amic_unsol_event, | 13431 | .setup = alc269_eeepc_amic_setup, |
13472 | .init_hook = alc269_eeepc_amic_inithook, | 13432 | .init_hook = alc269_eeepc_inithook, |
13473 | }, | 13433 | }, |
13474 | [ALC269_ASUS_EEEPC_P901] = { | 13434 | [ALC269_ASUS_EEEPC_P901] = { |
13475 | .mixers = { alc269_eeepc_mixer }, | 13435 | .mixers = { alc269_eeepc_mixer }, |
@@ -13481,9 +13441,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13481 | .hp_nid = 0x03, | 13441 | .hp_nid = 0x03, |
13482 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13442 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13483 | .channel_mode = alc269_modes, | 13443 | .channel_mode = alc269_modes, |
13484 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13444 | .unsol_event = alc269_eeepc_unsol_event, |
13485 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13445 | .setup = alc269_eeepc_dmic_setup, |
13486 | .init_hook = alc269_eeepc_dmic_inithook, | 13446 | .init_hook = alc269_eeepc_inithook, |
13487 | }, | 13447 | }, |
13488 | [ALC269_FUJITSU] = { | 13448 | [ALC269_FUJITSU] = { |
13489 | .mixers = { alc269_fujitsu_mixer }, | 13449 | .mixers = { alc269_fujitsu_mixer }, |
@@ -13495,9 +13455,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13495 | .hp_nid = 0x03, | 13455 | .hp_nid = 0x03, |
13496 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13456 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13497 | .channel_mode = alc269_modes, | 13457 | .channel_mode = alc269_modes, |
13498 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13458 | .unsol_event = alc269_eeepc_unsol_event, |
13499 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13459 | .setup = alc269_eeepc_dmic_setup, |
13500 | .init_hook = alc269_eeepc_dmic_inithook, | 13460 | .init_hook = alc269_eeepc_inithook, |
13501 | }, | 13461 | }, |
13502 | [ALC269_LIFEBOOK] = { | 13462 | [ALC269_LIFEBOOK] = { |
13503 | .mixers = { alc269_lifebook_mixer }, | 13463 | .mixers = { alc269_lifebook_mixer }, |
@@ -13532,8 +13492,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
13532 | alc269_cfg_tbl); | 13492 | alc269_cfg_tbl); |
13533 | 13493 | ||
13534 | if (board_config < 0) { | 13494 | if (board_config < 0) { |
13535 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 13495 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
13536 | "trying auto-probe from BIOS...\n", codec->chip_name); | 13496 | codec->chip_name); |
13537 | board_config = ALC269_AUTO; | 13497 | board_config = ALC269_AUTO; |
13538 | } | 13498 | } |
13539 | 13499 | ||
@@ -13558,7 +13518,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
13558 | } | 13518 | } |
13559 | 13519 | ||
13560 | if (board_config != ALC269_AUTO) | 13520 | if (board_config != ALC269_AUTO) |
13561 | setup_preset(spec, &alc269_presets[board_config]); | 13521 | setup_preset(codec, &alc269_presets[board_config]); |
13562 | 13522 | ||
13563 | if (codec->subsystem_id == 0x17aa3bf8) { | 13523 | if (codec->subsystem_id == 0x17aa3bf8) { |
13564 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | 13524 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
@@ -13577,7 +13537,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
13577 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 13537 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
13578 | spec->capsrc_nids = alc269_capsrc_nids; | 13538 | spec->capsrc_nids = alc269_capsrc_nids; |
13579 | if (!spec->cap_mixer) | 13539 | if (!spec->cap_mixer) |
13580 | set_capture_mixer(spec); | 13540 | set_capture_mixer(codec); |
13581 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 13541 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
13582 | 13542 | ||
13583 | spec->vmaster_nid = 0x02; | 13543 | spec->vmaster_nid = 0x02; |
@@ -14127,23 +14087,23 @@ static struct hda_verb alc861_auto_init_verbs[] = { | |||
14127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
14128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | 14088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
14129 | 14089 | ||
14130 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14131 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14132 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14092 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14133 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14093 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14094 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14135 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14136 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14096 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14138 | 14098 | ||
14139 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14099 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 14100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
14142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | 14102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
14143 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 14104 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14105 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
14146 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | 14106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
14147 | 14107 | ||
14148 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | 14108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
14149 | 14109 | ||
@@ -14215,64 +14175,96 @@ static struct hda_input_mux alc861_capture_source = { | |||
14215 | }, | 14175 | }, |
14216 | }; | 14176 | }; |
14217 | 14177 | ||
14178 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | ||
14179 | { | ||
14180 | struct alc_spec *spec = codec->spec; | ||
14181 | hda_nid_t mix, srcs[5]; | ||
14182 | int i, j, num; | ||
14183 | |||
14184 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | ||
14185 | return 0; | ||
14186 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
14187 | if (num < 0) | ||
14188 | return 0; | ||
14189 | for (i = 0; i < num; i++) { | ||
14190 | unsigned int type; | ||
14191 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | ||
14192 | if (type != AC_WID_AUD_OUT) | ||
14193 | continue; | ||
14194 | for (j = 0; j < spec->multiout.num_dacs; j++) | ||
14195 | if (spec->multiout.dac_nids[j] == srcs[i]) | ||
14196 | break; | ||
14197 | if (j >= spec->multiout.num_dacs) | ||
14198 | return srcs[i]; | ||
14199 | } | ||
14200 | return 0; | ||
14201 | } | ||
14202 | |||
14218 | /* fill in the dac_nids table from the parsed pin configuration */ | 14203 | /* fill in the dac_nids table from the parsed pin configuration */ |
14219 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, | 14204 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
14220 | const struct auto_pin_cfg *cfg) | 14205 | const struct auto_pin_cfg *cfg) |
14221 | { | 14206 | { |
14207 | struct alc_spec *spec = codec->spec; | ||
14222 | int i; | 14208 | int i; |
14223 | hda_nid_t nid; | 14209 | hda_nid_t nid, dac; |
14224 | 14210 | ||
14225 | spec->multiout.dac_nids = spec->private_dac_nids; | 14211 | spec->multiout.dac_nids = spec->private_dac_nids; |
14226 | for (i = 0; i < cfg->line_outs; i++) { | 14212 | for (i = 0; i < cfg->line_outs; i++) { |
14227 | nid = cfg->line_out_pins[i]; | 14213 | nid = cfg->line_out_pins[i]; |
14228 | if (nid) { | 14214 | dac = alc861_look_for_dac(codec, nid); |
14229 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | 14215 | if (!dac) |
14230 | continue; | 14216 | continue; |
14231 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | 14217 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
14232 | } | ||
14233 | } | 14218 | } |
14234 | spec->multiout.num_dacs = cfg->line_outs; | ||
14235 | return 0; | 14219 | return 0; |
14236 | } | 14220 | } |
14237 | 14221 | ||
14222 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | ||
14223 | hda_nid_t nid, unsigned int chs) | ||
14224 | { | ||
14225 | char name[32]; | ||
14226 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | ||
14227 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, | ||
14228 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | ||
14229 | } | ||
14230 | |||
14238 | /* add playback controls from the parsed DAC table */ | 14231 | /* add playback controls from the parsed DAC table */ |
14239 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | 14232 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
14240 | const struct auto_pin_cfg *cfg) | 14233 | const struct auto_pin_cfg *cfg) |
14241 | { | 14234 | { |
14242 | char name[32]; | 14235 | struct alc_spec *spec = codec->spec; |
14243 | static const char *chname[4] = { | 14236 | static const char *chname[4] = { |
14244 | "Front", "Surround", NULL /*CLFE*/, "Side" | 14237 | "Front", "Surround", NULL /*CLFE*/, "Side" |
14245 | }; | 14238 | }; |
14246 | hda_nid_t nid; | 14239 | hda_nid_t nid; |
14247 | int i, idx, err; | 14240 | int i, err; |
14241 | |||
14242 | if (cfg->line_outs == 1) { | ||
14243 | const char *pfx = NULL; | ||
14244 | if (!cfg->hp_outs) | ||
14245 | pfx = "Master"; | ||
14246 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
14247 | pfx = "Speaker"; | ||
14248 | if (pfx) { | ||
14249 | nid = spec->multiout.dac_nids[0]; | ||
14250 | return alc861_create_out_sw(codec, pfx, nid, 3); | ||
14251 | } | ||
14252 | } | ||
14248 | 14253 | ||
14249 | for (i = 0; i < cfg->line_outs; i++) { | 14254 | for (i = 0; i < cfg->line_outs; i++) { |
14250 | nid = spec->multiout.dac_nids[i]; | 14255 | nid = spec->multiout.dac_nids[i]; |
14251 | if (!nid) | 14256 | if (!nid) |
14252 | continue; | 14257 | continue; |
14253 | if (nid == 0x05) { | 14258 | if (i == 2) { |
14254 | /* Center/LFE */ | 14259 | /* Center/LFE */ |
14255 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 14260 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
14256 | "Center Playback Switch", | ||
14257 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | ||
14258 | HDA_OUTPUT)); | ||
14259 | if (err < 0) | 14261 | if (err < 0) |
14260 | return err; | 14262 | return err; |
14261 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 14263 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
14262 | "LFE Playback Switch", | ||
14263 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
14264 | HDA_OUTPUT)); | ||
14265 | if (err < 0) | 14264 | if (err < 0) |
14266 | return err; | 14265 | return err; |
14267 | } else { | 14266 | } else { |
14268 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; | 14267 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
14269 | idx++) | ||
14270 | if (nid == alc861_dac_nids[idx]) | ||
14271 | break; | ||
14272 | sprintf(name, "%s Playback Switch", chname[idx]); | ||
14273 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | ||
14274 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
14275 | HDA_OUTPUT)); | ||
14276 | if (err < 0) | 14268 | if (err < 0) |
14277 | return err; | 14269 | return err; |
14278 | } | 14270 | } |
@@ -14280,8 +14272,9 @@ static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14280 | return 0; | 14272 | return 0; |
14281 | } | 14273 | } |
14282 | 14274 | ||
14283 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | 14275 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
14284 | { | 14276 | { |
14277 | struct alc_spec *spec = codec->spec; | ||
14285 | int err; | 14278 | int err; |
14286 | hda_nid_t nid; | 14279 | hda_nid_t nid; |
14287 | 14280 | ||
@@ -14289,70 +14282,49 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |||
14289 | return 0; | 14282 | return 0; |
14290 | 14283 | ||
14291 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | 14284 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
14292 | nid = 0x03; | 14285 | nid = alc861_look_for_dac(codec, pin); |
14293 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 14286 | if (nid) { |
14294 | "Headphone Playback Switch", | 14287 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
14295 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 14288 | if (err < 0) |
14296 | if (err < 0) | 14289 | return err; |
14297 | return err; | 14290 | spec->multiout.hp_nid = nid; |
14298 | spec->multiout.hp_nid = nid; | 14291 | } |
14299 | } | 14292 | } |
14300 | return 0; | 14293 | return 0; |
14301 | } | 14294 | } |
14302 | 14295 | ||
14303 | /* create playback/capture controls for input pins */ | 14296 | /* create playback/capture controls for input pins */ |
14304 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, | 14297 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
14305 | const struct auto_pin_cfg *cfg) | 14298 | const struct auto_pin_cfg *cfg) |
14306 | { | 14299 | { |
14307 | struct hda_input_mux *imux = &spec->private_imux[0]; | 14300 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
14308 | int i, err, idx, idx1; | ||
14309 | |||
14310 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
14311 | switch (cfg->input_pins[i]) { | ||
14312 | case 0x0c: | ||
14313 | idx1 = 1; | ||
14314 | idx = 2; /* Line In */ | ||
14315 | break; | ||
14316 | case 0x0f: | ||
14317 | idx1 = 2; | ||
14318 | idx = 2; /* Line In */ | ||
14319 | break; | ||
14320 | case 0x0d: | ||
14321 | idx1 = 0; | ||
14322 | idx = 1; /* Mic In */ | ||
14323 | break; | ||
14324 | case 0x10: | ||
14325 | idx1 = 3; | ||
14326 | idx = 1; /* Mic In */ | ||
14327 | break; | ||
14328 | case 0x11: | ||
14329 | idx1 = 4; | ||
14330 | idx = 0; /* CD */ | ||
14331 | break; | ||
14332 | default: | ||
14333 | continue; | ||
14334 | } | ||
14335 | |||
14336 | err = new_analog_input(spec, cfg->input_pins[i], | ||
14337 | auto_pin_cfg_labels[i], idx, 0x15); | ||
14338 | if (err < 0) | ||
14339 | return err; | ||
14340 | |||
14341 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | ||
14342 | imux->items[imux->num_items].index = idx1; | ||
14343 | imux->num_items++; | ||
14344 | } | ||
14345 | return 0; | ||
14346 | } | 14301 | } |
14347 | 14302 | ||
14348 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | 14303 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
14349 | hda_nid_t nid, | 14304 | hda_nid_t nid, |
14350 | int pin_type, int dac_idx) | 14305 | int pin_type, hda_nid_t dac) |
14351 | { | 14306 | { |
14307 | hda_nid_t mix, srcs[5]; | ||
14308 | int i, num; | ||
14309 | |||
14352 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | 14310 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
14353 | pin_type); | 14311 | pin_type); |
14354 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 14312 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14355 | AMP_OUT_UNMUTE); | 14313 | AMP_OUT_UNMUTE); |
14314 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | ||
14315 | return; | ||
14316 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
14317 | if (num < 0) | ||
14318 | return; | ||
14319 | for (i = 0; i < num; i++) { | ||
14320 | unsigned int mute; | ||
14321 | if (srcs[i] == dac || srcs[i] == 0x15) | ||
14322 | mute = AMP_IN_UNMUTE(i); | ||
14323 | else | ||
14324 | mute = AMP_IN_MUTE(i); | ||
14325 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
14326 | mute); | ||
14327 | } | ||
14356 | } | 14328 | } |
14357 | 14329 | ||
14358 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | 14330 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
@@ -14375,12 +14347,13 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec) | |||
14375 | hda_nid_t pin; | 14347 | hda_nid_t pin; |
14376 | 14348 | ||
14377 | pin = spec->autocfg.hp_pins[0]; | 14349 | pin = spec->autocfg.hp_pins[0]; |
14378 | if (pin) /* connect to front */ | 14350 | if (pin) |
14379 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, | 14351 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
14380 | spec->multiout.dac_nids[0]); | 14352 | spec->multiout.hp_nid); |
14381 | pin = spec->autocfg.speaker_pins[0]; | 14353 | pin = spec->autocfg.speaker_pins[0]; |
14382 | if (pin) | 14354 | if (pin) |
14383 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 14355 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
14356 | spec->multiout.dac_nids[0]); | ||
14384 | } | 14357 | } |
14385 | 14358 | ||
14386 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | 14359 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
@@ -14412,16 +14385,16 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
14412 | if (!spec->autocfg.line_outs) | 14385 | if (!spec->autocfg.line_outs) |
14413 | return 0; /* can't find valid BIOS pin config */ | 14386 | return 0; /* can't find valid BIOS pin config */ |
14414 | 14387 | ||
14415 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); | 14388 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
14416 | if (err < 0) | 14389 | if (err < 0) |
14417 | return err; | 14390 | return err; |
14418 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); | 14391 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
14419 | if (err < 0) | 14392 | if (err < 0) |
14420 | return err; | 14393 | return err; |
14421 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | 14394 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
14422 | if (err < 0) | 14395 | if (err < 0) |
14423 | return err; | 14396 | return err; |
14424 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); | 14397 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
14425 | if (err < 0) | 14398 | if (err < 0) |
14426 | return err; | 14399 | return err; |
14427 | 14400 | ||
@@ -14440,7 +14413,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
14440 | 14413 | ||
14441 | spec->adc_nids = alc861_adc_nids; | 14414 | spec->adc_nids = alc861_adc_nids; |
14442 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | 14415 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
14443 | set_capture_mixer(spec); | 14416 | set_capture_mixer(codec); |
14444 | 14417 | ||
14445 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); | 14418 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
14446 | 14419 | ||
@@ -14633,8 +14606,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
14633 | alc861_cfg_tbl); | 14606 | alc861_cfg_tbl); |
14634 | 14607 | ||
14635 | if (board_config < 0) { | 14608 | if (board_config < 0) { |
14636 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 14609 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
14637 | "trying auto-probe from BIOS...\n", codec->chip_name); | 14610 | codec->chip_name); |
14638 | board_config = ALC861_AUTO; | 14611 | board_config = ALC861_AUTO; |
14639 | } | 14612 | } |
14640 | 14613 | ||
@@ -14659,7 +14632,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
14659 | } | 14632 | } |
14660 | 14633 | ||
14661 | if (board_config != ALC861_AUTO) | 14634 | if (board_config != ALC861_AUTO) |
14662 | setup_preset(spec, &alc861_presets[board_config]); | 14635 | setup_preset(codec, &alc861_presets[board_config]); |
14663 | 14636 | ||
14664 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | 14637 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
14665 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | 14638 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
@@ -15062,12 +15035,15 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |||
15062 | HDA_AMP_MUTE, bits); | 15035 | HDA_AMP_MUTE, bits); |
15063 | } | 15036 | } |
15064 | 15037 | ||
15065 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | 15038 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
15066 | { | 15039 | { |
15067 | struct alc_spec *spec = codec->spec; | 15040 | struct alc_spec *spec = codec->spec; |
15068 | |||
15069 | spec->autocfg.hp_pins[0] = 0x1b; | 15041 | spec->autocfg.hp_pins[0] = 0x1b; |
15070 | spec->autocfg.speaker_pins[0] = 0x14; | 15042 | spec->autocfg.speaker_pins[0] = 0x14; |
15043 | } | ||
15044 | |||
15045 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | ||
15046 | { | ||
15071 | alc_automute_amp(codec); | 15047 | alc_automute_amp(codec); |
15072 | alc861vd_lenovo_mic_automute(codec); | 15048 | alc861vd_lenovo_mic_automute(codec); |
15073 | } | 15049 | } |
@@ -15131,13 +15107,12 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
15131 | }; | 15107 | }; |
15132 | 15108 | ||
15133 | /* toggle speaker-output according to the hp-jack state */ | 15109 | /* toggle speaker-output according to the hp-jack state */ |
15134 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) | 15110 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
15135 | { | 15111 | { |
15136 | struct alc_spec *spec = codec->spec; | 15112 | struct alc_spec *spec = codec->spec; |
15137 | 15113 | ||
15138 | spec->autocfg.hp_pins[0] = 0x15; | 15114 | spec->autocfg.hp_pins[0] = 0x15; |
15139 | spec->autocfg.speaker_pins[0] = 0x14; | 15115 | spec->autocfg.speaker_pins[0] = 0x14; |
15140 | alc_automute_amp(codec); | ||
15141 | } | 15116 | } |
15142 | 15117 | ||
15143 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15118 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -15251,6 +15226,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15251 | .channel_mode = alc861vd_3stack_2ch_modes, | 15226 | .channel_mode = alc861vd_3stack_2ch_modes, |
15252 | .input_mux = &alc861vd_capture_source, | 15227 | .input_mux = &alc861vd_capture_source, |
15253 | .unsol_event = alc861vd_lenovo_unsol_event, | 15228 | .unsol_event = alc861vd_lenovo_unsol_event, |
15229 | .setup = alc861vd_lenovo_setup, | ||
15254 | .init_hook = alc861vd_lenovo_init_hook, | 15230 | .init_hook = alc861vd_lenovo_init_hook, |
15255 | }, | 15231 | }, |
15256 | [ALC861VD_DALLAS] = { | 15232 | [ALC861VD_DALLAS] = { |
@@ -15262,7 +15238,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15262 | .channel_mode = alc861vd_3stack_2ch_modes, | 15238 | .channel_mode = alc861vd_3stack_2ch_modes, |
15263 | .input_mux = &alc861vd_dallas_capture_source, | 15239 | .input_mux = &alc861vd_dallas_capture_source, |
15264 | .unsol_event = alc_automute_amp_unsol_event, | 15240 | .unsol_event = alc_automute_amp_unsol_event, |
15265 | .init_hook = alc861vd_dallas_init_hook, | 15241 | .setup = alc861vd_dallas_setup, |
15242 | .init_hook = alc_automute_amp, | ||
15266 | }, | 15243 | }, |
15267 | [ALC861VD_HP] = { | 15244 | [ALC861VD_HP] = { |
15268 | .mixers = { alc861vd_hp_mixer }, | 15245 | .mixers = { alc861vd_hp_mixer }, |
@@ -15274,7 +15251,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15274 | .channel_mode = alc861vd_3stack_2ch_modes, | 15251 | .channel_mode = alc861vd_3stack_2ch_modes, |
15275 | .input_mux = &alc861vd_hp_capture_source, | 15252 | .input_mux = &alc861vd_hp_capture_source, |
15276 | .unsol_event = alc_automute_amp_unsol_event, | 15253 | .unsol_event = alc_automute_amp_unsol_event, |
15277 | .init_hook = alc861vd_dallas_init_hook, | 15254 | .setup = alc861vd_dallas_setup, |
15255 | .init_hook = alc_automute_amp, | ||
15278 | }, | 15256 | }, |
15279 | [ALC660VD_ASUS_V1S] = { | 15257 | [ALC660VD_ASUS_V1S] = { |
15280 | .mixers = { alc861vd_lenovo_mixer }, | 15258 | .mixers = { alc861vd_lenovo_mixer }, |
@@ -15289,6 +15267,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15289 | .channel_mode = alc861vd_3stack_2ch_modes, | 15267 | .channel_mode = alc861vd_3stack_2ch_modes, |
15290 | .input_mux = &alc861vd_capture_source, | 15268 | .input_mux = &alc861vd_capture_source, |
15291 | .unsol_event = alc861vd_lenovo_unsol_event, | 15269 | .unsol_event = alc861vd_lenovo_unsol_event, |
15270 | .setup = alc861vd_lenovo_setup, | ||
15292 | .init_hook = alc861vd_lenovo_init_hook, | 15271 | .init_hook = alc861vd_lenovo_init_hook, |
15293 | }, | 15272 | }, |
15294 | }; | 15273 | }; |
@@ -15296,6 +15275,13 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15296 | /* | 15275 | /* |
15297 | * BIOS auto configuration | 15276 | * BIOS auto configuration |
15298 | */ | 15277 | */ |
15278 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | ||
15279 | const struct auto_pin_cfg *cfg) | ||
15280 | { | ||
15281 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | ||
15282 | } | ||
15283 | |||
15284 | |||
15299 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | 15285 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
15300 | hda_nid_t nid, int pin_type, int dac_idx) | 15286 | hda_nid_t nid, int pin_type, int dac_idx) |
15301 | { | 15287 | { |
@@ -15330,7 +15316,6 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |||
15330 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 15316 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
15331 | } | 15317 | } |
15332 | 15318 | ||
15333 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | ||
15334 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | 15319 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
15335 | 15320 | ||
15336 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | 15321 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
@@ -15340,7 +15325,7 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |||
15340 | 15325 | ||
15341 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 15326 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
15342 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 15327 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
15343 | if (alc861vd_is_input_pin(nid)) { | 15328 | if (alc_is_input_pin(codec, nid)) { |
15344 | alc_set_input_pin(codec, nid, i); | 15329 | alc_set_input_pin(codec, nid, i); |
15345 | if (nid != ALC861VD_PIN_CD_NID && | 15330 | if (nid != ALC861VD_PIN_CD_NID && |
15346 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 15331 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -15404,13 +15389,25 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
15404 | if (err < 0) | 15389 | if (err < 0) |
15405 | return err; | 15390 | return err; |
15406 | } else { | 15391 | } else { |
15407 | sprintf(name, "%s Playback Volume", chname[i]); | 15392 | const char *pfx; |
15393 | if (cfg->line_outs == 1 && | ||
15394 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
15395 | if (!cfg->hp_pins) | ||
15396 | pfx = "Speaker"; | ||
15397 | else | ||
15398 | pfx = "PCM"; | ||
15399 | } else | ||
15400 | pfx = chname[i]; | ||
15401 | sprintf(name, "%s Playback Volume", pfx); | ||
15408 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 15402 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
15409 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | 15403 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
15410 | HDA_OUTPUT)); | 15404 | HDA_OUTPUT)); |
15411 | if (err < 0) | 15405 | if (err < 0) |
15412 | return err; | 15406 | return err; |
15413 | sprintf(name, "%s Playback Switch", chname[i]); | 15407 | if (cfg->line_outs == 1 && |
15408 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
15409 | pfx = "Speaker"; | ||
15410 | sprintf(name, "%s Playback Switch", pfx); | ||
15414 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 15411 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
15415 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | 15412 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
15416 | HDA_INPUT)); | 15413 | HDA_INPUT)); |
@@ -15503,7 +15500,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
15503 | "Headphone"); | 15500 | "Headphone"); |
15504 | if (err < 0) | 15501 | if (err < 0) |
15505 | return err; | 15502 | return err; |
15506 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | 15503 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
15507 | if (err < 0) | 15504 | if (err < 0) |
15508 | return err; | 15505 | return err; |
15509 | 15506 | ||
@@ -15557,8 +15554,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15557 | alc861vd_cfg_tbl); | 15554 | alc861vd_cfg_tbl); |
15558 | 15555 | ||
15559 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | 15556 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
15560 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 15557 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
15561 | "trying auto-probe from BIOS...\n", codec->chip_name); | 15558 | codec->chip_name); |
15562 | board_config = ALC861VD_AUTO; | 15559 | board_config = ALC861VD_AUTO; |
15563 | } | 15560 | } |
15564 | 15561 | ||
@@ -15583,7 +15580,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15583 | } | 15580 | } |
15584 | 15581 | ||
15585 | if (board_config != ALC861VD_AUTO) | 15582 | if (board_config != ALC861VD_AUTO) |
15586 | setup_preset(spec, &alc861vd_presets[board_config]); | 15583 | setup_preset(codec, &alc861vd_presets[board_config]); |
15587 | 15584 | ||
15588 | if (codec->vendor_id == 0x10ec0660) { | 15585 | if (codec->vendor_id == 0x10ec0660) { |
15589 | /* always turn on EAPD */ | 15586 | /* always turn on EAPD */ |
@@ -15603,7 +15600,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15603 | if (!spec->capsrc_nids) | 15600 | if (!spec->capsrc_nids) |
15604 | spec->capsrc_nids = alc861vd_capsrc_nids; | 15601 | spec->capsrc_nids = alc861vd_capsrc_nids; |
15605 | 15602 | ||
15606 | set_capture_mixer(spec); | 15603 | set_capture_mixer(codec); |
15607 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 15604 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
15608 | 15605 | ||
15609 | spec->vmaster_nid = 0x02; | 15606 | spec->vmaster_nid = 0x02; |
@@ -15644,9 +15641,9 @@ static hda_nid_t alc272_dac_nids[2] = { | |||
15644 | 0x02, 0x03 | 15641 | 0x02, 0x03 |
15645 | }; | 15642 | }; |
15646 | 15643 | ||
15647 | static hda_nid_t alc662_adc_nids[1] = { | 15644 | static hda_nid_t alc662_adc_nids[2] = { |
15648 | /* ADC1-2 */ | 15645 | /* ADC1-2 */ |
15649 | 0x09, | 15646 | 0x09, 0x08 |
15650 | }; | 15647 | }; |
15651 | 15648 | ||
15652 | static hda_nid_t alc272_adc_nids[1] = { | 15649 | static hda_nid_t alc272_adc_nids[1] = { |
@@ -15654,7 +15651,7 @@ static hda_nid_t alc272_adc_nids[1] = { | |||
15654 | 0x08, | 15651 | 0x08, |
15655 | }; | 15652 | }; |
15656 | 15653 | ||
15657 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; | 15654 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
15658 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | 15655 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
15659 | 15656 | ||
15660 | 15657 | ||
@@ -15678,14 +15675,6 @@ static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |||
15678 | }, | 15675 | }, |
15679 | }; | 15676 | }; |
15680 | 15677 | ||
15681 | static struct hda_input_mux alc662_eeepc_capture_source = { | ||
15682 | .num_items = 2, | ||
15683 | .items = { | ||
15684 | { "i-Mic", 0x1 }, | ||
15685 | { "e-Mic", 0x0 }, | ||
15686 | }, | ||
15687 | }; | ||
15688 | |||
15689 | static struct hda_input_mux alc663_capture_source = { | 15678 | static struct hda_input_mux alc663_capture_source = { |
15690 | .num_items = 3, | 15679 | .num_items = 3, |
15691 | .items = { | 15680 | .items = { |
@@ -15695,23 +15684,7 @@ static struct hda_input_mux alc663_capture_source = { | |||
15695 | }, | 15684 | }, |
15696 | }; | 15685 | }; |
15697 | 15686 | ||
15698 | static struct hda_input_mux alc663_m51va_capture_source = { | 15687 | #if 0 /* set to 1 for testing other input sources below */ |
15699 | .num_items = 2, | ||
15700 | .items = { | ||
15701 | { "Ext-Mic", 0x0 }, | ||
15702 | { "D-Mic", 0x9 }, | ||
15703 | }, | ||
15704 | }; | ||
15705 | |||
15706 | #if 1 /* set to 0 for testing other input sources below */ | ||
15707 | static struct hda_input_mux alc272_nc10_capture_source = { | ||
15708 | .num_items = 2, | ||
15709 | .items = { | ||
15710 | { "Autoselect Mic", 0x0 }, | ||
15711 | { "Internal Mic", 0x1 }, | ||
15712 | }, | ||
15713 | }; | ||
15714 | #else | ||
15715 | static struct hda_input_mux alc272_nc10_capture_source = { | 15688 | static struct hda_input_mux alc272_nc10_capture_source = { |
15716 | .num_items = 16, | 15689 | .num_items = 16, |
15717 | .items = { | 15690 | .items = { |
@@ -16380,47 +16353,44 @@ static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
16380 | alc662_lenovo_101e_ispeaker_automute(codec); | 16353 | alc662_lenovo_101e_ispeaker_automute(codec); |
16381 | } | 16354 | } |
16382 | 16355 | ||
16383 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) | ||
16384 | { | ||
16385 | unsigned int present; | ||
16386 | |||
16387 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16388 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
16389 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16390 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16391 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16392 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16393 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16394 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16395 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16396 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16397 | } | ||
16398 | |||
16399 | /* unsolicited event for HP jack sensing */ | 16356 | /* unsolicited event for HP jack sensing */ |
16400 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | 16357 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
16401 | unsigned int res) | 16358 | unsigned int res) |
16402 | { | 16359 | { |
16403 | if ((res >> 26) == ALC880_MIC_EVENT) | 16360 | if ((res >> 26) == ALC880_MIC_EVENT) |
16404 | alc662_eeepc_mic_automute(codec); | 16361 | alc_mic_automute(codec); |
16405 | else | 16362 | else |
16406 | alc262_hippo_unsol_event(codec, res); | 16363 | alc262_hippo_unsol_event(codec, res); |
16407 | } | 16364 | } |
16408 | 16365 | ||
16366 | static void alc662_eeepc_setup(struct hda_codec *codec) | ||
16367 | { | ||
16368 | struct alc_spec *spec = codec->spec; | ||
16369 | |||
16370 | alc262_hippo1_setup(codec); | ||
16371 | spec->ext_mic.pin = 0x18; | ||
16372 | spec->ext_mic.mux_idx = 0; | ||
16373 | spec->int_mic.pin = 0x19; | ||
16374 | spec->int_mic.mux_idx = 1; | ||
16375 | spec->auto_mic = 1; | ||
16376 | } | ||
16377 | |||
16409 | static void alc662_eeepc_inithook(struct hda_codec *codec) | 16378 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
16410 | { | 16379 | { |
16411 | alc262_hippo1_init_hook(codec); | 16380 | alc262_hippo_automute(codec); |
16412 | alc662_eeepc_mic_automute(codec); | 16381 | alc_mic_automute(codec); |
16413 | } | 16382 | } |
16414 | 16383 | ||
16415 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | 16384 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
16416 | { | 16385 | { |
16417 | struct alc_spec *spec = codec->spec; | 16386 | struct alc_spec *spec = codec->spec; |
16418 | 16387 | ||
16419 | spec->autocfg.hp_pins[0] = 0x14; | 16388 | spec->autocfg.hp_pins[0] = 0x14; |
16420 | spec->autocfg.speaker_pins[0] = 0x1b; | 16389 | spec->autocfg.speaker_pins[0] = 0x1b; |
16421 | alc262_hippo_master_update(codec); | ||
16422 | } | 16390 | } |
16423 | 16391 | ||
16392 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | ||
16393 | |||
16424 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | 16394 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
16425 | { | 16395 | { |
16426 | unsigned int present; | 16396 | unsigned int present; |
@@ -16531,23 +16501,6 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
16531 | } | 16501 | } |
16532 | } | 16502 | } |
16533 | 16503 | ||
16534 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | ||
16535 | { | ||
16536 | unsigned int present; | ||
16537 | |||
16538 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16539 | AC_VERB_GET_PIN_SENSE, 0) | ||
16540 | & AC_PINSENSE_PRESENCE; | ||
16541 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16542 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16543 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16544 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16545 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16546 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16547 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16548 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16549 | } | ||
16550 | |||
16551 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 16504 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
16552 | unsigned int res) | 16505 | unsigned int res) |
16553 | { | 16506 | { |
@@ -16556,36 +16509,32 @@ static void alc663_m51va_unsol_event(struct hda_codec *codec, | |||
16556 | alc663_m51va_speaker_automute(codec); | 16509 | alc663_m51va_speaker_automute(codec); |
16557 | break; | 16510 | break; |
16558 | case ALC880_MIC_EVENT: | 16511 | case ALC880_MIC_EVENT: |
16559 | alc663_m51va_mic_automute(codec); | 16512 | alc_mic_automute(codec); |
16560 | break; | 16513 | break; |
16561 | } | 16514 | } |
16562 | } | 16515 | } |
16563 | 16516 | ||
16517 | static void alc663_m51va_setup(struct hda_codec *codec) | ||
16518 | { | ||
16519 | struct alc_spec *spec = codec->spec; | ||
16520 | spec->ext_mic.pin = 0x18; | ||
16521 | spec->ext_mic.mux_idx = 0; | ||
16522 | spec->int_mic.pin = 0x12; | ||
16523 | spec->int_mic.mux_idx = 1; | ||
16524 | spec->auto_mic = 1; | ||
16525 | } | ||
16526 | |||
16564 | static void alc663_m51va_inithook(struct hda_codec *codec) | 16527 | static void alc663_m51va_inithook(struct hda_codec *codec) |
16565 | { | 16528 | { |
16566 | alc663_m51va_speaker_automute(codec); | 16529 | alc663_m51va_speaker_automute(codec); |
16567 | alc663_m51va_mic_automute(codec); | 16530 | alc_mic_automute(codec); |
16568 | } | 16531 | } |
16569 | 16532 | ||
16570 | /* ***************** Mode1 ******************************/ | 16533 | /* ***************** Mode1 ******************************/ |
16571 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | 16534 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
16572 | unsigned int res) | 16535 | #define alc663_mode1_setup alc663_m51va_setup |
16573 | { | 16536 | #define alc663_mode1_inithook alc663_m51va_inithook |
16574 | switch (res >> 26) { | ||
16575 | case ALC880_HP_EVENT: | ||
16576 | alc663_m51va_speaker_automute(codec); | ||
16577 | break; | ||
16578 | case ALC880_MIC_EVENT: | ||
16579 | alc662_eeepc_mic_automute(codec); | ||
16580 | break; | ||
16581 | } | ||
16582 | } | ||
16583 | 16537 | ||
16584 | static void alc663_mode1_inithook(struct hda_codec *codec) | ||
16585 | { | ||
16586 | alc663_m51va_speaker_automute(codec); | ||
16587 | alc662_eeepc_mic_automute(codec); | ||
16588 | } | ||
16589 | /* ***************** Mode2 ******************************/ | 16538 | /* ***************** Mode2 ******************************/ |
16590 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | 16539 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
16591 | unsigned int res) | 16540 | unsigned int res) |
@@ -16595,15 +16544,17 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec, | |||
16595 | alc662_f5z_speaker_automute(codec); | 16544 | alc662_f5z_speaker_automute(codec); |
16596 | break; | 16545 | break; |
16597 | case ALC880_MIC_EVENT: | 16546 | case ALC880_MIC_EVENT: |
16598 | alc662_eeepc_mic_automute(codec); | 16547 | alc_mic_automute(codec); |
16599 | break; | 16548 | break; |
16600 | } | 16549 | } |
16601 | } | 16550 | } |
16602 | 16551 | ||
16552 | #define alc662_mode2_setup alc663_m51va_setup | ||
16553 | |||
16603 | static void alc662_mode2_inithook(struct hda_codec *codec) | 16554 | static void alc662_mode2_inithook(struct hda_codec *codec) |
16604 | { | 16555 | { |
16605 | alc662_f5z_speaker_automute(codec); | 16556 | alc662_f5z_speaker_automute(codec); |
16606 | alc662_eeepc_mic_automute(codec); | 16557 | alc_mic_automute(codec); |
16607 | } | 16558 | } |
16608 | /* ***************** Mode3 ******************************/ | 16559 | /* ***************** Mode3 ******************************/ |
16609 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | 16560 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
@@ -16614,15 +16565,17 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec, | |||
16614 | alc663_two_hp_m1_speaker_automute(codec); | 16565 | alc663_two_hp_m1_speaker_automute(codec); |
16615 | break; | 16566 | break; |
16616 | case ALC880_MIC_EVENT: | 16567 | case ALC880_MIC_EVENT: |
16617 | alc662_eeepc_mic_automute(codec); | 16568 | alc_mic_automute(codec); |
16618 | break; | 16569 | break; |
16619 | } | 16570 | } |
16620 | } | 16571 | } |
16621 | 16572 | ||
16573 | #define alc663_mode3_setup alc663_m51va_setup | ||
16574 | |||
16622 | static void alc663_mode3_inithook(struct hda_codec *codec) | 16575 | static void alc663_mode3_inithook(struct hda_codec *codec) |
16623 | { | 16576 | { |
16624 | alc663_two_hp_m1_speaker_automute(codec); | 16577 | alc663_two_hp_m1_speaker_automute(codec); |
16625 | alc662_eeepc_mic_automute(codec); | 16578 | alc_mic_automute(codec); |
16626 | } | 16579 | } |
16627 | /* ***************** Mode4 ******************************/ | 16580 | /* ***************** Mode4 ******************************/ |
16628 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | 16581 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
@@ -16633,15 +16586,17 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec, | |||
16633 | alc663_21jd_two_speaker_automute(codec); | 16586 | alc663_21jd_two_speaker_automute(codec); |
16634 | break; | 16587 | break; |
16635 | case ALC880_MIC_EVENT: | 16588 | case ALC880_MIC_EVENT: |
16636 | alc662_eeepc_mic_automute(codec); | 16589 | alc_mic_automute(codec); |
16637 | break; | 16590 | break; |
16638 | } | 16591 | } |
16639 | } | 16592 | } |
16640 | 16593 | ||
16594 | #define alc663_mode4_setup alc663_m51va_setup | ||
16595 | |||
16641 | static void alc663_mode4_inithook(struct hda_codec *codec) | 16596 | static void alc663_mode4_inithook(struct hda_codec *codec) |
16642 | { | 16597 | { |
16643 | alc663_21jd_two_speaker_automute(codec); | 16598 | alc663_21jd_two_speaker_automute(codec); |
16644 | alc662_eeepc_mic_automute(codec); | 16599 | alc_mic_automute(codec); |
16645 | } | 16600 | } |
16646 | /* ***************** Mode5 ******************************/ | 16601 | /* ***************** Mode5 ******************************/ |
16647 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | 16602 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
@@ -16652,15 +16607,17 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec, | |||
16652 | alc663_15jd_two_speaker_automute(codec); | 16607 | alc663_15jd_two_speaker_automute(codec); |
16653 | break; | 16608 | break; |
16654 | case ALC880_MIC_EVENT: | 16609 | case ALC880_MIC_EVENT: |
16655 | alc662_eeepc_mic_automute(codec); | 16610 | alc_mic_automute(codec); |
16656 | break; | 16611 | break; |
16657 | } | 16612 | } |
16658 | } | 16613 | } |
16659 | 16614 | ||
16615 | #define alc663_mode5_setup alc663_m51va_setup | ||
16616 | |||
16660 | static void alc663_mode5_inithook(struct hda_codec *codec) | 16617 | static void alc663_mode5_inithook(struct hda_codec *codec) |
16661 | { | 16618 | { |
16662 | alc663_15jd_two_speaker_automute(codec); | 16619 | alc663_15jd_two_speaker_automute(codec); |
16663 | alc662_eeepc_mic_automute(codec); | 16620 | alc_mic_automute(codec); |
16664 | } | 16621 | } |
16665 | /* ***************** Mode6 ******************************/ | 16622 | /* ***************** Mode6 ******************************/ |
16666 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | 16623 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
@@ -16671,15 +16628,17 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec, | |||
16671 | alc663_two_hp_m2_speaker_automute(codec); | 16628 | alc663_two_hp_m2_speaker_automute(codec); |
16672 | break; | 16629 | break; |
16673 | case ALC880_MIC_EVENT: | 16630 | case ALC880_MIC_EVENT: |
16674 | alc662_eeepc_mic_automute(codec); | 16631 | alc_mic_automute(codec); |
16675 | break; | 16632 | break; |
16676 | } | 16633 | } |
16677 | } | 16634 | } |
16678 | 16635 | ||
16636 | #define alc663_mode6_setup alc663_m51va_setup | ||
16637 | |||
16679 | static void alc663_mode6_inithook(struct hda_codec *codec) | 16638 | static void alc663_mode6_inithook(struct hda_codec *codec) |
16680 | { | 16639 | { |
16681 | alc663_two_hp_m2_speaker_automute(codec); | 16640 | alc663_two_hp_m2_speaker_automute(codec); |
16682 | alc662_eeepc_mic_automute(codec); | 16641 | alc_mic_automute(codec); |
16683 | } | 16642 | } |
16684 | 16643 | ||
16685 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 16644 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
@@ -16721,16 +16680,18 @@ static void alc663_g71v_unsol_event(struct hda_codec *codec, | |||
16721 | alc663_g71v_front_automute(codec); | 16680 | alc663_g71v_front_automute(codec); |
16722 | break; | 16681 | break; |
16723 | case ALC880_MIC_EVENT: | 16682 | case ALC880_MIC_EVENT: |
16724 | alc662_eeepc_mic_automute(codec); | 16683 | alc_mic_automute(codec); |
16725 | break; | 16684 | break; |
16726 | } | 16685 | } |
16727 | } | 16686 | } |
16728 | 16687 | ||
16688 | #define alc663_g71v_setup alc663_m51va_setup | ||
16689 | |||
16729 | static void alc663_g71v_inithook(struct hda_codec *codec) | 16690 | static void alc663_g71v_inithook(struct hda_codec *codec) |
16730 | { | 16691 | { |
16731 | alc663_g71v_front_automute(codec); | 16692 | alc663_g71v_front_automute(codec); |
16732 | alc663_g71v_hp_automute(codec); | 16693 | alc663_g71v_hp_automute(codec); |
16733 | alc662_eeepc_mic_automute(codec); | 16694 | alc_mic_automute(codec); |
16734 | } | 16695 | } |
16735 | 16696 | ||
16736 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | 16697 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
@@ -16741,15 +16702,17 @@ static void alc663_g50v_unsol_event(struct hda_codec *codec, | |||
16741 | alc663_m51va_speaker_automute(codec); | 16702 | alc663_m51va_speaker_automute(codec); |
16742 | break; | 16703 | break; |
16743 | case ALC880_MIC_EVENT: | 16704 | case ALC880_MIC_EVENT: |
16744 | alc662_eeepc_mic_automute(codec); | 16705 | alc_mic_automute(codec); |
16745 | break; | 16706 | break; |
16746 | } | 16707 | } |
16747 | } | 16708 | } |
16748 | 16709 | ||
16710 | #define alc663_g50v_setup alc663_m51va_setup | ||
16711 | |||
16749 | static void alc663_g50v_inithook(struct hda_codec *codec) | 16712 | static void alc663_g50v_inithook(struct hda_codec *codec) |
16750 | { | 16713 | { |
16751 | alc663_m51va_speaker_automute(codec); | 16714 | alc663_m51va_speaker_automute(codec); |
16752 | alc662_eeepc_mic_automute(codec); | 16715 | alc_mic_automute(codec); |
16753 | } | 16716 | } |
16754 | 16717 | ||
16755 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | 16718 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
@@ -16953,8 +16916,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16953 | .dac_nids = alc662_dac_nids, | 16916 | .dac_nids = alc662_dac_nids, |
16954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16917 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16955 | .channel_mode = alc662_3ST_2ch_modes, | 16918 | .channel_mode = alc662_3ST_2ch_modes, |
16956 | .input_mux = &alc662_eeepc_capture_source, | ||
16957 | .unsol_event = alc662_eeepc_unsol_event, | 16919 | .unsol_event = alc662_eeepc_unsol_event, |
16920 | .setup = alc662_eeepc_setup, | ||
16958 | .init_hook = alc662_eeepc_inithook, | 16921 | .init_hook = alc662_eeepc_inithook, |
16959 | }, | 16922 | }, |
16960 | [ALC662_ASUS_EEEPC_EP20] = { | 16923 | [ALC662_ASUS_EEEPC_EP20] = { |
@@ -16968,6 +16931,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
16968 | .channel_mode = alc662_3ST_6ch_modes, | 16931 | .channel_mode = alc662_3ST_6ch_modes, |
16969 | .input_mux = &alc662_lenovo_101e_capture_source, | 16932 | .input_mux = &alc662_lenovo_101e_capture_source, |
16970 | .unsol_event = alc662_eeepc_unsol_event, | 16933 | .unsol_event = alc662_eeepc_unsol_event, |
16934 | .setup = alc662_eeepc_ep20_setup, | ||
16971 | .init_hook = alc662_eeepc_ep20_inithook, | 16935 | .init_hook = alc662_eeepc_ep20_inithook, |
16972 | }, | 16936 | }, |
16973 | [ALC662_ECS] = { | 16937 | [ALC662_ECS] = { |
@@ -16978,8 +16942,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16978 | .dac_nids = alc662_dac_nids, | 16942 | .dac_nids = alc662_dac_nids, |
16979 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16980 | .channel_mode = alc662_3ST_2ch_modes, | 16944 | .channel_mode = alc662_3ST_2ch_modes, |
16981 | .input_mux = &alc662_eeepc_capture_source, | ||
16982 | .unsol_event = alc662_eeepc_unsol_event, | 16945 | .unsol_event = alc662_eeepc_unsol_event, |
16946 | .setup = alc662_eeepc_setup, | ||
16983 | .init_hook = alc662_eeepc_inithook, | 16947 | .init_hook = alc662_eeepc_inithook, |
16984 | }, | 16948 | }, |
16985 | [ALC663_ASUS_M51VA] = { | 16949 | [ALC663_ASUS_M51VA] = { |
@@ -16990,8 +16954,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16990 | .dig_out_nid = ALC662_DIGOUT_NID, | 16954 | .dig_out_nid = ALC662_DIGOUT_NID, |
16991 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16992 | .channel_mode = alc662_3ST_2ch_modes, | 16956 | .channel_mode = alc662_3ST_2ch_modes, |
16993 | .input_mux = &alc663_m51va_capture_source, | ||
16994 | .unsol_event = alc663_m51va_unsol_event, | 16957 | .unsol_event = alc663_m51va_unsol_event, |
16958 | .setup = alc663_m51va_setup, | ||
16995 | .init_hook = alc663_m51va_inithook, | 16959 | .init_hook = alc663_m51va_inithook, |
16996 | }, | 16960 | }, |
16997 | [ALC663_ASUS_G71V] = { | 16961 | [ALC663_ASUS_G71V] = { |
@@ -17002,8 +16966,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17002 | .dig_out_nid = ALC662_DIGOUT_NID, | 16966 | .dig_out_nid = ALC662_DIGOUT_NID, |
17003 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16967 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17004 | .channel_mode = alc662_3ST_2ch_modes, | 16968 | .channel_mode = alc662_3ST_2ch_modes, |
17005 | .input_mux = &alc662_eeepc_capture_source, | ||
17006 | .unsol_event = alc663_g71v_unsol_event, | 16969 | .unsol_event = alc663_g71v_unsol_event, |
16970 | .setup = alc663_g71v_setup, | ||
17007 | .init_hook = alc663_g71v_inithook, | 16971 | .init_hook = alc663_g71v_inithook, |
17008 | }, | 16972 | }, |
17009 | [ALC663_ASUS_H13] = { | 16973 | [ALC663_ASUS_H13] = { |
@@ -17013,7 +16977,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
17013 | .dac_nids = alc662_dac_nids, | 16977 | .dac_nids = alc662_dac_nids, |
17014 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16978 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17015 | .channel_mode = alc662_3ST_2ch_modes, | 16979 | .channel_mode = alc662_3ST_2ch_modes, |
17016 | .input_mux = &alc663_m51va_capture_source, | ||
17017 | .unsol_event = alc663_m51va_unsol_event, | 16980 | .unsol_event = alc663_m51va_unsol_event, |
17018 | .init_hook = alc663_m51va_inithook, | 16981 | .init_hook = alc663_m51va_inithook, |
17019 | }, | 16982 | }, |
@@ -17027,6 +16990,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
17027 | .channel_mode = alc662_3ST_6ch_modes, | 16990 | .channel_mode = alc662_3ST_6ch_modes, |
17028 | .input_mux = &alc663_capture_source, | 16991 | .input_mux = &alc663_capture_source, |
17029 | .unsol_event = alc663_g50v_unsol_event, | 16992 | .unsol_event = alc663_g50v_unsol_event, |
16993 | .setup = alc663_g50v_setup, | ||
17030 | .init_hook = alc663_g50v_inithook, | 16994 | .init_hook = alc663_g50v_inithook, |
17031 | }, | 16995 | }, |
17032 | [ALC663_ASUS_MODE1] = { | 16996 | [ALC663_ASUS_MODE1] = { |
@@ -17040,8 +17004,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17040 | .dig_out_nid = ALC662_DIGOUT_NID, | 17004 | .dig_out_nid = ALC662_DIGOUT_NID, |
17041 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17005 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17042 | .channel_mode = alc662_3ST_2ch_modes, | 17006 | .channel_mode = alc662_3ST_2ch_modes, |
17043 | .input_mux = &alc662_eeepc_capture_source, | ||
17044 | .unsol_event = alc663_mode1_unsol_event, | 17007 | .unsol_event = alc663_mode1_unsol_event, |
17008 | .setup = alc663_mode1_setup, | ||
17045 | .init_hook = alc663_mode1_inithook, | 17009 | .init_hook = alc663_mode1_inithook, |
17046 | }, | 17010 | }, |
17047 | [ALC662_ASUS_MODE2] = { | 17011 | [ALC662_ASUS_MODE2] = { |
@@ -17054,8 +17018,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17054 | .dig_out_nid = ALC662_DIGOUT_NID, | 17018 | .dig_out_nid = ALC662_DIGOUT_NID, |
17055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17019 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17056 | .channel_mode = alc662_3ST_2ch_modes, | 17020 | .channel_mode = alc662_3ST_2ch_modes, |
17057 | .input_mux = &alc662_eeepc_capture_source, | ||
17058 | .unsol_event = alc662_mode2_unsol_event, | 17021 | .unsol_event = alc662_mode2_unsol_event, |
17022 | .setup = alc662_mode2_setup, | ||
17059 | .init_hook = alc662_mode2_inithook, | 17023 | .init_hook = alc662_mode2_inithook, |
17060 | }, | 17024 | }, |
17061 | [ALC663_ASUS_MODE3] = { | 17025 | [ALC663_ASUS_MODE3] = { |
@@ -17069,8 +17033,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17069 | .dig_out_nid = ALC662_DIGOUT_NID, | 17033 | .dig_out_nid = ALC662_DIGOUT_NID, |
17070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17071 | .channel_mode = alc662_3ST_2ch_modes, | 17035 | .channel_mode = alc662_3ST_2ch_modes, |
17072 | .input_mux = &alc662_eeepc_capture_source, | ||
17073 | .unsol_event = alc663_mode3_unsol_event, | 17036 | .unsol_event = alc663_mode3_unsol_event, |
17037 | .setup = alc663_mode3_setup, | ||
17074 | .init_hook = alc663_mode3_inithook, | 17038 | .init_hook = alc663_mode3_inithook, |
17075 | }, | 17039 | }, |
17076 | [ALC663_ASUS_MODE4] = { | 17040 | [ALC663_ASUS_MODE4] = { |
@@ -17084,8 +17048,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17084 | .dig_out_nid = ALC662_DIGOUT_NID, | 17048 | .dig_out_nid = ALC662_DIGOUT_NID, |
17085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17049 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17086 | .channel_mode = alc662_3ST_2ch_modes, | 17050 | .channel_mode = alc662_3ST_2ch_modes, |
17087 | .input_mux = &alc662_eeepc_capture_source, | ||
17088 | .unsol_event = alc663_mode4_unsol_event, | 17051 | .unsol_event = alc663_mode4_unsol_event, |
17052 | .setup = alc663_mode4_setup, | ||
17089 | .init_hook = alc663_mode4_inithook, | 17053 | .init_hook = alc663_mode4_inithook, |
17090 | }, | 17054 | }, |
17091 | [ALC663_ASUS_MODE5] = { | 17055 | [ALC663_ASUS_MODE5] = { |
@@ -17099,8 +17063,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17099 | .dig_out_nid = ALC662_DIGOUT_NID, | 17063 | .dig_out_nid = ALC662_DIGOUT_NID, |
17100 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17064 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17101 | .channel_mode = alc662_3ST_2ch_modes, | 17065 | .channel_mode = alc662_3ST_2ch_modes, |
17102 | .input_mux = &alc662_eeepc_capture_source, | ||
17103 | .unsol_event = alc663_mode5_unsol_event, | 17066 | .unsol_event = alc663_mode5_unsol_event, |
17067 | .setup = alc663_mode5_setup, | ||
17104 | .init_hook = alc663_mode5_inithook, | 17068 | .init_hook = alc663_mode5_inithook, |
17105 | }, | 17069 | }, |
17106 | [ALC663_ASUS_MODE6] = { | 17070 | [ALC663_ASUS_MODE6] = { |
@@ -17114,8 +17078,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17114 | .dig_out_nid = ALC662_DIGOUT_NID, | 17078 | .dig_out_nid = ALC662_DIGOUT_NID, |
17115 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17079 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17116 | .channel_mode = alc662_3ST_2ch_modes, | 17080 | .channel_mode = alc662_3ST_2ch_modes, |
17117 | .input_mux = &alc662_eeepc_capture_source, | ||
17118 | .unsol_event = alc663_mode6_unsol_event, | 17081 | .unsol_event = alc663_mode6_unsol_event, |
17082 | .setup = alc663_mode6_setup, | ||
17119 | .init_hook = alc663_mode6_inithook, | 17083 | .init_hook = alc663_mode6_inithook, |
17120 | }, | 17084 | }, |
17121 | [ALC272_DELL] = { | 17085 | [ALC272_DELL] = { |
@@ -17129,8 +17093,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17129 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | 17093 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
17130 | .capsrc_nids = alc272_capsrc_nids, | 17094 | .capsrc_nids = alc272_capsrc_nids, |
17131 | .channel_mode = alc662_3ST_2ch_modes, | 17095 | .channel_mode = alc662_3ST_2ch_modes, |
17132 | .input_mux = &alc663_m51va_capture_source, | ||
17133 | .unsol_event = alc663_m51va_unsol_event, | 17096 | .unsol_event = alc663_m51va_unsol_event, |
17097 | .setup = alc663_m51va_setup, | ||
17134 | .init_hook = alc663_m51va_inithook, | 17098 | .init_hook = alc663_m51va_inithook, |
17135 | }, | 17099 | }, |
17136 | [ALC272_DELL_ZM1] = { | 17100 | [ALC272_DELL_ZM1] = { |
@@ -17141,11 +17105,11 @@ static struct alc_config_preset alc662_presets[] = { | |||
17141 | .dac_nids = alc662_dac_nids, | 17105 | .dac_nids = alc662_dac_nids, |
17142 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17106 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17143 | .adc_nids = alc662_adc_nids, | 17107 | .adc_nids = alc662_adc_nids, |
17144 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | 17108 | .num_adc_nids = 1, |
17145 | .capsrc_nids = alc662_capsrc_nids, | 17109 | .capsrc_nids = alc662_capsrc_nids, |
17146 | .channel_mode = alc662_3ST_2ch_modes, | 17110 | .channel_mode = alc662_3ST_2ch_modes, |
17147 | .input_mux = &alc663_m51va_capture_source, | ||
17148 | .unsol_event = alc663_m51va_unsol_event, | 17111 | .unsol_event = alc663_m51va_unsol_event, |
17112 | .setup = alc663_m51va_setup, | ||
17149 | .init_hook = alc663_m51va_inithook, | 17113 | .init_hook = alc663_m51va_inithook, |
17150 | }, | 17114 | }, |
17151 | [ALC272_SAMSUNG_NC10] = { | 17115 | [ALC272_SAMSUNG_NC10] = { |
@@ -17156,8 +17120,9 @@ static struct alc_config_preset alc662_presets[] = { | |||
17156 | .dac_nids = alc272_dac_nids, | 17120 | .dac_nids = alc272_dac_nids, |
17157 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17121 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17158 | .channel_mode = alc662_3ST_2ch_modes, | 17122 | .channel_mode = alc662_3ST_2ch_modes, |
17159 | .input_mux = &alc272_nc10_capture_source, | 17123 | /*.input_mux = &alc272_nc10_capture_source,*/ |
17160 | .unsol_event = alc663_mode4_unsol_event, | 17124 | .unsol_event = alc663_mode4_unsol_event, |
17125 | .setup = alc663_mode4_setup, | ||
17161 | .init_hook = alc663_mode4_inithook, | 17126 | .init_hook = alc663_mode4_inithook, |
17162 | }, | 17127 | }, |
17163 | }; | 17128 | }; |
@@ -17209,13 +17174,25 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
17209 | if (err < 0) | 17174 | if (err < 0) |
17210 | return err; | 17175 | return err; |
17211 | } else { | 17176 | } else { |
17212 | sprintf(name, "%s Playback Volume", chname[i]); | 17177 | const char *pfx; |
17178 | if (cfg->line_outs == 1 && | ||
17179 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
17180 | if (!cfg->hp_pins) | ||
17181 | pfx = "Speaker"; | ||
17182 | else | ||
17183 | pfx = "PCM"; | ||
17184 | } else | ||
17185 | pfx = chname[i]; | ||
17186 | sprintf(name, "%s Playback Volume", pfx); | ||
17213 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 17187 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
17214 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 17188 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
17215 | HDA_OUTPUT)); | 17189 | HDA_OUTPUT)); |
17216 | if (err < 0) | 17190 | if (err < 0) |
17217 | return err; | 17191 | return err; |
17218 | sprintf(name, "%s Playback Switch", chname[i]); | 17192 | if (cfg->line_outs == 1 && |
17193 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
17194 | pfx = "Speaker"; | ||
17195 | sprintf(name, "%s Playback Switch", pfx); | ||
17219 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 17196 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
17220 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), | 17197 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
17221 | 3, 0, HDA_INPUT)); | 17198 | 3, 0, HDA_INPUT)); |
@@ -17277,62 +17254,9 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |||
17277 | return 0; | 17254 | return 0; |
17278 | } | 17255 | } |
17279 | 17256 | ||
17280 | /* return the index of the src widget from the connection list of the nid. | ||
17281 | * return -1 if not found | ||
17282 | */ | ||
17283 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, | ||
17284 | hda_nid_t src) | ||
17285 | { | ||
17286 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
17287 | int i, conns; | ||
17288 | |||
17289 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
17290 | ARRAY_SIZE(conn_list)); | ||
17291 | if (conns < 0) | ||
17292 | return -1; | ||
17293 | for (i = 0; i < conns; i++) | ||
17294 | if (conn_list[i] == src) | ||
17295 | return i; | ||
17296 | return -1; | ||
17297 | } | ||
17298 | |||
17299 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
17300 | { | ||
17301 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
17302 | return (pincap & AC_PINCAP_IN) != 0; | ||
17303 | } | ||
17304 | |||
17305 | /* create playback/capture controls for input pins */ | 17257 | /* create playback/capture controls for input pins */ |
17306 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, | 17258 | #define alc662_auto_create_input_ctls \ |
17307 | const struct auto_pin_cfg *cfg) | 17259 | alc880_auto_create_input_ctls |
17308 | { | ||
17309 | struct alc_spec *spec = codec->spec; | ||
17310 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
17311 | int i, err, idx; | ||
17312 | |||
17313 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
17314 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { | ||
17315 | idx = alc662_input_pin_idx(codec, 0x0b, | ||
17316 | cfg->input_pins[i]); | ||
17317 | if (idx >= 0) { | ||
17318 | err = new_analog_input(spec, cfg->input_pins[i], | ||
17319 | auto_pin_cfg_labels[i], | ||
17320 | idx, 0x0b); | ||
17321 | if (err < 0) | ||
17322 | return err; | ||
17323 | } | ||
17324 | idx = alc662_input_pin_idx(codec, 0x22, | ||
17325 | cfg->input_pins[i]); | ||
17326 | if (idx >= 0) { | ||
17327 | imux->items[imux->num_items].label = | ||
17328 | auto_pin_cfg_labels[i]; | ||
17329 | imux->items[imux->num_items].index = idx; | ||
17330 | imux->num_items++; | ||
17331 | } | ||
17332 | } | ||
17333 | } | ||
17334 | return 0; | ||
17335 | } | ||
17336 | 17260 | ||
17337 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | 17261 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
17338 | hda_nid_t nid, int pin_type, | 17262 | hda_nid_t nid, int pin_type, |
@@ -17386,7 +17310,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) | |||
17386 | 17310 | ||
17387 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 17311 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
17388 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 17312 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
17389 | if (alc662_is_input_pin(codec, nid)) { | 17313 | if (alc_is_input_pin(codec, nid)) { |
17390 | alc_set_input_pin(codec, nid, i); | 17314 | alc_set_input_pin(codec, nid, i); |
17391 | if (nid != ALC662_PIN_CD_NID && | 17315 | if (nid != ALC662_PIN_CD_NID && |
17392 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 17316 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -17427,7 +17351,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
17427 | "Headphone"); | 17351 | "Headphone"); |
17428 | if (err < 0) | 17352 | if (err < 0) |
17429 | return err; | 17353 | return err; |
17430 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); | 17354 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
17431 | if (err < 0) | 17355 | if (err < 0) |
17432 | return err; | 17356 | return err; |
17433 | 17357 | ||
@@ -17484,8 +17408,8 @@ static int patch_alc662(struct hda_codec *codec) | |||
17484 | alc662_models, | 17408 | alc662_models, |
17485 | alc662_cfg_tbl); | 17409 | alc662_cfg_tbl); |
17486 | if (board_config < 0) { | 17410 | if (board_config < 0) { |
17487 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 17411 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
17488 | "trying auto-probe from BIOS...\n", codec->chip_name); | 17412 | codec->chip_name); |
17489 | board_config = ALC662_AUTO; | 17413 | board_config = ALC662_AUTO; |
17490 | } | 17414 | } |
17491 | 17415 | ||
@@ -17510,7 +17434,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
17510 | } | 17434 | } |
17511 | 17435 | ||
17512 | if (board_config != ALC662_AUTO) | 17436 | if (board_config != ALC662_AUTO) |
17513 | setup_preset(spec, &alc662_presets[board_config]); | 17437 | setup_preset(codec, &alc662_presets[board_config]); |
17514 | 17438 | ||
17515 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | 17439 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
17516 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | 17440 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
@@ -17526,7 +17450,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
17526 | spec->capsrc_nids = alc662_capsrc_nids; | 17450 | spec->capsrc_nids = alc662_capsrc_nids; |
17527 | 17451 | ||
17528 | if (!spec->cap_mixer) | 17452 | if (!spec->cap_mixer) |
17529 | set_capture_mixer(spec); | 17453 | set_capture_mixer(codec); |
17530 | if (codec->vendor_id == 0x10ec0662) | 17454 | if (codec->vendor_id == 0x10ec0662) |
17531 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 17455 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
17532 | else | 17456 | else |
@@ -17562,23 +17486,23 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
17562 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | 17486 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
17563 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | 17487 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
17564 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | 17488 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
17565 | .patch = patch_alc883 }, | 17489 | .patch = patch_alc882 }, |
17566 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | 17490 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
17567 | .patch = patch_alc662 }, | 17491 | .patch = patch_alc662 }, |
17568 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | 17492 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
17569 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 17493 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
17570 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 17494 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
17571 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, | 17495 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
17572 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | 17496 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
17573 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 17497 | .patch = patch_alc882 }, |
17574 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 17498 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
17575 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 17499 | .patch = patch_alc882 }, |
17576 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 17500 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
17577 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, | 17501 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
17578 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 17502 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
17579 | .patch = patch_alc883 }, | 17503 | .patch = patch_alc882 }, |
17580 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | 17504 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
17581 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 17505 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
17582 | {} /* terminator */ | 17506 | {} /* terminator */ |
17583 | }; | 17507 | }; |
17584 | 17508 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6990cfcb6a38..e31e53dc6962 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -40,6 +40,8 @@ enum { | |||
40 | STAC_INSERT_EVENT, | 40 | STAC_INSERT_EVENT, |
41 | STAC_PWR_EVENT, | 41 | STAC_PWR_EVENT, |
42 | STAC_HP_EVENT, | 42 | STAC_HP_EVENT, |
43 | STAC_LO_EVENT, | ||
44 | STAC_MIC_EVENT, | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | enum { | 47 | enum { |
@@ -81,6 +83,7 @@ enum { | |||
81 | STAC_DELL_M6_DMIC, | 83 | STAC_DELL_M6_DMIC, |
82 | STAC_DELL_M6_BOTH, | 84 | STAC_DELL_M6_BOTH, |
83 | STAC_DELL_EQ, | 85 | STAC_DELL_EQ, |
86 | STAC_ALIENWARE_M17X, | ||
84 | STAC_92HD73XX_MODELS | 87 | STAC_92HD73XX_MODELS |
85 | }; | 88 | }; |
86 | 89 | ||
@@ -177,6 +180,12 @@ struct sigmatel_jack { | |||
177 | struct snd_jack *jack; | 180 | struct snd_jack *jack; |
178 | }; | 181 | }; |
179 | 182 | ||
183 | struct sigmatel_mic_route { | ||
184 | hda_nid_t pin; | ||
185 | unsigned char mux_idx; | ||
186 | unsigned char dmux_idx; | ||
187 | }; | ||
188 | |||
180 | struct sigmatel_spec { | 189 | struct sigmatel_spec { |
181 | struct snd_kcontrol_new *mixers[4]; | 190 | struct snd_kcontrol_new *mixers[4]; |
182 | unsigned int num_mixers; | 191 | unsigned int num_mixers; |
@@ -188,6 +197,7 @@ struct sigmatel_spec { | |||
188 | unsigned int hp_detect: 1; | 197 | unsigned int hp_detect: 1; |
189 | unsigned int spdif_mute: 1; | 198 | unsigned int spdif_mute: 1; |
190 | unsigned int check_volume_offset:1; | 199 | unsigned int check_volume_offset:1; |
200 | unsigned int auto_mic:1; | ||
191 | 201 | ||
192 | /* gpio lines */ | 202 | /* gpio lines */ |
193 | unsigned int eapd_mask; | 203 | unsigned int eapd_mask; |
@@ -219,7 +229,6 @@ struct sigmatel_spec { | |||
219 | 229 | ||
220 | /* playback */ | 230 | /* playback */ |
221 | struct hda_input_mux *mono_mux; | 231 | struct hda_input_mux *mono_mux; |
222 | struct hda_input_mux *amp_mux; | ||
223 | unsigned int cur_mmux; | 232 | unsigned int cur_mmux; |
224 | struct hda_multi_out multiout; | 233 | struct hda_multi_out multiout; |
225 | hda_nid_t dac_nids[5]; | 234 | hda_nid_t dac_nids[5]; |
@@ -239,6 +248,15 @@ struct sigmatel_spec { | |||
239 | unsigned int num_dmuxes; | 248 | unsigned int num_dmuxes; |
240 | hda_nid_t *smux_nids; | 249 | hda_nid_t *smux_nids; |
241 | unsigned int num_smuxes; | 250 | unsigned int num_smuxes; |
251 | unsigned int num_analog_muxes; | ||
252 | |||
253 | unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ | ||
254 | unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ | ||
255 | unsigned int num_caps; /* number of capture volume/switch elements */ | ||
256 | |||
257 | struct sigmatel_mic_route ext_mic; | ||
258 | struct sigmatel_mic_route int_mic; | ||
259 | |||
242 | const char **spdif_labels; | 260 | const char **spdif_labels; |
243 | 261 | ||
244 | hda_nid_t dig_in_nid; | 262 | hda_nid_t dig_in_nid; |
@@ -263,7 +281,6 @@ struct sigmatel_spec { | |||
263 | unsigned int cur_smux[2]; | 281 | unsigned int cur_smux[2]; |
264 | unsigned int cur_amux; | 282 | unsigned int cur_amux; |
265 | hda_nid_t *amp_nids; | 283 | hda_nid_t *amp_nids; |
266 | unsigned int num_amps; | ||
267 | unsigned int powerdown_adcs; | 284 | unsigned int powerdown_adcs; |
268 | 285 | ||
269 | /* i/o switches */ | 286 | /* i/o switches */ |
@@ -282,7 +299,6 @@ struct sigmatel_spec { | |||
282 | struct hda_input_mux private_dimux; | 299 | struct hda_input_mux private_dimux; |
283 | struct hda_input_mux private_imux; | 300 | struct hda_input_mux private_imux; |
284 | struct hda_input_mux private_smux; | 301 | struct hda_input_mux private_smux; |
285 | struct hda_input_mux private_amp_mux; | ||
286 | struct hda_input_mux private_mono_mux; | 302 | struct hda_input_mux private_mono_mux; |
287 | }; | 303 | }; |
288 | 304 | ||
@@ -311,11 +327,6 @@ static hda_nid_t stac92hd73xx_adc_nids[2] = { | |||
311 | 0x1a, 0x1b | 327 | 0x1a, 0x1b |
312 | }; | 328 | }; |
313 | 329 | ||
314 | #define DELL_M6_AMP 2 | ||
315 | static hda_nid_t stac92hd73xx_amp_nids[3] = { | ||
316 | 0x0b, 0x0c, 0x0e | ||
317 | }; | ||
318 | |||
319 | #define STAC92HD73XX_NUM_DMICS 2 | 330 | #define STAC92HD73XX_NUM_DMICS 2 |
320 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { | 331 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
321 | 0x13, 0x14, 0 | 332 | 0x13, 0x14, 0 |
@@ -323,8 +334,8 @@ static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { | |||
323 | 334 | ||
324 | #define STAC92HD73_DAC_COUNT 5 | 335 | #define STAC92HD73_DAC_COUNT 5 |
325 | 336 | ||
326 | static hda_nid_t stac92hd73xx_mux_nids[4] = { | 337 | static hda_nid_t stac92hd73xx_mux_nids[2] = { |
327 | 0x28, 0x29, 0x2a, 0x2b, | 338 | 0x20, 0x21, |
328 | }; | 339 | }; |
329 | 340 | ||
330 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { | 341 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
@@ -335,14 +346,16 @@ static hda_nid_t stac92hd73xx_smux_nids[2] = { | |||
335 | 0x22, 0x23, | 346 | 0x22, 0x23, |
336 | }; | 347 | }; |
337 | 348 | ||
338 | #define STAC92HD83XXX_NUM_DMICS 2 | 349 | #define STAC92HD73XX_NUM_CAPS 2 |
339 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { | 350 | static unsigned long stac92hd73xx_capvols[] = { |
340 | 0x11, 0x12, 0 | 351 | HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT), |
352 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
341 | }; | 353 | }; |
354 | #define stac92hd73xx_capsws stac92hd73xx_capvols | ||
342 | 355 | ||
343 | #define STAC92HD83_DAC_COUNT 3 | 356 | #define STAC92HD83_DAC_COUNT 3 |
344 | 357 | ||
345 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { | 358 | static hda_nid_t stac92hd83xxx_mux_nids[2] = { |
346 | 0x17, 0x18, | 359 | 0x17, 0x18, |
347 | }; | 360 | }; |
348 | 361 | ||
@@ -362,9 +375,12 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = { | |||
362 | 0x03, 0x0c, 0x20, 0x40, | 375 | 0x03, 0x0c, 0x20, 0x40, |
363 | }; | 376 | }; |
364 | 377 | ||
365 | static hda_nid_t stac92hd83xxx_amp_nids[1] = { | 378 | #define STAC92HD83XXX_NUM_CAPS 2 |
366 | 0xc, | 379 | static unsigned long stac92hd83xxx_capvols[] = { |
380 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
381 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_OUTPUT), | ||
367 | }; | 382 | }; |
383 | #define stac92hd83xxx_capsws stac92hd83xxx_capvols | ||
368 | 384 | ||
369 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { | 385 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
370 | 0x0a, 0x0d, 0x0f | 386 | 0x0a, 0x0d, 0x0f |
@@ -395,6 +411,13 @@ static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { | |||
395 | 0x22, 0 | 411 | 0x22, 0 |
396 | }; | 412 | }; |
397 | 413 | ||
414 | #define STAC92HD71BXX_NUM_CAPS 2 | ||
415 | static unsigned long stac92hd71bxx_capvols[] = { | ||
416 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), | ||
417 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), | ||
418 | }; | ||
419 | #define stac92hd71bxx_capsws stac92hd71bxx_capvols | ||
420 | |||
398 | static hda_nid_t stac925x_adc_nids[1] = { | 421 | static hda_nid_t stac925x_adc_nids[1] = { |
399 | 0x03, | 422 | 0x03, |
400 | }; | 423 | }; |
@@ -416,6 +439,13 @@ static hda_nid_t stac925x_dmux_nids[1] = { | |||
416 | 0x14, | 439 | 0x14, |
417 | }; | 440 | }; |
418 | 441 | ||
442 | static unsigned long stac925x_capvols[] = { | ||
443 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | ||
444 | }; | ||
445 | static unsigned long stac925x_capsws[] = { | ||
446 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
447 | }; | ||
448 | |||
419 | static hda_nid_t stac922x_adc_nids[2] = { | 449 | static hda_nid_t stac922x_adc_nids[2] = { |
420 | 0x06, 0x07, | 450 | 0x06, 0x07, |
421 | }; | 451 | }; |
@@ -424,6 +454,13 @@ static hda_nid_t stac922x_mux_nids[2] = { | |||
424 | 0x12, 0x13, | 454 | 0x12, 0x13, |
425 | }; | 455 | }; |
426 | 456 | ||
457 | #define STAC922X_NUM_CAPS 2 | ||
458 | static unsigned long stac922x_capvols[] = { | ||
459 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT), | ||
460 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), | ||
461 | }; | ||
462 | #define stac922x_capsws stac922x_capvols | ||
463 | |||
427 | static hda_nid_t stac927x_slave_dig_outs[2] = { | 464 | static hda_nid_t stac927x_slave_dig_outs[2] = { |
428 | 0x1f, 0, | 465 | 0x1f, 0, |
429 | }; | 466 | }; |
@@ -453,6 +490,18 @@ static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { | |||
453 | 0x13, 0x14, 0 | 490 | 0x13, 0x14, 0 |
454 | }; | 491 | }; |
455 | 492 | ||
493 | #define STAC927X_NUM_CAPS 3 | ||
494 | static unsigned long stac927x_capvols[] = { | ||
495 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), | ||
496 | HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT), | ||
497 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT), | ||
498 | }; | ||
499 | static unsigned long stac927x_capsws[] = { | ||
500 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
501 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), | ||
502 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), | ||
503 | }; | ||
504 | |||
456 | static const char *stac927x_spdif_labels[5] = { | 505 | static const char *stac927x_spdif_labels[5] = { |
457 | "Digital Playback", "ADAT", "Analog Mux 1", | 506 | "Digital Playback", "ADAT", "Analog Mux 1", |
458 | "Analog Mux 2", "Analog Mux 3" | 507 | "Analog Mux 2", "Analog Mux 3" |
@@ -479,6 +528,16 @@ static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { | |||
479 | 0x17, 0x18, 0 | 528 | 0x17, 0x18, 0 |
480 | }; | 529 | }; |
481 | 530 | ||
531 | #define STAC9205_NUM_CAPS 2 | ||
532 | static unsigned long stac9205_capvols[] = { | ||
533 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT), | ||
534 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT), | ||
535 | }; | ||
536 | static unsigned long stac9205_capsws[] = { | ||
537 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), | ||
538 | HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT), | ||
539 | }; | ||
540 | |||
482 | static hda_nid_t stac9200_pin_nids[8] = { | 541 | static hda_nid_t stac9200_pin_nids[8] = { |
483 | 0x08, 0x09, 0x0d, 0x0e, | 542 | 0x08, 0x09, 0x0d, 0x0e, |
484 | 0x0f, 0x10, 0x11, 0x12, | 543 | 0x0f, 0x10, 0x11, 0x12, |
@@ -529,34 +588,6 @@ static hda_nid_t stac9205_pin_nids[12] = { | |||
529 | 0x21, 0x22, | 588 | 0x21, 0x22, |
530 | }; | 589 | }; |
531 | 590 | ||
532 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info | ||
533 | |||
534 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, | ||
535 | struct snd_ctl_elem_value *ucontrol) | ||
536 | { | ||
537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
538 | struct sigmatel_spec *spec = codec->spec; | ||
539 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; | ||
540 | |||
541 | kcontrol->private_value ^= get_amp_nid(kcontrol); | ||
542 | kcontrol->private_value |= nid; | ||
543 | |||
544 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); | ||
545 | } | ||
546 | |||
547 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, | ||
548 | struct snd_ctl_elem_value *ucontrol) | ||
549 | { | ||
550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
551 | struct sigmatel_spec *spec = codec->spec; | ||
552 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; | ||
553 | |||
554 | kcontrol->private_value ^= get_amp_nid(kcontrol); | ||
555 | kcontrol->private_value |= nid; | ||
556 | |||
557 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); | ||
558 | } | ||
559 | |||
560 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, | 591 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
561 | struct snd_ctl_elem_info *uinfo) | 592 | struct snd_ctl_elem_info *uinfo) |
562 | { | 593 | { |
@@ -693,9 +724,35 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
693 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 724 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
694 | struct sigmatel_spec *spec = codec->spec; | 725 | struct sigmatel_spec *spec = codec->spec; |
695 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 726 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
696 | 727 | const struct hda_input_mux *imux = spec->input_mux; | |
697 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 728 | unsigned int idx, prev_idx; |
698 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); | 729 | |
730 | idx = ucontrol->value.enumerated.item[0]; | ||
731 | if (idx >= imux->num_items) | ||
732 | idx = imux->num_items - 1; | ||
733 | prev_idx = spec->cur_mux[adc_idx]; | ||
734 | if (prev_idx == idx) | ||
735 | return 0; | ||
736 | if (idx < spec->num_analog_muxes) { | ||
737 | snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0, | ||
738 | AC_VERB_SET_CONNECT_SEL, | ||
739 | imux->items[idx].index); | ||
740 | if (prev_idx >= spec->num_analog_muxes) { | ||
741 | imux = spec->dinput_mux; | ||
742 | /* 0 = analog */ | ||
743 | snd_hda_codec_write_cache(codec, | ||
744 | spec->dmux_nids[adc_idx], 0, | ||
745 | AC_VERB_SET_CONNECT_SEL, | ||
746 | imux->items[0].index); | ||
747 | } | ||
748 | } else { | ||
749 | imux = spec->dinput_mux; | ||
750 | snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0, | ||
751 | AC_VERB_SET_CONNECT_SEL, | ||
752 | imux->items[idx - 1].index); | ||
753 | } | ||
754 | spec->cur_mux[adc_idx] = idx; | ||
755 | return 1; | ||
699 | } | 756 | } |
700 | 757 | ||
701 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, | 758 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
@@ -726,41 +783,6 @@ static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
726 | spec->mono_nid, &spec->cur_mmux); | 783 | spec->mono_nid, &spec->cur_mmux); |
727 | } | 784 | } |
728 | 785 | ||
729 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, | ||
730 | struct snd_ctl_elem_info *uinfo) | ||
731 | { | ||
732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
733 | struct sigmatel_spec *spec = codec->spec; | ||
734 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); | ||
735 | } | ||
736 | |||
737 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, | ||
738 | struct snd_ctl_elem_value *ucontrol) | ||
739 | { | ||
740 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
741 | struct sigmatel_spec *spec = codec->spec; | ||
742 | |||
743 | ucontrol->value.enumerated.item[0] = spec->cur_amux; | ||
744 | return 0; | ||
745 | } | ||
746 | |||
747 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
748 | struct snd_ctl_elem_value *ucontrol) | ||
749 | { | ||
750 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
751 | struct sigmatel_spec *spec = codec->spec; | ||
752 | struct snd_kcontrol *ctl = | ||
753 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); | ||
754 | if (!ctl) | ||
755 | return -EINVAL; | ||
756 | |||
757 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | | ||
758 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
759 | |||
760 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, | ||
761 | 0, &spec->cur_amux); | ||
762 | } | ||
763 | |||
764 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info | 786 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
765 | 787 | ||
766 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, | 788 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
@@ -828,84 +850,16 @@ static struct hda_verb stac9200_eapd_init[] = { | |||
828 | {} | 850 | {} |
829 | }; | 851 | }; |
830 | 852 | ||
831 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { | ||
832 | /* set master volume and direct control */ | ||
833 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | ||
834 | /* setup adcs to point to mixer */ | ||
835 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
836 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
837 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
838 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
839 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
840 | /* setup import muxs */ | ||
841 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
842 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
843 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
844 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
845 | {} | ||
846 | }; | ||
847 | |||
848 | static struct hda_verb dell_eq_core_init[] = { | 853 | static struct hda_verb dell_eq_core_init[] = { |
849 | /* set master volume to max value without distortion | 854 | /* set master volume to max value without distortion |
850 | * and direct control */ | 855 | * and direct control */ |
851 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, | 856 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
852 | /* setup adcs to point to mixer */ | ||
853 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
854 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
855 | /* setup import muxs */ | ||
856 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
857 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
858 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
859 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
860 | {} | ||
861 | }; | ||
862 | |||
863 | static struct hda_verb dell_m6_core_init[] = { | ||
864 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | ||
865 | /* setup adcs to point to mixer */ | ||
866 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
867 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
868 | /* setup import muxs */ | ||
869 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
870 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
871 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
872 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
873 | {} | ||
874 | }; | ||
875 | |||
876 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { | ||
877 | /* set master volume and direct control */ | ||
878 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | ||
879 | /* setup adcs to point to mixer */ | ||
880 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
881 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
882 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
883 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
884 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
885 | /* setup import muxs */ | ||
886 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
887 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
888 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
889 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
890 | {} | 857 | {} |
891 | }; | 858 | }; |
892 | 859 | ||
893 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { | 860 | static struct hda_verb stac92hd73xx_core_init[] = { |
894 | /* set master volume and direct control */ | 861 | /* set master volume and direct control */ |
895 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 862 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
896 | /* dac3 is connected to import3 mux */ | ||
897 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, | ||
898 | /* setup adcs to point to mixer */ | ||
899 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
900 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
901 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
902 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
903 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
904 | /* setup import muxs */ | ||
905 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
906 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
907 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
908 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
909 | {} | 863 | {} |
910 | }; | 864 | }; |
911 | 865 | ||
@@ -925,19 +879,6 @@ static struct hda_verb stac92hd71bxx_core_init[] = { | |||
925 | {} | 879 | {} |
926 | }; | 880 | }; |
927 | 881 | ||
928 | #define HD_DISABLE_PORTF 1 | ||
929 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { | ||
930 | /* start of config #1 */ | ||
931 | |||
932 | /* connect port 0f to audio mixer */ | ||
933 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, | ||
934 | /* start of config #2 */ | ||
935 | |||
936 | /* set master volume and direct control */ | ||
937 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | ||
938 | {} | ||
939 | }; | ||
940 | |||
941 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { | 882 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
942 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ | 883 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
943 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 884 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -996,31 +937,6 @@ static struct hda_verb stac9205_core_init[] = { | |||
996 | .put = stac92xx_mono_mux_enum_put, \ | 937 | .put = stac92xx_mono_mux_enum_put, \ |
997 | } | 938 | } |
998 | 939 | ||
999 | #define STAC_AMP_MUX \ | ||
1000 | { \ | ||
1001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
1002 | .name = "Amp Selector Capture Switch", \ | ||
1003 | .count = 1, \ | ||
1004 | .info = stac92xx_amp_mux_enum_info, \ | ||
1005 | .get = stac92xx_amp_mux_enum_get, \ | ||
1006 | .put = stac92xx_amp_mux_enum_put, \ | ||
1007 | } | ||
1008 | |||
1009 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ | ||
1010 | { \ | ||
1011 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
1012 | .name = xname, \ | ||
1013 | .index = 0, \ | ||
1014 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
1015 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
1016 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | ||
1017 | .info = stac92xx_amp_volume_info, \ | ||
1018 | .get = stac92xx_amp_volume_get, \ | ||
1019 | .put = stac92xx_amp_volume_put, \ | ||
1020 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ | ||
1021 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ | ||
1022 | } | ||
1023 | |||
1024 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ | 940 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
1025 | { \ | 941 | { \ |
1026 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -1051,34 +967,6 @@ static struct snd_kcontrol_new stac9200_mixer[] = { | |||
1051 | { } /* end */ | 967 | { } /* end */ |
1052 | }; | 968 | }; |
1053 | 969 | ||
1054 | #define DELL_M6_MIXER 6 | ||
1055 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { | ||
1056 | /* start of config #1 */ | ||
1057 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), | ||
1058 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), | ||
1059 | |||
1060 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), | ||
1061 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), | ||
1062 | |||
1063 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | ||
1064 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | ||
1065 | |||
1066 | /* start of config #2 */ | ||
1067 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
1068 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
1069 | |||
1070 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | ||
1071 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | ||
1072 | |||
1073 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1074 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1075 | |||
1076 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1077 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1078 | |||
1079 | { } /* end */ | ||
1080 | }; | ||
1081 | |||
1082 | static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { | 970 | static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
1083 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), | 971 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
1084 | {} | 972 | {} |
@@ -1094,134 +982,14 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { | |||
1094 | {} | 982 | {} |
1095 | }; | 983 | }; |
1096 | 984 | ||
1097 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { | ||
1098 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1099 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1100 | |||
1101 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1102 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1103 | |||
1104 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), | ||
1105 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), | ||
1106 | |||
1107 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
1108 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
1109 | |||
1110 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), | ||
1111 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), | ||
1112 | |||
1113 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | ||
1114 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | ||
1115 | |||
1116 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | ||
1117 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | ||
1118 | { } /* end */ | ||
1119 | }; | ||
1120 | |||
1121 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { | ||
1122 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1123 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1124 | |||
1125 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1126 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1127 | |||
1128 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), | ||
1129 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), | ||
1130 | |||
1131 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
1132 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
1133 | |||
1134 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), | ||
1135 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), | ||
1136 | |||
1137 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | ||
1138 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | ||
1139 | |||
1140 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | ||
1141 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | ||
1142 | { } /* end */ | ||
1143 | }; | ||
1144 | |||
1145 | |||
1146 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { | ||
1147 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1148 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1149 | |||
1150 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1151 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1152 | |||
1153 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), | ||
1154 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), | ||
1155 | |||
1156 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT), | ||
1157 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT), | ||
1158 | |||
1159 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT), | ||
1160 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT), | ||
1161 | |||
1162 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT), | ||
1163 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT), | ||
1164 | |||
1165 | /* | ||
1166 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT), | ||
1167 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT), | ||
1168 | */ | ||
1169 | { } /* end */ | ||
1170 | }; | ||
1171 | |||
1172 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | ||
1173 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | ||
1174 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | ||
1175 | |||
1176 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | ||
1177 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | ||
1178 | /* analog pc-beep replaced with digital beep support */ | ||
1179 | /* | ||
1180 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), | ||
1181 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), | ||
1182 | */ | ||
1183 | |||
1184 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), | ||
1185 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), | ||
1186 | |||
1187 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), | ||
1188 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), | ||
1189 | |||
1190 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), | ||
1191 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), | ||
1192 | |||
1193 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), | ||
1194 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), | ||
1195 | { } /* end */ | ||
1196 | }; | ||
1197 | 985 | ||
1198 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { | 986 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
1199 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) | 987 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
1200 | }; | 988 | }; |
1201 | 989 | ||
1202 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | ||
1203 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | ||
1204 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | ||
1205 | |||
1206 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | ||
1207 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | ||
1208 | { } /* end */ | ||
1209 | }; | ||
1210 | |||
1211 | static struct snd_kcontrol_new stac925x_mixer[] = { | 990 | static struct snd_kcontrol_new stac925x_mixer[] = { |
1212 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), | 991 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), |
1213 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), | 992 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), |
1214 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), | ||
1215 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), | ||
1216 | { } /* end */ | ||
1217 | }; | ||
1218 | |||
1219 | static struct snd_kcontrol_new stac9205_mixer[] = { | ||
1220 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), | ||
1221 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), | ||
1222 | |||
1223 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), | ||
1224 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), | ||
1225 | { } /* end */ | 993 | { } /* end */ |
1226 | }; | 994 | }; |
1227 | 995 | ||
@@ -1230,29 +998,6 @@ static struct snd_kcontrol_new stac9205_loopback[] = { | |||
1230 | {} | 998 | {} |
1231 | }; | 999 | }; |
1232 | 1000 | ||
1233 | /* This needs to be generated dynamically based on sequence */ | ||
1234 | static struct snd_kcontrol_new stac922x_mixer[] = { | ||
1235 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), | ||
1236 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), | ||
1237 | |||
1238 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), | ||
1239 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), | ||
1240 | { } /* end */ | ||
1241 | }; | ||
1242 | |||
1243 | |||
1244 | static struct snd_kcontrol_new stac927x_mixer[] = { | ||
1245 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), | ||
1246 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), | ||
1247 | |||
1248 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), | ||
1249 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), | ||
1250 | |||
1251 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), | ||
1252 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), | ||
1253 | { } /* end */ | ||
1254 | }; | ||
1255 | |||
1256 | static struct snd_kcontrol_new stac927x_loopback[] = { | 1001 | static struct snd_kcontrol_new stac927x_loopback[] = { |
1257 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), | 1002 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
1258 | {} | 1003 | {} |
@@ -1310,16 +1055,19 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1310 | int err; | 1055 | int err; |
1311 | int i; | 1056 | int i; |
1312 | 1057 | ||
1313 | err = snd_hda_add_new_ctls(codec, spec->mixer); | 1058 | if (spec->mixer) { |
1314 | if (err < 0) | 1059 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
1315 | return err; | 1060 | if (err < 0) |
1061 | return err; | ||
1062 | } | ||
1316 | 1063 | ||
1317 | for (i = 0; i < spec->num_mixers; i++) { | 1064 | for (i = 0; i < spec->num_mixers; i++) { |
1318 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | 1065 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
1319 | if (err < 0) | 1066 | if (err < 0) |
1320 | return err; | 1067 | return err; |
1321 | } | 1068 | } |
1322 | if (spec->num_dmuxes > 0) { | 1069 | if (!spec->auto_mic && spec->num_dmuxes > 0 && |
1070 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { | ||
1323 | stac_dmux_mixer.count = spec->num_dmuxes; | 1071 | stac_dmux_mixer.count = spec->num_dmuxes; |
1324 | err = snd_hda_ctl_add(codec, | 1072 | err = snd_hda_ctl_add(codec, |
1325 | snd_ctl_new1(&stac_dmux_mixer, codec)); | 1073 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
@@ -1766,12 +1514,20 @@ static unsigned int dell_m6_pin_configs[13] = { | |||
1766 | 0x4f0000f0, | 1514 | 0x4f0000f0, |
1767 | }; | 1515 | }; |
1768 | 1516 | ||
1517 | static unsigned int alienware_m17x_pin_configs[13] = { | ||
1518 | 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, | ||
1519 | 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, | ||
1520 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, | ||
1521 | 0x904601b0, | ||
1522 | }; | ||
1523 | |||
1769 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1524 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1770 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1525 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1771 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, | 1526 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
1772 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, | 1527 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
1773 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, | 1528 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
1774 | [STAC_DELL_EQ] = dell_m6_pin_configs, | 1529 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
1530 | [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, | ||
1775 | }; | 1531 | }; |
1776 | 1532 | ||
1777 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1533 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
@@ -1783,6 +1539,7 @@ static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | |||
1783 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", | 1539 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
1784 | [STAC_DELL_M6_BOTH] = "dell-m6", | 1540 | [STAC_DELL_M6_BOTH] = "dell-m6", |
1785 | [STAC_DELL_EQ] = "dell-eq", | 1541 | [STAC_DELL_EQ] = "dell-eq", |
1542 | [STAC_ALIENWARE_M17X] = "alienware", | ||
1786 | }; | 1543 | }; |
1787 | 1544 | ||
1788 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | 1545 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
@@ -1820,6 +1577,12 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1820 | {} /* terminator */ | 1577 | {} /* terminator */ |
1821 | }; | 1578 | }; |
1822 | 1579 | ||
1580 | static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { | ||
1581 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, | ||
1582 | "Alienware M17x", STAC_ALIENWARE_M17X), | ||
1583 | {} /* terminator */ | ||
1584 | }; | ||
1585 | |||
1823 | static unsigned int ref92hd83xxx_pin_configs[10] = { | 1586 | static unsigned int ref92hd83xxx_pin_configs[10] = { |
1824 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, | 1587 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
1825 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, | 1588 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
@@ -1927,6 +1690,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1927 | "HP mini 1000", STAC_HP_M4), | 1690 | "HP mini 1000", STAC_HP_M4), |
1928 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, | 1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, |
1929 | "HP HDX", STAC_HP_HDX), /* HDX16 */ | 1692 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
1693 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, | ||
1694 | "HP", STAC_HP_DV5), | ||
1930 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
1931 | "unknown Dell", STAC_DELL_M4_1), | 1696 | "unknown Dell", STAC_DELL_M4_1), |
1932 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, | 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
@@ -2642,8 +2407,7 @@ static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | |||
2642 | return 0; | 2407 | return 0; |
2643 | } | 2408 | } |
2644 | 2409 | ||
2645 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, | 2410 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid); |
2646 | unsigned char type); | ||
2647 | 2411 | ||
2648 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | 2412 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
2649 | struct snd_ctl_elem_value *ucontrol) | 2413 | struct snd_ctl_elem_value *ucontrol) |
@@ -2657,7 +2421,7 @@ static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
2657 | /* check to be sure that the ports are upto date with | 2421 | /* check to be sure that the ports are upto date with |
2658 | * switch changes | 2422 | * switch changes |
2659 | */ | 2423 | */ |
2660 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); | 2424 | stac_issue_unsol_event(codec, nid); |
2661 | 2425 | ||
2662 | return 1; | 2426 | return 1; |
2663 | } | 2427 | } |
@@ -2790,7 +2554,7 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
2790 | * appropriately according to the pin direction | 2554 | * appropriately according to the pin direction |
2791 | */ | 2555 | */ |
2792 | if (spec->hp_detect) | 2556 | if (spec->hp_detect) |
2793 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); | 2557 | stac_issue_unsol_event(codec, nid); |
2794 | 2558 | ||
2795 | return 1; | 2559 | return 1; |
2796 | } | 2560 | } |
@@ -2859,8 +2623,6 @@ enum { | |||
2859 | STAC_CTL_WIDGET_VOL, | 2623 | STAC_CTL_WIDGET_VOL, |
2860 | STAC_CTL_WIDGET_MUTE, | 2624 | STAC_CTL_WIDGET_MUTE, |
2861 | STAC_CTL_WIDGET_MONO_MUX, | 2625 | STAC_CTL_WIDGET_MONO_MUX, |
2862 | STAC_CTL_WIDGET_AMP_MUX, | ||
2863 | STAC_CTL_WIDGET_AMP_VOL, | ||
2864 | STAC_CTL_WIDGET_HP_SWITCH, | 2626 | STAC_CTL_WIDGET_HP_SWITCH, |
2865 | STAC_CTL_WIDGET_IO_SWITCH, | 2627 | STAC_CTL_WIDGET_IO_SWITCH, |
2866 | STAC_CTL_WIDGET_CLFE_SWITCH, | 2628 | STAC_CTL_WIDGET_CLFE_SWITCH, |
@@ -2871,8 +2633,6 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2871 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 2633 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2872 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 2634 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
2873 | STAC_MONO_MUX, | 2635 | STAC_MONO_MUX, |
2874 | STAC_AMP_MUX, | ||
2875 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), | ||
2876 | STAC_CODEC_HP_SWITCH(NULL), | 2636 | STAC_CODEC_HP_SWITCH(NULL), |
2877 | STAC_CODEC_IO_SWITCH(NULL, 0), | 2637 | STAC_CODEC_IO_SWITCH(NULL, 0), |
2878 | STAC_CODEC_CLFE_SWITCH(NULL, 0), | 2638 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
@@ -2973,6 +2733,8 @@ static int stac92xx_add_input_source(struct sigmatel_spec *spec) | |||
2973 | struct snd_kcontrol_new *knew; | 2733 | struct snd_kcontrol_new *knew; |
2974 | struct hda_input_mux *imux = &spec->private_imux; | 2734 | struct hda_input_mux *imux = &spec->private_imux; |
2975 | 2735 | ||
2736 | if (spec->auto_mic) | ||
2737 | return 0; /* no need for input source */ | ||
2976 | if (!spec->num_adcs || imux->num_items <= 1) | 2738 | if (!spec->num_adcs || imux->num_items <= 1) |
2977 | return 0; /* no need for input source control */ | 2739 | return 0; /* no need for input source control */ |
2978 | knew = stac_control_new(spec, &stac_input_src_temp, | 2740 | knew = stac_control_new(spec, &stac_input_src_temp, |
@@ -3066,7 +2828,7 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) | |||
3066 | HDA_MAX_CONNECTIONS); | 2828 | HDA_MAX_CONNECTIONS); |
3067 | for (j = 0; j < conn_len; j++) { | 2829 | for (j = 0; j < conn_len; j++) { |
3068 | wcaps = get_wcaps(codec, conn[j]); | 2830 | wcaps = get_wcaps(codec, conn[j]); |
3069 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 2831 | wtype = get_wcaps_type(wcaps); |
3070 | /* we check only analog outputs */ | 2832 | /* we check only analog outputs */ |
3071 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) | 2833 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
3072 | continue; | 2834 | continue; |
@@ -3325,6 +3087,21 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, | |||
3325 | return 0; | 3087 | return 0; |
3326 | } | 3088 | } |
3327 | 3089 | ||
3090 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, | ||
3091 | unsigned long sw, int idx) | ||
3092 | { | ||
3093 | int err; | ||
3094 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, | ||
3095 | "Capture Volume", vol); | ||
3096 | if (err < 0) | ||
3097 | return err; | ||
3098 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, | ||
3099 | "Capture Switch", sw); | ||
3100 | if (err < 0) | ||
3101 | return err; | ||
3102 | return 0; | ||
3103 | } | ||
3104 | |||
3328 | /* add playback controls from the parsed DAC table */ | 3105 | /* add playback controls from the parsed DAC table */ |
3329 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | 3106 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
3330 | const struct auto_pin_cfg *cfg) | 3107 | const struct auto_pin_cfg *cfg) |
@@ -3398,7 +3175,7 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) | |||
3398 | spec->mono_nid, | 3175 | spec->mono_nid, |
3399 | con_lst, | 3176 | con_lst, |
3400 | HDA_MAX_NUM_INPUTS); | 3177 | HDA_MAX_NUM_INPUTS); |
3401 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) | 3178 | if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
3402 | return -EINVAL; | 3179 | return -EINVAL; |
3403 | 3180 | ||
3404 | for (i = 0; i < num_cons; i++) { | 3181 | for (i = 0; i < num_cons; i++) { |
@@ -3412,37 +3189,6 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) | |||
3412 | "Mono Mux", spec->mono_nid); | 3189 | "Mono Mux", spec->mono_nid); |
3413 | } | 3190 | } |
3414 | 3191 | ||
3415 | /* labels for amp mux outputs */ | ||
3416 | static const char *stac92xx_amp_labels[3] = { | ||
3417 | "Front Microphone", "Microphone", "Line In", | ||
3418 | }; | ||
3419 | |||
3420 | /* create amp out controls mux on capable codecs */ | ||
3421 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) | ||
3422 | { | ||
3423 | struct sigmatel_spec *spec = codec->spec; | ||
3424 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; | ||
3425 | int i, err; | ||
3426 | |||
3427 | for (i = 0; i < spec->num_amps; i++) { | ||
3428 | amp_mux->items[amp_mux->num_items].label = | ||
3429 | stac92xx_amp_labels[i]; | ||
3430 | amp_mux->items[amp_mux->num_items].index = i; | ||
3431 | amp_mux->num_items++; | ||
3432 | } | ||
3433 | |||
3434 | if (spec->num_amps > 1) { | ||
3435 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, | ||
3436 | "Amp Selector Capture Switch", 0); | ||
3437 | if (err < 0) | ||
3438 | return err; | ||
3439 | } | ||
3440 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, | ||
3441 | "Amp Capture Volume", | ||
3442 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); | ||
3443 | } | ||
3444 | |||
3445 | |||
3446 | /* create PC beep volume controls */ | 3192 | /* create PC beep volume controls */ |
3447 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | 3193 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
3448 | hda_nid_t nid) | 3194 | hda_nid_t nid) |
@@ -3511,19 +3257,33 @@ static int stac92xx_beep_switch_ctl(struct hda_codec *codec) | |||
3511 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | 3257 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
3512 | { | 3258 | { |
3513 | struct sigmatel_spec *spec = codec->spec; | 3259 | struct sigmatel_spec *spec = codec->spec; |
3514 | int wcaps, nid, i, err = 0; | 3260 | int i, j, err = 0; |
3515 | 3261 | ||
3516 | for (i = 0; i < spec->num_muxes; i++) { | 3262 | for (i = 0; i < spec->num_muxes; i++) { |
3263 | hda_nid_t nid; | ||
3264 | unsigned int wcaps; | ||
3265 | unsigned long val; | ||
3266 | |||
3517 | nid = spec->mux_nids[i]; | 3267 | nid = spec->mux_nids[i]; |
3518 | wcaps = get_wcaps(codec, nid); | 3268 | wcaps = get_wcaps(codec, nid); |
3269 | if (!(wcaps & AC_WCAP_OUT_AMP)) | ||
3270 | continue; | ||
3519 | 3271 | ||
3520 | if (wcaps & AC_WCAP_OUT_AMP) { | 3272 | /* check whether already the same control was created as |
3521 | err = stac92xx_add_control_idx(spec, | 3273 | * normal Capture Volume. |
3522 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", | 3274 | */ |
3523 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 3275 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
3524 | if (err < 0) | 3276 | for (j = 0; j < spec->num_caps; j++) { |
3525 | return err; | 3277 | if (spec->capvols[j] == val) |
3278 | break; | ||
3526 | } | 3279 | } |
3280 | if (j < spec->num_caps) | ||
3281 | continue; | ||
3282 | |||
3283 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, i, | ||
3284 | "Mux Capture Volume", val); | ||
3285 | if (err < 0) | ||
3286 | return err; | ||
3527 | } | 3287 | } |
3528 | return 0; | 3288 | return 0; |
3529 | }; | 3289 | }; |
@@ -3544,7 +3304,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) | |||
3544 | spec->smux_nids[0], | 3304 | spec->smux_nids[0], |
3545 | con_lst, | 3305 | con_lst, |
3546 | HDA_MAX_NUM_INPUTS); | 3306 | HDA_MAX_NUM_INPUTS); |
3547 | if (!num_cons) | 3307 | if (num_cons <= 0) |
3548 | return -EINVAL; | 3308 | return -EINVAL; |
3549 | 3309 | ||
3550 | if (!labels) | 3310 | if (!labels) |
@@ -3565,101 +3325,231 @@ static const char *stac92xx_dmic_labels[5] = { | |||
3565 | "Digital Mic 3", "Digital Mic 4" | 3325 | "Digital Mic 3", "Digital Mic 4" |
3566 | }; | 3326 | }; |
3567 | 3327 | ||
3328 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | ||
3329 | hda_nid_t nid) | ||
3330 | { | ||
3331 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
3332 | int i, nums; | ||
3333 | |||
3334 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
3335 | for (i = 0; i < nums; i++) | ||
3336 | if (conn[i] == nid) | ||
3337 | return i; | ||
3338 | return -1; | ||
3339 | } | ||
3340 | |||
3341 | /* create a volume assigned to the given pin (only if supported) */ | ||
3342 | /* return 1 if the volume control is created */ | ||
3343 | static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid, | ||
3344 | const char *label, int direction) | ||
3345 | { | ||
3346 | unsigned int caps, nums; | ||
3347 | char name[32]; | ||
3348 | int err; | ||
3349 | |||
3350 | if (direction == HDA_OUTPUT) | ||
3351 | caps = AC_WCAP_OUT_AMP; | ||
3352 | else | ||
3353 | caps = AC_WCAP_IN_AMP; | ||
3354 | if (!(get_wcaps(codec, nid) & caps)) | ||
3355 | return 0; | ||
3356 | caps = query_amp_caps(codec, nid, direction); | ||
3357 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; | ||
3358 | if (!nums) | ||
3359 | return 0; | ||
3360 | snprintf(name, sizeof(name), "%s Capture Volume", label); | ||
3361 | err = stac92xx_add_control(codec->spec, STAC_CTL_WIDGET_VOL, name, | ||
3362 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction)); | ||
3363 | if (err < 0) | ||
3364 | return err; | ||
3365 | return 1; | ||
3366 | } | ||
3367 | |||
3568 | /* create playback/capture controls for input pins on dmic capable codecs */ | 3368 | /* create playback/capture controls for input pins on dmic capable codecs */ |
3569 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | 3369 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
3570 | const struct auto_pin_cfg *cfg) | 3370 | const struct auto_pin_cfg *cfg) |
3571 | { | 3371 | { |
3572 | struct sigmatel_spec *spec = codec->spec; | 3372 | struct sigmatel_spec *spec = codec->spec; |
3373 | struct hda_input_mux *imux = &spec->private_imux; | ||
3573 | struct hda_input_mux *dimux = &spec->private_dimux; | 3374 | struct hda_input_mux *dimux = &spec->private_dimux; |
3574 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | 3375 | int err, i, active_mics; |
3575 | int err, i, j; | 3376 | unsigned int def_conf; |
3576 | char name[32]; | ||
3577 | 3377 | ||
3578 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; | 3378 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
3579 | dimux->items[dimux->num_items].index = 0; | 3379 | dimux->items[dimux->num_items].index = 0; |
3580 | dimux->num_items++; | 3380 | dimux->num_items++; |
3581 | 3381 | ||
3382 | active_mics = 0; | ||
3383 | for (i = 0; i < spec->num_dmics; i++) { | ||
3384 | /* check the validity: sometimes it's a dead vendor-spec node */ | ||
3385 | if (get_wcaps_type(get_wcaps(codec, spec->dmic_nids[i])) | ||
3386 | != AC_WID_PIN) | ||
3387 | continue; | ||
3388 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); | ||
3389 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) | ||
3390 | active_mics++; | ||
3391 | } | ||
3392 | |||
3582 | for (i = 0; i < spec->num_dmics; i++) { | 3393 | for (i = 0; i < spec->num_dmics; i++) { |
3583 | hda_nid_t nid; | 3394 | hda_nid_t nid; |
3584 | int index; | 3395 | int index; |
3585 | int num_cons; | 3396 | const char *label; |
3586 | unsigned int wcaps; | ||
3587 | unsigned int def_conf; | ||
3588 | 3397 | ||
3589 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); | 3398 | nid = spec->dmic_nids[i]; |
3399 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | ||
3400 | continue; | ||
3401 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
3590 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) | 3402 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
3591 | continue; | 3403 | continue; |
3592 | 3404 | ||
3593 | nid = spec->dmic_nids[i]; | 3405 | index = get_connection_index(codec, spec->dmux_nids[0], nid); |
3594 | num_cons = snd_hda_get_connections(codec, | 3406 | if (index < 0) |
3595 | spec->dmux_nids[0], | 3407 | continue; |
3596 | con_lst, | ||
3597 | HDA_MAX_NUM_INPUTS); | ||
3598 | for (j = 0; j < num_cons; j++) | ||
3599 | if (con_lst[j] == nid) { | ||
3600 | index = j; | ||
3601 | goto found; | ||
3602 | } | ||
3603 | continue; | ||
3604 | found: | ||
3605 | wcaps = get_wcaps(codec, nid) & | ||
3606 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | ||
3607 | 3408 | ||
3608 | if (wcaps) { | 3409 | if (active_mics == 1) |
3609 | sprintf(name, "%s Capture Volume", | 3410 | label = "Digital Mic"; |
3610 | stac92xx_dmic_labels[dimux->num_items]); | 3411 | else |
3412 | label = stac92xx_dmic_labels[dimux->num_items]; | ||
3611 | 3413 | ||
3612 | err = stac92xx_add_control(spec, | 3414 | err = create_elem_capture_vol(codec, nid, label, HDA_INPUT); |
3613 | STAC_CTL_WIDGET_VOL, | 3415 | if (err < 0) |
3614 | name, | 3416 | return err; |
3615 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 3417 | if (!err) { |
3616 | (wcaps & AC_WCAP_OUT_AMP) ? | 3418 | err = create_elem_capture_vol(codec, nid, label, |
3617 | HDA_OUTPUT : HDA_INPUT)); | 3419 | HDA_OUTPUT); |
3618 | if (err < 0) | 3420 | if (err < 0) |
3619 | return err; | 3421 | return err; |
3620 | } | 3422 | } |
3621 | 3423 | ||
3622 | dimux->items[dimux->num_items].label = | 3424 | dimux->items[dimux->num_items].label = label; |
3623 | stac92xx_dmic_labels[dimux->num_items]; | ||
3624 | dimux->items[dimux->num_items].index = index; | 3425 | dimux->items[dimux->num_items].index = index; |
3625 | dimux->num_items++; | 3426 | dimux->num_items++; |
3427 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { | ||
3428 | imux->items[imux->num_items].label = label; | ||
3429 | imux->items[imux->num_items].index = index; | ||
3430 | imux->num_items++; | ||
3431 | } | ||
3626 | } | 3432 | } |
3627 | 3433 | ||
3628 | return 0; | 3434 | return 0; |
3629 | } | 3435 | } |
3630 | 3436 | ||
3437 | static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid, | ||
3438 | hda_nid_t *fixed, hda_nid_t *ext) | ||
3439 | { | ||
3440 | unsigned int cfg; | ||
3441 | |||
3442 | if (!nid) | ||
3443 | return 0; | ||
3444 | cfg = snd_hda_codec_get_pincfg(codec, nid); | ||
3445 | switch (get_defcfg_connect(cfg)) { | ||
3446 | case AC_JACK_PORT_FIXED: | ||
3447 | if (*fixed) | ||
3448 | return 1; /* already occupied */ | ||
3449 | *fixed = nid; | ||
3450 | break; | ||
3451 | case AC_JACK_PORT_COMPLEX: | ||
3452 | if (*ext) | ||
3453 | return 1; /* already occupied */ | ||
3454 | *ext = nid; | ||
3455 | break; | ||
3456 | } | ||
3457 | return 0; | ||
3458 | } | ||
3459 | |||
3460 | static int set_mic_route(struct hda_codec *codec, | ||
3461 | struct sigmatel_mic_route *mic, | ||
3462 | hda_nid_t pin) | ||
3463 | { | ||
3464 | struct sigmatel_spec *spec = codec->spec; | ||
3465 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3466 | int i; | ||
3467 | |||
3468 | mic->pin = pin; | ||
3469 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) | ||
3470 | if (pin == cfg->input_pins[i]) | ||
3471 | break; | ||
3472 | if (i <= AUTO_PIN_FRONT_MIC) { | ||
3473 | /* analog pin */ | ||
3474 | mic->dmux_idx = 0; | ||
3475 | i = get_connection_index(codec, spec->mux_nids[0], pin); | ||
3476 | if (i < 0) | ||
3477 | return -1; | ||
3478 | mic->mux_idx = i; | ||
3479 | } else if (spec->dmux_nids) { | ||
3480 | /* digital pin */ | ||
3481 | mic->mux_idx = 0; | ||
3482 | i = get_connection_index(codec, spec->dmux_nids[0], pin); | ||
3483 | if (i < 0) | ||
3484 | return -1; | ||
3485 | mic->dmux_idx = i; | ||
3486 | } | ||
3487 | return 0; | ||
3488 | } | ||
3489 | |||
3490 | /* return non-zero if the device is for automatic mic switch */ | ||
3491 | static int stac_check_auto_mic(struct hda_codec *codec) | ||
3492 | { | ||
3493 | struct sigmatel_spec *spec = codec->spec; | ||
3494 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3495 | hda_nid_t fixed, ext; | ||
3496 | int i; | ||
3497 | |||
3498 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) { | ||
3499 | if (cfg->input_pins[i]) | ||
3500 | return 0; /* must be exclusively mics */ | ||
3501 | } | ||
3502 | fixed = ext = 0; | ||
3503 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) | ||
3504 | if (check_mic_pin(codec, cfg->input_pins[i], &fixed, &ext)) | ||
3505 | return 0; | ||
3506 | for (i = 0; i < spec->num_dmics; i++) | ||
3507 | if (check_mic_pin(codec, spec->dmic_nids[i], &fixed, &ext)) | ||
3508 | return 0; | ||
3509 | if (!fixed || !ext) | ||
3510 | return 0; | ||
3511 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | ||
3512 | return 0; /* no unsol support */ | ||
3513 | if (set_mic_route(codec, &spec->ext_mic, ext) || | ||
3514 | set_mic_route(codec, &spec->int_mic, fixed)) | ||
3515 | return 0; /* something is wrong */ | ||
3516 | return 1; | ||
3517 | } | ||
3518 | |||
3631 | /* create playback/capture controls for input pins */ | 3519 | /* create playback/capture controls for input pins */ |
3632 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) | 3520 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
3633 | { | 3521 | { |
3634 | struct sigmatel_spec *spec = codec->spec; | 3522 | struct sigmatel_spec *spec = codec->spec; |
3635 | struct hda_input_mux *imux = &spec->private_imux; | 3523 | struct hda_input_mux *imux = &spec->private_imux; |
3636 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | 3524 | int i, j; |
3637 | int i, j, k; | ||
3638 | 3525 | ||
3639 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3526 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3640 | int index; | 3527 | hda_nid_t nid = cfg->input_pins[i]; |
3528 | int index, err; | ||
3641 | 3529 | ||
3642 | if (!cfg->input_pins[i]) | 3530 | if (!nid) |
3643 | continue; | 3531 | continue; |
3644 | index = -1; | 3532 | index = -1; |
3645 | for (j = 0; j < spec->num_muxes; j++) { | 3533 | for (j = 0; j < spec->num_muxes; j++) { |
3646 | int num_cons; | 3534 | index = get_connection_index(codec, spec->mux_nids[j], |
3647 | num_cons = snd_hda_get_connections(codec, | 3535 | nid); |
3648 | spec->mux_nids[j], | 3536 | if (index >= 0) |
3649 | con_lst, | 3537 | break; |
3650 | HDA_MAX_NUM_INPUTS); | ||
3651 | for (k = 0; k < num_cons; k++) | ||
3652 | if (con_lst[k] == cfg->input_pins[i]) { | ||
3653 | index = k; | ||
3654 | goto found; | ||
3655 | } | ||
3656 | } | 3538 | } |
3657 | continue; | 3539 | if (index < 0) |
3658 | found: | 3540 | continue; |
3541 | |||
3542 | err = create_elem_capture_vol(codec, nid, | ||
3543 | auto_pin_cfg_labels[i], | ||
3544 | HDA_INPUT); | ||
3545 | if (err < 0) | ||
3546 | return err; | ||
3547 | |||
3659 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | 3548 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
3660 | imux->items[imux->num_items].index = index; | 3549 | imux->items[imux->num_items].index = index; |
3661 | imux->num_items++; | 3550 | imux->num_items++; |
3662 | } | 3551 | } |
3552 | spec->num_analog_muxes = imux->num_items; | ||
3663 | 3553 | ||
3664 | if (imux->num_items) { | 3554 | if (imux->num_items) { |
3665 | /* | 3555 | /* |
@@ -3711,7 +3601,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3711 | { | 3601 | { |
3712 | struct sigmatel_spec *spec = codec->spec; | 3602 | struct sigmatel_spec *spec = codec->spec; |
3713 | int hp_swap = 0; | 3603 | int hp_swap = 0; |
3714 | int err; | 3604 | int i, err; |
3715 | 3605 | ||
3716 | if ((err = snd_hda_parse_pin_def_config(codec, | 3606 | if ((err = snd_hda_parse_pin_def_config(codec, |
3717 | &spec->autocfg, | 3607 | &spec->autocfg, |
@@ -3751,11 +3641,10 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3751 | if (snd_hda_get_connections(codec, | 3641 | if (snd_hda_get_connections(codec, |
3752 | spec->autocfg.mono_out_pin, conn_list, 1) && | 3642 | spec->autocfg.mono_out_pin, conn_list, 1) && |
3753 | snd_hda_get_connections(codec, conn_list[0], | 3643 | snd_hda_get_connections(codec, conn_list[0], |
3754 | conn_list, 1)) { | 3644 | conn_list, 1) > 0) { |
3755 | 3645 | ||
3756 | int wcaps = get_wcaps(codec, conn_list[0]); | 3646 | int wcaps = get_wcaps(codec, conn_list[0]); |
3757 | int wid_type = (wcaps & AC_WCAP_TYPE) | 3647 | int wid_type = get_wcaps_type(wcaps); |
3758 | >> AC_WCAP_TYPE_SHIFT; | ||
3759 | /* LR swap check, some stac925x have a mux that | 3648 | /* LR swap check, some stac925x have a mux that |
3760 | * changes the DACs output path instead of the | 3649 | * changes the DACs output path instead of the |
3761 | * mono-mux path. | 3650 | * mono-mux path. |
@@ -3846,6 +3735,21 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3846 | spec->autocfg.line_outs = 0; | 3735 | spec->autocfg.line_outs = 0; |
3847 | } | 3736 | } |
3848 | 3737 | ||
3738 | if (stac_check_auto_mic(codec)) { | ||
3739 | spec->auto_mic = 1; | ||
3740 | /* only one capture for auto-mic */ | ||
3741 | spec->num_adcs = 1; | ||
3742 | spec->num_caps = 1; | ||
3743 | spec->num_muxes = 1; | ||
3744 | } | ||
3745 | |||
3746 | for (i = 0; i < spec->num_caps; i++) { | ||
3747 | err = stac92xx_add_capvol_ctls(codec, spec->capvols[i], | ||
3748 | spec->capsws[i], i); | ||
3749 | if (err < 0) | ||
3750 | return err; | ||
3751 | } | ||
3752 | |||
3849 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); | 3753 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
3850 | if (err < 0) | 3754 | if (err < 0) |
3851 | return err; | 3755 | return err; |
@@ -3855,11 +3759,6 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3855 | if (err < 0) | 3759 | if (err < 0) |
3856 | return err; | 3760 | return err; |
3857 | } | 3761 | } |
3858 | if (spec->num_amps > 0) { | ||
3859 | err = stac92xx_auto_create_amp_output_ctls(codec); | ||
3860 | if (err < 0) | ||
3861 | return err; | ||
3862 | } | ||
3863 | if (spec->num_dmics > 0 && !spec->dinput_mux) | 3762 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
3864 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, | 3763 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
3865 | &spec->autocfg)) < 0) | 3764 | &spec->autocfg)) < 0) |
@@ -3896,7 +3795,6 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3896 | spec->dinput_mux = &spec->private_dimux; | 3795 | spec->dinput_mux = &spec->private_dimux; |
3897 | spec->sinput_mux = &spec->private_smux; | 3796 | spec->sinput_mux = &spec->private_smux; |
3898 | spec->mono_mux = &spec->private_mono_mux; | 3797 | spec->mono_mux = &spec->private_mono_mux; |
3899 | spec->amp_mux = &spec->private_amp_mux; | ||
3900 | return 1; | 3798 | return 1; |
3901 | } | 3799 | } |
3902 | 3800 | ||
@@ -4108,14 +4006,14 @@ static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, | |||
4108 | } | 4006 | } |
4109 | 4007 | ||
4110 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, | 4008 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, |
4111 | hda_nid_t nid, unsigned char type) | 4009 | hda_nid_t nid) |
4112 | { | 4010 | { |
4113 | struct sigmatel_spec *spec = codec->spec; | 4011 | struct sigmatel_spec *spec = codec->spec; |
4114 | struct sigmatel_event *event = spec->events.list; | 4012 | struct sigmatel_event *event = spec->events.list; |
4115 | int i; | 4013 | int i; |
4116 | 4014 | ||
4117 | for (i = 0; i < spec->events.used; i++, event++) { | 4015 | for (i = 0; i < spec->events.used; i++, event++) { |
4118 | if (event->nid == nid && event->type == type) | 4016 | if (event->nid == nid) |
4119 | return event; | 4017 | return event; |
4120 | } | 4018 | } |
4121 | return NULL; | 4019 | return NULL; |
@@ -4135,24 +4033,32 @@ static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, | |||
4135 | return NULL; | 4033 | return NULL; |
4136 | } | 4034 | } |
4137 | 4035 | ||
4138 | static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, | 4036 | /* check if given nid is a valid pin and no other events are assigned |
4139 | unsigned int type) | 4037 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
4038 | * Otherwise, returns zero. | ||
4039 | */ | ||
4040 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, | ||
4041 | unsigned int type) | ||
4140 | { | 4042 | { |
4141 | struct sigmatel_event *event; | 4043 | struct sigmatel_event *event; |
4142 | int tag; | 4044 | int tag; |
4143 | 4045 | ||
4144 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) | 4046 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
4145 | return; | 4047 | return 0; |
4146 | event = stac_get_event(codec, nid, type); | 4048 | event = stac_get_event(codec, nid); |
4147 | if (event) | 4049 | if (event) { |
4050 | if (event->type != type) | ||
4051 | return 0; | ||
4148 | tag = event->tag; | 4052 | tag = event->tag; |
4149 | else | 4053 | } else { |
4150 | tag = stac_add_event(codec->spec, nid, type, 0); | 4054 | tag = stac_add_event(codec->spec, nid, type, 0); |
4151 | if (tag < 0) | 4055 | if (tag < 0) |
4152 | return; | 4056 | return 0; |
4057 | } | ||
4153 | snd_hda_codec_write_cache(codec, nid, 0, | 4058 | snd_hda_codec_write_cache(codec, nid, 0, |
4154 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4059 | AC_VERB_SET_UNSOLICITED_ENABLE, |
4155 | AC_USRSP_EN | tag); | 4060 | AC_USRSP_EN | tag); |
4061 | return 1; | ||
4156 | } | 4062 | } |
4157 | 4063 | ||
4158 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) | 4064 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
@@ -4245,20 +4151,36 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4245 | hda_nid_t nid = cfg->hp_pins[i]; | 4151 | hda_nid_t nid = cfg->hp_pins[i]; |
4246 | enable_pin_detect(codec, nid, STAC_HP_EVENT); | 4152 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
4247 | } | 4153 | } |
4154 | if (cfg->line_out_type == AUTO_PIN_LINE_OUT && | ||
4155 | cfg->speaker_outs > 0) { | ||
4156 | /* enable pin-detect for line-outs as well */ | ||
4157 | for (i = 0; i < cfg->line_outs; i++) { | ||
4158 | hda_nid_t nid = cfg->line_out_pins[i]; | ||
4159 | enable_pin_detect(codec, nid, STAC_LO_EVENT); | ||
4160 | } | ||
4161 | } | ||
4162 | |||
4248 | /* force to enable the first line-out; the others are set up | 4163 | /* force to enable the first line-out; the others are set up |
4249 | * in unsol_event | 4164 | * in unsol_event |
4250 | */ | 4165 | */ |
4251 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], | 4166 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
4252 | AC_PINCTL_OUT_EN); | 4167 | AC_PINCTL_OUT_EN); |
4253 | /* fake event to set up pins */ | 4168 | /* fake event to set up pins */ |
4254 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], | 4169 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); |
4255 | STAC_HP_EVENT); | ||
4256 | } else { | 4170 | } else { |
4257 | stac92xx_auto_init_multi_out(codec); | 4171 | stac92xx_auto_init_multi_out(codec); |
4258 | stac92xx_auto_init_hp_out(codec); | 4172 | stac92xx_auto_init_hp_out(codec); |
4259 | for (i = 0; i < cfg->hp_outs; i++) | 4173 | for (i = 0; i < cfg->hp_outs; i++) |
4260 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); | 4174 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
4261 | } | 4175 | } |
4176 | if (spec->auto_mic) { | ||
4177 | /* initialize connection to analog input */ | ||
4178 | if (spec->dmux_nids) | ||
4179 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, | ||
4180 | AC_VERB_SET_CONNECT_SEL, 0); | ||
4181 | if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT)) | ||
4182 | stac_issue_unsol_event(codec, spec->ext_mic.pin); | ||
4183 | } | ||
4262 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4184 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4263 | hda_nid_t nid = cfg->input_pins[i]; | 4185 | hda_nid_t nid = cfg->input_pins[i]; |
4264 | if (nid) { | 4186 | if (nid) { |
@@ -4285,10 +4207,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4285 | } | 4207 | } |
4286 | conf = snd_hda_codec_get_pincfg(codec, nid); | 4208 | conf = snd_hda_codec_get_pincfg(codec, nid); |
4287 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { | 4209 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
4288 | enable_pin_detect(codec, nid, | 4210 | if (enable_pin_detect(codec, nid, |
4289 | STAC_INSERT_EVENT); | 4211 | STAC_INSERT_EVENT)) |
4290 | stac_issue_unsol_event(codec, nid, | 4212 | stac_issue_unsol_event(codec, nid); |
4291 | STAC_INSERT_EVENT); | ||
4292 | } | 4213 | } |
4293 | } | 4214 | } |
4294 | } | 4215 | } |
@@ -4333,10 +4254,8 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4333 | stac_toggle_power_map(codec, nid, 1); | 4254 | stac_toggle_power_map(codec, nid, 1); |
4334 | continue; | 4255 | continue; |
4335 | } | 4256 | } |
4336 | if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { | 4257 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) |
4337 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); | 4258 | stac_issue_unsol_event(codec, nid); |
4338 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); | ||
4339 | } | ||
4340 | } | 4259 | } |
4341 | if (spec->dac_list) | 4260 | if (spec->dac_list) |
4342 | stac92xx_power_down(codec); | 4261 | stac92xx_power_down(codec); |
@@ -4440,6 +4359,48 @@ static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
4440 | return 0; | 4359 | return 0; |
4441 | } | 4360 | } |
4442 | 4361 | ||
4362 | static void stac92xx_line_out_detect(struct hda_codec *codec, | ||
4363 | int presence) | ||
4364 | { | ||
4365 | struct sigmatel_spec *spec = codec->spec; | ||
4366 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
4367 | int i; | ||
4368 | |||
4369 | for (i = 0; i < cfg->line_outs; i++) { | ||
4370 | if (presence) | ||
4371 | break; | ||
4372 | presence = get_pin_presence(codec, cfg->line_out_pins[i]); | ||
4373 | if (presence) { | ||
4374 | unsigned int pinctl; | ||
4375 | pinctl = snd_hda_codec_read(codec, | ||
4376 | cfg->line_out_pins[i], 0, | ||
4377 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
4378 | if (pinctl & AC_PINCTL_IN_EN) | ||
4379 | presence = 0; /* mic- or line-input */ | ||
4380 | } | ||
4381 | } | ||
4382 | |||
4383 | if (presence) { | ||
4384 | /* disable speakers */ | ||
4385 | for (i = 0; i < cfg->speaker_outs; i++) | ||
4386 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], | ||
4387 | AC_PINCTL_OUT_EN); | ||
4388 | if (spec->eapd_mask && spec->eapd_switch) | ||
4389 | stac_gpio_set(codec, spec->gpio_mask, | ||
4390 | spec->gpio_dir, spec->gpio_data & | ||
4391 | ~spec->eapd_mask); | ||
4392 | } else { | ||
4393 | /* enable speakers */ | ||
4394 | for (i = 0; i < cfg->speaker_outs; i++) | ||
4395 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], | ||
4396 | AC_PINCTL_OUT_EN); | ||
4397 | if (spec->eapd_mask && spec->eapd_switch) | ||
4398 | stac_gpio_set(codec, spec->gpio_mask, | ||
4399 | spec->gpio_dir, spec->gpio_data | | ||
4400 | spec->eapd_mask); | ||
4401 | } | ||
4402 | } | ||
4403 | |||
4443 | /* return non-zero if the hp-pin of the given array index isn't | 4404 | /* return non-zero if the hp-pin of the given array index isn't |
4444 | * a jack-detection target | 4405 | * a jack-detection target |
4445 | */ | 4406 | */ |
@@ -4492,13 +4453,6 @@ static void stac92xx_hp_detect(struct hda_codec *codec) | |||
4492 | for (i = 0; i < cfg->line_outs; i++) | 4453 | for (i = 0; i < cfg->line_outs; i++) |
4493 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 4454 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
4494 | AC_PINCTL_OUT_EN); | 4455 | AC_PINCTL_OUT_EN); |
4495 | for (i = 0; i < cfg->speaker_outs; i++) | ||
4496 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], | ||
4497 | AC_PINCTL_OUT_EN); | ||
4498 | if (spec->eapd_mask && spec->eapd_switch) | ||
4499 | stac_gpio_set(codec, spec->gpio_mask, | ||
4500 | spec->gpio_dir, spec->gpio_data & | ||
4501 | ~spec->eapd_mask); | ||
4502 | } else { | 4456 | } else { |
4503 | /* enable lineouts */ | 4457 | /* enable lineouts */ |
4504 | if (spec->hp_switch) | 4458 | if (spec->hp_switch) |
@@ -4507,14 +4461,8 @@ static void stac92xx_hp_detect(struct hda_codec *codec) | |||
4507 | for (i = 0; i < cfg->line_outs; i++) | 4461 | for (i = 0; i < cfg->line_outs; i++) |
4508 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 4462 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
4509 | AC_PINCTL_OUT_EN); | 4463 | AC_PINCTL_OUT_EN); |
4510 | for (i = 0; i < cfg->speaker_outs; i++) | ||
4511 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], | ||
4512 | AC_PINCTL_OUT_EN); | ||
4513 | if (spec->eapd_mask && spec->eapd_switch) | ||
4514 | stac_gpio_set(codec, spec->gpio_mask, | ||
4515 | spec->gpio_dir, spec->gpio_data | | ||
4516 | spec->eapd_mask); | ||
4517 | } | 4464 | } |
4465 | stac92xx_line_out_detect(codec, presence); | ||
4518 | /* toggle hp outs */ | 4466 | /* toggle hp outs */ |
4519 | for (i = 0; i < cfg->hp_outs; i++) { | 4467 | for (i = 0; i < cfg->hp_outs; i++) { |
4520 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; | 4468 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
@@ -4599,10 +4547,28 @@ static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) | |||
4599 | } | 4547 | } |
4600 | } | 4548 | } |
4601 | 4549 | ||
4602 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, | 4550 | static void stac92xx_mic_detect(struct hda_codec *codec) |
4603 | unsigned char type) | ||
4604 | { | 4551 | { |
4605 | struct sigmatel_event *event = stac_get_event(codec, nid, type); | 4552 | struct sigmatel_spec *spec = codec->spec; |
4553 | struct sigmatel_mic_route *mic; | ||
4554 | |||
4555 | if (get_pin_presence(codec, spec->ext_mic.pin)) | ||
4556 | mic = &spec->ext_mic; | ||
4557 | else | ||
4558 | mic = &spec->int_mic; | ||
4559 | if (mic->dmux_idx) | ||
4560 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, | ||
4561 | AC_VERB_SET_CONNECT_SEL, | ||
4562 | mic->dmux_idx); | ||
4563 | else | ||
4564 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, | ||
4565 | AC_VERB_SET_CONNECT_SEL, | ||
4566 | mic->mux_idx); | ||
4567 | } | ||
4568 | |||
4569 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) | ||
4570 | { | ||
4571 | struct sigmatel_event *event = stac_get_event(codec, nid); | ||
4606 | if (!event) | 4572 | if (!event) |
4607 | return; | 4573 | return; |
4608 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); | 4574 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); |
@@ -4621,8 +4587,18 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4621 | 4587 | ||
4622 | switch (event->type) { | 4588 | switch (event->type) { |
4623 | case STAC_HP_EVENT: | 4589 | case STAC_HP_EVENT: |
4590 | case STAC_LO_EVENT: | ||
4624 | stac92xx_hp_detect(codec); | 4591 | stac92xx_hp_detect(codec); |
4625 | /* fallthru */ | 4592 | break; |
4593 | case STAC_MIC_EVENT: | ||
4594 | stac92xx_mic_detect(codec); | ||
4595 | break; | ||
4596 | } | ||
4597 | |||
4598 | switch (event->type) { | ||
4599 | case STAC_HP_EVENT: | ||
4600 | case STAC_LO_EVENT: | ||
4601 | case STAC_MIC_EVENT: | ||
4626 | case STAC_INSERT_EVENT: | 4602 | case STAC_INSERT_EVENT: |
4627 | case STAC_PWR_EVENT: | 4603 | case STAC_PWR_EVENT: |
4628 | if (spec->num_pwrs > 0) | 4604 | if (spec->num_pwrs > 0) |
@@ -4713,8 +4689,7 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
4713 | snd_hda_codec_resume_cache(codec); | 4689 | snd_hda_codec_resume_cache(codec); |
4714 | /* fake event to set up pins again to override cached values */ | 4690 | /* fake event to set up pins again to override cached values */ |
4715 | if (spec->hp_detect) | 4691 | if (spec->hp_detect) |
4716 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], | 4692 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); |
4717 | STAC_HP_EVENT); | ||
4718 | return 0; | 4693 | return 0; |
4719 | } | 4694 | } |
4720 | 4695 | ||
@@ -4754,6 +4729,19 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec, | |||
4754 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) | 4729 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
4755 | { | 4730 | { |
4756 | struct sigmatel_spec *spec = codec->spec; | 4731 | struct sigmatel_spec *spec = codec->spec; |
4732 | int i; | ||
4733 | hda_nid_t nid; | ||
4734 | |||
4735 | /* reset each pin before powering down DAC/ADC to avoid click noise */ | ||
4736 | nid = codec->start_nid; | ||
4737 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
4738 | unsigned int wcaps = get_wcaps(codec, nid); | ||
4739 | unsigned int wid_type = get_wcaps_type(wcaps); | ||
4740 | if (wid_type == AC_WID_PIN) | ||
4741 | snd_hda_codec_read(codec, nid, 0, | ||
4742 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
4743 | } | ||
4744 | |||
4757 | if (spec->eapd_mask) | 4745 | if (spec->eapd_mask) |
4758 | stac_gpio_set(codec, spec->gpio_mask, | 4746 | stac_gpio_set(codec, spec->gpio_mask, |
4759 | spec->gpio_dir, spec->gpio_data & | 4747 | spec->gpio_dir, spec->gpio_data & |
@@ -4790,7 +4778,8 @@ static int patch_stac9200(struct hda_codec *codec) | |||
4790 | stac9200_models, | 4778 | stac9200_models, |
4791 | stac9200_cfg_tbl); | 4779 | stac9200_cfg_tbl); |
4792 | if (spec->board_config < 0) | 4780 | if (spec->board_config < 0) |
4793 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); | 4781 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4782 | codec->chip_name); | ||
4794 | else | 4783 | else |
4795 | stac92xx_set_config_regs(codec, | 4784 | stac92xx_set_config_regs(codec, |
4796 | stac9200_brd_tbl[spec->board_config]); | 4785 | stac9200_brd_tbl[spec->board_config]); |
@@ -4862,8 +4851,8 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4862 | stac925x_cfg_tbl); | 4851 | stac925x_cfg_tbl); |
4863 | again: | 4852 | again: |
4864 | if (spec->board_config < 0) | 4853 | if (spec->board_config < 0) |
4865 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," | 4854 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4866 | "using BIOS defaults\n"); | 4855 | codec->chip_name); |
4867 | else | 4856 | else |
4868 | stac92xx_set_config_regs(codec, | 4857 | stac92xx_set_config_regs(codec, |
4869 | stac925x_brd_tbl[spec->board_config]); | 4858 | stac925x_brd_tbl[spec->board_config]); |
@@ -4893,6 +4882,9 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4893 | 4882 | ||
4894 | spec->init = stac925x_core_init; | 4883 | spec->init = stac925x_core_init; |
4895 | spec->mixer = stac925x_mixer; | 4884 | spec->mixer = stac925x_mixer; |
4885 | spec->num_caps = 1; | ||
4886 | spec->capvols = stac925x_capvols; | ||
4887 | spec->capsws = stac925x_capsws; | ||
4896 | 4888 | ||
4897 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); | 4889 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
4898 | if (!err) { | 4890 | if (!err) { |
@@ -4914,16 +4906,6 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4914 | return 0; | 4906 | return 0; |
4915 | } | 4907 | } |
4916 | 4908 | ||
4917 | static struct hda_input_mux stac92hd73xx_dmux = { | ||
4918 | .num_items = 4, | ||
4919 | .items = { | ||
4920 | { "Analog Inputs", 0x0b }, | ||
4921 | { "Digital Mic 1", 0x09 }, | ||
4922 | { "Digital Mic 2", 0x0a }, | ||
4923 | { "CD", 0x08 }, | ||
4924 | } | ||
4925 | }; | ||
4926 | |||
4927 | static int patch_stac92hd73xx(struct hda_codec *codec) | 4909 | static int patch_stac92hd73xx(struct hda_codec *codec) |
4928 | { | 4910 | { |
4929 | struct sigmatel_spec *spec; | 4911 | struct sigmatel_spec *spec; |
@@ -4943,10 +4925,16 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
4943 | STAC_92HD73XX_MODELS, | 4925 | STAC_92HD73XX_MODELS, |
4944 | stac92hd73xx_models, | 4926 | stac92hd73xx_models, |
4945 | stac92hd73xx_cfg_tbl); | 4927 | stac92hd73xx_cfg_tbl); |
4928 | /* check codec subsystem id if not found */ | ||
4929 | if (spec->board_config < 0) | ||
4930 | spec->board_config = | ||
4931 | snd_hda_check_board_codec_sid_config(codec, | ||
4932 | STAC_92HD73XX_MODELS, stac92hd73xx_models, | ||
4933 | stac92hd73xx_codec_id_cfg_tbl); | ||
4946 | again: | 4934 | again: |
4947 | if (spec->board_config < 0) | 4935 | if (spec->board_config < 0) |
4948 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 4936 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4949 | " STAC92HD73XX, using BIOS defaults\n"); | 4937 | codec->chip_name); |
4950 | else | 4938 | else |
4951 | stac92xx_set_config_regs(codec, | 4939 | stac92xx_set_config_regs(codec, |
4952 | stac92hd73xx_brd_tbl[spec->board_config]); | 4940 | stac92hd73xx_brd_tbl[spec->board_config]); |
@@ -4959,20 +4947,15 @@ again: | |||
4959 | "number of channels defaulting to DAC count\n"); | 4947 | "number of channels defaulting to DAC count\n"); |
4960 | num_dacs = STAC92HD73_DAC_COUNT; | 4948 | num_dacs = STAC92HD73_DAC_COUNT; |
4961 | } | 4949 | } |
4950 | spec->init = stac92hd73xx_core_init; | ||
4962 | switch (num_dacs) { | 4951 | switch (num_dacs) { |
4963 | case 0x3: /* 6 Channel */ | 4952 | case 0x3: /* 6 Channel */ |
4964 | spec->mixer = stac92hd73xx_6ch_mixer; | ||
4965 | spec->init = stac92hd73xx_6ch_core_init; | ||
4966 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; | 4953 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; |
4967 | break; | 4954 | break; |
4968 | case 0x4: /* 8 Channel */ | 4955 | case 0x4: /* 8 Channel */ |
4969 | spec->mixer = stac92hd73xx_8ch_mixer; | ||
4970 | spec->init = stac92hd73xx_8ch_core_init; | ||
4971 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; | 4956 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; |
4972 | break; | 4957 | break; |
4973 | case 0x5: /* 10 Channel */ | 4958 | case 0x5: /* 10 Channel */ |
4974 | spec->mixer = stac92hd73xx_10ch_mixer; | ||
4975 | spec->init = stac92hd73xx_10ch_core_init; | ||
4976 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; | 4959 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; |
4977 | break; | 4960 | break; |
4978 | } | 4961 | } |
@@ -4987,14 +4970,14 @@ again: | |||
4987 | spec->dmic_nids = stac92hd73xx_dmic_nids; | 4970 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
4988 | spec->dmux_nids = stac92hd73xx_dmux_nids; | 4971 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
4989 | spec->smux_nids = stac92hd73xx_smux_nids; | 4972 | spec->smux_nids = stac92hd73xx_smux_nids; |
4990 | spec->amp_nids = stac92hd73xx_amp_nids; | ||
4991 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); | ||
4992 | 4973 | ||
4993 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); | 4974 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
4994 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); | 4975 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
4995 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); | 4976 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
4996 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, | 4977 | |
4997 | sizeof(stac92hd73xx_dmux)); | 4978 | spec->num_caps = STAC92HD73XX_NUM_CAPS; |
4979 | spec->capvols = stac92hd73xx_capvols; | ||
4980 | spec->capsws = stac92hd73xx_capsws; | ||
4998 | 4981 | ||
4999 | switch (spec->board_config) { | 4982 | switch (spec->board_config) { |
5000 | case STAC_DELL_EQ: | 4983 | case STAC_DELL_EQ: |
@@ -5004,43 +4987,40 @@ again: | |||
5004 | case STAC_DELL_M6_DMIC: | 4987 | case STAC_DELL_M6_DMIC: |
5005 | case STAC_DELL_M6_BOTH: | 4988 | case STAC_DELL_M6_BOTH: |
5006 | spec->num_smuxes = 0; | 4989 | spec->num_smuxes = 0; |
5007 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | ||
5008 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | ||
5009 | spec->eapd_switch = 0; | 4990 | spec->eapd_switch = 0; |
5010 | spec->num_amps = 1; | ||
5011 | 4991 | ||
5012 | if (spec->board_config != STAC_DELL_EQ) | ||
5013 | spec->init = dell_m6_core_init; | ||
5014 | switch (spec->board_config) { | 4992 | switch (spec->board_config) { |
5015 | case STAC_DELL_M6_AMIC: /* Analog Mics */ | 4993 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
5016 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); | 4994 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
5017 | spec->num_dmics = 0; | 4995 | spec->num_dmics = 0; |
5018 | spec->private_dimux.num_items = 1; | ||
5019 | break; | 4996 | break; |
5020 | case STAC_DELL_M6_DMIC: /* Digital Mics */ | 4997 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
5021 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); | 4998 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
5022 | spec->num_dmics = 1; | 4999 | spec->num_dmics = 1; |
5023 | spec->private_dimux.num_items = 2; | ||
5024 | break; | 5000 | break; |
5025 | case STAC_DELL_M6_BOTH: /* Both */ | 5001 | case STAC_DELL_M6_BOTH: /* Both */ |
5026 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); | 5002 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
5027 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); | 5003 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
5028 | spec->num_dmics = 1; | 5004 | spec->num_dmics = 1; |
5029 | spec->private_dimux.num_items = 2; | ||
5030 | break; | 5005 | break; |
5031 | } | 5006 | } |
5032 | break; | 5007 | break; |
5008 | case STAC_ALIENWARE_M17X: | ||
5009 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | ||
5010 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | ||
5011 | spec->eapd_switch = 0; | ||
5012 | break; | ||
5033 | default: | 5013 | default: |
5034 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | 5014 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
5035 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | 5015 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
5036 | spec->eapd_switch = 1; | 5016 | spec->eapd_switch = 1; |
5017 | break; | ||
5037 | } | 5018 | } |
5038 | if (spec->board_config > STAC_92HD73XX_REF) { | 5019 | if (spec->board_config > STAC_92HD73XX_REF) { |
5039 | /* GPIO0 High = Enable EAPD */ | 5020 | /* GPIO0 High = Enable EAPD */ |
5040 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 5021 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
5041 | spec->gpio_data = 0x01; | 5022 | spec->gpio_data = 0x01; |
5042 | } | 5023 | } |
5043 | spec->dinput_mux = &spec->private_dimux; | ||
5044 | 5024 | ||
5045 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 5025 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
5046 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 5026 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
@@ -5072,15 +5052,6 @@ again: | |||
5072 | return 0; | 5052 | return 0; |
5073 | } | 5053 | } |
5074 | 5054 | ||
5075 | static struct hda_input_mux stac92hd83xxx_dmux = { | ||
5076 | .num_items = 3, | ||
5077 | .items = { | ||
5078 | { "Analog Inputs", 0x03 }, | ||
5079 | { "Digital Mic 1", 0x04 }, | ||
5080 | { "Digital Mic 2", 0x05 }, | ||
5081 | } | ||
5082 | }; | ||
5083 | |||
5084 | static int patch_stac92hd83xxx(struct hda_codec *codec) | 5055 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
5085 | { | 5056 | { |
5086 | struct sigmatel_spec *spec; | 5057 | struct sigmatel_spec *spec; |
@@ -5097,32 +5068,30 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5097 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | 5068 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
5098 | spec->mono_nid = 0x19; | 5069 | spec->mono_nid = 0x19; |
5099 | spec->digbeep_nid = 0x21; | 5070 | spec->digbeep_nid = 0x21; |
5100 | spec->dmic_nids = stac92hd83xxx_dmic_nids; | 5071 | spec->mux_nids = stac92hd83xxx_mux_nids; |
5101 | spec->dmux_nids = stac92hd83xxx_dmux_nids; | 5072 | spec->num_muxes = ARRAY_SIZE(stac92hd83xxx_mux_nids); |
5102 | spec->adc_nids = stac92hd83xxx_adc_nids; | 5073 | spec->adc_nids = stac92hd83xxx_adc_nids; |
5074 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); | ||
5103 | spec->pwr_nids = stac92hd83xxx_pwr_nids; | 5075 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
5104 | spec->amp_nids = stac92hd83xxx_amp_nids; | ||
5105 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; | 5076 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; |
5106 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); | 5077 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
5107 | spec->multiout.dac_nids = spec->dac_nids; | 5078 | spec->multiout.dac_nids = spec->dac_nids; |
5108 | 5079 | ||
5109 | spec->init = stac92hd83xxx_core_init; | 5080 | spec->init = stac92hd83xxx_core_init; |
5110 | spec->mixer = stac92hd83xxx_mixer; | ||
5111 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); | 5081 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
5112 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); | ||
5113 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); | ||
5114 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); | ||
5115 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; | ||
5116 | spec->dinput_mux = &stac92hd83xxx_dmux; | ||
5117 | spec->pin_nids = stac92hd83xxx_pin_nids; | 5082 | spec->pin_nids = stac92hd83xxx_pin_nids; |
5083 | spec->num_caps = STAC92HD83XXX_NUM_CAPS; | ||
5084 | spec->capvols = stac92hd83xxx_capvols; | ||
5085 | spec->capsws = stac92hd83xxx_capsws; | ||
5086 | |||
5118 | spec->board_config = snd_hda_check_board_config(codec, | 5087 | spec->board_config = snd_hda_check_board_config(codec, |
5119 | STAC_92HD83XXX_MODELS, | 5088 | STAC_92HD83XXX_MODELS, |
5120 | stac92hd83xxx_models, | 5089 | stac92hd83xxx_models, |
5121 | stac92hd83xxx_cfg_tbl); | 5090 | stac92hd83xxx_cfg_tbl); |
5122 | again: | 5091 | again: |
5123 | if (spec->board_config < 0) | 5092 | if (spec->board_config < 0) |
5124 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 5093 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5125 | " STAC92HD83XXX, using BIOS defaults\n"); | 5094 | codec->chip_name); |
5126 | else | 5095 | else |
5127 | stac92xx_set_config_regs(codec, | 5096 | stac92xx_set_config_regs(codec, |
5128 | stac92hd83xxx_brd_tbl[spec->board_config]); | 5097 | stac92hd83xxx_brd_tbl[spec->board_config]); |
@@ -5164,6 +5133,8 @@ again: | |||
5164 | 5133 | ||
5165 | num_dacs = snd_hda_get_connections(codec, nid, | 5134 | num_dacs = snd_hda_get_connections(codec, nid, |
5166 | conn, STAC92HD83_DAC_COUNT + 1) - 1; | 5135 | conn, STAC92HD83_DAC_COUNT + 1) - 1; |
5136 | if (num_dacs < 0) | ||
5137 | num_dacs = STAC92HD83_DAC_COUNT; | ||
5167 | 5138 | ||
5168 | /* set port X to select the last DAC | 5139 | /* set port X to select the last DAC |
5169 | */ | 5140 | */ |
@@ -5177,25 +5148,6 @@ again: | |||
5177 | return 0; | 5148 | return 0; |
5178 | } | 5149 | } |
5179 | 5150 | ||
5180 | static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { | ||
5181 | .num_items = 3, | ||
5182 | .items = { | ||
5183 | { "Analog Inputs", 0x00 }, | ||
5184 | { "Digital Mic 1", 0x02 }, | ||
5185 | { "Digital Mic 2", 0x03 }, | ||
5186 | } | ||
5187 | }; | ||
5188 | |||
5189 | static struct hda_input_mux stac92hd71bxx_dmux_amixer = { | ||
5190 | .num_items = 4, | ||
5191 | .items = { | ||
5192 | { "Analog Inputs", 0x00 }, | ||
5193 | { "Mixer", 0x01 }, | ||
5194 | { "Digital Mic 1", 0x02 }, | ||
5195 | { "Digital Mic 2", 0x03 }, | ||
5196 | } | ||
5197 | }; | ||
5198 | |||
5199 | /* get the pin connection (fixed, none, etc) */ | 5151 | /* get the pin connection (fixed, none, etc) */ |
5200 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) | 5152 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
5201 | { | 5153 | { |
@@ -5256,7 +5208,6 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5256 | struct sigmatel_spec *spec; | 5208 | struct sigmatel_spec *spec; |
5257 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; | 5209 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
5258 | int err = 0; | 5210 | int err = 0; |
5259 | unsigned int ndmic_nids = 0; | ||
5260 | 5211 | ||
5261 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5212 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5262 | if (spec == NULL) | 5213 | if (spec == NULL) |
@@ -5285,8 +5236,8 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5285 | stac92hd71bxx_cfg_tbl); | 5236 | stac92hd71bxx_cfg_tbl); |
5286 | again: | 5237 | again: |
5287 | if (spec->board_config < 0) | 5238 | if (spec->board_config < 0) |
5288 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 5239 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5289 | " STAC92HD71BXX, using BIOS defaults\n"); | 5240 | codec->chip_name); |
5290 | else | 5241 | else |
5291 | stac92xx_set_config_regs(codec, | 5242 | stac92xx_set_config_regs(codec, |
5292 | stac92hd71bxx_brd_tbl[spec->board_config]); | 5243 | stac92hd71bxx_brd_tbl[spec->board_config]); |
@@ -5301,6 +5252,10 @@ again: | |||
5301 | spec->dmic_nids = stac92hd71bxx_dmic_nids; | 5252 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
5302 | spec->dmux_nids = stac92hd71bxx_dmux_nids; | 5253 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
5303 | 5254 | ||
5255 | spec->num_caps = STAC92HD71BXX_NUM_CAPS; | ||
5256 | spec->capvols = stac92hd71bxx_capvols; | ||
5257 | spec->capsws = stac92hd71bxx_capsws; | ||
5258 | |||
5304 | switch (codec->vendor_id) { | 5259 | switch (codec->vendor_id) { |
5305 | case 0x111d76b6: /* 4 Port without Analog Mixer */ | 5260 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
5306 | case 0x111d76b7: | 5261 | case 0x111d76b7: |
@@ -5308,24 +5263,13 @@ again: | |||
5308 | /* fallthru */ | 5263 | /* fallthru */ |
5309 | case 0x111d76b4: /* 6 Port without Analog Mixer */ | 5264 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
5310 | case 0x111d76b5: | 5265 | case 0x111d76b5: |
5311 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, | ||
5312 | sizeof(stac92hd71bxx_dmux_nomixer)); | ||
5313 | spec->mixer = stac92hd71bxx_mixer; | ||
5314 | spec->init = stac92hd71bxx_core_init; | 5266 | spec->init = stac92hd71bxx_core_init; |
5315 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5267 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5316 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5268 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5317 | stac92hd71bxx_dmic_nids, | 5269 | stac92hd71bxx_dmic_nids, |
5318 | STAC92HD71BXX_NUM_DMICS); | 5270 | STAC92HD71BXX_NUM_DMICS); |
5319 | if (spec->num_dmics) { | ||
5320 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5321 | spec->dinput_mux = &spec->private_dimux; | ||
5322 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
5323 | } | ||
5324 | break; | 5271 | break; |
5325 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 5272 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
5326 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | ||
5327 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
5328 | spec->private_dimux.num_items--; | ||
5329 | switch (spec->board_config) { | 5273 | switch (spec->board_config) { |
5330 | case STAC_HP_M4: | 5274 | case STAC_HP_M4: |
5331 | /* Enable VREF power saving on GPIO1 detect */ | 5275 | /* Enable VREF power saving on GPIO1 detect */ |
@@ -5347,11 +5291,8 @@ again: | |||
5347 | 5291 | ||
5348 | /* no output amps */ | 5292 | /* no output amps */ |
5349 | spec->num_pwrs = 0; | 5293 | spec->num_pwrs = 0; |
5350 | spec->mixer = stac92hd71bxx_analog_mixer; | ||
5351 | spec->dinput_mux = &spec->private_dimux; | ||
5352 | |||
5353 | /* disable VSW */ | 5294 | /* disable VSW */ |
5354 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; | 5295 | spec->init = stac92hd71bxx_core_init; |
5355 | unmute_init++; | 5296 | unmute_init++; |
5356 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); | 5297 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); |
5357 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); | 5298 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); |
@@ -5359,8 +5300,6 @@ again: | |||
5359 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5300 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5360 | stac92hd71bxx_dmic_nids, | 5301 | stac92hd71bxx_dmic_nids, |
5361 | STAC92HD71BXX_NUM_DMICS - 1); | 5302 | STAC92HD71BXX_NUM_DMICS - 1); |
5362 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5363 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; | ||
5364 | break; | 5303 | break; |
5365 | case 0x111d7603: /* 6 Port with Analog Mixer */ | 5304 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
5366 | if ((codec->revision_id & 0xf) == 1) | 5305 | if ((codec->revision_id & 0xf) == 1) |
@@ -5370,17 +5309,12 @@ again: | |||
5370 | spec->num_pwrs = 0; | 5309 | spec->num_pwrs = 0; |
5371 | /* fallthru */ | 5310 | /* fallthru */ |
5372 | default: | 5311 | default: |
5373 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | 5312 | spec->init = stac92hd71bxx_core_init; |
5374 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
5375 | spec->dinput_mux = &spec->private_dimux; | ||
5376 | spec->mixer = stac92hd71bxx_analog_mixer; | ||
5377 | spec->init = stac92hd71bxx_analog_core_init; | ||
5378 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5313 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5379 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5314 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5380 | stac92hd71bxx_dmic_nids, | 5315 | stac92hd71bxx_dmic_nids, |
5381 | STAC92HD71BXX_NUM_DMICS); | 5316 | STAC92HD71BXX_NUM_DMICS); |
5382 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | 5317 | break; |
5383 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
5384 | } | 5318 | } |
5385 | 5319 | ||
5386 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) | 5320 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
@@ -5408,6 +5342,7 @@ again: | |||
5408 | 5342 | ||
5409 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); | 5343 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
5410 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); | 5344 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
5345 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5411 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); | 5346 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
5412 | 5347 | ||
5413 | switch (spec->board_config) { | 5348 | switch (spec->board_config) { |
@@ -5462,8 +5397,6 @@ again: | |||
5462 | #endif | 5397 | #endif |
5463 | 5398 | ||
5464 | spec->multiout.dac_nids = spec->dac_nids; | 5399 | spec->multiout.dac_nids = spec->dac_nids; |
5465 | if (spec->dinput_mux) | ||
5466 | spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; | ||
5467 | 5400 | ||
5468 | err = stac92xx_parse_auto_config(codec, 0x21, 0); | 5401 | err = stac92xx_parse_auto_config(codec, 0x21, 0); |
5469 | if (!err) { | 5402 | if (!err) { |
@@ -5541,8 +5474,8 @@ static int patch_stac922x(struct hda_codec *codec) | |||
5541 | 5474 | ||
5542 | again: | 5475 | again: |
5543 | if (spec->board_config < 0) | 5476 | if (spec->board_config < 0) |
5544 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " | 5477 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5545 | "using BIOS defaults\n"); | 5478 | codec->chip_name); |
5546 | else | 5479 | else |
5547 | stac92xx_set_config_regs(codec, | 5480 | stac92xx_set_config_regs(codec, |
5548 | stac922x_brd_tbl[spec->board_config]); | 5481 | stac922x_brd_tbl[spec->board_config]); |
@@ -5555,7 +5488,10 @@ static int patch_stac922x(struct hda_codec *codec) | |||
5555 | spec->num_pwrs = 0; | 5488 | spec->num_pwrs = 0; |
5556 | 5489 | ||
5557 | spec->init = stac922x_core_init; | 5490 | spec->init = stac922x_core_init; |
5558 | spec->mixer = stac922x_mixer; | 5491 | |
5492 | spec->num_caps = STAC922X_NUM_CAPS; | ||
5493 | spec->capvols = stac922x_capvols; | ||
5494 | spec->capsws = stac922x_capsws; | ||
5559 | 5495 | ||
5560 | spec->multiout.dac_nids = spec->dac_nids; | 5496 | spec->multiout.dac_nids = spec->dac_nids; |
5561 | 5497 | ||
@@ -5604,8 +5540,8 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5604 | stac927x_cfg_tbl); | 5540 | stac927x_cfg_tbl); |
5605 | again: | 5541 | again: |
5606 | if (spec->board_config < 0) | 5542 | if (spec->board_config < 0) |
5607 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 5543 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5608 | "STAC927x, using BIOS defaults\n"); | 5544 | codec->chip_name); |
5609 | else | 5545 | else |
5610 | stac92xx_set_config_regs(codec, | 5546 | stac92xx_set_config_regs(codec, |
5611 | stac927x_brd_tbl[spec->board_config]); | 5547 | stac927x_brd_tbl[spec->board_config]); |
@@ -5630,7 +5566,6 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5630 | spec->num_dmics = 0; | 5566 | spec->num_dmics = 0; |
5631 | 5567 | ||
5632 | spec->init = d965_core_init; | 5568 | spec->init = d965_core_init; |
5633 | spec->mixer = stac927x_mixer; | ||
5634 | break; | 5569 | break; |
5635 | case STAC_DELL_BIOS: | 5570 | case STAC_DELL_BIOS: |
5636 | switch (codec->subsystem_id) { | 5571 | switch (codec->subsystem_id) { |
@@ -5662,7 +5597,6 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5662 | spec->num_dmics = STAC927X_NUM_DMICS; | 5597 | spec->num_dmics = STAC927X_NUM_DMICS; |
5663 | 5598 | ||
5664 | spec->init = d965_core_init; | 5599 | spec->init = d965_core_init; |
5665 | spec->mixer = stac927x_mixer; | ||
5666 | spec->dmux_nids = stac927x_dmux_nids; | 5600 | spec->dmux_nids = stac927x_dmux_nids; |
5667 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); | 5601 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
5668 | break; | 5602 | break; |
@@ -5675,9 +5609,12 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5675 | spec->num_dmics = 0; | 5609 | spec->num_dmics = 0; |
5676 | 5610 | ||
5677 | spec->init = stac927x_core_init; | 5611 | spec->init = stac927x_core_init; |
5678 | spec->mixer = stac927x_mixer; | ||
5679 | } | 5612 | } |
5680 | 5613 | ||
5614 | spec->num_caps = STAC927X_NUM_CAPS; | ||
5615 | spec->capvols = stac927x_capvols; | ||
5616 | spec->capsws = stac927x_capsws; | ||
5617 | |||
5681 | spec->num_pwrs = 0; | 5618 | spec->num_pwrs = 0; |
5682 | spec->aloopback_ctl = stac927x_loopback; | 5619 | spec->aloopback_ctl = stac927x_loopback; |
5683 | spec->aloopback_mask = 0x40; | 5620 | spec->aloopback_mask = 0x40; |
@@ -5739,7 +5676,8 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5739 | stac9205_cfg_tbl); | 5676 | stac9205_cfg_tbl); |
5740 | again: | 5677 | again: |
5741 | if (spec->board_config < 0) | 5678 | if (spec->board_config < 0) |
5742 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); | 5679 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5680 | codec->chip_name); | ||
5743 | else | 5681 | else |
5744 | stac92xx_set_config_regs(codec, | 5682 | stac92xx_set_config_regs(codec, |
5745 | stac9205_brd_tbl[spec->board_config]); | 5683 | stac9205_brd_tbl[spec->board_config]); |
@@ -5758,9 +5696,12 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5758 | spec->num_pwrs = 0; | 5696 | spec->num_pwrs = 0; |
5759 | 5697 | ||
5760 | spec->init = stac9205_core_init; | 5698 | spec->init = stac9205_core_init; |
5761 | spec->mixer = stac9205_mixer; | ||
5762 | spec->aloopback_ctl = stac9205_loopback; | 5699 | spec->aloopback_ctl = stac9205_loopback; |
5763 | 5700 | ||
5701 | spec->num_caps = STAC9205_NUM_CAPS; | ||
5702 | spec->capvols = stac9205_capvols; | ||
5703 | spec->capsws = stac9205_capsws; | ||
5704 | |||
5764 | spec->aloopback_mask = 0x40; | 5705 | spec->aloopback_mask = 0x40; |
5765 | spec->aloopback_shift = 0; | 5706 | spec->aloopback_shift = 0; |
5766 | /* Turn on/off EAPD per HP plugging */ | 5707 | /* Turn on/off EAPD per HP plugging */ |
@@ -5835,12 +5776,6 @@ static struct hda_verb stac9872_core_init[] = { | |||
5835 | {} | 5776 | {} |
5836 | }; | 5777 | }; |
5837 | 5778 | ||
5838 | static struct snd_kcontrol_new stac9872_mixer[] = { | ||
5839 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | ||
5840 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | ||
5841 | { } /* end */ | ||
5842 | }; | ||
5843 | |||
5844 | static hda_nid_t stac9872_pin_nids[] = { | 5779 | static hda_nid_t stac9872_pin_nids[] = { |
5845 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | 5780 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
5846 | 0x11, 0x13, 0x14, | 5781 | 0x11, 0x13, 0x14, |
@@ -5854,6 +5789,11 @@ static hda_nid_t stac9872_mux_nids[] = { | |||
5854 | 0x15 | 5789 | 0x15 |
5855 | }; | 5790 | }; |
5856 | 5791 | ||
5792 | static unsigned long stac9872_capvols[] = { | ||
5793 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
5794 | }; | ||
5795 | #define stac9872_capsws stac9872_capvols | ||
5796 | |||
5857 | static unsigned int stac9872_vaio_pin_configs[9] = { | 5797 | static unsigned int stac9872_vaio_pin_configs[9] = { |
5858 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, | 5798 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
5859 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, | 5799 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
@@ -5891,8 +5831,8 @@ static int patch_stac9872(struct hda_codec *codec) | |||
5891 | stac9872_models, | 5831 | stac9872_models, |
5892 | stac9872_cfg_tbl); | 5832 | stac9872_cfg_tbl); |
5893 | if (spec->board_config < 0) | 5833 | if (spec->board_config < 0) |
5894 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, " | 5834 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5895 | "using BIOS defaults\n"); | 5835 | codec->chip_name); |
5896 | else | 5836 | else |
5897 | stac92xx_set_config_regs(codec, | 5837 | stac92xx_set_config_regs(codec, |
5898 | stac9872_brd_tbl[spec->board_config]); | 5838 | stac9872_brd_tbl[spec->board_config]); |
@@ -5902,8 +5842,10 @@ static int patch_stac9872(struct hda_codec *codec) | |||
5902 | spec->adc_nids = stac9872_adc_nids; | 5842 | spec->adc_nids = stac9872_adc_nids; |
5903 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); | 5843 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
5904 | spec->mux_nids = stac9872_mux_nids; | 5844 | spec->mux_nids = stac9872_mux_nids; |
5905 | spec->mixer = stac9872_mixer; | ||
5906 | spec->init = stac9872_core_init; | 5845 | spec->init = stac9872_core_init; |
5846 | spec->num_caps = 1; | ||
5847 | spec->capvols = stac9872_capvols; | ||
5848 | spec->capsws = stac9872_capsws; | ||
5907 | 5849 | ||
5908 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); | 5850 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); |
5909 | if (err < 0) { | 5851 | if (err < 0) { |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index e8f10b10cceb..ee89db90c9b6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1339,8 +1339,7 @@ static int get_mux_nids(struct hda_codec *codec) | |||
1339 | for (i = 0; i < spec->num_adc_nids; i++) { | 1339 | for (i = 0; i < spec->num_adc_nids; i++) { |
1340 | nid = spec->adc_nids[i]; | 1340 | nid = spec->adc_nids[i]; |
1341 | while (nid) { | 1341 | while (nid) { |
1342 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) | 1342 | type = get_wcaps_type(get_wcaps(codec, nid)); |
1343 | >> AC_WCAP_TYPE_SHIFT; | ||
1344 | if (type == AC_WID_PIN) | 1343 | if (type == AC_WID_PIN) |
1345 | break; | 1344 | break; |
1346 | n = snd_hda_get_connections(codec, nid, conn, | 1345 | n = snd_hda_get_connections(codec, nid, conn, |