diff options
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_beep.c | 134 | ||||
-rw-r--r-- | sound/pci/hda/hda_beep.h | 44 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 113 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 93 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 146 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 24 | ||||
-rw-r--r-- | sound/pci/hda/hda_patch.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 25 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 96 | ||||
-rw-r--r-- | sound/pci/hda/patch_atihdmi.c | 45 | ||||
-rw-r--r-- | sound/pci/hda/patch_nvhdmi.c | 165 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 1900 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 1008 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 1407 |
16 files changed, 4730 insertions, 477 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index ab0c726d648..1980c6d207e 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -5,6 +5,7 @@ snd-hda-intel-y := hda_intel.o | |||
5 | snd-hda-intel-y += hda_codec.o | 5 | snd-hda-intel-y += hda_codec.o |
6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o | 6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o |
7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-intel-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | ||
8 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 9 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
9 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_REALTEK) += patch_realtek.o | 10 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_REALTEK) += patch_realtek.o |
10 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CMEDIA) += patch_cmedia.o | 11 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CMEDIA) += patch_cmedia.o |
@@ -14,5 +15,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o | |||
14 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o | 15 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o |
15 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o | 16 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o |
16 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o | 17 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o |
18 | snd-hda-intel-$(CONFIG_SND_HDA_CODEC_NVHDMI) += patch_nvhdmi.o | ||
17 | 19 | ||
18 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o | 20 | obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c new file mode 100644 index 00000000000..9b77b3e0fa9 --- /dev/null +++ b/sound/pci/hda/hda_beep.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * Digital Beep Input Interface for HD-audio codec | ||
3 | * | ||
4 | * Author: Matthew Ranostay <mranostay@embeddedalley.com> | ||
5 | * Copyright (c) 2008 Embedded Alley Solutions Inc | ||
6 | * | ||
7 | * This driver is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This driver is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/input.h> | ||
23 | #include <linux/pci.h> | ||
24 | #include <linux/workqueue.h> | ||
25 | #include <sound/core.h> | ||
26 | #include "hda_beep.h" | ||
27 | |||
28 | enum { | ||
29 | DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ | ||
30 | DIGBEEP_HZ_MIN = 93750, /* 93.750 Hz */ | ||
31 | DIGBEEP_HZ_MAX = 12000000, /* 12 KHz */ | ||
32 | }; | ||
33 | |||
34 | static void snd_hda_generate_beep(struct work_struct *work) | ||
35 | { | ||
36 | struct hda_beep *beep = | ||
37 | container_of(work, struct hda_beep, beep_work); | ||
38 | struct hda_codec *codec = beep->codec; | ||
39 | |||
40 | /* generate tone */ | ||
41 | snd_hda_codec_write_cache(codec, beep->nid, 0, | ||
42 | AC_VERB_SET_BEEP_CONTROL, beep->tone); | ||
43 | } | ||
44 | |||
45 | static int snd_hda_beep_event(struct input_dev *dev, unsigned int type, | ||
46 | unsigned int code, int hz) | ||
47 | { | ||
48 | struct hda_beep *beep = input_get_drvdata(dev); | ||
49 | |||
50 | switch (code) { | ||
51 | case SND_BELL: | ||
52 | if (hz) | ||
53 | hz = 1000; | ||
54 | case SND_TONE: | ||
55 | hz *= 1000; /* fixed point */ | ||
56 | hz = hz - DIGBEEP_HZ_MIN; | ||
57 | if (hz < 0) | ||
58 | hz = 0; /* turn off PC beep*/ | ||
59 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) | ||
60 | hz = 0xff; | ||
61 | else { | ||
62 | hz /= DIGBEEP_HZ_STEP; | ||
63 | hz++; | ||
64 | } | ||
65 | break; | ||
66 | default: | ||
67 | return -1; | ||
68 | } | ||
69 | beep->tone = hz; | ||
70 | |||
71 | /* schedule beep event */ | ||
72 | schedule_work(&beep->beep_work); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | ||
77 | { | ||
78 | struct input_dev *input_dev; | ||
79 | struct hda_beep *beep; | ||
80 | int err; | ||
81 | |||
82 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); | ||
83 | if (beep == NULL) | ||
84 | return -ENOMEM; | ||
85 | snprintf(beep->phys, sizeof(beep->phys), | ||
86 | "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); | ||
87 | input_dev = input_allocate_device(); | ||
88 | |||
89 | /* setup digital beep device */ | ||
90 | input_dev->name = "HDA Digital PCBeep"; | ||
91 | input_dev->phys = beep->phys; | ||
92 | input_dev->id.bustype = BUS_PCI; | ||
93 | |||
94 | input_dev->id.vendor = codec->vendor_id >> 16; | ||
95 | input_dev->id.product = codec->vendor_id & 0xffff; | ||
96 | input_dev->id.version = 0x01; | ||
97 | |||
98 | input_dev->evbit[0] = BIT_MASK(EV_SND); | ||
99 | input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); | ||
100 | input_dev->event = snd_hda_beep_event; | ||
101 | input_dev->dev.parent = &codec->bus->pci->dev; | ||
102 | input_set_drvdata(input_dev, beep); | ||
103 | |||
104 | err = input_register_device(input_dev); | ||
105 | if (err < 0) { | ||
106 | input_free_device(input_dev); | ||
107 | kfree(beep); | ||
108 | return err; | ||
109 | } | ||
110 | |||
111 | /* enable linear scale */ | ||
112 | snd_hda_codec_write(codec, nid, 0, | ||
113 | AC_VERB_SET_DIGI_CONVERT_2, 0x01); | ||
114 | |||
115 | beep->nid = nid; | ||
116 | beep->dev = input_dev; | ||
117 | beep->codec = codec; | ||
118 | codec->beep = beep; | ||
119 | |||
120 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | void snd_hda_detach_beep_device(struct hda_codec *codec) | ||
125 | { | ||
126 | struct hda_beep *beep = codec->beep; | ||
127 | if (beep) { | ||
128 | cancel_work_sync(&beep->beep_work); | ||
129 | flush_scheduled_work(); | ||
130 | |||
131 | input_unregister_device(beep->dev); | ||
132 | kfree(beep); | ||
133 | } | ||
134 | } | ||
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h new file mode 100644 index 00000000000..de4036e6e71 --- /dev/null +++ b/sound/pci/hda/hda_beep.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Digital Beep Input Interface for HD-audio codec | ||
3 | * | ||
4 | * Author: Matthew Ranostay <mranostay@embeddedalley.com> | ||
5 | * Copyright (c) 2008 Embedded Alley Solutions Inc | ||
6 | * | ||
7 | * This driver is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This driver is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef __SOUND_HDA_BEEP_H | ||
23 | #define __SOUND_HDA_BEEP_H | ||
24 | |||
25 | #include "hda_codec.h" | ||
26 | |||
27 | /* beep information */ | ||
28 | struct hda_beep { | ||
29 | struct input_dev *dev; | ||
30 | struct hda_codec *codec; | ||
31 | char phys[32]; | ||
32 | int tone; | ||
33 | int nid; | ||
34 | struct work_struct beep_work; /* scheduled task for beep event */ | ||
35 | }; | ||
36 | |||
37 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
38 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); | ||
39 | void snd_hda_detach_beep_device(struct hda_codec *codec); | ||
40 | #else | ||
41 | #define snd_hda_attach_beep_device(...) | ||
42 | #define snd_hda_detach_beep_device(...) | ||
43 | #endif | ||
44 | #endif | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d2e1093f8e9..6447754ae56 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -94,6 +94,9 @@ static const struct hda_codec_preset *hda_preset_tables[] = { | |||
94 | #ifdef CONFIG_SND_HDA_CODEC_VIA | 94 | #ifdef CONFIG_SND_HDA_CODEC_VIA |
95 | snd_hda_preset_via, | 95 | snd_hda_preset_via, |
96 | #endif | 96 | #endif |
97 | #ifdef CONFIG_SND_HDA_CODEC_NVHDMI | ||
98 | snd_hda_preset_nvhdmi, | ||
99 | #endif | ||
97 | NULL | 100 | NULL |
98 | }; | 101 | }; |
99 | 102 | ||
@@ -211,7 +214,8 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
211 | unsigned int shift, num_elems, mask; | 214 | unsigned int shift, num_elems, mask; |
212 | hda_nid_t prev_nid; | 215 | hda_nid_t prev_nid; |
213 | 216 | ||
214 | snd_assert(conn_list && max_conns > 0, return -EINVAL); | 217 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) |
218 | return -EINVAL; | ||
215 | 219 | ||
216 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); | 220 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); |
217 | if (parm & AC_CLIST_LONG) { | 221 | if (parm & AC_CLIST_LONG) { |
@@ -313,7 +317,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) | |||
313 | } | 317 | } |
314 | 318 | ||
315 | /* | 319 | /* |
316 | * process queueud unsolicited events | 320 | * process queued unsolicited events |
317 | */ | 321 | */ |
318 | static void process_unsol_events(struct work_struct *work) | 322 | static void process_unsol_events(struct work_struct *work) |
319 | { | 323 | { |
@@ -407,8 +411,10 @@ int __devinit snd_hda_bus_new(struct snd_card *card, | |||
407 | .dev_free = snd_hda_bus_dev_free, | 411 | .dev_free = snd_hda_bus_dev_free, |
408 | }; | 412 | }; |
409 | 413 | ||
410 | snd_assert(temp, return -EINVAL); | 414 | if (snd_BUG_ON(!temp)) |
411 | snd_assert(temp->ops.command && temp->ops.get_response, return -EINVAL); | 415 | return -EINVAL; |
416 | if (snd_BUG_ON(!temp->ops.command || !temp->ops.get_response)) | ||
417 | return -EINVAL; | ||
412 | 418 | ||
413 | if (busp) | 419 | if (busp) |
414 | *busp = NULL; | 420 | *busp = NULL; |
@@ -585,11 +591,13 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
585 | struct hda_codec **codecp) | 591 | struct hda_codec **codecp) |
586 | { | 592 | { |
587 | struct hda_codec *codec; | 593 | struct hda_codec *codec; |
588 | char component[13]; | 594 | char component[31]; |
589 | int err; | 595 | int err; |
590 | 596 | ||
591 | snd_assert(bus, return -EINVAL); | 597 | if (snd_BUG_ON(!bus)) |
592 | snd_assert(codec_addr <= HDA_MAX_CODEC_ADDRESS, return -EINVAL); | 598 | return -EINVAL; |
599 | if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) | ||
600 | return -EINVAL; | ||
593 | 601 | ||
594 | if (bus->caddr_tbl[codec_addr]) { | 602 | if (bus->caddr_tbl[codec_addr]) { |
595 | snd_printk(KERN_ERR "hda_codec: " | 603 | snd_printk(KERN_ERR "hda_codec: " |
@@ -688,7 +696,7 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
688 | snd_hda_create_hwdep(codec); | 696 | snd_hda_create_hwdep(codec); |
689 | #endif | 697 | #endif |
690 | 698 | ||
691 | sprintf(component, "HDA:%08x", codec->vendor_id); | 699 | sprintf(component, "HDA:%08x,%08x,%08x", codec->vendor_id, codec->subsystem_id, codec->revision_id); |
692 | snd_component_add(codec->bus->card, component); | 700 | snd_component_add(codec->bus->card, component); |
693 | 701 | ||
694 | if (codecp) | 702 | if (codecp) |
@@ -956,15 +964,6 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec) | |||
956 | } | 964 | } |
957 | #endif /* SND_HDA_NEEDS_RESUME */ | 965 | #endif /* SND_HDA_NEEDS_RESUME */ |
958 | 966 | ||
959 | /* | ||
960 | * AMP control callbacks | ||
961 | */ | ||
962 | /* retrieve parameters from private_value */ | ||
963 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | ||
964 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | ||
965 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | ||
966 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | ||
967 | |||
968 | /* volume */ | 967 | /* volume */ |
969 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | 968 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, |
970 | struct snd_ctl_elem_info *uinfo) | 969 | struct snd_ctl_elem_info *uinfo) |
@@ -1430,6 +1429,29 @@ static unsigned int convert_to_spdif_status(unsigned short val) | |||
1430 | return sbits; | 1429 | return sbits; |
1431 | } | 1430 | } |
1432 | 1431 | ||
1432 | /* set digital convert verbs both for the given NID and its slaves */ | ||
1433 | static void set_dig_out(struct hda_codec *codec, hda_nid_t nid, | ||
1434 | int verb, int val) | ||
1435 | { | ||
1436 | hda_nid_t *d; | ||
1437 | |||
1438 | snd_hda_codec_write(codec, nid, 0, verb, val); | ||
1439 | d = codec->slave_dig_outs; | ||
1440 | if (!d) | ||
1441 | return; | ||
1442 | for (; *d; d++) | ||
1443 | snd_hda_codec_write(codec, *d, 0, verb, val); | ||
1444 | } | ||
1445 | |||
1446 | static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, | ||
1447 | int dig1, int dig2) | ||
1448 | { | ||
1449 | if (dig1 != -1) | ||
1450 | set_dig_out(codec, nid, AC_VERB_SET_DIGI_CONVERT_1, dig1); | ||
1451 | if (dig2 != -1) | ||
1452 | set_dig_out(codec, nid, AC_VERB_SET_DIGI_CONVERT_2, dig2); | ||
1453 | } | ||
1454 | |||
1433 | static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, | 1455 | static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, |
1434 | struct snd_ctl_elem_value *ucontrol) | 1456 | struct snd_ctl_elem_value *ucontrol) |
1435 | { | 1457 | { |
@@ -1448,14 +1470,8 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1448 | change = codec->spdif_ctls != val; | 1470 | change = codec->spdif_ctls != val; |
1449 | codec->spdif_ctls = val; | 1471 | codec->spdif_ctls = val; |
1450 | 1472 | ||
1451 | if (change) { | 1473 | if (change) |
1452 | snd_hda_codec_write_cache(codec, nid, 0, | 1474 | set_dig_out_convert(codec, nid, val & 0xff, (val >> 8) & 0xff); |
1453 | AC_VERB_SET_DIGI_CONVERT_1, | ||
1454 | val & 0xff); | ||
1455 | snd_hda_codec_write_cache(codec, nid, 0, | ||
1456 | AC_VERB_SET_DIGI_CONVERT_2, | ||
1457 | val >> 8); | ||
1458 | } | ||
1459 | 1475 | ||
1460 | mutex_unlock(&codec->spdif_mutex); | 1476 | mutex_unlock(&codec->spdif_mutex); |
1461 | return change; | 1477 | return change; |
@@ -1487,9 +1503,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, | |||
1487 | change = codec->spdif_ctls != val; | 1503 | change = codec->spdif_ctls != val; |
1488 | if (change) { | 1504 | if (change) { |
1489 | codec->spdif_ctls = val; | 1505 | codec->spdif_ctls = val; |
1490 | snd_hda_codec_write_cache(codec, nid, 0, | 1506 | set_dig_out_convert(codec, nid, val & 0xff, -1); |
1491 | AC_VERB_SET_DIGI_CONVERT_1, | ||
1492 | val & 0xff); | ||
1493 | /* unmute amp switch (if any) */ | 1507 | /* unmute amp switch (if any) */ |
1494 | if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) && | 1508 | if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) && |
1495 | (val & AC_DIG1_ENABLE)) | 1509 | (val & AC_DIG1_ENABLE)) |
@@ -2236,11 +2250,13 @@ static int __devinit set_pcm_default_values(struct hda_codec *codec, | |||
2236 | if (info->ops.close == NULL) | 2250 | if (info->ops.close == NULL) |
2237 | info->ops.close = hda_pcm_default_open_close; | 2251 | info->ops.close = hda_pcm_default_open_close; |
2238 | if (info->ops.prepare == NULL) { | 2252 | if (info->ops.prepare == NULL) { |
2239 | snd_assert(info->nid, return -EINVAL); | 2253 | if (snd_BUG_ON(!info->nid)) |
2254 | return -EINVAL; | ||
2240 | info->ops.prepare = hda_pcm_default_prepare; | 2255 | info->ops.prepare = hda_pcm_default_prepare; |
2241 | } | 2256 | } |
2242 | if (info->ops.cleanup == NULL) { | 2257 | if (info->ops.cleanup == NULL) { |
2243 | snd_assert(info->nid, return -EINVAL); | 2258 | if (snd_BUG_ON(!info->nid)) |
2259 | return -EINVAL; | ||
2244 | info->ops.cleanup = hda_pcm_default_cleanup; | 2260 | info->ops.cleanup = hda_pcm_default_cleanup; |
2245 | } | 2261 | } |
2246 | return 0; | 2262 | return 0; |
@@ -2583,14 +2599,31 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | |||
2583 | unsigned int stream_tag, unsigned int format) | 2599 | unsigned int stream_tag, unsigned int format) |
2584 | { | 2600 | { |
2585 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 2601 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
2586 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | 2602 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
2587 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | 2603 | set_dig_out_convert(codec, nid, |
2588 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 2604 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, |
2605 | -1); | ||
2589 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | 2606 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
2607 | if (codec->slave_dig_outs) { | ||
2608 | hda_nid_t *d; | ||
2609 | for (d = codec->slave_dig_outs; *d; d++) | ||
2610 | snd_hda_codec_setup_stream(codec, *d, stream_tag, 0, | ||
2611 | format); | ||
2612 | } | ||
2590 | /* turn on again (if needed) */ | 2613 | /* turn on again (if needed) */ |
2591 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | 2614 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
2592 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | 2615 | set_dig_out_convert(codec, nid, |
2593 | codec->spdif_ctls & 0xff); | 2616 | codec->spdif_ctls & 0xff, -1); |
2617 | } | ||
2618 | |||
2619 | static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid) | ||
2620 | { | ||
2621 | snd_hda_codec_cleanup_stream(codec, nid); | ||
2622 | if (codec->slave_dig_outs) { | ||
2623 | hda_nid_t *d; | ||
2624 | for (d = codec->slave_dig_outs; *d; d++) | ||
2625 | snd_hda_codec_cleanup_stream(codec, *d); | ||
2626 | } | ||
2594 | } | 2627 | } |
2595 | 2628 | ||
2596 | /* | 2629 | /* |
@@ -2602,7 +2635,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec, | |||
2602 | mutex_lock(&codec->spdif_mutex); | 2635 | mutex_lock(&codec->spdif_mutex); |
2603 | if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) | 2636 | if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) |
2604 | /* already opened as analog dup; reset it once */ | 2637 | /* already opened as analog dup; reset it once */ |
2605 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); | 2638 | cleanup_dig_out_stream(codec, mout->dig_out_nid); |
2606 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; | 2639 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; |
2607 | mutex_unlock(&codec->spdif_mutex); | 2640 | mutex_unlock(&codec->spdif_mutex); |
2608 | return 0; | 2641 | return 0; |
@@ -2697,7 +2730,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | |||
2697 | stream_tag, format); | 2730 | stream_tag, format); |
2698 | } else { | 2731 | } else { |
2699 | mout->dig_out_used = 0; | 2732 | mout->dig_out_used = 0; |
2700 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); | 2733 | cleanup_dig_out_stream(codec, mout->dig_out_nid); |
2701 | } | 2734 | } |
2702 | } | 2735 | } |
2703 | mutex_unlock(&codec->spdif_mutex); | 2736 | mutex_unlock(&codec->spdif_mutex); |
@@ -2748,7 +2781,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
2748 | mout->extra_out_nid[i]); | 2781 | mout->extra_out_nid[i]); |
2749 | mutex_lock(&codec->spdif_mutex); | 2782 | mutex_lock(&codec->spdif_mutex); |
2750 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { | 2783 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { |
2751 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); | 2784 | cleanup_dig_out_stream(codec, mout->dig_out_nid); |
2752 | mout->dig_out_used = 0; | 2785 | mout->dig_out_used = 0; |
2753 | } | 2786 | } |
2754 | mutex_unlock(&codec->spdif_mutex); | 2787 | mutex_unlock(&codec->spdif_mutex); |
@@ -2756,7 +2789,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
2756 | } | 2789 | } |
2757 | 2790 | ||
2758 | /* | 2791 | /* |
2759 | * Helper for automatic ping configuration | 2792 | * Helper for automatic pin configuration |
2760 | */ | 2793 | */ |
2761 | 2794 | ||
2762 | static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) | 2795 | static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index efc682888b3..60468f56240 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -90,6 +90,14 @@ enum { | |||
90 | #define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c | 90 | #define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c |
91 | /* f20: AFG/MFG */ | 91 | /* f20: AFG/MFG */ |
92 | #define AC_VERB_GET_SUBSYSTEM_ID 0x0f20 | 92 | #define AC_VERB_GET_SUBSYSTEM_ID 0x0f20 |
93 | #define AC_VERB_GET_CVT_CHAN_COUNT 0x0f2d | ||
94 | #define AC_VERB_GET_HDMI_DIP_SIZE 0x0f2e | ||
95 | #define AC_VERB_GET_HDMI_ELDD 0x0f2f | ||
96 | #define AC_VERB_GET_HDMI_DIP_INDEX 0x0f30 | ||
97 | #define AC_VERB_GET_HDMI_DIP_DATA 0x0f31 | ||
98 | #define AC_VERB_GET_HDMI_DIP_XMIT 0x0f32 | ||
99 | #define AC_VERB_GET_HDMI_CP_CTRL 0x0f33 | ||
100 | #define AC_VERB_GET_HDMI_CHAN_SLOT 0x0f34 | ||
93 | 101 | ||
94 | /* | 102 | /* |
95 | * SET verbs | 103 | * SET verbs |
@@ -121,7 +129,14 @@ enum { | |||
121 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d | 129 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d |
122 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e | 130 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e |
123 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_3 0x71f | 131 | #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_3 0x71f |
132 | #define AC_VERB_SET_EAPD 0x788 | ||
124 | #define AC_VERB_SET_CODEC_RESET 0x7ff | 133 | #define AC_VERB_SET_CODEC_RESET 0x7ff |
134 | #define AC_VERB_SET_CVT_CHAN_COUNT 0x72d | ||
135 | #define AC_VERB_SET_HDMI_DIP_INDEX 0x730 | ||
136 | #define AC_VERB_SET_HDMI_DIP_DATA 0x731 | ||
137 | #define AC_VERB_SET_HDMI_DIP_XMIT 0x732 | ||
138 | #define AC_VERB_SET_HDMI_CP_CTRL 0x733 | ||
139 | #define AC_VERB_SET_HDMI_CHAN_SLOT 0x734 | ||
125 | 140 | ||
126 | /* | 141 | /* |
127 | * Parameter IDs | 142 | * Parameter IDs |
@@ -143,6 +158,7 @@ enum { | |||
143 | #define AC_PAR_GPIO_CAP 0x11 | 158 | #define AC_PAR_GPIO_CAP 0x11 |
144 | #define AC_PAR_AMP_OUT_CAP 0x12 | 159 | #define AC_PAR_AMP_OUT_CAP 0x12 |
145 | #define AC_PAR_VOL_KNB_CAP 0x13 | 160 | #define AC_PAR_VOL_KNB_CAP 0x13 |
161 | #define AC_PAR_HDMI_LPCM_CAP 0x20 | ||
146 | 162 | ||
147 | /* | 163 | /* |
148 | * AC_VERB_PARAMETERS results (32bit) | 164 | * AC_VERB_PARAMETERS results (32bit) |
@@ -171,6 +187,8 @@ enum { | |||
171 | #define AC_WCAP_DIGITAL (1<<9) /* digital I/O */ | 187 | #define AC_WCAP_DIGITAL (1<<9) /* digital I/O */ |
172 | #define AC_WCAP_POWER (1<<10) /* power control */ | 188 | #define AC_WCAP_POWER (1<<10) /* power control */ |
173 | #define AC_WCAP_LR_SWAP (1<<11) /* L/R swap */ | 189 | #define AC_WCAP_LR_SWAP (1<<11) /* L/R swap */ |
190 | #define AC_WCAP_CP_CAPS (1<<12) /* content protection */ | ||
191 | #define AC_WCAP_CHAN_CNT_EXT (7<<13) /* channel count ext */ | ||
174 | #define AC_WCAP_DELAY (0xf<<16) | 192 | #define AC_WCAP_DELAY (0xf<<16) |
175 | #define AC_WCAP_DELAY_SHIFT 16 | 193 | #define AC_WCAP_DELAY_SHIFT 16 |
176 | #define AC_WCAP_TYPE (0xf<<20) | 194 | #define AC_WCAP_TYPE (0xf<<20) |
@@ -206,9 +224,20 @@ enum { | |||
206 | /* Input converter SDI select */ | 224 | /* Input converter SDI select */ |
207 | #define AC_SDI_SELECT (0xf<<0) | 225 | #define AC_SDI_SELECT (0xf<<0) |
208 | 226 | ||
209 | /* Unsolicited response */ | 227 | /* Unsolicited response control */ |
210 | #define AC_UNSOL_TAG (0x3f<<0) | 228 | #define AC_UNSOL_TAG (0x3f<<0) |
211 | #define AC_UNSOL_ENABLED (1<<7) | 229 | #define AC_UNSOL_ENABLED (1<<7) |
230 | #define AC_USRSP_EN AC_UNSOL_ENABLED | ||
231 | |||
232 | /* Unsolicited responses */ | ||
233 | #define AC_UNSOL_RES_TAG (0x3f<<26) | ||
234 | #define AC_UNSOL_RES_TAG_SHIFT 26 | ||
235 | #define AC_UNSOL_RES_SUBTAG (0x1f<<21) | ||
236 | #define AC_UNSOL_RES_SUBTAG_SHIFT 21 | ||
237 | #define AC_UNSOL_RES_ELDV (1<<1) /* ELD Data valid (for HDMI) */ | ||
238 | #define AC_UNSOL_RES_PD (1<<0) /* pinsense detect */ | ||
239 | #define AC_UNSOL_RES_CP_STATE (1<<1) /* content protection */ | ||
240 | #define AC_UNSOL_RES_CP_READY (1<<0) /* content protection */ | ||
212 | 241 | ||
213 | /* Pin widget capabilies */ | 242 | /* Pin widget capabilies */ |
214 | #define AC_PINCAP_IMP_SENSE (1<<0) /* impedance sense capable */ | 243 | #define AC_PINCAP_IMP_SENSE (1<<0) /* impedance sense capable */ |
@@ -222,6 +251,10 @@ enum { | |||
222 | * but is marked reserved in the Intel HDA specification. | 251 | * but is marked reserved in the Intel HDA specification. |
223 | */ | 252 | */ |
224 | #define AC_PINCAP_LR_SWAP (1<<7) /* L/R swap */ | 253 | #define AC_PINCAP_LR_SWAP (1<<7) /* L/R swap */ |
254 | /* Note: The same bit as LR_SWAP is newly defined as HDMI capability | ||
255 | * in HD-audio specification | ||
256 | */ | ||
257 | #define AC_PINCAP_HDMI (1<<7) /* HDMI pin */ | ||
225 | #define AC_PINCAP_VREF (0x37<<8) | 258 | #define AC_PINCAP_VREF (0x37<<8) |
226 | #define AC_PINCAP_VREF_SHIFT 8 | 259 | #define AC_PINCAP_VREF_SHIFT 8 |
227 | #define AC_PINCAP_EAPD (1<<16) /* EAPD capable */ | 260 | #define AC_PINCAP_EAPD (1<<16) /* EAPD capable */ |
@@ -272,6 +305,22 @@ enum { | |||
272 | #define AC_KNBCAP_NUM_STEPS (0x7f<<0) | 305 | #define AC_KNBCAP_NUM_STEPS (0x7f<<0) |
273 | #define AC_KNBCAP_DELTA (1<<7) | 306 | #define AC_KNBCAP_DELTA (1<<7) |
274 | 307 | ||
308 | /* HDMI LPCM capabilities */ | ||
309 | #define AC_LPCMCAP_48K_CP_CHNS (0x0f<<0) /* max channels w/ CP-on */ | ||
310 | #define AC_LPCMCAP_48K_NO_CHNS (0x0f<<4) /* max channels w/o CP-on */ | ||
311 | #define AC_LPCMCAP_48K_20BIT (1<<8) /* 20b bitrate supported */ | ||
312 | #define AC_LPCMCAP_48K_24BIT (1<<9) /* 24b bitrate supported */ | ||
313 | #define AC_LPCMCAP_96K_CP_CHNS (0x0f<<10) /* max channels w/ CP-on */ | ||
314 | #define AC_LPCMCAP_96K_NO_CHNS (0x0f<<14) /* max channels w/o CP-on */ | ||
315 | #define AC_LPCMCAP_96K_20BIT (1<<18) /* 20b bitrate supported */ | ||
316 | #define AC_LPCMCAP_96K_24BIT (1<<19) /* 24b bitrate supported */ | ||
317 | #define AC_LPCMCAP_192K_CP_CHNS (0x0f<<20) /* max channels w/ CP-on */ | ||
318 | #define AC_LPCMCAP_192K_NO_CHNS (0x0f<<24) /* max channels w/o CP-on */ | ||
319 | #define AC_LPCMCAP_192K_20BIT (1<<28) /* 20b bitrate supported */ | ||
320 | #define AC_LPCMCAP_192K_24BIT (1<<29) /* 24b bitrate supported */ | ||
321 | #define AC_LPCMCAP_44K (1<<30) /* 44.1kHz support */ | ||
322 | #define AC_LPCMCAP_44K_MS (1<<31) /* 44.1kHz-multiplies support */ | ||
323 | |||
275 | /* | 324 | /* |
276 | * Control Parameters | 325 | * Control Parameters |
277 | */ | 326 | */ |
@@ -317,18 +366,44 @@ enum { | |||
317 | #define AC_PINCTL_OUT_EN (1<<6) | 366 | #define AC_PINCTL_OUT_EN (1<<6) |
318 | #define AC_PINCTL_HP_EN (1<<7) | 367 | #define AC_PINCTL_HP_EN (1<<7) |
319 | 368 | ||
320 | /* Unsolicited response - 8bit */ | ||
321 | #define AC_USRSP_EN (1<<7) | ||
322 | |||
323 | /* Pin sense - 32bit */ | 369 | /* Pin sense - 32bit */ |
324 | #define AC_PINSENSE_IMPEDANCE_MASK (0x7fffffff) | 370 | #define AC_PINSENSE_IMPEDANCE_MASK (0x7fffffff) |
325 | #define AC_PINSENSE_PRESENCE (1<<31) | 371 | #define AC_PINSENSE_PRESENCE (1<<31) |
372 | #define AC_PINSENSE_ELDV (1<<30) /* ELD valid (HDMI) */ | ||
326 | 373 | ||
327 | /* EAPD/BTL enable - 32bit */ | 374 | /* EAPD/BTL enable - 32bit */ |
328 | #define AC_EAPDBTL_BALANCED (1<<0) | 375 | #define AC_EAPDBTL_BALANCED (1<<0) |
329 | #define AC_EAPDBTL_EAPD (1<<1) | 376 | #define AC_EAPDBTL_EAPD (1<<1) |
330 | #define AC_EAPDBTL_LR_SWAP (1<<2) | 377 | #define AC_EAPDBTL_LR_SWAP (1<<2) |
331 | 378 | ||
379 | /* HDMI ELD data */ | ||
380 | #define AC_ELDD_ELD_VALID (1<<31) | ||
381 | #define AC_ELDD_ELD_DATA 0xff | ||
382 | |||
383 | /* HDMI DIP size */ | ||
384 | #define AC_DIPSIZE_ELD_BUF (1<<3) /* ELD buf size of packet size */ | ||
385 | #define AC_DIPSIZE_PACK_IDX (0x07<<0) /* packet index */ | ||
386 | |||
387 | /* HDMI DIP index */ | ||
388 | #define AC_DIPIDX_PACK_IDX (0x07<<5) /* packet idnex */ | ||
389 | #define AC_DIPIDX_BYTE_IDX (0x1f<<0) /* byte index */ | ||
390 | |||
391 | /* HDMI DIP xmit (transmit) control */ | ||
392 | #define AC_DIPXMIT_MASK (0x3<<6) | ||
393 | #define AC_DIPXMIT_DISABLE (0x0<<6) /* disable xmit */ | ||
394 | #define AC_DIPXMIT_ONCE (0x2<<6) /* xmit once then disable */ | ||
395 | #define AC_DIPXMIT_BEST (0x3<<6) /* best effort */ | ||
396 | |||
397 | /* HDMI content protection (CP) control */ | ||
398 | #define AC_CPCTRL_CES (1<<9) /* current encryption state */ | ||
399 | #define AC_CPCTRL_READY (1<<8) /* ready bit */ | ||
400 | #define AC_CPCTRL_SUBTAG (0x1f<<3) /* subtag for unsol-resp */ | ||
401 | #define AC_CPCTRL_STATE (3<<0) /* current CP request state */ | ||
402 | |||
403 | /* Converter channel <-> HDMI slot mapping */ | ||
404 | #define AC_CVTMAP_HDMI_SLOT (0xf<<0) /* HDMI slot number */ | ||
405 | #define AC_CVTMAP_CHAN (0xf<<4) /* converter channel number */ | ||
406 | |||
332 | /* configuration default - 32bit */ | 407 | /* configuration default - 32bit */ |
333 | #define AC_DEFCFG_SEQUENCE (0xf<<0) | 408 | #define AC_DEFCFG_SEQUENCE (0xf<<0) |
334 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) | 409 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) |
@@ -449,6 +524,7 @@ enum { | |||
449 | */ | 524 | */ |
450 | 525 | ||
451 | struct hda_bus; | 526 | struct hda_bus; |
527 | struct hda_beep; | ||
452 | struct hda_codec; | 528 | struct hda_codec; |
453 | struct hda_pcm; | 529 | struct hda_pcm; |
454 | struct hda_pcm_stream; | 530 | struct hda_pcm_stream; |
@@ -634,6 +710,9 @@ struct hda_codec { | |||
634 | /* codec specific info */ | 710 | /* codec specific info */ |
635 | void *spec; | 711 | void *spec; |
636 | 712 | ||
713 | /* beep device */ | ||
714 | struct hda_beep *beep; | ||
715 | |||
637 | /* widget capabilities cache */ | 716 | /* widget capabilities cache */ |
638 | unsigned int num_nodes; | 717 | unsigned int num_nodes; |
639 | hda_nid_t start_nid; | 718 | hda_nid_t start_nid; |
@@ -646,9 +725,15 @@ struct hda_codec { | |||
646 | unsigned int spdif_status; /* IEC958 status bits */ | 725 | unsigned int spdif_status; /* IEC958 status bits */ |
647 | unsigned short spdif_ctls; /* SPDIF control bits */ | 726 | unsigned short spdif_ctls; /* SPDIF control bits */ |
648 | unsigned int spdif_in_enable; /* SPDIF input enable? */ | 727 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
728 | hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ | ||
649 | 729 | ||
650 | struct snd_hwdep *hwdep; /* assigned hwdep device */ | 730 | struct snd_hwdep *hwdep; /* assigned hwdep device */ |
651 | 731 | ||
732 | /* misc flags */ | ||
733 | unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each | ||
734 | * status change | ||
735 | * (e.g. Realtek codecs) | ||
736 | */ | ||
652 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 737 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
653 | unsigned int power_on :1; /* current (global) power-state */ | 738 | unsigned int power_on :1; /* current (global) power-state */ |
654 | unsigned int power_transition :1; /* power-state in transition */ | 739 | unsigned int power_transition :1; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 59e4389c94a..0ca30894f7c 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -174,7 +174,8 @@ static int build_afg_tree(struct hda_codec *codec) | |||
174 | int i, nodes, err; | 174 | int i, nodes, err; |
175 | hda_nid_t nid; | 175 | hda_nid_t nid; |
176 | 176 | ||
177 | snd_assert(spec, return -EINVAL); | 177 | if (snd_BUG_ON(!spec)) |
178 | return -EINVAL; | ||
178 | 179 | ||
179 | spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP); | 180 | spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP); |
180 | spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP); | 181 | spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 1c53e337ecb..9f316c1b279 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -222,9 +222,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
222 | #define RIRB_INT_OVERRUN 0x04 | 222 | #define RIRB_INT_OVERRUN 0x04 |
223 | #define RIRB_INT_MASK 0x05 | 223 | #define RIRB_INT_MASK 0x05 |
224 | 224 | ||
225 | /* STATESTS int mask: SD2,SD1,SD0 */ | 225 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ |
226 | #define AZX_MAX_CODECS 3 | 226 | #define AZX_MAX_CODECS 4 |
227 | #define STATESTS_INT_MASK 0x07 | 227 | #define STATESTS_INT_MASK 0x0f |
228 | 228 | ||
229 | /* SD_CTL bits */ | 229 | /* SD_CTL bits */ |
230 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ | 230 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ |
@@ -286,6 +286,11 @@ enum { | |||
286 | #define INTEL_SCH_HDA_DEVC 0x78 | 286 | #define INTEL_SCH_HDA_DEVC 0x78 |
287 | #define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11) | 287 | #define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11) |
288 | 288 | ||
289 | /* Define IN stream 0 FIFO size offset in VIA controller */ | ||
290 | #define VIA_IN_STREAM0_FIFO_SIZE_OFFSET 0x90 | ||
291 | /* Define VIA HD Audio Device ID*/ | ||
292 | #define VIA_HDAC_DEVICE_ID 0x3288 | ||
293 | |||
289 | 294 | ||
290 | /* | 295 | /* |
291 | */ | 296 | */ |
@@ -317,6 +322,12 @@ struct azx_dev { | |||
317 | unsigned int running :1; | 322 | unsigned int running :1; |
318 | unsigned int irq_pending :1; | 323 | unsigned int irq_pending :1; |
319 | unsigned int irq_ignore :1; | 324 | unsigned int irq_ignore :1; |
325 | /* | ||
326 | * For VIA: | ||
327 | * A flag to ensure DMA position is 0 | ||
328 | * when link position is not greater than FIFO size | ||
329 | */ | ||
330 | unsigned int insufficient :1; | ||
320 | }; | 331 | }; |
321 | 332 | ||
322 | /* CORB/RIRB */ | 333 | /* CORB/RIRB */ |
@@ -379,6 +390,7 @@ struct azx { | |||
379 | unsigned int polling_mode :1; | 390 | unsigned int polling_mode :1; |
380 | unsigned int msi :1; | 391 | unsigned int msi :1; |
381 | unsigned int irq_pending_warned :1; | 392 | unsigned int irq_pending_warned :1; |
393 | unsigned int via_dmapos_patch :1; /* enable DMA-position fix for VIA */ | ||
382 | 394 | ||
383 | /* for debugging */ | 395 | /* for debugging */ |
384 | unsigned int last_cmd; /* last issued command (to sync) */ | 396 | unsigned int last_cmd; /* last issued command (to sync) */ |
@@ -398,6 +410,7 @@ enum { | |||
398 | AZX_DRIVER_ULI, | 410 | AZX_DRIVER_ULI, |
399 | AZX_DRIVER_NVIDIA, | 411 | AZX_DRIVER_NVIDIA, |
400 | AZX_DRIVER_TERA, | 412 | AZX_DRIVER_TERA, |
413 | AZX_NUM_DRIVERS, /* keep this as last entry */ | ||
401 | }; | 414 | }; |
402 | 415 | ||
403 | static char *driver_short_names[] __devinitdata = { | 416 | static char *driver_short_names[] __devinitdata = { |
@@ -818,6 +831,11 @@ static void azx_int_clear(struct azx *chip) | |||
818 | /* start a stream */ | 831 | /* start a stream */ |
819 | static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev) | 832 | static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev) |
820 | { | 833 | { |
834 | /* | ||
835 | * Before stream start, initialize parameter | ||
836 | */ | ||
837 | azx_dev->insufficient = 1; | ||
838 | |||
821 | /* enable SIE */ | 839 | /* enable SIE */ |
822 | azx_writeb(chip, INTCTL, | 840 | azx_writeb(chip, INTCTL, |
823 | azx_readb(chip, INTCTL) | (1 << azx_dev->index)); | 841 | azx_readb(chip, INTCTL) | (1 << azx_dev->index)); |
@@ -998,7 +1016,6 @@ static int setup_bdle(struct snd_pcm_substream *substream, | |||
998 | struct azx_dev *azx_dev, u32 **bdlp, | 1016 | struct azx_dev *azx_dev, u32 **bdlp, |
999 | int ofs, int size, int with_ioc) | 1017 | int ofs, int size, int with_ioc) |
1000 | { | 1018 | { |
1001 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); | ||
1002 | u32 *bdl = *bdlp; | 1019 | u32 *bdl = *bdlp; |
1003 | 1020 | ||
1004 | while (size > 0) { | 1021 | while (size > 0) { |
@@ -1008,14 +1025,12 @@ static int setup_bdle(struct snd_pcm_substream *substream, | |||
1008 | if (azx_dev->frags >= AZX_MAX_BDL_ENTRIES) | 1025 | if (azx_dev->frags >= AZX_MAX_BDL_ENTRIES) |
1009 | return -EINVAL; | 1026 | return -EINVAL; |
1010 | 1027 | ||
1011 | addr = snd_pcm_sgbuf_get_addr(sgbuf, ofs); | 1028 | addr = snd_pcm_sgbuf_get_addr(substream, ofs); |
1012 | /* program the address field of the BDL entry */ | 1029 | /* program the address field of the BDL entry */ |
1013 | bdl[0] = cpu_to_le32((u32)addr); | 1030 | bdl[0] = cpu_to_le32((u32)addr); |
1014 | bdl[1] = cpu_to_le32(upper_32_bits(addr)); | 1031 | bdl[1] = cpu_to_le32(upper_32_bits(addr)); |
1015 | /* program the size field of the BDL entry */ | 1032 | /* program the size field of the BDL entry */ |
1016 | chunk = PAGE_SIZE - (ofs % PAGE_SIZE); | 1033 | chunk = snd_pcm_sgbuf_get_chunk_size(substream, ofs, size); |
1017 | if (size < chunk) | ||
1018 | chunk = size; | ||
1019 | bdl[2] = cpu_to_le32(chunk); | 1034 | bdl[2] = cpu_to_le32(chunk); |
1020 | /* program the IOC to enable interrupt | 1035 | /* program the IOC to enable interrupt |
1021 | * only when the whole fragment is processed | 1036 | * only when the whole fragment is processed |
@@ -1151,7 +1166,8 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1151 | 1166 | ||
1152 | /* enable the position buffer */ | 1167 | /* enable the position buffer */ |
1153 | if (chip->position_fix == POS_FIX_POSBUF || | 1168 | if (chip->position_fix == POS_FIX_POSBUF || |
1154 | chip->position_fix == POS_FIX_AUTO) { | 1169 | chip->position_fix == POS_FIX_AUTO || |
1170 | chip->via_dmapos_patch) { | ||
1155 | if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) | 1171 | if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) |
1156 | azx_writel(chip, DPLBASE, | 1172 | azx_writel(chip, DPLBASE, |
1157 | (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); | 1173 | (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); |
@@ -1169,23 +1185,26 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1169 | * Codec initialization | 1185 | * Codec initialization |
1170 | */ | 1186 | */ |
1171 | 1187 | ||
1172 | static unsigned int azx_max_codecs[] __devinitdata = { | 1188 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ |
1173 | [AZX_DRIVER_ICH] = 4, /* Some ICH9 boards use SD3 */ | 1189 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { |
1174 | [AZX_DRIVER_SCH] = 3, | ||
1175 | [AZX_DRIVER_ATI] = 4, | ||
1176 | [AZX_DRIVER_ATIHDMI] = 4, | ||
1177 | [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */ | ||
1178 | [AZX_DRIVER_SIS] = 3, /* FIXME: correct? */ | ||
1179 | [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */ | ||
1180 | [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */ | ||
1181 | [AZX_DRIVER_TERA] = 1, | 1190 | [AZX_DRIVER_TERA] = 1, |
1182 | }; | 1191 | }; |
1183 | 1192 | ||
1193 | /* number of slots to probe as default | ||
1194 | * this can be different from azx_max_codecs[] -- e.g. some boards | ||
1195 | * report wrongly the non-existing 4th slot availability | ||
1196 | */ | ||
1197 | static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = { | ||
1198 | [AZX_DRIVER_ICH] = 3, | ||
1199 | [AZX_DRIVER_ATI] = 3, | ||
1200 | }; | ||
1201 | |||
1184 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1202 | static int __devinit azx_codec_create(struct azx *chip, const char *model, |
1185 | unsigned int codec_probe_mask) | 1203 | unsigned int codec_probe_mask) |
1186 | { | 1204 | { |
1187 | struct hda_bus_template bus_temp; | 1205 | struct hda_bus_template bus_temp; |
1188 | int c, codecs, audio_codecs, err; | 1206 | int c, codecs, audio_codecs, err; |
1207 | int def_slots, max_slots; | ||
1189 | 1208 | ||
1190 | memset(&bus_temp, 0, sizeof(bus_temp)); | 1209 | memset(&bus_temp, 0, sizeof(bus_temp)); |
1191 | bus_temp.private_data = chip; | 1210 | bus_temp.private_data = chip; |
@@ -1201,8 +1220,17 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1201 | if (err < 0) | 1220 | if (err < 0) |
1202 | return err; | 1221 | return err; |
1203 | 1222 | ||
1223 | if (chip->driver_type == AZX_DRIVER_NVIDIA) | ||
1224 | chip->bus->needs_damn_long_delay = 1; | ||
1225 | |||
1204 | codecs = audio_codecs = 0; | 1226 | codecs = audio_codecs = 0; |
1205 | for (c = 0; c < AZX_MAX_CODECS; c++) { | 1227 | max_slots = azx_max_codecs[chip->driver_type]; |
1228 | if (!max_slots) | ||
1229 | max_slots = AZX_MAX_CODECS; | ||
1230 | def_slots = azx_default_codecs[chip->driver_type]; | ||
1231 | if (!def_slots) | ||
1232 | def_slots = max_slots; | ||
1233 | for (c = 0; c < def_slots; c++) { | ||
1206 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1234 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { |
1207 | struct hda_codec *codec; | 1235 | struct hda_codec *codec; |
1208 | err = snd_hda_codec_new(chip->bus, c, &codec); | 1236 | err = snd_hda_codec_new(chip->bus, c, &codec); |
@@ -1215,7 +1243,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1215 | } | 1243 | } |
1216 | if (!audio_codecs) { | 1244 | if (!audio_codecs) { |
1217 | /* probe additional slots if no codec is found */ | 1245 | /* probe additional slots if no codec is found */ |
1218 | for (; c < azx_max_codecs[chip->driver_type]; c++) { | 1246 | for (; c < max_slots; c++) { |
1219 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1247 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { |
1220 | err = snd_hda_codec_new(chip->bus, c, NULL); | 1248 | err = snd_hda_codec_new(chip->bus, c, NULL); |
1221 | if (err < 0) | 1249 | if (err < 0) |
@@ -1507,13 +1535,71 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1507 | return 0; | 1535 | return 0; |
1508 | } | 1536 | } |
1509 | 1537 | ||
1538 | /* get the current DMA position with correction on VIA chips */ | ||
1539 | static unsigned int azx_via_get_position(struct azx *chip, | ||
1540 | struct azx_dev *azx_dev) | ||
1541 | { | ||
1542 | unsigned int link_pos, mini_pos, bound_pos; | ||
1543 | unsigned int mod_link_pos, mod_dma_pos, mod_mini_pos; | ||
1544 | unsigned int fifo_size; | ||
1545 | |||
1546 | link_pos = azx_sd_readl(azx_dev, SD_LPIB); | ||
1547 | if (azx_dev->index >= 4) { | ||
1548 | /* Playback, no problem using link position */ | ||
1549 | return link_pos; | ||
1550 | } | ||
1551 | |||
1552 | /* Capture */ | ||
1553 | /* For new chipset, | ||
1554 | * use mod to get the DMA position just like old chipset | ||
1555 | */ | ||
1556 | mod_dma_pos = le32_to_cpu(*azx_dev->posbuf); | ||
1557 | mod_dma_pos %= azx_dev->period_bytes; | ||
1558 | |||
1559 | /* azx_dev->fifo_size can't get FIFO size of in stream. | ||
1560 | * Get from base address + offset. | ||
1561 | */ | ||
1562 | fifo_size = readw(chip->remap_addr + VIA_IN_STREAM0_FIFO_SIZE_OFFSET); | ||
1563 | |||
1564 | if (azx_dev->insufficient) { | ||
1565 | /* Link position never gather than FIFO size */ | ||
1566 | if (link_pos <= fifo_size) | ||
1567 | return 0; | ||
1568 | |||
1569 | azx_dev->insufficient = 0; | ||
1570 | } | ||
1571 | |||
1572 | if (link_pos <= fifo_size) | ||
1573 | mini_pos = azx_dev->bufsize + link_pos - fifo_size; | ||
1574 | else | ||
1575 | mini_pos = link_pos - fifo_size; | ||
1576 | |||
1577 | /* Find nearest previous boudary */ | ||
1578 | mod_mini_pos = mini_pos % azx_dev->period_bytes; | ||
1579 | mod_link_pos = link_pos % azx_dev->period_bytes; | ||
1580 | if (mod_link_pos >= fifo_size) | ||
1581 | bound_pos = link_pos - mod_link_pos; | ||
1582 | else if (mod_dma_pos >= mod_mini_pos) | ||
1583 | bound_pos = mini_pos - mod_mini_pos; | ||
1584 | else { | ||
1585 | bound_pos = mini_pos - mod_mini_pos + azx_dev->period_bytes; | ||
1586 | if (bound_pos >= azx_dev->bufsize) | ||
1587 | bound_pos = 0; | ||
1588 | } | ||
1589 | |||
1590 | /* Calculate real DMA position we want */ | ||
1591 | return bound_pos + mod_dma_pos; | ||
1592 | } | ||
1593 | |||
1510 | static unsigned int azx_get_position(struct azx *chip, | 1594 | static unsigned int azx_get_position(struct azx *chip, |
1511 | struct azx_dev *azx_dev) | 1595 | struct azx_dev *azx_dev) |
1512 | { | 1596 | { |
1513 | unsigned int pos; | 1597 | unsigned int pos; |
1514 | 1598 | ||
1515 | if (chip->position_fix == POS_FIX_POSBUF || | 1599 | if (chip->via_dmapos_patch) |
1516 | chip->position_fix == POS_FIX_AUTO) { | 1600 | pos = azx_via_get_position(chip, azx_dev); |
1601 | else if (chip->position_fix == POS_FIX_POSBUF || | ||
1602 | chip->position_fix == POS_FIX_AUTO) { | ||
1517 | /* use the position buffer */ | 1603 | /* use the position buffer */ |
1518 | pos = le32_to_cpu(*azx_dev->posbuf); | 1604 | pos = le32_to_cpu(*azx_dev->posbuf); |
1519 | } else { | 1605 | } else { |
@@ -1559,6 +1645,8 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) | |||
1559 | chip->position_fix = POS_FIX_POSBUF; | 1645 | chip->position_fix = POS_FIX_POSBUF; |
1560 | } | 1646 | } |
1561 | 1647 | ||
1648 | if (!bdl_pos_adj[chip->dev_index]) | ||
1649 | return 1; /* no delayed ack */ | ||
1562 | if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) | 1650 | if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) |
1563 | return 0; /* NG - it's below the period boundary */ | 1651 | return 0; /* NG - it's below the period boundary */ |
1564 | return 1; /* OK, it's fine */ | 1652 | return 1; /* OK, it's fine */ |
@@ -1646,7 +1734,8 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, | |||
1646 | if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) | 1734 | if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) |
1647 | return 0; | 1735 | return 0; |
1648 | 1736 | ||
1649 | snd_assert(cpcm->name, return -EINVAL); | 1737 | if (snd_BUG_ON(!cpcm->name)) |
1738 | return -EINVAL; | ||
1650 | 1739 | ||
1651 | err = snd_pcm_new(chip->card, cpcm->name, cpcm->device, | 1740 | err = snd_pcm_new(chip->card, cpcm->name, cpcm->device, |
1652 | cpcm->stream[0].substreams, | 1741 | cpcm->stream[0].substreams, |
@@ -1670,7 +1759,7 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, | |||
1670 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &azx_pcm_ops); | 1759 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &azx_pcm_ops); |
1671 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1760 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1672 | snd_dma_pci_data(chip->pci), | 1761 | snd_dma_pci_data(chip->pci), |
1673 | 1024 * 64, 1024 * 1024); | 1762 | 1024 * 64, 32 * 1024 * 1024); |
1674 | chip->pcm[cpcm->device] = pcm; | 1763 | chip->pcm[cpcm->device] = pcm; |
1675 | return 0; | 1764 | return 0; |
1676 | } | 1765 | } |
@@ -1946,6 +2035,15 @@ static int __devinit check_position_fix(struct azx *chip, int fix) | |||
1946 | { | 2035 | { |
1947 | const struct snd_pci_quirk *q; | 2036 | const struct snd_pci_quirk *q; |
1948 | 2037 | ||
2038 | /* Check VIA HD Audio Controller exist */ | ||
2039 | if (chip->pci->vendor == PCI_VENDOR_ID_VIA && | ||
2040 | chip->pci->device == VIA_HDAC_DEVICE_ID) { | ||
2041 | chip->via_dmapos_patch = 1; | ||
2042 | /* Use link position directly, avoid any transfer problem. */ | ||
2043 | return POS_FIX_LPIB; | ||
2044 | } | ||
2045 | chip->via_dmapos_patch = 0; | ||
2046 | |||
1949 | if (fix == POS_FIX_AUTO) { | 2047 | if (fix == POS_FIX_AUTO) { |
1950 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); | 2048 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); |
1951 | if (q) { | 2049 | if (q) { |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 5c9e578f7f2..7957fefda73 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -368,12 +368,15 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
368 | #define AMP_OUT_UNMUTE 0xb000 | 368 | #define AMP_OUT_UNMUTE 0xb000 |
369 | #define AMP_OUT_ZERO 0xb000 | 369 | #define AMP_OUT_ZERO 0xb000 |
370 | /* pinctl values */ | 370 | /* pinctl values */ |
371 | #define PIN_IN 0x20 | 371 | #define PIN_IN (AC_PINCTL_IN_EN) |
372 | #define PIN_VREF80 0x24 | 372 | #define PIN_VREFHIZ (AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ) |
373 | #define PIN_VREF50 0x21 | 373 | #define PIN_VREF50 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_50) |
374 | #define PIN_OUT 0x40 | 374 | #define PIN_VREFGRD (AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD) |
375 | #define PIN_HP 0xc0 | 375 | #define PIN_VREF80 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_80) |
376 | #define PIN_HP_AMP 0x80 | 376 | #define PIN_VREF100 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_100) |
377 | #define PIN_OUT (AC_PINCTL_OUT_EN) | ||
378 | #define PIN_HP (AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN) | ||
379 | #define PIN_HP_AMP (AC_PINCTL_HP_EN) | ||
377 | 380 | ||
378 | /* | 381 | /* |
379 | * get widget capabilities | 382 | * get widget capabilities |
@@ -418,4 +421,13 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
418 | hda_nid_t nid); | 421 | hda_nid_t nid); |
419 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | 422 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
420 | 423 | ||
424 | /* | ||
425 | * AMP control callbacks | ||
426 | */ | ||
427 | /* retrieve parameters from private_value */ | ||
428 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | ||
429 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | ||
430 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | ||
431 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | ||
432 | |||
421 | #endif /* __SOUND_HDA_LOCAL_H */ | 433 | #endif /* __SOUND_HDA_LOCAL_H */ |
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h index 2fdf2358dbc..dfbcfa88da4 100644 --- a/sound/pci/hda/hda_patch.h +++ b/sound/pci/hda/hda_patch.h | |||
@@ -18,3 +18,5 @@ extern struct hda_codec_preset snd_hda_preset_atihdmi[]; | |||
18 | extern struct hda_codec_preset snd_hda_preset_conexant[]; | 18 | extern struct hda_codec_preset snd_hda_preset_conexant[]; |
19 | /* VIA codecs */ | 19 | /* VIA codecs */ |
20 | extern struct hda_codec_preset snd_hda_preset_via[]; | 20 | extern struct hda_codec_preset snd_hda_preset_via[]; |
21 | /* NVIDIA HDMI codecs */ | ||
22 | extern struct hda_codec_preset snd_hda_preset_nvhdmi[]; | ||
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 1e5aff5c48d..743d77922bc 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -216,7 +216,7 @@ static void print_pin_caps(struct snd_info_buffer *buffer, | |||
216 | unsigned int caps, val; | 216 | unsigned int caps, val; |
217 | 217 | ||
218 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | 218 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
219 | snd_iprintf(buffer, " Pincap 0x08%x:", caps); | 219 | snd_iprintf(buffer, " Pincap 0x%08x:", caps); |
220 | if (caps & AC_PINCAP_IN) | 220 | if (caps & AC_PINCAP_IN) |
221 | snd_iprintf(buffer, " IN"); | 221 | snd_iprintf(buffer, " IN"); |
222 | if (caps & AC_PINCAP_OUT) | 222 | if (caps & AC_PINCAP_OUT) |
@@ -229,8 +229,13 @@ static void print_pin_caps(struct snd_info_buffer *buffer, | |||
229 | snd_iprintf(buffer, " Detect"); | 229 | snd_iprintf(buffer, " Detect"); |
230 | if (caps & AC_PINCAP_BALANCE) | 230 | if (caps & AC_PINCAP_BALANCE) |
231 | snd_iprintf(buffer, " Balanced"); | 231 | snd_iprintf(buffer, " Balanced"); |
232 | if (caps & AC_PINCAP_LR_SWAP) | 232 | if (caps & AC_PINCAP_HDMI) { |
233 | snd_iprintf(buffer, " R/L"); | 233 | /* Realtek uses this bit as a different meaning */ |
234 | if ((codec->vendor_id >> 16) == 0x10ec) | ||
235 | snd_iprintf(buffer, " R/L"); | ||
236 | else | ||
237 | snd_iprintf(buffer, " HDMI"); | ||
238 | } | ||
234 | if (caps & AC_PINCAP_TRIG_REQ) | 239 | if (caps & AC_PINCAP_TRIG_REQ) |
235 | snd_iprintf(buffer, " Trigger"); | 240 | snd_iprintf(buffer, " Trigger"); |
236 | if (caps & AC_PINCAP_IMP_SENSE) | 241 | if (caps & AC_PINCAP_IMP_SENSE) |
@@ -552,9 +557,15 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
552 | 557 | ||
553 | snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, | 558 | snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, |
554 | get_wid_type_name(wid_type), wid_caps); | 559 | get_wid_type_name(wid_type), wid_caps); |
555 | if (wid_caps & AC_WCAP_STEREO) | 560 | if (wid_caps & AC_WCAP_STEREO) { |
556 | snd_iprintf(buffer, " Stereo"); | 561 | unsigned int chans; |
557 | else | 562 | chans = (wid_caps & AC_WCAP_CHAN_CNT_EXT) >> 13; |
563 | chans = ((chans << 1) | 1) + 1; | ||
564 | if (chans == 2) | ||
565 | snd_iprintf(buffer, " Stereo"); | ||
566 | else | ||
567 | snd_iprintf(buffer, " %d-Channels", chans); | ||
568 | } else | ||
558 | snd_iprintf(buffer, " Mono"); | 569 | snd_iprintf(buffer, " Mono"); |
559 | if (wid_caps & AC_WCAP_DIGITAL) | 570 | if (wid_caps & AC_WCAP_DIGITAL) |
560 | snd_iprintf(buffer, " Digital"); | 571 | snd_iprintf(buffer, " Digital"); |
@@ -566,6 +577,8 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
566 | snd_iprintf(buffer, " Stripe"); | 577 | snd_iprintf(buffer, " Stripe"); |
567 | if (wid_caps & AC_WCAP_LR_SWAP) | 578 | if (wid_caps & AC_WCAP_LR_SWAP) |
568 | snd_iprintf(buffer, " R/L"); | 579 | snd_iprintf(buffer, " R/L"); |
580 | if (wid_caps & AC_WCAP_CP_CAPS) | ||
581 | snd_iprintf(buffer, " CP"); | ||
569 | snd_iprintf(buffer, "\n"); | 582 | snd_iprintf(buffer, "\n"); |
570 | 583 | ||
571 | /* volume knob is a special widget that always have connection | 584 | /* volume knob is a special widget that always have connection |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e8003d99f0b..2b00c4afdf9 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -1826,9 +1826,14 @@ static hda_nid_t ad1988_capsrc_nids[3] = { | |||
1826 | 0x0c, 0x0d, 0x0e | 1826 | 0x0c, 0x0d, 0x0e |
1827 | }; | 1827 | }; |
1828 | 1828 | ||
1829 | #define AD1988_SPDIF_OUT 0x02 | 1829 | #define AD1988_SPDIF_OUT 0x02 |
1830 | #define AD1988_SPDIF_OUT_HDMI 0x0b | ||
1830 | #define AD1988_SPDIF_IN 0x07 | 1831 | #define AD1988_SPDIF_IN 0x07 |
1831 | 1832 | ||
1833 | static hda_nid_t ad1989b_slave_dig_outs[2] = { | ||
1834 | AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI | ||
1835 | }; | ||
1836 | |||
1832 | static struct hda_input_mux ad1988_6stack_capture_source = { | 1837 | static struct hda_input_mux ad1988_6stack_capture_source = { |
1833 | .num_items = 5, | 1838 | .num_items = 5, |
1834 | .items = { | 1839 | .items = { |
@@ -2143,6 +2148,7 @@ static struct snd_kcontrol_new ad1988_spdif_in_mixers[] = { | |||
2143 | 2148 | ||
2144 | static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = { | 2149 | static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = { |
2145 | HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), | 2150 | HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), |
2151 | HDA_CODEC_VOLUME("HDMI Playback Volume", 0x1d, 0x0, HDA_OUTPUT), | ||
2146 | { } /* end */ | 2152 | { } /* end */ |
2147 | }; | 2153 | }; |
2148 | 2154 | ||
@@ -2207,6 +2213,8 @@ static struct hda_verb ad1988_6stack_init_verbs[] = { | |||
2207 | {0x34, AC_VERB_SET_CONNECT_SEL, 0x0}, | 2213 | {0x34, AC_VERB_SET_CONNECT_SEL, 0x0}, |
2208 | /* Analog CD Input */ | 2214 | /* Analog CD Input */ |
2209 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 2215 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2216 | /* Analog Mix output amp */ | ||
2217 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | ||
2210 | 2218 | ||
2211 | { } | 2219 | { } |
2212 | }; | 2220 | }; |
@@ -2247,8 +2255,12 @@ static struct hda_verb ad1988_spdif_init_verbs[] = { | |||
2247 | 2255 | ||
2248 | /* AD1989 has no ADC -> SPDIF route */ | 2256 | /* AD1989 has no ADC -> SPDIF route */ |
2249 | static struct hda_verb ad1989_spdif_init_verbs[] = { | 2257 | static struct hda_verb ad1989_spdif_init_verbs[] = { |
2250 | /* SPDIF out pin */ | 2258 | /* SPDIF-1 out pin */ |
2259 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
2251 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ | 2260 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ |
2261 | /* SPDIF-2/HDMI out pin */ | ||
2262 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
2263 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ | ||
2252 | { } | 2264 | { } |
2253 | }; | 2265 | }; |
2254 | 2266 | ||
@@ -2336,6 +2348,8 @@ static struct hda_verb ad1988_3stack_init_verbs[] = { | |||
2336 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2349 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2338 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2351 | /* Analog Mix output amp */ | ||
2352 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | ||
2339 | { } | 2353 | { } |
2340 | }; | 2354 | }; |
2341 | 2355 | ||
@@ -2409,6 +2423,8 @@ static struct hda_verb ad1988_laptop_init_verbs[] = { | |||
2409 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2410 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2424 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2411 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 2425 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2426 | /* Analog Mix output amp */ | ||
2427 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | ||
2412 | { } | 2428 | { } |
2413 | }; | 2429 | }; |
2414 | 2430 | ||
@@ -2868,6 +2884,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = { | |||
2868 | SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), | 2884 | SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), |
2869 | SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), | 2885 | SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), |
2870 | SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG), | 2886 | SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG), |
2887 | SND_PCI_QUIRK(0x1043, 0x8311, "Asus P5Q-Premium/Pro", AD1988_6STACK_DIG), | ||
2871 | {} | 2888 | {} |
2872 | }; | 2889 | }; |
2873 | 2890 | ||
@@ -2975,6 +2992,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2975 | ad1989_spdif_out_mixers; | 2992 | ad1989_spdif_out_mixers; |
2976 | spec->init_verbs[spec->num_init_verbs++] = | 2993 | spec->init_verbs[spec->num_init_verbs++] = |
2977 | ad1989_spdif_init_verbs; | 2994 | ad1989_spdif_init_verbs; |
2995 | codec->slave_dig_outs = ad1989b_slave_dig_outs; | ||
2978 | } else { | 2996 | } else { |
2979 | spec->mixers[spec->num_mixers++] = | 2997 | spec->mixers[spec->num_mixers++] = |
2980 | ad1988_spdif_out_mixers; | 2998 | ad1988_spdif_out_mixers; |
@@ -3911,7 +3929,7 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3911 | 3929 | ||
3912 | 3930 | ||
3913 | /* | 3931 | /* |
3914 | * AD1882 | 3932 | * AD1882 / AD1882A |
3915 | * | 3933 | * |
3916 | * port-A - front hp-out | 3934 | * port-A - front hp-out |
3917 | * port-B - front mic-in | 3935 | * port-B - front mic-in |
@@ -3948,6 +3966,18 @@ static struct hda_input_mux ad1882_capture_source = { | |||
3948 | }, | 3966 | }, |
3949 | }; | 3967 | }; |
3950 | 3968 | ||
3969 | /* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */ | ||
3970 | static struct hda_input_mux ad1882a_capture_source = { | ||
3971 | .num_items = 5, | ||
3972 | .items = { | ||
3973 | { "Front Mic", 0x1 }, | ||
3974 | { "Mic", 0x4}, | ||
3975 | { "Line", 0x2 }, | ||
3976 | { "Digital Mic", 0x06 }, | ||
3977 | { "Mix", 0x7 }, | ||
3978 | }, | ||
3979 | }; | ||
3980 | |||
3951 | static struct snd_kcontrol_new ad1882_base_mixers[] = { | 3981 | static struct snd_kcontrol_new ad1882_base_mixers[] = { |
3952 | HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), | 3982 | HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), |
3953 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 3983 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
@@ -3957,16 +3987,7 @@ static struct snd_kcontrol_new ad1882_base_mixers[] = { | |||
3957 | HDA_CODEC_MUTE("Front Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 3987 | HDA_CODEC_MUTE("Front Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
3958 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), | 3988 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), |
3959 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x13, 1, 0x0, HDA_OUTPUT), | 3989 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x13, 1, 0x0, HDA_OUTPUT), |
3960 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | 3990 | |
3961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
3962 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
3963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
3964 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x04, HDA_INPUT), | ||
3965 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), | ||
3966 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | ||
3967 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | ||
3968 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
3969 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
3970 | HDA_CODEC_VOLUME("Mic Boost", 0x3c, 0x0, HDA_OUTPUT), | 3991 | HDA_CODEC_VOLUME("Mic Boost", 0x3c, 0x0, HDA_OUTPUT), |
3971 | HDA_CODEC_VOLUME("Front Mic Boost", 0x39, 0x0, HDA_OUTPUT), | 3992 | HDA_CODEC_VOLUME("Front Mic Boost", 0x39, 0x0, HDA_OUTPUT), |
3972 | HDA_CODEC_VOLUME("Line-In Boost", 0x3a, 0x0, HDA_OUTPUT), | 3993 | HDA_CODEC_VOLUME("Line-In Boost", 0x3a, 0x0, HDA_OUTPUT), |
@@ -3999,6 +4020,35 @@ static struct snd_kcontrol_new ad1882_base_mixers[] = { | |||
3999 | { } /* end */ | 4020 | { } /* end */ |
4000 | }; | 4021 | }; |
4001 | 4022 | ||
4023 | static struct snd_kcontrol_new ad1882_loopback_mixers[] = { | ||
4024 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | ||
4025 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
4026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
4027 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
4028 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x04, HDA_INPUT), | ||
4029 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), | ||
4030 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | ||
4031 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | ||
4032 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4033 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4034 | { } /* end */ | ||
4035 | }; | ||
4036 | |||
4037 | static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { | ||
4038 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | ||
4039 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
4040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | ||
4041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | ||
4042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
4043 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
4044 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | ||
4045 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | ||
4046 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4047 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4048 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), | ||
4049 | { } /* end */ | ||
4050 | }; | ||
4051 | |||
4002 | static struct snd_kcontrol_new ad1882_3stack_mixers[] = { | 4052 | static struct snd_kcontrol_new ad1882_3stack_mixers[] = { |
4003 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), | 4053 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
4004 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT), | 4054 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT), |
@@ -4168,9 +4218,16 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4168 | spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); | 4218 | spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); |
4169 | spec->adc_nids = ad1882_adc_nids; | 4219 | spec->adc_nids = ad1882_adc_nids; |
4170 | spec->capsrc_nids = ad1882_capsrc_nids; | 4220 | spec->capsrc_nids = ad1882_capsrc_nids; |
4171 | spec->input_mux = &ad1882_capture_source; | 4221 | if (codec->vendor_id == 0x11d1882) |
4172 | spec->num_mixers = 1; | 4222 | spec->input_mux = &ad1882_capture_source; |
4223 | else | ||
4224 | spec->input_mux = &ad1882a_capture_source; | ||
4225 | spec->num_mixers = 2; | ||
4173 | spec->mixers[0] = ad1882_base_mixers; | 4226 | spec->mixers[0] = ad1882_base_mixers; |
4227 | if (codec->vendor_id == 0x11d1882) | ||
4228 | spec->mixers[1] = ad1882_loopback_mixers; | ||
4229 | else | ||
4230 | spec->mixers[1] = ad1882a_loopback_mixers; | ||
4174 | spec->num_init_verbs = 1; | 4231 | spec->num_init_verbs = 1; |
4175 | spec->init_verbs[0] = ad1882_init_verbs; | 4232 | spec->init_verbs[0] = ad1882_init_verbs; |
4176 | spec->spdif_route = 0; | 4233 | spec->spdif_route = 0; |
@@ -4187,8 +4244,8 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4187 | switch (board_config) { | 4244 | switch (board_config) { |
4188 | default: | 4245 | default: |
4189 | case AD1882_3STACK: | 4246 | case AD1882_3STACK: |
4190 | spec->num_mixers = 2; | 4247 | spec->num_mixers = 3; |
4191 | spec->mixers[1] = ad1882_3stack_mixers; | 4248 | spec->mixers[2] = ad1882_3stack_mixers; |
4192 | spec->channel_mode = ad1882_modes; | 4249 | spec->channel_mode = ad1882_modes; |
4193 | spec->num_channel_mode = ARRAY_SIZE(ad1882_modes); | 4250 | spec->num_channel_mode = ARRAY_SIZE(ad1882_modes); |
4194 | spec->need_dac_fix = 1; | 4251 | spec->need_dac_fix = 1; |
@@ -4196,8 +4253,8 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4196 | spec->multiout.num_dacs = 1; | 4253 | spec->multiout.num_dacs = 1; |
4197 | break; | 4254 | break; |
4198 | case AD1882_6STACK: | 4255 | case AD1882_6STACK: |
4199 | spec->num_mixers = 2; | 4256 | spec->num_mixers = 3; |
4200 | spec->mixers[1] = ad1882_6stack_mixers; | 4257 | spec->mixers[2] = ad1882_6stack_mixers; |
4201 | break; | 4258 | break; |
4202 | } | 4259 | } |
4203 | return 0; | 4260 | return 0; |
@@ -4220,6 +4277,7 @@ struct hda_codec_preset snd_hda_preset_analog[] = { | |||
4220 | { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a }, | 4277 | { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a }, |
4221 | { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, | 4278 | { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, |
4222 | { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, | 4279 | { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, |
4280 | { .id = 0x11d4882a, .name = "AD1882A", .patch = patch_ad1882 }, | ||
4223 | { .id = 0x11d4989a, .name = "AD1989A", .patch = patch_ad1988 }, | 4281 | { .id = 0x11d4989a, .name = "AD1989A", .patch = patch_ad1988 }, |
4224 | { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 }, | 4282 | { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 }, |
4225 | {} /* terminator */ | 4283 | {} /* terminator */ |
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c index 12272508b11..ba61575983f 100644 --- a/sound/pci/hda/patch_atihdmi.c +++ b/sound/pci/hda/patch_atihdmi.c | |||
@@ -35,6 +35,9 @@ struct atihdmi_spec { | |||
35 | struct hda_pcm pcm_rec; | 35 | struct hda_pcm pcm_rec; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #define CVT_NID 0x02 /* audio converter */ | ||
39 | #define PIN_NID 0x03 /* HDMI output pin */ | ||
40 | |||
38 | static struct hda_verb atihdmi_basic_init[] = { | 41 | static struct hda_verb atihdmi_basic_init[] = { |
39 | /* enable digital output on pin widget */ | 42 | /* enable digital output on pin widget */ |
40 | { 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | 43 | { 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
@@ -60,8 +63,9 @@ static int atihdmi_init(struct hda_codec *codec) | |||
60 | { | 63 | { |
61 | snd_hda_sequence_write(codec, atihdmi_basic_init); | 64 | snd_hda_sequence_write(codec, atihdmi_basic_init); |
62 | /* SI codec requires to unmute the pin */ | 65 | /* SI codec requires to unmute the pin */ |
63 | if (get_wcaps(codec, 0x03) & AC_WCAP_OUT_AMP) | 66 | if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) |
64 | snd_hda_codec_write(codec, 0x03, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 67 | snd_hda_codec_write(codec, PIN_NID, 0, |
68 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
65 | AMP_OUT_UNMUTE); | 69 | AMP_OUT_UNMUTE); |
66 | return 0; | 70 | return 0; |
67 | } | 71 | } |
@@ -92,15 +96,29 @@ static int atihdmi_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
92 | struct snd_pcm_substream *substream) | 96 | struct snd_pcm_substream *substream) |
93 | { | 97 | { |
94 | struct atihdmi_spec *spec = codec->spec; | 98 | struct atihdmi_spec *spec = codec->spec; |
95 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | 99 | int chans = substream->runtime->channels; |
96 | format, substream); | 100 | int i, err; |
101 | |||
102 | err = snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | ||
103 | format, substream); | ||
104 | if (err < 0) | ||
105 | return err; | ||
106 | snd_hda_codec_write(codec, CVT_NID, 0, AC_VERB_SET_CVT_CHAN_COUNT, | ||
107 | chans - 1); | ||
108 | /* FIXME: XXX */ | ||
109 | for (i = 0; i < chans; i++) { | ||
110 | snd_hda_codec_write(codec, CVT_NID, 0, | ||
111 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
112 | (i << 4) | i); | ||
113 | } | ||
114 | return 0; | ||
97 | } | 115 | } |
98 | 116 | ||
99 | static struct hda_pcm_stream atihdmi_pcm_digital_playback = { | 117 | static struct hda_pcm_stream atihdmi_pcm_digital_playback = { |
100 | .substreams = 1, | 118 | .substreams = 1, |
101 | .channels_min = 2, | 119 | .channels_min = 2, |
102 | .channels_max = 2, | 120 | .channels_max = 2, |
103 | .nid = 0x2, /* NID to query formats and rates and setup streams */ | 121 | .nid = CVT_NID, /* NID to query formats and rates and setup streams */ |
104 | .ops = { | 122 | .ops = { |
105 | .open = atihdmi_dig_playback_pcm_open, | 123 | .open = atihdmi_dig_playback_pcm_open, |
106 | .close = atihdmi_dig_playback_pcm_close, | 124 | .close = atihdmi_dig_playback_pcm_close, |
@@ -112,6 +130,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec) | |||
112 | { | 130 | { |
113 | struct atihdmi_spec *spec = codec->spec; | 131 | struct atihdmi_spec *spec = codec->spec; |
114 | struct hda_pcm *info = &spec->pcm_rec; | 132 | struct hda_pcm *info = &spec->pcm_rec; |
133 | unsigned int chans; | ||
115 | 134 | ||
116 | codec->num_pcms = 1; | 135 | codec->num_pcms = 1; |
117 | codec->pcm_info = info; | 136 | codec->pcm_info = info; |
@@ -120,6 +139,13 @@ static int atihdmi_build_pcms(struct hda_codec *codec) | |||
120 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 139 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
121 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; | 140 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; |
122 | 141 | ||
142 | /* FIXME: we must check ELD and change the PCM parameters dynamically | ||
143 | */ | ||
144 | chans = get_wcaps(codec, CVT_NID); | ||
145 | chans = (chans & AC_WCAP_CHAN_CNT_EXT) >> 13; | ||
146 | chans = ((chans << 1) | 1) + 1; | ||
147 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | ||
148 | |||
123 | return 0; | 149 | return 0; |
124 | } | 150 | } |
125 | 151 | ||
@@ -147,9 +173,11 @@ static int patch_atihdmi(struct hda_codec *codec) | |||
147 | 173 | ||
148 | spec->multiout.num_dacs = 0; /* no analog */ | 174 | spec->multiout.num_dacs = 0; /* no analog */ |
149 | spec->multiout.max_channels = 2; | 175 | spec->multiout.max_channels = 2; |
150 | spec->multiout.dig_out_nid = 0x2; /* NID for copying analog to digital, | 176 | /* NID for copying analog to digital, |
151 | * seems to be unused in pure-digital | 177 | * seems to be unused in pure-digital |
152 | * case. */ | 178 | * case. |
179 | */ | ||
180 | spec->multiout.dig_out_nid = CVT_NID; | ||
153 | 181 | ||
154 | codec->patch_ops = atihdmi_patch_ops; | 182 | codec->patch_ops = atihdmi_patch_ops; |
155 | 183 | ||
@@ -164,6 +192,7 @@ struct hda_codec_preset snd_hda_preset_atihdmi[] = { | |||
164 | { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, | 192 | { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, |
165 | { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, | 193 | { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, |
166 | { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, | 194 | { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, |
195 | { .id = 0x10951390, .name = "SiI1390 HDMI", .patch = patch_atihdmi }, | ||
167 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, | 196 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, |
168 | { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, | 197 | { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, |
169 | {} /* terminator */ | 198 | {} /* terminator */ |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c new file mode 100644 index 00000000000..2eed2c8b98d --- /dev/null +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -0,0 +1,165 @@ | |||
1 | /* | ||
2 | * Universal Interface for Intel High Definition Audio Codec | ||
3 | * | ||
4 | * HD audio interface patch for NVIDIA HDMI codecs | ||
5 | * | ||
6 | * Copyright (c) 2008 NVIDIA Corp. All rights reserved. | ||
7 | * Copyright (c) 2008 Wei Ni <wni@nvidia.com> | ||
8 | * | ||
9 | * | ||
10 | * This driver is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This driver is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/init.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <sound/core.h> | ||
29 | #include "hda_codec.h" | ||
30 | #include "hda_local.h" | ||
31 | |||
32 | struct nvhdmi_spec { | ||
33 | struct hda_multi_out multiout; | ||
34 | |||
35 | struct hda_pcm pcm_rec; | ||
36 | }; | ||
37 | |||
38 | static struct hda_verb nvhdmi_basic_init[] = { | ||
39 | /* enable digital output on pin widget */ | ||
40 | { 0x05, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
41 | {} /* terminator */ | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * Controls | ||
46 | */ | ||
47 | static int nvhdmi_build_controls(struct hda_codec *codec) | ||
48 | { | ||
49 | struct nvhdmi_spec *spec = codec->spec; | ||
50 | int err; | ||
51 | |||
52 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | ||
53 | if (err < 0) | ||
54 | return err; | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int nvhdmi_init(struct hda_codec *codec) | ||
60 | { | ||
61 | snd_hda_sequence_write(codec, nvhdmi_basic_init); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * Digital out | ||
67 | */ | ||
68 | static int nvhdmi_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
69 | struct hda_codec *codec, | ||
70 | struct snd_pcm_substream *substream) | ||
71 | { | ||
72 | struct nvhdmi_spec *spec = codec->spec; | ||
73 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | ||
74 | } | ||
75 | |||
76 | static int nvhdmi_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
77 | struct hda_codec *codec, | ||
78 | struct snd_pcm_substream *substream) | ||
79 | { | ||
80 | struct nvhdmi_spec *spec = codec->spec; | ||
81 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | ||
82 | } | ||
83 | |||
84 | static int nvhdmi_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
85 | struct hda_codec *codec, | ||
86 | unsigned int stream_tag, | ||
87 | unsigned int format, | ||
88 | struct snd_pcm_substream *substream) | ||
89 | { | ||
90 | struct nvhdmi_spec *spec = codec->spec; | ||
91 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | ||
92 | format, substream); | ||
93 | } | ||
94 | |||
95 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback = { | ||
96 | .substreams = 1, | ||
97 | .channels_min = 2, | ||
98 | .channels_max = 2, | ||
99 | .nid = 0x4, /* NID to query formats and rates and setup streams */ | ||
100 | .rates = SNDRV_PCM_RATE_48000, | ||
101 | .maxbps = 16, | ||
102 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
103 | .ops = { | ||
104 | .open = nvhdmi_dig_playback_pcm_open, | ||
105 | .close = nvhdmi_dig_playback_pcm_close, | ||
106 | .prepare = nvhdmi_dig_playback_pcm_prepare | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | static int nvhdmi_build_pcms(struct hda_codec *codec) | ||
111 | { | ||
112 | struct nvhdmi_spec *spec = codec->spec; | ||
113 | struct hda_pcm *info = &spec->pcm_rec; | ||
114 | |||
115 | codec->num_pcms = 1; | ||
116 | codec->pcm_info = info; | ||
117 | |||
118 | info->name = "NVIDIA HDMI"; | ||
119 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
120 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static void nvhdmi_free(struct hda_codec *codec) | ||
126 | { | ||
127 | kfree(codec->spec); | ||
128 | } | ||
129 | |||
130 | static struct hda_codec_ops nvhdmi_patch_ops = { | ||
131 | .build_controls = nvhdmi_build_controls, | ||
132 | .build_pcms = nvhdmi_build_pcms, | ||
133 | .init = nvhdmi_init, | ||
134 | .free = nvhdmi_free, | ||
135 | }; | ||
136 | |||
137 | static int patch_nvhdmi(struct hda_codec *codec) | ||
138 | { | ||
139 | struct nvhdmi_spec *spec; | ||
140 | |||
141 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
142 | if (spec == NULL) | ||
143 | return -ENOMEM; | ||
144 | |||
145 | codec->spec = spec; | ||
146 | |||
147 | spec->multiout.num_dacs = 0; /* no analog */ | ||
148 | spec->multiout.max_channels = 2; | ||
149 | spec->multiout.dig_out_nid = 0x4; /* NID for copying analog to digital, | ||
150 | * seems to be unused in pure-digital | ||
151 | * case. */ | ||
152 | |||
153 | codec->patch_ops = nvhdmi_patch_ops; | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * patch entries | ||
160 | */ | ||
161 | struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | ||
162 | { .id = 0x10de0002, .name = "NVIDIA MCP78 HDMI", .patch = patch_nvhdmi }, | ||
163 | { .id = 0x10de0007, .name = "NVIDIA MCP7A HDMI", .patch = patch_nvhdmi }, | ||
164 | {} /* terminator */ | ||
165 | }; | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 66025161bd6..e72707cb60a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -72,6 +72,7 @@ enum { | |||
72 | enum { | 72 | enum { |
73 | ALC260_BASIC, | 73 | ALC260_BASIC, |
74 | ALC260_HP, | 74 | ALC260_HP, |
75 | ALC260_HP_DC7600, | ||
75 | ALC260_HP_3013, | 76 | ALC260_HP_3013, |
76 | ALC260_FUJITSU_S702X, | 77 | ALC260_FUJITSU_S702X, |
77 | ALC260_ACER, | 78 | ALC260_ACER, |
@@ -100,6 +101,9 @@ enum { | |||
100 | ALC262_BENQ_T31, | 101 | ALC262_BENQ_T31, |
101 | ALC262_ULTRA, | 102 | ALC262_ULTRA, |
102 | ALC262_LENOVO_3000, | 103 | ALC262_LENOVO_3000, |
104 | ALC262_NEC, | ||
105 | ALC262_TOSHIBA_S06, | ||
106 | ALC262_TOSHIBA_RX1, | ||
103 | ALC262_AUTO, | 107 | ALC262_AUTO, |
104 | ALC262_MODEL_LAST /* last tag */ | 108 | ALC262_MODEL_LAST /* last tag */ |
105 | }; | 109 | }; |
@@ -110,6 +114,7 @@ enum { | |||
110 | ALC268_3ST, | 114 | ALC268_3ST, |
111 | ALC268_TOSHIBA, | 115 | ALC268_TOSHIBA, |
112 | ALC268_ACER, | 116 | ALC268_ACER, |
117 | ALC268_ACER_ASPIRE_ONE, | ||
113 | ALC268_DELL, | 118 | ALC268_DELL, |
114 | ALC268_ZEPTO, | 119 | ALC268_ZEPTO, |
115 | #ifdef CONFIG_SND_DEBUG | 120 | #ifdef CONFIG_SND_DEBUG |
@@ -122,6 +127,7 @@ enum { | |||
122 | /* ALC269 models */ | 127 | /* ALC269 models */ |
123 | enum { | 128 | enum { |
124 | ALC269_BASIC, | 129 | ALC269_BASIC, |
130 | ALC269_QUANTA_FL1, | ||
125 | ALC269_ASUS_EEEPC_P703, | 131 | ALC269_ASUS_EEEPC_P703, |
126 | ALC269_ASUS_EEEPC_P901, | 132 | ALC269_ASUS_EEEPC_P901, |
127 | ALC269_AUTO, | 133 | ALC269_AUTO, |
@@ -169,6 +175,13 @@ enum { | |||
169 | ALC663_ASUS_G71V, | 175 | ALC663_ASUS_G71V, |
170 | ALC663_ASUS_H13, | 176 | ALC663_ASUS_H13, |
171 | ALC663_ASUS_G50V, | 177 | ALC663_ASUS_G50V, |
178 | ALC662_ECS, | ||
179 | ALC663_ASUS_MODE1, | ||
180 | ALC662_ASUS_MODE2, | ||
181 | ALC663_ASUS_MODE3, | ||
182 | ALC663_ASUS_MODE4, | ||
183 | ALC663_ASUS_MODE5, | ||
184 | ALC663_ASUS_MODE6, | ||
172 | ALC662_AUTO, | 185 | ALC662_AUTO, |
173 | ALC662_MODEL_LAST, | 186 | ALC662_MODEL_LAST, |
174 | }; | 187 | }; |
@@ -200,18 +213,21 @@ enum { | |||
200 | ALC883_ACER, | 213 | ALC883_ACER, |
201 | ALC883_ACER_ASPIRE, | 214 | ALC883_ACER_ASPIRE, |
202 | ALC883_MEDION, | 215 | ALC883_MEDION, |
203 | ALC883_MEDION_MD2, | 216 | ALC883_MEDION_MD2, |
204 | ALC883_LAPTOP_EAPD, | 217 | ALC883_LAPTOP_EAPD, |
205 | ALC883_LENOVO_101E_2ch, | 218 | ALC883_LENOVO_101E_2ch, |
206 | ALC883_LENOVO_NB0763, | 219 | ALC883_LENOVO_NB0763, |
207 | ALC888_LENOVO_MS7195_DIG, | 220 | ALC888_LENOVO_MS7195_DIG, |
208 | ALC883_HAIER_W66, | 221 | ALC888_LENOVO_SKY, |
222 | ALC883_HAIER_W66, | ||
209 | ALC888_3ST_HP, | 223 | ALC888_3ST_HP, |
210 | ALC888_6ST_DELL, | 224 | ALC888_6ST_DELL, |
211 | ALC883_MITAC, | 225 | ALC883_MITAC, |
212 | ALC883_CLEVO_M720, | 226 | ALC883_CLEVO_M720, |
213 | ALC883_FUJITSU_PI2515, | 227 | ALC883_FUJITSU_PI2515, |
214 | ALC883_3ST_6ch_INTEL, | 228 | ALC883_3ST_6ch_INTEL, |
229 | ALC888_ASUS_M90V, | ||
230 | ALC888_ASUS_EEE1601, | ||
215 | ALC883_AUTO, | 231 | ALC883_AUTO, |
216 | ALC883_MODEL_LAST, | 232 | ALC883_MODEL_LAST, |
217 | }; | 233 | }; |
@@ -398,7 +414,7 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | |||
398 | 414 | ||
399 | /* | 415 | /* |
400 | * Control the mode of pin widget settings via the mixer. "pc" is used | 416 | * Control the mode of pin widget settings via the mixer. "pc" is used |
401 | * instead of "%" to avoid consequences of accidently treating the % as | 417 | * instead of "%" to avoid consequences of accidently treating the % as |
402 | * being part of a format specifier. Maximum allowed length of a value is | 418 | * being part of a format specifier. Maximum allowed length of a value is |
403 | * 63 characters plus NULL terminator. | 419 | * 63 characters plus NULL terminator. |
404 | * | 420 | * |
@@ -429,7 +445,7 @@ static unsigned char alc_pin_mode_values[] = { | |||
429 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | 445 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
430 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | 446 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
431 | 447 | ||
432 | /* Info about the pin modes supported by the different pin direction modes. | 448 | /* Info about the pin modes supported by the different pin direction modes. |
433 | * For each direction the minimum and maximum values are given. | 449 | * For each direction the minimum and maximum values are given. |
434 | */ | 450 | */ |
435 | static signed char alc_pin_mode_dir_info[5][2] = { | 451 | static signed char alc_pin_mode_dir_info[5][2] = { |
@@ -502,7 +518,7 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | |||
502 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 518 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
503 | alc_pin_mode_values[val]); | 519 | alc_pin_mode_values[val]); |
504 | 520 | ||
505 | /* Also enable the retasking pin's input/output as required | 521 | /* Also enable the retasking pin's input/output as required |
506 | * for the requested pin mode. Enum values of 2 or less are | 522 | * for the requested pin mode. Enum values of 2 or less are |
507 | * input modes. | 523 | * input modes. |
508 | * | 524 | * |
@@ -707,7 +723,7 @@ static void setup_preset(struct alc_spec *spec, | |||
707 | i++) | 723 | i++) |
708 | spec->init_verbs[spec->num_init_verbs++] = | 724 | spec->init_verbs[spec->num_init_verbs++] = |
709 | preset->init_verbs[i]; | 725 | preset->init_verbs[i]; |
710 | 726 | ||
711 | spec->channel_mode = preset->channel_mode; | 727 | spec->channel_mode = preset->channel_mode; |
712 | spec->num_channel_mode = preset->num_channel_mode; | 728 | spec->num_channel_mode = preset->num_channel_mode; |
713 | spec->need_dac_fix = preset->need_dac_fix; | 729 | spec->need_dac_fix = preset->need_dac_fix; |
@@ -718,7 +734,7 @@ static void setup_preset(struct alc_spec *spec, | |||
718 | spec->multiout.dac_nids = preset->dac_nids; | 734 | spec->multiout.dac_nids = preset->dac_nids; |
719 | spec->multiout.dig_out_nid = preset->dig_out_nid; | 735 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
720 | spec->multiout.hp_nid = preset->hp_nid; | 736 | spec->multiout.hp_nid = preset->hp_nid; |
721 | 737 | ||
722 | spec->num_mux_defs = preset->num_mux_defs; | 738 | spec->num_mux_defs = preset->num_mux_defs; |
723 | if (!spec->num_mux_defs) | 739 | if (!spec->num_mux_defs) |
724 | spec->num_mux_defs = 1; | 740 | spec->num_mux_defs = 1; |
@@ -806,6 +822,27 @@ static void alc_sku_automute(struct hda_codec *codec) | |||
806 | spec->jack_present ? 0 : PIN_OUT); | 822 | spec->jack_present ? 0 : PIN_OUT); |
807 | } | 823 | } |
808 | 824 | ||
825 | static void alc_mic_automute(struct hda_codec *codec) | ||
826 | { | ||
827 | struct alc_spec *spec = codec->spec; | ||
828 | unsigned int present; | ||
829 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
830 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
831 | unsigned int mix_nid = spec->capsrc_nids[0]; | ||
832 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | ||
833 | |||
834 | capsrc_idx_mic = mic_nid - 0x18; | ||
835 | capsrc_idx_fmic = fmic_nid - 0x18; | ||
836 | present = snd_hda_codec_read(codec, mic_nid, 0, | ||
837 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
838 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
839 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | ||
840 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
841 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | ||
842 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | ||
843 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
844 | } | ||
845 | |||
809 | /* unsolicited event for HP jack sensing */ | 846 | /* unsolicited event for HP jack sensing */ |
810 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 847 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
811 | { | 848 | { |
@@ -813,10 +850,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |||
813 | res >>= 28; | 850 | res >>= 28; |
814 | else | 851 | else |
815 | res >>= 26; | 852 | res >>= 26; |
816 | if (res != ALC880_HP_EVENT) | 853 | if (res == ALC880_HP_EVENT) |
817 | return; | 854 | alc_sku_automute(codec); |
818 | 855 | ||
856 | if (res == ALC880_MIC_EVENT) | ||
857 | alc_mic_automute(codec); | ||
858 | } | ||
859 | |||
860 | static void alc_inithook(struct hda_codec *codec) | ||
861 | { | ||
819 | alc_sku_automute(codec); | 862 | alc_sku_automute(codec); |
863 | alc_mic_automute(codec); | ||
820 | } | 864 | } |
821 | 865 | ||
822 | /* additional initialization for ALC888 variants */ | 866 | /* additional initialization for ALC888 variants */ |
@@ -855,7 +899,7 @@ static void alc_subsystem_id(struct hda_codec *codec, | |||
855 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | 899 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
856 | goto do_sku; | 900 | goto do_sku; |
857 | 901 | ||
858 | /* | 902 | /* |
859 | * 31~30 : port conetcivity | 903 | * 31~30 : port conetcivity |
860 | * 29~21 : reserve | 904 | * 29~21 : reserve |
861 | * 20 : PCBEEP input | 905 | * 20 : PCBEEP input |
@@ -946,7 +990,7 @@ do_sku: | |||
946 | tmp = snd_hda_codec_read(codec, 0x20, 0, | 990 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
947 | AC_VERB_GET_PROC_COEF, 0); | 991 | AC_VERB_GET_PROC_COEF, 0); |
948 | snd_hda_codec_write(codec, 0x20, 0, | 992 | snd_hda_codec_write(codec, 0x20, 0, |
949 | AC_VERB_SET_COEF_INDEX, 7); | 993 | AC_VERB_SET_COEF_INDEX, 7); |
950 | snd_hda_codec_write(codec, 0x20, 0, | 994 | snd_hda_codec_write(codec, 0x20, 0, |
951 | AC_VERB_SET_PROC_COEF, | 995 | AC_VERB_SET_PROC_COEF, |
952 | tmp | 0x2010); | 996 | tmp | 0x2010); |
@@ -961,7 +1005,7 @@ do_sku: | |||
961 | tmp = snd_hda_codec_read(codec, 0x20, 0, | 1005 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
962 | AC_VERB_GET_PROC_COEF, 0); | 1006 | AC_VERB_GET_PROC_COEF, 0); |
963 | snd_hda_codec_write(codec, 0x20, 0, | 1007 | snd_hda_codec_write(codec, 0x20, 0, |
964 | AC_VERB_SET_COEF_INDEX, 7); | 1008 | AC_VERB_SET_COEF_INDEX, 7); |
965 | snd_hda_codec_write(codec, 0x20, 0, | 1009 | snd_hda_codec_write(codec, 0x20, 0, |
966 | AC_VERB_SET_PROC_COEF, | 1010 | AC_VERB_SET_PROC_COEF, |
967 | tmp | 0x3000); | 1011 | tmp | 0x3000); |
@@ -970,7 +1014,7 @@ do_sku: | |||
970 | default: | 1014 | default: |
971 | break; | 1015 | break; |
972 | } | 1016 | } |
973 | 1017 | ||
974 | /* is laptop or Desktop and enable the function "Mute internal speaker | 1018 | /* is laptop or Desktop and enable the function "Mute internal speaker |
975 | * when the external headphone out jack is plugged" | 1019 | * when the external headphone out jack is plugged" |
976 | */ | 1020 | */ |
@@ -1002,10 +1046,18 @@ do_sku: | |||
1002 | else | 1046 | else |
1003 | return; | 1047 | return; |
1004 | } | 1048 | } |
1049 | if (spec->autocfg.hp_pins[0]) | ||
1050 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | ||
1051 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1052 | AC_USRSP_EN | ALC880_HP_EVENT); | ||
1053 | |||
1054 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && | ||
1055 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) | ||
1056 | snd_hda_codec_write(codec, | ||
1057 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, | ||
1058 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1059 | AC_USRSP_EN | ALC880_MIC_EVENT); | ||
1005 | 1060 | ||
1006 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | ||
1007 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1008 | AC_USRSP_EN | ALC880_HP_EVENT); | ||
1009 | spec->unsol_event = alc_sku_unsol_event; | 1061 | spec->unsol_event = alc_sku_unsol_event; |
1010 | } | 1062 | } |
1011 | 1063 | ||
@@ -1296,7 +1348,7 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |||
1296 | * | 1348 | * |
1297 | * The system also has a pair of internal speakers, and a headphone jack. | 1349 | * The system also has a pair of internal speakers, and a headphone jack. |
1298 | * These are both connected to Line2 on the codec, hence to DAC 02. | 1350 | * These are both connected to Line2 on the codec, hence to DAC 02. |
1299 | * | 1351 | * |
1300 | * There is a variable resistor to control the speaker or headphone | 1352 | * There is a variable resistor to control the speaker or headphone |
1301 | * volume. This is a hardware-only device without a software API. | 1353 | * volume. This is a hardware-only device without a software API. |
1302 | * | 1354 | * |
@@ -1824,7 +1876,7 @@ static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |||
1824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 1876 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1877 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1826 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 1878 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1827 | 1879 | ||
1828 | { } | 1880 | { } |
1829 | }; | 1881 | }; |
1830 | 1882 | ||
@@ -1869,7 +1921,7 @@ static struct hda_verb alc880_uniwill_init_verbs[] = { | |||
1869 | 1921 | ||
1870 | /* | 1922 | /* |
1871 | * Uniwill P53 | 1923 | * Uniwill P53 |
1872 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | 1924 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
1873 | */ | 1925 | */ |
1874 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | 1926 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
1875 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 1927 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -1968,7 +2020,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |||
1968 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 2020 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
1969 | { | 2021 | { |
1970 | unsigned int present; | 2022 | unsigned int present; |
1971 | 2023 | ||
1972 | present = snd_hda_codec_read(codec, 0x21, 0, | 2024 | present = snd_hda_codec_read(codec, 0x21, 0, |
1973 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | 2025 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
1974 | present &= HDA_AMP_VOLMASK; | 2026 | present &= HDA_AMP_VOLMASK; |
@@ -2050,7 +2102,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = { | |||
2050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 2102 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
2051 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2103 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2052 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 2104 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2053 | 2105 | ||
2054 | { } | 2106 | { } |
2055 | }; | 2107 | }; |
2056 | 2108 | ||
@@ -2632,12 +2684,14 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2632 | 2684 | ||
2633 | info->name = spec->stream_name_analog; | 2685 | info->name = spec->stream_name_analog; |
2634 | if (spec->stream_analog_playback) { | 2686 | if (spec->stream_analog_playback) { |
2635 | snd_assert(spec->multiout.dac_nids, return -EINVAL); | 2687 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
2688 | return -EINVAL; | ||
2636 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | 2689 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
2637 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | 2690 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
2638 | } | 2691 | } |
2639 | if (spec->stream_analog_capture) { | 2692 | if (spec->stream_analog_capture) { |
2640 | snd_assert(spec->adc_nids, return -EINVAL); | 2693 | if (snd_BUG_ON(!spec->adc_nids)) |
2694 | return -EINVAL; | ||
2641 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | 2695 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
2642 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | 2696 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
2643 | } | 2697 | } |
@@ -2667,6 +2721,8 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2667 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | 2721 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2668 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | 2722 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
2669 | } | 2723 | } |
2724 | /* FIXME: do we need this for all Realtek codec models? */ | ||
2725 | codec->spdif_status_reset = 1; | ||
2670 | } | 2726 | } |
2671 | 2727 | ||
2672 | /* If the use of more than one ADC is requested for the current | 2728 | /* If the use of more than one ADC is requested for the current |
@@ -3683,7 +3739,7 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec) | |||
3683 | { | 3739 | { |
3684 | struct alc_spec *spec = codec->spec; | 3740 | struct alc_spec *spec = codec->spec; |
3685 | int i; | 3741 | int i; |
3686 | 3742 | ||
3687 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); | 3743 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
3688 | for (i = 0; i < spec->autocfg.line_outs; i++) { | 3744 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
3689 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | 3745 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
@@ -3787,7 +3843,7 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
3787 | alc880_auto_init_extra_out(codec); | 3843 | alc880_auto_init_extra_out(codec); |
3788 | alc880_auto_init_analog_input(codec); | 3844 | alc880_auto_init_analog_input(codec); |
3789 | if (spec->unsol_event) | 3845 | if (spec->unsol_event) |
3790 | alc_sku_automute(codec); | 3846 | alc_inithook(codec); |
3791 | } | 3847 | } |
3792 | 3848 | ||
3793 | /* | 3849 | /* |
@@ -4124,6 +4180,33 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |||
4124 | { } /* end */ | 4180 | { } /* end */ |
4125 | }; | 4181 | }; |
4126 | 4182 | ||
4183 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | ||
4184 | .ops = &snd_hda_bind_vol, | ||
4185 | .values = { | ||
4186 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | ||
4187 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | ||
4188 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | ||
4189 | 0 | ||
4190 | }, | ||
4191 | }; | ||
4192 | |||
4193 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | ||
4194 | .ops = &snd_hda_bind_sw, | ||
4195 | .values = { | ||
4196 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | ||
4197 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
4198 | 0 | ||
4199 | }, | ||
4200 | }; | ||
4201 | |||
4202 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | ||
4203 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | ||
4204 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | ||
4205 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | ||
4206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
4207 | { } /* end */ | ||
4208 | }; | ||
4209 | |||
4127 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | 4210 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
4128 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 4211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
4129 | {}, | 4212 | {}, |
@@ -4147,7 +4230,30 @@ static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |||
4147 | alc260_hp_3013_automute(codec); | 4230 | alc260_hp_3013_automute(codec); |
4148 | } | 4231 | } |
4149 | 4232 | ||
4150 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | 4233 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
4234 | { | ||
4235 | unsigned int present, bits; | ||
4236 | |||
4237 | present = snd_hda_codec_read(codec, 0x10, 0, | ||
4238 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; | ||
4239 | |||
4240 | bits = present ? 0 : PIN_OUT; | ||
4241 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4242 | bits); | ||
4243 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4244 | bits); | ||
4245 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4246 | bits); | ||
4247 | } | ||
4248 | |||
4249 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | ||
4250 | unsigned int res) | ||
4251 | { | ||
4252 | if ((res >> 26) == ALC880_HP_EVENT) | ||
4253 | alc260_hp_3012_automute(codec); | ||
4254 | } | ||
4255 | |||
4256 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | ||
4151 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | 4257 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
4152 | */ | 4258 | */ |
4153 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | 4259 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
@@ -4478,7 +4584,7 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { | |||
4478 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4584 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4479 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4585 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4480 | 4586 | ||
4481 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | 4587 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
4482 | * when acting as an output. | 4588 | * when acting as an output. |
4483 | */ | 4589 | */ |
4484 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | 4590 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4503,14 +4609,14 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { | |||
4503 | * stage. | 4609 | * stage. |
4504 | */ | 4610 | */ |
4505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 4611 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4506 | /* Unmute input buffer of pin widget used for Line-in (no equiv | 4612 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
4507 | * mixer ctrl) | 4613 | * mixer ctrl) |
4508 | */ | 4614 | */ |
4509 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 4615 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4510 | 4616 | ||
4511 | /* Mute capture amp left and right */ | 4617 | /* Mute capture amp left and right */ |
4512 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 4618 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4513 | /* Set ADC connection select to match default mixer setting - line | 4619 | /* Set ADC connection select to match default mixer setting - line |
4514 | * in (on mic1 pin) | 4620 | * in (on mic1 pin) |
4515 | */ | 4621 | */ |
4516 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | 4622 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -4564,7 +4670,7 @@ static struct hda_verb alc260_acer_init_verbs[] = { | |||
4564 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4670 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4565 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4671 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4566 | 4672 | ||
4567 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | 4673 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
4568 | * bus when acting as outputs. | 4674 | * bus when acting as outputs. |
4569 | */ | 4675 | */ |
4570 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | 4676 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4675,6 +4781,20 @@ static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |||
4675 | alc260_replacer_672v_automute(codec); | 4781 | alc260_replacer_672v_automute(codec); |
4676 | } | 4782 | } |
4677 | 4783 | ||
4784 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | ||
4785 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
4786 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
4787 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4788 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
4789 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4791 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
4792 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4793 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4794 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4795 | {} | ||
4796 | }; | ||
4797 | |||
4678 | /* Test configuration for debugging, modelled after the ALC880 test | 4798 | /* Test configuration for debugging, modelled after the ALC880 test |
4679 | * configuration. | 4799 | * configuration. |
4680 | */ | 4800 | */ |
@@ -4686,7 +4806,7 @@ static hda_nid_t alc260_test_adc_nids[2] = { | |||
4686 | 0x04, 0x05, | 4806 | 0x04, 0x05, |
4687 | }; | 4807 | }; |
4688 | /* For testing the ALC260, each input MUX needs its own definition since | 4808 | /* For testing the ALC260, each input MUX needs its own definition since |
4689 | * the signal assignments are different. This assumes that the first ADC | 4809 | * the signal assignments are different. This assumes that the first ADC |
4690 | * is NID 0x04. | 4810 | * is NID 0x04. |
4691 | */ | 4811 | */ |
4692 | static struct hda_input_mux alc260_test_capture_sources[2] = { | 4812 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
@@ -4769,7 +4889,7 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { | |||
4769 | 4889 | ||
4770 | /* Switches to allow the digital IO pins to be enabled. The datasheet | 4890 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
4771 | * is ambigious as to which NID is which; testing on laptops which | 4891 | * is ambigious as to which NID is which; testing on laptops which |
4772 | * make this output available should provide clarification. | 4892 | * make this output available should provide clarification. |
4773 | */ | 4893 | */ |
4774 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | 4894 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
4775 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | 4895 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
@@ -4805,7 +4925,7 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
4805 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4925 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4806 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4926 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4807 | 4927 | ||
4808 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | 4928 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
4809 | * OUT1 sum bus when acting as an output. | 4929 | * OUT1 sum bus when acting as an output. |
4810 | */ | 4930 | */ |
4811 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | 4931 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4897,7 +5017,7 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |||
4897 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | 5017 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
4898 | } else | 5018 | } else |
4899 | return 0; /* N/A */ | 5019 | return 0; /* N/A */ |
4900 | 5020 | ||
4901 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | 5021 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
4902 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | 5022 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
4903 | if (err < 0) | 5023 | if (err < 0) |
@@ -5003,7 +5123,7 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec) | |||
5003 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | 5123 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
5004 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | 5124 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
5005 | } | 5125 | } |
5006 | 5126 | ||
5007 | nid = spec->autocfg.speaker_pins[0]; | 5127 | nid = spec->autocfg.speaker_pins[0]; |
5008 | if (nid) | 5128 | if (nid) |
5009 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | 5129 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
@@ -5045,7 +5165,7 @@ static struct hda_verb alc260_volume_init_verbs[] = { | |||
5045 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5165 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5046 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | 5166 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
5047 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5167 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5048 | 5168 | ||
5049 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | 5169 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
5050 | * mixer widget | 5170 | * mixer widget |
5051 | * Note: PASD motherboards uses the Line In 2 as the input for | 5171 | * Note: PASD motherboards uses the Line In 2 as the input for |
@@ -5074,7 +5194,7 @@ static struct hda_verb alc260_volume_init_verbs[] = { | |||
5074 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 5194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
5075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5195 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 5196 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
5077 | 5197 | ||
5078 | { } | 5198 | { } |
5079 | }; | 5199 | }; |
5080 | 5200 | ||
@@ -5134,7 +5254,7 @@ static void alc260_auto_init(struct hda_codec *codec) | |||
5134 | alc260_auto_init_multi_out(codec); | 5254 | alc260_auto_init_multi_out(codec); |
5135 | alc260_auto_init_analog_input(codec); | 5255 | alc260_auto_init_analog_input(codec); |
5136 | if (spec->unsol_event) | 5256 | if (spec->unsol_event) |
5137 | alc_sku_automute(codec); | 5257 | alc_inithook(codec); |
5138 | } | 5258 | } |
5139 | 5259 | ||
5140 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5260 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -5155,6 +5275,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
5155 | [ALC260_BASIC] = "basic", | 5275 | [ALC260_BASIC] = "basic", |
5156 | [ALC260_HP] = "hp", | 5276 | [ALC260_HP] = "hp", |
5157 | [ALC260_HP_3013] = "hp-3013", | 5277 | [ALC260_HP_3013] = "hp-3013", |
5278 | [ALC260_HP_DC7600] = "hp-dc7600", | ||
5158 | [ALC260_FUJITSU_S702X] = "fujitsu", | 5279 | [ALC260_FUJITSU_S702X] = "fujitsu", |
5159 | [ALC260_ACER] = "acer", | 5280 | [ALC260_ACER] = "acer", |
5160 | [ALC260_WILL] = "will", | 5281 | [ALC260_WILL] = "will", |
@@ -5172,7 +5293,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = { | |||
5172 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), | 5293 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
5173 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | 5294 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
5174 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | 5295 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
5175 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), | 5296 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
5176 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | 5297 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
5177 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | 5298 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
5178 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | 5299 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
@@ -5218,6 +5339,22 @@ static struct alc_config_preset alc260_presets[] = { | |||
5218 | .unsol_event = alc260_hp_unsol_event, | 5339 | .unsol_event = alc260_hp_unsol_event, |
5219 | .init_hook = alc260_hp_automute, | 5340 | .init_hook = alc260_hp_automute, |
5220 | }, | 5341 | }, |
5342 | [ALC260_HP_DC7600] = { | ||
5343 | .mixers = { alc260_hp_dc7600_mixer, | ||
5344 | alc260_input_mixer, | ||
5345 | alc260_capture_alt_mixer }, | ||
5346 | .init_verbs = { alc260_init_verbs, | ||
5347 | alc260_hp_dc7600_verbs }, | ||
5348 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
5349 | .dac_nids = alc260_dac_nids, | ||
5350 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | ||
5351 | .adc_nids = alc260_hp_adc_nids, | ||
5352 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
5353 | .channel_mode = alc260_modes, | ||
5354 | .input_mux = &alc260_capture_source, | ||
5355 | .unsol_event = alc260_hp_3012_unsol_event, | ||
5356 | .init_hook = alc260_hp_3012_automute, | ||
5357 | }, | ||
5221 | [ALC260_HP_3013] = { | 5358 | [ALC260_HP_3013] = { |
5222 | .mixers = { alc260_hp_3013_mixer, | 5359 | .mixers = { alc260_hp_3013_mixer, |
5223 | alc260_input_mixer, | 5360 | alc260_input_mixer, |
@@ -5933,7 +6070,7 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
5933 | 6070 | ||
5934 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6071 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6072 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5936 | 6073 | ||
5937 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | 6074 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
5938 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | 6075 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
5939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6076 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -5949,7 +6086,7 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
5949 | static void alc882_targa_automute(struct hda_codec *codec) | 6086 | static void alc882_targa_automute(struct hda_codec *codec) |
5950 | { | 6087 | { |
5951 | unsigned int present; | 6088 | unsigned int present; |
5952 | 6089 | ||
5953 | present = snd_hda_codec_read(codec, 0x14, 0, | 6090 | present = snd_hda_codec_read(codec, 0x14, 0, |
5954 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 6091 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
5955 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 6092 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
@@ -5975,7 +6112,7 @@ static struct hda_verb alc882_asus_a7j_verbs[] = { | |||
5975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6113 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5977 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6114 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5978 | 6115 | ||
5979 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6116 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
5980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6117 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
5981 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6118 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
@@ -5993,7 +6130,7 @@ static struct hda_verb alc882_asus_a7m_verbs[] = { | |||
5993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5995 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6132 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5996 | 6133 | ||
5997 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6134 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
5998 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
5999 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6136 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
@@ -6319,7 +6456,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6319 | .channel_mode = alc882_3ST_6ch_modes, | 6456 | .channel_mode = alc882_3ST_6ch_modes, |
6320 | .need_dac_fix = 1, | 6457 | .need_dac_fix = 1, |
6321 | .input_mux = &alc882_capture_source, | 6458 | .input_mux = &alc882_capture_source, |
6322 | }, | 6459 | }, |
6323 | [ALC882_ASUS_A7M] = { | 6460 | [ALC882_ASUS_A7M] = { |
6324 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | 6461 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
6325 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | 6462 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
@@ -6332,14 +6469,14 @@ static struct alc_config_preset alc882_presets[] = { | |||
6332 | .channel_mode = alc880_threestack_modes, | 6469 | .channel_mode = alc880_threestack_modes, |
6333 | .need_dac_fix = 1, | 6470 | .need_dac_fix = 1, |
6334 | .input_mux = &alc882_capture_source, | 6471 | .input_mux = &alc882_capture_source, |
6335 | }, | 6472 | }, |
6336 | }; | 6473 | }; |
6337 | 6474 | ||
6338 | 6475 | ||
6339 | /* | 6476 | /* |
6340 | * Pin config fixes | 6477 | * Pin config fixes |
6341 | */ | 6478 | */ |
6342 | enum { | 6479 | enum { |
6343 | PINFIX_ABIT_AW9D_MAX | 6480 | PINFIX_ABIT_AW9D_MAX |
6344 | }; | 6481 | }; |
6345 | 6482 | ||
@@ -6527,7 +6664,7 @@ static void alc882_auto_init(struct hda_codec *codec) | |||
6527 | alc882_auto_init_analog_input(codec); | 6664 | alc882_auto_init_analog_input(codec); |
6528 | alc882_auto_init_input_src(codec); | 6665 | alc882_auto_init_input_src(codec); |
6529 | if (spec->unsol_event) | 6666 | if (spec->unsol_event) |
6530 | alc_sku_automute(codec); | 6667 | alc_inithook(codec); |
6531 | } | 6668 | } |
6532 | 6669 | ||
6533 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ | 6670 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
@@ -6554,16 +6691,19 @@ static int patch_alc882(struct hda_codec *codec) | |||
6554 | board_config = ALC885_MACPRO; | 6691 | board_config = ALC885_MACPRO; |
6555 | break; | 6692 | break; |
6556 | case 0x106b1000: /* iMac 24 */ | 6693 | case 0x106b1000: /* iMac 24 */ |
6694 | case 0x106b2800: /* AppleTV */ | ||
6557 | board_config = ALC885_IMAC24; | 6695 | board_config = ALC885_IMAC24; |
6558 | break; | 6696 | break; |
6559 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | 6697 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
6698 | case 0x106b00a4: /* MacbookPro4,1 */ | ||
6560 | case 0x106b2c00: /* Macbook Pro rev3 */ | 6699 | case 0x106b2c00: /* Macbook Pro rev3 */ |
6561 | case 0x106b3600: /* Macbook 3.1 */ | 6700 | case 0x106b3600: /* Macbook 3.1 */ |
6562 | board_config = ALC885_MBP3; | 6701 | board_config = ALC885_MBP3; |
6563 | break; | 6702 | break; |
6564 | default: | 6703 | default: |
6565 | /* ALC889A is handled better as ALC888-compatible */ | 6704 | /* ALC889A is handled better as ALC888-compatible */ |
6566 | if (codec->revision_id == 0x100103) { | 6705 | if (codec->revision_id == 0x100101 || |
6706 | codec->revision_id == 0x100103) { | ||
6567 | alc_free(codec); | 6707 | alc_free(codec); |
6568 | return patch_alc883(codec); | 6708 | return patch_alc883(codec); |
6569 | } | 6709 | } |
@@ -6718,6 +6858,23 @@ static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |||
6718 | }, | 6858 | }, |
6719 | }; | 6859 | }; |
6720 | 6860 | ||
6861 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
6862 | .num_items = 3, | ||
6863 | .items = { | ||
6864 | { "Mic", 0x0 }, | ||
6865 | { "Front Mic", 0x1 }, | ||
6866 | { "Line", 0x4 }, | ||
6867 | }, | ||
6868 | }; | ||
6869 | |||
6870 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
6871 | .num_items = 2, | ||
6872 | .items = { | ||
6873 | { "Mic", 0x0 }, | ||
6874 | { "Line", 0x2 }, | ||
6875 | }, | ||
6876 | }; | ||
6877 | |||
6721 | #define alc883_mux_enum_info alc_mux_enum_info | 6878 | #define alc883_mux_enum_info alc_mux_enum_info |
6722 | #define alc883_mux_enum_get alc_mux_enum_get | 6879 | #define alc883_mux_enum_get alc_mux_enum_get |
6723 | /* ALC883 has the ALC882-type input selection */ | 6880 | /* ALC883 has the ALC882-type input selection */ |
@@ -7032,13 +7189,11 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |||
7032 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | 7189 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
7033 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | 7190 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7034 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | 7191 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
7035 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
7036 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
7037 | { | 7192 | { |
7038 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 7193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
7039 | /* .name = "Capture Source", */ | 7194 | /* .name = "Capture Source", */ |
7040 | .name = "Input Source", | 7195 | .name = "Input Source", |
7041 | .count = 2, | 7196 | .count = 1, |
7042 | .info = alc883_mux_enum_info, | 7197 | .info = alc883_mux_enum_info, |
7043 | .get = alc883_mux_enum_get, | 7198 | .get = alc883_mux_enum_get, |
7044 | .put = alc883_mux_enum_put, | 7199 | .put = alc883_mux_enum_put, |
@@ -7256,7 +7411,7 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |||
7256 | .put = alc883_mux_enum_put, | 7411 | .put = alc883_mux_enum_put, |
7257 | }, | 7412 | }, |
7258 | { } /* end */ | 7413 | { } /* end */ |
7259 | }; | 7414 | }; |
7260 | 7415 | ||
7261 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 7416 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
7262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7417 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -7283,6 +7438,87 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |||
7283 | { } /* end */ | 7438 | { } /* end */ |
7284 | }; | 7439 | }; |
7285 | 7440 | ||
7441 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | ||
7442 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7443 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7444 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
7445 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
7446 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | ||
7447 | 0x0d, 1, 0x0, HDA_OUTPUT), | ||
7448 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
7449 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
7450 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
7451 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7452 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
7454 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
7455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
7456 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
7457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7460 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7462 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
7463 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
7464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
7465 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
7466 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
7467 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
7468 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
7469 | { | ||
7470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7471 | /* .name = "Capture Source", */ | ||
7472 | .name = "Input Source", | ||
7473 | .count = 2, | ||
7474 | .info = alc883_mux_enum_info, | ||
7475 | .get = alc883_mux_enum_get, | ||
7476 | .put = alc883_mux_enum_put, | ||
7477 | }, | ||
7478 | { } /* end */ | ||
7479 | }; | ||
7480 | |||
7481 | static struct hda_bind_ctls alc883_bind_cap_vol = { | ||
7482 | .ops = &snd_hda_bind_vol, | ||
7483 | .values = { | ||
7484 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
7485 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
7486 | 0 | ||
7487 | }, | ||
7488 | }; | ||
7489 | |||
7490 | static struct hda_bind_ctls alc883_bind_cap_switch = { | ||
7491 | .ops = &snd_hda_bind_sw, | ||
7492 | .values = { | ||
7493 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
7494 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
7495 | 0 | ||
7496 | }, | ||
7497 | }; | ||
7498 | |||
7499 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | ||
7500 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7501 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7502 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
7503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7504 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7506 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7508 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | ||
7509 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | ||
7510 | { | ||
7511 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7512 | /* .name = "Capture Source", */ | ||
7513 | .name = "Input Source", | ||
7514 | .count = 1, | ||
7515 | .info = alc883_mux_enum_info, | ||
7516 | .get = alc883_mux_enum_get, | ||
7517 | .put = alc883_mux_enum_put, | ||
7518 | }, | ||
7519 | { } /* end */ | ||
7520 | }; | ||
7521 | |||
7286 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | 7522 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
7287 | { | 7523 | { |
7288 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 7524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -7296,7 +7532,7 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
7296 | 7532 | ||
7297 | static struct hda_verb alc883_init_verbs[] = { | 7533 | static struct hda_verb alc883_init_verbs[] = { |
7298 | /* ADC1: mute amp left and right */ | 7534 | /* ADC1: mute amp left and right */ |
7299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7535 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7300 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7536 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7301 | /* ADC2: mute amp left and right */ | 7537 | /* ADC2: mute amp left and right */ |
7302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7538 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -7361,14 +7597,14 @@ static struct hda_verb alc883_init_verbs[] = { | |||
7361 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7597 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
7362 | /* Input mixer2 */ | 7598 | /* Input mixer2 */ |
7363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7599 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 7600 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 7601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
7366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | 7602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
7367 | /* Input mixer3 */ | 7603 | /* Input mixer3 */ |
7368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 7605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 7606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
7371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | 7607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
7372 | { } | 7608 | { } |
7373 | }; | 7609 | }; |
7374 | 7610 | ||
@@ -7468,7 +7704,7 @@ static struct hda_verb alc883_tagra_verbs[] = { | |||
7468 | 7704 | ||
7469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 7705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
7470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7706 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7471 | 7707 | ||
7472 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | 7708 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
7473 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | 7709 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
7474 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 7710 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -7518,6 +7754,18 @@ static struct hda_verb alc883_haier_w66_verbs[] = { | |||
7518 | { } /* end */ | 7754 | { } /* end */ |
7519 | }; | 7755 | }; |
7520 | 7756 | ||
7757 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | ||
7758 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7759 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
7760 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7762 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7763 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7764 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7765 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7766 | { } /* end */ | ||
7767 | }; | ||
7768 | |||
7521 | static struct hda_verb alc888_3st_hp_verbs[] = { | 7769 | static struct hda_verb alc888_3st_hp_verbs[] = { |
7522 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | 7770 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
7523 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | 7771 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
@@ -7555,7 +7803,7 @@ static struct hda_channel_mode alc888_3st_hp_modes[2] = { | |||
7555 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | 7803 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
7556 | { | 7804 | { |
7557 | unsigned int present; | 7805 | unsigned int present; |
7558 | 7806 | ||
7559 | present = snd_hda_codec_read(codec, 0x1b, 0, | 7807 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7560 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7808 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7561 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 7809 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
@@ -7568,7 +7816,7 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |||
7568 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | 7816 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
7569 | { | 7817 | { |
7570 | unsigned int present; | 7818 | unsigned int present; |
7571 | 7819 | ||
7572 | present = snd_hda_codec_read(codec, 0x14, 0, | 7820 | present = snd_hda_codec_read(codec, 0x14, 0, |
7573 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7821 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7574 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 7822 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7598,7 +7846,7 @@ static struct hda_verb alc883_medion_md2_verbs[] = { | |||
7598 | static void alc883_medion_md2_automute(struct hda_codec *codec) | 7846 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
7599 | { | 7847 | { |
7600 | unsigned int present; | 7848 | unsigned int present; |
7601 | 7849 | ||
7602 | present = snd_hda_codec_read(codec, 0x14, 0, | 7850 | present = snd_hda_codec_read(codec, 0x14, 0, |
7603 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7851 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7604 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 7852 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7753,7 +8001,7 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
7753 | static void alc883_acer_aspire_automute(struct hda_codec *codec) | 8001 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
7754 | { | 8002 | { |
7755 | unsigned int present; | 8003 | unsigned int present; |
7756 | 8004 | ||
7757 | present = snd_hda_codec_read(codec, 0x14, 0, | 8005 | present = snd_hda_codec_read(codec, 0x14, 0, |
7758 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 8006 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7759 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 8007 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7790,7 +8038,7 @@ static struct hda_verb alc883_acer_eapd_verbs[] = { | |||
7790 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) | 8038 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
7791 | { | 8039 | { |
7792 | unsigned int present; | 8040 | unsigned int present; |
7793 | 8041 | ||
7794 | present = snd_hda_codec_read(codec, 0x1b, 0, | 8042 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7795 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 8043 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7796 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 8044 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
@@ -7814,6 +8062,50 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |||
7814 | } | 8062 | } |
7815 | } | 8063 | } |
7816 | 8064 | ||
8065 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) | ||
8066 | { | ||
8067 | unsigned int mute; | ||
8068 | unsigned int present; | ||
8069 | |||
8070 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
8071 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
8072 | AC_VERB_GET_PIN_SENSE, 0); | ||
8073 | present = (present & 0x80000000) != 0; | ||
8074 | if (present) { | ||
8075 | /* mute internal speaker */ | ||
8076 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8077 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8078 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
8079 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8080 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8081 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8082 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | ||
8083 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8084 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
8085 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8086 | } else { | ||
8087 | /* unmute internal speaker if necessary */ | ||
8088 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | ||
8089 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8090 | HDA_AMP_MUTE, mute); | ||
8091 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
8092 | HDA_AMP_MUTE, mute); | ||
8093 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8094 | HDA_AMP_MUTE, mute); | ||
8095 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | ||
8096 | HDA_AMP_MUTE, mute); | ||
8097 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
8098 | HDA_AMP_MUTE, mute); | ||
8099 | } | ||
8100 | } | ||
8101 | |||
8102 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, | ||
8103 | unsigned int res) | ||
8104 | { | ||
8105 | if ((res >> 26) == ALC880_HP_EVENT) | ||
8106 | alc888_lenovo_sky_front_automute(codec); | ||
8107 | } | ||
8108 | |||
7817 | /* | 8109 | /* |
7818 | * generic initialization of ADC, input mixers and output mixers | 8110 | * generic initialization of ADC, input mixers and output mixers |
7819 | */ | 8111 | */ |
@@ -7898,6 +8190,105 @@ static struct snd_kcontrol_new alc883_capture_mixer[] = { | |||
7898 | { } /* end */ | 8190 | { } /* end */ |
7899 | }; | 8191 | }; |
7900 | 8192 | ||
8193 | static struct hda_verb alc888_asus_m90v_verbs[] = { | ||
8194 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8197 | /* enable unsolicited event */ | ||
8198 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8199 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
8200 | { } /* end */ | ||
8201 | }; | ||
8202 | |||
8203 | static void alc883_nb_mic_automute(struct hda_codec *codec) | ||
8204 | { | ||
8205 | unsigned int present; | ||
8206 | |||
8207 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
8208 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8209 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8210 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
8211 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8212 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
8213 | } | ||
8214 | |||
8215 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) | ||
8216 | { | ||
8217 | unsigned int present; | ||
8218 | unsigned char bits; | ||
8219 | |||
8220 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
8221 | AC_VERB_GET_PIN_SENSE, 0) | ||
8222 | & AC_PINSENSE_PRESENCE; | ||
8223 | bits = present ? 0 : PIN_OUT; | ||
8224 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8225 | bits); | ||
8226 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8227 | bits); | ||
8228 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8229 | bits); | ||
8230 | } | ||
8231 | |||
8232 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | ||
8233 | unsigned int res) | ||
8234 | { | ||
8235 | switch (res >> 26) { | ||
8236 | case ALC880_HP_EVENT: | ||
8237 | alc883_M90V_speaker_automute(codec); | ||
8238 | break; | ||
8239 | case ALC880_MIC_EVENT: | ||
8240 | alc883_nb_mic_automute(codec); | ||
8241 | break; | ||
8242 | } | ||
8243 | } | ||
8244 | |||
8245 | static void alc883_mode2_inithook(struct hda_codec *codec) | ||
8246 | { | ||
8247 | alc883_M90V_speaker_automute(codec); | ||
8248 | alc883_nb_mic_automute(codec); | ||
8249 | } | ||
8250 | |||
8251 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | ||
8252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8255 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8256 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8257 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
8258 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | ||
8259 | /* enable unsolicited event */ | ||
8260 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8261 | { } /* end */ | ||
8262 | }; | ||
8263 | |||
8264 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) | ||
8265 | { | ||
8266 | unsigned int present; | ||
8267 | unsigned char bits; | ||
8268 | |||
8269 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
8270 | AC_VERB_GET_PIN_SENSE, 0) | ||
8271 | & AC_PINSENSE_PRESENCE; | ||
8272 | bits = present ? 0 : PIN_OUT; | ||
8273 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8274 | bits); | ||
8275 | } | ||
8276 | |||
8277 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, | ||
8278 | unsigned int res) | ||
8279 | { | ||
8280 | switch (res >> 26) { | ||
8281 | case ALC880_HP_EVENT: | ||
8282 | alc883_eee1601_speaker_automute(codec); | ||
8283 | break; | ||
8284 | } | ||
8285 | } | ||
8286 | |||
8287 | static void alc883_eee1601_inithook(struct hda_codec *codec) | ||
8288 | { | ||
8289 | alc883_eee1601_speaker_automute(codec); | ||
8290 | } | ||
8291 | |||
7901 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 8292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7902 | #define alc883_loopbacks alc880_loopbacks | 8293 | #define alc883_loopbacks alc880_loopbacks |
7903 | #endif | 8294 | #endif |
@@ -7927,6 +8318,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
7927 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | 8318 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
7928 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | 8319 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
7929 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | 8320 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
8321 | [ALC888_LENOVO_SKY] = "lenovo-sky", | ||
7930 | [ALC883_HAIER_W66] = "haier-w66", | 8322 | [ALC883_HAIER_W66] = "haier-w66", |
7931 | [ALC888_3ST_HP] = "3stack-hp", | 8323 | [ALC888_3ST_HP] = "3stack-hp", |
7932 | [ALC888_6ST_DELL] = "6stack-dell", | 8324 | [ALC888_6ST_DELL] = "6stack-dell", |
@@ -7942,18 +8334,21 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7942 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8334 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
7943 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | 8335 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
7944 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | 8336 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
7945 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | 8337 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
7946 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | 8338 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
7947 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8339 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
7948 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8340 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
7949 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8341 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
7950 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8342 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
7951 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8343 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
8344 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | ||
7952 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8345 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8346 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | ||
7953 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8347 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
7954 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 8348 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
7955 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | 8349 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
7956 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 8350 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
8351 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | ||
7957 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | 8352 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
7958 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), | 8353 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
7959 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 8354 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
@@ -7989,6 +8384,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7989 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8384 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7990 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8385 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7991 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8386 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8387 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | ||
7992 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | 8388 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
7993 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8389 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
7994 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8390 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
@@ -8128,7 +8524,7 @@ static struct alc_config_preset alc883_presets[] = { | |||
8128 | .input_mux = &alc883_capture_source, | 8524 | .input_mux = &alc883_capture_source, |
8129 | .unsol_event = alc883_medion_md2_unsol_event, | 8525 | .unsol_event = alc883_medion_md2_unsol_event, |
8130 | .init_hook = alc883_medion_md2_automute, | 8526 | .init_hook = alc883_medion_md2_automute, |
8131 | }, | 8527 | }, |
8132 | [ALC883_LAPTOP_EAPD] = { | 8528 | [ALC883_LAPTOP_EAPD] = { |
8133 | .mixers = { alc883_base_mixer }, | 8529 | .mixers = { alc883_base_mixer }, |
8134 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 8530 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
@@ -8245,6 +8641,49 @@ static struct alc_config_preset alc883_presets[] = { | |||
8245 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | 8641 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
8246 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | 8642 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
8247 | }, | 8643 | }, |
8644 | [ALC888_LENOVO_SKY] = { | ||
8645 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | ||
8646 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | ||
8647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8648 | .dac_nids = alc883_dac_nids, | ||
8649 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8650 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
8651 | .adc_nids = alc883_adc_nids, | ||
8652 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
8653 | .channel_mode = alc883_sixstack_modes, | ||
8654 | .need_dac_fix = 1, | ||
8655 | .input_mux = &alc883_lenovo_sky_capture_source, | ||
8656 | .unsol_event = alc883_lenovo_sky_unsol_event, | ||
8657 | .init_hook = alc888_lenovo_sky_front_automute, | ||
8658 | }, | ||
8659 | [ALC888_ASUS_M90V] = { | ||
8660 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
8661 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | ||
8662 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8663 | .dac_nids = alc883_dac_nids, | ||
8664 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8665 | .dig_in_nid = ALC883_DIGIN_NID, | ||
8666 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
8667 | .channel_mode = alc883_3ST_6ch_modes, | ||
8668 | .need_dac_fix = 1, | ||
8669 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
8670 | .unsol_event = alc883_mode2_unsol_event, | ||
8671 | .init_hook = alc883_mode2_inithook, | ||
8672 | }, | ||
8673 | [ALC888_ASUS_EEE1601] = { | ||
8674 | .mixers = { alc883_asus_eee1601_mixer }, | ||
8675 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | ||
8676 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8677 | .dac_nids = alc883_dac_nids, | ||
8678 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8679 | .dig_in_nid = ALC883_DIGIN_NID, | ||
8680 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
8681 | .channel_mode = alc883_3ST_2ch_modes, | ||
8682 | .need_dac_fix = 1, | ||
8683 | .input_mux = &alc883_asus_eee1601_capture_source, | ||
8684 | .unsol_event = alc883_eee1601_unsol_event, | ||
8685 | .init_hook = alc883_eee1601_inithook, | ||
8686 | }, | ||
8248 | }; | 8687 | }; |
8249 | 8688 | ||
8250 | 8689 | ||
@@ -8354,7 +8793,7 @@ static void alc883_auto_init(struct hda_codec *codec) | |||
8354 | alc883_auto_init_analog_input(codec); | 8793 | alc883_auto_init_analog_input(codec); |
8355 | alc883_auto_init_input_src(codec); | 8794 | alc883_auto_init_input_src(codec); |
8356 | if (spec->unsol_event) | 8795 | if (spec->unsol_event) |
8357 | alc_sku_automute(codec); | 8796 | alc_inithook(codec); |
8358 | } | 8797 | } |
8359 | 8798 | ||
8360 | static int patch_alc883(struct hda_codec *codec) | 8799 | static int patch_alc883(struct hda_codec *codec) |
@@ -8398,8 +8837,13 @@ static int patch_alc883(struct hda_codec *codec) | |||
8398 | 8837 | ||
8399 | switch (codec->vendor_id) { | 8838 | switch (codec->vendor_id) { |
8400 | case 0x10ec0888: | 8839 | case 0x10ec0888: |
8401 | spec->stream_name_analog = "ALC888 Analog"; | 8840 | if (codec->revision_id == 0x100101) { |
8402 | spec->stream_name_digital = "ALC888 Digital"; | 8841 | spec->stream_name_analog = "ALC1200 Analog"; |
8842 | spec->stream_name_digital = "ALC1200 Digital"; | ||
8843 | } else { | ||
8844 | spec->stream_name_analog = "ALC888 Analog"; | ||
8845 | spec->stream_name_digital = "ALC888 Digital"; | ||
8846 | } | ||
8403 | break; | 8847 | break; |
8404 | case 0x10ec0889: | 8848 | case 0x10ec0889: |
8405 | spec->stream_name_analog = "ALC889 Analog"; | 8849 | spec->stream_name_analog = "ALC889 Analog"; |
@@ -8452,6 +8896,13 @@ static int patch_alc883(struct hda_codec *codec) | |||
8452 | #define alc262_modes alc260_modes | 8896 | #define alc262_modes alc260_modes |
8453 | #define alc262_capture_source alc882_capture_source | 8897 | #define alc262_capture_source alc882_capture_source |
8454 | 8898 | ||
8899 | static hda_nid_t alc262_dmic_adc_nids[1] = { | ||
8900 | /* ADC0 */ | ||
8901 | 0x09 | ||
8902 | }; | ||
8903 | |||
8904 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | ||
8905 | |||
8455 | static struct snd_kcontrol_new alc262_base_mixer[] = { | 8906 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
8456 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8907 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8457 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 8908 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
@@ -8833,10 +9284,10 @@ static struct hda_verb alc262_init_verbs[] = { | |||
8833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9284 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9285 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9286 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8836 | 9287 | ||
8837 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | 9288 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 9289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
8839 | 9290 | ||
8840 | /* FIXME: use matrix-type input source selection */ | 9291 | /* FIXME: use matrix-type input source selection */ |
8841 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 9292 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
8842 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | 9293 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
@@ -8858,6 +9309,12 @@ static struct hda_verb alc262_init_verbs[] = { | |||
8858 | { } | 9309 | { } |
8859 | }; | 9310 | }; |
8860 | 9311 | ||
9312 | static struct hda_verb alc262_eapd_verbs[] = { | ||
9313 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
9314 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
9315 | { } | ||
9316 | }; | ||
9317 | |||
8861 | static struct hda_verb alc262_hippo_unsol_verbs[] = { | 9318 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
8862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 9319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
8863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 9320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
@@ -8884,6 +9341,91 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { | |||
8884 | {} | 9341 | {} |
8885 | }; | 9342 | }; |
8886 | 9343 | ||
9344 | static struct hda_input_mux alc262_dmic_capture_source = { | ||
9345 | .num_items = 2, | ||
9346 | .items = { | ||
9347 | { "Int DMic", 0x9 }, | ||
9348 | { "Mic", 0x0 }, | ||
9349 | }, | ||
9350 | }; | ||
9351 | |||
9352 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | ||
9353 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
9354 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
9355 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9358 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
9359 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
9360 | { | ||
9361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
9362 | /* The multiple "Capture Source" controls confuse alsamixer | ||
9363 | * So call somewhat different.. | ||
9364 | */ | ||
9365 | /* .name = "Capture Source", */ | ||
9366 | .name = "Input Source", | ||
9367 | .count = 1, | ||
9368 | .info = alc_mux_enum_info, | ||
9369 | .get = alc_mux_enum_get, | ||
9370 | .put = alc_mux_enum_put, | ||
9371 | }, | ||
9372 | { } /* end */ | ||
9373 | }; | ||
9374 | |||
9375 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | ||
9376 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
9377 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
9378 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
9379 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
9380 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | ||
9381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
9382 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
9383 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
9384 | {} | ||
9385 | }; | ||
9386 | |||
9387 | static void alc262_dmic_automute(struct hda_codec *codec) | ||
9388 | { | ||
9389 | unsigned int present; | ||
9390 | |||
9391 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
9392 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
9393 | snd_hda_codec_write(codec, 0x22, 0, | ||
9394 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | ||
9395 | } | ||
9396 | |||
9397 | /* toggle speaker-output according to the hp-jack state */ | ||
9398 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) | ||
9399 | { | ||
9400 | unsigned int present; | ||
9401 | unsigned char bits; | ||
9402 | |||
9403 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
9404 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
9405 | bits = present ? 0 : PIN_OUT; | ||
9406 | snd_hda_codec_write(codec, 0x14, 0, | ||
9407 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | ||
9408 | } | ||
9409 | |||
9410 | |||
9411 | |||
9412 | /* unsolicited event for HP jack sensing */ | ||
9413 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | ||
9414 | unsigned int res) | ||
9415 | { | ||
9416 | if ((res >> 26) == ALC880_HP_EVENT) | ||
9417 | alc262_toshiba_s06_speaker_automute(codec); | ||
9418 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
9419 | alc262_dmic_automute(codec); | ||
9420 | |||
9421 | } | ||
9422 | |||
9423 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | ||
9424 | { | ||
9425 | alc262_toshiba_s06_speaker_automute(codec); | ||
9426 | alc262_dmic_automute(codec); | ||
9427 | } | ||
9428 | |||
8887 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 9429 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8888 | static void alc262_hippo_automute(struct hda_codec *codec) | 9430 | static void alc262_hippo_automute(struct hda_codec *codec) |
8889 | { | 9431 | { |
@@ -8948,6 +9490,41 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |||
8948 | } | 9490 | } |
8949 | 9491 | ||
8950 | /* | 9492 | /* |
9493 | * nec model | ||
9494 | * 0x15 = headphone | ||
9495 | * 0x16 = internal speaker | ||
9496 | * 0x18 = external mic | ||
9497 | */ | ||
9498 | |||
9499 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | ||
9500 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
9501 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | ||
9502 | |||
9503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9505 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
9506 | |||
9507 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
9508 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9509 | { } /* end */ | ||
9510 | }; | ||
9511 | |||
9512 | static struct hda_verb alc262_nec_verbs[] = { | ||
9513 | /* Unmute Speaker */ | ||
9514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
9515 | |||
9516 | /* Headphone */ | ||
9517 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
9518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
9519 | |||
9520 | /* External mic to headphone */ | ||
9521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
9522 | /* External mic to speaker */ | ||
9523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
9524 | {} | ||
9525 | }; | ||
9526 | |||
9527 | /* | ||
8951 | * fujitsu model | 9528 | * fujitsu model |
8952 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | 9529 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
8953 | * 0x1b = port replicator headphone out | 9530 | * 0x1b = port replicator headphone out |
@@ -9179,6 +9756,25 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |||
9179 | { } /* end */ | 9756 | { } /* end */ |
9180 | }; | 9757 | }; |
9181 | 9758 | ||
9759 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | ||
9760 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
9761 | { | ||
9762 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
9763 | .name = "Master Playback Switch", | ||
9764 | .info = snd_hda_mixer_amp_switch_info, | ||
9765 | .get = snd_hda_mixer_amp_switch_get, | ||
9766 | .put = alc262_sony_master_sw_put, | ||
9767 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
9768 | }, | ||
9769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
9772 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
9773 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
9774 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
9775 | { } /* end */ | ||
9776 | }; | ||
9777 | |||
9182 | /* additional init verbs for Benq laptops */ | 9778 | /* additional init verbs for Benq laptops */ |
9183 | static struct hda_verb alc262_EAPD_verbs[] = { | 9779 | static struct hda_verb alc262_EAPD_verbs[] = { |
9184 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | 9780 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
@@ -9427,7 +10023,7 @@ static struct hda_verb alc262_volume_init_verbs[] = { | |||
9427 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 10023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 10024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9429 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 10025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9430 | 10026 | ||
9431 | /* set up input amps for analog loopback */ | 10027 | /* set up input amps for analog loopback */ |
9432 | /* Amp Indices: DAC = 0, mixer = 1 */ | 10028 | /* Amp Indices: DAC = 0, mixer = 1 */ |
9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 10029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -9482,7 +10078,7 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = { | |||
9482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 10078 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
9483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | 10079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
9484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | 10080 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
9485 | 10081 | ||
9486 | /* | 10082 | /* |
9487 | * Set up output mixers (0x0c - 0x0e) | 10083 | * Set up output mixers (0x0c - 0x0e) |
9488 | */ | 10084 | */ |
@@ -9643,6 +10239,24 @@ static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | |||
9643 | { } | 10239 | { } |
9644 | }; | 10240 | }; |
9645 | 10241 | ||
10242 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | ||
10243 | |||
10244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | ||
10245 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
10246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
10247 | |||
10248 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | ||
10249 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
10250 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
10251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
10252 | |||
10253 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | ||
10254 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
10255 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
10256 | {} | ||
10257 | }; | ||
10258 | |||
10259 | |||
9646 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 10260 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9647 | #define alc262_loopbacks alc880_loopbacks | 10261 | #define alc262_loopbacks alc880_loopbacks |
9648 | #endif | 10262 | #endif |
@@ -9711,7 +10325,7 @@ static void alc262_auto_init(struct hda_codec *codec) | |||
9711 | alc262_auto_init_analog_input(codec); | 10325 | alc262_auto_init_analog_input(codec); |
9712 | alc262_auto_init_input_src(codec); | 10326 | alc262_auto_init_input_src(codec); |
9713 | if (spec->unsol_event) | 10327 | if (spec->unsol_event) |
9714 | alc_sku_automute(codec); | 10328 | alc_inithook(codec); |
9715 | } | 10329 | } |
9716 | 10330 | ||
9717 | /* | 10331 | /* |
@@ -9729,13 +10343,17 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { | |||
9729 | [ALC262_BENQ_ED8] = "benq", | 10343 | [ALC262_BENQ_ED8] = "benq", |
9730 | [ALC262_BENQ_T31] = "benq-t31", | 10344 | [ALC262_BENQ_T31] = "benq-t31", |
9731 | [ALC262_SONY_ASSAMD] = "sony-assamd", | 10345 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
10346 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | ||
10347 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | ||
9732 | [ALC262_ULTRA] = "ultra", | 10348 | [ALC262_ULTRA] = "ultra", |
9733 | [ALC262_LENOVO_3000] = "lenovo-3000", | 10349 | [ALC262_LENOVO_3000] = "lenovo-3000", |
10350 | [ALC262_NEC] = "nec", | ||
9734 | [ALC262_AUTO] = "auto", | 10351 | [ALC262_AUTO] = "auto", |
9735 | }; | 10352 | }; |
9736 | 10353 | ||
9737 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | 10354 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
9738 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | 10355 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
10356 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | ||
9739 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), | 10357 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
9740 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), | 10358 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
9741 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), | 10359 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
@@ -9764,7 +10382,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
9764 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), | 10382 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
9765 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), | 10383 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
9766 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | 10384 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9767 | ALC262_SONY_ASSAMD), | 10385 | ALC262_TOSHIBA_RX1), |
10386 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | ||
9768 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | 10387 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
9769 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | 10388 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
9770 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), | 10389 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
@@ -9918,7 +10537,7 @@ static struct alc_config_preset alc262_presets[] = { | |||
9918 | .input_mux = &alc262_capture_source, | 10537 | .input_mux = &alc262_capture_source, |
9919 | .unsol_event = alc262_hippo_unsol_event, | 10538 | .unsol_event = alc262_hippo_unsol_event, |
9920 | .init_hook = alc262_hippo_automute, | 10539 | .init_hook = alc262_hippo_automute, |
9921 | }, | 10540 | }, |
9922 | [ALC262_ULTRA] = { | 10541 | [ALC262_ULTRA] = { |
9923 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, | 10542 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
9924 | .init_verbs = { alc262_ultra_verbs }, | 10543 | .init_verbs = { alc262_ultra_verbs }, |
@@ -9946,6 +10565,43 @@ static struct alc_config_preset alc262_presets[] = { | |||
9946 | .input_mux = &alc262_fujitsu_capture_source, | 10565 | .input_mux = &alc262_fujitsu_capture_source, |
9947 | .unsol_event = alc262_lenovo_3000_unsol_event, | 10566 | .unsol_event = alc262_lenovo_3000_unsol_event, |
9948 | }, | 10567 | }, |
10568 | [ALC262_NEC] = { | ||
10569 | .mixers = { alc262_nec_mixer }, | ||
10570 | .init_verbs = { alc262_nec_verbs }, | ||
10571 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10572 | .dac_nids = alc262_dac_nids, | ||
10573 | .hp_nid = 0x03, | ||
10574 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10575 | .channel_mode = alc262_modes, | ||
10576 | .input_mux = &alc262_capture_source, | ||
10577 | }, | ||
10578 | [ALC262_TOSHIBA_S06] = { | ||
10579 | .mixers = { alc262_toshiba_s06_mixer }, | ||
10580 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | ||
10581 | alc262_eapd_verbs }, | ||
10582 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10583 | .capsrc_nids = alc262_dmic_capsrc_nids, | ||
10584 | .dac_nids = alc262_dac_nids, | ||
10585 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | ||
10586 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
10587 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10588 | .channel_mode = alc262_modes, | ||
10589 | .input_mux = &alc262_dmic_capture_source, | ||
10590 | .unsol_event = alc262_toshiba_s06_unsol_event, | ||
10591 | .init_hook = alc262_toshiba_s06_init_hook, | ||
10592 | }, | ||
10593 | [ALC262_TOSHIBA_RX1] = { | ||
10594 | .mixers = { alc262_toshiba_rx1_mixer }, | ||
10595 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | ||
10596 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10597 | .dac_nids = alc262_dac_nids, | ||
10598 | .hp_nid = 0x03, | ||
10599 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10600 | .channel_mode = alc262_modes, | ||
10601 | .input_mux = &alc262_capture_source, | ||
10602 | .unsol_event = alc262_hippo_unsol_event, | ||
10603 | .init_hook = alc262_hippo_automute, | ||
10604 | }, | ||
9949 | }; | 10605 | }; |
9950 | 10606 | ||
9951 | static int patch_alc262(struct hda_codec *codec) | 10607 | static int patch_alc262(struct hda_codec *codec) |
@@ -10004,7 +10660,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10004 | spec->stream_name_analog = "ALC262 Analog"; | 10660 | spec->stream_name_analog = "ALC262 Analog"; |
10005 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | 10661 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
10006 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | 10662 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
10007 | 10663 | ||
10008 | spec->stream_name_digital = "ALC262 Digital"; | 10664 | spec->stream_name_digital = "ALC262 Digital"; |
10009 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | 10665 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
10010 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | 10666 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
@@ -10040,7 +10696,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10040 | if (!spec->loopback.amplist) | 10696 | if (!spec->loopback.amplist) |
10041 | spec->loopback.amplist = alc262_loopbacks; | 10697 | spec->loopback.amplist = alc262_loopbacks; |
10042 | #endif | 10698 | #endif |
10043 | 10699 | ||
10044 | return 0; | 10700 | return 0; |
10045 | } | 10701 | } |
10046 | 10702 | ||
@@ -10049,7 +10705,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10049 | */ | 10705 | */ |
10050 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | 10706 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
10051 | #define alc268_modes alc260_modes | 10707 | #define alc268_modes alc260_modes |
10052 | 10708 | ||
10053 | static hda_nid_t alc268_dac_nids[2] = { | 10709 | static hda_nid_t alc268_dac_nids[2] = { |
10054 | /* front, hp */ | 10710 | /* front, hp */ |
10055 | 0x02, 0x03 | 10711 | 0x02, 0x03 |
@@ -10109,6 +10765,14 @@ static struct hda_verb alc268_toshiba_verbs[] = { | |||
10109 | { } /* end */ | 10765 | { } /* end */ |
10110 | }; | 10766 | }; |
10111 | 10767 | ||
10768 | static struct hda_input_mux alc268_acer_lc_capture_source = { | ||
10769 | .num_items = 2, | ||
10770 | .items = { | ||
10771 | { "i-Mic", 0x6 }, | ||
10772 | { "E-Mic", 0x0 }, | ||
10773 | }, | ||
10774 | }; | ||
10775 | |||
10112 | /* Acer specific */ | 10776 | /* Acer specific */ |
10113 | /* bind volumes of both NID 0x02 and 0x03 */ | 10777 | /* bind volumes of both NID 0x02 and 0x03 */ |
10114 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | 10778 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
@@ -10161,6 +10825,21 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |||
10161 | return change; | 10825 | return change; |
10162 | } | 10826 | } |
10163 | 10827 | ||
10828 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | ||
10829 | /* output mixer control */ | ||
10830 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
10831 | { | ||
10832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
10833 | .name = "Master Playback Switch", | ||
10834 | .info = snd_hda_mixer_amp_switch_info, | ||
10835 | .get = snd_hda_mixer_amp_switch_get, | ||
10836 | .put = alc268_acer_master_sw_put, | ||
10837 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
10838 | }, | ||
10839 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | ||
10840 | { } | ||
10841 | }; | ||
10842 | |||
10164 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | 10843 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
10165 | /* output mixer control */ | 10844 | /* output mixer control */ |
10166 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | 10845 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
@@ -10178,6 +10857,16 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = { | |||
10178 | { } | 10857 | { } |
10179 | }; | 10858 | }; |
10180 | 10859 | ||
10860 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | ||
10861 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
10862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
10863 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
10864 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
10865 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
10866 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | ||
10867 | { } | ||
10868 | }; | ||
10869 | |||
10181 | static struct hda_verb alc268_acer_verbs[] = { | 10870 | static struct hda_verb alc268_acer_verbs[] = { |
10182 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | 10871 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
10183 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 10872 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
@@ -10185,7 +10874,6 @@ static struct hda_verb alc268_acer_verbs[] = { | |||
10185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 10874 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
10186 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 10875 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10187 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 10876 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10188 | |||
10189 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 10877 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10190 | { } | 10878 | { } |
10191 | }; | 10879 | }; |
@@ -10212,6 +10900,47 @@ static void alc268_acer_init_hook(struct hda_codec *codec) | |||
10212 | alc268_acer_automute(codec, 1); | 10900 | alc268_acer_automute(codec, 1); |
10213 | } | 10901 | } |
10214 | 10902 | ||
10903 | /* toggle speaker-output according to the hp-jack state */ | ||
10904 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | ||
10905 | { | ||
10906 | unsigned int present; | ||
10907 | unsigned char bits; | ||
10908 | |||
10909 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
10910 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10911 | bits = present ? AMP_IN_MUTE(0) : 0; | ||
10912 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | ||
10913 | AMP_IN_MUTE(0), bits); | ||
10914 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | ||
10915 | AMP_IN_MUTE(0), bits); | ||
10916 | } | ||
10917 | |||
10918 | |||
10919 | static void alc268_acer_mic_automute(struct hda_codec *codec) | ||
10920 | { | ||
10921 | unsigned int present; | ||
10922 | |||
10923 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
10924 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10925 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | ||
10926 | present ? 0x0 : 0x6); | ||
10927 | } | ||
10928 | |||
10929 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | ||
10930 | unsigned int res) | ||
10931 | { | ||
10932 | if ((res >> 26) == ALC880_HP_EVENT) | ||
10933 | alc268_aspire_one_speaker_automute(codec); | ||
10934 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
10935 | alc268_acer_mic_automute(codec); | ||
10936 | } | ||
10937 | |||
10938 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | ||
10939 | { | ||
10940 | alc268_aspire_one_speaker_automute(codec); | ||
10941 | alc268_acer_mic_automute(codec); | ||
10942 | } | ||
10943 | |||
10215 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | 10944 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
10216 | /* output mixer control */ | 10945 | /* output mixer control */ |
10217 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 10946 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
@@ -10360,7 +11089,7 @@ static struct hda_verb alc268_base_init_verbs[] = { | |||
10360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11089 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
10361 | 11090 | ||
10362 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | 11091 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
10363 | 11092 | ||
10364 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11093 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
10365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
10366 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11095 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -10559,7 +11288,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
10559 | 11288 | ||
10560 | nid = cfg->line_out_pins[0]; | 11289 | nid = cfg->line_out_pins[0]; |
10561 | if (nid) | 11290 | if (nid) |
10562 | alc268_new_analog_output(spec, nid, "Front", 0); | 11291 | alc268_new_analog_output(spec, nid, "Front", 0); |
10563 | 11292 | ||
10564 | nid = cfg->speaker_pins[0]; | 11293 | nid = cfg->speaker_pins[0]; |
10565 | if (nid == 0x1d) { | 11294 | if (nid == 0x1d) { |
@@ -10581,7 +11310,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
10581 | if (err < 0) | 11310 | if (err < 0) |
10582 | return err; | 11311 | return err; |
10583 | } | 11312 | } |
10584 | return 0; | 11313 | return 0; |
10585 | } | 11314 | } |
10586 | 11315 | ||
10587 | /* create playback/capture controls for input pins */ | 11316 | /* create playback/capture controls for input pins */ |
@@ -10602,7 +11331,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
10602 | case 0x1a: | 11331 | case 0x1a: |
10603 | idx1 = 2; /* Line In */ | 11332 | idx1 = 2; /* Line In */ |
10604 | break; | 11333 | break; |
10605 | case 0x1c: | 11334 | case 0x1c: |
10606 | idx1 = 3; /* CD */ | 11335 | idx1 = 3; /* CD */ |
10607 | break; | 11336 | break; |
10608 | case 0x12: | 11337 | case 0x12: |
@@ -10614,7 +11343,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
10614 | } | 11343 | } |
10615 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | 11344 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
10616 | imux->items[imux->num_items].index = idx1; | 11345 | imux->items[imux->num_items].index = idx1; |
10617 | imux->num_items++; | 11346 | imux->num_items++; |
10618 | } | 11347 | } |
10619 | return 0; | 11348 | return 0; |
10620 | } | 11349 | } |
@@ -10644,11 +11373,11 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
10644 | } | 11373 | } |
10645 | 11374 | ||
10646 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | 11375 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
10647 | if (line_nid == 0x14) | 11376 | if (line_nid == 0x14) |
10648 | dac_vol2 = AMP_OUT_ZERO; | 11377 | dac_vol2 = AMP_OUT_ZERO; |
10649 | else if (line_nid == 0x15) | 11378 | else if (line_nid == 0x15) |
10650 | dac_vol1 = AMP_OUT_ZERO; | 11379 | dac_vol1 = AMP_OUT_ZERO; |
10651 | if (hp_nid == 0x14) | 11380 | if (hp_nid == 0x14) |
10652 | dac_vol2 = AMP_OUT_ZERO; | 11381 | dac_vol2 = AMP_OUT_ZERO; |
10653 | else if (hp_nid == 0x15) | 11382 | else if (hp_nid == 0x15) |
10654 | dac_vol1 = AMP_OUT_ZERO; | 11383 | dac_vol1 = AMP_OUT_ZERO; |
@@ -10728,7 +11457,7 @@ static void alc268_auto_init(struct hda_codec *codec) | |||
10728 | alc268_auto_init_mono_speaker_out(codec); | 11457 | alc268_auto_init_mono_speaker_out(codec); |
10729 | alc268_auto_init_analog_input(codec); | 11458 | alc268_auto_init_analog_input(codec); |
10730 | if (spec->unsol_event) | 11459 | if (spec->unsol_event) |
10731 | alc_sku_automute(codec); | 11460 | alc_inithook(codec); |
10732 | } | 11461 | } |
10733 | 11462 | ||
10734 | /* | 11463 | /* |
@@ -10739,6 +11468,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = { | |||
10739 | [ALC268_3ST] = "3stack", | 11468 | [ALC268_3ST] = "3stack", |
10740 | [ALC268_TOSHIBA] = "toshiba", | 11469 | [ALC268_TOSHIBA] = "toshiba", |
10741 | [ALC268_ACER] = "acer", | 11470 | [ALC268_ACER] = "acer", |
11471 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | ||
10742 | [ALC268_DELL] = "dell", | 11472 | [ALC268_DELL] = "dell", |
10743 | [ALC268_ZEPTO] = "zepto", | 11473 | [ALC268_ZEPTO] = "zepto", |
10744 | #ifdef CONFIG_SND_DEBUG | 11474 | #ifdef CONFIG_SND_DEBUG |
@@ -10753,11 +11483,14 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
10753 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | 11483 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
10754 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | 11484 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
10755 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | 11485 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
11486 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | ||
11487 | ALC268_ACER_ASPIRE_ONE), | ||
10756 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | 11488 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
10757 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), | 11489 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
10758 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 11490 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
10759 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), | 11491 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
10760 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), | 11492 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
11493 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), | ||
10761 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | 11494 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
10762 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | 11495 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
10763 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | 11496 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
@@ -10830,6 +11563,23 @@ static struct alc_config_preset alc268_presets[] = { | |||
10830 | .unsol_event = alc268_acer_unsol_event, | 11563 | .unsol_event = alc268_acer_unsol_event, |
10831 | .init_hook = alc268_acer_init_hook, | 11564 | .init_hook = alc268_acer_init_hook, |
10832 | }, | 11565 | }, |
11566 | [ALC268_ACER_ASPIRE_ONE] = { | ||
11567 | .mixers = { alc268_acer_aspire_one_mixer, | ||
11568 | alc268_capture_alt_mixer }, | ||
11569 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
11570 | alc268_acer_aspire_one_verbs }, | ||
11571 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
11572 | .dac_nids = alc268_dac_nids, | ||
11573 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
11574 | .adc_nids = alc268_adc_nids_alt, | ||
11575 | .capsrc_nids = alc268_capsrc_nids, | ||
11576 | .hp_nid = 0x03, | ||
11577 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
11578 | .channel_mode = alc268_modes, | ||
11579 | .input_mux = &alc268_acer_lc_capture_source, | ||
11580 | .unsol_event = alc268_acer_lc_unsol_event, | ||
11581 | .init_hook = alc268_acer_lc_init_hook, | ||
11582 | }, | ||
10833 | [ALC268_DELL] = { | 11583 | [ALC268_DELL] = { |
10834 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, | 11584 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
10835 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 11585 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
@@ -10974,7 +11724,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
10974 | codec->patch_ops = alc_patch_ops; | 11724 | codec->patch_ops = alc_patch_ops; |
10975 | if (board_config == ALC268_AUTO) | 11725 | if (board_config == ALC268_AUTO) |
10976 | spec->init_hook = alc268_auto_init; | 11726 | spec->init_hook = alc268_auto_init; |
10977 | 11727 | ||
10978 | return 0; | 11728 | return 0; |
10979 | } | 11729 | } |
10980 | 11730 | ||
@@ -10990,6 +11740,14 @@ static hda_nid_t alc269_adc_nids[1] = { | |||
10990 | 0x08, | 11740 | 0x08, |
10991 | }; | 11741 | }; |
10992 | 11742 | ||
11743 | static hda_nid_t alc269_capsrc_nids[1] = { | ||
11744 | 0x23, | ||
11745 | }; | ||
11746 | |||
11747 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | ||
11748 | * not a mux! | ||
11749 | */ | ||
11750 | |||
10993 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { | 11751 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
10994 | .num_items = 2, | 11752 | .num_items = 2, |
10995 | .items = { | 11753 | .items = { |
@@ -11016,6 +11774,8 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { | |||
11016 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 11774 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
11017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 11775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 11776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
11777 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | ||
11778 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | ||
11019 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 11779 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
11020 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 11780 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11021 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 11781 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
@@ -11025,6 +11785,28 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { | |||
11025 | { } /* end */ | 11785 | { } /* end */ |
11026 | }; | 11786 | }; |
11027 | 11787 | ||
11788 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | ||
11789 | /* output mixer control */ | ||
11790 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
11791 | { | ||
11792 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
11793 | .name = "Master Playback Switch", | ||
11794 | .info = snd_hda_mixer_amp_switch_info, | ||
11795 | .get = snd_hda_mixer_amp_switch_get, | ||
11796 | .put = alc268_acer_master_sw_put, | ||
11797 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
11798 | }, | ||
11799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
11800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
11801 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
11802 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
11803 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
11804 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
11805 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
11806 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
11807 | { } | ||
11808 | }; | ||
11809 | |||
11028 | /* bind volumes of both NID 0x0c and 0x0d */ | 11810 | /* bind volumes of both NID 0x0c and 0x0d */ |
11029 | static struct hda_bind_ctls alc269_epc_bind_vol = { | 11811 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
11030 | .ops = &snd_hda_bind_vol, | 11812 | .ops = &snd_hda_bind_vol, |
@@ -11068,75 +11850,72 @@ static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |||
11068 | { } /* end */ | 11850 | { } /* end */ |
11069 | }; | 11851 | }; |
11070 | 11852 | ||
11071 | /* | 11853 | /* beep control */ |
11072 | * generic initialization of ADC, input mixers and output mixers | 11854 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
11073 | */ | 11855 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
11074 | static struct hda_verb alc269_init_verbs[] = { | 11856 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
11075 | /* | 11857 | { } /* end */ |
11076 | * Unmute ADC0 and set the default input to mic-in | 11858 | }; |
11077 | */ | ||
11078 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11079 | 11859 | ||
11080 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | 11860 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
11081 | * analog-loopback mixer widget | 11861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
11082 | * Note: PASD motherboards uses the Line In 2 as the input for | 11862 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
11083 | * front panel mic (mic 2) | 11863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
11084 | */ | 11864 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
11085 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | 11865 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
11086 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 11866 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
11087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11867 | { } |
11088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | 11868 | }; |
11089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
11090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
11091 | 11869 | ||
11092 | /* | 11870 | /* toggle speaker-output according to the hp-jack state */ |
11093 | * Set up output mixers (0x0c - 0x0e) | 11871 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
11094 | */ | 11872 | { |
11095 | /* set vol=0 to output mixers */ | 11873 | unsigned int present; |
11096 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 11874 | unsigned char bits; |
11097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11098 | 11875 | ||
11099 | /* set up input amps for analog loopback */ | 11876 | present = snd_hda_codec_read(codec, 0x15, 0, |
11100 | /* Amp Indices: DAC = 0, mixer = 1 */ | 11877 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11878 | bits = present ? AMP_IN_MUTE(0) : 0; |
11102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 11879 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
11103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11880 | AMP_IN_MUTE(0), bits); |
11104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 11881 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
11105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11882 | AMP_IN_MUTE(0), bits); |
11106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11107 | 11883 | ||
11108 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 11884 | snd_hda_codec_write(codec, 0x20, 0, |
11109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 11885 | AC_VERB_SET_COEF_INDEX, 0x0c); |
11110 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 11886 | snd_hda_codec_write(codec, 0x20, 0, |
11111 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 11887 | AC_VERB_SET_PROC_COEF, 0x680); |
11112 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
11113 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
11114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
11115 | 11888 | ||
11116 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11889 | snd_hda_codec_write(codec, 0x20, 0, |
11117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11890 | AC_VERB_SET_COEF_INDEX, 0x0c); |
11118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11891 | snd_hda_codec_write(codec, 0x20, 0, |
11119 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11892 | AC_VERB_SET_PROC_COEF, 0x480); |
11120 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11893 | } |
11121 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11123 | 11894 | ||
11124 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11895 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
11125 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11896 | { |
11897 | unsigned int present; | ||
11126 | 11898 | ||
11127 | /* FIXME: use matrix-type input source selection */ | 11899 | present = snd_hda_codec_read(codec, 0x18, 0, |
11128 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | 11900 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11129 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | 11901 | snd_hda_codec_write(codec, 0x23, 0, |
11130 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11902 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
11131 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11903 | } |
11132 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
11133 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
11134 | 11904 | ||
11135 | /* set EAPD */ | 11905 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
11136 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 11906 | unsigned int res) |
11137 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 11907 | { |
11138 | { } | 11908 | if ((res >> 26) == ALC880_HP_EVENT) |
11139 | }; | 11909 | alc269_quanta_fl1_speaker_automute(codec); |
11910 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
11911 | alc269_quanta_fl1_mic_automute(codec); | ||
11912 | } | ||
11913 | |||
11914 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | ||
11915 | { | ||
11916 | alc269_quanta_fl1_speaker_automute(codec); | ||
11917 | alc269_quanta_fl1_mic_automute(codec); | ||
11918 | } | ||
11140 | 11919 | ||
11141 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { | 11920 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
11142 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 11921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
@@ -11163,42 +11942,42 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |||
11163 | static void alc269_speaker_automute(struct hda_codec *codec) | 11942 | static void alc269_speaker_automute(struct hda_codec *codec) |
11164 | { | 11943 | { |
11165 | unsigned int present; | 11944 | unsigned int present; |
11166 | unsigned int bits; | 11945 | unsigned char bits; |
11167 | 11946 | ||
11168 | present = snd_hda_codec_read(codec, 0x15, 0, | 11947 | present = snd_hda_codec_read(codec, 0x15, 0, |
11169 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 11948 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11170 | bits = present ? AMP_IN_MUTE(0) : 0; | 11949 | bits = present ? AMP_IN_MUTE(0) : 0; |
11171 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 11950 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
11172 | AMP_IN_MUTE(0), bits); | 11951 | AMP_IN_MUTE(0), bits); |
11173 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 11952 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
11174 | AMP_IN_MUTE(0), bits); | 11953 | AMP_IN_MUTE(0), bits); |
11175 | } | 11954 | } |
11176 | 11955 | ||
11177 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | 11956 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
11178 | { | 11957 | { |
11179 | unsigned int present; | 11958 | unsigned int present; |
11180 | 11959 | ||
11181 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) | 11960 | present = snd_hda_codec_read(codec, 0x18, 0, |
11182 | & AC_PINSENSE_PRESENCE; | 11961 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11183 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | 11962 | snd_hda_codec_write(codec, 0x23, 0, |
11184 | present ? 0 : 5); | 11963 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
11185 | } | 11964 | } |
11186 | 11965 | ||
11187 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | 11966 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
11188 | { | 11967 | { |
11189 | unsigned int present; | 11968 | unsigned int present; |
11190 | 11969 | ||
11191 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) | 11970 | present = snd_hda_codec_read(codec, 0x18, 0, |
11192 | & AC_PINSENSE_PRESENCE; | 11971 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11193 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 11972 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
11194 | present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); | 11973 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
11195 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 11974 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
11196 | present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); | 11975 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
11197 | } | 11976 | } |
11198 | 11977 | ||
11199 | /* unsolicited event for HP jack sensing */ | 11978 | /* unsolicited event for HP jack sensing */ |
11200 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | 11979 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
11201 | unsigned int res) | 11980 | unsigned int res) |
11202 | { | 11981 | { |
11203 | if ((res >> 26) == ALC880_HP_EVENT) | 11982 | if ((res >> 26) == ALC880_HP_EVENT) |
11204 | alc269_speaker_automute(codec); | 11983 | alc269_speaker_automute(codec); |
@@ -11215,7 +11994,7 @@ static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | |||
11215 | 11994 | ||
11216 | /* unsolicited event for HP jack sensing */ | 11995 | /* unsolicited event for HP jack sensing */ |
11217 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | 11996 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
11218 | unsigned int res) | 11997 | unsigned int res) |
11219 | { | 11998 | { |
11220 | if ((res >> 26) == ALC880_HP_EVENT) | 11999 | if ((res >> 26) == ALC880_HP_EVENT) |
11221 | alc269_speaker_automute(codec); | 12000 | alc269_speaker_automute(codec); |
@@ -11230,6 +12009,76 @@ static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | |||
11230 | alc269_eeepc_amic_automute(codec); | 12009 | alc269_eeepc_amic_automute(codec); |
11231 | } | 12010 | } |
11232 | 12011 | ||
12012 | /* | ||
12013 | * generic initialization of ADC, input mixers and output mixers | ||
12014 | */ | ||
12015 | static struct hda_verb alc269_init_verbs[] = { | ||
12016 | /* | ||
12017 | * Unmute ADC0 and set the default input to mic-in | ||
12018 | */ | ||
12019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12020 | |||
12021 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | ||
12022 | * analog-loopback mixer widget | ||
12023 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
12024 | * front panel mic (mic 2) | ||
12025 | */ | ||
12026 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
12027 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
12028 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
12029 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
12030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
12031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
12032 | |||
12033 | /* | ||
12034 | * Set up output mixers (0x0c - 0x0e) | ||
12035 | */ | ||
12036 | /* set vol=0 to output mixers */ | ||
12037 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
12038 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
12039 | |||
12040 | /* set up input amps for analog loopback */ | ||
12041 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
12042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12043 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12044 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12045 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12046 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12047 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12048 | |||
12049 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
12050 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
12051 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
12052 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
12053 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
12054 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
12055 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
12056 | |||
12057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
12058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
12059 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12061 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12063 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12064 | |||
12065 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
12066 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
12067 | |||
12068 | /* FIXME: use matrix-type input source selection */ | ||
12069 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
12070 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
12071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
12072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
12074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
12075 | |||
12076 | /* set EAPD */ | ||
12077 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
12078 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
12079 | { } | ||
12080 | }; | ||
12081 | |||
11233 | /* add playback controls from the parsed DAC table */ | 12082 | /* add playback controls from the parsed DAC table */ |
11234 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | 12083 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
11235 | const struct auto_pin_cfg *cfg) | 12084 | const struct auto_pin_cfg *cfg) |
@@ -11330,7 +12179,7 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11330 | static int alc269_parse_auto_config(struct hda_codec *codec) | 12179 | static int alc269_parse_auto_config(struct hda_codec *codec) |
11331 | { | 12180 | { |
11332 | struct alc_spec *spec = codec->spec; | 12181 | struct alc_spec *spec = codec->spec; |
11333 | int err; | 12182 | int i, err; |
11334 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | 12183 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
11335 | 12184 | ||
11336 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 12185 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
@@ -11353,9 +12202,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
11353 | if (spec->kctl_alloc) | 12202 | if (spec->kctl_alloc) |
11354 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 12203 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
11355 | 12204 | ||
12205 | /* create a beep mixer control if the pin 0x1d isn't assigned */ | ||
12206 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) | ||
12207 | if (spec->autocfg.input_pins[i] == 0x1d) | ||
12208 | break; | ||
12209 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) | ||
12210 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; | ||
12211 | |||
11356 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; | 12212 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
11357 | spec->num_mux_defs = 1; | 12213 | spec->num_mux_defs = 1; |
11358 | spec->input_mux = &spec->private_imux; | 12214 | spec->input_mux = &spec->private_imux; |
12215 | /* set default input source */ | ||
12216 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | ||
12217 | 0, AC_VERB_SET_CONNECT_SEL, | ||
12218 | spec->input_mux->items[0].index); | ||
11359 | 12219 | ||
11360 | err = alc_auto_add_mic_boost(codec); | 12220 | err = alc_auto_add_mic_boost(codec); |
11361 | if (err < 0) | 12221 | if (err < 0) |
@@ -11380,21 +12240,27 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
11380 | alc269_auto_init_hp_out(codec); | 12240 | alc269_auto_init_hp_out(codec); |
11381 | alc269_auto_init_analog_input(codec); | 12241 | alc269_auto_init_analog_input(codec); |
11382 | if (spec->unsol_event) | 12242 | if (spec->unsol_event) |
11383 | alc_sku_automute(codec); | 12243 | alc_inithook(codec); |
11384 | } | 12244 | } |
11385 | 12245 | ||
11386 | /* | 12246 | /* |
11387 | * configuration and preset | 12247 | * configuration and preset |
11388 | */ | 12248 | */ |
11389 | static const char *alc269_models[ALC269_MODEL_LAST] = { | 12249 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
11390 | [ALC269_BASIC] = "basic", | 12250 | [ALC269_BASIC] = "basic", |
12251 | [ALC269_QUANTA_FL1] = "quanta", | ||
12252 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | ||
12253 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" | ||
11391 | }; | 12254 | }; |
11392 | 12255 | ||
11393 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | 12256 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
12257 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | ||
11394 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | 12258 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
11395 | ALC269_ASUS_EEEPC_P703), | 12259 | ALC269_ASUS_EEEPC_P703), |
11396 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | 12260 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
11397 | ALC269_ASUS_EEEPC_P901), | 12261 | ALC269_ASUS_EEEPC_P901), |
12262 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | ||
12263 | ALC269_ASUS_EEEPC_P901), | ||
11398 | {} | 12264 | {} |
11399 | }; | 12265 | }; |
11400 | 12266 | ||
@@ -11409,6 +12275,18 @@ static struct alc_config_preset alc269_presets[] = { | |||
11409 | .channel_mode = alc269_modes, | 12275 | .channel_mode = alc269_modes, |
11410 | .input_mux = &alc269_capture_source, | 12276 | .input_mux = &alc269_capture_source, |
11411 | }, | 12277 | }, |
12278 | [ALC269_QUANTA_FL1] = { | ||
12279 | .mixers = { alc269_quanta_fl1_mixer }, | ||
12280 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | ||
12281 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
12282 | .dac_nids = alc269_dac_nids, | ||
12283 | .hp_nid = 0x03, | ||
12284 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
12285 | .channel_mode = alc269_modes, | ||
12286 | .input_mux = &alc269_capture_source, | ||
12287 | .unsol_event = alc269_quanta_fl1_unsol_event, | ||
12288 | .init_hook = alc269_quanta_fl1_init_hook, | ||
12289 | }, | ||
11412 | [ALC269_ASUS_EEEPC_P703] = { | 12290 | [ALC269_ASUS_EEEPC_P703] = { |
11413 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, | 12291 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
11414 | .init_verbs = { alc269_init_verbs, | 12292 | .init_verbs = { alc269_init_verbs, |
@@ -11488,6 +12366,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
11488 | 12366 | ||
11489 | spec->adc_nids = alc269_adc_nids; | 12367 | spec->adc_nids = alc269_adc_nids; |
11490 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 12368 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
12369 | spec->capsrc_nids = alc269_capsrc_nids; | ||
11491 | 12370 | ||
11492 | codec->patch_ops = alc_patch_ops; | 12371 | codec->patch_ops = alc_patch_ops; |
11493 | if (board_config == ALC269_AUTO) | 12372 | if (board_config == ALC269_AUTO) |
@@ -11689,7 +12568,7 @@ static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | |||
11689 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | 12568 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
11690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | 12569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
11691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | 12570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
11692 | 12571 | ||
11693 | /*Capture mixer control */ | 12572 | /*Capture mixer control */ |
11694 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | 12573 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
11695 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | 12574 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
@@ -11832,20 +12711,20 @@ static struct hda_verb alc861_base_init_verbs[] = { | |||
11832 | /* route front mic to ADC1*/ | 12711 | /* route front mic to ADC1*/ |
11833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 12712 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12713 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11835 | 12714 | ||
11836 | /* Unmute DAC0~3 & spdif out*/ | 12715 | /* Unmute DAC0~3 & spdif out*/ |
11837 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12716 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11838 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12717 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11839 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12718 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11840 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12719 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11841 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12720 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11842 | 12721 | ||
11843 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12722 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11844 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12723 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11845 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12724 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11846 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12725 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11847 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12726 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11848 | 12727 | ||
11849 | /* Unmute Stereo Mixer 15 */ | 12728 | /* Unmute Stereo Mixer 15 */ |
11850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11851 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -11901,13 +12780,13 @@ static struct hda_verb alc861_threestack_init_verbs[] = { | |||
11901 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11902 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12781 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11904 | 12783 | ||
11905 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12784 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11906 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12785 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11907 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12786 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11908 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12787 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11909 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12788 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11910 | 12789 | ||
11911 | /* Unmute Stereo Mixer 15 */ | 12790 | /* Unmute Stereo Mixer 15 */ |
11912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -11963,13 +12842,13 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |||
11963 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12842 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11964 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12843 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12844 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11966 | 12845 | ||
11967 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12846 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11968 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12847 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11969 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12848 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11970 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12849 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11971 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12850 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11972 | 12851 | ||
11973 | /* Unmute Stereo Mixer 15 */ | 12852 | /* Unmute Stereo Mixer 15 */ |
11974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12853 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12854 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12034,7 +12913,7 @@ static struct hda_verb alc861_asus_init_verbs[] = { | |||
12034 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12913 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12035 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12914 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12036 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12915 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12037 | 12916 | ||
12038 | /* Unmute Stereo Mixer 15 */ | 12917 | /* Unmute Stereo Mixer 15 */ |
12039 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12919 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12071,20 +12950,20 @@ static struct hda_verb alc861_auto_init_verbs[] = { | |||
12071 | */ | 12950 | */ |
12072 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | 12951 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
12073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12952 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12074 | 12953 | ||
12075 | /* Unmute DAC0~3 & spdif out*/ | 12954 | /* Unmute DAC0~3 & spdif out*/ |
12076 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12955 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12077 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12956 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12078 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12957 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12079 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12958 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
12081 | 12960 | ||
12082 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12961 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12083 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12962 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12084 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12963 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12085 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12964 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12086 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12965 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12087 | 12966 | ||
12088 | /* Unmute Stereo Mixer 15 */ | 12967 | /* Unmute Stereo Mixer 15 */ |
12089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12968 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12442,7 +13321,7 @@ static void alc861_auto_init(struct hda_codec *codec) | |||
12442 | alc861_auto_init_hp_out(codec); | 13321 | alc861_auto_init_hp_out(codec); |
12443 | alc861_auto_init_analog_input(codec); | 13322 | alc861_auto_init_analog_input(codec); |
12444 | if (spec->unsol_event) | 13323 | if (spec->unsol_event) |
12445 | alc_sku_automute(codec); | 13324 | alc_inithook(codec); |
12446 | } | 13325 | } |
12447 | 13326 | ||
12448 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 13327 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -12659,7 +13538,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
12659 | if (!spec->loopback.amplist) | 13538 | if (!spec->loopback.amplist) |
12660 | spec->loopback.amplist = alc861_loopbacks; | 13539 | spec->loopback.amplist = alc861_loopbacks; |
12661 | #endif | 13540 | #endif |
12662 | 13541 | ||
12663 | return 0; | 13542 | return 0; |
12664 | } | 13543 | } |
12665 | 13544 | ||
@@ -12913,7 +13792,7 @@ static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |||
12913 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 13792 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
12914 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 13793 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
12915 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 13794 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
12916 | 13795 | ||
12917 | { } /* end */ | 13796 | { } /* end */ |
12918 | }; | 13797 | }; |
12919 | 13798 | ||
@@ -13058,7 +13937,7 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | |||
13058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 13937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
13059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | 13938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
13060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 13939 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
13061 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | 13940 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
13062 | {} | 13941 | {} |
13063 | }; | 13942 | }; |
13064 | 13943 | ||
@@ -13120,7 +13999,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
13120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 13999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
13121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14000 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 14001 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
13123 | 14002 | ||
13124 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 14003 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
13125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 14004 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
13126 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 14005 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
@@ -13145,7 +14024,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
13145 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 14024 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
13146 | 14025 | ||
13147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14026 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13148 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | 14027 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13149 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 14028 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
13150 | 14029 | ||
13151 | { } /* end */ | 14030 | { } /* end */ |
@@ -13304,7 +14183,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
13304 | .input_mux = &alc861vd_hp_capture_source, | 14183 | .input_mux = &alc861vd_hp_capture_source, |
13305 | .unsol_event = alc861vd_dallas_unsol_event, | 14184 | .unsol_event = alc861vd_dallas_unsol_event, |
13306 | .init_hook = alc861vd_dallas_automute, | 14185 | .init_hook = alc861vd_dallas_automute, |
13307 | }, | 14186 | }, |
13308 | }; | 14187 | }; |
13309 | 14188 | ||
13310 | /* | 14189 | /* |
@@ -13554,7 +14433,7 @@ static void alc861vd_auto_init(struct hda_codec *codec) | |||
13554 | alc861vd_auto_init_analog_input(codec); | 14433 | alc861vd_auto_init_analog_input(codec); |
13555 | alc861vd_auto_init_input_src(codec); | 14434 | alc861vd_auto_init_input_src(codec); |
13556 | if (spec->unsol_event) | 14435 | if (spec->unsol_event) |
13557 | alc_sku_automute(codec); | 14436 | alc_inithook(codec); |
13558 | } | 14437 | } |
13559 | 14438 | ||
13560 | static int patch_alc861vd(struct hda_codec *codec) | 14439 | static int patch_alc861vd(struct hda_codec *codec) |
@@ -13883,13 +14762,120 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | |||
13883 | { } /* end */ | 14762 | { } /* end */ |
13884 | }; | 14763 | }; |
13885 | 14764 | ||
14765 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | ||
14766 | .ops = &snd_hda_bind_vol, | ||
14767 | .values = { | ||
14768 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
14769 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
14770 | 0 | ||
14771 | }, | ||
14772 | }; | ||
14773 | |||
14774 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | ||
14775 | .ops = &snd_hda_bind_sw, | ||
14776 | .values = { | ||
14777 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14778 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
14779 | 0 | ||
14780 | }, | ||
14781 | }; | ||
14782 | |||
13886 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | 14783 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
14784 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14785 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | ||
14786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14788 | { } /* end */ | ||
14789 | }; | ||
14790 | |||
14791 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | ||
14792 | .ops = &snd_hda_bind_sw, | ||
14793 | .values = { | ||
14794 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14795 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
14796 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
14797 | 0 | ||
14798 | }, | ||
14799 | }; | ||
14800 | |||
14801 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | ||
14802 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14803 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | ||
14804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14806 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14807 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14808 | |||
14809 | { } /* end */ | ||
14810 | }; | ||
14811 | |||
14812 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | ||
14813 | .ops = &snd_hda_bind_sw, | ||
14814 | .values = { | ||
14815 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14816 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
14817 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
14818 | 0 | ||
14819 | }, | ||
14820 | }; | ||
14821 | |||
14822 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | ||
14823 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14824 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | ||
14825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14827 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14828 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14829 | { } /* end */ | ||
14830 | }; | ||
14831 | |||
14832 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | ||
13887 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 14833 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13888 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 14834 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
14835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
14836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14838 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14839 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14840 | { } /* end */ | ||
14841 | }; | ||
14842 | |||
14843 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | ||
14844 | .ops = &snd_hda_bind_vol, | ||
14845 | .values = { | ||
14846 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
14847 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | ||
14848 | 0 | ||
14849 | }, | ||
14850 | }; | ||
14851 | |||
14852 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | ||
14853 | .ops = &snd_hda_bind_sw, | ||
14854 | .values = { | ||
14855 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14856 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | ||
14857 | 0 | ||
14858 | }, | ||
14859 | }; | ||
14860 | |||
14861 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | ||
14862 | HDA_BIND_VOL("Master Playback Volume", | ||
14863 | &alc663_asus_two_bind_master_vol), | ||
14864 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
14865 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
13889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 14866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
13890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 14867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
13891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 14868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
13892 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), | 14869 | { } /* end */ |
14870 | }; | ||
14871 | |||
14872 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | ||
14873 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14874 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
14875 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
14876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
14877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14878 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
13893 | { } /* end */ | 14879 | { } /* end */ |
13894 | }; | 14880 | }; |
13895 | 14881 | ||
@@ -14074,14 +15060,81 @@ static struct hda_verb alc663_auto_init_verbs[] = { | |||
14074 | }; | 15060 | }; |
14075 | 15061 | ||
14076 | static struct hda_verb alc663_m51va_init_verbs[] = { | 15062 | static struct hda_verb alc663_m51va_init_verbs[] = { |
15063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
14077 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 15065 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
14078 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 15066 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
14079 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | 15067 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
15068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
15070 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15071 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15072 | {} | ||
15073 | }; | ||
14080 | 15074 | ||
14081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | 15075 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
15076 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15077 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15078 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15081 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15082 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15083 | {} | ||
15084 | }; | ||
14082 | 15085 | ||
15086 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | ||
15087 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15088 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15089 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15090 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
15091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15093 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15094 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15095 | {} | ||
15096 | }; | ||
15097 | |||
15098 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | ||
15099 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15100 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15101 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15104 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15105 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15106 | {} | ||
15107 | }; | ||
15108 | |||
15109 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | ||
15110 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15111 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15112 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15113 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
15114 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15115 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15116 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
15117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
14083 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | 15119 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
14084 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 15120 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
15121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15122 | {} | ||
15123 | }; | ||
15124 | |||
15125 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | ||
15126 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15127 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15128 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15129 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15135 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15136 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15137 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
14085 | {} | 15138 | {} |
14086 | }; | 15139 | }; |
14087 | 15140 | ||
@@ -14110,6 +15163,14 @@ static struct hda_verb alc663_g50v_init_verbs[] = { | |||
14110 | {} | 15163 | {} |
14111 | }; | 15164 | }; |
14112 | 15165 | ||
15166 | static struct hda_verb alc662_ecs_init_verbs[] = { | ||
15167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | ||
15168 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15169 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15170 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15171 | {} | ||
15172 | }; | ||
15173 | |||
14113 | /* capture mixer elements */ | 15174 | /* capture mixer elements */ |
14114 | static struct snd_kcontrol_new alc662_capture_mixer[] = { | 15175 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
14115 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | 15176 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
@@ -14129,6 +15190,12 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = { | |||
14129 | { } /* end */ | 15190 | { } /* end */ |
14130 | }; | 15191 | }; |
14131 | 15192 | ||
15193 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | ||
15194 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
15195 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
15196 | { } /* end */ | ||
15197 | }; | ||
15198 | |||
14132 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | 15199 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
14133 | { | 15200 | { |
14134 | unsigned int present; | 15201 | unsigned int present; |
@@ -14209,12 +15276,12 @@ static void alc662_eeepc_ep20_automute(struct hda_codec *codec) | |||
14209 | if (present) { | 15276 | if (present) { |
14210 | /* mute internal speaker */ | 15277 | /* mute internal speaker */ |
14211 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 15278 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
14212 | HDA_AMP_MUTE, HDA_AMP_MUTE); | 15279 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
14213 | } else { | 15280 | } else { |
14214 | /* unmute internal speaker if necessary */ | 15281 | /* unmute internal speaker if necessary */ |
14215 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | 15282 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
14216 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 15283 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
14217 | HDA_AMP_MUTE, mute); | 15284 | HDA_AMP_MUTE, mute); |
14218 | } | 15285 | } |
14219 | } | 15286 | } |
14220 | 15287 | ||
@@ -14237,11 +15304,108 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |||
14237 | unsigned char bits; | 15304 | unsigned char bits; |
14238 | 15305 | ||
14239 | present = snd_hda_codec_read(codec, 0x21, 0, | 15306 | present = snd_hda_codec_read(codec, 0x21, 0, |
14240 | AC_VERB_GET_PIN_SENSE, 0) | 15307 | AC_VERB_GET_PIN_SENSE, 0) |
14241 | & AC_PINSENSE_PRESENCE; | 15308 | & AC_PINSENSE_PRESENCE; |
14242 | bits = present ? HDA_AMP_MUTE : 0; | 15309 | bits = present ? HDA_AMP_MUTE : 0; |
14243 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 15310 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
14244 | HDA_AMP_MUTE, bits); | 15311 | AMP_IN_MUTE(0), bits); |
15312 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15313 | AMP_IN_MUTE(0), bits); | ||
15314 | } | ||
15315 | |||
15316 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | ||
15317 | { | ||
15318 | unsigned int present; | ||
15319 | unsigned char bits; | ||
15320 | |||
15321 | present = snd_hda_codec_read(codec, 0x21, 0, | ||
15322 | AC_VERB_GET_PIN_SENSE, 0) | ||
15323 | & AC_PINSENSE_PRESENCE; | ||
15324 | bits = present ? HDA_AMP_MUTE : 0; | ||
15325 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15326 | AMP_IN_MUTE(0), bits); | ||
15327 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15328 | AMP_IN_MUTE(0), bits); | ||
15329 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
15330 | AMP_IN_MUTE(0), bits); | ||
15331 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
15332 | AMP_IN_MUTE(0), bits); | ||
15333 | } | ||
15334 | |||
15335 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | ||
15336 | { | ||
15337 | unsigned int present; | ||
15338 | unsigned char bits; | ||
15339 | |||
15340 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
15341 | AC_VERB_GET_PIN_SENSE, 0) | ||
15342 | & AC_PINSENSE_PRESENCE; | ||
15343 | bits = present ? HDA_AMP_MUTE : 0; | ||
15344 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15345 | AMP_IN_MUTE(0), bits); | ||
15346 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15347 | AMP_IN_MUTE(0), bits); | ||
15348 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
15349 | AMP_IN_MUTE(0), bits); | ||
15350 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
15351 | AMP_IN_MUTE(0), bits); | ||
15352 | } | ||
15353 | |||
15354 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | ||
15355 | { | ||
15356 | unsigned int present; | ||
15357 | unsigned char bits; | ||
15358 | |||
15359 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
15360 | AC_VERB_GET_PIN_SENSE, 0) | ||
15361 | & AC_PINSENSE_PRESENCE; | ||
15362 | bits = present ? 0 : PIN_OUT; | ||
15363 | snd_hda_codec_write(codec, 0x14, 0, | ||
15364 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | ||
15365 | } | ||
15366 | |||
15367 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | ||
15368 | { | ||
15369 | unsigned int present1, present2; | ||
15370 | |||
15371 | present1 = snd_hda_codec_read(codec, 0x21, 0, | ||
15372 | AC_VERB_GET_PIN_SENSE, 0) | ||
15373 | & AC_PINSENSE_PRESENCE; | ||
15374 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
15375 | AC_VERB_GET_PIN_SENSE, 0) | ||
15376 | & AC_PINSENSE_PRESENCE; | ||
15377 | |||
15378 | if (present1 || present2) { | ||
15379 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
15380 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
15381 | } else { | ||
15382 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
15383 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
15384 | } | ||
15385 | } | ||
15386 | |||
15387 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | ||
15388 | { | ||
15389 | unsigned int present1, present2; | ||
15390 | |||
15391 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | ||
15392 | AC_VERB_GET_PIN_SENSE, 0) | ||
15393 | & AC_PINSENSE_PRESENCE; | ||
15394 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
15395 | AC_VERB_GET_PIN_SENSE, 0) | ||
15396 | & AC_PINSENSE_PRESENCE; | ||
15397 | |||
15398 | if (present1 || present2) { | ||
15399 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15400 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | ||
15401 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15402 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | ||
15403 | } else { | ||
15404 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15405 | AMP_IN_MUTE(0), 0); | ||
15406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15407 | AMP_IN_MUTE(0), 0); | ||
15408 | } | ||
14245 | } | 15409 | } |
14246 | 15410 | ||
14247 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | 15411 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
@@ -14249,16 +15413,16 @@ static void alc663_m51va_mic_automute(struct hda_codec *codec) | |||
14249 | unsigned int present; | 15413 | unsigned int present; |
14250 | 15414 | ||
14251 | present = snd_hda_codec_read(codec, 0x18, 0, | 15415 | present = snd_hda_codec_read(codec, 0x18, 0, |
14252 | AC_VERB_GET_PIN_SENSE, 0) | 15416 | AC_VERB_GET_PIN_SENSE, 0) |
14253 | & AC_PINSENSE_PRESENCE; | 15417 | & AC_PINSENSE_PRESENCE; |
14254 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15418 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14255 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | 15419 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
14256 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15420 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14257 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | 15421 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
14258 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15422 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14259 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | 15423 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
14260 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15424 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14261 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | 15425 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
14262 | } | 15426 | } |
14263 | 15427 | ||
14264 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 15428 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
@@ -14280,6 +15444,121 @@ static void alc663_m51va_inithook(struct hda_codec *codec) | |||
14280 | alc663_m51va_mic_automute(codec); | 15444 | alc663_m51va_mic_automute(codec); |
14281 | } | 15445 | } |
14282 | 15446 | ||
15447 | /* ***************** Mode1 ******************************/ | ||
15448 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | ||
15449 | unsigned int res) | ||
15450 | { | ||
15451 | switch (res >> 26) { | ||
15452 | case ALC880_HP_EVENT: | ||
15453 | alc663_m51va_speaker_automute(codec); | ||
15454 | break; | ||
15455 | case ALC880_MIC_EVENT: | ||
15456 | alc662_eeepc_mic_automute(codec); | ||
15457 | break; | ||
15458 | } | ||
15459 | } | ||
15460 | |||
15461 | static void alc663_mode1_inithook(struct hda_codec *codec) | ||
15462 | { | ||
15463 | alc663_m51va_speaker_automute(codec); | ||
15464 | alc662_eeepc_mic_automute(codec); | ||
15465 | } | ||
15466 | /* ***************** Mode2 ******************************/ | ||
15467 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | ||
15468 | unsigned int res) | ||
15469 | { | ||
15470 | switch (res >> 26) { | ||
15471 | case ALC880_HP_EVENT: | ||
15472 | alc662_f5z_speaker_automute(codec); | ||
15473 | break; | ||
15474 | case ALC880_MIC_EVENT: | ||
15475 | alc662_eeepc_mic_automute(codec); | ||
15476 | break; | ||
15477 | } | ||
15478 | } | ||
15479 | |||
15480 | static void alc662_mode2_inithook(struct hda_codec *codec) | ||
15481 | { | ||
15482 | alc662_f5z_speaker_automute(codec); | ||
15483 | alc662_eeepc_mic_automute(codec); | ||
15484 | } | ||
15485 | /* ***************** Mode3 ******************************/ | ||
15486 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | ||
15487 | unsigned int res) | ||
15488 | { | ||
15489 | switch (res >> 26) { | ||
15490 | case ALC880_HP_EVENT: | ||
15491 | alc663_two_hp_m1_speaker_automute(codec); | ||
15492 | break; | ||
15493 | case ALC880_MIC_EVENT: | ||
15494 | alc662_eeepc_mic_automute(codec); | ||
15495 | break; | ||
15496 | } | ||
15497 | } | ||
15498 | |||
15499 | static void alc663_mode3_inithook(struct hda_codec *codec) | ||
15500 | { | ||
15501 | alc663_two_hp_m1_speaker_automute(codec); | ||
15502 | alc662_eeepc_mic_automute(codec); | ||
15503 | } | ||
15504 | /* ***************** Mode4 ******************************/ | ||
15505 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | ||
15506 | unsigned int res) | ||
15507 | { | ||
15508 | switch (res >> 26) { | ||
15509 | case ALC880_HP_EVENT: | ||
15510 | alc663_21jd_two_speaker_automute(codec); | ||
15511 | break; | ||
15512 | case ALC880_MIC_EVENT: | ||
15513 | alc662_eeepc_mic_automute(codec); | ||
15514 | break; | ||
15515 | } | ||
15516 | } | ||
15517 | |||
15518 | static void alc663_mode4_inithook(struct hda_codec *codec) | ||
15519 | { | ||
15520 | alc663_21jd_two_speaker_automute(codec); | ||
15521 | alc662_eeepc_mic_automute(codec); | ||
15522 | } | ||
15523 | /* ***************** Mode5 ******************************/ | ||
15524 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | ||
15525 | unsigned int res) | ||
15526 | { | ||
15527 | switch (res >> 26) { | ||
15528 | case ALC880_HP_EVENT: | ||
15529 | alc663_15jd_two_speaker_automute(codec); | ||
15530 | break; | ||
15531 | case ALC880_MIC_EVENT: | ||
15532 | alc662_eeepc_mic_automute(codec); | ||
15533 | break; | ||
15534 | } | ||
15535 | } | ||
15536 | |||
15537 | static void alc663_mode5_inithook(struct hda_codec *codec) | ||
15538 | { | ||
15539 | alc663_15jd_two_speaker_automute(codec); | ||
15540 | alc662_eeepc_mic_automute(codec); | ||
15541 | } | ||
15542 | /* ***************** Mode6 ******************************/ | ||
15543 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | ||
15544 | unsigned int res) | ||
15545 | { | ||
15546 | switch (res >> 26) { | ||
15547 | case ALC880_HP_EVENT: | ||
15548 | alc663_two_hp_m2_speaker_automute(codec); | ||
15549 | break; | ||
15550 | case ALC880_MIC_EVENT: | ||
15551 | alc662_eeepc_mic_automute(codec); | ||
15552 | break; | ||
15553 | } | ||
15554 | } | ||
15555 | |||
15556 | static void alc663_mode6_inithook(struct hda_codec *codec) | ||
15557 | { | ||
15558 | alc663_two_hp_m2_speaker_automute(codec); | ||
15559 | alc662_eeepc_mic_automute(codec); | ||
15560 | } | ||
15561 | |||
14283 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 15562 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
14284 | { | 15563 | { |
14285 | unsigned int present; | 15564 | unsigned int present; |
@@ -14350,6 +15629,46 @@ static void alc663_g50v_inithook(struct hda_codec *codec) | |||
14350 | alc662_eeepc_mic_automute(codec); | 15629 | alc662_eeepc_mic_automute(codec); |
14351 | } | 15630 | } |
14352 | 15631 | ||
15632 | /* bind hp and internal speaker mute (with plug check) */ | ||
15633 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, | ||
15634 | struct snd_ctl_elem_value *ucontrol) | ||
15635 | { | ||
15636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
15637 | long *valp = ucontrol->value.integer.value; | ||
15638 | int change; | ||
15639 | |||
15640 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, | ||
15641 | HDA_AMP_MUTE, | ||
15642 | valp[0] ? 0 : HDA_AMP_MUTE); | ||
15643 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, | ||
15644 | HDA_AMP_MUTE, | ||
15645 | valp[1] ? 0 : HDA_AMP_MUTE); | ||
15646 | if (change) | ||
15647 | alc262_hippo1_automute(codec); | ||
15648 | return change; | ||
15649 | } | ||
15650 | |||
15651 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | ||
15652 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
15653 | { | ||
15654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
15655 | .name = "Master Playback Switch", | ||
15656 | .info = snd_hda_mixer_amp_switch_info, | ||
15657 | .get = snd_hda_mixer_amp_switch_get, | ||
15658 | .put = alc662_ecs_master_sw_put, | ||
15659 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
15660 | }, | ||
15661 | |||
15662 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | ||
15663 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
15664 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
15665 | |||
15666 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | ||
15667 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
15668 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
15669 | { } /* end */ | ||
15670 | }; | ||
15671 | |||
14353 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15672 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14354 | #define alc662_loopbacks alc880_loopbacks | 15673 | #define alc662_loopbacks alc880_loopbacks |
14355 | #endif | 15674 | #endif |
@@ -14372,21 +15691,68 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
14372 | [ALC662_LENOVO_101E] = "lenovo-101e", | 15691 | [ALC662_LENOVO_101E] = "lenovo-101e", |
14373 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | 15692 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
14374 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | 15693 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
15694 | [ALC662_ECS] = "ecs", | ||
14375 | [ALC663_ASUS_M51VA] = "m51va", | 15695 | [ALC663_ASUS_M51VA] = "m51va", |
14376 | [ALC663_ASUS_G71V] = "g71v", | 15696 | [ALC663_ASUS_G71V] = "g71v", |
14377 | [ALC663_ASUS_H13] = "h13", | 15697 | [ALC663_ASUS_H13] = "h13", |
14378 | [ALC663_ASUS_G50V] = "g50v", | 15698 | [ALC663_ASUS_G50V] = "g50v", |
15699 | [ALC663_ASUS_MODE1] = "asus-mode1", | ||
15700 | [ALC662_ASUS_MODE2] = "asus-mode2", | ||
15701 | [ALC663_ASUS_MODE3] = "asus-mode3", | ||
15702 | [ALC663_ASUS_MODE4] = "asus-mode4", | ||
15703 | [ALC663_ASUS_MODE5] = "asus-mode5", | ||
15704 | [ALC663_ASUS_MODE6] = "asus-mode6", | ||
14379 | [ALC662_AUTO] = "auto", | 15705 | [ALC662_AUTO] = "auto", |
14380 | }; | 15706 | }; |
14381 | 15707 | ||
14382 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | 15708 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
14383 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), | ||
14384 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | 15709 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
14385 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), | 15710 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
14386 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | 15711 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
14387 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | 15712 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
14388 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | 15713 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
15714 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | ||
15715 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), | ||
15716 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | ||
15717 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | ||
15718 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | ||
15719 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15720 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15721 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | ||
15722 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15723 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
15724 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
15725 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | ||
15726 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | ||
15727 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | ||
15728 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | ||
15729 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | ||
15730 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | ||
15731 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | ||
15732 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | ||
15733 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | ||
15734 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | ||
15735 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
15736 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | ||
15737 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | ||
15738 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
15739 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | ||
15740 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | ||
15741 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | ||
15742 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | ||
15743 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | ||
15744 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | ||
15745 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | ||
15746 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | ||
15747 | ALC662_3ST_6ch_DIG), | ||
14389 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | 15748 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
15749 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | ||
15750 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | ||
15751 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | ||
15752 | ALC662_3ST_6ch_DIG), | ||
15753 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | ||
15754 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | ||
15755 | ALC662_3ST_6ch_DIG), | ||
14390 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), | 15756 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
14391 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | 15757 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
14392 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | 15758 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
@@ -14477,6 +15843,18 @@ static struct alc_config_preset alc662_presets[] = { | |||
14477 | .unsol_event = alc662_eeepc_ep20_unsol_event, | 15843 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
14478 | .init_hook = alc662_eeepc_ep20_inithook, | 15844 | .init_hook = alc662_eeepc_ep20_inithook, |
14479 | }, | 15845 | }, |
15846 | [ALC662_ECS] = { | ||
15847 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, | ||
15848 | .init_verbs = { alc662_init_verbs, | ||
15849 | alc662_ecs_init_verbs }, | ||
15850 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15851 | .dac_nids = alc662_dac_nids, | ||
15852 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15853 | .channel_mode = alc662_3ST_2ch_modes, | ||
15854 | .input_mux = &alc662_eeepc_capture_source, | ||
15855 | .unsol_event = alc662_eeepc_unsol_event, | ||
15856 | .init_hook = alc662_eeepc_inithook, | ||
15857 | }, | ||
14480 | [ALC663_ASUS_M51VA] = { | 15858 | [ALC663_ASUS_M51VA] = { |
14481 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | 15859 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
14482 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | 15860 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
@@ -14524,6 +15902,91 @@ static struct alc_config_preset alc662_presets[] = { | |||
14524 | .unsol_event = alc663_g50v_unsol_event, | 15902 | .unsol_event = alc663_g50v_unsol_event, |
14525 | .init_hook = alc663_g50v_inithook, | 15903 | .init_hook = alc663_g50v_inithook, |
14526 | }, | 15904 | }, |
15905 | [ALC663_ASUS_MODE1] = { | ||
15906 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, | ||
15907 | .init_verbs = { alc662_init_verbs, | ||
15908 | alc663_21jd_amic_init_verbs }, | ||
15909 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15910 | .hp_nid = 0x03, | ||
15911 | .dac_nids = alc662_dac_nids, | ||
15912 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15913 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15914 | .channel_mode = alc662_3ST_2ch_modes, | ||
15915 | .input_mux = &alc662_eeepc_capture_source, | ||
15916 | .unsol_event = alc663_mode1_unsol_event, | ||
15917 | .init_hook = alc663_mode1_inithook, | ||
15918 | }, | ||
15919 | [ALC662_ASUS_MODE2] = { | ||
15920 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, | ||
15921 | .init_verbs = { alc662_init_verbs, | ||
15922 | alc662_1bjd_amic_init_verbs }, | ||
15923 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15924 | .dac_nids = alc662_dac_nids, | ||
15925 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15926 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15927 | .channel_mode = alc662_3ST_2ch_modes, | ||
15928 | .input_mux = &alc662_eeepc_capture_source, | ||
15929 | .unsol_event = alc662_mode2_unsol_event, | ||
15930 | .init_hook = alc662_mode2_inithook, | ||
15931 | }, | ||
15932 | [ALC663_ASUS_MODE3] = { | ||
15933 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, | ||
15934 | .init_verbs = { alc662_init_verbs, | ||
15935 | alc663_two_hp_amic_m1_init_verbs }, | ||
15936 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15937 | .hp_nid = 0x03, | ||
15938 | .dac_nids = alc662_dac_nids, | ||
15939 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15940 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15941 | .channel_mode = alc662_3ST_2ch_modes, | ||
15942 | .input_mux = &alc662_eeepc_capture_source, | ||
15943 | .unsol_event = alc663_mode3_unsol_event, | ||
15944 | .init_hook = alc663_mode3_inithook, | ||
15945 | }, | ||
15946 | [ALC663_ASUS_MODE4] = { | ||
15947 | .mixers = { alc663_asus_21jd_clfe_mixer, | ||
15948 | alc662_auto_capture_mixer}, | ||
15949 | .init_verbs = { alc662_init_verbs, | ||
15950 | alc663_21jd_amic_init_verbs}, | ||
15951 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15952 | .hp_nid = 0x03, | ||
15953 | .dac_nids = alc662_dac_nids, | ||
15954 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15956 | .channel_mode = alc662_3ST_2ch_modes, | ||
15957 | .input_mux = &alc662_eeepc_capture_source, | ||
15958 | .unsol_event = alc663_mode4_unsol_event, | ||
15959 | .init_hook = alc663_mode4_inithook, | ||
15960 | }, | ||
15961 | [ALC663_ASUS_MODE5] = { | ||
15962 | .mixers = { alc663_asus_15jd_clfe_mixer, | ||
15963 | alc662_auto_capture_mixer }, | ||
15964 | .init_verbs = { alc662_init_verbs, | ||
15965 | alc663_15jd_amic_init_verbs }, | ||
15966 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15967 | .hp_nid = 0x03, | ||
15968 | .dac_nids = alc662_dac_nids, | ||
15969 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15970 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15971 | .channel_mode = alc662_3ST_2ch_modes, | ||
15972 | .input_mux = &alc662_eeepc_capture_source, | ||
15973 | .unsol_event = alc663_mode5_unsol_event, | ||
15974 | .init_hook = alc663_mode5_inithook, | ||
15975 | }, | ||
15976 | [ALC663_ASUS_MODE6] = { | ||
15977 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, | ||
15978 | .init_verbs = { alc662_init_verbs, | ||
15979 | alc663_two_hp_amic_m2_init_verbs }, | ||
15980 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15981 | .hp_nid = 0x03, | ||
15982 | .dac_nids = alc662_dac_nids, | ||
15983 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15984 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15985 | .channel_mode = alc662_3ST_2ch_modes, | ||
15986 | .input_mux = &alc662_eeepc_capture_source, | ||
15987 | .unsol_event = alc663_mode6_unsol_event, | ||
15988 | .init_hook = alc663_mode6_inithook, | ||
15989 | }, | ||
14527 | }; | 15990 | }; |
14528 | 15991 | ||
14529 | 15992 | ||
@@ -14560,15 +16023,15 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14560 | HDA_OUTPUT)); | 16023 | HDA_OUTPUT)); |
14561 | if (err < 0) | 16024 | if (err < 0) |
14562 | return err; | 16025 | return err; |
14563 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 16026 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
14564 | "Center Playback Switch", | 16027 | "Center Playback Switch", |
14565 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | 16028 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
14566 | HDA_INPUT)); | 16029 | HDA_INPUT)); |
14567 | if (err < 0) | 16030 | if (err < 0) |
14568 | return err; | 16031 | return err; |
14569 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 16032 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
14570 | "LFE Playback Switch", | 16033 | "LFE Playback Switch", |
14571 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | 16034 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
14572 | HDA_INPUT)); | 16035 | HDA_INPUT)); |
14573 | if (err < 0) | 16036 | if (err < 0) |
14574 | return err; | 16037 | return err; |
@@ -14580,9 +16043,9 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14580 | if (err < 0) | 16043 | if (err < 0) |
14581 | return err; | 16044 | return err; |
14582 | sprintf(name, "%s Playback Switch", chname[i]); | 16045 | sprintf(name, "%s Playback Switch", chname[i]); |
14583 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 16046 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
14584 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | 16047 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
14585 | HDA_INPUT)); | 16048 | 3, 0, HDA_INPUT)); |
14586 | if (err < 0) | 16049 | if (err < 0) |
14587 | return err; | 16050 | return err; |
14588 | } | 16051 | } |
@@ -14777,7 +16240,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
14777 | 16240 | ||
14778 | spec->num_mux_defs = 1; | 16241 | spec->num_mux_defs = 1; |
14779 | spec->input_mux = &spec->private_imux; | 16242 | spec->input_mux = &spec->private_imux; |
14780 | 16243 | ||
14781 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; | 16244 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
14782 | if (codec->vendor_id == 0x10ec0663) | 16245 | if (codec->vendor_id == 0x10ec0663) |
14783 | spec->init_verbs[spec->num_init_verbs++] = | 16246 | spec->init_verbs[spec->num_init_verbs++] = |
@@ -14801,7 +16264,7 @@ static void alc662_auto_init(struct hda_codec *codec) | |||
14801 | alc662_auto_init_analog_input(codec); | 16264 | alc662_auto_init_analog_input(codec); |
14802 | alc662_auto_init_input_src(codec); | 16265 | alc662_auto_init_input_src(codec); |
14803 | if (spec->unsol_event) | 16266 | if (spec->unsol_event) |
14804 | alc_sku_automute(codec); | 16267 | alc_inithook(codec); |
14805 | } | 16268 | } |
14806 | 16269 | ||
14807 | static int patch_alc662(struct hda_codec *codec) | 16270 | static int patch_alc662(struct hda_codec *codec) |
@@ -14846,6 +16309,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
14846 | if (codec->vendor_id == 0x10ec0663) { | 16309 | if (codec->vendor_id == 0x10ec0663) { |
14847 | spec->stream_name_analog = "ALC663 Analog"; | 16310 | spec->stream_name_analog = "ALC663 Analog"; |
14848 | spec->stream_name_digital = "ALC663 Digital"; | 16311 | spec->stream_name_digital = "ALC663 Digital"; |
16312 | } else if (codec->vendor_id == 0x10ec0272) { | ||
16313 | spec->stream_name_analog = "ALC272 Analog"; | ||
16314 | spec->stream_name_digital = "ALC272 Digital"; | ||
14849 | } else { | 16315 | } else { |
14850 | spec->stream_name_analog = "ALC662 Analog"; | 16316 | spec->stream_name_analog = "ALC662 Analog"; |
14851 | spec->stream_name_digital = "ALC662 Digital"; | 16317 | spec->stream_name_digital = "ALC662 Digital"; |
@@ -14883,6 +16349,7 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
14883 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | 16349 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
14884 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | 16350 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
14885 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | 16351 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
16352 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | ||
14886 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | 16353 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
14887 | .patch = patch_alc861 }, | 16354 | .patch = patch_alc861 }, |
14888 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | 16355 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
@@ -14896,10 +16363,15 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
14896 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 16363 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
14897 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 16364 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
14898 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, | 16365 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
16366 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | ||
16367 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | ||
14899 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 16368 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
14900 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 16369 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
14901 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 16370 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
16371 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, | ||
14902 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | 16372 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
16373 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | ||
16374 | .patch = patch_alc883 }, | ||
14903 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 16375 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
14904 | {} /* terminator */ | 16376 | {} /* terminator */ |
14905 | }; | 16377 | }; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f3da621f25c..a2ac7205d45 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -33,10 +33,12 @@ | |||
33 | #include "hda_codec.h" | 33 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 34 | #include "hda_local.h" |
35 | #include "hda_patch.h" | 35 | #include "hda_patch.h" |
36 | #include "hda_beep.h" | ||
36 | 37 | ||
37 | #define NUM_CONTROL_ALLOC 32 | 38 | #define NUM_CONTROL_ALLOC 32 |
38 | #define STAC_PWR_EVENT 0x20 | 39 | #define STAC_PWR_EVENT 0x20 |
39 | #define STAC_HP_EVENT 0x30 | 40 | #define STAC_HP_EVENT 0x30 |
41 | #define STAC_VREF_EVENT 0x40 | ||
40 | 42 | ||
41 | enum { | 43 | enum { |
42 | STAC_REF, | 44 | STAC_REF, |
@@ -71,9 +73,15 @@ enum { | |||
71 | }; | 73 | }; |
72 | 74 | ||
73 | enum { | 75 | enum { |
76 | STAC_92HD83XXX_REF, | ||
77 | STAC_92HD83XXX_MODELS | ||
78 | }; | ||
79 | |||
80 | enum { | ||
74 | STAC_92HD71BXX_REF, | 81 | STAC_92HD71BXX_REF, |
75 | STAC_DELL_M4_1, | 82 | STAC_DELL_M4_1, |
76 | STAC_DELL_M4_2, | 83 | STAC_DELL_M4_2, |
84 | STAC_HP_M4, | ||
77 | STAC_92HD71BXX_MODELS | 85 | STAC_92HD71BXX_MODELS |
78 | }; | 86 | }; |
79 | 87 | ||
@@ -104,6 +112,7 @@ enum { | |||
104 | STAC_MACBOOK_PRO_V2, | 112 | STAC_MACBOOK_PRO_V2, |
105 | STAC_IMAC_INTEL, | 113 | STAC_IMAC_INTEL, |
106 | STAC_IMAC_INTEL_20, | 114 | STAC_IMAC_INTEL_20, |
115 | STAC_ECS_202, | ||
107 | STAC_922X_DELL_D81, | 116 | STAC_922X_DELL_D81, |
108 | STAC_922X_DELL_D82, | 117 | STAC_922X_DELL_D82, |
109 | STAC_922X_DELL_M81, | 118 | STAC_922X_DELL_M81, |
@@ -130,6 +139,7 @@ struct sigmatel_spec { | |||
130 | unsigned int mic_switch: 1; | 139 | unsigned int mic_switch: 1; |
131 | unsigned int alt_switch: 1; | 140 | unsigned int alt_switch: 1; |
132 | unsigned int hp_detect: 1; | 141 | unsigned int hp_detect: 1; |
142 | unsigned int spdif_mute: 1; | ||
133 | 143 | ||
134 | /* gpio lines */ | 144 | /* gpio lines */ |
135 | unsigned int eapd_mask; | 145 | unsigned int eapd_mask; |
@@ -138,17 +148,22 @@ struct sigmatel_spec { | |||
138 | unsigned int gpio_data; | 148 | unsigned int gpio_data; |
139 | unsigned int gpio_mute; | 149 | unsigned int gpio_mute; |
140 | 150 | ||
151 | /* stream */ | ||
152 | unsigned int stream_delay; | ||
153 | |||
141 | /* analog loopback */ | 154 | /* analog loopback */ |
142 | unsigned char aloopback_mask; | 155 | unsigned char aloopback_mask; |
143 | unsigned char aloopback_shift; | 156 | unsigned char aloopback_shift; |
144 | 157 | ||
145 | /* power management */ | 158 | /* power management */ |
146 | unsigned int num_pwrs; | 159 | unsigned int num_pwrs; |
160 | unsigned int *pwr_mapping; | ||
147 | hda_nid_t *pwr_nids; | 161 | hda_nid_t *pwr_nids; |
148 | hda_nid_t *dac_list; | 162 | hda_nid_t *dac_list; |
149 | 163 | ||
150 | /* playback */ | 164 | /* playback */ |
151 | struct hda_input_mux *mono_mux; | 165 | struct hda_input_mux *mono_mux; |
166 | struct hda_input_mux *amp_mux; | ||
152 | unsigned int cur_mmux; | 167 | unsigned int cur_mmux; |
153 | struct hda_multi_out multiout; | 168 | struct hda_multi_out multiout; |
154 | hda_nid_t dac_nids[5]; | 169 | hda_nid_t dac_nids[5]; |
@@ -162,8 +177,14 @@ struct sigmatel_spec { | |||
162 | unsigned int num_dmics; | 177 | unsigned int num_dmics; |
163 | hda_nid_t *dmux_nids; | 178 | hda_nid_t *dmux_nids; |
164 | unsigned int num_dmuxes; | 179 | unsigned int num_dmuxes; |
180 | hda_nid_t *smux_nids; | ||
181 | unsigned int num_smuxes; | ||
182 | const char **spdif_labels; | ||
183 | |||
165 | hda_nid_t dig_in_nid; | 184 | hda_nid_t dig_in_nid; |
166 | hda_nid_t mono_nid; | 185 | hda_nid_t mono_nid; |
186 | hda_nid_t anabeep_nid; | ||
187 | hda_nid_t digbeep_nid; | ||
167 | 188 | ||
168 | /* pin widgets */ | 189 | /* pin widgets */ |
169 | hda_nid_t *pin_nids; | 190 | hda_nid_t *pin_nids; |
@@ -180,6 +201,12 @@ struct sigmatel_spec { | |||
180 | unsigned int cur_dmux[2]; | 201 | unsigned int cur_dmux[2]; |
181 | struct hda_input_mux *input_mux; | 202 | struct hda_input_mux *input_mux; |
182 | unsigned int cur_mux[3]; | 203 | unsigned int cur_mux[3]; |
204 | struct hda_input_mux *sinput_mux; | ||
205 | unsigned int cur_smux[2]; | ||
206 | unsigned int cur_amux; | ||
207 | hda_nid_t *amp_nids; | ||
208 | unsigned int num_amps; | ||
209 | unsigned int powerdown_adcs; | ||
183 | 210 | ||
184 | /* i/o switches */ | 211 | /* i/o switches */ |
185 | unsigned int io_switch[2]; | 212 | unsigned int io_switch[2]; |
@@ -195,6 +222,8 @@ struct sigmatel_spec { | |||
195 | struct snd_kcontrol_new *kctl_alloc; | 222 | struct snd_kcontrol_new *kctl_alloc; |
196 | struct hda_input_mux private_dimux; | 223 | struct hda_input_mux private_dimux; |
197 | struct hda_input_mux private_imux; | 224 | struct hda_input_mux private_imux; |
225 | struct hda_input_mux private_smux; | ||
226 | struct hda_input_mux private_amp_mux; | ||
198 | struct hda_input_mux private_mono_mux; | 227 | struct hda_input_mux private_mono_mux; |
199 | }; | 228 | }; |
200 | 229 | ||
@@ -215,10 +244,19 @@ static hda_nid_t stac92hd73xx_pwr_nids[8] = { | |||
215 | 0x0f, 0x10, 0x11 | 244 | 0x0f, 0x10, 0x11 |
216 | }; | 245 | }; |
217 | 246 | ||
247 | static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { | ||
248 | 0x26, 0, | ||
249 | }; | ||
250 | |||
218 | static hda_nid_t stac92hd73xx_adc_nids[2] = { | 251 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
219 | 0x1a, 0x1b | 252 | 0x1a, 0x1b |
220 | }; | 253 | }; |
221 | 254 | ||
255 | #define DELL_M6_AMP 2 | ||
256 | static hda_nid_t stac92hd73xx_amp_nids[3] = { | ||
257 | 0x0b, 0x0c, 0x0e | ||
258 | }; | ||
259 | |||
222 | #define STAC92HD73XX_NUM_DMICS 2 | 260 | #define STAC92HD73XX_NUM_DMICS 2 |
223 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { | 261 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
224 | 0x13, 0x14, 0 | 262 | 0x13, 0x14, 0 |
@@ -237,6 +275,41 @@ static hda_nid_t stac92hd73xx_dmux_nids[2] = { | |||
237 | 0x20, 0x21, | 275 | 0x20, 0x21, |
238 | }; | 276 | }; |
239 | 277 | ||
278 | static hda_nid_t stac92hd73xx_smux_nids[2] = { | ||
279 | 0x22, 0x23, | ||
280 | }; | ||
281 | |||
282 | #define STAC92HD83XXX_NUM_DMICS 2 | ||
283 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { | ||
284 | 0x11, 0x12, 0 | ||
285 | }; | ||
286 | |||
287 | #define STAC92HD81_DAC_COUNT 2 | ||
288 | #define STAC92HD83_DAC_COUNT 3 | ||
289 | static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = { | ||
290 | 0x13, 0x14, 0x22, | ||
291 | }; | ||
292 | |||
293 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { | ||
294 | 0x17, 0x18, | ||
295 | }; | ||
296 | |||
297 | static hda_nid_t stac92hd83xxx_adc_nids[2] = { | ||
298 | 0x15, 0x16, | ||
299 | }; | ||
300 | |||
301 | static hda_nid_t stac92hd83xxx_pwr_nids[4] = { | ||
302 | 0xa, 0xb, 0xd, 0xe, | ||
303 | }; | ||
304 | |||
305 | static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { | ||
306 | 0x1e, 0, | ||
307 | }; | ||
308 | |||
309 | static unsigned int stac92hd83xxx_pwr_mapping[4] = { | ||
310 | 0x03, 0x0c, 0x10, 0x40, | ||
311 | }; | ||
312 | |||
240 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { | 313 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
241 | 0x0a, 0x0d, 0x0f | 314 | 0x0a, 0x0d, 0x0f |
242 | }; | 315 | }; |
@@ -249,8 +322,12 @@ static hda_nid_t stac92hd71bxx_mux_nids[2] = { | |||
249 | 0x1a, 0x1b | 322 | 0x1a, 0x1b |
250 | }; | 323 | }; |
251 | 324 | ||
252 | static hda_nid_t stac92hd71bxx_dmux_nids[1] = { | 325 | static hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
253 | 0x1c, | 326 | 0x1c, 0x1d, |
327 | }; | ||
328 | |||
329 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { | ||
330 | 0x24, 0x25, | ||
254 | }; | 331 | }; |
255 | 332 | ||
256 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { | 333 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { |
@@ -262,6 +339,10 @@ static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { | |||
262 | 0x18, 0x19, 0 | 339 | 0x18, 0x19, 0 |
263 | }; | 340 | }; |
264 | 341 | ||
342 | static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { | ||
343 | 0x22, 0 | ||
344 | }; | ||
345 | |||
265 | static hda_nid_t stac925x_adc_nids[1] = { | 346 | static hda_nid_t stac925x_adc_nids[1] = { |
266 | 0x03, | 347 | 0x03, |
267 | }; | 348 | }; |
@@ -299,6 +380,10 @@ static hda_nid_t stac927x_mux_nids[3] = { | |||
299 | 0x15, 0x16, 0x17 | 380 | 0x15, 0x16, 0x17 |
300 | }; | 381 | }; |
301 | 382 | ||
383 | static hda_nid_t stac927x_smux_nids[1] = { | ||
384 | 0x21, | ||
385 | }; | ||
386 | |||
302 | static hda_nid_t stac927x_dac_nids[6] = { | 387 | static hda_nid_t stac927x_dac_nids[6] = { |
303 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 | 388 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
304 | }; | 389 | }; |
@@ -312,6 +397,11 @@ static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { | |||
312 | 0x13, 0x14, 0 | 397 | 0x13, 0x14, 0 |
313 | }; | 398 | }; |
314 | 399 | ||
400 | static const char *stac927x_spdif_labels[5] = { | ||
401 | "Digital Playback", "ADAT", "Analog Mux 1", | ||
402 | "Analog Mux 2", "Analog Mux 3" | ||
403 | }; | ||
404 | |||
315 | static hda_nid_t stac9205_adc_nids[2] = { | 405 | static hda_nid_t stac9205_adc_nids[2] = { |
316 | 0x12, 0x13 | 406 | 0x12, 0x13 |
317 | }; | 407 | }; |
@@ -324,6 +414,10 @@ static hda_nid_t stac9205_dmux_nids[1] = { | |||
324 | 0x1d, | 414 | 0x1d, |
325 | }; | 415 | }; |
326 | 416 | ||
417 | static hda_nid_t stac9205_smux_nids[1] = { | ||
418 | 0x21, | ||
419 | }; | ||
420 | |||
327 | #define STAC9205_NUM_DMICS 2 | 421 | #define STAC9205_NUM_DMICS 2 |
328 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { | 422 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
329 | 0x17, 0x18, 0 | 423 | 0x17, 0x18, 0 |
@@ -347,12 +441,18 @@ static hda_nid_t stac922x_pin_nids[10] = { | |||
347 | static hda_nid_t stac92hd73xx_pin_nids[13] = { | 441 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
348 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 442 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
349 | 0x0f, 0x10, 0x11, 0x12, 0x13, | 443 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
350 | 0x14, 0x1e, 0x22 | 444 | 0x14, 0x22, 0x23 |
351 | }; | 445 | }; |
352 | 446 | ||
353 | static hda_nid_t stac92hd71bxx_pin_nids[10] = { | 447 | static hda_nid_t stac92hd83xxx_pin_nids[14] = { |
448 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | ||
449 | 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
450 | 0x1d, 0x1e, 0x1f, 0x20 | ||
451 | }; | ||
452 | static hda_nid_t stac92hd71bxx_pin_nids[11] = { | ||
354 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 453 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
355 | 0x0f, 0x14, 0x18, 0x19, 0x1e, | 454 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
455 | 0x1f, | ||
356 | }; | 456 | }; |
357 | 457 | ||
358 | static hda_nid_t stac927x_pin_nids[14] = { | 458 | static hda_nid_t stac927x_pin_nids[14] = { |
@@ -367,6 +467,34 @@ static hda_nid_t stac9205_pin_nids[12] = { | |||
367 | 0x21, 0x22, | 467 | 0x21, 0x22, |
368 | }; | 468 | }; |
369 | 469 | ||
470 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info | ||
471 | |||
472 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, | ||
473 | struct snd_ctl_elem_value *ucontrol) | ||
474 | { | ||
475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
476 | struct sigmatel_spec *spec = codec->spec; | ||
477 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; | ||
478 | |||
479 | kcontrol->private_value ^= get_amp_nid(kcontrol); | ||
480 | kcontrol->private_value |= nid; | ||
481 | |||
482 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); | ||
483 | } | ||
484 | |||
485 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, | ||
486 | struct snd_ctl_elem_value *ucontrol) | ||
487 | { | ||
488 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
489 | struct sigmatel_spec *spec = codec->spec; | ||
490 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; | ||
491 | |||
492 | kcontrol->private_value ^= get_amp_nid(kcontrol); | ||
493 | kcontrol->private_value |= nid; | ||
494 | |||
495 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); | ||
496 | } | ||
497 | |||
370 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, | 498 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
371 | struct snd_ctl_elem_info *uinfo) | 499 | struct snd_ctl_elem_info *uinfo) |
372 | { | 500 | { |
@@ -397,6 +525,58 @@ static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, | |||
397 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); | 525 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
398 | } | 526 | } |
399 | 527 | ||
528 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, | ||
529 | struct snd_ctl_elem_info *uinfo) | ||
530 | { | ||
531 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
532 | struct sigmatel_spec *spec = codec->spec; | ||
533 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); | ||
534 | } | ||
535 | |||
536 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, | ||
537 | struct snd_ctl_elem_value *ucontrol) | ||
538 | { | ||
539 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
540 | struct sigmatel_spec *spec = codec->spec; | ||
541 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
542 | |||
543 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; | ||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | static int stac92xx_smux_enum_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 | struct hda_input_mux *smux = &spec->private_smux; | ||
553 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
554 | int err, val; | ||
555 | hda_nid_t nid; | ||
556 | |||
557 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, | ||
558 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); | ||
559 | if (err < 0) | ||
560 | return err; | ||
561 | |||
562 | if (spec->spdif_mute) { | ||
563 | if (smux_idx == 0) | ||
564 | nid = spec->multiout.dig_out_nid; | ||
565 | else | ||
566 | nid = codec->slave_dig_outs[smux_idx - 1]; | ||
567 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) | ||
568 | val = AMP_OUT_MUTE; | ||
569 | if (smux_idx == 0) | ||
570 | nid = spec->multiout.dig_out_nid; | ||
571 | else | ||
572 | nid = codec->slave_dig_outs[smux_idx - 1]; | ||
573 | /* un/mute SPDIF out */ | ||
574 | snd_hda_codec_write_cache(codec, nid, 0, | ||
575 | AC_VERB_SET_AMP_GAIN_MUTE, val); | ||
576 | } | ||
577 | return 0; | ||
578 | } | ||
579 | |||
400 | static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 580 | static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
401 | { | 581 | { |
402 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 582 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
@@ -452,6 +632,41 @@ static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
452 | spec->mono_nid, &spec->cur_mmux); | 632 | spec->mono_nid, &spec->cur_mmux); |
453 | } | 633 | } |
454 | 634 | ||
635 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, | ||
636 | struct snd_ctl_elem_info *uinfo) | ||
637 | { | ||
638 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
639 | struct sigmatel_spec *spec = codec->spec; | ||
640 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); | ||
641 | } | ||
642 | |||
643 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, | ||
644 | struct snd_ctl_elem_value *ucontrol) | ||
645 | { | ||
646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
647 | struct sigmatel_spec *spec = codec->spec; | ||
648 | |||
649 | ucontrol->value.enumerated.item[0] = spec->cur_amux; | ||
650 | return 0; | ||
651 | } | ||
652 | |||
653 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
654 | struct snd_ctl_elem_value *ucontrol) | ||
655 | { | ||
656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
657 | struct sigmatel_spec *spec = codec->spec; | ||
658 | struct snd_kcontrol *ctl = | ||
659 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); | ||
660 | if (!ctl) | ||
661 | return -EINVAL; | ||
662 | |||
663 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | | ||
664 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
665 | |||
666 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, | ||
667 | 0, &spec->cur_amux); | ||
668 | } | ||
669 | |||
455 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info | 670 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
456 | 671 | ||
457 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, | 672 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
@@ -546,8 +761,8 @@ static struct hda_verb dell_eq_core_init[] = { | |||
546 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, | 761 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
547 | /* setup audio connections */ | 762 | /* setup audio connections */ |
548 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | 763 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
549 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | 764 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
550 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, | 765 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01}, |
551 | /* setup adcs to point to mixer */ | 766 | /* setup adcs to point to mixer */ |
552 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | 767 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
553 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | 768 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
@@ -628,25 +843,36 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = { | |||
628 | {} | 843 | {} |
629 | }; | 844 | }; |
630 | 845 | ||
846 | static struct hda_verb stac92hd83xxx_core_init[] = { | ||
847 | /* start of config #1 */ | ||
848 | { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3}, | ||
849 | |||
850 | /* start of config #2 */ | ||
851 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
852 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
853 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, | ||
854 | |||
855 | /* power state controls amps */ | ||
856 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, | ||
857 | }; | ||
858 | |||
631 | static struct hda_verb stac92hd71bxx_core_init[] = { | 859 | static struct hda_verb stac92hd71bxx_core_init[] = { |
632 | /* set master volume and direct control */ | 860 | /* set master volume and direct control */ |
633 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 861 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
634 | /* connect headphone jack to dac1 */ | 862 | /* connect headphone jack to dac1 */ |
635 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | 863 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
636 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */ | ||
637 | /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ | 864 | /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ |
638 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 865 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
639 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 866 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
640 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 867 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
641 | }; | 868 | }; |
642 | 869 | ||
643 | #define HD_DISABLE_PORTF 3 | 870 | #define HD_DISABLE_PORTF 2 |
644 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { | 871 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
645 | /* start of config #1 */ | 872 | /* start of config #1 */ |
646 | 873 | ||
647 | /* connect port 0f to audio mixer */ | 874 | /* connect port 0f to audio mixer */ |
648 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, | 875 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
649 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */ | ||
650 | /* unmute right and left channels for node 0x0f */ | 876 | /* unmute right and left channels for node 0x0f */ |
651 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 877 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
652 | /* start of config #2 */ | 878 | /* start of config #2 */ |
@@ -655,10 +881,6 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = { | |||
655 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 881 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
656 | /* connect headphone jack to dac1 */ | 882 | /* connect headphone jack to dac1 */ |
657 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | 883 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
658 | /* connect port 0d to audio mixer */ | ||
659 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2}, | ||
660 | /* unmute dac0 input in audio mixer */ | ||
661 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | ||
662 | /* unmute right and left channels for nodes 0x0a, 0xd */ | 884 | /* unmute right and left channels for nodes 0x0a, 0xd */ |
663 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 885 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
664 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 886 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -690,12 +912,16 @@ static struct hda_verb d965_core_init[] = { | |||
690 | static struct hda_verb stac927x_core_init[] = { | 912 | static struct hda_verb stac927x_core_init[] = { |
691 | /* set master volume and direct control */ | 913 | /* set master volume and direct control */ |
692 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 914 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
915 | /* enable analog pc beep path */ | ||
916 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
693 | {} | 917 | {} |
694 | }; | 918 | }; |
695 | 919 | ||
696 | static struct hda_verb stac9205_core_init[] = { | 920 | static struct hda_verb stac9205_core_init[] = { |
697 | /* set master volume and direct control */ | 921 | /* set master volume and direct control */ |
698 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 922 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
923 | /* enable analog pc beep path */ | ||
924 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
699 | {} | 925 | {} |
700 | }; | 926 | }; |
701 | 927 | ||
@@ -709,6 +935,31 @@ static struct hda_verb stac9205_core_init[] = { | |||
709 | .put = stac92xx_mono_mux_enum_put, \ | 935 | .put = stac92xx_mono_mux_enum_put, \ |
710 | } | 936 | } |
711 | 937 | ||
938 | #define STAC_AMP_MUX \ | ||
939 | { \ | ||
940 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
941 | .name = "Amp Selector Capture Switch", \ | ||
942 | .count = 1, \ | ||
943 | .info = stac92xx_amp_mux_enum_info, \ | ||
944 | .get = stac92xx_amp_mux_enum_get, \ | ||
945 | .put = stac92xx_amp_mux_enum_put, \ | ||
946 | } | ||
947 | |||
948 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ | ||
949 | { \ | ||
950 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
951 | .name = xname, \ | ||
952 | .index = 0, \ | ||
953 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
954 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
955 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | ||
956 | .info = stac92xx_amp_volume_info, \ | ||
957 | .get = stac92xx_amp_volume_get, \ | ||
958 | .put = stac92xx_amp_volume_put, \ | ||
959 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ | ||
960 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ | ||
961 | } | ||
962 | |||
712 | #define STAC_INPUT_SOURCE(cnt) \ | 963 | #define STAC_INPUT_SOURCE(cnt) \ |
713 | { \ | 964 | { \ |
714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 965 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -736,33 +987,36 @@ static struct snd_kcontrol_new stac9200_mixer[] = { | |||
736 | STAC_INPUT_SOURCE(1), | 987 | STAC_INPUT_SOURCE(1), |
737 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), | 988 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
738 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), | 989 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
739 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), | ||
740 | { } /* end */ | 990 | { } /* end */ |
741 | }; | 991 | }; |
742 | 992 | ||
993 | #define DELL_M6_MIXER 6 | ||
743 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { | 994 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
744 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), | 995 | /* start of config #1 */ |
745 | |||
746 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
747 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
748 | |||
749 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
750 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
751 | |||
752 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), | 996 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
753 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), | 997 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
754 | 998 | ||
755 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
756 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
757 | |||
758 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), | 999 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
759 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), | 1000 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
760 | 1001 | ||
1002 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | ||
1003 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | ||
1004 | |||
1005 | /* start of config #2 */ | ||
1006 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
1007 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
1008 | |||
761 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | 1009 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
762 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | 1010 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
763 | 1011 | ||
764 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | 1012 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
765 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | 1013 | |
1014 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1015 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1016 | |||
1017 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1018 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1019 | |||
766 | { } /* end */ | 1020 | { } /* end */ |
767 | }; | 1021 | }; |
768 | 1022 | ||
@@ -818,22 +1072,59 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { | |||
818 | { } /* end */ | 1072 | { } /* end */ |
819 | }; | 1073 | }; |
820 | 1074 | ||
1075 | |||
1076 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { | ||
1077 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1078 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1079 | |||
1080 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1081 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1082 | |||
1083 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT), | ||
1084 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT), | ||
1085 | |||
1086 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT), | ||
1087 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT), | ||
1088 | |||
1089 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT), | ||
1090 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT), | ||
1091 | |||
1092 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT), | ||
1093 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT), | ||
1094 | |||
1095 | /* | ||
1096 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT), | ||
1097 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT), | ||
1098 | */ | ||
1099 | { } /* end */ | ||
1100 | }; | ||
1101 | |||
821 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | 1102 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
822 | STAC_INPUT_SOURCE(2), | 1103 | STAC_INPUT_SOURCE(2), |
1104 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), | ||
823 | 1105 | ||
824 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1106 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
825 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1107 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
826 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), | ||
827 | 1108 | ||
828 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1109 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
829 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1110 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
830 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), | 1111 | /* analog pc-beep replaced with digital beep support */ |
831 | 1112 | /* | |
832 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), | 1113 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), |
833 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), | 1114 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), |
1115 | */ | ||
1116 | |||
1117 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), | ||
1118 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), | ||
1119 | |||
1120 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), | ||
1121 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), | ||
1122 | |||
1123 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), | ||
1124 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), | ||
834 | 1125 | ||
835 | HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), | 1126 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), |
836 | HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), | 1127 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), |
837 | { } /* end */ | 1128 | { } /* end */ |
838 | }; | 1129 | }; |
839 | 1130 | ||
@@ -843,11 +1134,9 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | |||
843 | 1134 | ||
844 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1135 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
845 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1136 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
846 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), | ||
847 | 1137 | ||
848 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1138 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
849 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1139 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
850 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), | ||
851 | { } /* end */ | 1140 | { } /* end */ |
852 | }; | 1141 | }; |
853 | 1142 | ||
@@ -855,7 +1144,6 @@ static struct snd_kcontrol_new stac925x_mixer[] = { | |||
855 | STAC_INPUT_SOURCE(1), | 1144 | STAC_INPUT_SOURCE(1), |
856 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), | 1145 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
857 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), | 1146 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
858 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), | ||
859 | { } /* end */ | 1147 | { } /* end */ |
860 | }; | 1148 | }; |
861 | 1149 | ||
@@ -865,12 +1153,9 @@ static struct snd_kcontrol_new stac9205_mixer[] = { | |||
865 | 1153 | ||
866 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), | 1154 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
867 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), | 1155 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
868 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT), | ||
869 | 1156 | ||
870 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), | 1157 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
871 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), | 1158 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
872 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT), | ||
873 | |||
874 | { } /* end */ | 1159 | { } /* end */ |
875 | }; | 1160 | }; |
876 | 1161 | ||
@@ -879,11 +1164,9 @@ static struct snd_kcontrol_new stac922x_mixer[] = { | |||
879 | STAC_INPUT_SOURCE(2), | 1164 | STAC_INPUT_SOURCE(2), |
880 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), | 1165 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
881 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), | 1166 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
882 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), | ||
883 | 1167 | ||
884 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), | 1168 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
885 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), | 1169 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
886 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT), | ||
887 | { } /* end */ | 1170 | { } /* end */ |
888 | }; | 1171 | }; |
889 | 1172 | ||
@@ -894,15 +1177,12 @@ static struct snd_kcontrol_new stac927x_mixer[] = { | |||
894 | 1177 | ||
895 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), | 1178 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
896 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), | 1179 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
897 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT), | ||
898 | 1180 | ||
899 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), | 1181 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
900 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), | 1182 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), |
901 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT), | ||
902 | 1183 | ||
903 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), | 1184 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
904 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), | 1185 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), |
905 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT), | ||
906 | { } /* end */ | 1186 | { } /* end */ |
907 | }; | 1187 | }; |
908 | 1188 | ||
@@ -915,6 +1195,15 @@ static struct snd_kcontrol_new stac_dmux_mixer = { | |||
915 | .put = stac92xx_dmux_enum_put, | 1195 | .put = stac92xx_dmux_enum_put, |
916 | }; | 1196 | }; |
917 | 1197 | ||
1198 | static struct snd_kcontrol_new stac_smux_mixer = { | ||
1199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1200 | .name = "IEC958 Playback Source", | ||
1201 | /* count set later */ | ||
1202 | .info = stac92xx_smux_enum_info, | ||
1203 | .get = stac92xx_smux_enum_get, | ||
1204 | .put = stac92xx_smux_enum_put, | ||
1205 | }; | ||
1206 | |||
918 | static const char *slave_vols[] = { | 1207 | static const char *slave_vols[] = { |
919 | "Front Playback Volume", | 1208 | "Front Playback Volume", |
920 | "Surround Playback Volume", | 1209 | "Surround Playback Volume", |
@@ -966,6 +1255,22 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
966 | if (err < 0) | 1255 | if (err < 0) |
967 | return err; | 1256 | return err; |
968 | } | 1257 | } |
1258 | if (spec->num_smuxes > 0) { | ||
1259 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); | ||
1260 | struct hda_input_mux *smux = &spec->private_smux; | ||
1261 | /* check for mute support on SPDIF out */ | ||
1262 | if (wcaps & AC_WCAP_OUT_AMP) { | ||
1263 | smux->items[smux->num_items].label = "Off"; | ||
1264 | smux->items[smux->num_items].index = 0; | ||
1265 | smux->num_items++; | ||
1266 | spec->spdif_mute = 1; | ||
1267 | } | ||
1268 | stac_smux_mixer.count = spec->num_smuxes; | ||
1269 | err = snd_ctl_add(codec->bus->card, | ||
1270 | snd_ctl_new1(&stac_smux_mixer, codec)); | ||
1271 | if (err < 0) | ||
1272 | return err; | ||
1273 | } | ||
969 | 1274 | ||
970 | if (spec->multiout.dig_out_nid) { | 1275 | if (spec->multiout.dig_out_nid) { |
971 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 1276 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
@@ -977,7 +1282,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
977 | return err; | 1282 | return err; |
978 | spec->multiout.share_spdif = 1; | 1283 | spec->multiout.share_spdif = 1; |
979 | } | 1284 | } |
980 | if (spec->dig_in_nid) { | 1285 | if (spec->dig_in_nid && (!spec->gpio_dir & 0x01)) { |
981 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 1286 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
982 | if (err < 0) | 1287 | if (err < 0) |
983 | return err; | 1288 | return err; |
@@ -1325,40 +1630,65 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1325 | {} /* terminator */ | 1630 | {} /* terminator */ |
1326 | }; | 1631 | }; |
1327 | 1632 | ||
1328 | static unsigned int ref92hd71bxx_pin_configs[10] = { | 1633 | static unsigned int ref92hd83xxx_pin_configs[14] = { |
1634 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, | ||
1635 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, | ||
1636 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, | ||
1637 | 0x01451160, 0x98560170, | ||
1638 | }; | ||
1639 | |||
1640 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | ||
1641 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | ||
1642 | }; | ||
1643 | |||
1644 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | ||
1645 | [STAC_92HD83XXX_REF] = "ref", | ||
1646 | }; | ||
1647 | |||
1648 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | ||
1649 | /* SigmaTel reference board */ | ||
1650 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | ||
1651 | "DFI LanParty", STAC_92HD71BXX_REF), | ||
1652 | }; | ||
1653 | |||
1654 | static unsigned int ref92hd71bxx_pin_configs[11] = { | ||
1329 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, | 1655 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
1330 | 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0, | 1656 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
1331 | 0x90a000f0, 0x01452050, | 1657 | 0x90a000f0, 0x01452050, 0x01452050, |
1332 | }; | 1658 | }; |
1333 | 1659 | ||
1334 | static unsigned int dell_m4_1_pin_configs[10] = { | 1660 | static unsigned int dell_m4_1_pin_configs[11] = { |
1335 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, | 1661 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
1336 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, | 1662 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
1337 | 0x40f000f0, 0x4f0000f0, | 1663 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, |
1338 | }; | 1664 | }; |
1339 | 1665 | ||
1340 | static unsigned int dell_m4_2_pin_configs[10] = { | 1666 | static unsigned int dell_m4_2_pin_configs[11] = { |
1341 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | 1667 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
1342 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, | 1668 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
1343 | 0x40f000f0, 0x044413b0, | 1669 | 0x40f000f0, 0x044413b0, 0x044413b0, |
1344 | }; | 1670 | }; |
1345 | 1671 | ||
1346 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | 1672 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
1347 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, | 1673 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
1348 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, | 1674 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
1349 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, | 1675 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
1676 | [STAC_HP_M4] = NULL, | ||
1350 | }; | 1677 | }; |
1351 | 1678 | ||
1352 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { | 1679 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
1353 | [STAC_92HD71BXX_REF] = "ref", | 1680 | [STAC_92HD71BXX_REF] = "ref", |
1354 | [STAC_DELL_M4_1] = "dell-m4-1", | 1681 | [STAC_DELL_M4_1] = "dell-m4-1", |
1355 | [STAC_DELL_M4_2] = "dell-m4-2", | 1682 | [STAC_DELL_M4_2] = "dell-m4-2", |
1683 | [STAC_HP_M4] = "hp-m4", | ||
1356 | }; | 1684 | }; |
1357 | 1685 | ||
1358 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | 1686 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
1359 | /* SigmaTel reference board */ | 1687 | /* SigmaTel reference board */ |
1360 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1361 | "DFI LanParty", STAC_92HD71BXX_REF), | 1689 | "DFI LanParty", STAC_92HD71BXX_REF), |
1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | ||
1691 | "unknown HP", STAC_HP_M4), | ||
1362 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1692 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
1363 | "unknown Dell", STAC_DELL_M4_1), | 1693 | "unknown Dell", STAC_DELL_M4_1), |
1364 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, | 1694 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
@@ -1477,6 +1807,11 @@ static unsigned int intel_mac_v5_pin_configs[10] = { | |||
1477 | 0x400000fc, 0x400000fb, | 1807 | 0x400000fc, 0x400000fb, |
1478 | }; | 1808 | }; |
1479 | 1809 | ||
1810 | static unsigned int ecs202_pin_configs[10] = { | ||
1811 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, | ||
1812 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, | ||
1813 | 0x9037012e, 0x40e000f2, | ||
1814 | }; | ||
1480 | 1815 | ||
1481 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | 1816 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
1482 | [STAC_D945_REF] = ref922x_pin_configs, | 1817 | [STAC_D945_REF] = ref922x_pin_configs, |
@@ -1495,6 +1830,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | |||
1495 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, | 1830 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
1496 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, | 1831 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
1497 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, | 1832 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
1833 | [STAC_ECS_202] = ecs202_pin_configs, | ||
1498 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, | 1834 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
1499 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, | 1835 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
1500 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, | 1836 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
@@ -1518,6 +1854,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = { | |||
1518 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", | 1854 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
1519 | [STAC_IMAC_INTEL] = "imac-intel", | 1855 | [STAC_IMAC_INTEL] = "imac-intel", |
1520 | [STAC_IMAC_INTEL_20] = "imac-intel-20", | 1856 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
1857 | [STAC_ECS_202] = "ecs202", | ||
1521 | [STAC_922X_DELL_D81] = "dell-d81", | 1858 | [STAC_922X_DELL_D81] = "dell-d81", |
1522 | [STAC_922X_DELL_D82] = "dell-d82", | 1859 | [STAC_922X_DELL_D82] = "dell-d82", |
1523 | [STAC_922X_DELL_M81] = "dell-m81", | 1860 | [STAC_922X_DELL_M81] = "dell-m81", |
@@ -1604,6 +1941,33 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { | |||
1604 | "unknown Dell", STAC_922X_DELL_D81), | 1941 | "unknown Dell", STAC_922X_DELL_D81), |
1605 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, | 1942 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
1606 | "Dell XPS M1210", STAC_922X_DELL_M82), | 1943 | "Dell XPS M1210", STAC_922X_DELL_M82), |
1944 | /* ECS/PC Chips boards */ | ||
1945 | SND_PCI_QUIRK(0x1019, 0x2144, | ||
1946 | "ECS/PC chips", STAC_ECS_202), | ||
1947 | SND_PCI_QUIRK(0x1019, 0x2608, | ||
1948 | "ECS/PC chips", STAC_ECS_202), | ||
1949 | SND_PCI_QUIRK(0x1019, 0x2633, | ||
1950 | "ECS/PC chips P17G/1333", STAC_ECS_202), | ||
1951 | SND_PCI_QUIRK(0x1019, 0x2811, | ||
1952 | "ECS/PC chips", STAC_ECS_202), | ||
1953 | SND_PCI_QUIRK(0x1019, 0x2812, | ||
1954 | "ECS/PC chips", STAC_ECS_202), | ||
1955 | SND_PCI_QUIRK(0x1019, 0x2813, | ||
1956 | "ECS/PC chips", STAC_ECS_202), | ||
1957 | SND_PCI_QUIRK(0x1019, 0x2814, | ||
1958 | "ECS/PC chips", STAC_ECS_202), | ||
1959 | SND_PCI_QUIRK(0x1019, 0x2815, | ||
1960 | "ECS/PC chips", STAC_ECS_202), | ||
1961 | SND_PCI_QUIRK(0x1019, 0x2816, | ||
1962 | "ECS/PC chips", STAC_ECS_202), | ||
1963 | SND_PCI_QUIRK(0x1019, 0x2817, | ||
1964 | "ECS/PC chips", STAC_ECS_202), | ||
1965 | SND_PCI_QUIRK(0x1019, 0x2818, | ||
1966 | "ECS/PC chips", STAC_ECS_202), | ||
1967 | SND_PCI_QUIRK(0x1019, 0x2819, | ||
1968 | "ECS/PC chips", STAC_ECS_202), | ||
1969 | SND_PCI_QUIRK(0x1019, 0x2820, | ||
1970 | "ECS/PC chips", STAC_ECS_202), | ||
1607 | {} /* terminator */ | 1971 | {} /* terminator */ |
1608 | }; | 1972 | }; |
1609 | 1973 | ||
@@ -1867,6 +2231,8 @@ static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
1867 | struct snd_pcm_substream *substream) | 2231 | struct snd_pcm_substream *substream) |
1868 | { | 2232 | { |
1869 | struct sigmatel_spec *spec = codec->spec; | 2233 | struct sigmatel_spec *spec = codec->spec; |
2234 | if (spec->stream_delay) | ||
2235 | msleep(spec->stream_delay); | ||
1870 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | 2236 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
1871 | hinfo); | 2237 | hinfo); |
1872 | } | 2238 | } |
@@ -1930,9 +2296,14 @@ static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1930 | struct snd_pcm_substream *substream) | 2296 | struct snd_pcm_substream *substream) |
1931 | { | 2297 | { |
1932 | struct sigmatel_spec *spec = codec->spec; | 2298 | struct sigmatel_spec *spec = codec->spec; |
2299 | hda_nid_t nid = spec->adc_nids[substream->number]; | ||
1933 | 2300 | ||
1934 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | 2301 | if (spec->powerdown_adcs) { |
1935 | stream_tag, 0, format); | 2302 | msleep(40); |
2303 | snd_hda_codec_write_cache(codec, nid, 0, | ||
2304 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); | ||
2305 | } | ||
2306 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | ||
1936 | return 0; | 2307 | return 0; |
1937 | } | 2308 | } |
1938 | 2309 | ||
@@ -1941,8 +2312,12 @@ static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
1941 | struct snd_pcm_substream *substream) | 2312 | struct snd_pcm_substream *substream) |
1942 | { | 2313 | { |
1943 | struct sigmatel_spec *spec = codec->spec; | 2314 | struct sigmatel_spec *spec = codec->spec; |
2315 | hda_nid_t nid = spec->adc_nids[substream->number]; | ||
1944 | 2316 | ||
1945 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); | 2317 | snd_hda_codec_cleanup_stream(codec, nid); |
2318 | if (spec->powerdown_adcs) | ||
2319 | snd_hda_codec_write_cache(codec, nid, 0, | ||
2320 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
1946 | return 0; | 2321 | return 0; |
1947 | } | 2322 | } |
1948 | 2323 | ||
@@ -2193,6 +2568,8 @@ enum { | |||
2193 | STAC_CTL_WIDGET_VOL, | 2568 | STAC_CTL_WIDGET_VOL, |
2194 | STAC_CTL_WIDGET_MUTE, | 2569 | STAC_CTL_WIDGET_MUTE, |
2195 | STAC_CTL_WIDGET_MONO_MUX, | 2570 | STAC_CTL_WIDGET_MONO_MUX, |
2571 | STAC_CTL_WIDGET_AMP_MUX, | ||
2572 | STAC_CTL_WIDGET_AMP_VOL, | ||
2196 | STAC_CTL_WIDGET_HP_SWITCH, | 2573 | STAC_CTL_WIDGET_HP_SWITCH, |
2197 | STAC_CTL_WIDGET_IO_SWITCH, | 2574 | STAC_CTL_WIDGET_IO_SWITCH, |
2198 | STAC_CTL_WIDGET_CLFE_SWITCH | 2575 | STAC_CTL_WIDGET_CLFE_SWITCH |
@@ -2202,13 +2579,16 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2202 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 2579 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2203 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 2580 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
2204 | STAC_MONO_MUX, | 2581 | STAC_MONO_MUX, |
2582 | STAC_AMP_MUX, | ||
2583 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), | ||
2205 | STAC_CODEC_HP_SWITCH(NULL), | 2584 | STAC_CODEC_HP_SWITCH(NULL), |
2206 | STAC_CODEC_IO_SWITCH(NULL, 0), | 2585 | STAC_CODEC_IO_SWITCH(NULL, 0), |
2207 | STAC_CODEC_CLFE_SWITCH(NULL, 0), | 2586 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
2208 | }; | 2587 | }; |
2209 | 2588 | ||
2210 | /* add dynamic controls */ | 2589 | /* add dynamic controls */ |
2211 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) | 2590 | static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, |
2591 | int idx, const char *name, unsigned long val) | ||
2212 | { | 2592 | { |
2213 | struct snd_kcontrol_new *knew; | 2593 | struct snd_kcontrol_new *knew; |
2214 | 2594 | ||
@@ -2228,6 +2608,7 @@ static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char | |||
2228 | 2608 | ||
2229 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 2609 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
2230 | *knew = stac92xx_control_templates[type]; | 2610 | *knew = stac92xx_control_templates[type]; |
2611 | knew->index = idx; | ||
2231 | knew->name = kstrdup(name, GFP_KERNEL); | 2612 | knew->name = kstrdup(name, GFP_KERNEL); |
2232 | if (! knew->name) | 2613 | if (! knew->name) |
2233 | return -ENOMEM; | 2614 | return -ENOMEM; |
@@ -2236,6 +2617,14 @@ static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char | |||
2236 | return 0; | 2617 | return 0; |
2237 | } | 2618 | } |
2238 | 2619 | ||
2620 | |||
2621 | /* add dynamic controls */ | ||
2622 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, | ||
2623 | const char *name, unsigned long val) | ||
2624 | { | ||
2625 | return stac92xx_add_control_idx(spec, type, 0, name, val); | ||
2626 | } | ||
2627 | |||
2239 | /* flag inputs as additional dynamic lineouts */ | 2628 | /* flag inputs as additional dynamic lineouts */ |
2240 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) | 2629 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
2241 | { | 2630 | { |
@@ -2427,7 +2816,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2427 | static const char *chname[4] = { | 2816 | static const char *chname[4] = { |
2428 | "Front", "Surround", NULL /*CLFE*/, "Side" | 2817 | "Front", "Surround", NULL /*CLFE*/, "Side" |
2429 | }; | 2818 | }; |
2430 | hda_nid_t nid; | 2819 | hda_nid_t nid = 0; |
2431 | int i, err; | 2820 | int i, err; |
2432 | 2821 | ||
2433 | struct sigmatel_spec *spec = codec->spec; | 2822 | struct sigmatel_spec *spec = codec->spec; |
@@ -2467,6 +2856,10 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2467 | } | 2856 | } |
2468 | } | 2857 | } |
2469 | 2858 | ||
2859 | if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && | ||
2860 | cfg->hp_outs && !spec->multiout.hp_nid) | ||
2861 | spec->multiout.hp_nid = nid; | ||
2862 | |||
2470 | if (cfg->hp_outs > 1) { | 2863 | if (cfg->hp_outs > 1) { |
2471 | err = stac92xx_add_control(spec, | 2864 | err = stac92xx_add_control(spec, |
2472 | STAC_CTL_WIDGET_HP_SWITCH, | 2865 | STAC_CTL_WIDGET_HP_SWITCH, |
@@ -2579,8 +2972,8 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, | |||
2579 | } | 2972 | } |
2580 | 2973 | ||
2581 | /* labels for mono mux outputs */ | 2974 | /* labels for mono mux outputs */ |
2582 | static const char *stac92xx_mono_labels[3] = { | 2975 | static const char *stac92xx_mono_labels[4] = { |
2583 | "DAC0", "DAC1", "Mixer" | 2976 | "DAC0", "DAC1", "Mixer", "DAC2" |
2584 | }; | 2977 | }; |
2585 | 2978 | ||
2586 | /* create mono mux for mono out on capable codecs */ | 2979 | /* create mono mux for mono out on capable codecs */ |
@@ -2609,6 +3002,116 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) | |||
2609 | "Mono Mux", spec->mono_nid); | 3002 | "Mono Mux", spec->mono_nid); |
2610 | } | 3003 | } |
2611 | 3004 | ||
3005 | /* labels for amp mux outputs */ | ||
3006 | static const char *stac92xx_amp_labels[3] = { | ||
3007 | "Front Microphone", "Microphone", "Line In", | ||
3008 | }; | ||
3009 | |||
3010 | /* create amp out controls mux on capable codecs */ | ||
3011 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) | ||
3012 | { | ||
3013 | struct sigmatel_spec *spec = codec->spec; | ||
3014 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; | ||
3015 | int i, err; | ||
3016 | |||
3017 | for (i = 0; i < spec->num_amps; i++) { | ||
3018 | amp_mux->items[amp_mux->num_items].label = | ||
3019 | stac92xx_amp_labels[i]; | ||
3020 | amp_mux->items[amp_mux->num_items].index = i; | ||
3021 | amp_mux->num_items++; | ||
3022 | } | ||
3023 | |||
3024 | if (spec->num_amps > 1) { | ||
3025 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, | ||
3026 | "Amp Selector Capture Switch", 0); | ||
3027 | if (err < 0) | ||
3028 | return err; | ||
3029 | } | ||
3030 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, | ||
3031 | "Amp Capture Volume", | ||
3032 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); | ||
3033 | } | ||
3034 | |||
3035 | |||
3036 | /* create PC beep volume controls */ | ||
3037 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | ||
3038 | hda_nid_t nid) | ||
3039 | { | ||
3040 | struct sigmatel_spec *spec = codec->spec; | ||
3041 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3042 | int err; | ||
3043 | |||
3044 | /* check for mute support for the the amp */ | ||
3045 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { | ||
3046 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, | ||
3047 | "PC Beep Playback Switch", | ||
3048 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | ||
3049 | if (err < 0) | ||
3050 | return err; | ||
3051 | } | ||
3052 | |||
3053 | /* check to see if there is volume support for the amp */ | ||
3054 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { | ||
3055 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, | ||
3056 | "PC Beep Playback Volume", | ||
3057 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | ||
3058 | if (err < 0) | ||
3059 | return err; | ||
3060 | } | ||
3061 | return 0; | ||
3062 | } | ||
3063 | |||
3064 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | ||
3065 | { | ||
3066 | struct sigmatel_spec *spec = codec->spec; | ||
3067 | int wcaps, nid, i, err = 0; | ||
3068 | |||
3069 | for (i = 0; i < spec->num_muxes; i++) { | ||
3070 | nid = spec->mux_nids[i]; | ||
3071 | wcaps = get_wcaps(codec, nid); | ||
3072 | |||
3073 | if (wcaps & AC_WCAP_OUT_AMP) { | ||
3074 | err = stac92xx_add_control_idx(spec, | ||
3075 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", | ||
3076 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
3077 | if (err < 0) | ||
3078 | return err; | ||
3079 | } | ||
3080 | } | ||
3081 | return 0; | ||
3082 | }; | ||
3083 | |||
3084 | static const char *stac92xx_spdif_labels[3] = { | ||
3085 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", | ||
3086 | }; | ||
3087 | |||
3088 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) | ||
3089 | { | ||
3090 | struct sigmatel_spec *spec = codec->spec; | ||
3091 | struct hda_input_mux *spdif_mux = &spec->private_smux; | ||
3092 | const char **labels = spec->spdif_labels; | ||
3093 | int i, num_cons; | ||
3094 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | ||
3095 | |||
3096 | num_cons = snd_hda_get_connections(codec, | ||
3097 | spec->smux_nids[0], | ||
3098 | con_lst, | ||
3099 | HDA_MAX_NUM_INPUTS); | ||
3100 | if (!num_cons) | ||
3101 | return -EINVAL; | ||
3102 | |||
3103 | if (!labels) | ||
3104 | labels = stac92xx_spdif_labels; | ||
3105 | |||
3106 | for (i = 0; i < num_cons; i++) { | ||
3107 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; | ||
3108 | spdif_mux->items[spdif_mux->num_items].index = i; | ||
3109 | spdif_mux->num_items++; | ||
3110 | } | ||
3111 | |||
3112 | return 0; | ||
3113 | } | ||
3114 | |||
2612 | /* labels for dmic mux inputs */ | 3115 | /* labels for dmic mux inputs */ |
2613 | static const char *stac92xx_dmic_labels[5] = { | 3116 | static const char *stac92xx_dmic_labels[5] = { |
2614 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", | 3117 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
@@ -2656,16 +3159,19 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
2656 | } | 3159 | } |
2657 | continue; | 3160 | continue; |
2658 | found: | 3161 | found: |
2659 | wcaps = get_wcaps(codec, nid); | 3162 | wcaps = get_wcaps(codec, nid) & |
3163 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | ||
2660 | 3164 | ||
2661 | if (wcaps & AC_WCAP_OUT_AMP) { | 3165 | if (wcaps) { |
2662 | sprintf(name, "%s Capture Volume", | 3166 | sprintf(name, "%s Capture Volume", |
2663 | stac92xx_dmic_labels[dimux->num_items]); | 3167 | stac92xx_dmic_labels[dimux->num_items]); |
2664 | 3168 | ||
2665 | err = stac92xx_add_control(spec, | 3169 | err = stac92xx_add_control(spec, |
2666 | STAC_CTL_WIDGET_VOL, | 3170 | STAC_CTL_WIDGET_VOL, |
2667 | name, | 3171 | name, |
2668 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 3172 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
3173 | (wcaps & AC_WCAP_OUT_AMP) ? | ||
3174 | HDA_OUTPUT : HDA_INPUT)); | ||
2669 | if (err < 0) | 3175 | if (err < 0) |
2670 | return err; | 3176 | return err; |
2671 | } | 3177 | } |
@@ -2789,8 +3295,8 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2789 | hp_speaker_swap = 1; | 3295 | hp_speaker_swap = 1; |
2790 | } | 3296 | } |
2791 | if (spec->autocfg.mono_out_pin) { | 3297 | if (spec->autocfg.mono_out_pin) { |
2792 | int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin) | 3298 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
2793 | & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; | 3299 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
2794 | u32 caps = query_amp_caps(codec, | 3300 | u32 caps = query_amp_caps(codec, |
2795 | spec->autocfg.mono_out_pin, dir); | 3301 | spec->autocfg.mono_out_pin, dir); |
2796 | hda_nid_t conn_list[1]; | 3302 | hda_nid_t conn_list[1]; |
@@ -2812,21 +3318,26 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2812 | !(wcaps & AC_WCAP_LR_SWAP)) | 3318 | !(wcaps & AC_WCAP_LR_SWAP)) |
2813 | spec->mono_nid = conn_list[0]; | 3319 | spec->mono_nid = conn_list[0]; |
2814 | } | 3320 | } |
2815 | /* all mono outs have a least a mute/unmute switch */ | 3321 | if (dir) { |
2816 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, | 3322 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
2817 | "Mono Playback Switch", | 3323 | |
2818 | HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin, | 3324 | /* most mono outs have a least a mute/unmute switch */ |
2819 | 1, 0, dir)); | 3325 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
2820 | if (err < 0) | 3326 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
2821 | return err; | 3327 | "Mono Playback Switch", |
2822 | /* check to see if there is volume support for the amp */ | 3328 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
2823 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { | ||
2824 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, | ||
2825 | "Mono Playback Volume", | ||
2826 | HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin, | ||
2827 | 1, 0, dir)); | ||
2828 | if (err < 0) | 3329 | if (err < 0) |
2829 | return err; | 3330 | return err; |
3331 | /* check for volume support for the amp */ | ||
3332 | if ((caps & AC_AMPCAP_NUM_STEPS) | ||
3333 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { | ||
3334 | err = stac92xx_add_control(spec, | ||
3335 | STAC_CTL_WIDGET_VOL, | ||
3336 | "Mono Playback Volume", | ||
3337 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); | ||
3338 | if (err < 0) | ||
3339 | return err; | ||
3340 | } | ||
2830 | } | 3341 | } |
2831 | 3342 | ||
2832 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, | 3343 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
@@ -2844,6 +3355,28 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2844 | if (err < 0) | 3355 | if (err < 0) |
2845 | return err; | 3356 | return err; |
2846 | 3357 | ||
3358 | /* setup analog beep controls */ | ||
3359 | if (spec->anabeep_nid > 0) { | ||
3360 | err = stac92xx_auto_create_beep_ctls(codec, | ||
3361 | spec->anabeep_nid); | ||
3362 | if (err < 0) | ||
3363 | return err; | ||
3364 | } | ||
3365 | |||
3366 | /* setup digital beep controls and input device */ | ||
3367 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
3368 | if (spec->digbeep_nid > 0) { | ||
3369 | hda_nid_t nid = spec->digbeep_nid; | ||
3370 | |||
3371 | err = stac92xx_auto_create_beep_ctls(codec, nid); | ||
3372 | if (err < 0) | ||
3373 | return err; | ||
3374 | err = snd_hda_attach_beep_device(codec, nid); | ||
3375 | if (err < 0) | ||
3376 | return err; | ||
3377 | } | ||
3378 | #endif | ||
3379 | |||
2847 | if (hp_speaker_swap == 1) { | 3380 | if (hp_speaker_swap == 1) { |
2848 | /* Restore the hp_outs and line_outs */ | 3381 | /* Restore the hp_outs and line_outs */ |
2849 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, | 3382 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
@@ -2872,11 +3405,25 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2872 | if (err < 0) | 3405 | if (err < 0) |
2873 | return err; | 3406 | return err; |
2874 | } | 3407 | } |
2875 | 3408 | if (spec->num_amps > 0) { | |
2876 | if (spec->num_dmics > 0) | 3409 | err = stac92xx_auto_create_amp_output_ctls(codec); |
3410 | if (err < 0) | ||
3411 | return err; | ||
3412 | } | ||
3413 | if (spec->num_dmics > 0 && !spec->dinput_mux) | ||
2877 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, | 3414 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
2878 | &spec->autocfg)) < 0) | 3415 | &spec->autocfg)) < 0) |
2879 | return err; | 3416 | return err; |
3417 | if (spec->num_muxes > 0) { | ||
3418 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3419 | if (err < 0) | ||
3420 | return err; | ||
3421 | } | ||
3422 | if (spec->num_smuxes > 0) { | ||
3423 | err = stac92xx_auto_create_spdif_mux_ctls(codec); | ||
3424 | if (err < 0) | ||
3425 | return err; | ||
3426 | } | ||
2880 | 3427 | ||
2881 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 3428 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2882 | if (spec->multiout.max_channels > 2) | 3429 | if (spec->multiout.max_channels > 2) |
@@ -2884,17 +3431,17 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2884 | 3431 | ||
2885 | if (spec->autocfg.dig_out_pin) | 3432 | if (spec->autocfg.dig_out_pin) |
2886 | spec->multiout.dig_out_nid = dig_out; | 3433 | spec->multiout.dig_out_nid = dig_out; |
2887 | if (spec->autocfg.dig_in_pin) | 3434 | if (dig_in && spec->autocfg.dig_in_pin) |
2888 | spec->dig_in_nid = dig_in; | 3435 | spec->dig_in_nid = dig_in; |
2889 | 3436 | ||
2890 | if (spec->kctl_alloc) | 3437 | if (spec->kctl_alloc) |
2891 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 3438 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
2892 | 3439 | ||
2893 | spec->input_mux = &spec->private_imux; | 3440 | spec->input_mux = &spec->private_imux; |
2894 | if (!spec->dinput_mux) | 3441 | spec->dinput_mux = &spec->private_dimux; |
2895 | spec->dinput_mux = &spec->private_dimux; | 3442 | spec->sinput_mux = &spec->private_smux; |
2896 | spec->mono_mux = &spec->private_mono_mux; | 3443 | spec->mono_mux = &spec->private_mono_mux; |
2897 | 3444 | spec->amp_mux = &spec->private_amp_mux; | |
2898 | return 1; | 3445 | return 1; |
2899 | } | 3446 | } |
2900 | 3447 | ||
@@ -3074,6 +3621,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3074 | 3621 | ||
3075 | snd_hda_sequence_write(codec, spec->init); | 3622 | snd_hda_sequence_write(codec, spec->init); |
3076 | 3623 | ||
3624 | /* power down adcs initially */ | ||
3625 | if (spec->powerdown_adcs) | ||
3626 | for (i = 0; i < spec->num_adcs; i++) | ||
3627 | snd_hda_codec_write_cache(codec, | ||
3628 | spec->adc_nids[i], 0, | ||
3629 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
3077 | /* set up pins */ | 3630 | /* set up pins */ |
3078 | if (spec->hp_detect) { | 3631 | if (spec->hp_detect) { |
3079 | /* Enable unsolicited responses on the HP widget */ | 3632 | /* Enable unsolicited responses on the HP widget */ |
@@ -3095,7 +3648,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3095 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3648 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3096 | hda_nid_t nid = cfg->input_pins[i]; | 3649 | hda_nid_t nid = cfg->input_pins[i]; |
3097 | if (nid) { | 3650 | if (nid) { |
3098 | unsigned int pinctl = AC_PINCTL_IN_EN; | 3651 | unsigned int pinctl = snd_hda_codec_read(codec, nid, |
3652 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
3653 | /* if PINCTL already set then skip */ | ||
3654 | if (pinctl & AC_PINCAP_IN) | ||
3655 | continue; | ||
3656 | pinctl = AC_PINCTL_IN_EN; | ||
3099 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3657 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
3100 | pinctl |= stac92xx_get_vref(codec, nid); | 3658 | pinctl |= stac92xx_get_vref(codec, nid); |
3101 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3659 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
@@ -3158,6 +3716,7 @@ static void stac92xx_free(struct hda_codec *codec) | |||
3158 | kfree(spec->bios_pin_configs); | 3716 | kfree(spec->bios_pin_configs); |
3159 | 3717 | ||
3160 | kfree(spec); | 3718 | kfree(spec); |
3719 | snd_hda_detach_beep_device(codec); | ||
3161 | } | 3720 | } |
3162 | 3721 | ||
3163 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | 3722 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
@@ -3279,7 +3838,12 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | |||
3279 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) | 3838 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) |
3280 | & 0x000000ff; | 3839 | & 0x000000ff; |
3281 | presence = get_hp_pin_presence(codec, nid); | 3840 | presence = get_hp_pin_presence(codec, nid); |
3282 | idx = 1 << idx; | 3841 | |
3842 | /* several codecs have two power down bits */ | ||
3843 | if (spec->pwr_mapping) | ||
3844 | idx = spec->pwr_mapping[idx]; | ||
3845 | else | ||
3846 | idx = 1 << idx; | ||
3283 | 3847 | ||
3284 | if (presence) | 3848 | if (presence) |
3285 | val &= ~idx; | 3849 | val &= ~idx; |
@@ -3295,13 +3859,22 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
3295 | struct sigmatel_spec *spec = codec->spec; | 3859 | struct sigmatel_spec *spec = codec->spec; |
3296 | int idx = res >> 26 & 0x0f; | 3860 | int idx = res >> 26 & 0x0f; |
3297 | 3861 | ||
3298 | switch ((res >> 26) & 0x30) { | 3862 | switch ((res >> 26) & 0x70) { |
3299 | case STAC_HP_EVENT: | 3863 | case STAC_HP_EVENT: |
3300 | stac92xx_hp_detect(codec, res); | 3864 | stac92xx_hp_detect(codec, res); |
3301 | /* fallthru */ | 3865 | /* fallthru */ |
3302 | case STAC_PWR_EVENT: | 3866 | case STAC_PWR_EVENT: |
3303 | if (spec->num_pwrs > 0) | 3867 | if (spec->num_pwrs > 0) |
3304 | stac92xx_pin_sense(codec, idx); | 3868 | stac92xx_pin_sense(codec, idx); |
3869 | break; | ||
3870 | case STAC_VREF_EVENT: { | ||
3871 | int data = snd_hda_codec_read(codec, codec->afg, 0, | ||
3872 | AC_VERB_GET_GPIO_DATA, 0); | ||
3873 | /* toggle VREF state based on GPIOx status */ | ||
3874 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, | ||
3875 | !!(data & (1 << idx))); | ||
3876 | break; | ||
3877 | } | ||
3305 | } | 3878 | } |
3306 | } | 3879 | } |
3307 | 3880 | ||
@@ -3478,9 +4051,9 @@ static struct hda_input_mux stac92hd73xx_dmux = { | |||
3478 | .num_items = 4, | 4051 | .num_items = 4, |
3479 | .items = { | 4052 | .items = { |
3480 | { "Analog Inputs", 0x0b }, | 4053 | { "Analog Inputs", 0x0b }, |
3481 | { "CD", 0x08 }, | ||
3482 | { "Digital Mic 1", 0x09 }, | 4054 | { "Digital Mic 1", 0x09 }, |
3483 | { "Digital Mic 2", 0x0a }, | 4055 | { "Digital Mic 2", 0x0a }, |
4056 | { "CD", 0x08 }, | ||
3484 | } | 4057 | } |
3485 | }; | 4058 | }; |
3486 | 4059 | ||
@@ -3495,6 +4068,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
3495 | return -ENOMEM; | 4068 | return -ENOMEM; |
3496 | 4069 | ||
3497 | codec->spec = spec; | 4070 | codec->spec = spec; |
4071 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; | ||
3498 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); | 4072 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
3499 | spec->pin_nids = stac92hd73xx_pin_nids; | 4073 | spec->pin_nids = stac92hd73xx_pin_nids; |
3500 | spec->board_config = snd_hda_check_board_config(codec, | 4074 | spec->board_config = snd_hda_check_board_config(codec, |
@@ -3527,17 +4101,14 @@ again: | |||
3527 | 4101 | ||
3528 | switch (spec->multiout.num_dacs) { | 4102 | switch (spec->multiout.num_dacs) { |
3529 | case 0x3: /* 6 Channel */ | 4103 | case 0x3: /* 6 Channel */ |
3530 | spec->multiout.hp_nid = 0x17; | ||
3531 | spec->mixer = stac92hd73xx_6ch_mixer; | 4104 | spec->mixer = stac92hd73xx_6ch_mixer; |
3532 | spec->init = stac92hd73xx_6ch_core_init; | 4105 | spec->init = stac92hd73xx_6ch_core_init; |
3533 | break; | 4106 | break; |
3534 | case 0x4: /* 8 Channel */ | 4107 | case 0x4: /* 8 Channel */ |
3535 | spec->multiout.hp_nid = 0x18; | ||
3536 | spec->mixer = stac92hd73xx_8ch_mixer; | 4108 | spec->mixer = stac92hd73xx_8ch_mixer; |
3537 | spec->init = stac92hd73xx_8ch_core_init; | 4109 | spec->init = stac92hd73xx_8ch_core_init; |
3538 | break; | 4110 | break; |
3539 | case 0x5: /* 10 Channel */ | 4111 | case 0x5: /* 10 Channel */ |
3540 | spec->multiout.hp_nid = 0x19; | ||
3541 | spec->mixer = stac92hd73xx_10ch_mixer; | 4112 | spec->mixer = stac92hd73xx_10ch_mixer; |
3542 | spec->init = stac92hd73xx_10ch_core_init; | 4113 | spec->init = stac92hd73xx_10ch_core_init; |
3543 | }; | 4114 | }; |
@@ -3546,27 +4117,34 @@ again: | |||
3546 | spec->aloopback_mask = 0x01; | 4117 | spec->aloopback_mask = 0x01; |
3547 | spec->aloopback_shift = 8; | 4118 | spec->aloopback_shift = 8; |
3548 | 4119 | ||
4120 | spec->digbeep_nid = 0x1c; | ||
3549 | spec->mux_nids = stac92hd73xx_mux_nids; | 4121 | spec->mux_nids = stac92hd73xx_mux_nids; |
3550 | spec->adc_nids = stac92hd73xx_adc_nids; | 4122 | spec->adc_nids = stac92hd73xx_adc_nids; |
3551 | spec->dmic_nids = stac92hd73xx_dmic_nids; | 4123 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
3552 | spec->dmux_nids = stac92hd73xx_dmux_nids; | 4124 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
4125 | spec->smux_nids = stac92hd73xx_smux_nids; | ||
4126 | spec->amp_nids = stac92hd73xx_amp_nids; | ||
4127 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); | ||
3553 | 4128 | ||
3554 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); | 4129 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
3555 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); | 4130 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
3556 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); | 4131 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
3557 | spec->dinput_mux = &stac92hd73xx_dmux; | 4132 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
3558 | /* GPIO0 High = Enable EAPD */ | 4133 | sizeof(stac92hd73xx_dmux)); |
3559 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | ||
3560 | spec->gpio_data = 0x01; | ||
3561 | 4134 | ||
3562 | switch (spec->board_config) { | 4135 | switch (spec->board_config) { |
3563 | case STAC_DELL_M6: | 4136 | case STAC_DELL_M6: |
3564 | spec->init = dell_eq_core_init; | 4137 | spec->init = dell_eq_core_init; |
4138 | spec->num_smuxes = 0; | ||
4139 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | ||
4140 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | ||
4141 | spec->num_amps = 1; | ||
3565 | switch (codec->subsystem_id) { | 4142 | switch (codec->subsystem_id) { |
3566 | case 0x1028025e: /* Analog Mics */ | 4143 | case 0x1028025e: /* Analog Mics */ |
3567 | case 0x1028025f: | 4144 | case 0x1028025f: |
3568 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4145 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
3569 | spec->num_dmics = 0; | 4146 | spec->num_dmics = 0; |
4147 | spec->private_dimux.num_items = 1; | ||
3570 | break; | 4148 | break; |
3571 | case 0x10280271: /* Digital Mics */ | 4149 | case 0x10280271: /* Digital Mics */ |
3572 | case 0x10280272: | 4150 | case 0x10280272: |
@@ -3576,23 +4154,32 @@ again: | |||
3576 | case 0x10280255: | 4154 | case 0x10280255: |
3577 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4155 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
3578 | spec->num_dmics = 1; | 4156 | spec->num_dmics = 1; |
4157 | spec->private_dimux.num_items = 2; | ||
3579 | break; | 4158 | break; |
3580 | case 0x10280256: /* Both */ | 4159 | case 0x10280256: /* Both */ |
3581 | case 0x10280057: | 4160 | case 0x10280057: |
3582 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4161 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
3583 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4162 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
3584 | spec->num_dmics = 1; | 4163 | spec->num_dmics = 1; |
4164 | spec->private_dimux.num_items = 2; | ||
3585 | break; | 4165 | break; |
3586 | } | 4166 | } |
3587 | break; | 4167 | break; |
3588 | default: | 4168 | default: |
3589 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | 4169 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
4170 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | ||
3590 | } | 4171 | } |
4172 | if (spec->board_config > STAC_92HD73XX_REF) { | ||
4173 | /* GPIO0 High = Enable EAPD */ | ||
4174 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | ||
4175 | spec->gpio_data = 0x01; | ||
4176 | } | ||
4177 | spec->dinput_mux = &spec->private_dimux; | ||
3591 | 4178 | ||
3592 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 4179 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
3593 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 4180 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
3594 | 4181 | ||
3595 | err = stac92xx_parse_auto_config(codec, 0x22, 0x24); | 4182 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
3596 | 4183 | ||
3597 | if (!err) { | 4184 | if (!err) { |
3598 | if (spec->board_config < 0) { | 4185 | if (spec->board_config < 0) { |
@@ -3614,6 +4201,146 @@ again: | |||
3614 | return 0; | 4201 | return 0; |
3615 | } | 4202 | } |
3616 | 4203 | ||
4204 | static struct hda_input_mux stac92hd83xxx_dmux = { | ||
4205 | .num_items = 3, | ||
4206 | .items = { | ||
4207 | { "Analog Inputs", 0x03 }, | ||
4208 | { "Digital Mic 1", 0x04 }, | ||
4209 | { "Digital Mic 2", 0x05 }, | ||
4210 | } | ||
4211 | }; | ||
4212 | |||
4213 | static int patch_stac92hd83xxx(struct hda_codec *codec) | ||
4214 | { | ||
4215 | struct sigmatel_spec *spec; | ||
4216 | int err; | ||
4217 | |||
4218 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
4219 | if (spec == NULL) | ||
4220 | return -ENOMEM; | ||
4221 | |||
4222 | codec->spec = spec; | ||
4223 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | ||
4224 | spec->mono_nid = 0x19; | ||
4225 | spec->digbeep_nid = 0x21; | ||
4226 | spec->dmic_nids = stac92hd83xxx_dmic_nids; | ||
4227 | spec->dmux_nids = stac92hd83xxx_dmux_nids; | ||
4228 | spec->adc_nids = stac92hd83xxx_adc_nids; | ||
4229 | spec->pwr_nids = stac92hd83xxx_pwr_nids; | ||
4230 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; | ||
4231 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); | ||
4232 | spec->multiout.dac_nids = stac92hd83xxx_dac_nids; | ||
4233 | |||
4234 | spec->init = stac92hd83xxx_core_init; | ||
4235 | switch (codec->vendor_id) { | ||
4236 | case 0x111d7605: | ||
4237 | spec->multiout.num_dacs = STAC92HD81_DAC_COUNT; | ||
4238 | break; | ||
4239 | default: | ||
4240 | spec->num_pwrs--; | ||
4241 | spec->init++; /* switch to config #2 */ | ||
4242 | spec->multiout.num_dacs = STAC92HD83_DAC_COUNT; | ||
4243 | } | ||
4244 | |||
4245 | spec->mixer = stac92hd83xxx_mixer; | ||
4246 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); | ||
4247 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); | ||
4248 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); | ||
4249 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; | ||
4250 | spec->dinput_mux = &stac92hd83xxx_dmux; | ||
4251 | spec->pin_nids = stac92hd83xxx_pin_nids; | ||
4252 | spec->board_config = snd_hda_check_board_config(codec, | ||
4253 | STAC_92HD83XXX_MODELS, | ||
4254 | stac92hd83xxx_models, | ||
4255 | stac92hd83xxx_cfg_tbl); | ||
4256 | again: | ||
4257 | if (spec->board_config < 0) { | ||
4258 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | ||
4259 | " STAC92HD83XXX, using BIOS defaults\n"); | ||
4260 | err = stac92xx_save_bios_config_regs(codec); | ||
4261 | if (err < 0) { | ||
4262 | stac92xx_free(codec); | ||
4263 | return err; | ||
4264 | } | ||
4265 | spec->pin_configs = spec->bios_pin_configs; | ||
4266 | } else { | ||
4267 | spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config]; | ||
4268 | stac92xx_set_config_regs(codec); | ||
4269 | } | ||
4270 | |||
4271 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); | ||
4272 | if (!err) { | ||
4273 | if (spec->board_config < 0) { | ||
4274 | printk(KERN_WARNING "hda_codec: No auto-config is " | ||
4275 | "available, default to model=ref\n"); | ||
4276 | spec->board_config = STAC_92HD83XXX_REF; | ||
4277 | goto again; | ||
4278 | } | ||
4279 | err = -EINVAL; | ||
4280 | } | ||
4281 | |||
4282 | if (err < 0) { | ||
4283 | stac92xx_free(codec); | ||
4284 | return err; | ||
4285 | } | ||
4286 | |||
4287 | codec->patch_ops = stac92xx_patch_ops; | ||
4288 | |||
4289 | return 0; | ||
4290 | } | ||
4291 | |||
4292 | #ifdef SND_HDA_NEEDS_RESUME | ||
4293 | static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr) | ||
4294 | { | ||
4295 | struct sigmatel_spec *spec = codec->spec; | ||
4296 | int i; | ||
4297 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
4298 | AC_VERB_SET_POWER_STATE, pwr); | ||
4299 | |||
4300 | msleep(1); | ||
4301 | for (i = 0; i < spec->num_adcs; i++) { | ||
4302 | snd_hda_codec_write_cache(codec, | ||
4303 | spec->adc_nids[i], 0, | ||
4304 | AC_VERB_SET_POWER_STATE, pwr); | ||
4305 | } | ||
4306 | }; | ||
4307 | |||
4308 | static int stac92hd71xx_resume(struct hda_codec *codec) | ||
4309 | { | ||
4310 | stac92hd71xx_set_power_state(codec, AC_PWRST_D0); | ||
4311 | return stac92xx_resume(codec); | ||
4312 | } | ||
4313 | |||
4314 | static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) | ||
4315 | { | ||
4316 | stac92hd71xx_set_power_state(codec, AC_PWRST_D3); | ||
4317 | return 0; | ||
4318 | }; | ||
4319 | |||
4320 | #endif | ||
4321 | |||
4322 | static struct hda_codec_ops stac92hd71bxx_patch_ops = { | ||
4323 | .build_controls = stac92xx_build_controls, | ||
4324 | .build_pcms = stac92xx_build_pcms, | ||
4325 | .init = stac92xx_init, | ||
4326 | .free = stac92xx_free, | ||
4327 | .unsol_event = stac92xx_unsol_event, | ||
4328 | #ifdef SND_HDA_NEEDS_RESUME | ||
4329 | .resume = stac92hd71xx_resume, | ||
4330 | .suspend = stac92hd71xx_suspend, | ||
4331 | #endif | ||
4332 | }; | ||
4333 | |||
4334 | static struct hda_input_mux stac92hd71bxx_dmux = { | ||
4335 | .num_items = 4, | ||
4336 | .items = { | ||
4337 | { "Analog Inputs", 0x00 }, | ||
4338 | { "Mixer", 0x01 }, | ||
4339 | { "Digital Mic 1", 0x02 }, | ||
4340 | { "Digital Mic 2", 0x03 }, | ||
4341 | } | ||
4342 | }; | ||
4343 | |||
3617 | static int patch_stac92hd71bxx(struct hda_codec *codec) | 4344 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
3618 | { | 4345 | { |
3619 | struct sigmatel_spec *spec; | 4346 | struct sigmatel_spec *spec; |
@@ -3624,9 +4351,12 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
3624 | return -ENOMEM; | 4351 | return -ENOMEM; |
3625 | 4352 | ||
3626 | codec->spec = spec; | 4353 | codec->spec = spec; |
4354 | codec->patch_ops = stac92xx_patch_ops; | ||
3627 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); | 4355 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); |
3628 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); | 4356 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
3629 | spec->pin_nids = stac92hd71bxx_pin_nids; | 4357 | spec->pin_nids = stac92hd71bxx_pin_nids; |
4358 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, | ||
4359 | sizeof(stac92hd71bxx_dmux)); | ||
3630 | spec->board_config = snd_hda_check_board_config(codec, | 4360 | spec->board_config = snd_hda_check_board_config(codec, |
3631 | STAC_92HD71BXX_MODELS, | 4361 | STAC_92HD71BXX_MODELS, |
3632 | stac92hd71bxx_models, | 4362 | stac92hd71bxx_models, |
@@ -3653,47 +4383,101 @@ again: | |||
3653 | case 0x111d76b5: | 4383 | case 0x111d76b5: |
3654 | spec->mixer = stac92hd71bxx_mixer; | 4384 | spec->mixer = stac92hd71bxx_mixer; |
3655 | spec->init = stac92hd71bxx_core_init; | 4385 | spec->init = stac92hd71bxx_core_init; |
4386 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | ||
3656 | break; | 4387 | break; |
3657 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4388 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4389 | switch (codec->subsystem_id) { | ||
4390 | case 0x103c361a: | ||
4391 | /* Enable VREF power saving on GPIO1 detect */ | ||
4392 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4393 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | ||
4394 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
4395 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
4396 | (AC_USRSP_EN | STAC_VREF_EVENT | 0x01)); | ||
4397 | spec->gpio_mask |= 0x02; | ||
4398 | break; | ||
4399 | } | ||
4400 | if ((codec->revision_id & 0xf) == 0 || | ||
4401 | (codec->revision_id & 0xf) == 1) { | ||
4402 | #ifdef SND_HDA_NEEDS_RESUME | ||
4403 | codec->patch_ops = stac92hd71bxx_patch_ops; | ||
4404 | #endif | ||
4405 | spec->stream_delay = 40; /* 40 milliseconds */ | ||
4406 | } | ||
4407 | |||
3658 | /* no output amps */ | 4408 | /* no output amps */ |
3659 | spec->num_pwrs = 0; | 4409 | spec->num_pwrs = 0; |
3660 | spec->mixer = stac92hd71bxx_analog_mixer; | 4410 | spec->mixer = stac92hd71bxx_analog_mixer; |
4411 | spec->dinput_mux = &spec->private_dimux; | ||
3661 | 4412 | ||
3662 | /* disable VSW */ | 4413 | /* disable VSW */ |
3663 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; | 4414 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
3664 | stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); | 4415 | stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); |
3665 | break; | 4416 | break; |
3666 | case 0x111d7603: /* 6 Port with Analog Mixer */ | 4417 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
4418 | if ((codec->revision_id & 0xf) == 1) { | ||
4419 | #ifdef SND_HDA_NEEDS_RESUME | ||
4420 | codec->patch_ops = stac92hd71bxx_patch_ops; | ||
4421 | #endif | ||
4422 | spec->stream_delay = 40; /* 40 milliseconds */ | ||
4423 | } | ||
4424 | |||
3667 | /* no output amps */ | 4425 | /* no output amps */ |
3668 | spec->num_pwrs = 0; | 4426 | spec->num_pwrs = 0; |
3669 | /* fallthru */ | 4427 | /* fallthru */ |
3670 | default: | 4428 | default: |
4429 | spec->dinput_mux = &spec->private_dimux; | ||
3671 | spec->mixer = stac92hd71bxx_analog_mixer; | 4430 | spec->mixer = stac92hd71bxx_analog_mixer; |
3672 | spec->init = stac92hd71bxx_analog_core_init; | 4431 | spec->init = stac92hd71bxx_analog_core_init; |
4432 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | ||
3673 | } | 4433 | } |
3674 | 4434 | ||
3675 | spec->aloopback_mask = 0x20; | 4435 | spec->aloopback_mask = 0x50; |
3676 | spec->aloopback_shift = 0; | 4436 | spec->aloopback_shift = 0; |
3677 | 4437 | ||
3678 | /* GPIO0 High = EAPD */ | 4438 | if (spec->board_config > STAC_92HD71BXX_REF) { |
3679 | spec->gpio_mask = 0x01; | 4439 | /* GPIO0 = EAPD */ |
3680 | spec->gpio_dir = 0x01; | 4440 | spec->gpio_mask = 0x01; |
3681 | spec->gpio_data = 0x01; | 4441 | spec->gpio_dir = 0x01; |
4442 | spec->gpio_data = 0x01; | ||
4443 | } | ||
3682 | 4444 | ||
4445 | spec->powerdown_adcs = 1; | ||
4446 | spec->digbeep_nid = 0x26; | ||
3683 | spec->mux_nids = stac92hd71bxx_mux_nids; | 4447 | spec->mux_nids = stac92hd71bxx_mux_nids; |
3684 | spec->adc_nids = stac92hd71bxx_adc_nids; | 4448 | spec->adc_nids = stac92hd71bxx_adc_nids; |
3685 | spec->dmic_nids = stac92hd71bxx_dmic_nids; | 4449 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
3686 | spec->dmux_nids = stac92hd71bxx_dmux_nids; | 4450 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
4451 | spec->smux_nids = stac92hd71bxx_smux_nids; | ||
3687 | spec->pwr_nids = stac92hd71bxx_pwr_nids; | 4452 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
3688 | 4453 | ||
3689 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); | 4454 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
3690 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); | 4455 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
3691 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | 4456 | |
3692 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | 4457 | switch (spec->board_config) { |
4458 | case STAC_HP_M4: | ||
4459 | spec->num_dmics = 0; | ||
4460 | spec->num_smuxes = 0; | ||
4461 | spec->num_dmuxes = 0; | ||
4462 | |||
4463 | /* enable internal microphone */ | ||
4464 | stac92xx_set_config_reg(codec, 0x0e, 0x01813040); | ||
4465 | stac92xx_auto_set_pinctl(codec, 0x0e, | ||
4466 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); | ||
4467 | break; | ||
4468 | default: | ||
4469 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | ||
4470 | spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); | ||
4471 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
4472 | }; | ||
3693 | 4473 | ||
3694 | spec->multiout.num_dacs = 1; | 4474 | spec->multiout.num_dacs = 1; |
3695 | spec->multiout.hp_nid = 0x11; | 4475 | spec->multiout.hp_nid = 0x11; |
3696 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; | 4476 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; |
4477 | if (spec->dinput_mux) | ||
4478 | spec->private_dimux.num_items += | ||
4479 | spec->num_dmics - | ||
4480 | (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); | ||
3697 | 4481 | ||
3698 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); | 4482 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); |
3699 | if (!err) { | 4483 | if (!err) { |
@@ -3711,8 +4495,6 @@ again: | |||
3711 | return err; | 4495 | return err; |
3712 | } | 4496 | } |
3713 | 4497 | ||
3714 | codec->patch_ops = stac92xx_patch_ops; | ||
3715 | |||
3716 | return 0; | 4498 | return 0; |
3717 | }; | 4499 | }; |
3718 | 4500 | ||
@@ -3854,10 +4636,14 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3854 | stac92xx_set_config_regs(codec); | 4636 | stac92xx_set_config_regs(codec); |
3855 | } | 4637 | } |
3856 | 4638 | ||
4639 | spec->digbeep_nid = 0x23; | ||
3857 | spec->adc_nids = stac927x_adc_nids; | 4640 | spec->adc_nids = stac927x_adc_nids; |
3858 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); | 4641 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
3859 | spec->mux_nids = stac927x_mux_nids; | 4642 | spec->mux_nids = stac927x_mux_nids; |
3860 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); | 4643 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
4644 | spec->smux_nids = stac927x_smux_nids; | ||
4645 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); | ||
4646 | spec->spdif_labels = stac927x_spdif_labels; | ||
3861 | spec->dac_list = stac927x_dac_nids; | 4647 | spec->dac_list = stac927x_dac_nids; |
3862 | spec->multiout.dac_nids = spec->dac_nids; | 4648 | spec->multiout.dac_nids = spec->dac_nids; |
3863 | 4649 | ||
@@ -3900,9 +4686,11 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3900 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); | 4686 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
3901 | break; | 4687 | break; |
3902 | default: | 4688 | default: |
3903 | /* GPIO0 High = Enable EAPD */ | 4689 | if (spec->board_config > STAC_D965_REF) { |
3904 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 4690 | /* GPIO0 High = Enable EAPD */ |
3905 | spec->gpio_data = 0x01; | 4691 | spec->eapd_mask = spec->gpio_mask = 0x01; |
4692 | spec->gpio_dir = spec->gpio_data = 0x01; | ||
4693 | } | ||
3906 | spec->num_dmics = 0; | 4694 | spec->num_dmics = 0; |
3907 | 4695 | ||
3908 | spec->init = stac927x_core_init; | 4696 | spec->init = stac927x_core_init; |
@@ -3974,10 +4762,13 @@ static int patch_stac9205(struct hda_codec *codec) | |||
3974 | stac92xx_set_config_regs(codec); | 4762 | stac92xx_set_config_regs(codec); |
3975 | } | 4763 | } |
3976 | 4764 | ||
4765 | spec->digbeep_nid = 0x23; | ||
3977 | spec->adc_nids = stac9205_adc_nids; | 4766 | spec->adc_nids = stac9205_adc_nids; |
3978 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); | 4767 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
3979 | spec->mux_nids = stac9205_mux_nids; | 4768 | spec->mux_nids = stac9205_mux_nids; |
3980 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); | 4769 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
4770 | spec->smux_nids = stac9205_smux_nids; | ||
4771 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); | ||
3981 | spec->dmic_nids = stac9205_dmic_nids; | 4772 | spec->dmic_nids = stac9205_dmic_nids; |
3982 | spec->num_dmics = STAC9205_NUM_DMICS; | 4773 | spec->num_dmics = STAC9205_NUM_DMICS; |
3983 | spec->dmux_nids = stac9205_dmux_nids; | 4774 | spec->dmux_nids = stac9205_dmux_nids; |
@@ -4013,6 +4804,9 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4013 | */ | 4804 | */ |
4014 | spec->gpio_data = 0x01; | 4805 | spec->gpio_data = 0x01; |
4015 | break; | 4806 | break; |
4807 | case STAC_9205_REF: | ||
4808 | /* SPDIF-In enabled */ | ||
4809 | break; | ||
4016 | default: | 4810 | default: |
4017 | /* GPIO0 High = EAPD */ | 4811 | /* GPIO0 High = EAPD */ |
4018 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 4812 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
@@ -4332,6 +5126,8 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
4332 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, | 5126 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
4333 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, | 5127 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
4334 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, | 5128 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
5129 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, | ||
5130 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, | ||
4335 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, | 5131 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
4336 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, | 5132 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
4337 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, | 5133 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index e7e43524f8c..63e4871e5d8 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * Universal Interface for Intel High Definition Audio Codec | 2 | * Universal Interface for Intel High Definition Audio Codec |
3 | * | 3 | * |
4 | * HD audio interface patch for VIA VT1708 codec | 4 | * HD audio interface patch for VIA VT1702/VT1708/VT1709 codec |
5 | * | 5 | * |
6 | * Copyright (c) 2006 Lydia Wang <lydiawang@viatech.com> | 6 | * Copyright (c) 2006-2008 Lydia Wang <lydiawang@viatech.com> |
7 | * Takashi Iwai <tiwai@suse.de> | 7 | * Takashi Iwai <tiwai@suse.de> |
8 | * | 8 | * |
9 | * This driver is free software; you can redistribute it and/or modify | 9 | * This driver is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -29,6 +29,13 @@ | |||
29 | /* 2006-09-08 Lydia Wang Fix internal loopback recording source select bug */ | 29 | /* 2006-09-08 Lydia Wang Fix internal loopback recording source select bug */ |
30 | /* 2007-09-12 Lydia Wang Add EAPD enable during driver initialization */ | 30 | /* 2007-09-12 Lydia Wang Add EAPD enable during driver initialization */ |
31 | /* 2007-09-17 Lydia Wang Add VT1708B codec support */ | 31 | /* 2007-09-17 Lydia Wang Add VT1708B codec support */ |
32 | /* 2007-11-14 Lydia Wang Add VT1708A codec HP and CD pin connect config */ | ||
33 | /* 2008-02-03 Lydia Wang Fix Rear channels and Back channels inverse issue */ | ||
34 | /* 2008-03-06 Lydia Wang Add VT1702 codec and VT1708S codec support */ | ||
35 | /* 2008-04-09 Lydia Wang Add mute front speaker when HP plugin */ | ||
36 | /* 2008-04-09 Lydia Wang Add Independent HP feature */ | ||
37 | /* 2008-05-28 Lydia Wang Add second S/PDIF Out support for VT1702 */ | ||
38 | /* 2008-09-15 Logan Li Add VT1708S Mic Boost workaround/backdoor */ | ||
32 | /* */ | 39 | /* */ |
33 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 40 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
34 | 41 | ||
@@ -37,6 +44,7 @@ | |||
37 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
38 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
39 | #include <sound/core.h> | 46 | #include <sound/core.h> |
47 | #include <sound/asoundef.h> | ||
40 | #include "hda_codec.h" | 48 | #include "hda_codec.h" |
41 | #include "hda_local.h" | 49 | #include "hda_local.h" |
42 | #include "hda_patch.h" | 50 | #include "hda_patch.h" |
@@ -53,6 +61,8 @@ | |||
53 | #define VT1708_DIGOUT_NID 0x14 | 61 | #define VT1708_DIGOUT_NID 0x14 |
54 | #define VT1708_DIGIN_NID 0x16 | 62 | #define VT1708_DIGIN_NID 0x16 |
55 | #define VT1708_DIGIN_PIN 0x26 | 63 | #define VT1708_DIGIN_PIN 0x26 |
64 | #define VT1708_HP_PIN_NID 0x20 | ||
65 | #define VT1708_CD_PIN_NID 0x24 | ||
56 | 66 | ||
57 | #define VT1709_HP_DAC_NID 0x28 | 67 | #define VT1709_HP_DAC_NID 0x28 |
58 | #define VT1709_DIGOUT_NID 0x13 | 68 | #define VT1709_DIGOUT_NID 0x13 |
@@ -64,12 +74,64 @@ | |||
64 | #define VT1708B_DIGIN_NID 0x15 | 74 | #define VT1708B_DIGIN_NID 0x15 |
65 | #define VT1708B_DIGIN_PIN 0x21 | 75 | #define VT1708B_DIGIN_PIN 0x21 |
66 | 76 | ||
77 | #define VT1708S_HP_NID 0x25 | ||
78 | #define VT1708S_DIGOUT_NID 0x12 | ||
79 | |||
80 | #define VT1702_HP_NID 0x17 | ||
81 | #define VT1702_DIGOUT_NID 0x11 | ||
82 | |||
67 | #define IS_VT1708_VENDORID(x) ((x) >= 0x11061708 && (x) <= 0x1106170b) | 83 | #define IS_VT1708_VENDORID(x) ((x) >= 0x11061708 && (x) <= 0x1106170b) |
68 | #define IS_VT1709_10CH_VENDORID(x) ((x) >= 0x1106e710 && (x) <= 0x1106e713) | 84 | #define IS_VT1709_10CH_VENDORID(x) ((x) >= 0x1106e710 && (x) <= 0x1106e713) |
69 | #define IS_VT1709_6CH_VENDORID(x) ((x) >= 0x1106e714 && (x) <= 0x1106e717) | 85 | #define IS_VT1709_6CH_VENDORID(x) ((x) >= 0x1106e714 && (x) <= 0x1106e717) |
70 | #define IS_VT1708B_8CH_VENDORID(x) ((x) >= 0x1106e720 && (x) <= 0x1106e723) | 86 | #define IS_VT1708B_8CH_VENDORID(x) ((x) >= 0x1106e720 && (x) <= 0x1106e723) |
71 | #define IS_VT1708B_4CH_VENDORID(x) ((x) >= 0x1106e724 && (x) <= 0x1106e727) | 87 | #define IS_VT1708B_4CH_VENDORID(x) ((x) >= 0x1106e724 && (x) <= 0x1106e727) |
88 | #define IS_VT1708S_VENDORID(x) ((x) >= 0x11060397 && (x) <= 0x11067397) | ||
89 | #define IS_VT1702_VENDORID(x) ((x) >= 0x11060398 && (x) <= 0x11067398) | ||
90 | |||
91 | enum VIA_HDA_CODEC { | ||
92 | UNKNOWN = -1, | ||
93 | VT1708, | ||
94 | VT1709_10CH, | ||
95 | VT1709_6CH, | ||
96 | VT1708B_8CH, | ||
97 | VT1708B_4CH, | ||
98 | VT1708S, | ||
99 | VT1702, | ||
100 | CODEC_TYPES, | ||
101 | }; | ||
102 | |||
103 | static enum VIA_HDA_CODEC get_codec_type(u32 vendor_id) | ||
104 | { | ||
105 | u16 ven_id = vendor_id >> 16; | ||
106 | u16 dev_id = vendor_id & 0xffff; | ||
107 | enum VIA_HDA_CODEC codec_type; | ||
108 | |||
109 | /* get codec type */ | ||
110 | if (ven_id != 0x1106) | ||
111 | codec_type = UNKNOWN; | ||
112 | else if (dev_id >= 0x1708 && dev_id <= 0x170b) | ||
113 | codec_type = VT1708; | ||
114 | else if (dev_id >= 0xe710 && dev_id <= 0xe713) | ||
115 | codec_type = VT1709_10CH; | ||
116 | else if (dev_id >= 0xe714 && dev_id <= 0xe717) | ||
117 | codec_type = VT1709_6CH; | ||
118 | else if (dev_id >= 0xe720 && dev_id <= 0xe723) | ||
119 | codec_type = VT1708B_8CH; | ||
120 | else if (dev_id >= 0xe724 && dev_id <= 0xe727) | ||
121 | codec_type = VT1708B_4CH; | ||
122 | else if ((dev_id & 0xfff) == 0x397 | ||
123 | && (dev_id >> 12) < 8) | ||
124 | codec_type = VT1708S; | ||
125 | else if ((dev_id & 0xfff) == 0x398 | ||
126 | && (dev_id >> 12) < 8) | ||
127 | codec_type = VT1702; | ||
128 | else | ||
129 | codec_type = UNKNOWN; | ||
130 | return codec_type; | ||
131 | }; | ||
72 | 132 | ||
133 | #define VIA_HP_EVENT 0x01 | ||
134 | #define VIA_GPIO_EVENT 0x02 | ||
73 | 135 | ||
74 | enum { | 136 | enum { |
75 | VIA_CTL_WIDGET_VOL, | 137 | VIA_CTL_WIDGET_VOL, |
@@ -77,12 +139,54 @@ enum { | |||
77 | }; | 139 | }; |
78 | 140 | ||
79 | enum { | 141 | enum { |
80 | AUTO_SEQ_FRONT, | 142 | AUTO_SEQ_FRONT = 0, |
81 | AUTO_SEQ_SURROUND, | 143 | AUTO_SEQ_SURROUND, |
82 | AUTO_SEQ_CENLFE, | 144 | AUTO_SEQ_CENLFE, |
83 | AUTO_SEQ_SIDE | 145 | AUTO_SEQ_SIDE |
84 | }; | 146 | }; |
85 | 147 | ||
148 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | ||
149 | |||
150 | /* Some VT1708S based boards gets the micboost setting wrong, so we have | ||
151 | * to apply some brute-force and re-write the TLV's by software. */ | ||
152 | static int mic_boost_tlv(struct snd_kcontrol *kcontrol, int op_flag, | ||
153 | unsigned int size, unsigned int __user *_tlv) | ||
154 | { | ||
155 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
156 | hda_nid_t nid = get_amp_nid(kcontrol); | ||
157 | |||
158 | if (get_codec_type(codec->vendor_id) == VT1708S | ||
159 | && (nid == 0x1a || nid == 0x1e)) { | ||
160 | if (size < 4 * sizeof(unsigned int)) | ||
161 | return -ENOMEM; | ||
162 | if (put_user(1, _tlv)) /* SNDRV_CTL_TLVT_DB_SCALE */ | ||
163 | return -EFAULT; | ||
164 | if (put_user(2 * sizeof(unsigned int), _tlv + 1)) | ||
165 | return -EFAULT; | ||
166 | if (put_user(0, _tlv + 2)) /* offset = 0 */ | ||
167 | return -EFAULT; | ||
168 | if (put_user(1000, _tlv + 3)) /* step size = 10 dB */ | ||
169 | return -EFAULT; | ||
170 | } | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static int mic_boost_volume_info(struct snd_kcontrol *kcontrol, | ||
175 | struct snd_ctl_elem_info *uinfo) | ||
176 | { | ||
177 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
178 | hda_nid_t nid = get_amp_nid(kcontrol); | ||
179 | |||
180 | if (get_codec_type(codec->vendor_id) == VT1708S | ||
181 | && (nid == 0x1a || nid == 0x1e)) { | ||
182 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
183 | uinfo->count = 2; | ||
184 | uinfo->value.integer.min = 0; | ||
185 | uinfo->value.integer.max = 3; | ||
186 | } | ||
187 | return 0; | ||
188 | } | ||
189 | |||
86 | static struct snd_kcontrol_new vt1708_control_templates[] = { | 190 | static struct snd_kcontrol_new vt1708_control_templates[] = { |
87 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 191 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
88 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 192 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
@@ -94,7 +198,8 @@ struct via_spec { | |||
94 | struct snd_kcontrol_new *mixers[3]; | 198 | struct snd_kcontrol_new *mixers[3]; |
95 | unsigned int num_mixers; | 199 | unsigned int num_mixers; |
96 | 200 | ||
97 | struct hda_verb *init_verbs; | 201 | struct hda_verb *init_verbs[5]; |
202 | unsigned int num_iverbs; | ||
98 | 203 | ||
99 | char *stream_name_analog; | 204 | char *stream_name_analog; |
100 | struct hda_pcm_stream *stream_analog_playback; | 205 | struct hda_pcm_stream *stream_analog_playback; |
@@ -106,6 +211,7 @@ struct via_spec { | |||
106 | 211 | ||
107 | /* playback */ | 212 | /* playback */ |
108 | struct hda_multi_out multiout; | 213 | struct hda_multi_out multiout; |
214 | hda_nid_t extra_dig_out_nid; | ||
109 | 215 | ||
110 | /* capture */ | 216 | /* capture */ |
111 | unsigned int num_adc_nids; | 217 | unsigned int num_adc_nids; |
@@ -117,15 +223,19 @@ struct via_spec { | |||
117 | unsigned int cur_mux[3]; | 223 | unsigned int cur_mux[3]; |
118 | 224 | ||
119 | /* PCM information */ | 225 | /* PCM information */ |
120 | struct hda_pcm pcm_rec[2]; | 226 | struct hda_pcm pcm_rec[3]; |
121 | 227 | ||
122 | /* dynamic controls, init_verbs and input_mux */ | 228 | /* dynamic controls, init_verbs and input_mux */ |
123 | struct auto_pin_cfg autocfg; | 229 | struct auto_pin_cfg autocfg; |
124 | unsigned int num_kctl_alloc, num_kctl_used; | 230 | unsigned int num_kctl_alloc, num_kctl_used; |
125 | struct snd_kcontrol_new *kctl_alloc; | 231 | struct snd_kcontrol_new *kctl_alloc; |
126 | struct hda_input_mux private_imux; | 232 | struct hda_input_mux private_imux[2]; |
127 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 233 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
128 | 234 | ||
235 | /* HP mode source */ | ||
236 | const struct hda_input_mux *hp_mux; | ||
237 | unsigned int hp_independent_mode; | ||
238 | |||
129 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 239 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
130 | struct hda_loopback_check loopback; | 240 | struct hda_loopback_check loopback; |
131 | #endif | 241 | #endif |
@@ -146,6 +256,16 @@ static hda_nid_t vt1708B_adc_nids[2] = { | |||
146 | 0x13, 0x14 | 256 | 0x13, 0x14 |
147 | }; | 257 | }; |
148 | 258 | ||
259 | static hda_nid_t vt1708S_adc_nids[2] = { | ||
260 | /* ADC1-2 */ | ||
261 | 0x13, 0x14 | ||
262 | }; | ||
263 | |||
264 | static hda_nid_t vt1702_adc_nids[3] = { | ||
265 | /* ADC1-2 */ | ||
266 | 0x12, 0x20, 0x1F | ||
267 | }; | ||
268 | |||
149 | /* add dynamic controls */ | 269 | /* add dynamic controls */ |
150 | static int via_add_control(struct via_spec *spec, int type, const char *name, | 270 | static int via_add_control(struct via_spec *spec, int type, const char *name, |
151 | unsigned long val) | 271 | unsigned long val) |
@@ -283,19 +403,108 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
283 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 403 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
284 | 0x18, &spec->cur_mux[adc_idx]); | 404 | 0x18, &spec->cur_mux[adc_idx]); |
285 | else if ((IS_VT1709_10CH_VENDORID(vendor_id) || | 405 | else if ((IS_VT1709_10CH_VENDORID(vendor_id) || |
286 | IS_VT1709_6CH_VENDORID(vendor_id)) && adc_idx == 0) | 406 | IS_VT1709_6CH_VENDORID(vendor_id)) && (adc_idx == 0)) |
287 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 407 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
288 | 0x19, &spec->cur_mux[adc_idx]); | 408 | 0x19, &spec->cur_mux[adc_idx]); |
289 | else if ((IS_VT1708B_8CH_VENDORID(vendor_id) || | 409 | else if ((IS_VT1708B_8CH_VENDORID(vendor_id) || |
290 | IS_VT1708B_4CH_VENDORID(vendor_id)) && adc_idx == 0) | 410 | IS_VT1708B_4CH_VENDORID(vendor_id)) && (adc_idx == 0)) |
291 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 411 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
292 | 0x17, &spec->cur_mux[adc_idx]); | 412 | 0x17, &spec->cur_mux[adc_idx]); |
413 | else if (IS_VT1702_VENDORID(vendor_id) && (adc_idx == 0)) | ||
414 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
415 | 0x13, &spec->cur_mux[adc_idx]); | ||
293 | else | 416 | else |
294 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 417 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
295 | spec->adc_nids[adc_idx], | 418 | spec->adc_nids[adc_idx], |
296 | &spec->cur_mux[adc_idx]); | 419 | &spec->cur_mux[adc_idx]); |
297 | } | 420 | } |
298 | 421 | ||
422 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, | ||
423 | struct snd_ctl_elem_info *uinfo) | ||
424 | { | ||
425 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
426 | struct via_spec *spec = codec->spec; | ||
427 | return snd_hda_input_mux_info(spec->hp_mux, uinfo); | ||
428 | } | ||
429 | |||
430 | static int via_independent_hp_get(struct snd_kcontrol *kcontrol, | ||
431 | struct snd_ctl_elem_value *ucontrol) | ||
432 | { | ||
433 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
434 | struct via_spec *spec = codec->spec; | ||
435 | hda_nid_t nid = spec->autocfg.hp_pins[0]; | ||
436 | unsigned int pinsel = snd_hda_codec_read(codec, nid, 0, | ||
437 | AC_VERB_GET_CONNECT_SEL, | ||
438 | 0x00); | ||
439 | |||
440 | ucontrol->value.enumerated.item[0] = pinsel; | ||
441 | |||
442 | return 0; | ||
443 | } | ||
444 | |||
445 | static int via_independent_hp_put(struct snd_kcontrol *kcontrol, | ||
446 | struct snd_ctl_elem_value *ucontrol) | ||
447 | { | ||
448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
449 | struct via_spec *spec = codec->spec; | ||
450 | hda_nid_t nid = spec->autocfg.hp_pins[0]; | ||
451 | unsigned int pinsel = ucontrol->value.enumerated.item[0]; | ||
452 | unsigned int con_nid = snd_hda_codec_read(codec, nid, 0, | ||
453 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; | ||
454 | |||
455 | if (con_nid == spec->multiout.hp_nid) { | ||
456 | if (pinsel == 0) { | ||
457 | if (!spec->hp_independent_mode) { | ||
458 | if (spec->multiout.num_dacs > 1) | ||
459 | spec->multiout.num_dacs -= 1; | ||
460 | spec->hp_independent_mode = 1; | ||
461 | } | ||
462 | } else if (pinsel == 1) { | ||
463 | if (spec->hp_independent_mode) { | ||
464 | if (spec->multiout.num_dacs > 1) | ||
465 | spec->multiout.num_dacs += 1; | ||
466 | spec->hp_independent_mode = 0; | ||
467 | } | ||
468 | } | ||
469 | } else { | ||
470 | if (pinsel == 0) { | ||
471 | if (spec->hp_independent_mode) { | ||
472 | if (spec->multiout.num_dacs > 1) | ||
473 | spec->multiout.num_dacs += 1; | ||
474 | spec->hp_independent_mode = 0; | ||
475 | } | ||
476 | } else if (pinsel == 1) { | ||
477 | if (!spec->hp_independent_mode) { | ||
478 | if (spec->multiout.num_dacs > 1) | ||
479 | spec->multiout.num_dacs -= 1; | ||
480 | spec->hp_independent_mode = 1; | ||
481 | } | ||
482 | } | ||
483 | } | ||
484 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, | ||
485 | pinsel); | ||
486 | |||
487 | if (spec->multiout.hp_nid && | ||
488 | spec->multiout.hp_nid != spec->multiout.dac_nids[HDA_FRONT]) | ||
489 | snd_hda_codec_setup_stream(codec, | ||
490 | spec->multiout.hp_nid, | ||
491 | 0, 0, 0); | ||
492 | |||
493 | return 0; | ||
494 | } | ||
495 | |||
496 | static struct snd_kcontrol_new via_hp_mixer[] = { | ||
497 | { | ||
498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
499 | .name = "Independent HP", | ||
500 | .count = 1, | ||
501 | .info = via_independent_hp_info, | ||
502 | .get = via_independent_hp_get, | ||
503 | .put = via_independent_hp_put, | ||
504 | }, | ||
505 | { } /* end */ | ||
506 | }; | ||
507 | |||
299 | /* capture mixer elements */ | 508 | /* capture mixer elements */ |
300 | static struct snd_kcontrol_new vt1708_capture_mixer[] = { | 509 | static struct snd_kcontrol_new vt1708_capture_mixer[] = { |
301 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_INPUT), | 510 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_INPUT), |
@@ -380,6 +589,138 @@ static int via_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
380 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | 589 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
381 | } | 590 | } |
382 | 591 | ||
592 | |||
593 | static void playback_multi_pcm_prep_0(struct hda_codec *codec, | ||
594 | unsigned int stream_tag, | ||
595 | unsigned int format, | ||
596 | struct snd_pcm_substream *substream) | ||
597 | { | ||
598 | struct via_spec *spec = codec->spec; | ||
599 | struct hda_multi_out *mout = &spec->multiout; | ||
600 | hda_nid_t *nids = mout->dac_nids; | ||
601 | int chs = substream->runtime->channels; | ||
602 | int i; | ||
603 | |||
604 | mutex_lock(&codec->spdif_mutex); | ||
605 | if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { | ||
606 | if (chs == 2 && | ||
607 | snd_hda_is_supported_format(codec, mout->dig_out_nid, | ||
608 | format) && | ||
609 | !(codec->spdif_status & IEC958_AES0_NONAUDIO)) { | ||
610 | mout->dig_out_used = HDA_DIG_ANALOG_DUP; | ||
611 | /* turn off SPDIF once; otherwise the IEC958 bits won't | ||
612 | * be updated */ | ||
613 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | ||
614 | snd_hda_codec_write(codec, mout->dig_out_nid, 0, | ||
615 | AC_VERB_SET_DIGI_CONVERT_1, | ||
616 | codec->spdif_ctls & | ||
617 | ~AC_DIG1_ENABLE & 0xff); | ||
618 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, | ||
619 | stream_tag, 0, format); | ||
620 | /* turn on again (if needed) */ | ||
621 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | ||
622 | snd_hda_codec_write(codec, mout->dig_out_nid, 0, | ||
623 | AC_VERB_SET_DIGI_CONVERT_1, | ||
624 | codec->spdif_ctls & 0xff); | ||
625 | } else { | ||
626 | mout->dig_out_used = 0; | ||
627 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, | ||
628 | 0, 0, 0); | ||
629 | } | ||
630 | } | ||
631 | mutex_unlock(&codec->spdif_mutex); | ||
632 | |||
633 | /* front */ | ||
634 | snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, | ||
635 | 0, format); | ||
636 | |||
637 | if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT] && | ||
638 | !spec->hp_independent_mode) | ||
639 | /* headphone out will just decode front left/right (stereo) */ | ||
640 | snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, | ||
641 | 0, format); | ||
642 | |||
643 | /* extra outputs copied from front */ | ||
644 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) | ||
645 | if (mout->extra_out_nid[i]) | ||
646 | snd_hda_codec_setup_stream(codec, | ||
647 | mout->extra_out_nid[i], | ||
648 | stream_tag, 0, format); | ||
649 | |||
650 | /* surrounds */ | ||
651 | for (i = 1; i < mout->num_dacs; i++) { | ||
652 | if (chs >= (i + 1) * 2) /* independent out */ | ||
653 | snd_hda_codec_setup_stream(codec, nids[i], stream_tag, | ||
654 | i * 2, format); | ||
655 | else /* copy front */ | ||
656 | snd_hda_codec_setup_stream(codec, nids[i], stream_tag, | ||
657 | 0, format); | ||
658 | } | ||
659 | } | ||
660 | |||
661 | static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
662 | struct hda_codec *codec, | ||
663 | unsigned int stream_tag, | ||
664 | unsigned int format, | ||
665 | struct snd_pcm_substream *substream) | ||
666 | { | ||
667 | struct via_spec *spec = codec->spec; | ||
668 | struct hda_multi_out *mout = &spec->multiout; | ||
669 | hda_nid_t *nids = mout->dac_nids; | ||
670 | |||
671 | if (substream->number == 0) | ||
672 | playback_multi_pcm_prep_0(codec, stream_tag, format, | ||
673 | substream); | ||
674 | else { | ||
675 | if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT] && | ||
676 | spec->hp_independent_mode) | ||
677 | snd_hda_codec_setup_stream(codec, mout->hp_nid, | ||
678 | stream_tag, 0, format); | ||
679 | } | ||
680 | |||
681 | return 0; | ||
682 | } | ||
683 | |||
684 | static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
685 | struct hda_codec *codec, | ||
686 | struct snd_pcm_substream *substream) | ||
687 | { | ||
688 | struct via_spec *spec = codec->spec; | ||
689 | struct hda_multi_out *mout = &spec->multiout; | ||
690 | hda_nid_t *nids = mout->dac_nids; | ||
691 | int i; | ||
692 | |||
693 | if (substream->number == 0) { | ||
694 | for (i = 0; i < mout->num_dacs; i++) | ||
695 | snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); | ||
696 | |||
697 | if (mout->hp_nid && !spec->hp_independent_mode) | ||
698 | snd_hda_codec_setup_stream(codec, mout->hp_nid, | ||
699 | 0, 0, 0); | ||
700 | |||
701 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) | ||
702 | if (mout->extra_out_nid[i]) | ||
703 | snd_hda_codec_setup_stream(codec, | ||
704 | mout->extra_out_nid[i], | ||
705 | 0, 0, 0); | ||
706 | mutex_lock(&codec->spdif_mutex); | ||
707 | if (mout->dig_out_nid && | ||
708 | mout->dig_out_used == HDA_DIG_ANALOG_DUP) { | ||
709 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, | ||
710 | 0, 0, 0); | ||
711 | mout->dig_out_used = 0; | ||
712 | } | ||
713 | mutex_unlock(&codec->spdif_mutex); | ||
714 | } else { | ||
715 | if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT] && | ||
716 | spec->hp_independent_mode) | ||
717 | snd_hda_codec_setup_stream(codec, mout->hp_nid, | ||
718 | 0, 0, 0); | ||
719 | } | ||
720 | |||
721 | return 0; | ||
722 | } | ||
723 | |||
383 | /* | 724 | /* |
384 | * Digital out | 725 | * Digital out |
385 | */ | 726 | */ |
@@ -399,6 +740,21 @@ static int via_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | |||
399 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | 740 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
400 | } | 741 | } |
401 | 742 | ||
743 | /* setup SPDIF output stream */ | ||
744 | static void setup_dig_playback_stream(struct hda_codec *codec, hda_nid_t nid, | ||
745 | unsigned int stream_tag, unsigned int format) | ||
746 | { | ||
747 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | ||
748 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | ||
749 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | ||
750 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | ||
751 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | ||
752 | /* turn on again (if needed) */ | ||
753 | if (codec->spdif_ctls & AC_DIG1_ENABLE) | ||
754 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | ||
755 | codec->spdif_ctls & 0xff); | ||
756 | } | ||
757 | |||
402 | static int via_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 758 | static int via_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
403 | struct hda_codec *codec, | 759 | struct hda_codec *codec, |
404 | unsigned int stream_tag, | 760 | unsigned int stream_tag, |
@@ -406,8 +762,20 @@ static int via_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
406 | struct snd_pcm_substream *substream) | 762 | struct snd_pcm_substream *substream) |
407 | { | 763 | { |
408 | struct via_spec *spec = codec->spec; | 764 | struct via_spec *spec = codec->spec; |
409 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | 765 | hda_nid_t nid; |
410 | stream_tag, format, substream); | 766 | |
767 | /* 1st or 2nd S/PDIF */ | ||
768 | if (substream->number == 0) | ||
769 | nid = spec->multiout.dig_out_nid; | ||
770 | else if (substream->number == 1) | ||
771 | nid = spec->extra_dig_out_nid; | ||
772 | else | ||
773 | return -1; | ||
774 | |||
775 | mutex_lock(&codec->spdif_mutex); | ||
776 | setup_dig_playback_stream(codec, nid, stream_tag, format); | ||
777 | mutex_unlock(&codec->spdif_mutex); | ||
778 | return 0; | ||
411 | } | 779 | } |
412 | 780 | ||
413 | /* | 781 | /* |
@@ -436,14 +804,14 @@ static int via_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
436 | } | 804 | } |
437 | 805 | ||
438 | static struct hda_pcm_stream vt1708_pcm_analog_playback = { | 806 | static struct hda_pcm_stream vt1708_pcm_analog_playback = { |
439 | .substreams = 1, | 807 | .substreams = 2, |
440 | .channels_min = 2, | 808 | .channels_min = 2, |
441 | .channels_max = 8, | 809 | .channels_max = 8, |
442 | .nid = 0x10, /* NID to query formats and rates */ | 810 | .nid = 0x10, /* NID to query formats and rates */ |
443 | .ops = { | 811 | .ops = { |
444 | .open = via_playback_pcm_open, | 812 | .open = via_playback_pcm_open, |
445 | .prepare = via_playback_pcm_prepare, | 813 | .prepare = via_playback_multi_pcm_prepare, |
446 | .cleanup = via_playback_pcm_cleanup | 814 | .cleanup = via_playback_multi_pcm_cleanup |
447 | }, | 815 | }, |
448 | }; | 816 | }; |
449 | 817 | ||
@@ -515,6 +883,13 @@ static int via_build_controls(struct hda_codec *codec) | |||
515 | if (err < 0) | 883 | if (err < 0) |
516 | return err; | 884 | return err; |
517 | spec->multiout.share_spdif = 1; | 885 | spec->multiout.share_spdif = 1; |
886 | |||
887 | if (spec->extra_dig_out_nid) { | ||
888 | err = snd_hda_create_spdif_out_ctls(codec, | ||
889 | spec->extra_dig_out_nid); | ||
890 | if (err < 0) | ||
891 | return err; | ||
892 | } | ||
518 | } | 893 | } |
519 | if (spec->dig_in_nid) { | 894 | if (spec->dig_in_nid) { |
520 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 895 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -580,10 +955,89 @@ static void via_free(struct hda_codec *codec) | |||
580 | kfree(codec->spec); | 955 | kfree(codec->spec); |
581 | } | 956 | } |
582 | 957 | ||
958 | /* mute internal speaker if HP is plugged */ | ||
959 | static void via_hp_automute(struct hda_codec *codec) | ||
960 | { | ||
961 | unsigned int present; | ||
962 | struct via_spec *spec = codec->spec; | ||
963 | |||
964 | present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, | ||
965 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
966 | snd_hda_codec_amp_stereo(codec, spec->autocfg.line_out_pins[0], | ||
967 | HDA_OUTPUT, 0, HDA_AMP_MUTE, | ||
968 | present ? HDA_AMP_MUTE : 0); | ||
969 | } | ||
970 | |||
971 | static void via_gpio_control(struct hda_codec *codec) | ||
972 | { | ||
973 | unsigned int gpio_data; | ||
974 | unsigned int vol_counter; | ||
975 | unsigned int vol; | ||
976 | unsigned int master_vol; | ||
977 | |||
978 | struct via_spec *spec = codec->spec; | ||
979 | |||
980 | gpio_data = snd_hda_codec_read(codec, codec->afg, 0, | ||
981 | AC_VERB_GET_GPIO_DATA, 0) & 0x03; | ||
982 | |||
983 | vol_counter = (snd_hda_codec_read(codec, codec->afg, 0, | ||
984 | 0xF84, 0) & 0x3F0000) >> 16; | ||
985 | |||
986 | vol = vol_counter & 0x1F; | ||
987 | master_vol = snd_hda_codec_read(codec, 0x1A, 0, | ||
988 | AC_VERB_GET_AMP_GAIN_MUTE, | ||
989 | AC_AMP_GET_INPUT); | ||
990 | |||
991 | if (gpio_data == 0x02) { | ||
992 | /* unmute line out */ | ||
993 | snd_hda_codec_amp_stereo(codec, spec->autocfg.line_out_pins[0], | ||
994 | HDA_OUTPUT, 0, HDA_AMP_MUTE, 0); | ||
995 | |||
996 | if (vol_counter & 0x20) { | ||
997 | /* decrease volume */ | ||
998 | if (vol > master_vol) | ||
999 | vol = master_vol; | ||
1000 | snd_hda_codec_amp_stereo(codec, 0x1A, HDA_INPUT, | ||
1001 | 0, HDA_AMP_VOLMASK, | ||
1002 | master_vol-vol); | ||
1003 | } else { | ||
1004 | /* increase volume */ | ||
1005 | snd_hda_codec_amp_stereo(codec, 0x1A, HDA_INPUT, 0, | ||
1006 | HDA_AMP_VOLMASK, | ||
1007 | ((master_vol+vol) > 0x2A) ? 0x2A : | ||
1008 | (master_vol+vol)); | ||
1009 | } | ||
1010 | } else if (!(gpio_data & 0x02)) { | ||
1011 | /* mute line out */ | ||
1012 | snd_hda_codec_amp_stereo(codec, | ||
1013 | spec->autocfg.line_out_pins[0], | ||
1014 | HDA_OUTPUT, 0, HDA_AMP_MUTE, | ||
1015 | HDA_AMP_MUTE); | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | /* unsolicited event for jack sensing */ | ||
1020 | static void via_unsol_event(struct hda_codec *codec, | ||
1021 | unsigned int res) | ||
1022 | { | ||
1023 | res >>= 26; | ||
1024 | if (res == VIA_HP_EVENT) | ||
1025 | via_hp_automute(codec); | ||
1026 | else if (res == VIA_GPIO_EVENT) | ||
1027 | via_gpio_control(codec); | ||
1028 | } | ||
1029 | |||
1030 | static hda_nid_t slave_dig_outs[] = { | ||
1031 | 0, | ||
1032 | }; | ||
1033 | |||
583 | static int via_init(struct hda_codec *codec) | 1034 | static int via_init(struct hda_codec *codec) |
584 | { | 1035 | { |
585 | struct via_spec *spec = codec->spec; | 1036 | struct via_spec *spec = codec->spec; |
586 | snd_hda_sequence_write(codec, spec->init_verbs); | 1037 | int i; |
1038 | for (i = 0; i < spec->num_iverbs; i++) | ||
1039 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | ||
1040 | |||
587 | /* Lydia Add for EAPD enable */ | 1041 | /* Lydia Add for EAPD enable */ |
588 | if (!spec->dig_in_nid) { /* No Digital In connection */ | 1042 | if (!spec->dig_in_nid) { /* No Digital In connection */ |
589 | if (IS_VT1708_VENDORID(codec->vendor_id)) { | 1043 | if (IS_VT1708_VENDORID(codec->vendor_id)) { |
@@ -611,6 +1065,9 @@ static int via_init(struct hda_codec *codec) | |||
611 | snd_hda_codec_write(codec, spec->autocfg.dig_in_pin, 0, | 1065 | snd_hda_codec_write(codec, spec->autocfg.dig_in_pin, 0, |
612 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN); | 1066 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN); |
613 | 1067 | ||
1068 | /* no slave outs */ | ||
1069 | codec->slave_dig_outs = slave_dig_outs; | ||
1070 | |||
614 | return 0; | 1071 | return 0; |
615 | } | 1072 | } |
616 | 1073 | ||
@@ -657,10 +1114,10 @@ static int vt1708_auto_fill_dac_nids(struct via_spec *spec, | |||
657 | spec->multiout.dac_nids[i] = 0x12; | 1114 | spec->multiout.dac_nids[i] = 0x12; |
658 | break; | 1115 | break; |
659 | case AUTO_SEQ_SURROUND: | 1116 | case AUTO_SEQ_SURROUND: |
660 | spec->multiout.dac_nids[i] = 0x13; | 1117 | spec->multiout.dac_nids[i] = 0x11; |
661 | break; | 1118 | break; |
662 | case AUTO_SEQ_SIDE: | 1119 | case AUTO_SEQ_SIDE: |
663 | spec->multiout.dac_nids[i] = 0x11; | 1120 | spec->multiout.dac_nids[i] = 0x13; |
664 | break; | 1121 | break; |
665 | } | 1122 | } |
666 | } | 1123 | } |
@@ -685,7 +1142,7 @@ static int vt1708_auto_create_multi_out_ctls(struct via_spec *spec, | |||
685 | continue; | 1142 | continue; |
686 | 1143 | ||
687 | if (i != AUTO_SEQ_FRONT) | 1144 | if (i != AUTO_SEQ_FRONT) |
688 | nid_vol = 0x1b - i + 1; | 1145 | nid_vol = 0x18 + i; |
689 | 1146 | ||
690 | if (i == AUTO_SEQ_CENLFE) { | 1147 | if (i == AUTO_SEQ_CENLFE) { |
691 | /* Center/LFE */ | 1148 | /* Center/LFE */ |
@@ -760,6 +1217,24 @@ static int vt1708_auto_create_multi_out_ctls(struct via_spec *spec, | |||
760 | return 0; | 1217 | return 0; |
761 | } | 1218 | } |
762 | 1219 | ||
1220 | static void create_hp_imux(struct via_spec *spec) | ||
1221 | { | ||
1222 | int i; | ||
1223 | struct hda_input_mux *imux = &spec->private_imux[1]; | ||
1224 | static const char *texts[] = { "OFF", "ON", NULL}; | ||
1225 | |||
1226 | /* for hp mode select */ | ||
1227 | i = 0; | ||
1228 | while (texts[i] != NULL) { | ||
1229 | imux->items[imux->num_items].label = texts[i]; | ||
1230 | imux->items[imux->num_items].index = i; | ||
1231 | imux->num_items++; | ||
1232 | i++; | ||
1233 | } | ||
1234 | |||
1235 | spec->hp_mux = &spec->private_imux[1]; | ||
1236 | } | ||
1237 | |||
763 | static int vt1708_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | 1238 | static int vt1708_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) |
764 | { | 1239 | { |
765 | int err; | 1240 | int err; |
@@ -780,6 +1255,8 @@ static int vt1708_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | |||
780 | if (err < 0) | 1255 | if (err < 0) |
781 | return err; | 1256 | return err; |
782 | 1257 | ||
1258 | create_hp_imux(spec); | ||
1259 | |||
783 | return 0; | 1260 | return 0; |
784 | } | 1261 | } |
785 | 1262 | ||
@@ -790,7 +1267,7 @@ static int vt1708_auto_create_analog_input_ctls(struct via_spec *spec, | |||
790 | static char *labels[] = { | 1267 | static char *labels[] = { |
791 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL | 1268 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL |
792 | }; | 1269 | }; |
793 | struct hda_input_mux *imux = &spec->private_imux; | 1270 | struct hda_input_mux *imux = &spec->private_imux[0]; |
794 | int i, err, idx = 0; | 1271 | int i, err, idx = 0; |
795 | 1272 | ||
796 | /* for internal loopback recording select */ | 1273 | /* for internal loopback recording select */ |
@@ -840,11 +1317,36 @@ static struct hda_amp_list vt1708_loopbacks[] = { | |||
840 | }; | 1317 | }; |
841 | #endif | 1318 | #endif |
842 | 1319 | ||
1320 | static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid) | ||
1321 | { | ||
1322 | unsigned int def_conf; | ||
1323 | unsigned char seqassoc; | ||
1324 | |||
1325 | def_conf = snd_hda_codec_read(codec, nid, 0, | ||
1326 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
1327 | seqassoc = (unsigned char) get_defcfg_association(def_conf); | ||
1328 | seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf); | ||
1329 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) { | ||
1330 | if (seqassoc == 0xff) { | ||
1331 | def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30)); | ||
1332 | snd_hda_codec_write(codec, nid, 0, | ||
1333 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
1334 | def_conf >> 24); | ||
1335 | } | ||
1336 | } | ||
1337 | |||
1338 | return; | ||
1339 | } | ||
1340 | |||
843 | static int vt1708_parse_auto_config(struct hda_codec *codec) | 1341 | static int vt1708_parse_auto_config(struct hda_codec *codec) |
844 | { | 1342 | { |
845 | struct via_spec *spec = codec->spec; | 1343 | struct via_spec *spec = codec->spec; |
846 | int err; | 1344 | int err; |
847 | 1345 | ||
1346 | /* Add HP and CD pin config connect bit re-config action */ | ||
1347 | vt1708_set_pinconfig_connect(codec, VT1708_HP_PIN_NID); | ||
1348 | vt1708_set_pinconfig_connect(codec, VT1708_CD_PIN_NID); | ||
1349 | |||
848 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); | 1350 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); |
849 | if (err < 0) | 1351 | if (err < 0) |
850 | return err; | 1352 | return err; |
@@ -874,9 +1376,12 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
874 | if (spec->kctl_alloc) | 1376 | if (spec->kctl_alloc) |
875 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 1377 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
876 | 1378 | ||
877 | spec->init_verbs = vt1708_volume_init_verbs; | 1379 | spec->init_verbs[spec->num_iverbs++] = vt1708_volume_init_verbs; |
1380 | |||
1381 | spec->input_mux = &spec->private_imux[0]; | ||
878 | 1382 | ||
879 | spec->input_mux = &spec->private_imux; | 1383 | if (spec->hp_mux) |
1384 | spec->mixers[spec->num_mixers++] = via_hp_mixer; | ||
880 | 1385 | ||
881 | return 1; | 1386 | return 1; |
882 | } | 1387 | } |
@@ -897,7 +1402,7 @@ static int patch_vt1708(struct hda_codec *codec) | |||
897 | int err; | 1402 | int err; |
898 | 1403 | ||
899 | /* create a codec specific record */ | 1404 | /* create a codec specific record */ |
900 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 1405 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
901 | if (spec == NULL) | 1406 | if (spec == NULL) |
902 | return -ENOMEM; | 1407 | return -ENOMEM; |
903 | 1408 | ||
@@ -966,6 +1471,11 @@ static struct snd_kcontrol_new vt1709_capture_mixer[] = { | |||
966 | { } /* end */ | 1471 | { } /* end */ |
967 | }; | 1472 | }; |
968 | 1473 | ||
1474 | static struct hda_verb vt1709_uniwill_init_verbs[] = { | ||
1475 | {0x20, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_HP_EVENT}, | ||
1476 | { } | ||
1477 | }; | ||
1478 | |||
969 | /* | 1479 | /* |
970 | * generic initialization of ADC, input mixers and output mixers | 1480 | * generic initialization of ADC, input mixers and output mixers |
971 | */ | 1481 | */ |
@@ -1090,11 +1600,11 @@ static int vt1709_auto_fill_dac_nids(struct via_spec *spec, | |||
1090 | break; | 1600 | break; |
1091 | case AUTO_SEQ_SURROUND: | 1601 | case AUTO_SEQ_SURROUND: |
1092 | /* AOW3 */ | 1602 | /* AOW3 */ |
1093 | spec->multiout.dac_nids[i] = 0x27; | 1603 | spec->multiout.dac_nids[i] = 0x11; |
1094 | break; | 1604 | break; |
1095 | case AUTO_SEQ_SIDE: | 1605 | case AUTO_SEQ_SIDE: |
1096 | /* AOW1 */ | 1606 | /* AOW1 */ |
1097 | spec->multiout.dac_nids[i] = 0x11; | 1607 | spec->multiout.dac_nids[i] = 0x27; |
1098 | break; | 1608 | break; |
1099 | default: | 1609 | default: |
1100 | break; | 1610 | break; |
@@ -1203,26 +1713,26 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec, | |||
1203 | } else if (i == AUTO_SEQ_SURROUND) { | 1713 | } else if (i == AUTO_SEQ_SURROUND) { |
1204 | sprintf(name, "%s Playback Volume", chname[i]); | 1714 | sprintf(name, "%s Playback Volume", chname[i]); |
1205 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, | 1715 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, |
1206 | HDA_COMPOSE_AMP_VAL(0x29, 3, 0, | 1716 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, |
1207 | HDA_OUTPUT)); | 1717 | HDA_OUTPUT)); |
1208 | if (err < 0) | 1718 | if (err < 0) |
1209 | return err; | 1719 | return err; |
1210 | sprintf(name, "%s Playback Switch", chname[i]); | 1720 | sprintf(name, "%s Playback Switch", chname[i]); |
1211 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, | 1721 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, |
1212 | HDA_COMPOSE_AMP_VAL(0x29, 3, 0, | 1722 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, |
1213 | HDA_OUTPUT)); | 1723 | HDA_OUTPUT)); |
1214 | if (err < 0) | 1724 | if (err < 0) |
1215 | return err; | 1725 | return err; |
1216 | } else if (i == AUTO_SEQ_SIDE) { | 1726 | } else if (i == AUTO_SEQ_SIDE) { |
1217 | sprintf(name, "%s Playback Volume", chname[i]); | 1727 | sprintf(name, "%s Playback Volume", chname[i]); |
1218 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, | 1728 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, |
1219 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, | 1729 | HDA_COMPOSE_AMP_VAL(0x29, 3, 0, |
1220 | HDA_OUTPUT)); | 1730 | HDA_OUTPUT)); |
1221 | if (err < 0) | 1731 | if (err < 0) |
1222 | return err; | 1732 | return err; |
1223 | sprintf(name, "%s Playback Switch", chname[i]); | 1733 | sprintf(name, "%s Playback Switch", chname[i]); |
1224 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, | 1734 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, |
1225 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, | 1735 | HDA_COMPOSE_AMP_VAL(0x29, 3, 0, |
1226 | HDA_OUTPUT)); | 1736 | HDA_OUTPUT)); |
1227 | if (err < 0) | 1737 | if (err < 0) |
1228 | return err; | 1738 | return err; |
@@ -1265,7 +1775,7 @@ static int vt1709_auto_create_analog_input_ctls(struct via_spec *spec, | |||
1265 | static char *labels[] = { | 1775 | static char *labels[] = { |
1266 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL | 1776 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL |
1267 | }; | 1777 | }; |
1268 | struct hda_input_mux *imux = &spec->private_imux; | 1778 | struct hda_input_mux *imux = &spec->private_imux[0]; |
1269 | int i, err, idx = 0; | 1779 | int i, err, idx = 0; |
1270 | 1780 | ||
1271 | /* for internal loopback recording select */ | 1781 | /* for internal loopback recording select */ |
@@ -1339,7 +1849,10 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
1339 | if (spec->kctl_alloc) | 1849 | if (spec->kctl_alloc) |
1340 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 1850 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
1341 | 1851 | ||
1342 | spec->input_mux = &spec->private_imux; | 1852 | spec->input_mux = &spec->private_imux[0]; |
1853 | |||
1854 | if (spec->hp_mux) | ||
1855 | spec->mixers[spec->num_mixers++] = via_hp_mixer; | ||
1343 | 1856 | ||
1344 | return 1; | 1857 | return 1; |
1345 | } | 1858 | } |
@@ -1360,7 +1873,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
1360 | int err; | 1873 | int err; |
1361 | 1874 | ||
1362 | /* create a codec specific record */ | 1875 | /* create a codec specific record */ |
1363 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 1876 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1364 | if (spec == NULL) | 1877 | if (spec == NULL) |
1365 | return -ENOMEM; | 1878 | return -ENOMEM; |
1366 | 1879 | ||
@@ -1375,7 +1888,8 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
1375 | "Using genenic mode...\n"); | 1888 | "Using genenic mode...\n"); |
1376 | } | 1889 | } |
1377 | 1890 | ||
1378 | spec->init_verbs = vt1709_10ch_volume_init_verbs; | 1891 | spec->init_verbs[spec->num_iverbs++] = vt1709_10ch_volume_init_verbs; |
1892 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; | ||
1379 | 1893 | ||
1380 | spec->stream_name_analog = "VT1709 Analog"; | 1894 | spec->stream_name_analog = "VT1709 Analog"; |
1381 | spec->stream_analog_playback = &vt1709_10ch_pcm_analog_playback; | 1895 | spec->stream_analog_playback = &vt1709_10ch_pcm_analog_playback; |
@@ -1396,6 +1910,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
1396 | codec->patch_ops = via_patch_ops; | 1910 | codec->patch_ops = via_patch_ops; |
1397 | 1911 | ||
1398 | codec->patch_ops.init = via_auto_init; | 1912 | codec->patch_ops.init = via_auto_init; |
1913 | codec->patch_ops.unsol_event = via_unsol_event; | ||
1399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1914 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1400 | spec->loopback.amplist = vt1709_loopbacks; | 1915 | spec->loopback.amplist = vt1709_loopbacks; |
1401 | #endif | 1916 | #endif |
@@ -1451,7 +1966,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
1451 | int err; | 1966 | int err; |
1452 | 1967 | ||
1453 | /* create a codec specific record */ | 1968 | /* create a codec specific record */ |
1454 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 1969 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1455 | if (spec == NULL) | 1970 | if (spec == NULL) |
1456 | return -ENOMEM; | 1971 | return -ENOMEM; |
1457 | 1972 | ||
@@ -1466,7 +1981,8 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
1466 | "Using genenic mode...\n"); | 1981 | "Using genenic mode...\n"); |
1467 | } | 1982 | } |
1468 | 1983 | ||
1469 | spec->init_verbs = vt1709_6ch_volume_init_verbs; | 1984 | spec->init_verbs[spec->num_iverbs++] = vt1709_6ch_volume_init_verbs; |
1985 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; | ||
1470 | 1986 | ||
1471 | spec->stream_name_analog = "VT1709 Analog"; | 1987 | spec->stream_name_analog = "VT1709 Analog"; |
1472 | spec->stream_analog_playback = &vt1709_6ch_pcm_analog_playback; | 1988 | spec->stream_analog_playback = &vt1709_6ch_pcm_analog_playback; |
@@ -1487,6 +2003,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
1487 | codec->patch_ops = via_patch_ops; | 2003 | codec->patch_ops = via_patch_ops; |
1488 | 2004 | ||
1489 | codec->patch_ops.init = via_auto_init; | 2005 | codec->patch_ops.init = via_auto_init; |
2006 | codec->patch_ops.unsol_event = via_unsol_event; | ||
1490 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2007 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1491 | spec->loopback.amplist = vt1709_loopbacks; | 2008 | spec->loopback.amplist = vt1709_loopbacks; |
1492 | #endif | 2009 | #endif |
@@ -1586,27 +2103,32 @@ static struct hda_verb vt1708B_4ch_volume_init_verbs[] = { | |||
1586 | { } | 2103 | { } |
1587 | }; | 2104 | }; |
1588 | 2105 | ||
2106 | static struct hda_verb vt1708B_uniwill_init_verbs[] = { | ||
2107 | {0x1D, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_HP_EVENT}, | ||
2108 | { } | ||
2109 | }; | ||
2110 | |||
1589 | static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = { | 2111 | static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = { |
1590 | .substreams = 1, | 2112 | .substreams = 2, |
1591 | .channels_min = 2, | 2113 | .channels_min = 2, |
1592 | .channels_max = 8, | 2114 | .channels_max = 8, |
1593 | .nid = 0x10, /* NID to query formats and rates */ | 2115 | .nid = 0x10, /* NID to query formats and rates */ |
1594 | .ops = { | 2116 | .ops = { |
1595 | .open = via_playback_pcm_open, | 2117 | .open = via_playback_pcm_open, |
1596 | .prepare = via_playback_pcm_prepare, | 2118 | .prepare = via_playback_multi_pcm_prepare, |
1597 | .cleanup = via_playback_pcm_cleanup | 2119 | .cleanup = via_playback_multi_pcm_cleanup |
1598 | }, | 2120 | }, |
1599 | }; | 2121 | }; |
1600 | 2122 | ||
1601 | static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = { | 2123 | static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = { |
1602 | .substreams = 1, | 2124 | .substreams = 2, |
1603 | .channels_min = 2, | 2125 | .channels_min = 2, |
1604 | .channels_max = 4, | 2126 | .channels_max = 4, |
1605 | .nid = 0x10, /* NID to query formats and rates */ | 2127 | .nid = 0x10, /* NID to query formats and rates */ |
1606 | .ops = { | 2128 | .ops = { |
1607 | .open = via_playback_pcm_open, | 2129 | .open = via_playback_pcm_open, |
1608 | .prepare = via_playback_pcm_prepare, | 2130 | .prepare = via_playback_multi_pcm_prepare, |
1609 | .cleanup = via_playback_pcm_cleanup | 2131 | .cleanup = via_playback_multi_pcm_cleanup |
1610 | }, | 2132 | }, |
1611 | }; | 2133 | }; |
1612 | 2134 | ||
@@ -1662,10 +2184,10 @@ static int vt1708B_auto_fill_dac_nids(struct via_spec *spec, | |||
1662 | spec->multiout.dac_nids[i] = 0x24; | 2184 | spec->multiout.dac_nids[i] = 0x24; |
1663 | break; | 2185 | break; |
1664 | case AUTO_SEQ_SURROUND: | 2186 | case AUTO_SEQ_SURROUND: |
1665 | spec->multiout.dac_nids[i] = 0x25; | 2187 | spec->multiout.dac_nids[i] = 0x11; |
1666 | break; | 2188 | break; |
1667 | case AUTO_SEQ_SIDE: | 2189 | case AUTO_SEQ_SIDE: |
1668 | spec->multiout.dac_nids[i] = 0x11; | 2190 | spec->multiout.dac_nids[i] = 0x25; |
1669 | break; | 2191 | break; |
1670 | } | 2192 | } |
1671 | } | 2193 | } |
@@ -1680,7 +2202,7 @@ static int vt1708B_auto_create_multi_out_ctls(struct via_spec *spec, | |||
1680 | { | 2202 | { |
1681 | char name[32]; | 2203 | char name[32]; |
1682 | static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; | 2204 | static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; |
1683 | hda_nid_t nid_vols[] = {0x16, 0x27, 0x26, 0x18}; | 2205 | hda_nid_t nid_vols[] = {0x16, 0x18, 0x26, 0x27}; |
1684 | hda_nid_t nid, nid_vol = 0; | 2206 | hda_nid_t nid, nid_vol = 0; |
1685 | int i, err; | 2207 | int i, err; |
1686 | 2208 | ||
@@ -1785,6 +2307,8 @@ static int vt1708B_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | |||
1785 | if (err < 0) | 2307 | if (err < 0) |
1786 | return err; | 2308 | return err; |
1787 | 2309 | ||
2310 | create_hp_imux(spec); | ||
2311 | |||
1788 | return 0; | 2312 | return 0; |
1789 | } | 2313 | } |
1790 | 2314 | ||
@@ -1795,7 +2319,7 @@ static int vt1708B_auto_create_analog_input_ctls(struct via_spec *spec, | |||
1795 | static char *labels[] = { | 2319 | static char *labels[] = { |
1796 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL | 2320 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL |
1797 | }; | 2321 | }; |
1798 | struct hda_input_mux *imux = &spec->private_imux; | 2322 | struct hda_input_mux *imux = &spec->private_imux[0]; |
1799 | int i, err, idx = 0; | 2323 | int i, err, idx = 0; |
1800 | 2324 | ||
1801 | /* for internal loopback recording select */ | 2325 | /* for internal loopback recording select */ |
@@ -1869,7 +2393,10 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
1869 | if (spec->kctl_alloc) | 2393 | if (spec->kctl_alloc) |
1870 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 2394 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
1871 | 2395 | ||
1872 | spec->input_mux = &spec->private_imux; | 2396 | spec->input_mux = &spec->private_imux[0]; |
2397 | |||
2398 | if (spec->hp_mux) | ||
2399 | spec->mixers[spec->num_mixers++] = via_hp_mixer; | ||
1873 | 2400 | ||
1874 | return 1; | 2401 | return 1; |
1875 | } | 2402 | } |
@@ -1890,7 +2417,7 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
1890 | int err; | 2417 | int err; |
1891 | 2418 | ||
1892 | /* create a codec specific record */ | 2419 | /* create a codec specific record */ |
1893 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 2420 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1894 | if (spec == NULL) | 2421 | if (spec == NULL) |
1895 | return -ENOMEM; | 2422 | return -ENOMEM; |
1896 | 2423 | ||
@@ -1906,7 +2433,8 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
1906 | "from BIOS. Using genenic mode...\n"); | 2433 | "from BIOS. Using genenic mode...\n"); |
1907 | } | 2434 | } |
1908 | 2435 | ||
1909 | spec->init_verbs = vt1708B_8ch_volume_init_verbs; | 2436 | spec->init_verbs[spec->num_iverbs++] = vt1708B_8ch_volume_init_verbs; |
2437 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; | ||
1910 | 2438 | ||
1911 | spec->stream_name_analog = "VT1708B Analog"; | 2439 | spec->stream_name_analog = "VT1708B Analog"; |
1912 | spec->stream_analog_playback = &vt1708B_8ch_pcm_analog_playback; | 2440 | spec->stream_analog_playback = &vt1708B_8ch_pcm_analog_playback; |
@@ -1926,6 +2454,7 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
1926 | codec->patch_ops = via_patch_ops; | 2454 | codec->patch_ops = via_patch_ops; |
1927 | 2455 | ||
1928 | codec->patch_ops.init = via_auto_init; | 2456 | codec->patch_ops.init = via_auto_init; |
2457 | codec->patch_ops.unsol_event = via_unsol_event; | ||
1929 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2458 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1930 | spec->loopback.amplist = vt1708B_loopbacks; | 2459 | spec->loopback.amplist = vt1708B_loopbacks; |
1931 | #endif | 2460 | #endif |
@@ -1939,7 +2468,7 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
1939 | int err; | 2468 | int err; |
1940 | 2469 | ||
1941 | /* create a codec specific record */ | 2470 | /* create a codec specific record */ |
1942 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 2471 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1943 | if (spec == NULL) | 2472 | if (spec == NULL) |
1944 | return -ENOMEM; | 2473 | return -ENOMEM; |
1945 | 2474 | ||
@@ -1955,7 +2484,8 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
1955 | "from BIOS. Using genenic mode...\n"); | 2484 | "from BIOS. Using genenic mode...\n"); |
1956 | } | 2485 | } |
1957 | 2486 | ||
1958 | spec->init_verbs = vt1708B_4ch_volume_init_verbs; | 2487 | spec->init_verbs[spec->num_iverbs++] = vt1708B_4ch_volume_init_verbs; |
2488 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; | ||
1959 | 2489 | ||
1960 | spec->stream_name_analog = "VT1708B Analog"; | 2490 | spec->stream_name_analog = "VT1708B Analog"; |
1961 | spec->stream_analog_playback = &vt1708B_4ch_pcm_analog_playback; | 2491 | spec->stream_analog_playback = &vt1708B_4ch_pcm_analog_playback; |
@@ -1975,6 +2505,7 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
1975 | codec->patch_ops = via_patch_ops; | 2505 | codec->patch_ops = via_patch_ops; |
1976 | 2506 | ||
1977 | codec->patch_ops.init = via_auto_init; | 2507 | codec->patch_ops.init = via_auto_init; |
2508 | codec->patch_ops.unsol_event = via_unsol_event; | ||
1978 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2509 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1979 | spec->loopback.amplist = vt1708B_loopbacks; | 2510 | spec->loopback.amplist = vt1708B_loopbacks; |
1980 | #endif | 2511 | #endif |
@@ -1982,6 +2513,752 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
1982 | return 0; | 2513 | return 0; |
1983 | } | 2514 | } |
1984 | 2515 | ||
2516 | /* Patch for VT1708S */ | ||
2517 | |||
2518 | /* VT1708S software backdoor based override for buggy hardware micboost | ||
2519 | * setting */ | ||
2520 | #define MIC_BOOST_VOLUME(xname, nid) { \ | ||
2521 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
2522 | .name = xname, \ | ||
2523 | .index = 0, \ | ||
2524 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
2525 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
2526 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | ||
2527 | .info = mic_boost_volume_info, \ | ||
2528 | .get = snd_hda_mixer_amp_volume_get, \ | ||
2529 | .put = snd_hda_mixer_amp_volume_put, \ | ||
2530 | .tlv = { .c = mic_boost_tlv }, \ | ||
2531 | .private_value = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT) } | ||
2532 | |||
2533 | /* capture mixer elements */ | ||
2534 | static struct snd_kcontrol_new vt1708S_capture_mixer[] = { | ||
2535 | HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT), | ||
2536 | HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT), | ||
2537 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT), | ||
2538 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x14, 0x0, HDA_INPUT), | ||
2539 | MIC_BOOST_VOLUME("Mic Boost Capture Volume", 0x1A), | ||
2540 | MIC_BOOST_VOLUME("Front Mic Boost Capture Volume", 0x1E), | ||
2541 | { | ||
2542 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2543 | /* The multiple "Capture Source" controls confuse alsamixer | ||
2544 | * So call somewhat different.. | ||
2545 | */ | ||
2546 | /* .name = "Capture Source", */ | ||
2547 | .name = "Input Source", | ||
2548 | .count = 1, | ||
2549 | .info = via_mux_enum_info, | ||
2550 | .get = via_mux_enum_get, | ||
2551 | .put = via_mux_enum_put, | ||
2552 | }, | ||
2553 | { } /* end */ | ||
2554 | }; | ||
2555 | |||
2556 | static struct hda_verb vt1708S_volume_init_verbs[] = { | ||
2557 | /* Unmute ADC0-1 and set the default input to mic-in */ | ||
2558 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2559 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2560 | |||
2561 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the | ||
2562 | * analog-loopback mixer widget */ | ||
2563 | /* Amp Indices: CD = 1, Mic1 = 2, Line = 3, Mic2 = 4 */ | ||
2564 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2565 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2566 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
2567 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
2568 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
2569 | |||
2570 | /* Setup default input of PW4 to MW0 */ | ||
2571 | {0x1d, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
2572 | /* PW9, PW10 Output enable */ | ||
2573 | {0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
2574 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
2575 | /* Enable Mic Boost Volume backdoor */ | ||
2576 | {0x1, 0xf98, 0x1}, | ||
2577 | { } | ||
2578 | }; | ||
2579 | |||
2580 | static struct hda_verb vt1708S_uniwill_init_verbs[] = { | ||
2581 | {0x1D, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_HP_EVENT}, | ||
2582 | { } | ||
2583 | }; | ||
2584 | |||
2585 | static struct hda_pcm_stream vt1708S_pcm_analog_playback = { | ||
2586 | .substreams = 2, | ||
2587 | .channels_min = 2, | ||
2588 | .channels_max = 8, | ||
2589 | .nid = 0x10, /* NID to query formats and rates */ | ||
2590 | .ops = { | ||
2591 | .open = via_playback_pcm_open, | ||
2592 | .prepare = via_playback_pcm_prepare, | ||
2593 | .cleanup = via_playback_pcm_cleanup | ||
2594 | }, | ||
2595 | }; | ||
2596 | |||
2597 | static struct hda_pcm_stream vt1708S_pcm_analog_capture = { | ||
2598 | .substreams = 2, | ||
2599 | .channels_min = 2, | ||
2600 | .channels_max = 2, | ||
2601 | .nid = 0x13, /* NID to query formats and rates */ | ||
2602 | .ops = { | ||
2603 | .prepare = via_capture_pcm_prepare, | ||
2604 | .cleanup = via_capture_pcm_cleanup | ||
2605 | }, | ||
2606 | }; | ||
2607 | |||
2608 | static struct hda_pcm_stream vt1708S_pcm_digital_playback = { | ||
2609 | .substreams = 2, | ||
2610 | .channels_min = 2, | ||
2611 | .channels_max = 2, | ||
2612 | /* NID is set in via_build_pcms */ | ||
2613 | .ops = { | ||
2614 | .open = via_dig_playback_pcm_open, | ||
2615 | .close = via_dig_playback_pcm_close, | ||
2616 | .prepare = via_dig_playback_pcm_prepare | ||
2617 | }, | ||
2618 | }; | ||
2619 | |||
2620 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
2621 | static int vt1708S_auto_fill_dac_nids(struct via_spec *spec, | ||
2622 | const struct auto_pin_cfg *cfg) | ||
2623 | { | ||
2624 | int i; | ||
2625 | hda_nid_t nid; | ||
2626 | |||
2627 | spec->multiout.num_dacs = cfg->line_outs; | ||
2628 | |||
2629 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
2630 | |||
2631 | for (i = 0; i < 4; i++) { | ||
2632 | nid = cfg->line_out_pins[i]; | ||
2633 | if (nid) { | ||
2634 | /* config dac list */ | ||
2635 | switch (i) { | ||
2636 | case AUTO_SEQ_FRONT: | ||
2637 | spec->multiout.dac_nids[i] = 0x10; | ||
2638 | break; | ||
2639 | case AUTO_SEQ_CENLFE: | ||
2640 | spec->multiout.dac_nids[i] = 0x24; | ||
2641 | break; | ||
2642 | case AUTO_SEQ_SURROUND: | ||
2643 | spec->multiout.dac_nids[i] = 0x11; | ||
2644 | break; | ||
2645 | case AUTO_SEQ_SIDE: | ||
2646 | spec->multiout.dac_nids[i] = 0x25; | ||
2647 | break; | ||
2648 | } | ||
2649 | } | ||
2650 | } | ||
2651 | |||
2652 | return 0; | ||
2653 | } | ||
2654 | |||
2655 | /* add playback controls from the parsed DAC table */ | ||
2656 | static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec, | ||
2657 | const struct auto_pin_cfg *cfg) | ||
2658 | { | ||
2659 | char name[32]; | ||
2660 | static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; | ||
2661 | hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25}; | ||
2662 | hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27}; | ||
2663 | hda_nid_t nid, nid_vol, nid_mute; | ||
2664 | int i, err; | ||
2665 | |||
2666 | for (i = 0; i <= AUTO_SEQ_SIDE; i++) { | ||
2667 | nid = cfg->line_out_pins[i]; | ||
2668 | |||
2669 | if (!nid) | ||
2670 | continue; | ||
2671 | |||
2672 | nid_vol = nid_vols[i]; | ||
2673 | nid_mute = nid_mutes[i]; | ||
2674 | |||
2675 | if (i == AUTO_SEQ_CENLFE) { | ||
2676 | /* Center/LFE */ | ||
2677 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
2678 | "Center Playback Volume", | ||
2679 | HDA_COMPOSE_AMP_VAL(nid_vol, 1, 0, | ||
2680 | HDA_OUTPUT)); | ||
2681 | if (err < 0) | ||
2682 | return err; | ||
2683 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
2684 | "LFE Playback Volume", | ||
2685 | HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, | ||
2686 | HDA_OUTPUT)); | ||
2687 | if (err < 0) | ||
2688 | return err; | ||
2689 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
2690 | "Center Playback Switch", | ||
2691 | HDA_COMPOSE_AMP_VAL(nid_mute, | ||
2692 | 1, 0, | ||
2693 | HDA_OUTPUT)); | ||
2694 | if (err < 0) | ||
2695 | return err; | ||
2696 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
2697 | "LFE Playback Switch", | ||
2698 | HDA_COMPOSE_AMP_VAL(nid_mute, | ||
2699 | 2, 0, | ||
2700 | HDA_OUTPUT)); | ||
2701 | if (err < 0) | ||
2702 | return err; | ||
2703 | } else if (i == AUTO_SEQ_FRONT) { | ||
2704 | /* add control to mixer index 0 */ | ||
2705 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
2706 | "Master Front Playback Volume", | ||
2707 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, | ||
2708 | HDA_INPUT)); | ||
2709 | if (err < 0) | ||
2710 | return err; | ||
2711 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
2712 | "Master Front Playback Switch", | ||
2713 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, | ||
2714 | HDA_INPUT)); | ||
2715 | if (err < 0) | ||
2716 | return err; | ||
2717 | |||
2718 | /* Front */ | ||
2719 | sprintf(name, "%s Playback Volume", chname[i]); | ||
2720 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, | ||
2721 | HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, | ||
2722 | HDA_OUTPUT)); | ||
2723 | if (err < 0) | ||
2724 | return err; | ||
2725 | sprintf(name, "%s Playback Switch", chname[i]); | ||
2726 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, | ||
2727 | HDA_COMPOSE_AMP_VAL(nid_mute, | ||
2728 | 3, 0, | ||
2729 | HDA_OUTPUT)); | ||
2730 | if (err < 0) | ||
2731 | return err; | ||
2732 | } else { | ||
2733 | sprintf(name, "%s Playback Volume", chname[i]); | ||
2734 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, | ||
2735 | HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, | ||
2736 | HDA_OUTPUT)); | ||
2737 | if (err < 0) | ||
2738 | return err; | ||
2739 | sprintf(name, "%s Playback Switch", chname[i]); | ||
2740 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, | ||
2741 | HDA_COMPOSE_AMP_VAL(nid_mute, | ||
2742 | 3, 0, | ||
2743 | HDA_OUTPUT)); | ||
2744 | if (err < 0) | ||
2745 | return err; | ||
2746 | } | ||
2747 | } | ||
2748 | |||
2749 | return 0; | ||
2750 | } | ||
2751 | |||
2752 | static int vt1708S_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | ||
2753 | { | ||
2754 | int err; | ||
2755 | |||
2756 | if (!pin) | ||
2757 | return 0; | ||
2758 | |||
2759 | spec->multiout.hp_nid = VT1708S_HP_NID; /* AOW3 */ | ||
2760 | |||
2761 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
2762 | "Headphone Playback Volume", | ||
2763 | HDA_COMPOSE_AMP_VAL(0x25, 3, 0, HDA_OUTPUT)); | ||
2764 | if (err < 0) | ||
2765 | return err; | ||
2766 | |||
2767 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
2768 | "Headphone Playback Switch", | ||
2769 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
2770 | if (err < 0) | ||
2771 | return err; | ||
2772 | |||
2773 | create_hp_imux(spec); | ||
2774 | |||
2775 | return 0; | ||
2776 | } | ||
2777 | |||
2778 | /* create playback/capture controls for input pins */ | ||
2779 | static int vt1708S_auto_create_analog_input_ctls(struct via_spec *spec, | ||
2780 | const struct auto_pin_cfg *cfg) | ||
2781 | { | ||
2782 | static char *labels[] = { | ||
2783 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL | ||
2784 | }; | ||
2785 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
2786 | int i, err, idx = 0; | ||
2787 | |||
2788 | /* for internal loopback recording select */ | ||
2789 | imux->items[imux->num_items].label = "Stereo Mixer"; | ||
2790 | imux->items[imux->num_items].index = 5; | ||
2791 | imux->num_items++; | ||
2792 | |||
2793 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
2794 | if (!cfg->input_pins[i]) | ||
2795 | continue; | ||
2796 | |||
2797 | switch (cfg->input_pins[i]) { | ||
2798 | case 0x1a: /* Mic */ | ||
2799 | idx = 2; | ||
2800 | break; | ||
2801 | |||
2802 | case 0x1b: /* Line In */ | ||
2803 | idx = 3; | ||
2804 | break; | ||
2805 | |||
2806 | case 0x1e: /* Front Mic */ | ||
2807 | idx = 4; | ||
2808 | break; | ||
2809 | |||
2810 | case 0x1f: /* CD */ | ||
2811 | idx = 1; | ||
2812 | break; | ||
2813 | } | ||
2814 | err = via_new_analog_input(spec, cfg->input_pins[i], labels[i], | ||
2815 | idx, 0x16); | ||
2816 | if (err < 0) | ||
2817 | return err; | ||
2818 | imux->items[imux->num_items].label = labels[i]; | ||
2819 | imux->items[imux->num_items].index = idx-1; | ||
2820 | imux->num_items++; | ||
2821 | } | ||
2822 | return 0; | ||
2823 | } | ||
2824 | |||
2825 | static int vt1708S_parse_auto_config(struct hda_codec *codec) | ||
2826 | { | ||
2827 | struct via_spec *spec = codec->spec; | ||
2828 | int err; | ||
2829 | static hda_nid_t vt1708s_ignore[] = {0x21, 0}; | ||
2830 | |||
2831 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
2832 | vt1708s_ignore); | ||
2833 | if (err < 0) | ||
2834 | return err; | ||
2835 | err = vt1708S_auto_fill_dac_nids(spec, &spec->autocfg); | ||
2836 | if (err < 0) | ||
2837 | return err; | ||
2838 | if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) | ||
2839 | return 0; /* can't find valid BIOS pin config */ | ||
2840 | |||
2841 | err = vt1708S_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
2842 | if (err < 0) | ||
2843 | return err; | ||
2844 | err = vt1708S_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | ||
2845 | if (err < 0) | ||
2846 | return err; | ||
2847 | err = vt1708S_auto_create_analog_input_ctls(spec, &spec->autocfg); | ||
2848 | if (err < 0) | ||
2849 | return err; | ||
2850 | |||
2851 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
2852 | |||
2853 | if (spec->autocfg.dig_out_pin) | ||
2854 | spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; | ||
2855 | |||
2856 | spec->extra_dig_out_nid = 0x15; | ||
2857 | |||
2858 | if (spec->kctl_alloc) | ||
2859 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | ||
2860 | |||
2861 | spec->input_mux = &spec->private_imux[0]; | ||
2862 | |||
2863 | if (spec->hp_mux) | ||
2864 | spec->mixers[spec->num_mixers++] = via_hp_mixer; | ||
2865 | |||
2866 | return 1; | ||
2867 | } | ||
2868 | |||
2869 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
2870 | static struct hda_amp_list vt1708S_loopbacks[] = { | ||
2871 | { 0x16, HDA_INPUT, 1 }, | ||
2872 | { 0x16, HDA_INPUT, 2 }, | ||
2873 | { 0x16, HDA_INPUT, 3 }, | ||
2874 | { 0x16, HDA_INPUT, 4 }, | ||
2875 | { } /* end */ | ||
2876 | }; | ||
2877 | #endif | ||
2878 | |||
2879 | static int patch_vt1708S(struct hda_codec *codec) | ||
2880 | { | ||
2881 | struct via_spec *spec; | ||
2882 | int err; | ||
2883 | |||
2884 | /* create a codec specific record */ | ||
2885 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
2886 | if (spec == NULL) | ||
2887 | return -ENOMEM; | ||
2888 | |||
2889 | codec->spec = spec; | ||
2890 | |||
2891 | /* automatic parse from the BIOS config */ | ||
2892 | err = vt1708S_parse_auto_config(codec); | ||
2893 | if (err < 0) { | ||
2894 | via_free(codec); | ||
2895 | return err; | ||
2896 | } else if (!err) { | ||
2897 | printk(KERN_INFO "hda_codec: Cannot set up configuration " | ||
2898 | "from BIOS. Using genenic mode...\n"); | ||
2899 | } | ||
2900 | |||
2901 | spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs; | ||
2902 | spec->init_verbs[spec->num_iverbs++] = vt1708S_uniwill_init_verbs; | ||
2903 | |||
2904 | spec->stream_name_analog = "VT1708S Analog"; | ||
2905 | spec->stream_analog_playback = &vt1708S_pcm_analog_playback; | ||
2906 | spec->stream_analog_capture = &vt1708S_pcm_analog_capture; | ||
2907 | |||
2908 | spec->stream_name_digital = "VT1708S Digital"; | ||
2909 | spec->stream_digital_playback = &vt1708S_pcm_digital_playback; | ||
2910 | |||
2911 | if (!spec->adc_nids && spec->input_mux) { | ||
2912 | spec->adc_nids = vt1708S_adc_nids; | ||
2913 | spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); | ||
2914 | spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; | ||
2915 | spec->num_mixers++; | ||
2916 | } | ||
2917 | |||
2918 | codec->patch_ops = via_patch_ops; | ||
2919 | |||
2920 | codec->patch_ops.init = via_auto_init; | ||
2921 | codec->patch_ops.unsol_event = via_unsol_event; | ||
2922 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
2923 | spec->loopback.amplist = vt1708S_loopbacks; | ||
2924 | #endif | ||
2925 | |||
2926 | return 0; | ||
2927 | } | ||
2928 | |||
2929 | /* Patch for VT1702 */ | ||
2930 | |||
2931 | /* capture mixer elements */ | ||
2932 | static struct snd_kcontrol_new vt1702_capture_mixer[] = { | ||
2933 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_INPUT), | ||
2934 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_INPUT), | ||
2935 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x20, 0x0, HDA_INPUT), | ||
2936 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x20, 0x0, HDA_INPUT), | ||
2937 | HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x1F, 0x0, HDA_INPUT), | ||
2938 | HDA_CODEC_MUTE("Digital Mic Capture Switch", 0x1F, 0x0, HDA_INPUT), | ||
2939 | HDA_CODEC_VOLUME("Digital Mic Boost Capture Volume", 0x1E, 0x0, | ||
2940 | HDA_INPUT), | ||
2941 | { | ||
2942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2943 | /* The multiple "Capture Source" controls confuse alsamixer | ||
2944 | * So call somewhat different.. | ||
2945 | */ | ||
2946 | /* .name = "Capture Source", */ | ||
2947 | .name = "Input Source", | ||
2948 | .count = 1, | ||
2949 | .info = via_mux_enum_info, | ||
2950 | .get = via_mux_enum_get, | ||
2951 | .put = via_mux_enum_put, | ||
2952 | }, | ||
2953 | { } /* end */ | ||
2954 | }; | ||
2955 | |||
2956 | static struct hda_verb vt1702_volume_init_verbs[] = { | ||
2957 | /* | ||
2958 | * Unmute ADC0-1 and set the default input to mic-in | ||
2959 | */ | ||
2960 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2961 | {0x1F, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2962 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2963 | |||
2964 | |||
2965 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
2966 | * mixer widget | ||
2967 | */ | ||
2968 | /* Amp Indices: Mic1 = 1, Line = 1, Mic2 = 3 */ | ||
2969 | {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2970 | {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
2971 | {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
2972 | {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
2973 | {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
2974 | |||
2975 | /* Setup default input of PW4 to MW0 */ | ||
2976 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x1}, | ||
2977 | /* PW6 PW7 Output enable */ | ||
2978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
2979 | {0x1C, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
2980 | { } | ||
2981 | }; | ||
2982 | |||
2983 | static struct hda_verb vt1702_uniwill_init_verbs[] = { | ||
2984 | {0x01, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_GPIO_EVENT}, | ||
2985 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_HP_EVENT}, | ||
2986 | { } | ||
2987 | }; | ||
2988 | |||
2989 | static struct hda_pcm_stream vt1702_pcm_analog_playback = { | ||
2990 | .substreams = 2, | ||
2991 | .channels_min = 2, | ||
2992 | .channels_max = 2, | ||
2993 | .nid = 0x10, /* NID to query formats and rates */ | ||
2994 | .ops = { | ||
2995 | .open = via_playback_pcm_open, | ||
2996 | .prepare = via_playback_multi_pcm_prepare, | ||
2997 | .cleanup = via_playback_multi_pcm_cleanup | ||
2998 | }, | ||
2999 | }; | ||
3000 | |||
3001 | static struct hda_pcm_stream vt1702_pcm_analog_capture = { | ||
3002 | .substreams = 3, | ||
3003 | .channels_min = 2, | ||
3004 | .channels_max = 2, | ||
3005 | .nid = 0x12, /* NID to query formats and rates */ | ||
3006 | .ops = { | ||
3007 | .prepare = via_capture_pcm_prepare, | ||
3008 | .cleanup = via_capture_pcm_cleanup | ||
3009 | }, | ||
3010 | }; | ||
3011 | |||
3012 | static struct hda_pcm_stream vt1702_pcm_digital_playback = { | ||
3013 | .substreams = 2, | ||
3014 | .channels_min = 2, | ||
3015 | .channels_max = 2, | ||
3016 | /* NID is set in via_build_pcms */ | ||
3017 | .ops = { | ||
3018 | .open = via_dig_playback_pcm_open, | ||
3019 | .close = via_dig_playback_pcm_close, | ||
3020 | .prepare = via_dig_playback_pcm_prepare | ||
3021 | }, | ||
3022 | }; | ||
3023 | |||
3024 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
3025 | static int vt1702_auto_fill_dac_nids(struct via_spec *spec, | ||
3026 | const struct auto_pin_cfg *cfg) | ||
3027 | { | ||
3028 | spec->multiout.num_dacs = 1; | ||
3029 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
3030 | |||
3031 | if (cfg->line_out_pins[0]) { | ||
3032 | /* config dac list */ | ||
3033 | spec->multiout.dac_nids[0] = 0x10; | ||
3034 | } | ||
3035 | |||
3036 | return 0; | ||
3037 | } | ||
3038 | |||
3039 | /* add playback controls from the parsed DAC table */ | ||
3040 | static int vt1702_auto_create_line_out_ctls(struct via_spec *spec, | ||
3041 | const struct auto_pin_cfg *cfg) | ||
3042 | { | ||
3043 | int err; | ||
3044 | |||
3045 | if (!cfg->line_out_pins[0]) | ||
3046 | return -1; | ||
3047 | |||
3048 | /* add control to mixer index 0 */ | ||
3049 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
3050 | "Master Front Playback Volume", | ||
3051 | HDA_COMPOSE_AMP_VAL(0x1A, 3, 0, HDA_INPUT)); | ||
3052 | if (err < 0) | ||
3053 | return err; | ||
3054 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
3055 | "Master Front Playback Switch", | ||
3056 | HDA_COMPOSE_AMP_VAL(0x1A, 3, 0, HDA_INPUT)); | ||
3057 | if (err < 0) | ||
3058 | return err; | ||
3059 | |||
3060 | /* Front */ | ||
3061 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
3062 | "Front Playback Volume", | ||
3063 | HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT)); | ||
3064 | if (err < 0) | ||
3065 | return err; | ||
3066 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
3067 | "Front Playback Switch", | ||
3068 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT)); | ||
3069 | if (err < 0) | ||
3070 | return err; | ||
3071 | |||
3072 | return 0; | ||
3073 | } | ||
3074 | |||
3075 | static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) | ||
3076 | { | ||
3077 | int err; | ||
3078 | |||
3079 | if (!pin) | ||
3080 | return 0; | ||
3081 | |||
3082 | spec->multiout.hp_nid = 0x1D; | ||
3083 | |||
3084 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | ||
3085 | "Headphone Playback Volume", | ||
3086 | HDA_COMPOSE_AMP_VAL(0x1D, 3, 0, HDA_OUTPUT)); | ||
3087 | if (err < 0) | ||
3088 | return err; | ||
3089 | |||
3090 | err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, | ||
3091 | "Headphone Playback Switch", | ||
3092 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
3093 | if (err < 0) | ||
3094 | return err; | ||
3095 | |||
3096 | create_hp_imux(spec); | ||
3097 | |||
3098 | return 0; | ||
3099 | } | ||
3100 | |||
3101 | /* create playback/capture controls for input pins */ | ||
3102 | static int vt1702_auto_create_analog_input_ctls(struct via_spec *spec, | ||
3103 | const struct auto_pin_cfg *cfg) | ||
3104 | { | ||
3105 | static char *labels[] = { | ||
3106 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux", NULL | ||
3107 | }; | ||
3108 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
3109 | int i, err, idx = 0; | ||
3110 | |||
3111 | /* for internal loopback recording select */ | ||
3112 | imux->items[imux->num_items].label = "Stereo Mixer"; | ||
3113 | imux->items[imux->num_items].index = 3; | ||
3114 | imux->num_items++; | ||
3115 | |||
3116 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
3117 | if (!cfg->input_pins[i]) | ||
3118 | continue; | ||
3119 | |||
3120 | switch (cfg->input_pins[i]) { | ||
3121 | case 0x14: /* Mic */ | ||
3122 | idx = 1; | ||
3123 | break; | ||
3124 | |||
3125 | case 0x15: /* Line In */ | ||
3126 | idx = 2; | ||
3127 | break; | ||
3128 | |||
3129 | case 0x18: /* Front Mic */ | ||
3130 | idx = 3; | ||
3131 | break; | ||
3132 | } | ||
3133 | err = via_new_analog_input(spec, cfg->input_pins[i], | ||
3134 | labels[i], idx, 0x1A); | ||
3135 | if (err < 0) | ||
3136 | return err; | ||
3137 | imux->items[imux->num_items].label = labels[i]; | ||
3138 | imux->items[imux->num_items].index = idx-1; | ||
3139 | imux->num_items++; | ||
3140 | } | ||
3141 | return 0; | ||
3142 | } | ||
3143 | |||
3144 | static int vt1702_parse_auto_config(struct hda_codec *codec) | ||
3145 | { | ||
3146 | struct via_spec *spec = codec->spec; | ||
3147 | int err; | ||
3148 | static hda_nid_t vt1702_ignore[] = {0x1C, 0}; | ||
3149 | |||
3150 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
3151 | vt1702_ignore); | ||
3152 | if (err < 0) | ||
3153 | return err; | ||
3154 | err = vt1702_auto_fill_dac_nids(spec, &spec->autocfg); | ||
3155 | if (err < 0) | ||
3156 | return err; | ||
3157 | if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) | ||
3158 | return 0; /* can't find valid BIOS pin config */ | ||
3159 | |||
3160 | err = vt1702_auto_create_line_out_ctls(spec, &spec->autocfg); | ||
3161 | if (err < 0) | ||
3162 | return err; | ||
3163 | err = vt1702_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | ||
3164 | if (err < 0) | ||
3165 | return err; | ||
3166 | err = vt1702_auto_create_analog_input_ctls(spec, &spec->autocfg); | ||
3167 | if (err < 0) | ||
3168 | return err; | ||
3169 | |||
3170 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
3171 | |||
3172 | if (spec->autocfg.dig_out_pin) | ||
3173 | spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; | ||
3174 | |||
3175 | spec->extra_dig_out_nid = 0x1B; | ||
3176 | |||
3177 | if (spec->kctl_alloc) | ||
3178 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | ||
3179 | |||
3180 | spec->input_mux = &spec->private_imux[0]; | ||
3181 | |||
3182 | if (spec->hp_mux) | ||
3183 | spec->mixers[spec->num_mixers++] = via_hp_mixer; | ||
3184 | |||
3185 | return 1; | ||
3186 | } | ||
3187 | |||
3188 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3189 | static struct hda_amp_list vt1702_loopbacks[] = { | ||
3190 | { 0x1A, HDA_INPUT, 1 }, | ||
3191 | { 0x1A, HDA_INPUT, 2 }, | ||
3192 | { 0x1A, HDA_INPUT, 3 }, | ||
3193 | { 0x1A, HDA_INPUT, 4 }, | ||
3194 | { } /* end */ | ||
3195 | }; | ||
3196 | #endif | ||
3197 | |||
3198 | static int patch_vt1702(struct hda_codec *codec) | ||
3199 | { | ||
3200 | struct via_spec *spec; | ||
3201 | int err; | ||
3202 | unsigned int response; | ||
3203 | unsigned char control; | ||
3204 | |||
3205 | /* create a codec specific record */ | ||
3206 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
3207 | if (spec == NULL) | ||
3208 | return -ENOMEM; | ||
3209 | |||
3210 | codec->spec = spec; | ||
3211 | |||
3212 | /* automatic parse from the BIOS config */ | ||
3213 | err = vt1702_parse_auto_config(codec); | ||
3214 | if (err < 0) { | ||
3215 | via_free(codec); | ||
3216 | return err; | ||
3217 | } else if (!err) { | ||
3218 | printk(KERN_INFO "hda_codec: Cannot set up configuration " | ||
3219 | "from BIOS. Using genenic mode...\n"); | ||
3220 | } | ||
3221 | |||
3222 | spec->init_verbs[spec->num_iverbs++] = vt1702_volume_init_verbs; | ||
3223 | spec->init_verbs[spec->num_iverbs++] = vt1702_uniwill_init_verbs; | ||
3224 | |||
3225 | spec->stream_name_analog = "VT1702 Analog"; | ||
3226 | spec->stream_analog_playback = &vt1702_pcm_analog_playback; | ||
3227 | spec->stream_analog_capture = &vt1702_pcm_analog_capture; | ||
3228 | |||
3229 | spec->stream_name_digital = "VT1702 Digital"; | ||
3230 | spec->stream_digital_playback = &vt1702_pcm_digital_playback; | ||
3231 | |||
3232 | if (!spec->adc_nids && spec->input_mux) { | ||
3233 | spec->adc_nids = vt1702_adc_nids; | ||
3234 | spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); | ||
3235 | spec->mixers[spec->num_mixers] = vt1702_capture_mixer; | ||
3236 | spec->num_mixers++; | ||
3237 | } | ||
3238 | |||
3239 | codec->patch_ops = via_patch_ops; | ||
3240 | |||
3241 | codec->patch_ops.init = via_auto_init; | ||
3242 | codec->patch_ops.unsol_event = via_unsol_event; | ||
3243 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3244 | spec->loopback.amplist = vt1702_loopbacks; | ||
3245 | #endif | ||
3246 | |||
3247 | /* Open backdoor */ | ||
3248 | response = snd_hda_codec_read(codec, codec->afg, 0, 0xF8C, 0); | ||
3249 | control = (unsigned char)(response & 0xff); | ||
3250 | control |= 0x3; | ||
3251 | snd_hda_codec_write(codec, codec->afg, 0, 0xF88, control); | ||
3252 | |||
3253 | /* Enable GPIO 0&1 for volume&mute control */ | ||
3254 | /* Enable GPIO 2 for DMIC-DATA */ | ||
3255 | response = snd_hda_codec_read(codec, codec->afg, 0, 0xF84, 0); | ||
3256 | control = (unsigned char)((response >> 16) & 0x3f); | ||
3257 | snd_hda_codec_write(codec, codec->afg, 0, 0xF82, control); | ||
3258 | |||
3259 | return 0; | ||
3260 | } | ||
3261 | |||
1985 | /* | 3262 | /* |
1986 | * patch entries | 3263 | * patch entries |
1987 | */ | 3264 | */ |
@@ -2022,5 +3299,37 @@ struct hda_codec_preset snd_hda_preset_via[] = { | |||
2022 | .patch = patch_vt1708B_4ch}, | 3299 | .patch = patch_vt1708B_4ch}, |
2023 | { .id = 0x1106E727, .name = "VIA VT1708B 4-Ch", | 3300 | { .id = 0x1106E727, .name = "VIA VT1708B 4-Ch", |
2024 | .patch = patch_vt1708B_4ch}, | 3301 | .patch = patch_vt1708B_4ch}, |
3302 | { .id = 0x11060397, .name = "VIA VT1708S", | ||
3303 | .patch = patch_vt1708S}, | ||
3304 | { .id = 0x11061397, .name = "VIA VT1708S", | ||
3305 | .patch = patch_vt1708S}, | ||
3306 | { .id = 0x11062397, .name = "VIA VT1708S", | ||
3307 | .patch = patch_vt1708S}, | ||
3308 | { .id = 0x11063397, .name = "VIA VT1708S", | ||
3309 | .patch = patch_vt1708S}, | ||
3310 | { .id = 0x11064397, .name = "VIA VT1708S", | ||
3311 | .patch = patch_vt1708S}, | ||
3312 | { .id = 0x11065397, .name = "VIA VT1708S", | ||
3313 | .patch = patch_vt1708S}, | ||
3314 | { .id = 0x11066397, .name = "VIA VT1708S", | ||
3315 | .patch = patch_vt1708S}, | ||
3316 | { .id = 0x11067397, .name = "VIA VT1708S", | ||
3317 | .patch = patch_vt1708S}, | ||
3318 | { .id = 0x11060398, .name = "VIA VT1702", | ||
3319 | .patch = patch_vt1702}, | ||
3320 | { .id = 0x11061398, .name = "VIA VT1702", | ||
3321 | .patch = patch_vt1702}, | ||
3322 | { .id = 0x11062398, .name = "VIA VT1702", | ||
3323 | .patch = patch_vt1702}, | ||
3324 | { .id = 0x11063398, .name = "VIA VT1702", | ||
3325 | .patch = patch_vt1702}, | ||
3326 | { .id = 0x11064398, .name = "VIA VT1702", | ||
3327 | .patch = patch_vt1702}, | ||
3328 | { .id = 0x11065398, .name = "VIA VT1702", | ||
3329 | .patch = patch_vt1702}, | ||
3330 | { .id = 0x11066398, .name = "VIA VT1702", | ||
3331 | .patch = patch_vt1702}, | ||
3332 | { .id = 0x11067398, .name = "VIA VT1702", | ||
3333 | .patch = patch_vt1702}, | ||
2025 | {} /* terminator */ | 3334 | {} /* terminator */ |
2026 | }; | 3335 | }; |